home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / apps / spread / sheet_20 / shtdoc20 / shtdoc20.man < prev   
Text File  |  1988-10-10  |  231KB  |  6,073 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.                                SHEET -- FOR ATARI ST
  26.                  A BASIC interpreter in a spreadsheet environment
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.              Atari, 520 ST and ST are trademarks of Atari Corporation
  49.                     GEM is trademark of Digital Research, Inc.
  50.               Lotus 123 is trademark of Lotus Development Corporation
  51.  
  52.  
  53.  
  54.              Copyright (C) 1988, Chor-ming Lung. All rights reserved.
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.                                  Table of Content                                 ________________                                                 
  73.  
  74.  
  75.      Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   1
  76.  
  77.      Disclaimer  . . . . . . . . . . . . . . . . . . . . . . . . . . . .   1
  78.  
  79.      Requirements  . . . . . . . . . . . . . . . . . . . . . . . . . . .   1
  80.  
  81.      Introduction  . . . . . . . . . . . . . . . . . . . . . . . . . . .   2
  82.  
  83.                                PART I -- TUTORIAL  . . . . . . . . . . .   3
  84.      Example 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   4
  85.      Example 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   9
  86.      Example 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  11
  87.      Example 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  13
  88.      Example 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  15
  89.      Example 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  16
  90.      Example 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  18
  91.      Example 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  19
  92.      Example 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  20
  93.  
  94.                        PART II -- Spreadsheet operations . . . . . . . .  22
  95.  
  96.      MENU SELECTIONS . . . . . . . . . . . . . . . . . . . . . . . . . .  23
  97.           Desk . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  23
  98.                About SHEET . . . . . . . . . . . . . . . . . . . . . . .  23
  99.           File . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  23
  100.                New    N  . . . . . . . . . . . . . . . . . . . . . . . .  23
  101.                Load   L  . . . . . . . . . . . . . . . . . . . . . . . .  23
  102.                Load WKS  . . . . . . . . . . . . . . . . . . . . . . . .  23
  103.                Load PART . . . . . . . . . . . . . . . . . . . . . . . .  23
  104.                Save   S  . . . . . . . . . . . . . . . . . . . . . . . .  23
  105.                Save WKS  . . . . . . . . . . . . . . . . . . . . . . . .  23
  106.                Save PART . . . . . . . . . . . . . . . . . . . . . . . .  23
  107.                Print  P  . . . . . . . . . . . . . . . . . . . . . . . .  23
  108.                Quit   Q  . . . . . . . . . . . . . . . . . . . . . . . .  23
  109.           Sheet  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  23
  110.                Erase . . . . . . . . . . . . . . . . . . . . . . . . . .  23
  111.                Defaults  . . . . . . . . . . . . . . . . . . . . . . . .  23
  112.                Options . . . . . . . . . . . . . . . . . . . . . . . . .  24
  113.                Dates . . . . . . . . . . . . . . . . . . . . . . . . . .  24
  114.           Row/Col  . . . . . . . . . . . . . . . . . . . . . . . . . . .  25
  115.                Insert  I . . . . . . . . . . . . . . . . . . . . . . . .  25
  116.                Delete  D . . . . . . . . . . . . . . . . . . . . . . . .  25
  117.                Col widths  . . . . . . . . . . . . . . . . . . . . . . .  25
  118.           Cells  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  25
  119.                Reformat  R . . . . . . . . . . . . . . . . . . . . . . .  25
  120.                Erase     E . . . . . . . . . . . . . . . . . . . . . . .  25
  121.                Copy      C . . . . . . . . . . . . . . . . . . . . . . .  25
  122.                Move      M . . . . . . . . . . . . . . . . . . . . . . .  25
  123.                Adjust    A . . . . . . . . . . . . . . . . . . . . . . .  25
  124.           Graph  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  25
  125.           Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  26
  126.  
  127.  
  128.                                        - i -
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.      MOVING AROUND . . . . . . . . . . . . . . . . . . . . . . . . . . .  27
  138.  
  139.      EDITING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  28
  140.           Types of cell entry  . . . . . . . . . . . . . . . . . . . . .  28
  141.                Formula . . . . . . . . . . . . . . . . . . . . . . . . .  28
  142.                Constant  . . . . . . . . . . . . . . . . . . . . . . . .  28
  143.                Statement . . . . . . . . . . . . . . . . . . . . . . . .  28
  144.                Command . . . . . . . . . . . . . . . . . . . . . . . . .  28
  145.                Text  . . . . . . . . . . . . . . . . . . . . . . . . . .  28
  146.           Rules for constructing formula . . . . . . . . . . . . . . . .  29
  147.           Cell input . . . . . . . . . . . . . . . . . . . . . . . . . .  30
  148.                Move the editing cursor . . . . . . . . . . . . . . . . .  30
  149.                Modify your input . . . . . . . . . . . . . . . . . . . .  30
  150.                Terminate your input  . . . . . . . . . . . . . . . . . .  30
  151.                Miscellaneous operations  . . . . . . . . . . . . . . . .  30
  152.           Modify a cell  . . . . . . . . . . . . . . . . . . . . . . . .  31
  153.           Editing direction  . . . . . . . . . . . . . . . . . . . . . .  31
  154.  
  155.      CUSTOMIZED DISPLAY  . . . . . . . . . . . . . . . . . . . . . . . .  32
  156.           Change column width  . . . . . . . . . . . . . . . . . . . . .  32
  157.           Default display format . . . . . . . . . . . . . . . . . . . .  33
  158.           Display format:  . . . . . . . . . . . . . . . . . . . . . . .  33
  159.           Block  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  34
  160.           De-select blocks . . . . . . . . . . . . . . . . . . . . . . .  34
  161.           Change display format  . . . . . . . . . . . . . . . . . . . .  35
  162.  
  163.      COPY AND MOVE . . . . . . . . . . . . . . . . . . . . . . . . . . .  36
  164.           Relative and Absolue cell reference  . . . . . . . . . . . . .  37
  165.  
  166.      ERASE CELLS . . . . . . . . . . . . . . . . . . . . . . . . . . . .  38
  167.  
  168.      INSERT AND DELETE . . . . . . . . . . . . . . . . . . . . . . . . .  39
  169.           Row/Column selection . . . . . . . . . . . . . . . . . . . . .  39
  170.  
  171.      LOAD, SAVE AND PRINT  . . . . . . . . . . . . . . . . . . . . . . .  40
  172.           File extension . . . . . . . . . . . . . . . . . . . . . . . .  40
  173.           Load . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  40
  174.           Save . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  40
  175.           Load PART  . . . . . . . . . . . . . . . . . . . . . . . . . .  40
  176.           Save Part  . . . . . . . . . . . . . . . . . . . . . . . . . .  41
  177.           Lotus files  . . . . . . . . . . . . . . . . . . . . . . . . .  41
  178.           Print  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  41
  179.  
  180.                              PART III -- SHEET BASIC . . . . . . . . . .  43
  181.  
  182.      Cells and Variables . . . . . . . . . . . . . . . . . . . . . . . .  44
  183.           Cell reference with dimension  . . . . . . . . . . . . . . . .  44
  184.           Variables  . . . . . . . . . . . . . . . . . . . . . . . . . .  44
  185.           Cell reference with variables  . . . . . . . . . . . . . . . .  44
  186.           String . . . . . . . . . . . . . . . . . . . . . . . . . . . .  45
  187.           String operators           String operators . . . . . . . . . . . . . . . . . . . . . . .  45
  188.  
  189.      Flow control Statements . . . . . . . . . . . . . . . . . . . . . .  47
  190.           IF .. THEN .. ELSE ..  . . . . . . . . . . . . . . . . . . . .  47
  191.           GOTO . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  47
  192.           GOSUB .. RETURN  . . . . . . . . . . . . . . . . . . . . . . .  47
  193.  
  194.                                       - ii -
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.           LOOP .. EXIT IF .. ENDLOOP . . . . . . . . . . . . . . . . . .  47
  204.           FOR .. NEXT  . . . . . . . . . . . . . . . . . . . . . . . . .  48
  205.           RUN  . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  48
  206.  
  207.      I/O Statements  . . . . . . . . . . . . . . . . . . . . . . . . . .  49
  208.           REDIRECT TO  . . . . . . . . . . . . . . . . . . . . . . . . .  49
  209.           PRINT statement  . . . . . . . . . . . . . . . . . . . . . . .  49
  210.  
  211.      Miscellaneous statements  . . . . . . . . . . . . . . . . . . . . .  51
  212.           SAVE SCREEN  . . . . . . . . . . . . . . . . . . . . . . . . .  51
  213.           RESTORE SCREEN . . . . . . . . . . . . . . . . . . . . . . . .  51
  214.           WAIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  51
  215.           DEFINE . . . . . . . . . . . . . . . . . . . . . . . . . . . .  51
  216.           MESSAGE  . . . . . . . . . . . . . . . . . . . . . . . . . . .  52
  217.  
  218.      Text files  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  53
  219.           GET_FILE . . . . . . . . . . . . . . . . . . . . . . . . . . .  53
  220.           OPEN . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  53
  221.           CLOSE  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  53
  222.           INPUT #n . . . . . . . . . . . . . . . . . . . . . . . . . . .  54
  223.           PRINT #n . . . . . . . . . . . . . . . . . . . . . . . . . . .  54
  224.  
  225.      Worksheet commands  . . . . . . . . . . . . . . . . . . . . . . . .  55
  226.           COPY . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  55
  227.           MOVE . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  55
  228.           ERASE  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  55
  229.           REFORMAT . . . . . . . . . . . . . . . . . . . . . . . . . . .  55
  230.           SORT . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  56
  231.           SWAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  56
  232.  
  233.      Console commands  . . . . . . . . . . . . . . . . . . . . . . . . .  57
  234.           CLS  . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  57
  235.           CURSORON . . . . . . . . . . . . . . . . . . . . . . . . . . .  57
  236.           CURSOROFF  . . . . . . . . . . . . . . . . . . . . . . . . . .  57
  237.           VIDEOHIGH  . . . . . . . . . . . . . . . . . . . . . . . . . .  57
  238.           VIDEONORM  . . . . . . . . . . . . . . . . . . . . . . . . . .  57
  239.           GOTOXY . . . . . . . . . . . . . . . . . . . . . . . . . . . .  57
  240.           INKEY  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  58
  241.           UNGET  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  58
  242.           INPUT  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  58
  243.  
  244.      Graphic commands  . . . . . . . . . . . . . . . . . . . . . . . . .  59
  245.           Setup commands . . . . . . . . . . . . . . . . . . . . . . . .  60
  246.                WINDOW  . . . . . . . . . . . . . . . . . . . . . . . . .  60
  247.                VIEWPORT  . . . . . . . . . . . . . . . . . . . . . . . .  61
  248.                SCALE . . . . . . . . . . . . . . . . . . . . . . . . . .  61
  249.                CLEAR . . . . . . . . . . . . . . . . . . . . . . . . . .  61
  250.                EXITGRAPH . . . . . . . . . . . . . . . . . . . . . . . .  61
  251.           Line/Dot commands  . . . . . . . . . . . . . . . . . . . . . .  62
  252.                ATTRIBUTE . . . . . . . . . . . . . . . . . . . . . . . .  62
  253.                LINE  . . . . . . . . . . . . . . . . . . . . . . . . . .  62
  254.                LINE_TO . . . . . . . . . . . . . . . . . . . . . . . . .  62
  255.                PLOT  . . . . . . . . . . . . . . . . . . . . . . . . . .  63
  256.                PLOT DATA . . . . . . . . . . . . . . . . . . . . . . . .  63
  257.                SPLINE  . . . . . . . . . . . . . . . . . . . . . . . . .  63
  258.           Turtlegraphics . . . . . . . . . . . . . . . . . . . . . . . .  64
  259.  
  260.                                       - iii -
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.                FORWARD . . . . . . . . . . . . . . . . . . . . . . . . .  64
  270.                TURN  . . . . . . . . . . . . . . . . . . . . . . . . . .  64
  271.                TURN_TO . . . . . . . . . . . . . . . . . . . . . . . . .  64
  272.           Axis command . . . . . . . . . . . . . . . . . . . . . . . . .  65
  273.                MARKX . . . . . . . . . . . . . . . . . . . . . . . . . .  65
  274.                MARKY . . . . . . . . . . . . . . . . . . . . . . . . . .  65
  275.                LABELX  . . . . . . . . . . . . . . . . . . . . . . . . .  65
  276.                LABELY  . . . . . . . . . . . . . . . . . . . . . . . . .  65
  277.           Text command . . . . . . . . . . . . . . . . . . . . . . . . .  66
  278.                PTEXT . . . . . . . . . . . . . . . . . . . . . . . . . .  66
  279.           Miscellaneous  . . . . . . . . . . . . . . . . . . . . . . . .  67
  280.                MOUSE_POS . . . . . . . . . . . . . . . . . . . . . . . .  67
  281.  
  282.      Tips on using SHEET BASIC . . . . . . . . . . . . . . . . . . . . .  68
  283.           Interrupt  . . . . . . . . . . . . . . . . . . . . . . . . . .  68
  284.           Using previous row format  . . . . . . . . . . . . . . . . . .  68
  285.           Error           Error  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  68
  286.           Multiple statements  . . . . . . . . . . . . . . . . . . . . .  68
  287.           Garbled screen . . . . . . . . . . . . . . . . . . . . . . . .  68
  288.           Adjust . . . . . . . . . . . . . . . . . . . . . . . . . . . .  68
  289.  
  290.      Appendix A BUILT-IN FUNCTIONS . . . . . . . . . . . . . . . . . . .  69
  291.           Math . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  69
  292.                General functions . . . . . . . . . . . . . . . . . . . .  69
  293.                     ABS  . . . . . . . . . . . . . . . . . . . . . . . .  69
  294.                     INT  . . . . . . . . . . . . . . . . . . . . . . . .  69
  295.                     FRAC . . . . . . . . . . . . . . . . . . . . . . . .  69
  296.                     FACT . . . . . . . . . . . . . . . . . . . . . . . .  69
  297.                     SQR  . . . . . . . . . . . . . . . . . . . . . . . .  69
  298.                     SQRT . . . . . . . . . . . . . . . . . . . . . . . .  69
  299.                Trigo & logarithm functions . . . . . . . . . . . . . . .  69
  300.                     SIN  . . . . . . . . . . . . . . . . . . . . . . . .  69
  301.                     COS  . . . . . . . . . . . . . . . . . . . . . . . .  69
  302.                     TAN  . . . . . . . . . . . . . . . . . . . . . . . .  69
  303.                     ASIN . . . . . . . . . . . . . . . . . . . . . . . .  69
  304.                     ACOS . . . . . . . . . . . . . . . . . . . . . . . .  69
  305.                     ATAN . . . . . . . . . . . . . . . . . . . . . . . .  69
  306.                     LOG  . . . . . . . . . . . . . . . . . . . . . . . .  69
  307.                     LN . . . . . . . . . . . . . . . . . . . . . . . . .  69
  308.                     EXP  . . . . . . . . . . . . . . . . . . . . . . . .  69
  309.                     RAD_DEG  . . . . . . . . . . . . . . . . . . . . . .  69
  310.                     DEG_RAD  . . . . . . . . . . . . . . . . . . . . . .  69
  311.                DATE functions  . . . . . . . . . . . . . . . . . . . . .  69
  312.                     DATE . . . . . . . . . . . . . . . . . . . . . . . .  69
  313.                     DAY  . . . . . . . . . . . . . . . . . . . . . . . .  69
  314.                     MONTH  . . . . . . . . . . . . . . . . . . . . . . .  69
  315.                     YEAR . . . . . . . . . . . . . . . . . . . . . . . .  69
  316.                Matrix functions  . . . . . . . . . . . . . . . . . . . .  69
  317.                     INVERSE  . . . . . . . . . . . . . . . . . . . . . .  69
  318.                     TRANSPOSE  . . . . . . . . . . . . . . . . . . . . .  69
  319.           Statistics . . . . . . . . . . . . . . . . . . . . . . . . . .  70
  320.                AVERAGE . . . . . . . . . . . . . . . . . . . . . . . . .  70
  321.                MEDIAN  . . . . . . . . . . . . . . . . . . . . . . . . .  70
  322.                STD . . . . . . . . . . . . . . . . . . . . . . . . . . .  70
  323.                VAR . . . . . . . . . . . . . . . . . . . . . . . . . . .  70
  324.                SQR_SUM . . . . . . . . . . . . . . . . . . . . . . . . .  70
  325.  
  326.                                       - iv -
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.           Miscellaneous  . . . . . . . . . . . . . . . . . . . . . . . .  70
  336.                MAX . . . . . . . . . . . . . . . . . . . . . . . . . . .  70
  337.                MIN . . . . . . . . . . . . . . . . . . . . . . . . . . .  70
  338.                SUM . . . . . . . . . . . . . . . . . . . . . . . . . . .  70
  339.                RAND  . . . . . . . . . . . . . . . . . . . . . . . . . .  70
  340.                IFF . . . . . . . . . . . . . . . . . . . . . . . . . . .  70
  341.                ISEMPTY . . . . . . . . . . . . . . . . . . . . . . . . .  70
  342.                TRUE  . . . . . . . . . . . . . . . . . . . . . . . . . .  70
  343.                FALSE . . . . . . . . . . . . . . . . . . . . . . . . . .  70
  344.                ALERT . . . . . . . . . . . . . . . . . . . . . . . . . .  70
  345.                COL_WIDTH . . . . . . . . . . . . . . . . . . . . . . . .  71
  346.                LAST_ROW  . . . . . . . . . . . . . . . . . . . . . . . .  71
  347.                LAST_COL  . . . . . . . . . . . . . . . . . . . . . . . .  71
  348.                SEARCH  . . . . . . . . . . . . . . . . . . . . . . . . .  71
  349.           Finance  . . . . . . . . . . . . . . . . . . . . . . . . . . .  71
  350.                Future growth . . . . . . . . . . . . . . . . . . . . . .  71
  351.                     GRATE  . . . . . . . . . . . . . . . . . . . . . . .  71
  352.                     GBASE  . . . . . . . . . . . . . . . . . . . . . . .  71
  353.                     GFUTURE  . . . . . . . . . . . . . . . . . . . . . .  71
  354.                Investment  . . . . . . . . . . . . . . . . . . . . . . .  71
  355.                     INVEST_PV  . . . . . . . . . . . . . . . . . . . . .  71
  356.                     INVEST_FV  . . . . . . . . . . . . . . . . . . . . .  72
  357.                     INVEST_INTEREST  . . . . . . . . . . . . . . . . . .  72
  358.                     INVEST_TERM  . . . . . . . . . . . . . . . . . . . .  72
  359.                Loan  . . . . . . . . . . . . . . . . . . . . . . . . . .  72
  360.                     LOAN_PAY . . . . . . . . . . . . . . . . . . . . . .  72
  361.                     LOAN_AMOUNT  . . . . . . . . . . . . . . . . . . . .  72
  362.                     LOAN_TERM  . . . . . . . . . . . . . . . . . . . . .  72
  363.                Withdraw  . . . . . . . . . . . . . . . . . . . . . . . .  72
  364.                     WDRAW_SAVE . . . . . . . . . . . . . . . . . . . . .  72
  365.                     WDRAW_AMOUNT . . . . . . . . . . . . . . . . . . . .  72
  366.                     WDRAW_TERM . . . . . . . . . . . . . . . . . . . . .  72
  367.                Deposit . . . . . . . . . . . . . . . . . . . . . . . . .  72
  368.                     DEPOSIT_FV . . . . . . . . . . . . . . . . . . . . .  72
  369.                     DEPOSIT_AMOUNT . . . . . . . . . . . . . . . . . . .  72
  370.                     DEPOSIT_TERM . . . . . . . . . . . . . . . . . . . .  72
  371.           String functions:  . . . . . . . . . . . . . . . . . . . . . .  72
  372.                FILENAME$ . . . . . . . . . . . . . . . . . . . . . . . .  72
  373.                BUF$  . . . . . . . . . . . . . . . . . . . . . . . . . .  72
  374.                MID$  . . . . . . . . . . . . . . . . . . . . . . . . . .  72
  375.                LEFT$ . . . . . . . . . . . . . . . . . . . . . . . . . .  73
  376.                RIGHT$  . . . . . . . . . . . . . . . . . . . . . . . . .  73
  377.                SPACE$  . . . . . . . . . . . . . . . . . . . . . . . . .  73
  378.                CHR$  . . . . . . . . . . . . . . . . . . . . . . . . . .  73
  379.                STR$  . . . . . . . . . . . . . . . . . . . . . . . . . .  73
  380.                VAL . . . . . . . . . . . . . . . . . . . . . . . . . . .  73
  381.                LEN:  . . . . . . . . . . . . . . . . . . . . . . . . . .  73
  382.                POS . . . . . . . . . . . . . . . . . . . . . . . . . . .  74
  383.  
  384.      Appendix B CONTROL KEYS . . . . . . . . . . . . . . . . . . . . . .  74
  385.           Non-editing  . . . . . . . . . . . . . . . . . . . . . . . . .  74
  386.           Editing  . . . . . . . . . . . . . . . . . . . . . . . . . . .  75
  387.  
  388.      Appendix C Program specification  . . . . . . . . . . . . . . . . .  75
  389.  
  390.      Appendix D Lotus and SHEET  . . . . . . . . . . . . . . . . . . . .  76
  391.  
  392.                                        - v -
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.      Appendix E Recalculation  . . . . . . . . . . . . . . . . . . . . .  77
  403.  
  404.      Appendix F FILE FORMAT  . . . . . . . . . . . . . . . . . . . . . .  78
  405.           Header for SHT . . . . . . . . . . . . . . . . . . . . . . . .  78
  406.           Cell contents for SHT format . . . . . . . . . . . . . . . . .  78
  407.           Header for PRT . . . . . . . . . . . . . . . . . . . . . . . .  78
  408.           Cell contents for PART format  . . . . . . . . . . . . . . . .  78
  409.  
  410.      Appendix G Problems . . . . . . . . . . . . . . . . . . . . . . . .  78
  411.  
  412.      Biorthym program  . . . . . . . . . . . . . . . . . . . . . . . . .  80
  413.  
  414.      Calendar program  . . . . . . . . . . . . . . . . . . . . . . . . .  82
  415.  
  416.      Roots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  84
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.                                       - vi -
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  468.  
  469.      Preface:     ________
  470.                I have  used spreadsheet  programs for  quite a while. I feel
  471.           they are fantastic tools. I am quite familiar with Lotus  123. One
  472.           thing that  I feel  terrible is  its MACRO  language. It is not as
  473.           user-friendly as its display. I feel  that BASIC  is more powerful
  474.           and yet easier to use than MACRO.
  475.  
  476.                Thinking that  may be profitable to write a BASIC interpreter
  477.           in a spreadsheet environment,  I started  to write  the program on
  478.           Oct.  1987.  After  a  few  months'  struggle,  I have created the
  479.           program and named it SHEET.
  480.  
  481.                Making SHEET as shareware,  I uploaded  the first  version on
  482.           February 1988 to GEnie and CompuServe. Right now, SHEET can do not
  483.           only numerical calculation, but  also, graphic,  string operations
  484.           and text  files access. Its growth depends on you. If you like it,
  485.           please send me $25 or whatever you think  it is  worth. My address
  486.           is:
  487.  
  488.                                Mr. Chor-ming Lung
  489.                               330 Tremont St A-708
  490.                                 Boston, MA 02116
  491.                                      U.S.A.
  492.  
  493.                You can  also send  your comments or suggestions by Email. My
  494.           addresses are:
  495.                                    GEnie: LUNG
  496.                               CompuServe: 72740,40
  497.  
  498.                If you have access of GEnie, you can also leave  your message
  499.           on the bulletin board. It is Page 475, Category 2, Topic 28.
  500.  
  501.  
  502.      Disclaimer:     __________
  503.                I  have  made  every  effort  to  insure  the accuracy of the
  504.           program. However, there is no warranty  either express  or implied
  505.           for its uses.
  506.  
  507.  
  508.      Requirements:     ____________
  509.           * Atari 520 ST or 1040 ST with disk drive(s).
  510.           * Monochrome or color monitor.
  511.           * SHEETxxx.PRG, CALC.RSC and SHEET.CFG on the same directory. (xxx
  512.             is the version number of SHEET. Currently, it  is SHEET20.PRG or
  513.             version 2.0)
  514.           * You must know how to operate with GEM.
  515.           * Some BASIC programming experience is desirable if you want to
  516.             use SHEET BASIC effectively.
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.                                      Page 1
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  534.  
  535.      Introduction:     ____________
  536.  
  537.           Thank you  for using  SHEET. SHEET is a combination of spreadsheet
  538.      and BASIC. The  spreadsheet  functions  and  commands  make  this BASIC
  539.      interpreter a  lot easier to handle data and the BASIC interpreter make
  540.      the spreadsheet a lot powerful  than  many  other  spreadsheet programs
  541.      commercially available.
  542.  
  543.           The arrangement  of this manual consists of three parts. The first
  544.      part consists of 9 example worksheets  as a  tutorial. The  second part
  545.      shows the details of how to use the spreadsheet commands. The last part
  546.      consists of BASIC commands and their usage.
  547.  
  548.           If you have problems in locating cell cursor  with the  mouse, you
  549.      should  read  Appendix  G.  You  should  read  example 1 thoroughly. It
  550.      contains informations for operating the  spreadsheet.  Example  3  is a
  551.      trivial  program  but  it  is  an  important  one  too.  If  you do not
  552.      understand the  cell  reference  method  in  this  program.  You cannot
  553.      understand the  rest examples.  I have tried my best to describe how it
  554.      works. If you still have problem, you should  read PART  III about cell
  555.      reference.
  556.  
  557.           There are  three "big" program listings after the Appendixes. They
  558.      use many commands of SHEET BASIC. You should not miss them too.
  559.  
  560.           Finally,  I  would  like  to  thank  all  the  users  who  provide
  561.      suggestions to make SHEET more useful and reliable. I like to thank Mr.
  562.      Donald A. Edwards and  Dr. Stan  Liebowitz specifically.  Without their
  563.      enthusiasm, I  can hardly imagine some of the features found in version
  564.      2.0. If you have made suggestions but they are not  implemented yet, it
  565.      is not  because they  are being  ignored. Instead, I do not have enough
  566.      time to get everything done on this version.
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.                                      Page 2
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  600.  
  601.                                PART I -- TUTORIAL
  602.  
  603.      Example 1: "AMORT.SHT"
  604.                This example shows you how to  operate with  SHEET. A  lot of
  605.           the basic  ideas of  how to  use the  mouse and your keyboard with
  606.           your worksheet are being introduced. If you understand it, you can
  607.           read PART II without any difficulty.
  608.  
  609.      Example 2: "ROSES.SHT"
  610.                This example  shows you  some advanced feature of spreadsheet
  611.           design. It introduces  the  idea  of  absolute  and  relative cell
  612.           reference.
  613.  
  614.      Example 3: "RANDOM.SHT"
  615.                This example  is a  simple SHEET BASIC program. The main idea
  616.           introduces in this example is a new cell reference method. You can
  617.           use  the  cell  as  a  cell  reference  or as a BASE which you can
  618.           stretch horizontally or vertically.
  619.  
  620.      Example 4: "LOTTERY.SHT"
  621.                This example shows you  how  to  print  your  output  to your
  622.           printer. It  generates 6 different numbers from 1 to 36, and sorts
  623.           those numbers in ascending order, and then prints those numbers to
  624.           your printer.
  625.  
  626.      Example 5: "FTEST.SHT"
  627.                This file shows you the commands for ASCII file accesses.
  628.  
  629.      Example 6: "NUMBER.SHT"
  630.                This file  shows you  how to  use the file access commands to
  631.           retrieve  data  stored  in  ASCII  file  and  then  put  them into
  632.           individual cells.
  633.  
  634.      Example 7: "GRID.SHT"
  635.                This first  graphic program  shows the basic process of using
  636.           the graphic commands.
  637.  
  638.      Example 8: "SINCURVE.SHT"
  639.                This file shows you how to draw a sine curve with the graphic
  640.           commands.
  641.  
  642.      Example 9: "SPLINE.SHT"
  643.                This file  shows you  how to  draw graph using data stored in
  644.           your worksheet.
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.                                      Page 3
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  666.  
  667.  
  668.      Example 1:     _________      AMORT.SHT
  669.  
  670.                Amortization means killing something bit by bit. That  is the
  671.           way we handle loans -- we pay little by little.
  672.  
  673.                Suppose  you  are  trying  to borrow $100,000. Your financial
  674.           company provides two options for this loan.
  675.                -    30 years with annual interest rate 9%
  676.                -    20 years with annual interest rate 10.5%
  677.           Intuitively, you may choose  option 1.  Well, let  us analyze this
  678.           problem with SHEET and see whether it is a wise choice.
  679.  
  680.                First, we  have to design our layout. We plan to use column A
  681.           for labels, column B for option  1  and  column  C  for  option 2.
  682.           Following are the steps for creating the template:
  683.  
  684.                Cell entry     Cell cursor    Menu option/Description
  685.           ---------------------------------------------------------
  686.                                              Find  menu  title  "Sheet"  and
  687.                                              select "Defaults".  Choose Text
  688.                                              justification  for  Center  (^)
  689.                                              and select OK.
  690.                               B1             To move your cell cursor to B1,
  691.                                              either move the mouse cursor to
  692.                                              B1 and click the  mouse button,
  693.                                              or use  the arrow  keys to move
  694.                                              the cell cursor. If you use the
  695.                                              mouse to  move your cell cursor
  696.                                              and   if    the   cell   cursor
  697.                                              disappears,   then  you  should
  698.                                              refer to Appendix F.
  699.                Option 1<Return>              Type "Option  1"  and terminate
  700.                                              it with <Return> key.
  701.                               C1             Press the  -> arrow key to move
  702.                                              from cell B1 to C1.
  703.                Option 2<Return>
  704.                               B2
  705.                \-<Return>                    Type "\-" and terminate it with
  706.                                              <Return> key.
  707.                               C2
  708.                \-<Return>
  709.                                              Find  menu  title  "Sheet"  and
  710.                                              choose "Defaults".  Choose Text
  711.                                              justification for Right (")
  712.                               A3
  713.                Amount borrowed<Return>
  714.                               A4
  715.                Annual interest rate<Return>
  716.                               A5
  717.                Total number of terms<Return>
  718.                               A6
  719.                Terms per year<Return>
  720.                               A7
  721.  
  722.                                      Page 4
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  732.  
  733.                \-<Return>
  734.                               B7
  735.                \-<Return>
  736.                               C7
  737.                \-<Return>
  738.                               A8
  739.                Payment<Return>
  740.  
  741.  
  742.  
  743.                "\-" means  to fill  up the  cell with "-". You should notice
  744.           that entries on column A occupy some areas of column  B and  C. We
  745.           need to enlarge the width of column A to make rooms for entries on
  746.           column B and C. To widen  column A,  you need  to place  the mouse
  747.           pointer within  the gap  between column  letter A and B. Press the
  748.           mouse button and drag it to the right hand side. (Alternately, you
  749.           can select  the menu  item "Col widths", enter the column name and
  750.           your desired width.) When you press and drag you mouse, you should
  751.           see the  rubber box  expanding.  If the rubber box is large enough
  752.           to cover all the characters of column A, then you can release your
  753.           mouse button. Every text in column A is right justified now.
  754.  
  755.                Well, a  template without  formulas is not a template at all.
  756.           The formula we need for this  calculation is  "LOAN_PAY". It needs
  757.           four arguments  --   amount borrowed,  annual interest rate, total
  758.           number of terms, terms per year.  That is "LOAN_PAY(B3,B4,B5,B6)".
  759.           If you enter the above line into cell B8, SHEET will treat it as a
  760.           TEXT string  instead  of  formula.  That  is  because  the leading
  761.           character of  a cell entry determines its type. A cell starts with
  762.           "+", "-", digit, "(" or "." is a formula. A cell starts with alpha
  763.           character is  a TEXT  string. A  '+' symbol before "LOAN_PAY" will
  764.           tell SHEET to treat it as  a formula.  (NOTE: If  you are  used to
  765.           Lotus  123,  you  may  tempt  to add @ symbol before "LOAN_PAY". @
  766.           symbol in SHEET has different meaning. All the  functions in SHEET
  767.           does  not  require  @  symbol.)  Here  is  the  steps for entering
  768.           "+loan_pay(b3,b4,b5,b7)" on cell B8 and copy the content  of B8 to
  769.           C8.
  770.  
  771.  
  772.                Entry     Mouse     Mouse button   Editing buffer
  773.                          cursor                   display
  774.           --------------------------------------------------------------
  775.                +loan_pay(                         +loan_pay(
  776.                          B3
  777.                                    Mouse click    +loan_pay(B3
  778.                          B4
  779.                <Control>+          Mouse click    +loan_pay(B3,B4
  780.                          B5
  781.                <Control>+          Mouse click    +loan_pay(B3,B4,B5
  782.                          B6
  783.                <Control>+          Mouse click    +loan_pay(B3,B4,B5,B6
  784.                )                                  +loan_pay(B3,B4,B5,B6)
  785.                <Return>
  786.                          B8
  787.  
  788.                                      Page 5
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  798.  
  799.                <Control>+          Mouse click
  800.                          C8
  801.                <Control>+          Mouse click
  802.                <Control C>
  803.                <Return>
  804.  
  805.  
  806.  
  807.           "<Control>+Mouse click" means press the Control key and left mouse
  808.           button simultaneously.  SHEET  is case-insensitive.  It will treat
  809.           "loan_pay"  as  "LOAN_PAY".  After  those  steps,  you  should see
  810.           0.1e+38 on both B8 and C8. Don't panic. You are not suppose to pay
  811.           that  much  money  even  you    borrow  nothing. This number means
  812.           calculation  error.  During  calculation,  Lotus  uses   11  bytes
  813.           (instead of  8 bytes) to store real number. Special bit pattern is
  814.           set in these 11 bytes to  represent ERR.  Unfortunately, I  do not
  815.           have that  much energy to create my own math package. So, I choose
  816.           the largest number to represent error.
  817.  
  818.                It seems column B and column C are  too close  to each other.
  819.           You should  be able  to change  the column width of column B and C
  820.           without any difficulty now. How wide should they  be? It  is up to
  821.           you.
  822.  
  823.  
  824.                It is time to enter our data to do analysis.
  825.  
  826.                Entry          Cell cursor
  827.           -----------------------------------
  828.                               B3
  829.                100000 <Down arrow>
  830.                               B4
  831.                0.09 <Return>
  832.                               B5
  833.                360 <Return>
  834.                               B6
  835.                12 <Return>
  836.  
  837.  
  838.  
  839.                After you  have typed 100000, you terminate your input by the
  840.           down arrow key. This action changes the editing direction to DOWN.
  841.           Whenever you  terminate your  input with <Return>, the cell cursor
  842.           will automatically move DOWN.  B3 holds  the $100,000  you want to
  843.           borrow. B4  holds the  annual interest rate 9%. B5 holds the total
  844.           number of terms you must pay back to your financial company. It is
  845.           supposed to  be a  monthly payment.  You have to pay 12 times each
  846.           year. Hence, the total number is 30*12 or 360. B6 holds the number
  847.           of terms  per year.  It is  12. NOTE: if your payment is collected
  848.           quarterly, then B6 should be 4 and B5 should be 30*4 or 120.
  849.  
  850.                It is an exercise for you to enter 100000, 0.105,  240 and 12
  851.           into cells  C3, C4,  C5, and C6 are  respectively. The payment for
  852.           option 1 is 804.622617 and it is 998.379887 for option 2. Probably
  853.  
  854.                                      Page 6
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  864.  
  865.           your financial  company will  ask you  to pay  $804.62 and $998.38
  866.           respectively.  To  reflect  this  fact,  you  must  reformat  your
  867.           display. We  need to change B3..C3 and B8..C8 to DOLLAR format and
  868.           B4..C4 to percent (%) format.
  869.  
  870.  
  871.  
  872.                Key       Mouse button   Mouse cursor position
  873.           ----------------------------------------------------
  874.                                         B3
  875.                <Control>+Mouse click
  876.                                         C3
  877.                <Shift>+  Mouse click
  878.                                         B8
  879.                <Control>+Mouse click
  880.                                         C8
  881.                <Shift>+  Mouse click
  882.                <Control R>
  883.                          Select DOLLAR
  884.  
  885.  
  886.  
  887.                The above operations define two blocks. <Control>+mouse click
  888.           on a  cell defines the start of a block and <Shift>+Mouse click on
  889.           a cell defines the end of a block. The first  block is  B3..C3 and
  890.           the  second  block  is  B8..C8. <Control R> activates the reformat
  891.           dialog box. Selection DOLLAR will change cells contained  in those
  892.           blocks to DOLLAR format. I think it is an easy exercise for you to
  893.           change B4..C4 to percent format.
  894.                The payment just tells us we need to pay more for less terms.
  895.           That is  natural. The hidden truth is: we pay more money in option
  896.           1 than option 2.  How can  we find  it? Well,  we pay  804.62 each
  897.           month, and we need to do it 360 times. So, the total amount we pay
  898.           for option 1 is 360*804.62, and 240*998.38 for  option 2.  In cell
  899.           A9, enter  "Total payment".  In B9,  enter 360*b8 and in C9, enter
  900.           240*c8. Comparing the results on B9 and C9, you will  find you pay
  901.           $50,000 less in option 2. So, if you can affort $998.38 per month,
  902.           you should choose option 2.
  903.  
  904.                Now, it  is up  to you  whether you  want to  save your first
  905.           worksheet.  If  you  think  you  don't need it any more. Press the
  906.           window close button and SHEET will give you a last  chance to save
  907.           it. If  you want to save it for future reference, you should press
  908.           <Control S> and enter the file  name in  the file  selector dialog
  909.           box.
  910.  
  911.                You may  even want  to print  it out to show your spouse that
  912.           his/her decision is right or wrong. The following steps will print
  913.           cells A1..C10.
  914.                Key       Mouse button   Mouse cursor
  915.           ----------------------------------------------------
  916.                                         A1
  917.                <Control>+Mouse click
  918.                                         C10
  919.  
  920.                                      Page 7
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  930.  
  931.                <Shift>+  Mouse click
  932.                <Control P>
  933.                Fill out the Print dialog box
  934.                <Return>
  935.  
  936.  
  937.  
  938.  
  939.           After this  example, I assume you can operate this program without
  940.      any difficulty. The  tedious  description  of  cell  entries  and mouse
  941.      operations will not appear in the following examples.
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.                                      Page 8
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  996.  
  997.  
  998.      Example 2:     _________      ROSES.SHT
  999.  
  1000.                This  is  an  inventory  problem. Assume that you are selling
  1001.           roses. Each dozen costs 4  dollars  and  you  are  selling  for 12
  1002.           dollars per dozen. According to your pass experience, you know the
  1003.           probabilities you can sell 10 dozens, 11 dozens, 12 dozens  in one
  1004.           day  are  0.60,  0.23,  0.17.  How many dozens of roses should you
  1005.           order to get the best profit?
  1006.  
  1007.             PROFIT= 12 * actual number of dozens sold - 4 * number of dozens
  1008.                     ordered
  1009.  
  1010.           For example, if you order 11 dozens and you sell only 10 dozens of
  1011.           them, then you earn:
  1012.                PROFIT = 12*10-4*11=76
  1013.  
  1014.           Here  we  need  to  create  the   array  of   profits  for  actual
  1015.           calculation.
  1016.  
  1017.                ordered/  10   11   12
  1018.                sold
  1019.                10        80   76   72
  1020.                11        80   88   84
  1021.                12        80   88   96
  1022.  
  1023.           You may  ask what  is the  meaning of  ordered 10  and sold 11? It
  1024.           means you  sell all  the 10  dozens of  roses and  still there are
  1025.           customers  asking  for  roses.  The  number of roses sold includes
  1026.           actual number  of  dozens  sold  and  number  of  dozens customers
  1027.           asking. If  you have  sold all the roses you have, you cannot give
  1028.           anything to the late customers. So, your profit is 12*10-4*10=80.
  1029.  
  1030.           If you are using calculator to find out those number, then you are
  1031.           not a  good spreadsheet  user. To  calculate the profit table, you
  1032.           must use formula. Now, we  assume  that  the  numbers  ordered are
  1033.           stored from  C1..E1 and  the numbers  sold are stored from B3..B5.
  1034.           The function we need is IFF which means IF Function (I choose this
  1035.           name because  IF is  a reserved key word for BASIC). This function
  1036.           require 3 arguments. The  first one  is a  conditional expression,
  1037.           the second  one is  an expression  returned when  the condition is
  1038.           true, the last one is an expression returned when the condition is
  1039.           false.
  1040.  
  1041.           Here is  the logic:  IF the  number of  dozens we order is greater
  1042.           than the number of dozens we sell, we use the following formula to
  1043.           calculate PROFIT:
  1044.                PROFIT = 12 * dozens ordered - 4 * dozens sold
  1045.           That is  because we can sell no more than we ordered. On the other
  1046.           hand, if the number  of dozens  we order  is not  greater than the
  1047.           number of  dozens we sell, then we can sell as many as we can. The
  1048.           PROFIT will be:
  1049.                PROFIT = 12 * dozens sold - 4 * dozens ordered
  1050.  
  1051.  
  1052.                                      Page 9
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  1062.  
  1063.           So, we enter the following formula in C3:
  1064.                +IFF(C1<B3,12*C1-4*C1,12*B3-4*C1)
  1065.  
  1066.           Now, we can copy this formula to the rest of  the table.  The COPY
  1067.           command does not handle overlap cells correctly. So, we need to do
  1068.           it twice. The first COPY copies  C3 to  C4..C5 and  the second one
  1069.           copies C3 to D3..E5.
  1070.  
  1071.           If you compare the result you get from SHEET with the above table,
  1072.           you may say, column C is correct, but  column D  and E  is totally
  1073.           different. What  is wrong?  Let us examine the content in cell D3.
  1074.           It is:
  1075.                +IFF(D1<C3,12*D1-4*D1,12*C3-4*D1)
  1076.           COPY command will copy  the source  to destination  and modify the
  1077.           destination cell  if its content refers to other cells. The column
  1078.           letter in C3 is increased by one in  D3. Let  us examine  the cell
  1079.           content in cell D4. It is:
  1080.                +IFF(D2<C4,12*D2-4*D2,12*C4-4*D2)
  1081.           In cell  D4, not  only the  column letter changes but also the row
  1082.           number changes. Well,  the  cell  reference  we  choose  is called
  1083.           relative cell reference. We want COPY command just changes what we
  1084.           want but not every cell reference. To do this, we need to  add a $
  1085.           symbol before  the column  letter or the row number. The corrected
  1086.           formula for cell B3 should be:
  1087.                +IFF(C$1<$B3,12*C$1-4*C$1,12*$B3-4*C$1)
  1088.           and you should do the COPY again.
  1089.  
  1090.           Now, we need to find the EXPECTED PROFIT. It is:
  1091.                EP = prob selling 10 * PROFIT selling 10 + prob selling  11 *
  1092.                     PROFIT selling 11 + prob selling 12 * PROFIT selling 12
  1093.           You can  setup the one formula and copy it to find EP for ordering
  1094.           10, 11 and 12.  But  you  can  also  use  the  MATRIX  function to
  1095.           calculate it  easily. Assume  we put the probabilities (0.6, 0.23,
  1096.           0.17) in cells C7..E7. Enter  "Expected  profit"  in  cell  A8 and
  1097.           enter the  formula "+matrix(c8,[c7..e7]*[c3..e5])  in cell A7. You
  1098.           should get 80, 80.8 and 78.84 in cells  C8..E8. Hence  to get more
  1099.           profit, you should order 11 dozens of roses.
  1100.  
  1101.  
  1102.  
  1103.  
  1104.           The above  two examples  show you  some fundamental operations and
  1105.      calculations for using SHEET. The following examples will  show you how
  1106.      to program in SHEET BASIC. Some BASIC experience is required.
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.                                      Page 10
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  1128.  
  1129.  
  1130.      Example 3     _________      RANDOM.SHT
  1131.  
  1132.                Now,  I  am  going  to  show  you  the  unusual  part of this
  1133.           spreadsheet program  -- the  BASIC interpreter.  This example will
  1134.           generate  100  random  numbers  and calculate the AVERAGE, MEDIAN,
  1135.           MINIMUM,  MAXIMUM,  VARIANCE  and  STANDARD  DEVIATION   of  those
  1136.           numbers.  "C1        :  !R=0" means that cell C1 has the statement
  1137.           "!R=0". If you want to enter the program yourself, you should move
  1138.           your cell  cursor to  C1 and  then enter "!R=0" without the double
  1139.           quotes.    To  run  the  following  BASIC  program,   please  load
  1140.           "RANDOM.SHT" and enter "@run c1" without the double quotes in your
  1141.           editing buffer.
  1142.  
  1143.      C1    : !R=0
  1144.      C2    : ! LOOP 
  1145.      C3    : ! EXIT  IF R=100
  1146.      C4    : !A1[0,R]= RAND
  1147.      C5    : !R=R+1
  1148.      C6    : ! ENDLOOP 
  1149.      C7    : !B3= AVERAGE(A1..A100)
  1150.      C8    : !B4= STD(A1..A100)
  1151.      C9    : !B5= VAR(A1..A100)
  1152.      C10   : !B6= MIN(A1..A100)
  1153.      C11   : !B7= MAX(A1..A100)
  1154.      C12   : !B8= MEDIAN(A1..A100)
  1155.  
  1156.                The above listing  is  printed  by  SHEET.  Here  is  a brief
  1157.           explanation for each line.
  1158.  
  1159.      C1:  R is  a variable  and its  content is initialized to 0. There is a
  1160.           fundamental difference between SHEET  BASIC and  traditional BASIC
  1161.           in  handling  variables  --  YOU MUST initialize all the variables
  1162.           first. If any calculation  involved with  uninitialized variables,
  1163.           you will  be flagged and SHEET BASIC will terminate its operation.
  1164.           Other BASICs treat uninitialized variables as zero. You may have a
  1165.           hard time  to check  typo errors.  So, I FORCE users to initialize
  1166.           variables to eliminate this problem.
  1167.      C2:  LOOP is not available in other  BASICs. This  flow control command
  1168.           is from  Modula-2. I  think sometimes  it is  better than WHILE ..
  1169.           WEND.
  1170.      C3:  EXIT IF is part of LOOP statement. It is an exit for  the LOOP. If
  1171.           the  conditional  expression  for  EXIT  IF is true, then the next
  1172.           command being executed is the one following ENDLOOP.
  1173.      C4:  RAND is the random number generating function. The  left hand side
  1174.           of  the  assignment  statement  is  A1[0,R]  which is a new way to
  1175.           access or store result in cells. We treat cells in  spreadsheet as
  1176.           two  dimensional  array.  You  can  use  the column letter and row
  1177.           number as a cell reference or use the cell reference as a BASE and
  1178.           increases  the  BASE  vertically  or  horizontally by two numbers.
  1179.           These two numbers are separated by comma and  embraced by  "[" and
  1180.           "]". For  example A2[3,4]  is equivalent  to D6. (We assume column
  1181.           letter A is 1 and B  is  2  and  so  on.  A2=[1,2]  and  A2[3,4] =
  1182.           [1,2]+[3,4] =  [4,6]= D6).  In the above listing, if R=12, A1[0,R]
  1183.  
  1184.                                      Page 11
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  1194.  
  1195.           is referred to cell A13 (A1[0,12] = [1,1]+[0,12] = [1,13] = A13).
  1196.      C5:  Increase the variable R by one.
  1197.      C6:  ENDLOOP statement will force the BASIC  interpreter jumps  back to
  1198.           C3 and test whether R=100. If it is, then the next statement being
  1199.           executed is in C7.
  1200.      C7:  Stores the AVERAGE values of the 100 random number in cell B3
  1201.      C8:  Stores the STANDARD DEVIATION in cell B4
  1202.      C9:  Stores the VARIANCE in cell B5
  1203.      C10: Stores the minimum value to B6
  1204.      C11: Stores the maximum value to B7
  1205.      C12: Stores the MEDIAN in cell B8
  1206.  
  1207.  
  1208.  
  1209.                The logic of the above program will be  more straight forward
  1210.           if we use FOR .. NEXT statement..
  1211.  
  1212.                You  can  generate  100  numbers  by  using  the  spreadsheet
  1213.           commands only.  In cell  A1, enter  "+rand". COPY  a1 to a2..a100.
  1214.           Enter "+average(a1..a100)" in cell b3 and so on.
  1215.  
  1216.  
  1217.                Well, there  are some  difference between these two approach.
  1218.           If you want to get another  set of  random numbers,  you can "@run
  1219.           c1" again. But if you are using the spreadsheet commands, you must
  1220.           COPY it over and  over again  to get  another 100  random numbers.
  1221.           Those AVERAGE,  MIN,MAX ..  functions will hinder your inputs when
  1222.           you are in automatic recalculation mode.
  1223.  
  1224.                If you are programming in traditional  BASICs, you  know that
  1225.           it is  inconvenient to  view the  array which holds the 100 random
  1226.           numbers and you need  to write  a lot  of subroutine  to calculate
  1227.           AVERAGE,MIN,MAX   ....   SHEET   provides   you   the  spreadsheet
  1228.           functionality to help you to handle your date easily and the BASIC
  1229.           interpreter  helps  the  spreadsheet  perform  something that many
  1230.           other spreadsheet users cannot  dream  of.  That  is  some  of the
  1231.           benefit   of   having   a   BASIC  interpreter  in  a  spreadsheet
  1232.           environment.
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.                                      Page 12
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  1260.  
  1261.  
  1262.      Example 4:     _________      LOTTERY.SHT
  1263.                Everyone wants to be rich. Here is a  program in  SHEET BASIC
  1264.           which may  help you  to get  rich. Well, if you do get any profit,
  1265.           please  share  it  with  me  (grin).  This  is  a  lottery numbers
  1266.           generating program. Here is the listing from SHEET.
  1267.  
  1268.      C1    : ! REDIRECT  TO "prn:"
  1269.      C2    : !R=1
  1270.      C3    : ! LOOP 
  1271.      C4    : !A1[0,R]= INT( RAND*36+1)
  1272.      C5    : !J=1:F= TRUE
  1273.      C6    : ! LOOP 
  1274.      C7    : ! EXIT  IF J=R
  1275.      C8    : ! IF A1[0,J]=A1[0,R] THEN F= FALSE
  1276.      C9    : ! EXIT  IF F= FALSE
  1277.      C10   : !J=J+1
  1278.      C11   : ! ENDLOOP 
  1279.      C12   : ! IF F= TRUE THEN R=R+1
  1280.      C13   : ! EXIT  IF R=7
  1281.      C14   : ! ENDLOOP : SAVE  SCREEN 
  1282.      C15   : ! SORT "A", A2..A7, A1
  1283.      C16   : ! PRINT A2,A3,A4,A5,A6,A7
  1284.      C17   : ! WAIT : RESTORE  SCREEN : EXITGRAPH 
  1285.  
  1286.           Here is a brief explanation.
  1287.      C1:  REDIRECT TO  a file.  This I/O  redirection command causes all the
  1288.           subsequent PRINT commands output to the file specified.  There are
  1289.           some  pre-defined  files.  "prn:"  is  the  printer, "con:" is the
  1290.           monitor and "aux:" is the rs-232 port.
  1291.      C2:  R is a loop counter.
  1292.      C3:  The outer loop for generating 6 different numbers.
  1293.      C4:  INT( RAND*36+1) will generate a random  number from  1 to  36, and
  1294.           this number  is stored  from A2..A7  depends on the value of R. If
  1295.           R=1 then A1[0,R] will be A2  (Remember  A1  is  the  BASE  and its
  1296.           coordinate is [1,1], A1[0,R] = [1,1]+[0,1]=[1,2] = A2).
  1297.      C5:  J is another loop counter which increases from 1 to R. F is a flag
  1298.           to see whether the previous generated number has been picked. F is
  1299.           TRUE  means  no  it  is  not.  By the way, TRUE and FALSE are pre-
  1300.           defined constants. TRUE is equal to 1 and FALSE is 0.
  1301.      C6:  An inner loop to check whether the last number has been picked.
  1302.      C7:  If J=R, it means we check every numbers.
  1303.      C8:  Otherwise, compares each old numbers with  the new  number, if one
  1304.           of them are equal to it, then we set F to FALSE
  1305.      C9:  Well, this  is the second EXIT IF statement within a LOOP. You can
  1306.           have multiple EXIT IF within a LOOP. There is no limit about it.
  1307.      C10: Increase J by 1
  1308.      C11: End of the inner loop
  1309.      C12: If no numbers is equal, then we request for another random number.
  1310.      C13: If 6 numbers have been picked, the loop should be terminated.
  1311.      C14: SAVE SCREEN is a command  to  save  your  current  display.  It is
  1312.           useful if you are printing on screen.
  1313.      C15: SORT is  a worksheet  command which  sort a block in descending or
  1314.           ascending order. The  first  string  "A"  tells  SORT  to  sort in
  1315.  
  1316.                                      Page 13
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  1326.  
  1327.           ascending order. A2..A7 is the block being sorted and A1 holds the
  1328.           column that we used for determining  the  place  where  we  try to
  1329.           compare.
  1330.      C16: PRINT cell  A2 to  A7. You  can use comma or semicolon to separate
  1331.           each item for PRINT statement.  Comma  will  make  the  next print
  1332.           position align to 10 characters wide tab.
  1333.      C17: WAIT is  useful when  you output  the data to screen. It stops all
  1334.           the process just wait for you to press <Return> key.  It should be
  1335.           placed before  you restore  your screen.  SORT will not change the
  1336.           appearance of the updated  cells. We  need to  refresh the screen.
  1337.           EXITGRAPH is  a command to refresh the screen. By the way, you can
  1338.           update your screen manually by pressing <Alt-F>.
  1339.  
  1340.  
  1341.                One thing you may notice in this program  is I/O redirection.
  1342.           Here is  a reason why you need to redirect your data to disk file.
  1343.           A user from Canada told me that his  JUKI 6100  Daisywheel printer
  1344.           does not respond to the "end of line" character. So, he prints his
  1345.           worksheet to disk and then use 1st Word  to print  it. If  I don't
  1346.           support I/O redirection in SHEET BASIC, he may need to buy another
  1347.           printer or stop using SHEET..
  1348.  
  1349.                Currently, SHEET BASIC has  command to  redirect output only.
  1350.           Future version should provide input redirection.
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.                                      Page 14
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  1392.  
  1393.      Example 5:     _________      FTEST.SHT
  1394.  
  1395.                The file  name of  this example  is "FTEST.SHT".  A1..A5 is a
  1396.           program testing the output file  commands.  A7..A13  is  a program
  1397.           testing the  input file  commands. To  run it, enter "@run a1" and
  1398.           "@run a7" separately.
  1399.  
  1400.      A1     :! OPEN "o",#1,"test.txt"
  1401.      A2     :! PRINT #1,"123,456 789": PRINT #1
  1402.      A3     :! PRINT #1,"5623.23,84.38 723.12"
  1403.      A4     :! CLOSE #1
  1404.      A5     :! END 
  1405.  
  1406.      A7     :! GET_FILE "\*.txt", FILENAME$
  1407.      A8     :! OPEN "i",#1, FILENAME$
  1408.      A9     :!R=1: SAVE  SCREEN 
  1409.      A10    :! LOOP 
  1410.      A11    :! INPUT #1, BUF$
  1411.      A12    :! PRINT  BUF$
  1412.      A13    :!R=R+1: ENDLOOP 
  1413.      A14    :! END 
  1414.  
  1415.      Explanation:     Explanation
  1416.      A1:  Before we can access a file, we need  to open  it first. Statement
  1417.           A1  open  an  output  file  in  channel  #1  and  the file name is
  1418.           "test.txt". Channel number is in the range of 0~9.
  1419.      A2:  Print the string "123,456 789" and a blank line to the file
  1420.      A3:  Print another string to the file. You can output not only a string
  1421.           but  also  numeric  data  on  the  same line separated by comma or
  1422.           semicolon.
  1423.      A4:  Close channel number 1.
  1424.  
  1425.  
  1426.      A7:  Use the file selector  to  get  the  file  name  from  user. Note:
  1427.           FILENAME$ is a string variable that is changed whenever you change
  1428.           the content of the file selector dialog box.
  1429.      A8:  Open that file as input file on channel #1
  1430.      A9:  R is the counter for line  being  read.  Save  our  current screen
  1431.           first.
  1432.      A10: Enter a loop to read the file line by line.
  1433.      A11: Read a line from the file to BUF$. BUF$ is a string variable which
  1434.           can be modified by INPUT statement only.
  1435.      A12: Print the line being read to the terminal.
  1436.      A13: Increase the  counter of  line number  and repeat  the loop. NOTE,
  1437.           there is  no EXIT  IF statement.  There is no way to detect end of
  1438.           file in current SHEET BASIC. You must let it go  forever until the
  1439.           interpreter finds  end of  file error  and stops your program. You
  1440.           may have some extra "Syntax error" errors. It is normal.
  1441.  
  1442.      NOTE:     After you are  done,  you  can  enter  the  command "@restore
  1443.                screen" to  restore your screen. Also, program A7 can be used
  1444.                to read other text files. You can even read this  document by
  1445.                choosing  this  file  and  you  can stop and resume the print
  1446.                action by <Ctrl-S> and <Ctrl-Q>.
  1447.  
  1448.                                      Page 15
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  1458.  
  1459.      Example 6:     _________      NUMBER.SHT
  1460.                The file name  for  the  following  program  is "NUMBER.SHT".
  1461.           There  are  two  programs  in  this spreadsheet. The first program
  1462.           generates data to file "test.txt". It is exactly  the same program
  1463.           of Example  5. L7..L16 reads the data from the file "test.txt" and
  1464.           separate each of line into different cells. Subroutine  P1..P11 is
  1465.           used to separate each data into different cells.
  1466.  
  1467.      L1     :! OPEN "o",#1,"test.txt"
  1468.      L2     :! PRINT #1,"123,456 789": PRINT #1
  1469.      L3     :! PRINT #1,"5623.23,84.38 723.12"
  1470.      L4     :! CLOSE #1
  1471.      L5     :! END 
  1472.  
  1473.      L7     :! GET_FILE "*.txt", FILENAME$
  1474.      L8     :! OPEN "i",#1, FILENAME$
  1475.      L9     :!R=0
  1476.      L10    :! LOOP 
  1477.      L11    :! INPUT #1, BUF$
  1478.      L12    :! IF ( ASC( BUF$)<>0) THEN  GOSUB P1
  1479.      L13    :!R=R+1
  1480.      L14    :! ENDLOOP 
  1481.      L15    :! CLOSE #1
  1482.      L16    :! END 
  1483.  
  1484.      P1     :!P=1:C=1
  1485.      P2     :! LOOP 
  1486.      P3     :!Q= POS(" ,", BUF$,P)
  1487.      P4     :! EXIT  IF Q=0
  1488.      P5     :!A1[C,R]= VAL( MID$( BUF$,P,Q-P))
  1489.      P6     :!C=C+1
  1490.      P7     :!P=Q+1
  1491.      P8     :! ENDLOOP 
  1492.      P9     :!A1[C,R]= VAL( MID$( BUF$,P,100))
  1493.      P10    :! RETURN 
  1494.  
  1495.      Explanation:     Explanation
  1496.      L1~L5: It is the same code for Example 5 A1~A5.
  1497.      L7:  Uses the file selector to get the file name
  1498.      L8:  Open the file for INPUT.
  1499.      L9:  R is a counter for row number.
  1500.      L10: We enter an infinite loop to read data lines.
  1501.      L11: Read a line from the data file.
  1502.      L12: Test whether  the line  being read  is empty or not. If it is not,
  1503.           then we call subroutine P1 to separate the data into cells.
  1504.      L13: Increase our row number by one.
  1505.      L14: Repeat our loop
  1506.      L15 and L16 is never being  executed.  They  are  there  for decoration
  1507.           only.
  1508.      P1:  P is  the starting  search position and C is the column number. It
  1509.           is zero origin. C=1 means we start from column B.
  1510.      P2:  Enter the loop to separate BUF$ into pieces.
  1511.      P3:  We assume the number is separate by a blank space or comma. POS is
  1512.           a function  that tries  to find  the position  of a blank space or
  1513.  
  1514.                                      Page 16
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  1524.  
  1525.           comma from BUF$ starting from P. If POS cannot find it, Q  will be
  1526.           zero.
  1527.      P4:  Check whether  Q is zero. If it is, then we have checked the whole
  1528.           data line for space and comma and that is the end of our loop.
  1529.      P5:  Store the value of BUF$ from P up to Q-1. It depends  on the value
  1530.           of C and R. If C is 1 and R is 0, then the value will be stored in
  1531.           cell B1. (A1[1,0] is equivalent to B1).
  1532.      P6:  Increase our column number by one.
  1533.      P7:  Change our starting position for P to Q+1
  1534.      P8:  Repeat from P2.
  1535.      P9:  We still have one value after  the  last  space  or  comma.  It is
  1536.           stored from P to the last character of BUF$. If the len of MID$ is
  1537.           larger than the length of BUF$, then it returns a string from P to
  1538.           the last character of BUF$.
  1539.      P10: End our subroutine.
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.                                      Page 17
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  1590.  
  1591.  
  1592.      Example 7:     _________      GRID.SHT
  1593.  
  1594.           This  small  program  shows  the  setup and exit process for using
  1595.      graphics in SHEET BASIC. It just  uses window  1 to  draw the  x and y-
  1596.      axis then marks them. To run it, enter the command "@run d1"
  1597.  
  1598.      D1    : ! WINDOW 1
  1599.      D2    : ! SCALE -7,-2,7,2
  1600.      D3    : ! CLEAR 
  1601.      D4    : ! LINE -7,0,7,0: LINE 0,-10,0,10
  1602.      D5    : ! MARKX 0,-6,6,0.1,0.5
  1603.      D6    : ! MARKY 0,-2,2,0.2,1
  1604.      D7    : ! EXITGRAPH 
  1605.      D8    : ! END 
  1606.  
  1607.      Explanation:     Explanation:
  1608.      D1:  The first  command for graphics is WINDOW/VIEWPORT. WINDOW 1 means
  1609.           that we are using window 1 for output.
  1610.      D2:  Setup the scaling factors. The minimum number for X is  -7 and the
  1611.           maximum number is 7 and -2, 2 for Y.
  1612.      D3:  Clear the window being used.
  1613.      D4:  Draws the x-axis and y-axis
  1614.      D5:  Making marks  on x-axis  from -6 to 6 with increment 0.1. A bigger
  1615.           marker on increment of 0.5.
  1616.      D6:  Marks y-axis
  1617.      D7:  Legal way to exit from graphics commands
  1618.  
  1619.      NOTE:     ____
  1620.           The first step on graphic command  is WINDOW/VIEWPORT  followed by
  1621.      SCALE. After  that, you can enter any graphic commands. After the graph
  1622.      is  done,  you  should  use  EXITGRAPH  to  reset  the  clipping  area.
  1623.      Otherwise, your screen may seem to be locked up.
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.                                      Page 18
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  1656.  
  1657.      Example 8:     _________      SINCURVE.SHT
  1658.  
  1659.           This example  draws a sine curve on the current window. To run it,
  1660.      enter the command "@run a1".
  1661.  
  1662.      A1    : ! WINDOW
  1663.      A2    : ! SCALE -7,-1.2,7,1.2
  1664.      A3    : ! CLEAR 
  1665.      A4    : ! PLOT -2*PI, SIN(-2*PI)
  1666.      A5    : ! FOR X=-2*PI TO 2*PI+0.1 STEP 0.1
  1667.      A6    : ! LINE_TO X, SIN(X)
  1668.      A7    : ! NEXT X
  1669.      A8    : ! LINE -7,0,7,0: LINE 0,-1.2,0,1.2
  1670.      A9    : ! MARKX 0,-7,7,0.5,1
  1671.      A10   : ! MARKY 0,-1.2,1.2,0.1,0
  1672.      A11   : ! LABELX 0,-7,7,1,"f0"
  1673.      A12   : ! LABELY 0,-1.2,1.2,0.2,"f2"
  1674.      A13   : ! WAIT 5: EXITGRAPH
  1675.  
  1676.  
  1677.      Explanation:     Explanation:
  1678.      A1:  WINDOW with  no parameter  means we  are using  current window for
  1679.           output.
  1680.      A2:  SCALE for our sine curve.
  1681.      A3:  Clear our window
  1682.      A4:  Plot the first point of our sine curve
  1683.      A5:  A FOR loop to generate a sine wave from -2*PI to 2*PI
  1684.      A6:  Instead of  plotting dots,  we want  to connect  all the dots with
  1685.           lines.
  1686.      A8:  Draws the x- and y-axis.
  1687.      A9:  Marks x-axis
  1688.      A10: Marks y-axis
  1689.      A11: Draws the labels on x-axis. They  are integers  (f0). F  means the
  1690.           number is  displayed in  fixed format. 0 means decimal place is 0.
  1691.           So, it has no decimal place or it is integer.
  1692.      A12: Draws the labels on y-axis. They  are real  number with  2 decimal
  1693.           points.
  1694.      A13: Waits for 5 seconds and then refreshes our window.
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.                                      Page 19
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  1722.  
  1723.      Example 9:     _________      SPLINE.SHT
  1724.  
  1725.           This time,  we are  going to  use PLOT  DATA and SPLINE to see how
  1726.      wonderful SPLINE will be. This program has a lot of subroutines. I will
  1727.      explain each. To run it, enter the command "@run c1".
  1728.  
  1729.      F1    : !R=0
  1730.      F2    : ! FOR X=-2*PI TO 2*PI+1 STEP 2
  1731.      F3    : !J1[0,R]=X:K1[0,R]= SIN(X)
  1732.      F4    : !R=R+1
  1733.      F5    : ! NEXT X
  1734.  
  1735.           Subprogram F1 generates 7 data sets for sine curve. The data for x
  1736.      is stored in cells J1..J7 and data for y is stored in cells K1..K7.
  1737.  
  1738.      D1    : ! WINDOW 1
  1739.      D2    : ! CLEAR : SCALE -7,-2,7,2
  1740.      D3    : ! PLOT  DATA J1..J7,K1..K7,0,1
  1741.      D4    : ! GOSUB C13
  1742.      D5    : ! RETURN 
  1743.  
  1744.           Subroutine D1 plots the  data  stored  in  J1..J7,K1..K7  using no
  1745.      marker  and  solid  line.  The  command  PLOT DATA plots data stored in
  1746.      worksheet. J1..J7 and K1..K7  for x,y  respectively. 0  means using dot
  1747.      instead  of  marker  for  each  point  and  1 means using solid line to
  1748.      connect points.
  1749.  
  1750.      D7    : ! WINDOW 1
  1751.      D8    : ! SCALE -7,-2,7,2
  1752.      D9    : ! ATTRIBUTE 1,1
  1753.      D10   : ! SPLINE J1..J7,K1..K7,0.1
  1754.      D11   : ! RETURN 
  1755.  
  1756.           This subroutine draws the spline curve using color  1 (Black). The
  1757.      first argument for ATTRIBUTE sets the color to 1 (Black) and using line
  1758.      width 1. SPLINE uses cubic-spline method  to draw  smooth curve. J1..J7
  1759.      and  K1..K7  define  the  value  for x,y. 0.1 defines the increment for
  1760.      generating data on the spline-curve.
  1761.  
  1762.      F7    : ! WINDOW 1
  1763.      F8    : ! SCALE -7,-2,7,2
  1764.      F9    : !X=-2*PI: PLOT X, SIN(X)
  1765.      F10   : ! ATTRIBUTE 3,1
  1766.      F11   : ! FOR X=-2*PI TO 2*PI STEP 0.1
  1767.      F12   : ! LINE_TO X, SIN(X)
  1768.      F13   : ! NEXT X
  1769.      F14   : ! RETURN 
  1770.  
  1771.           Subroutine F7 draws the actual sine curve using color 3 (Green).
  1772.  
  1773.      C13   : ! LINE 0,-2,0,2: LINE -7,0,7,0: RETURN 
  1774.  
  1775.           Subroutine C13 draws the x- and y-axis
  1776.  
  1777.  
  1778.                                      Page 20
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  1788.  
  1789.  
  1790.      C1    : ! GOSUB D1
  1791.      C2    : ! GOSUB D7
  1792.      C3    : ! GOSUB F7
  1793.      C4    : ! WAIT 5
  1794.      C5    : ! EXITGRAPH 
  1795.      C6    : ! END 
  1796.  
  1797.           Our main program. First, draws the sine curve with PLOT DATA. Plot
  1798.      the sine  curve with  cubic spline  routine, then draws the actual sine
  1799.      curve. The sine curve using SPLINE is closer to the  actual sine curve.
  1800.      Actually, if  you change  cell F2 with "STEP 1" instead of "STEP 2" and
  1801.      change cells D3 and D10 for ranges J1..J14,K1..K14, then you can hardly
  1802.      tell the difference between the spline-curve and the actual sine-curve.
  1803.      NOTE: the actual sine-curve generates 126 points and  spline-curve uses
  1804.      14 data points! Isn't it wonderful?
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.                                      Page 21
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  1854.  
  1855.  
  1856.                         PART II -- Spreadsheet operations
  1857.  
  1858.      MENU SELECTIONS:    Briefly  describes  all  the menu selection and its
  1859.                          usage.
  1860.  
  1861.      MOVING AROUND:      This session explains how to move  the working area
  1862.                          to display different part of your worksheet.
  1863.  
  1864.      EDITING:            This  session  discusses  about  cell  entries  for
  1865.                          formula,  constant,  text,   BASIC   statement  and
  1866.                          command. It shows you how to use the line editor.
  1867.  
  1868.      CUSTOMIZED DISPLAY: This chapter  tells you  how to change the width of
  1869.                          individual  column   and  the   display  format  of
  1870.                          individual  cell.   Block  is  introduced  in  this                                             _____
  1871.                          chapter too. Block is  important to  many worksheet
  1872.                          commands.
  1873.  
  1874.      COPY AND MOVE:      This  chapter  shows  you  how  to  reorganize your
  1875.                          worksheet. You need to  know how  to select blocks.
  1876.                          It also  discusses about absolute and relative cell
  1877.                          references.
  1878.  
  1879.      ERASE CELLS:        This chapter  explains  to  you  how  to  erase the
  1880.                          unnecessary cells.
  1881.  
  1882.      INSERT AND DELETE:  This session  discusses how  to delete  or insert a
  1883.                          row  or  a  column.  Column  and  row  selection is
  1884.                          different from block.
  1885.  
  1886.      LOAD, SAVE, PRINT:  It explains the menu items under menu title "File".
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.                                      Page 22
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  1920.  
  1921.                                  MENU SELECTIONS
  1922.  
  1923.                The menu  titles are the strings that appear on the menu bar.                   ____________
  1924.           Menu items refer to the strings that drop  down when  a menu title          __________
  1925.           is selected.
  1926.  
  1927.           The menu titles for SHEET looks like this:
  1928.                  Desk  File  Sheet  Row/Col  Cells  Graph  Help                 ______________________________________________                                                               
  1929.  
  1930.  
  1931.      TITLE     ITEM            Description
  1932.      --------------------------------------------------------------------
  1933.      Desk     Desk
  1934.                About SHEET    General information about SHEET.
  1935.  
  1936.      File     File                     For a detail description of the following menu
  1937.                               items,  please  refer  to  the  chapter "LOAD,
  1938.                               SAVE, PRINT"
  1939.                New    N       Open  a  new  worksheet  window.  The N on the
  1940.                               right hand side means  that  you  can activate
  1941.                               this  menu  item  by pressing <Control-N>. You
  1942.                               have a choice for changing your  new worksheet
  1943.                               size. The  maximal number of rows can be 50 to
  1944.                               9999.
  1945.                Load   L       Load an old worksheet  file  from  disk drive.
  1946.                               You can  use <Control-L> to activate this menu
  1947.                               item.
  1948.                Load WKS       Load files in the format of  Lotus 123 release
  1949.                               1A or  2. SHEET  is not  a Lotus  clone, so it
  1950.                               will  not  translate  everything.  Whenever it
  1951.                               encounters  problem,  the  translation process
  1952.                               will be terminated.
  1953.                Load PART      Load SHEET files saved  by using  "Save PART".
  1954.                               Its file extension is PRT.
  1955.                Save   S       Save  the   whole  worksheet  file  into  your
  1956.                               diskette.
  1957.                Save WKS       It is supposed to save your worksheet in Lotus
  1958.                               123 file format. It is not working right now.
  1959.                Save PART      Save part of your worksheet into diskette. You
  1960.                               need to  select  blocks  of  cells  before you
  1961.                               activate this menu item.
  1962.                Print  P       Print part  of your worksheet to disk/printer.
  1963.                               You need to select a block before you activate
  1964.                               this menu item.
  1965.                Quit   Q       Quit to desktop.
  1966.  
  1967.  
  1968.      Sheet     Sheet
  1969.                Erase          Erase your current worksheet.
  1970.                Defaults       Set  some  default  states  of  SHEET. You can
  1971.                               change the recalculation order  which is saved
  1972.                               with   your   worksheet,   change   the   TEXT
  1973.                               justication, change the  current  window name,
  1974.                               takes 32K  back for  screen redraw  and have a
  1975.  
  1976.                                      Page 23
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  1986.  
  1987.                               look of the memory remains.
  1988.                Options        In the dialog box  of Options,  you have three
  1989.                               choices.
  1990.                                    Users have  suggested for a Global format
  1991.                               for each  column. "Cell  format using previous
  1992.                               row"  means  that  whenever  you  enter  a new
  1993.                               element for the worksheet, it will try to find
  1994.                               the format  of previous row on the same column
  1995.                               and uses it as default format. So, you  do not
  1996.                               need to reformat again and again.
  1997.                                    If  you  are  moving  the  worksheet with
  1998.                               arrow keys, you will  find that  moving up and
  1999.                               down  is  a  lot  faster  than moving left and
  2000.                               right. "Move  to left/right  Fast" provides an
  2001.                               option that you can move left and right faster
  2002.                               than before. One drawback  for this  option is
  2003.                               that  the   new  column   being  displayed  is
  2004.                               truncated to its own width. Hence you may have
  2005.                               problem  in  displaying  BASIC program or text
  2006.                               string which spilled over other cells.  If you
  2007.                               want  to  redraw  the  screen  to display them
  2008.                               properly, you can use the command "@exitgraph"
  2009.                               or <Alt-F> to redraw the screen.
  2010.                                    Two monochrome users have suggested me to
  2011.                               give an option for  using  the  Small  font to
  2012.                               display more  rows per screen. I have make the
  2013.                               option available but it is not working yet.
  2014.                Dates               SHEET can  display  three  different Date
  2015.                               types.  The  Dates  menu item under menu title
  2016.                               Sheet provides you a new way to show your date
  2017.                               data. The components for a DATE are day, month
  2018.                               and year. Normally, day and year are displayed
  2019.                               as digits. Month can be digit, the first three
  2020.                               characters of the month or the whole alphabets
  2021.                               for  that  month  and some countries put month
  2022.                               before day and some  put day  before month. To
  2023.                               overcome these differences, the date format is
  2024.                               configurable  to   your  favour.   dd  and  yy
  2025.                               represent day and year in digit. mm represents
  2026.                               month in digit. mmm represents month  in three
  2027.                               letters  and  mmmm  represents  month  in full
  2028.                               alphabets. Here are some examples. Assume that
  2029.                               the date is March the first, 1988.
  2030.  
  2031.                               Date format:                   Display:
  2032.                          -------------------------------------------------
  2033.                               mmddyy                        030188
  2034.                               dd-mmm-yy                     01-Mar-88
  2035.                               mmmm dd,19yy                  March 01,1988
  2036.                               dd/mm/yy                      01/03/88
  2037.                               mm/dd/yy                      03/01/88
  2038.  
  2039.                     NOTE:     The  file  SHEET.CFG  holds  the  defnition of
  2040.                               Date1, Date2 and Date3. It is updated whenever
  2041.  
  2042.                                      Page 24
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  2052.  
  2053.                               you  change  the  Date format. If SHEET.CFG is
  2054.                               not  there  when  SHEET  is  loaded,  then the
  2055.                               default formats will be used.
  2056.  
  2057.      Row/Col     Row/Col
  2058.                Insert  I      Insert a  row or  a column. You need to select
  2059.                               that particular row/column first. Refer to the
  2060.                               chapter   "INSERT   AND   DELETE"  for  detail
  2061.                               description.
  2062.                Delete  D      Delete a row or a column.  You need  to select
  2063.                               that particular row/column first.
  2064.                Col widths          You can change the column width in a more
  2065.                               effecient way  than just  using mouse dragging
  2066.                               method. For  example, if  you want to make the
  2067.                               column width from  column  A  to  column  O to
  2068.                               1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,  you can select
  2069.                               the menu item  "Col  widths"  from  menu title
  2070.                               "Row/Col",  enter  "A"  for the leading column
  2071.                               and 1,9,1,9,1,9,1,9,1,9,1  in  the  edit field
  2072.                               "widths".
  2073.  
  2074.      Cells     Cells                    NOTE:  YOU  HAVE  TO  SELECT BLOCKS BEFORE YOU
  2075.                               ACTIVATE THE FOLLOWING MENU ITEMS.
  2076.                Reformat  R    Changes the format  of  blocks.  For  a detail
  2077.                               description,   please   refer  to  "CUSTOMIZED
  2078.                               DISPLAY"
  2079.                Erase     E    Erase cells on blocks  specified. Please refer
  2080.                               to "ERASE CELLS".
  2081.                Copy      C    Copy a  block of  cells to other block. Please
  2082.                               refer to "COPY AND MOVE"
  2083.                Move      M    Move a block of cells to other place
  2084.                Adjust    A         Adjust is  used for  changing TEXT string
  2085.                               to   BASIC   statements   or   changing   TEXT
  2086.                               justifications. The first step in using ADJUST
  2087.                               is: Select  the blocks  being ajusted and then
  2088.                               press <Control A> or  select  this  menu item.
  2089.                               You MUST not change TEXT that are not supposed
  2090.                               to be BASIC  statements  to  BASIC statements.
  2091.                               The  program   may  not   recognize  all  your
  2092.                               characters and part of  them may  be truncated
  2093.                               with a character #.
  2094.  
  2095.      Graph     Graph                    This selections is not available yet.                              This selections is not available yet.
  2096.                Selections
  2097.                Layout
  2098.                Legend
  2099.                X-axis lable
  2100.                Data Variable A
  2101.                Data Variable B
  2102.                Data Variable C
  2103.                Data Variable D
  2104.                Data Variable E
  2105.                Data Variable F
  2106.  
  2107.  
  2108.                                      Page 25
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  2118.  
  2119.      Help     Help
  2120.                Entry          Helps  for  entering  formula,  text  strings,
  2121.                               BASIC statements and commands.
  2122.                Formula        Helps for formula, especially  for calculation
  2123.                               priority
  2124.                Built-in Func  Helps for built-in functions.
  2125.                Statement      Helps for BASIC statements (v1.6)
  2126.                Limits         Helps  for  program  limit  (accuracy, maximum
  2127.                               numbe of variables and so on)
  2128.                Graphic commands Helps for graphic commands for BASIC (v1.7)
  2129.                PTEXT          Helps  for  the  graphic  command  PTEXT (PLOT
  2130.                               TEXT) (v1.7)
  2131.                Commands       Helps on other new BASIC commands (v2.0)
  2132.                Console  commands   Helps  on  screen  control  and  keyboard
  2133.                               commands. (v2.0)
  2134.  
  2135.  
  2136.  
  2137.  
  2138.  
  2139.  
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  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.                                      Page 26
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  2184.  
  2185.  
  2186.                                   MOVING AROUND
  2187.  
  2188.           When you start SHEET,  your screen  is divided  into menu  bar and
  2189.      worksheet  window.  The  worksheet  window  can be divided into 5 major
  2190.      areas. The status line is the first line under the window title.  It is                ___________
  2191.      used for  displaying current  cell's content  and worksheet status. The
  2192.      editing buffer ,which is  the  line  below  status  line,  is  used for     ______________
  2193.      entering or  editing the current cell. The column bar is the line below                                                __________
  2194.      the editing buffer. The row bar is located on the left hand side of the                             _______
  2195.      worksheet window. Both column and row bars are used for cell reference.
  2196.      The biggest area is the working area for current worksheet.                             ____________
  2197.  
  2198.           Each column is referred  by a  unique letter  (from A  to IU). The
  2199.      first column  is A,  column B  after A,  C after  B and  so on. The one
  2200.      following column Z is AA and  after AZ  comes BA,  and so  on. Each row
  2201.      numbers are  sequentially ordered  from 1  to a  variety of  50 to 9999
  2202.      depends on the worksheet size you  choose. A  cell in  the worksheet is
  2203.      referred by  column letter  followed by row number. For example, at the
  2204.      intersection of column B and row number 2 is cell B2.
  2205.  
  2206.           Each spreadsheet  can hold  255 columns  and a  variable number of
  2207.      rows from  50 to 9999. It means you can access at most 2,549,745 cells.
  2208.      Your screen can display a very  small amounts  of them.  Therefore, you
  2209.      have to view your spreadsheet by moving the working area. The following
  2210.      operations let you move your working  area by  keyboard entry  or mouse
  2211.      button.
  2212.  
  2213.           <Up arrow>     If current  cell cursor is not in row number 1, the
  2214.                          cell cursor will be moved one row up.
  2215.           <Down arrow>   If current cell cursor is not  in row  number 1280,
  2216.                          the cell cursor will be moved one row down.
  2217.           <Left arrow>   If current cell cursor is not in column A, the cell
  2218.                          cursor will be moved one column left.
  2219.           <Right arrow>  If current cell cursor is  not  in  column  IU, the
  2220.                          cell cursor will be moved one column right.
  2221.           <Shift-arrows> If  possible,  the  cell  cursor  will  be moved by
  2222.                          "page" to the direction the arrow key specified.
  2223.           <Clr-Home>     This key moves the current cell cursor to A1.
  2224.  
  2225.           <F5>           When you press the function key  F5, you  can enter
  2226.                          the cell reference directly to move the cell cursor
  2227.                          to that cell. If the cell  specified is  not in the
  2228.                          working area, then the working area will be changed
  2229.                          and the new upper left cell is the cell specified.
  2230.  
  2231.           You can use the slider bars to change the working area quite fast.
  2232.      Also, you  can locate a cell with mouse much faster than arrow keys. To
  2233.      locate a cell with mouse:
  2234.                -    use vertical and horizontal slider bars  to move  to the
  2235.                     desired working area.
  2236.                -    put  the  mouse  cursor  over the desired cell and press
  2237.                     left button on your mouse.
  2238.  
  2239.  
  2240.                                      Page 27
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  2250.  
  2251.                                      EDITING
  2252.  
  2253.      Types of cell entry:     ___________________
  2254.                There are 4 different types of cell entries in SHEET: numeric
  2255.           constant, formula,  text and  BASIC statement. BASIC commands will
  2256.           be executed immediately but it will not be stored in any cell. The
  2257.           leading character  of each  entry will  differentiate one from the
  2258.           other.
  2259.  
  2260.                Formula: Input string starts with "+", "-", DIGIT, "." or "("               Formula
  2261.                Constant: Input string starts  with "+",  "-", DIGIT,  "." or               Constant
  2262.                     "("
  2263.                Statement: Input string starts with "!"               Statement
  2264.                Command: Input string starts with "@"               Command
  2265.                Text: Input  string starts  with double  quote, single quote,               Text
  2266.                     "^", "\" or character other than  "+", "-",  DIGIT, ".",
  2267.                     "(", "!", "@".
  2268.  
  2269.                Constant is  an arithmetic expression which does not refer to               Constant
  2270.           other  cell(s)  or  variable(s).  A  constant  cell  will  not  be                                               constant
  2271.           recalculated.  You  may  notice  that  most  of  your  inputs  are
  2272.           constants. Making the  distinction  between  formula  and constant          constants                                    formula      constant
  2273.           helps speeding up the spreadsheet recalculation time.
  2274.  
  2275.                Statement  and   command  are   for  BASIC  interpreter.  The               Statement        command
  2276.           differences between statement and command are that command will be                              statement     command          command
  2277.           executed immediately  but will  not be  stored in current cell and
  2278.           statement will not be executed but will be  stored in  the current          statement                                          
  2279.           cell.
  2280.  
  2281.                Text  is  a  descriptive  string. The first character of each               Text
  2282.           text entry has special effect for display.
  2283.                Single quote('):    The text is left justified.
  2284.                Double quote("):    If the width of  the cell  is larger than
  2285.                                    the length of the text, the text is right
  2286.                                    justified.
  2287.                Circumflex (^):     if the width of  the cell  is larger than
  2288.                                    the  length  of  the  text,  the  text is
  2289.                                    centered within the cell width.
  2290.                Back slash(\):      The text  following  back  slash  will be
  2291.                                    used repetively filling the cell.
  2292.  
  2293.                If  a  text  string  starts  with character other than single
  2294.           quote, double quote, circumflex or back slash, then  the character
  2295.           selected  on  "TEXT  justification"  of menu item "Defaults" under
  2296.           menu title "Sheet" will be used as its leading character.
  2297.  
  2298.                There is a command which you  can change  the first character
  2299.           from one  of ('  " ^ \) to one of (' " ^ \ !). It is the menu item
  2300.           "Adjust" under menu title "Cells".
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.                                      Page 28
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  2316.  
  2317.  
  2318.      Rules for constructing formula:     ______________________________
  2319.           When you are entering formula, the  first character  of your entry
  2320.      must be  "+","-", "0".."9",  "." or "(". The following table summarizes
  2321.      all such first characters and their usage.
  2322.  
  2323.           Char Usage                                        Example
  2324.      -----------------------------------------------------------------
  2325.           +    Used when the formula begins with  a cell    +A1/A2
  2326.                reference or calling built-in function       +SIN(A1)
  2327.  
  2328.           -    Used   when   the   formula  begins  with    -A1*20
  2329.                negative constant value or negative value    -12*0.2
  2330.                of  cell  reference  or negative value of    -COS(A1)
  2331.                function call
  2332.  
  2333.           0-9  Used  when  the  formula  begins  with  a    12.3*20
  2334.                constant number.
  2335.  
  2336.           .    Used  when  the  formula  begins  with  a    .05*120
  2337.                constant number.
  2338.  
  2339.           (    Used  when  the  beginning  part  of  the    (A1-A2)/A3
  2340.                formula's  natural  order  of calculation
  2341.                must be altered through the use of a pair
  2342.                of parentheses.
  2343.  
  2344.  
  2345.           NOTE: 1.          ____      Versions before  2.0 of  SHEET did  not know that .05 is
  2346.                     0.05.
  2347.                 2.  If part of the expression returns a string, then it will
  2348.                     treat as 0. It means you cannot do string calculation in
  2349.                     any  cell.  But  the  BASIC  interpreter  can  do string
  2350.                     operations.
  2351.  
  2352.                  eg.     34+chr$(12)         ==>34
  2353.                          "test1"+"test2"     ==>0
  2354.                          4+len("some")       ==>8
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.                                      Page 29
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.  
  2381.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  2382.  
  2383.      Cell input:     __________
  2384.                Whenever  you  type  some  keys, the corresponding characters
  2385.           will be inserted into  the  editing  buffer.  You  may  notice the
  2386.           status  is  changed  from  "Ready"  to "Input". Your entry must be
  2387.           terminated by the following  method to  change the  status back to
  2388.           "Ready". While  you are  in "Input"  mode, the menu selections and
  2389.           window resize function are not allowed, though you can change your
  2390.           working  area  by  moving  the horizontal or vertical slider bars.
  2391.           Whenever you terminate  your  input,  you  will  get  back  to the
  2392.           working area before you do editing.
  2393.  
  2394.           Move the editing cursor:          Move the editing cursor
  2395.           <Shift-Left arrow>  Moves the  editing cursor  to left  by 1/2 the
  2396.                               length of the editing buffer.
  2397.           <Shift-Right arrow> Moves the editing cursor  to right  by 1/2 the
  2398.                               length of the editing buffer.
  2399.                MOUSE cursor   Moves  the  mouse  cursor to the character you
  2400.                               want it  be  and  press  left  button  on your
  2401.                               mouse,  then  the  editing cursor will move to
  2402.                               that character.
  2403.           Modify your input:          Modify your input
  2404.                <Insert>       Toggles the INSERT mode  to TYPEOVER  mode and
  2405.                               vice versa.
  2406.                <Backspace>    Erases the  character on the left hand side of
  2407.                               the editing cursor.
  2408.                <Delete>       Erases the character under the editing cursor.
  2409.           Terminate your input:          Terminate your input:
  2410.                <Undo>         Terminates input and the  cell content  is not
  2411.                               modified.
  2412.                <Return>       Terminates input  and the cell cursor moves to
  2413.                               the direction specified  by  editing direction
  2414.                               (see below).
  2415.                <UP arrow>     Terminates input and the cell cursor moves one
  2416.                               row up if possible.
  2417.                <Down arrow>   Terminates input and the cell cursor moves one
  2418.                               row down if possible.
  2419.                <Left arrow>   Terminates input and the cell cursor moves one
  2420.                               column left if possible.
  2421.                <Right arrow>  terminates input and the cell cursor moves one
  2422.                               column right if possible.
  2423.           Miscellaneous operations:          Miscellaneous operations:
  2424.                MOUSE          if the mouse cursor is inside the working area
  2425.                               and if  you  press  the  left  button  on your
  2426.                               mouse, the  cell coordinate  that the mouse is
  2427.                               over will be inserted into the editing buffer.
  2428.           <Control> MOUSE     It works as above  except a  comma is inserted
  2429.                               before the cell coordinate.
  2430.           <Shift> MOUSE       Instead  of  comma,  a  through  notation (..)
  2431.                               added before the cell coordinate.
  2432.                Sliders        You can change the working area  by moving the
  2433.                               vertical   or   horizontal  slider  bars.  Any
  2434.                               terminating key  will resume  the display back
  2435.                               to the working area before editing.
  2436.  
  2437.  
  2438.                                      Page 30
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  2448.  
  2449.      Modify a cell:     _____________
  2450.                To modify  a cell,  you have  to move  the cell cursor to the
  2451.           desired cell. Press the function key <F2> and use the above method
  2452.           to modify  the cell  content but you must terminate your change by                                               ______________
  2453.           <Return>. If you change your mind, you can always <Undo>  what you
  2454.           have done.
  2455.  
  2456.      Editing direction:     _________________
  2457.                When you  terminate your  input by any arrow key, the editing
  2458.           direction  will  be  changed  to  the  direction  the   arrow  key
  2459.           specified. When  you press  <Return> to  terminate your input, the
  2460.           cell cursor will move  to the  editing direction.  If you  want to
  2461.           change  the  editing  direction  to  neutral,  you  have  to press
  2462.           <Return> before your editing session.
  2463.  
  2464.                e.g.
  2465.  
  2466.  
  2467.                Cell      Entry                    Cell cursor position
  2468.           -------------------------------------------------------------
  2469.                 A1       1 <Down arrow>                 A2
  2470.  
  2471.                 A2       2 <Return>                     A3
  2472.  
  2473.  
  2474.                The first entry change the editing  direction to  <Down>. The
  2475.           second  entry   which  terminates  with  <Return>  is  similar  to
  2476.           terminating with <Down arrow>.
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.                                      Page 31
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  2514.  
  2515.                                CUSTOMIZED DISPLAY
  2516.  
  2517.           SHEET can calculate number  accurate up  to 17  decimal places. In
  2518.      most case, you need to display 2 decimal points only. For example, your
  2519.      monthly loan payment may be 876.54321.  You  will  not  care  about the
  2520.      extra digits. You just want it to display as 876.54 or $876.54. That is
  2521.      the situation in which you need to change its default display format.
  2522.  
  2523.           There are two ways to change  the appearance  of your worksheets--
  2524.      changing  the  width  of  individual  column and changing the format of
  2525.      individual cells.
  2526.  
  2527.  
  2528.      Change column width:     ___________________
  2529.           The column width of  a cell  may affect  the display.  For numeric
  2530.      result, if  the format  you specify  cannot fit  into the  width of the
  2531.      cell, then the cell will be filled up with "*".  For text,  you may not
  2532.      be able  to do  right justification  or center the text. To display the
  2533.      result correctly, you may need to change the width of the column.
  2534.  
  2535.           There are two ways to change the width  of individual  column. The
  2536.      first way  uses the  mouse and  the second  way uses the menu item "Col
  2537.      widths" under menu title "Row/Col".
  2538.  
  2539.           MOUSE:
  2540.                -    Move the desired column within the working area
  2541.                -    Move the mouse cursor on the white gap  after the column
  2542.                     letter (e.g.  if you  want to change the width of column
  2543.                     A, move the mouse cursor on  the white  gap after column
  2544.                     letter A)
  2545.                -    Press the left mouse button (do not release it)
  2546.                -    To expand  the column width, drag the mouse to right and
  2547.                     release the button
  2548.                -    To shrink the column width, drag  the mouse  to left and
  2549.                     release the column
  2550.           Col widths:
  2551.                -    Select the  menu item  "Col widths" under the menu title
  2552.                     "Row/Col".
  2553.                -    Enter the correct column letter
  2554.                -    Enter your desired column width.
  2555.                -    You can enter numbers separate by comma. Doing this will
  2556.                     change  the  column  widths  beginning  from  the column
  2557.                     letter specified.
  2558.       
  2559.           Note:          Note      if your column width is only 1 character  wide, then the
  2560.                     column letter will be pushed to the next column.
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.                                      Page 32
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.  
  2579.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  2580.  
  2581.  
  2582.      Default display format:     ______________________
  2583.           Text:          Text      Depends on the first character for justification.
  2584.           Constant and Formula:          Constant and Formula
  2585.                     The number  of digits after the decimal point is six. It
  2586.                     is right justified and if  possible,  a  blank  space is
  2587.                     added at the rightmost place.
  2588.           Column width:  9 characters per column.          Column width
  2589.  
  2590.  
  2591.      Display format:     _______________
  2592.                There are  9 different predefined display formats for formula                                                                     formula
  2593.           and constant types. The first one is the  default format mentioned              constant
  2594.           above.  The  others  are  %,  Fixed, Scientific, Dollar, ,(comma),                                    %   Fixed  Scientific  Dollar  ,
  2595.           Date1, Date2, Date3.          Date1  Date2  Date3
  2596.  
  2597.  
  2598.                Type      Usage                         Example
  2599.           --------------------------------------------------------
  2600.             Default    Display up to 6 decimal points    3.1234
  2601.             %          Use    for    interest    rate,   0.05    will    be
  2602.                        discount, tax and so on.          displayed as 5%
  2603.             Fixed      Use   for   data   which   have   1.00
  2604.                        different  decimal  places. (eg   1.50
  2605.                        1,1.5. Most likely, you want it   2.00
  2606.                        to be 1.00, 1.50)
  2607.             Scienti-   Use for display data which is a   3.24e12
  2608.             fic        big or small number.
  2609.  
  2610.             Dollar     Use for data which  are related   $1,245.12
  2611.                        to money.
  2612.             ,          Comma  format   is  similar  to   1,245.12
  2613.                        Dollar format excep there is no
  2614.                        dollar sign in front of it.
  2615.             Date1      Use for displaying date related   9-Jul-88
  2616.                        value. Its format is dd-MMM-yy.
  2617.             Date2      Its format is dd-mmm.             18-Jul
  2618.             Date3      Its format is mmm-yy.             Jul-88
  2619.             TEXT       Display formula  instead of its
  2620.                        value.
  2621.  
  2622.             HIDE       The  information  on  this cell
  2623.                        will not appear on  the working
  2624.                        area
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.                                      Page 33
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.  
  2645.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  2646.  
  2647.  
  2648.      Block:     _____
  2649.           Before we  reformat some  cells, we need to tell SHEET which cells
  2650.      we intend to do that. In SHEET, those cells are called blocks. In Lotus
  2651.      123, we can define only one block at one time, but SHEET can accomodate
  2652.      up to 18 blocks at one time.
  2653.  
  2654.           A block is part of the spreadsheet. It is a  rectangle which holds
  2655.      at least  one cell.  To define a block, you need to select the starting                                                                    ________
  2656.      cell and stopping cell  of  the  block.  The  process  of  defining the     ____     _____________
  2657.      starting  cell  requires  mouse  button and <Control> key, and stopping     ______________                                                 ________
  2658.      cell requires mouse button and <Shift> key.     ____
  2659.  
  2660.                Here is an example to define cell A5 as a block:
  2661.  
  2662.                -    Move the mouse cursor within cell A5
  2663.                -    Press  <Control>  key   and   the   left   mouse  button
  2664.                     simultaneously
  2665.  
  2666.                You may  notice that  the selected block has been highlighted
  2667.           by reversing its color.
  2668.  
  2669.                Here is another example  to show  you how  to define  a block
  2670.           containing cells from B5 to C14 (B5..C14):
  2671.                -    Move the mouse cursor within cell B5
  2672.                -    Press   <Control>   key   and   the  left  mouse  button
  2673.                     simultaneously
  2674.                -    Move the mouse cursor within cell C14
  2675.                -Press <Shift> key and the left mouse button simultaneously.
  2676.  
  2677.                In summary, to define the starting cell, you have to move the                                         _____________
  2678.           mouse  cursor  over  the  first  cell and press <Control> and left
  2679.           mouse button simultaneously. To define the stopping cell, you have                                                     _____________
  2680.           to move  the mouse cursor over the last cell and press <Shift> and
  2681.           left mouse button simultaneously. If no stopping cell  is provided                                                  _____________
  2682.           then the stopping cell is the starting cell.
  2683.  
  2684.                Using  above  example,  if  you  want to define block B5..B14
  2685.           instead of B5..C14
  2686.                -    Move the mouse cursor within cell B14
  2687.                -    Press <Shift>  key and  the left  mouse button simultan-
  2688.                     eously.
  2689.  
  2690.                If block  B5..C14 is  the first  block you  defined, there is
  2691.           another way to select this block:
  2692.                -    move the mouse cursor within the cell B5
  2693.                -    press the left mouse button  and  drag  until  you reach
  2694.                     cell C14
  2695.                -    release mouse button.
  2696.  
  2697.      De-select blocks:     ________________
  2698.                Selecting any cell by a mouse button click will de-select all
  2699.           the blocks being selected.
  2700.  
  2701.  
  2702.                                      Page 34
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.  
  2711.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  2712.  
  2713.      Change display format:     _____________________
  2714.           To reformat some cells:
  2715.                -    select blocks using above method
  2716.                -    Press <Control R>
  2717.                     or  find  menu  title  "Sheet"  and   choose  menu  item
  2718.                     "Reformat" under it.
  2719.                -    A dialog  box will  show up.  Choose the format you want
  2720.                     from it.
  2721.  
  2722.                You can also use the  command  "@REFORAMT"  to  reformat some
  2723.           cells. The command should be:
  2724.                -    @reformat FORMAT_STRING, block1, block2, ....
  2725.                -    FORMAT_STRING consists  of two  part. The  first part is
  2726.                     the format  being  used,  and  the  second  part  is the
  2727.                     decimal places.  The format  of a  cell can be "$", ",",
  2728.                     "%", "F", "S" "D1",  "D2" and  "D3". They  represent the
  2729.                     format    of    "DOLLAR",   ",",   "PERCENT",   "FIXED",
  2730.                     "SCIENTIFIC", "Date1", "Date2" and "Date3" respectively.
  2731.  
  2732.                For example, if you want to  reformat cell  B2..C2 and B5..C5
  2733.           to DOLLAR with decimal place of 2, you can issue the command
  2734.                           @reformat "$2",b2..c2,b5..c5
  2735.           instead of selecting blocks and press <Control R>.
  2736.  
  2737.  
  2738.           NOTE:          NOTE      YOU CAN  ONLY REFORMAT  THOSE CELLS WHICH EXIST. That is
  2739.                     because of Sparse Matrix. After a cell has been created,
  2740.                     the cell  possesses attributes. If you format some empty
  2741.                     cells and insert something into those  cells after that,
  2742.                     those cells appear as default. It is not a bug.
  2743.  
  2744.                     You  can  set  the  option  in menu item "Options" under
  2745.                     "Sheet"  to  use  the  format  of  previous  row.  Then,
  2746.                     whenever you  enter a  new element for the worksheet, it
  2747.                     will try to find the format of previous row on  the same
  2748.                     column and  uses it  as default  format. So,  you do not
  2749.                     need to reformat again and again.
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.                                      Page 35
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.  
  2777.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  2778.  
  2779.                                   COPY AND MOVE
  2780.  
  2781.                COPY and MOVE commands require two blocks. The first block is
  2782.           the source,  and the second one is destination. You have to select
  2783.           those blocks before you  activate COPY  command by  <Control C> or
  2784.           find the  menu title "Cells" and choose menu item "Copy" under it.
  2785.           To activate MOVE command, you press <Control M> or find menu title
  2786.           "Range" and choose menu item "Move" under it.
  2787.  
  2788.                You can  use the  command "@COPY source_block, dest_block" or
  2789.           "@MOVE source_block, dest_block" to do the same thing.
  2790.  
  2791.                Here is an example  showing you  how to  copy the  content on
  2792.           cell A1  to A2..A5.  Assume that  the content of A1 is "1+A2". The
  2793.           display of cell A1 should be 1.
  2794.  
  2795.  
  2796.                Key       Mouse button   Effect              Mouse cursor
  2797.                                                               position
  2798.           -----------------------------------------------------------
  2799.                                                             A1
  2800.                Control + Mouse click    Cell A1 inverted
  2801.                                                             A2
  2802.                Control + Mouse click    Cell A2 inverted
  2803.                                                             A5
  2804.                Shift +   Mouse click    Cell A2 through
  2805.                                         A5 inverted.
  2806.                Control C                An alert box
  2807.                                         display on screen
  2808.                Return or Mouse click
  2809.                          on OK.
  2810.  
  2811.                The operations prior to  <Control C>  define two  blocks. The
  2812.           first block consists of cell A1 only. The second block consists of
  2813.           cells A2 through A5. <Control C> tells SHEET  to copy  the content
  2814.           of  the  first  block  to  the  second  block. If cell A6 does not
  2815.           contain anything and you  set the  recalculation mode  to Natural,
  2816.           your display should be:
  2817.                          A              Cell content
  2818.                1              5         1+A2
  2819.                2              4         1+A3
  2820.                3              3         1+A4
  2821.                4              2         1+A5
  2822.                5              1         1+A6
  2823.  
  2824.                Natural recalculation  means formulas are calculated in their
  2825.           dependent order. Cell A1 depends on the result  of A2  (1+A2). So,
  2826.           the calculation  of A1  is postponed  until A2 gets its result. A2
  2827.           depends on  A3 and  A3 depends  on A4  and so  on. Thererfore, the
  2828.           first  formula  being  computed  is  A5. If a formula refers to an
  2829.           empty cell, a zero  will be  returned. Hence,  A5=1+A6=1+0=1, cell
  2830.           A4=1+A5=1+1=2 and A3=1+A4=1+2=3 ...
  2831.  
  2832.  
  2833.  
  2834.                                      Page 36
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.  
  2843.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  2844.  
  2845.                One question  you may  ask: Why  the cell  reference of A2 in
  2846.           cell A1 has been changed to A3, A4, A5 and A6 in  cell A2,  A3, A4
  2847.           and A5 respectively? The answer is relative cell reference.
  2848.  
  2849.      Relative and Absolue cell reference:     ___________________________________
  2850.                Cell reference  can be  absolute or  relative. By  adding a $               
  2851.           symbol before the column letter or/and row number,  we designate a
  2852.           part of  a cell address as absolute or both parts as absolute. For
  2853.           example:
  2854.                $A2  denotes column  (A)  is  absolute  and  the  row  (2) is
  2855.                     relative.
  2856.                $A$2 denotes column (A) and row (2) are both absolute.
  2857.                A$2  denotes  column  (A)  is  relative  and  the  row (2) is
  2858.                     absolute
  2859.                A2   denotes column (A) and row (2) are both relative.
  2860.  
  2861.                During  COPY,  a  formula  in  source  block  which  contains
  2862.           relative  cell  references  will  be  modified.  If the formula is
  2863.           copied down, then the  relative row  number will  be increased. If
  2864.           the formula is copied to right hand side, then the relative column
  2865.           letter will be increased. If you intend to copy "1+A2"  to A2..A5,
  2866.           then you must use formula "1+A$2" instead of "1+A2".
  2867.  
  2868.      NOTE:     NOTE:
  2869.                A  block  can  be  a  single  cell  (A2),  part  of  a column
  2870.           (A2..A5),part of  a  row  (B20..E20)  or  a  range  (A4..C10). The
  2871.           following  describes  how  the  program  handle different types of
  2872.           block COPY. Source is  the  first  block  and  destination  is the
  2873.           second block. Result is the range size chosen by COPY.
  2874.  
  2875.                Source              Destination         Result size
  2876.           --------------------------------------------------------- 
  2877.                 Single cell        any kind of block    the largest range
  2878.                 column reference   any kind of block    the largest range
  2879.                 row reference      any kind of block    the largest range
  2880.                 range reference    any kind of block    the source range
  2881.  
  2882.  
  2883.           You can use "@COPY" to copy from source to destination too.          You can use "@COPY" to copy from source to destination too.
  2884.  
  2885.           Examples:
  2886.                - If you want to COPY C1 to C2..C20
  2887.                     * Control and mouse click on cell C1
  2888.                     * Control and mouse click on cell C2
  2889.                     * Shift and mouse click on cell C20
  2890.                     * <Control C>
  2891.                 OR: "@COPY c1,c2..c20"
  2892.                - If you want to COPY C1..C12 to D1..D12
  2893.                     * Control and mouse click on cell C1
  2894.                     * Shift and mouse click on cell C12
  2895.                     * Control and mouse click on cell D1
  2896.                     * <Control C>
  2897.                 OR: "@COPY c1..c12,d1"
  2898.  
  2899.  
  2900.                                      Page 37
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  2910.  
  2911.                                    ERASE CELLS
  2912.  
  2913.                After some practice, you may find some data in your worksheet
  2914.           are no longer needed. Hence,  you  need  the  capability  to erase
  2915.           them. Before  you activate  the ERASE command, you must select the
  2916.           desired cells as blocks. Yes, you can erase  more than  one block,
  2917.           but  the  total  number  of  blocks  cannot  exceed 18. Here is an
  2918.           example showing you how to erase  cells  C1..D11,  E5,  F8  at one
  2919.           time.
  2920.  
  2921.                Key       Mouse button   Effect              Mouse cursor
  2922.                                                               Position
  2923.           ----------------------------------------------------------------
  2924.                                                             C1
  2925.                Control + Mouse button   C1 is inverted
  2926.                                                             D11
  2927.                Shift +   Mouse button   C1 through D11
  2928.                                         are inverted
  2929.                                                             E5
  2930.                Control + Mouse button   E5 is inverted
  2931.                                                             F8
  2932.                Control + Mouse button   F8 is inverted
  2933.                Control E                An alert box for
  2934.                                         ERASE command on
  2935.                                         screen
  2936.                Return or Mouse button   The screen will be
  2937.                          on OK          redrawn to show the
  2938.                                         effect of erase.
  2939.  
  2940.  
  2941.      Note:     ____      Instead of  using mouse  operations, you  can use the command
  2942.                "@ERASE" to erase part of  your  worksheet.  To  do  the same
  2943.                thing as above, you can issue the command:
  2944.  
  2945.                               @erase c1..d11,e5,f8
  2946.  
  2947.  
  2948.  
  2949.  
  2950.  
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.                                      Page 38
  2967.  
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974.  
  2975.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  2976.  
  2977.                                 INSERT AND DELETE
  2978.  
  2979.                INSERT and DELETE commands work with row and column only. The
  2980.           first thing before we activate INSERT  or DELETE  command, we must
  2981.           select a row/column.
  2982.  
  2983.      Row/Column selection:     ____________________
  2984.           Here is an example to show you how to select column D:
  2985.                Mouse cursor position         Mouse button
  2986.           ------------------------------------------------------
  2987.                COLUMN BAR
  2988.                column letter D
  2989.                                              Click the mouse button
  2990.                After you select column D, the whole column will be inverted.
  2991.  
  2992.           This is an example showing you how to select row 3
  2993.  
  2994.  
  2995.                Mouse cursor position         Mouse button
  2996.           ------------------------------------------------------
  2997.                ROW BAR
  2998.                row number 3
  2999.                                              Click the mouse button
  3000.  
  3001.  
  3002.                After you select row 3, the whole row will be inverted.
  3003.  
  3004.  
  3005.                To delete  or insert  a row/column, you must first select the
  3006.           row/column by clicking on  the  column  or  row  bar  with desired
  3007.           column letter or row number. After that, you can press <Control I>
  3008.           or <Control D> for inserting or deleting. You can choose  the menu
  3009.           title "Row/Col"  and choose  menu item  "Insert" or "Delete" to do
  3010.           the same thing.
  3011.  
  3012.      Note:     ____      INSERT and DELETE commands work with row and column only.
  3013.           -    If you intend to add some blank rows or column but you do not
  3014.                want to  add the  whole rows/columns,  then you must use MOVE
  3015.                command instead.
  3016.           -    If you intend to delete  some  cells,  use  ERASE  instead of
  3017.                DELETE.
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.                                      Page 39
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.  
  3041.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  3042.  
  3043.                                  LOAD, SAVE AND PRINT
  3044.  
  3045.                If you  take a  look of the menu title "File", you may notice
  3046.           that there are three types of  load and  save commands.  Menu item
  3047.           "Load"  will  load  the  ordinary  SHEET  files  (they have a file
  3048.           extension SHT). "Load WKS"  will  load  Lotus  123  release  1A or
  3049.           release  2  files.  "Load  PART"  is similar to Lotus file combine
  3050.           command. It is  used  for  merging  other  worksheet  with current
  3051.           worksheet.  The  file  you  "Load"  with part should be saved with
  3052.           "Save PART" command and its file extension should be PRT.
  3053.  
  3054.                Menu item "Save" will save the current file using SHT format.
  3055.           "Save  WKS"  will  save  file  in Lotus WKS format. "Save PART" is
  3056.           similar to Lotus file extract command. It is used for  saving some
  3057.           part  of  the  current  worksheet.  To  activate this command, you
  3058.           should select blocks to hold cells being output, and activate this
  3059.           command.
  3060.  
  3061.                Currently, you cannot save your worksheet in Lotus release 1A
  3062.           format. Other than that, every thing is functional.
  3063.  
  3064.      File extension:     ______________
  3065.                Lotus 123 release 1A  uses WKS  as its  file extension. SHEET
  3066.           uses SHT  as its  file extension. If you enter a file name in your
  3067.           file selector dialog box, you should  include the  file extension.
  3068.           The  file  extension  for  PART  is  PRT.  If you are printing the
  3069.           spreadsheet to disk, the  file extension  for this  file should be
  3070.           PRN.
  3071.  
  3072.      Load:     ____
  3073.           There are three way to load a spreadsheet:
  3074.                -    From the menu title, choose "File"
  3075.                     Choose menu item "Load"
  3076.                     Select your file from the file selector box
  3077.                -    <Control-L>. Press <Control> and L key simultaneously
  3078.                     Select your file from the file selector box
  3079.                -    @load (This is a BASIC command).
  3080.  
  3081.      Save:     ____
  3082.           There are three way to save a spreadsheet:
  3083.                -    From the menu title, choose "File"
  3084.                     Choose menu item "Save"
  3085.                     Enter your file in the file selector dialog box
  3086.                -    <Control-S>. Press <Control> and S key simultaneously
  3087.                     Enter your file in the file selector dialog box
  3088.                -    @save "filenmae" (This is a BASIC command.)
  3089.  
  3090.      Load PART:     _________
  3091.                You can  merge those  cells that  are saved  with "Save PART"
  3092.           into your current  worksheet.  To  load  those  files,  you should
  3093.           select the menu item "Load PART" from the menu title "File".
  3094.  
  3095.  
  3096.  
  3097.  
  3098.                                      Page 40
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.  
  3107.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  3108.  
  3109.  
  3110.      Save Part:     _________
  3111.                You can  save part of your worksheet to a file and then merge
  3112.           it  with  other  worksheet.  It  is  especially  useful  for BASIC
  3113.           programmer. They  may create  some BASIC  routines that are needed
  3114.           from file to file. Save them as PART and load them back  for other
  3115.           files. To  save part  of your  worksheet, you need to select those
  3116.           cells as blocks and activate the menu item  "Save PART".  The file
  3117.           extension for this kind of file is PRT.
  3118.  
  3119.      Lotus files:     ___________
  3120.                In many ways, SHEET is quite similar to Lotus 123. But I must
  3121.           emphasize that I am not  writing  a  Lotus  clone.  Instead,  I am
  3122.           trying to  write a BASIC interpreter in a spreadsheet environment.
  3123.           Even though, SHEET can read Lotus  files,  you  may  not  be lucky
  3124.           enough  to  convert  all  your  existing  Lotus  files. SHEET will
  3125.           convert those functions it supports. When SHEET encounters problem
  3126.           in function convertion, it will stop loading the file. It can read
  3127.           Lotus 123 release 1A or 2 files.
  3128.                You may also notice that the converted SHT files are normally
  3129.           bigger than WKS files. There are two reason for that. First, I use
  3130.           a single data type  -- double  -- for  all constant  number. Lotus
  3131.           separates number  from integer  to double. An integer is two bytes
  3132.           long while a double is eight  bytes.  The  second  reason  is that
  3133.           Lotus stores formula in suffix order while SHEET stores formula in
  3134.           infix  order  (e.g.  3+4  is  in  infix  order,  its  suffix order
  3135.           representation is  3 4 +). Suffix order not only saves storage (in
  3136.           suffix order,  parenthesis  can  be  discarded  and  comma between
  3137.           parameters  can  be  discarded  too),  it  also  speeds up formula
  3138.           calculation. You may ask me why I use infix order? Well, it is not
  3139.           easy to write a BASIC interpreter using suffix order.
  3140.  
  3141.      Print:     _____
  3142.                You can print your work sheet to a file or to printer. Before                                                                      Before
  3143.           you print, please specify the block which you  want to  print. The          you print, please specify the block which you  want to  print
  3144.           print routine  will print  those columns that fits on the margins.
  3145.           If some  columns on  the print  range are  not print  on the first
  3146.           pass, they will be printed on later passes.
  3147.                Note:               Note      The information you enter for the PRINT DIALOG will
  3148.                          not be saved with  your spreadsheet  file. It means
  3149.                          you have  to type in your format each time you want
  3150.                          to print it.
  3151.  
  3152.  
  3153.                Here is an example showing how to print the block A1..E12
  3154.  
  3155.                Key       Mouse button   Effect              Mouse cursor
  3156.                                                               position
  3157.           ----------------------------------------------------------------
  3158.                                                             A1
  3159.                Control + Mouse button   A1 is inverted
  3160.                                                             E12
  3161.                Shift +   Mouse button   A1 through E12
  3162.                                         are inverted
  3163.  
  3164.                                      Page 41
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.  
  3173.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  3174.  
  3175.                <Control P>              PRINT dialog box
  3176.                                         display
  3177.                Change dialog box contents.
  3178.                <Return>  or Mouse button
  3179.                          on OK.
  3180.  
  3181.  
  3182.                Let us examine what  the components  of the  print dialog box
  3183.           mean.  If  you  want  to  print  your worksheet to disk instead of
  3184.           printer, enter D in  the box  after "Print  to (P)rinter/(D)isk:".
  3185.           Otherwise, enter  P. If  you want  to print the formula (including
  3186.           BASIC statement) of each  cell,  then  enter  Y  for  the question
  3187.           "Print  Formula  (Y)es/(N)o"".  Otherwise, enter N. NOTE: versions
  3188.           before 2.0 prints formula  row after  row. The  new version prints
  3189.           formula  column  after  column.  It  makes  printing BASIC program
  3190.           easier.
  3191.  
  3192.                                                        Right margin-->      
  3193.              <---------------------- Page width --------------------->
  3194.       ^       ********************************************************
  3195.       |       *         ^                                            *
  3196.       |       *         | Top margin and titles                      *
  3197.       |       *         v                                            *
  3198.       |       *        **************************************        *
  3199.       |       *        *                                    *        *
  3200.               *<------>*                                    *        *
  3201.       Page    * Left   *                                    *        *
  3202.       Length  * Margin *                                    *        *
  3203.               *        *                                    *        *
  3204.       |       *        *                                    *        *
  3205.       |       *        *                                    *        *
  3206.       |       *        *                                    *        *
  3207.       |       *        *                                    *        *
  3208.       |       *        *                                    *        *
  3209.       |       *        *                                    *        *
  3210.       |       *        *                                    *        *
  3211.       |       *        *                                    *        *
  3212.       |       *        **************************************        *
  3213.       |       *         ^                                            *
  3214.       |       *         | Bottom margin                              *
  3215.       |       *         v                                            *
  3216.       v       ********************************************************
  3217.                                                               
  3218.  
  3219.                If you want to test your output before you actually print it,
  3220.           you can enter the command:
  3221.  
  3222.                               @redirect to "prn:"
  3223.                               @print_block a1..g4,4,76
  3224.  
  3225.                The commands above will print row 1 to row 4 from column A to
  3226.           column G using left margin 4 and right margin 76  to your printer.
  3227.           You can  check the  result before  you actually print it. (That is
  3228.           useful because you cannot stop PRINT when it actually prints).
  3229.  
  3230.                                      Page 42
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  3240.  
  3241.                              PART III -- SHEET BASIC
  3242.  
  3243.           A spreadsheet is a  powerful computing  tool. It  is also  a handy
  3244.      environment for handling data. Yon can add, delete and change your data
  3245.      with ease, and the spreadsheet program modifies all the required places
  3246.      to reflect the changes.
  3247.  
  3248.           Let the  spreadsheet handle  your data and numurical calculations,
  3249.      and  let  the  BASIC  interpreter  do  the  rest.  SHEET  BASIC  can do
  3250.      calculations,   string   operations,   graphics  and  text  files.  The
  3251.      combination of spreadsheet and BASIC provides an ideal  environment for
  3252.      using your computer productively.
  3253.  
  3254.           The following is a brief explanation of each session of PART III.
  3255.  
  3256.      Cells,  Variables,   String:  This  chapter  introduces  the  new  cell
  3257.                          reference  method,  variables   and   their  naming
  3258.                          convention.
  3259.                               You cannot  assign a string to a variable, but
  3260.                          you can assign a  string to  a cell.  The rules for
  3261.                          accessing and operating strings are introduced too.
  3262.  
  3263.      Flow control Statements: These statements change the execution sequence
  3264.                          of BASIC commands. The commands include:
  3265.                          IF .. THEN .. ELSE, GOTO, GOSUB ..  RETURN, LOOP ..
  3266.                          EXIT IF .. ENDLOOP, FOR .. NEXT, and RUN
  3267.  
  3268.      I/O Statements:     REDIRECT TO, PRINT
  3269.  
  3270.      Miscellaneous  statements:  SAVE  SCREEN, RESTORE SCREEN, WAIT, DEFINE,
  3271.                          MESSAGE
  3272.  
  3273.      Text files:         GET_FILE, OPEN, CLOSE, INPUT, PRINT
  3274.  
  3275.      Worksheet commands: COPY, MOVE, ERASE, REFORMAT, SORT, SWAP
  3276.  
  3277.      Console commands:   CLS,  CURSORON,  CURSOROFF,  VIDEOHIGH,  VIDEONORM,
  3278.                          GOTOXY, INKEY, UNGET, INPUT
  3279.  
  3280.      Graphic commands:
  3281.           Setup commands:     WINDOW, VIEWPORT, SCALE, EXITGRAPH, CLEAR
  3282.           Line/Dot commands:  ATTRIBUTE,  LINE,  LINE_TO,  PLOT,  PLOT DATA,
  3283.                               SPLINE
  3284.           Turtlegraphics:     FORWARD, TURN, TURN_TO
  3285.           Axis commands:      MARKX, MARKY, LABELX, LABELY
  3286.           Text command:       PTEXT
  3287.           Miscellaneous:      MOUSE_POS
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.                                      Page 43
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  3306.  
  3307.                                Cells and Variables
  3308.  
  3309.      Cell reference with dimension:     _____________________________
  3310.           A cell reference is a combination of column letter and row number.
  3311.      This type of access method is not enough for a programming language. In
  3312.      SHEET, you can use a  cell  as  a  BASE  and  move  it  horizontally or
  3313.      vertically by  appending two  numbers which  are separated by comma and
  3314.      embraced by "[" and "]". Each column letter has its own value. Column A
  3315.      is 1,  B is  2 and  so on.  For example,  A2[3,4]. A2 is the BASE whose
  3316.      coordinate is [1,2] and
  3317.  
  3318.                           A2[3,4]=[1,2]+[3,4]=[4,6]=D6.
  3319.  
  3320.           Here are some other examples:
  3321.  
  3322.                C1[4,7]   which is equivalent to  cell  G8.  C1  is  equal to
  3323.                          [3,1] and  C1[4,7]=[3,1]+[4,7] = [7,8]. Column G is
  3324.                          7. So the combination of this cell is G8.
  3325.                H123[-2,4] H123=[8,123]  and  H123[-2,4]  =  [8,123]+[-2,4] =
  3326.                          [6,127] or F127.
  3327.  
  3328.      Variables:     _________
  3329.           Variables must be initialized before being used. You can define up
  3330.      to 150 variables. A variable name starts with an alpha  character which
  3331.      is  followed  by  alphanumeric  characters.  Up  to  15  characters are
  3332.      significant. A  variable  name  must  not  be  identical  with reserved
  3333.      keywords, built-in functions  and cell reference.
  3334.  
  3335.           examples:
  3336.                row=4          correct
  3337.                pi=3.1415      incorrect (PI is a predefined constant)
  3338.                a1=12          incorrect (it is cell A1)
  3339.                1and2          incorrect (the first character is not letter)
  3340.  
  3341.           There are  so many  keywords and  built-in functions,  how can one
  3342.      differentiate them from the other? Keywords are embraced by leading and
  3343.      trailing spaces. For example, IF is a keyword and when it is displayed,
  3344.      it is " IF ". A built-in function has a leading space  before the name.
  3345.      For example,  SIN(x) will  be displayed  as " SIN(X)". Variables do not
  3346.      have any leading or trailing space.
  3347.  
  3348.      Cell reference with variables     _____________________________
  3349.            The whole worksheet can be viewed as a two dimensional array. You
  3350.      can access  any cell  by A1[c,r]  where c is the column number and r is
  3351.      the row number. 
  3352.           Not only you can access individual cell by using this  method, you
  3353.      can also  use it  for block.  For example,  assume that  you store your
  3354.      square matrix in cells a1..c3 and you want to store the inverse of this
  3355.      matrix to d1..f3. You can use the following program to do this.
  3356.  
  3357.      ! matrix(d1,inverse[a1..c3])
  3358.      ! end 
  3359.  
  3360.           Assume that  you need  to solve another square matrix in which you
  3361.  
  3362.                                      Page 44
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.  
  3371.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  3372.  
  3373.      store it in cells a1..d4. You can easily change the  argument of matrix
  3374.      to:
  3375.  
  3376.      ! matrix(e1,inverse[a1..d4)
  3377.  
  3378.      If  you  keep  using  this  method  to solve square matrix in different
  3379.      sizes, you may find it is  clumsy and  easy to  make mistakes.  Here is
  3380.      another program  that makes  the whole process of changing a lot easier
  3381.      for you and less error prone.
  3382.  
  3383.      !n=3
  3384.      ! matrix(a1[n,0],invers[a1..a1[n-1,n-1])
  3385.      ! end 
  3386.  
  3387.      n=3 so a1[3,0]=[1,1]+[3,0]=[4,1]=d1 and 
  3388.                a1[n-1,n-1]=[1,1][2,2]=[3,3]=c3.
  3389.  
  3390.      All you need to change is the constant n.
  3391.  
  3392.      String     ______
  3393.           You may store numerical data or TEXT string in a cell. To access a
  3394.      cell  as  a  string,  you  should  add  the "$" at the end of each cell
  3395.      reference. For example:
  3396.                                  A1$,  A1[i,j]$
  3397.  
  3398.           String  operators   for  comparisons,   concatenation  and  string
  3399.      functions  are  added  for  BASIC users. REMEMBER, string functions and
  3400.      concatenation are available  only  in  BASIC  statements  and commands.
  3401.      Currently, you  can assign  string to  cells but not the 150 variables.
  3402.      Two predefined string variables  are provided  for file  name and input
  3403.      buffer. They  are FILENAME$  and BUF$.  You can use them but you cannot
  3404.      assign new value to  them. FILENAME$  is changed  whenever you  use the
  3405.      file item  selector and  BUF$ is  changed whenever  you use the command
  3406.      INPUT. For  more details,  please refer  to "Text  files" for GET_FILE,
  3407.      INPUT #n and "Console:" for INPUT.
  3408.  
  3409.           If an  empty cell  is referred  as a string, a null string will be
  3410.      returned. If a cell with number is referred as a string, then  a string
  3411.      that is  exactly being displayed for that cell will be returned. If the
  3412.      cell is a TEXT string, a string excluding the leading character will be
  3413.      returned. The  leading character  for a TEXT string is one of ' " ^ and
  3414.      \.
  3415.  
  3416.           If you are assigning a string to a  cell, and  if the  string does
  3417.      not contain  one of those leading character, then the default character
  3418.      defined in "TEXT justification" of menu item "Defaults" will be used as
  3419.      the leading character for that cell.
  3420.           WARNING: DO NOT MAKE ANY STRING LONGER THAN 249 CHARACTERS.
  3421.  
  3422.      String operators:     String operators
  3423.           +:   string  concatenation.  For  example  "Thi"+"s  a  test" will
  3424.                return a string "This is a test".
  3425.           =:   string   assignment   or   string   equal   comparison.  E.g.
  3426.                !a1$="^123": END.  or !if a1$=b1$ then ...
  3427.  
  3428.                                      Page 45
  3429.  
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436.  
  3437.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  3438.  
  3439.           <>, >, <, =>, >=, =<, <=
  3440.                string  comparisons  for  not  equal, greater, less, equal or
  3441.                greater and equal or less than.
  3442.  
  3443.  
  3444.  
  3445.  
  3446.  
  3447.  
  3448.  
  3449.  
  3450.  
  3451.  
  3452.  
  3453.  
  3454.  
  3455.  
  3456.  
  3457.  
  3458.  
  3459.  
  3460.  
  3461.  
  3462.  
  3463.  
  3464.  
  3465.  
  3466.  
  3467.  
  3468.  
  3469.  
  3470.  
  3471.  
  3472.  
  3473.  
  3474.  
  3475.  
  3476.  
  3477.  
  3478.  
  3479.  
  3480.  
  3481.  
  3482.  
  3483.  
  3484.  
  3485.  
  3486.  
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.  
  3494.                                      Page 46
  3495.  
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502.  
  3503.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  3504.  
  3505.                              Flow control Statements
  3506.  
  3507.      IF .. THEN .. ELSE ..
  3508.           Syntax:
  3509.                IF conditionn THEN statements:ELSE statements
  3510.  
  3511.           Description:
  3512.                This statement is used to make  a decision  regarding program
  3513.                flow based on the result returned by an expression.
  3514.  
  3515.           Example:
  3516.                IF A1=12 THEN A2=20:ELSE A2=30
  3517.  
  3518.           NOTE: The following statements are not valid:
  3519.                     IF A1=12 THEN G3:ELSE GOTO G4
  3520.                     IF A1=12 GOTO G3
  3521.           If you  have used  traditional BASICs  before, you would know that
  3522.           you can write "IF A1=12 THEN 120:ELSE GOTO 130" and "IF A1=12 GOTO
  3523.           120" They  are not  valid in  SHEET. Instead, you must change them
  3524.           to:
  3525.                     IF A1=12 THEN GOTO G3:ELSE GOTO G4
  3526.                     IF A1=12 THEN GOTO G3
  3527.  
  3528.      GOTO
  3529.           Syntax:
  3530.                GOTO cell.
  3531.  
  3532.           Description:
  3533.                This  statement  is  used  to  branch  unconditionally  to  a
  3534.                specified cell.
  3535.  
  3536.           Example:
  3537.                GOTO A1
  3538.  
  3539.      GOSUB .. RETURN
  3540.           Syntax:
  3541.                GOSUB cell
  3542.                ...
  3543.                RETURN
  3544.  
  3545.           Description:
  3546.                These statements uses in pair for branching to, and returning
  3547.                from a subroutine.
  3548.  
  3549.      LOOP .. EXIT IF .. ENDLOOP
  3550.           Syntax:
  3551.                LOOP
  3552.                ...
  3553.                EXIT IF condition
  3554.                ....
  3555.                ENDLOOP
  3556.  
  3557.           Description:
  3558.                Those commands are used to execute a series  of statements in
  3559.  
  3560.                                      Page 47
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  3570.  
  3571.                a loop until some conditions are true. Condition is a logical
  3572.                expression which may be  either  TRUE  or  FALSE.  Within the
  3573.                LOOP, multiple EXIT IFs are allowed. It is adviced not to use
  3574.                GOTO statement to break the loop.
  3575.           Example:
  3576.                The following example assigns 1 to 20 to cell A1 through A20.
  3577.                     R=0
  3578.                     LOOP
  3579.                     A1[0,R]=R+1
  3580.                     R = R+1
  3581.                     EXIT IF R=20
  3582.                     ENDLOOP
  3583.  
  3584.      FOR .. NEXT
  3585.           Syntax:
  3586.                FOR assignment TO expression [STEP expression]
  3587.                ...
  3588.                NEXT variable_being_assigned
  3589.  
  3590.           Description:
  3591.                These commands are used to execute a series  of statements in
  3592.                a  definite  number  of  times.  STEP is optional. If no STEP
  3593.                value being provided, it is assumed to be one. In other BASIC
  3594.                interpreters, NEXT  I,J means: increases value of I, when the                             _________
  3595.                FOR loop for I is done, then increases  value of  J. You must
  3596.                use NEXT  I: NEXT J in SHEET BASIC. The number of nesting FOR                   _______________
  3597.                loops is infinite.
  3598.  
  3599.      RUN
  3600.           Syntax:
  3601.                RUN cell
  3602.  
  3603.           Description:
  3604.                RUN is similar to GOTO. The only difference is that  RUN will
  3605.                initialize the runtime stack and reset the symbol table. Most
  3606.                of the time, RUN is used to execute BASIC codes starting from
  3607.                a specified  cell. If  the cell is C1, you should enter "@run
  3608.                c1" in the editing buffer.
  3609.  
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.                                      Page 48
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.  
  3635.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  3636.  
  3637.                                  I/O Statements
  3638.  
  3639.      REDIRECT TO
  3640.           Syntax:
  3641.                REDIRECT TO "file"
  3642.  
  3643.           Description:
  3644.                     This statement changes  the  output  path  of subsequent
  3645.                PRINT  commands  to  the  specified  file.  There  are  a few
  3646.                predefined files. prn: is the printer,  con: is  your monitor                                 ____                  ____
  3647.                and aux:  is the rs-232 port. Otherwise, they are disk files.                   ____
  3648.                The default file is  con:. Except  con:, all  the file output
  3649.                are buffered. It means you may not get instant response.
  3650.                     If  you  redirect  the  output  to  printer  and if your
  3651.                printer is not on, an alert box will  show up.  If you choose
  3652.                "Quit", the  BASIC program being executed will be stopped. If
  3653.                you choose "Continue",  the  subsequent  PRINT  commands will
  3654.                output to the file prior to REDIRECT TO command. Most likely,
  3655.                it is con:. You should turn your printer on before you choose
  3656.                "Try again".
  3657.  
  3658.           EXAMPLE:
  3659.                REDIRECT TO "prn:"
  3660.  
  3661.  
  3662.      PRINT statement
  3663.           Syntax:
  3664.                PRINT cell/cell$/number/string[,/;...]
  3665.  
  3666.           Description:
  3667.                     This command  prints numeric  or string data to the file
  3668.                specified by REDIRECT  TO  command.  Implicitly,  it  is your
  3669.                monitor. If no data following the PRINT command, a blank line
  3670.                will be printed.  String  data  must  be  enclosed  by double
  3671.                quotation  marks.   Each  datum  can  be  a  cell  reference,
  3672.                variable, string or number. If more  than one  datum is going
  3673.                to  print,  each  of  them  should  be  separated by comma or
  3674.                semicolon. If you are using comma to separated  two data, the
  3675.                second data  will be  aligned to  the next TAB position. Each
  3676.                TAB is 10 characters wide.
  3677.                     If you are printing  cell content,  the format specified
  3678.                in  that  cell  is  used  exactly as display. If the cell you
  3679.                intended to print contains TEXT string, you should add "$" at
  3680.                the end  of the  cell reference.  Otherwise, you will print a
  3681.                cell with zero.
  3682.                     If  a  number  is  being  printed,  the  number  will be
  3683.                surrounded  by  a  leading  space  and  a trailing space. The
  3684.                output format of variables is similar to a  number.If you are
  3685.                printing  string,   the  text   inside  the  embraced  double
  3686.                quotation marks will be outputed.
  3687.                     While you are printing,  you  can  use  <Control  S> and
  3688.                <Control  Q>  to  suspend  and resume your display. BUT don't                                                                   _________
  3689.                press <Control C> to stop your PRINT session. If you do press               _____________________________________________________________
  3690.                <Control C>  while PRINT  command is printing on console, YOU               _____________________________________________________________
  3691.  
  3692.                                      Page 49
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.  
  3701.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  3702.  
  3703.                WILL GET back to desktop and you need to reboot the system to               _____________________________________________________________
  3704.                use SHEET. UES <ESC> to stop your BASIC program.               ________________________________________________
  3705.  
  3706.           Example:
  3707.                PRINT a1,12;b1$;20;"This is a test"
  3708.  
  3709.  
  3710.  
  3711.  
  3712.  
  3713.  
  3714.  
  3715.  
  3716.  
  3717.  
  3718.  
  3719.  
  3720.  
  3721.  
  3722.  
  3723.  
  3724.  
  3725.  
  3726.  
  3727.  
  3728.  
  3729.  
  3730.  
  3731.  
  3732.  
  3733.  
  3734.  
  3735.  
  3736.  
  3737.  
  3738.  
  3739.  
  3740.  
  3741.  
  3742.  
  3743.  
  3744.  
  3745.  
  3746.  
  3747.  
  3748.  
  3749.  
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.  
  3758.                                      Page 50
  3759.  
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766.  
  3767.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  3768.  
  3769.                             Miscellaneous statements
  3770.  
  3771.           If  you  print  to  console,  your current display may be garbled.
  3772.           Therefore, you  need  to  save  your  screen  before  printing and
  3773.           restore it after you are done.
  3774.  
  3775.      SAVE SCREEN
  3776.           Syntax:
  3777.                SAVE SCREEN
  3778.  
  3779.           Description:
  3780.                     Save current  display to  SCREEN reserved  area. That is
  3781.                the same area that  is used  for FAST  screen update.  If you
  3782.                deny to reserve 32K for fast screen update, you may crash the
  3783.                system when you use this command.
  3784.  
  3785.      RESTORE SCREEN
  3786.           Syntax:
  3787.                RESTORE SCREEN
  3788.  
  3789.           Description:
  3790.                Restore the screen to the old display.
  3791.  
  3792.      WAIT
  3793.           Syntax:
  3794.                WAIT
  3795.                WAIT #
  3796.  
  3797.           Description:
  3798.                     This statement suspends the execution of BASIC commands.
  3799.                # means an integer number. If no number follows WAIT, it will
  3800.                print "Press return to continue ..." on console  and you must
  3801.                press  <Return>  key  to  resume  its operations. The printed
  3802.                message will damage your display. Hence, you should save your
  3803.                screen before calling WAIT.
  3804.                     If WAIT  followed by  an integer x, then the system will
  3805.                wait for x seconds.
  3806.  
  3807.           Example:
  3808.                WAIT 5         (System suspends for 5 seconds)
  3809.  
  3810.      DEFINE
  3811.           Syntax:
  3812.                DEFINE fname(parameters) = expression
  3813.  
  3814.           Description:
  3815.                     This statement let user define its  own functions. Fname
  3816.                is the  function name. Its naming convention follows the rule
  3817.                for naming variable. You can put up to 9 parameters  for each
  3818.                user  function.  Each  parameter  is  a variable separated by
  3819.                comma. Each DEFINE statement  must occupy  a single  cell and
  3820.                user  defined  function  is  useful for numerical calculation
  3821.                only.
  3822.  
  3823.  
  3824.                                      Page 51
  3825.  
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.  
  3832.  
  3833.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  3834.  
  3835.      MESSAGE
  3836.           Syntax:
  3837.                MESSAGE "text"
  3838.  
  3839.           Description:
  3840.                     This  command  uses  the  GEM  alert  box  to  display a
  3841.                message. "text"  can be  a string of up to 5 lines. Each line
  3842.                is separated by "|" and the length of each line should not be
  3843.                bigger than 40.
  3844.  
  3845.           Example:
  3846.                MESSAGE "Hello|World"
  3847.  
  3848.      EXAMPLE: Address label program     EXAMPLE
  3849.           Assume  that   you  store   your  address   data  in  the  current
  3850.           spreadsheet. Column A holds the  Last  name.  Column  B  holds the
  3851.           First name. Column C holds the address and D,E,F holds City, State
  3852.           and Zip respectively. The  data starts  from row  3. The following
  3853.           program will  print the  data in your address sheet to the address
  3854.           label for handling mails.  Assume  the  program  stores  from cell
  3855.           G1..G10 and you run it by "@run g1".
  3856.  
  3857.      G1    : ! REDIRECT  TO "prn:" 
  3858.      G2    : !R=0: SAVE  SCREEN  
  3859.      G3    : ! LOOP 
  3860.      G4    : ! EXIT  IF  ISEMPTY(A3[0,R]): PRINT  
  3861.      G5    : ! PRINT A3[1,R]$;A3[0,R]$ 
  3862.      G6    : ! PRINT A3[2,R]$ 
  3863.      G7    : ! PRINT A3[3,R]$;A3[4,R]$;A3[5,R]$ 
  3864.      G8    : ! PRINT : PRINT :R=R+1 
  3865.      G9    : ! ENDLOOP : WAIT  
  3866.      G10   : ! RESTORE  SCREEN  
  3867.  
  3868.  
  3869.  
  3870.  
  3871.  
  3872.  
  3873.  
  3874.  
  3875.  
  3876.  
  3877.  
  3878.  
  3879.  
  3880.  
  3881.  
  3882.  
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.                                      Page 52
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898.  
  3899.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  3900.  
  3901.                                    Text files
  3902.  
  3903.                SHEET should  be the first spreadsheet which has the commands
  3904.           for you to access any TEXT  files. The  command is  line oriented.
  3905.           These commands  are intended  for people  who need to acquire data
  3906.           from other  sources.  There  are  two  constant  strings  that are
  3907.           related to some of the Text file commands. FILENAME$ is a constant
  3908.           string that can be changed by file item  selecto dialog  box. BUF$
  3909.           is a constant string that is modified by any INPUT statement.
  3910.  
  3911.                Using the file commands and string functions, you can do some
  3912.           thing that is impossible for user of other spreadsheet programs.
  3913.  
  3914.      GET_FILE
  3915.           Syntax:
  3916.                GET_FILE def_search, name$
  3917.  
  3918.           Description:
  3919.                     Use the  file  item  selector  to  find  the  file name.
  3920.                Def_search is  the default  search string. It can be a string
  3921.                with wild characters.  For  example  "\*.SHT".  name$  can be
  3922.                FILENAME$ or a cell reference.
  3923.  
  3924.           Example:
  3925.                GET_FILE "\*.*",filename$
  3926.                GET_FILE "\*.txt",a1$
  3927.  
  3928.      OPEN
  3929.           Syntax:
  3930.                OPEN "o",#n,filename$
  3931.                OPEN "i",#n,a1$
  3932.  
  3933.           Description:
  3934.                     Open a  file for  input or  output. "o" means output and
  3935.                "i" for input. #n  means the  channel number.  N should  be a
  3936.                number  from  0  to  9.  Filename  can be FILENAME$ or a cell
  3937.                reference.
  3938.  
  3939.           Example:
  3940.                OPEN "o",#1,FILENAME$
  3941.                OPEN "i",#2,"test.txt"
  3942.  
  3943.      CLOSE
  3944.           Syntax:
  3945.                CLOSE #n[,#m,...]
  3946.  
  3947.           Description:
  3948.                     Close opened files. #n , #m are the channel number. They
  3949.                should be  in the  range of  0 to  9. If  you try to close an
  3950.                unopened file, you will get an error message "Cannot close an
  3951.                unopened file".
  3952.  
  3953.           Example:
  3954.                CLOSE #1
  3955.  
  3956.                                      Page 53
  3957.  
  3958.  
  3959.  
  3960.  
  3961.  
  3962.  
  3963.  
  3964.  
  3965.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  3966.  
  3967.  
  3968.      INPUT #n
  3969.           Syntax:
  3970.                INPUT #n,buf$
  3971.  
  3972.           Description:
  3973.                     Read  a  line  from  the  input  file. #n is the channel
  3974.                number. buf$ can be BUF$ or a cell reference.  If the channel
  3975.                number being  referred is an output file or an unopened file,
  3976.                you will get an error message "Channel number error".
  3977.  
  3978.           Example:
  3979.                INPUT #1, BUF$
  3980.                INPUT #1, a1$
  3981.  
  3982.      PRINT #n
  3983.           Syntax:
  3984.                PRINT #n, cell/cell$/string/number[,/;....]
  3985.  
  3986.           Description:
  3987.                     PRINT #n is similar to PRINT  except that  PRINT outputs
  3988.                to  the  file  specified  by  REDIRECT  TO  (implicitly  your
  3989.                terminal). PRINT  #n  outputs  to  the  channel  number being
  3990.                opened by OPEN command.
  3991.  
  3992.           Example:
  3993.                Assume that  cell a1$="This  is a  test" and b1=12.34 and the
  3994.                widths of column A and B are 9.
  3995.                PRINT #1,a1;b1      ==> "       0    12.34 " to #1
  3996.                PRINT #1,a1$;b1     ==> "This is a test   12.34 " to #1
  3997.  
  3998.  
  3999.  
  4000.  
  4001.  
  4002.  
  4003.  
  4004.  
  4005.  
  4006.  
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.                                      Page 54
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.  
  4031.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  4032.  
  4033.                                Worksheet commands
  4034.  
  4035.                SHEET BASIC is part of SHEET  -- the  spreadsheet program. It
  4036.           is more convenient if you can use some of those worksheet commands
  4037.           to handle data in your BASIC  program. This  new version  of SHEET
  4038.           provides  some  of  the  essential  worksheet  commands for you to
  4039.           incorporate  with  your  program.  They  are  COPY,  MOVE,  ERASE,
  4040.           REFORMAT, SORT  and SWAP. SORT and SWAP are new commands for SHEET
  4041.           too. Currently, they can be activated by BASIC commands only. They
  4042.           work fine  with cells  whose formula  do not refer to other cells.
  4043.           That is because the  cell  references  in  those  formula  are not
  4044.           updated  when  you  SWAP  them.  Next  release  should remove this
  4045.           restriction.
  4046.  
  4047.      COPY
  4048.           Syntax:
  4049.                COPY block1, block2
  4050.  
  4051.           Description:
  4052.                     Copy block1 to block2. A block can be a single cell or a
  4053.                rectangle portion  of the worksheet. The COPY command follows
  4054.                the rule for COPYing cells by <Ctrl-C>.
  4055.  
  4056.           Example:
  4057.                COPY a1..b3, c1
  4058.  
  4059.      MOVE
  4060.           Syntax:
  4061.                MOVE block1, block2
  4062.  
  4063.           Description:
  4064.                     Move block1 to block2.  It  is  similar  to  the command
  4065.                <Ctrl-M>.
  4066.  
  4067.           Example:
  4068.                MOVE a1..b3, c1
  4069.  
  4070.      ERASE
  4071.           Syntax:
  4072.                ERASE block1[,block2,...]
  4073.  
  4074.           Description:
  4075.                     Erase portion  of the worksheet specified by the blocks.
  4076.                Up to 18 blocks can be erased at one time.
  4077.  
  4078.           Example:
  4079.                ERASE a1..b3,c1..d3
  4080.  
  4081.      REFORMAT
  4082.           Syntax:
  4083.                REFORMAT FORMAT,block1[,block2,...]
  4084.  
  4085.           Description:
  4086.                     Reformat portion of the worksheet. Up  to 18  blocks can
  4087.  
  4088.                                      Page 55
  4089.  
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096.  
  4097.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  4098.  
  4099.                be reformat at one time. FORMAT is a string which consists of
  4100.                two part -- format and decimal places. A  format can  be "$",
  4101.                ",",  "F",  "S",  "D1",  "D2",  "D3". "$" for DOLLAR, "," for
  4102.                COMMA, "F" for FIXED, "S" for SCINETIFIC and "D1", "D2", "D3"
  4103.                for DATE1,  DATE2, and  DATE3 respectively. No decimal places
  4104.                should follow "D1","D2" and "D3".
  4105.  
  4106.           Example:
  4107.                REFORMAT "$2",A1..B3
  4108.                     (reformat a1..b3 for dollar and 2 decimal places)
  4109.                REFORMAT "D1", C1..C12
  4110.                     (reformat C1..c12 for Date1 format)
  4111.  
  4112.      SORT
  4113.           Syntax:
  4114.                SORT "A",block, cell1[,cell2,...]
  4115.                SORT "D",block, cell1[,cell2,...]
  4116.  
  4117.           Description:
  4118.                     Sort followed by "A" means sort block in ascending order
  4119.                and "D" for descending order. Only the block will be affected
  4120.                by the sort command. Cell1 points to the first column that is
  4121.                used for  comparison. Up  to 6  of these cells can be used as
  4122.                criteria for comparisons. In  comparison,  an  empty  cell is
  4123.                smaller  than  a  cell  with  numerical value and a cell with
  4124.                numerical value is smaller than a cell contains  TEXT string.
  4125.                If the  column being  compared consists  of BASIC statements,
  4126.                SORT will be stopped. Currently,  SORT  does  not  modify the
  4127.                formula on  each cell being affected. You may have trouble in
  4128.                sorting cells whose formula refers to other cells.
  4129.  
  4130.           Example:
  4131.                SORT "A",A1..B3,A1
  4132.  
  4133.      SWAP
  4134.           Syntax:
  4135.                SWAP cell1, cell2
  4136.  
  4137.           Description:
  4138.                     This command  swaps cell1  with cell2.  It swaps between
  4139.                two cells.  If you  want to  swap a  row with  other row, you
  4140.                should use a FOR  loop to  do it  one by  one. Again,  it has
  4141.                problem with cell whose formula refers to other cell.
  4142.  
  4143.           Example:
  4144.                SWAP a1,b2
  4145.  
  4146.  
  4147.  
  4148.  
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.                                      Page 56
  4155.  
  4156.  
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162.  
  4163.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  4164.  
  4165.                                 Console commands                                ________________
  4166.                The  Atari  monitor  emulates  the VT52 terminal. You can use
  4167.           those VT52 commands to control your output. This  version of SHEET
  4168.           provides some  of the  VT52 commands  in the SHEET BASIC. They are
  4169.           CLS, CURSORON, CURSOROFF,  VIDEOHIGH,  VIDEONORM  and  GOTOXY. One
  4170.           function  and  two  commands  for  reading  keyboard  entries  are
  4171.           provided. They are INKEY, UNGET and INPUT.
  4172.  
  4173.                Screen coordinate: (1,1) is the upper  left-corner, (80,1) is
  4174.           the  upper  right-corner,  (1,25)  is  the  bottom left-corner and
  4175.           (80,25) is the bottom right-corner.
  4176.  
  4177.      CLS
  4178.           Syntax:
  4179.                CLS
  4180.  
  4181.           Description:
  4182.                Clear the current screen and move the cursor  to the position
  4183.                1,1.
  4184.  
  4185.      CURSORON
  4186.           Syntax:
  4187.                CURSORON
  4188.  
  4189.           Description:
  4190.                Makes the screen cursor visible.
  4191.  
  4192.      CURSOROFF
  4193.           Syntax:
  4194.                CURSOROFF
  4195.  
  4196.           Description:
  4197.                Turns the screen cursor off.
  4198.  
  4199.      VIDEOHIGH
  4200.           Syntax:
  4201.                VIDEOHIGH
  4202.  
  4203.           Description:
  4204.                Makes the subsequent output characters in reverse color
  4205.  
  4206.      VIDEONORM
  4207.           Syntax:
  4208.                VIDEONORM
  4209.  
  4210.           Description:
  4211.                Makes the subsequent output characters in normal color
  4212.  
  4213.      GOTOXY
  4214.           Syntax:
  4215.                GOTOXY x,y
  4216.  
  4217.           Description:
  4218.                     Moves the  screen cursor  to position  x,y. x  is in the
  4219.  
  4220.                                      Page 57
  4221.  
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228.  
  4229.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  4230.  
  4231.                range of 1 to 80 and y is in the range of 1 to 25.
  4232.  
  4233.      INKEY
  4234.           Syntax:
  4235.                a=INKEY
  4236.  
  4237.           Description:
  4238.                     It is a function that returns the ASCII number of  a key
  4239.                being pressed. If no key or special keys are being pressed -1
  4240.                will be returned. Arrow keys for  Up, Down,  Left, Right have
  4241.                value of  129,130,131 and  132 respectively . Arrow keys with
  4242.                Shift  keys  for  Up,  Down,  Left,  Right  have   values  of
  4243.                133,134,135 and 136.
  4244.  
  4245.           Example:
  4246.                A=INKEY
  4247.  
  4248.      UNGET
  4249.           Syntax:
  4250.                UNGET x
  4251.  
  4252.           Description:
  4253.                Put x back to the input stream for later INPUT uses.
  4254.  
  4255.           Example:
  4256.                A=INKEY:.... :UNGET a
  4257.  
  4258.      INPUT
  4259.           Syntax:
  4260.                INPUT buf$
  4261.  
  4262.           Description:
  4263.                     buf$  can  be  either  BUF$  or  a  cell reference. This
  4264.                routine calls the standard C function gets to get your input.
  4265.                If  you  UNGET  a  character before calling this command, the
  4266.                UNGET character cannot be altered or displayed but it will be
  4267.                the first character in your buf$.
  4268.  
  4269.  
  4270.  
  4271.  
  4272.  
  4273.  
  4274.  
  4275.  
  4276.  
  4277.  
  4278.  
  4279.  
  4280.  
  4281.  
  4282.  
  4283.  
  4284.  
  4285.  
  4286.                                      Page 58
  4287.  
  4288.  
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294.  
  4295.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  4296.  
  4297.                                 Graphic commands                                ________________
  4298.  
  4299.           Your  monitor  can  be  used  to  display pictures. A picture is a
  4300.      collection of picture elements (pixels). Some  people prefer  to call a
  4301.      pixel a  dot. Normal  graphic commands in other BASIC languages provide
  4302.      you a mean to change each pixel in your display.  The addressing method
  4303.      they used  are called  Raster coordinate.  The left top-corner is (0,0)
  4304.      and the right bottom-corner  is (639,399),  (639,199) or  (319,199) for
  4305.      high, medium and low resolution.
  4306.           In real world, we are dealing with Cartesian coordinate instead of
  4307.      Raster coordinate. The left bottom-corner is  the minimal  point we can
  4308.      use  for  display  and  the  right top-corner is the maximal point. The
  4309.      graphic commands provided by SHEET BASIC  use the  Cartesian coordinate
  4310.      and those commands will translate Cartesian points to pixels.
  4311.           SHEET  BASIC  is  not  the  first  BASIC interpreter which provide
  4312.      scientific graphics (at least True BASIC is a few years earlier). But I
  4313.      think it  is the first BASIC provides cubic spline curves. Cubic spline
  4314.      is a method scientists use to draw smooth curves.
  4315.           The graphic commands are highly relocatable  and they  work on any
  4316.      resolution. Hence,  it is  possible to use 16 colors to plot your graph
  4317.      in low resolution.
  4318.           The graphics commands are separated into the following categories:
  4319.                Setup commands:               Setup commands:     WINDOW  or  VIEWPORT,  SCALE,  EXITGRAPH,
  4320.                                    CLEAR
  4321.                Line/Dot commands:               Line/Dot commands:  ATTRIBUTE,  LINE,   LINE_TO,  PLOT,  PLOT
  4322.                                    DATA, SPLINE
  4323.                Turtlegraphics:               Turtlegraphics      FORWARD, TURN, TURN_TO
  4324.                Axis commands:               Axis commands       MARKX, MARKY, LABELX, LABELY
  4325.                Text command:               Text command:       PTEXT
  4326.                Miscellaneous:               Miscellaneous:      MOUSE_POS
  4327.  
  4328.           CONVENTION:          CONVENTION     Optional  parameters  are  bracketed.   #  means  a
  4329.                          number. (x,y),  (x1,y1) and (x2,y2) are measured in
  4330.                          Cartesian coordinate. An  r  added  before  x  or y
  4331.                          means the point is in Raster coordinate.
  4332.  
  4333.  
  4334.  
  4335.  
  4336.  
  4337.  
  4338.  
  4339.  
  4340.  
  4341.  
  4342.  
  4343.  
  4344.  
  4345.  
  4346.  
  4347.  
  4348.  
  4349.  
  4350.  
  4351.  
  4352.                                      Page 59
  4353.  
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360.  
  4361.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  4362.  
  4363.  
  4364.      Setup commands:     ______________
  4365.           WINDOW or  VIEWPORT defines  the part of the screen being used for
  4366.      graphic output. They are the  only  commands  whose  parameters  are in
  4367.      Raster coordinate. SCALE defines the scaling factors that translate the
  4368.      Cartesian corrdinate data into location on  your display.  CLEAR cleans
  4369.      up the  area defined  by WINDOW or VIEWPORT. WINDOW and VIEWPORT change
  4370.      the clipping area. The last command after your graph is  done should be
  4371.      EXITGRAPH  which  resets  the  clipping  area  to  the  current window.
  4372.      Otherwise, you may have an illusion that your system is locked. In case
  4373.      you  feel  your  system  is  locked,  you should try <Esc> first to see
  4374.      whether a BASIC program  is running.  If the  system is  still lock-up,
  4375.      enter the  command "@EXITGRAPH" in blind and you should have the system
  4376.      back.
  4377.  
  4378.           WINDOW:          ______
  4379.                Syntax:
  4380.                     WINDOW [# [,rx1,ry1,rx2,ry2] ]
  4381.  
  4382.                Description:
  4383.                          If no parameter provides for this command, then the
  4384.                     current window will be used for graphic output.
  4385.                          SHEET supports up to 4 windows. Each window has its
  4386.                     own number ranging from 1 to 4. This  number corresponds
  4387.                     to the  number you  press ALT-1,  ALT-2, ALT-3 or ALT-4.
  4388.                     So, you can use any window for graphics output.
  4389.                          If  raster  parameters  provide,  then  the  window
  4390.                     specified will  be resized  to those coordinates and the
  4391.                     work area of  that  window  will  be  used  for graphics
  4392.                     output. If  a window changes it size, AES will ask SHEET
  4393.                     to redraw it. So, you may need to run your program twice
  4394.                     to get the graph.
  4395.                          If the window number specified has not been opened,
  4396.                     then you won't see the graph, but the  BASIC interpreter
  4397.                     will not stop.
  4398.  
  4399.                Examples:
  4400.                     WINDOW                   using the current window
  4401.                     WINDOW 1                 using window 1
  4402.                     WINDOW 1,0,20,350,120    reposition and resize window 1
  4403.  
  4404.                Hints:
  4405.                          If your  program involves a lot of calculation, and
  4406.                     you don't want to  run  the  program  twice  to  get the
  4407.                     graph, you  can stop  your program by <Esc> key when you
  4408.                     see the window has been resized and then  enter the same
  4409.                     run command  again in  blind. So, you have better to put
  4410.                     your WINDOW command on the first line.
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.  
  4418.                                      Page 60
  4419.  
  4420.  
  4421.  
  4422.  
  4423.  
  4424.  
  4425.  
  4426.  
  4427.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  4428.  
  4429.  
  4430.           VIEWPORT:          ________
  4431.                Syntax:
  4432.                     VIEWPORT rx1,ry1,rx2,ry2
  4433.  
  4434.                Description:
  4435.                          WINDOW lets you to borrow  the  working  area  of a
  4436.                     spreadsheet window.  VIEWPORT command  lets you put your
  4437.                     picture  anywhere  in  your   screen.   If   the  raster
  4438.                     parameters  are  0,0,0,0  then  the whole screen will be
  4439.                     used for graphic display. It is desirable if you want to
  4440.                     test  the  graph  on  medium  resolution and display the
  4441.                     final graph on low resolution.
  4442.  
  4443.                Examples:
  4444.                     VIEWPORT 0,0,0,0
  4445.                     VIEWPORT 0,0,350,120
  4446.  
  4447.  
  4448.           SCALE:          _____
  4449.                Syntax:
  4450.                     SCALE xmin, ymin, xmax, ymax
  4451.  
  4452.                Description:
  4453.                          SCALE setup the scaling factors which  are used for
  4454.                     mapping Cartesian  coordinate data  to Raster coordinate
  4455.                     pixels.  xmin,ymin  specifies  the   left  bottom-corner
  4456.                     coordinate  and  xmax,ymax  the  right  top-corner.  You
  4457.                     should make the scale a little bit larger  than what you
  4458.                     want to leave some spaces for texts.
  4459.  
  4460.           CLEAR:          _____
  4461.                Syntax:
  4462.                     CLEAR
  4463.  
  4464.                Description:
  4465.                          This command  clears the screen specified by WINDOW
  4466.                     or VIEWPORT commands.
  4467.  
  4468.           EXITGRAPH:          _________
  4469.                Syntax:
  4470.                     EXITGRAPH
  4471.  
  4472.                Description:
  4473.                          WINDOW  and  VIEWPORT  commands   will  change  the
  4474.                     clipping area. EXITGRAPH resets the clipping area to the
  4475.                     current window and refreshes  it  (sometimes  your graph
  4476.                     may overwrite part of the current window).
  4477.  
  4478.  
  4479.  
  4480.  
  4481.  
  4482.  
  4483.  
  4484.                                      Page 61
  4485.  
  4486.  
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492.  
  4493.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  4494.  
  4495.      Line/Dot commands:     _________________
  4496.           Each line  posseses some  attributes. It  has color, width and its
  4497.      type. A line can be a solid, or broken line. This is the type of a line
  4498.      and there are 6 line types defined.
  4499.           A dot  has color and width. Instead of dot, sometimes you may want
  4500.      to display your data  using  markers.  There  are  6  different markers
  4501.      defined in SHEET BASIC graphic commands.
  4502.           SHEET BASIC  is part  of the  spreadsheet SHEET. You may have your
  4503.      data stored in the spreadsheet. There are two special commands  to plot
  4504.      data stored in cells. They are PLOT DATA and SPLINE.
  4505.  
  4506.           ATTRIBUTE:          _________
  4507.                Syntax
  4508.                     ATTRIBUTE color#,width
  4509.  
  4510.                Description:
  4511.                          ATTRIBUTE  command  changes  the color and width of
  4512.                     subsequent graphic  commands.  The  default  color  is 2
  4513.                     which is red and the default width is 1.
  4514.  
  4515.           LINE:          ____
  4516.                Syntax:
  4517.                     LINE x1,y1,x2,y2[,linetype]
  4518.  
  4519.                Description:
  4520.                          This command  draws a line from (x1,y1) to (x2,y2).
  4521.                     If no type specified, it is  supposed to  be solid line.
  4522.                     The parameter type is a number ranging from 1 to 6.
  4523.                          linetype:
  4524.                               1:   solid line
  4525.                               2:   long dashes
  4526.                               3:   dots
  4527.                               4:   dash-dots
  4528.                               5:   dashes
  4529.                               6:   dash-dot-dot
  4530.  
  4531.           LINE_TO:          _______
  4532.                Syntax:
  4533.                     LINE_TO x1,y1[,type]
  4534.  
  4535.                Description:
  4536.                          This  command   draws  a  line  from  the  previous
  4537.                     position  to  (x1,y1).   The   last   line/dot  commands
  4538.                     specified the previous position. If the program is newly
  4539.                     executed, the previous position is (0,0).
  4540.  
  4541.  
  4542.  
  4543.  
  4544.  
  4545.  
  4546.  
  4547.  
  4548.  
  4549.  
  4550.                                      Page 62
  4551.  
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558.  
  4559.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  4560.  
  4561.           PLOT:          ____
  4562.                Syntax:
  4563.                     PLOT x,y[,marker#]
  4564.  
  4565.                Description:
  4566.                          If no marker number  specified,  PLOT  command will
  4567.                     draw a dot on the position (x,y). The markers chosen for
  4568.                     SHEET BASIC are model after Lotus 123.
  4569.                          MARKER:
  4570.                               1:   square
  4571.                               2:   +
  4572.                               3:   diamond
  4573.                               4:   up-triangle
  4574.                               5:   x
  4575.                               6:   down-triangle
  4576.  
  4577.           PLOT DATA:          _________
  4578.                Syntax:
  4579.                     PLOT DATA xrange, yrange[,marker#, linetype]
  4580.  
  4581.                Description:
  4582.                          The data are stored  in the  spreadsheet. PLOT DATA
  4583.                     accesses x,y pairs from the xrange and yrange specified.
  4584.                     It will plot data from the first row to the  last row in
  4585.                     the range.  Please refers  to PLOT for marker number and
  4586.                     LINE for linetype. NOTE: if your  data are  quite dense,
  4587.                     the linetype other than 1 may not break the line the way
  4588.                     you specified.
  4589.  
  4590.           SPLINE          ______
  4591.                Syntax:
  4592.                     SPLINE xrange, yrange,increment
  4593.  
  4594.                Description:
  4595.                          Given n points (knots), mathematicians can  find n-
  4596.                     1 different  cubic polynomials  that pass  through the n                      _________
  4597.                     points. This curve  generated  by  those  polynomials is
  4598.                     called  spline-curve.  It  is  a smooth curve and it may
  4599.                     represent the  data  more  closely  than  connecting the
  4600.                     points with  lines. Increment should be smaller than any
  4601.                     subinterval of the n  points. NOTE:  To use  SPLINE, you                                                  NOTE:  To use  SPLINE, you
  4602.                     must provide at least 4 points.                    must provide at least 4 points.           
  4603.  
  4604.  
  4605.  
  4606.  
  4607.  
  4608.  
  4609.  
  4610.  
  4611.  
  4612.  
  4613.  
  4614.  
  4615.  
  4616.                                      Page 63
  4617.  
  4618.  
  4619.  
  4620.  
  4621.  
  4622.  
  4623.  
  4624.  
  4625.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  4626.  
  4627.      Turtlegraphics:     ______________
  4628.           Turtlegraphics is quite interesting. I add these commands just for
  4629.      fun. Only three commands are provided though.
  4630.  
  4631.           FORWARD:          _______
  4632.                Syntax:
  4633.                     FORWARD distance
  4634.  
  4635.                Description:
  4636.                          FORWARD command in LOGO  uses pixel  as measurement
  4637.                     for  distance.   SHEET  BASIC  uses  the  scale  factors
  4638.                     specified by SCALE  as  measurement  for  distance. This
  4639.                     command moves the drawing pen specified by the parameter
  4640.                     distance. Distance can be  negative  which  make FORWARD
  4641.                     acts as BACK in LOGO.
  4642.  
  4643.                Example:
  4644.                     FORWARD 5.2
  4645.  
  4646.           TURN, TURN_TO:          ____  _______
  4647.                Syntax:
  4648.                     TURN degree
  4649.                     TURN_TO degree
  4650.  
  4651.                Description:
  4652.                          They  are  the  only  commands in SHEET BASIC using
  4653.                     degrees instead  of radians.  Degree 0  points to North.
  4654.                     East is  90 degree,  South is  180 and West is 270. TURN
  4655.                     turns the  active  turtle  by  the  amount  specified in
  4656.                     rotation.  TURN  is  similar  to  LEFT  if the degree is
  4657.                     positive and RIGHT if the degree is negative. TURN_TO is
  4658.                     similar to  SETHEADING in LOGO, which sets the direction
  4659.                     of the active turtle to a specified angle.
  4660.  
  4661.  
  4662.  
  4663.  
  4664.  
  4665.  
  4666.  
  4667.  
  4668.  
  4669.  
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679.  
  4680.  
  4681.  
  4682.                                      Page 64
  4683.  
  4684.  
  4685.  
  4686.  
  4687.  
  4688.  
  4689.  
  4690.  
  4691.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  4692.  
  4693.      Axis command:     ____________
  4694.           It is easy to draw the  x-axis and  y-axis by  using LINE command,
  4695.      but you  may also want to know where x=3 on the x-axis. MARKX and MARKY
  4696.      commands help you to mark your axes with measurement. LABELX and LABELY
  4697.      let you add the number 3 under the mark.
  4698.  
  4699.           MARKX/MARKY:          ___________
  4700.                Syntax:
  4701.                     MARKX y_origin, xmin, xmax, xinc, xstep
  4702.                     MARKY x_origin, ymin, ymax, yinc, ystep
  4703.  
  4704.                Description:
  4705.                          An example  may help  me to explain better. Suppose
  4706.                     that you are drawing an x-y  graph for  your income from
  4707.                     1970  to  1988  and  your  income  ranges from 12,000 to
  4708.                     40,000.
  4709.                               SCALE 1969, 0, 1989, 45000
  4710.                     Making the x-axis one year larger on both sides give you
  4711.                     some blank  spaces. You do not care about amount smaller
  4712.                     than 12,000. The following command draws the x-axis.
  4713.                               LINE 1969,12000,1989,12000
  4714.                     Your y_origin starts from 12000. xmin  is 1970  and xmax
  4715.                     is 1988.  You want  to mark  each year and have a bigger
  4716.                     mark on each five year. Here is the command:
  4717.                               MARKX 12000,1970,1988,1,5
  4718.                     MARKY works similarly.
  4719.  
  4720.                     NOTE: xstep should be a multiple of xinc.
  4721.  
  4722.           LABELX/LABELY:          _____________
  4723.                Syntax:
  4724.                     LABELX y_origin, xmin, xmax, xinc, format
  4725.                     LABELY x_origin, ymin, ymax, yinc, format
  4726.  
  4727.                Description:
  4728.                          I am using the same example on MARKX. Now, you want
  4729.                     to add  the year 1970 to 1988 on your graph. The command
  4730.                     to do this is:
  4731.                               LABELX 12000,1970,1988,1,"f0"
  4732.                     You may find some  of the  numbers are  overlapped. Then
  4733.                     you should adjust xinc.
  4734.  
  4735.                     Format is a string that specified what kind of format we
  4736.                     are going to use  for displaying  the labels. Currently,
  4737.                     there are  two formats  supported by  LABELX and LABELY.
  4738.                     They are FIXED and SCIENTIFIC. The string starts with an
  4739.                     f or  F means  the labels  are FIXED  number. The number
  4740.                     following f/F is the decimal place.  A scientific format
  4741.                     starts  with  an  s/S.  The  format string ("f0") on the
  4742.                     example means that we are displaying integers.
  4743.  
  4744.  
  4745.  
  4746.  
  4747.  
  4748.                                      Page 65
  4749.  
  4750.  
  4751.  
  4752.  
  4753.  
  4754.  
  4755.  
  4756.  
  4757.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  4758.  
  4759.      Text command:     ____________
  4760.  
  4761.           PTEXT:          _____
  4762.                Syntax:
  4763.                     PTEXT x,y,string[,color, effects, rotation, height]
  4764.  
  4765.                Description:
  4766.                          PTEXT plots string on the location (x,y). There are
  4767.                     some special effects:
  4768.                          1:   bold face
  4769.                          2:   light
  4770.                          4:   italic
  4771.                          8:   underline
  4772.                          16:  outline
  4773.                          32:  shadowed
  4774.                     If you  want to  use more  than one special effects, you
  4775.                     can do that by adding the  number for  each effects. For
  4776.                     example, if  you want  to plot the string with bold face
  4777.                     and underline, you should use 9 (1+8) for the effects.
  4778.  
  4779.                     Rotation  changes  the  direction  the  characters being
  4780.                     displayed.
  4781.                          0:        East
  4782.                          900:      North
  4783.                          1800:     West
  4784.                          2700:     South
  4785.  
  4786.                     Height of  a font  may be  changed but you may not get a
  4787.                     good result. The following  height  numbers  provide the
  4788.                     best result for small and normal fonts.
  4789.                          Color monitor:
  4790.                               small font:    4
  4791.                               normal font:   6
  4792.                          Monochrome monitor:
  4793.                               small font:    6
  4794.                               normal font:   13
  4795.  
  4796.  
  4797.  
  4798.  
  4799.  
  4800.  
  4801.  
  4802.  
  4803.  
  4804.  
  4805.  
  4806.  
  4807.  
  4808.  
  4809.  
  4810.  
  4811.  
  4812.  
  4813.  
  4814.                                      Page 66
  4815.  
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822.  
  4823.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  4824.  
  4825.      Miscellaneous:     _____________
  4826.  
  4827.  
  4828.           MOUSE_POS:          _________
  4829.                Syntax:
  4830.                     MOUSE_POS x,y
  4831.  
  4832.                Description:
  4833.                          x,y  should   be  variables   or  cell  references.
  4834.                     MOUSE_POS will wait for you to press the  left button on
  4835.                     your  mouse.  If  your  mouse cursor is within the block
  4836.                     specified by WINDOW or  VIEWPORT, then  the Cartesian of
  4837.                     the mouse  cursor will  be stored on x,y. Otherwise, the
  4838.                     Raster coordinate is stored on x,y.
  4839.                          This command  is useful  for finding  the value for
  4840.                     WINDOW,  VIEWPORT  or  PTEXT.  It is also useful to find
  4841.                     some data points from your graph.
  4842.  
  4843.                Hints:
  4844.                          Mouse click response time varies not  in a constant
  4845.                     way (refer  to problems part). You may better add a WAIT                                                                        ____
  4846.                     1 statement after the MOUSE_POS. So, user can  press the                    _
  4847.                     button  a  little  bit  longer  without causing problem.
  4848.                     Also, MOUSE_POS will keep  polling until  you press your
  4849.                     mouse  button.  It  means  your  system is suspended for
  4850.                     mouse click. You cannot break its  operation by pressing
  4851.                     <Esc>. You  have better  add an ALERT or MESSAGE telling
  4852.                     user to press the mouse button.
  4853.  
  4854.  
  4855.  
  4856.  
  4857.  
  4858.  
  4859.  
  4860.  
  4861.  
  4862.  
  4863.  
  4864.  
  4865.  
  4866.  
  4867.  
  4868.  
  4869.  
  4870.  
  4871.  
  4872.  
  4873.  
  4874.  
  4875.  
  4876.  
  4877.  
  4878.  
  4879.  
  4880.                                      Page 67
  4881.  
  4882.  
  4883.  
  4884.  
  4885.  
  4886.  
  4887.  
  4888.  
  4889.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  4890.  
  4891.                             Tips on using SHEET BASIC
  4892.      Interrupt:     Interrupt
  4893.                You can stop your BASIC program by pressing <Esc> key.
  4894.  
  4895.      Using previous row format:     Using previous row format
  4896.                If  your  BASIC  program  generates  a  lot  of  data  to the
  4897.           worksheet,  you  should  choose  "Using previous format" from menu
  4898.           item "Options" to non.  It will  speed up  a little  of your BASIC
  4899.           program.
  4900.  
  4901.      Error:     Error
  4902.                When the BASIC interpreter encounters error, it will tell you
  4903.           what is wrong and where the offending code is. You  can use  F2 to
  4904.           edit that  line and re-run it again. If your offending cell is for
  4905.           example G12, instead of re-run it,  you  can  use  "@goto  g12" to
  4906.           continue your program. It may save you some time.
  4907.  
  4908.      Multiple statements:     Multiple statements
  4909.                You  can  enter  more  than  one  statement  in  a cell. Each
  4910.           statement must be separated by colon. Entering multiple statements
  4911.           in  one  cell  will  save  some  memory,  but don't enter too many
  4912.           because your editing buffer can hold 250 characters only.
  4913.  
  4914.      Garbled screen:     Garbled screen
  4915.                If you output some data to your monitor,  your current screen
  4916.           display will  be garbled.  In case  you forget to save your screen
  4917.           before you print, you  can rebuild  your display  by the following
  4918.           steps:
  4919.                -    Select the menu bar and choose "About SHEET"
  4920.                -    Press return when the dialog shown up.
  4921.                -    If the  number of  windows being  opened is less than 4,
  4922.                     you can choose "New" to open up a new worksheet and then
  4923.                     close it.
  4924.                -    If the  number is  4, then you must move your window out
  4925.                     of the screen and move it back.
  4926.  
  4927.      Adjust:     Adjust
  4928.                When I wrote the first SHEET  BASIC  program,  I  felt  it is
  4929.           clumsy  to  enter  "!"  at  the  beginning of each statement and I
  4930.           forgot to enter "!" in some cells. If you have  the same problems,
  4931.           you can use the following technique to enter BASIC statement.
  4932.                As we know, each BASIC statement starts with an alpha letter.
  4933.           SHEET will treat any  cell entry  starts with  an alpha  letter as
  4934.           TEXT string.  You can  enter your  BASIC codes  as text string and
  4935.           then adjust them to BASIC statements. The steps to adjust codes:
  4936.                -    select blocks to cover the desired cells
  4937.                -    Press <Control A> and choose "BASIC  (!)" to  adjust the
  4938.                     text string to BASIC statements.
  4939.  
  4940.  
  4941.  
  4942.  
  4943.  
  4944.  
  4945.  
  4946.                                      Page 68
  4947.  
  4948.  
  4949.  
  4950.  
  4951.  
  4952.  
  4953.  
  4954.  
  4955.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  4956.  
  4957.                           Appendix A BUILT-IN FUNCTIONS                          _____________________________                                                       
  4958.  
  4959.      Math:     ____
  4960.           General functions:
  4961.                ABS(x):   Absolute function of x
  4962.                INT(x):   Integer part of x (e.g. +int(12.4) = 12)
  4963.                FRAC(x):  Fraction part of x (e.g. +frac(12.4) = 0.4)
  4964.                FACT(x):  Factorial of x. X < 34
  4965.                SQR(x):   Square function of x
  4966.                SQRT(x):  Square root of x
  4967.  
  4968.           Trigo & logarithm functions:
  4969.                SIN(x):   Sine function of x. X is measured in radian
  4970.                COS(x):   Cosine function of x.
  4971.                TAN(x):   Tangent function of x.
  4972.                ASIN(x):  Arc sine function of x
  4973.                ACOS(x):  Arc cosine function of x
  4974.                ATAN(x):  Arc tangent of x
  4975.                LOG(x):   Logarithm base 10
  4976.                LN(x):    Logarithm base e
  4977.                EXP(x):   Exponent of x
  4978.                RAD_DEG(x): Radian to degree
  4979.                DEG_RAD(x): Degree to radian
  4980.  
  4981.           DATE functions:
  4982.                DATE(mm,dd,yy): Function for calculating Julian days.
  4983.                DAY(x):   Day of x. X is Julian day
  4984.                MONTH(x): Month of x
  4985.                YEAR(x):  Year of x
  4986.                NOTE: 1.  You  can  use  the  following  formula  to find the
  4987.                          weekday of the date:
  4988.                                (date(mm,dd,yy)+1) mod 7
  4989.                          0 if Sunday, 1 if Monday and so on.
  4990.                      2.  You can  use  the  following  formula  to  find the
  4991.                          number of days on a specific month.
  4992.                          case 1: mm<12       date(mm+1,1,yy)-date(mm,1,yy)
  4993.                          case 2: mm=12       date(1,1,yy+1)-date(mm,1,yy)
  4994.  
  4995.           Matrix functions:
  4996.                     A matrix  in a  worksheet is a block embraced by "[" and
  4997.                "]". For example, to make A1..C3  as a  matrix, it  should be
  4998.                [A1..C3].  Versions  before  2.0 of SHEET restrict individual
  4999.                matrix size within 64K. This limit has been removed.
  5000.  
  5001.                     Matrix operators include *,+ and -. There is no priority
  5002.                for those  matrix operators.  Formula is calculated from left
  5003.                to right. Parenthesis can be used  to change  the calculation
  5004.                order.
  5005.  
  5006.                     There are  only two  matrix functions.  They are INVERSE
  5007.                and TRANSPOSE. Their arguments must be  a matrix  or a matrix
  5008.                operations grouped by parenthesis.
  5009.  
  5010.                     The sequence of activating matrix operations is:
  5011.  
  5012.                                      Page 69
  5013.  
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020.  
  5021.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  5022.  
  5023.  
  5024.                          MATRIX(cell, matrix_operations)
  5025.  
  5026.                Cell:  The  cell  reference  of  the  MATRIX  is  the leading
  5027.                     location where matrix operations put their result.
  5028.                Matrix_operations: Matrix operations can  be matrix functions
  5029.                     or combination of matrix operators.
  5030.  
  5031.                For  example,  to  store  the  inverse  of matrix [a1..c3] in
  5032.                matrix  [d1..f3],  you  should  store  the  following formula
  5033.                somewhere:
  5034.                            +MATRIX(d1,inverse[a1..c3])
  5035.  
  5036.  
  5037.      Statistics:     __________
  5038.           AVERAGE(  any  number  of  parameters  ):  Average  of parameters.
  5039.                     Parameters  can  be   a   single   cell   reference,  an
  5040.                     expression, a block of cells.
  5041.           MEDIAN( any number of parameters ): Median of parameters.
  5042.           STD( any number of parameters): Standard deviation of parameters.
  5043.           VAR( any number of parameters): Variance of parameters.
  5044.           SQR_SUM( any number of parameters): Square sum of parameters.
  5045.  
  5046.       eg. +AVERAGE(A1..F4,234,12+24.5,H2+34*sin(pi))
  5047.  
  5048.  
  5049.      Miscellaneous:     _____________
  5050.           MAX(any number of parameters): Maximum value of parameters.
  5051.           MIN(any number of parameters): Minimum value of parameters.
  5052.           SUM(any number of parameters): Sum of all parameters.
  5053.           RAND: Random number between 0 and 1.
  5054.           IFF(condition,true_value, false_value): IF function
  5055.           ISEMPTY(cell): return 1 if cell is empty, otherwise 0
  5056.           TRUE: it is equal to 1
  5057.           FALSE: it is equal to 0
  5058.           ALERT     ALERT(default, "[icon#][text][exit]")
  5059.                     Uses the alert box to get user's response.
  5060.             icon#:
  5061.                0:   no icon
  5062.                1:   NOTE icon (!)
  5063.                2:   WAIT icon (?)
  5064.                3:   STOP icon (stop sign)
  5065.             text:
  5066.                text string  can be  up to 5 lines. Each line is separated by
  5067.                "|". You cannot have more than 40 characters per line. If you
  5068.                use  icon,  then  the  number  of  character per line must be
  5069.                lesser than  40. Keep  your character  per line  less than 30
  5070.                will be safe.
  5071.             exit:
  5072.                Up to 3 exit button can be defined. Each of them is separated
  5073.                by "|".
  5074.  
  5075.            eg.
  5076.                !A3=ALERT(1,"[1][This is a test|Wow][Ok|Cancel]")
  5077.  
  5078.                                      Page 70
  5079.  
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086.  
  5087.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  5088.  
  5089.           COL_WIDTH COL_WIDTH(block)
  5090.                     Returns the  total column  widths that  holds the block.
  5091.                     For example, if column width of A is 8 and B is 12 and C
  5092.                     is 4:
  5093.                eg   COL_WIDTH(a1)            ==> 8
  5094.                     COL_WIDTH(b1..c1)        ==> 16
  5095.  
  5096.           LAST_ROW  LAST_ROW(cell,r)
  5097.                     Returns the value stores in the  last row  on the column
  5098.                     the cell  is. r  tells you  where the  last row is. r is
  5099.                     zero origin. For example, if the last row of column B is
  5100.                     12 and cell B12 has a value of 123.45:
  5101.                eg   LAST_ROW(b20,row)        ==> 123.45 and row=11
  5102.                     You can access the last cell by using B1[0,row]
  5103.  
  5104.           LAST_COL  LAST_COL(cell,c)
  5105.                     Returns the  value stores  in the last column on the row
  5106.                     the cell is. c tells you where the last column  is. c is
  5107.                     zero origin. For example, if the last column of row 4 is
  5108.                     H and cell H4 has a value of 456.77:
  5109.                eg   LAST_COL(a4,col)         ==> 456.77 and col=7
  5110.                     You can access the last cell by using a4[col,0]
  5111.  
  5112.           SEARCH    SEARCH(STRING,block,r,c)
  5113.                     A boolean function to find  out  whether  STRING  in the
  5114.                     block and  r,c tell  you where  the cell is. r and c are
  5115.                     zero origin so you can access the cell by using a1[c,r].
  5116.                     NOTE: the  comparison is  case insensitive and a cell of
  5117.                     the block  which has  a substring  includes STRING, then
  5118.                     the location  of that cell will be stored in r and c. If
  5119.                     search fails, r and c will not be changed.
  5120.                eg.  Assume    that    cell   A5$="What",b5$="is",c5$="your",
  5121.                     d5$="name?".
  5122.                     SEARCH("You",a5..d5,r,c) ==> 1  and r=4,  c=2. To access
  5123.                     the cell that holds a substring of "YOU", you should use
  5124.                     a1[c,r]$ (it is c5$ in this case).
  5125.  
  5126.  
  5127.      Finance:     _______
  5128.           Future growth:
  5129.                GRATE(a time series data): Average growth rate.
  5130.                GBASE(a time series data): Adjusted base value
  5131.                GFUTURE(grate,gbase,  predict  time):  Future values based on
  5132.                     grate and gbase
  5133.  
  5134.                A time  series  data  is  data  being  collected  in  a fixed
  5135.                frequency of  time. They  may be  gathered yearly, quarterly,
  5136.                monthly or daily. For  example, you  income is  a time series
  5137.                data  that  is  increased  yearly. For a more detail example,
  5138.                refer to the example file "FG.SHT"
  5139.  
  5140.           Investment:
  5141.                INVEST_PV(final value, interest, compound  frequency, terms):
  5142.                     Present value of investment
  5143.  
  5144.                                      Page 71
  5145.  
  5146.  
  5147.  
  5148.  
  5149.  
  5150.  
  5151.  
  5152.  
  5153.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  5154.  
  5155.                INVEST_FV(present   value,   interest,   compound  frequency,
  5156.                     terms): Future value of investment
  5157.                INVEST_INTEREST(present   value,    final   value,   compound
  5158.                     frequency, terms):Compound interest of investment
  5159.                INVEST_TERM(present  value,  final  value, interest, compound
  5160.                     frequency): Terms of investment.
  5161.  
  5162.                Please  refer  to  the  file  "INVEST.SHT"  for  using  those
  5163.                functions.
  5164.  
  5165.           Loan:
  5166.                LOAN_PAY(amount  borrowed,  interest,total  terms,  number of
  5167.                     terms per year): Payment for each term.
  5168.                LOAN_AMOUNT(payment, interest, total terms,  terms per year):
  5169.                     Amount borrowed.
  5170.                LOAN_TERM(amount  borrowed,   payment,  interest,  terms  per
  5171.                     year): Total number of terms for loan. 
  5172.  
  5173.                Please  refer  to  the   file  "LOAN.SHT"   for  using  those
  5174.                functions.
  5175.  
  5176.           Withdraw:
  5177.                WDRAW_SAVE(amount  withdrawn,   interest,  terms,  terms  per
  5178.                     year): Initial Investment
  5179.                WDRAW_AMOUNT(amount saved, interest, terms,  terms per year):
  5180.                     Amount withdrawn.
  5181.                WDRAW_TERM(amount  saved,  amount  withdrawn, interest, terms
  5182.                     per year): Total terms
  5183.  
  5184.                Please refer  to  the  file  "WITHDRAW.SHT"  for  using those
  5185.                functions.
  5186.  
  5187.           Deposit:
  5188.                DEPOSIT_FV(amount,  interest,  total  terms, terms per year):
  5189.                     Final value for deposit
  5190.                DEPOSIT_AMOUNT(final value, interest, total  terms, terms per
  5191.                     year): Regular deposit
  5192.                DEPOSIT_TERM(amount, final  value, interest, terms per year):
  5193.                     Total number of terms.
  5194.  
  5195.                Please  refer  to  the  file  "DEPOSIT.SHT"  for  using those
  5196.                functions.
  5197.  
  5198.  
  5199.  
  5200.      String functions:     _________________
  5201.           FILENAME$ FILENAME$ is a string variable that can only be modified
  5202.                     by file selector dialog box.
  5203.  
  5204.           BUF$      BUF$ is  a string  variable that  can be  changed by the
  5205.                     command INPUT only.
  5206.  
  5207.           MID$:     MID$(STRING,s,len)
  5208.                     Returns  a  substring  of  STRING,  starting from s with
  5209.  
  5210.                                      Page 72
  5211.  
  5212.  
  5213.  
  5214.  
  5215.  
  5216.  
  5217.  
  5218.  
  5219.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  5220.  
  5221.                     length len. If s is larger than the length of the string
  5222.                     STRING, then  a substring range error occur. If len+s is
  5223.                     larger than the length  of STRING,  then up  to the last
  5224.                     character will be returned.
  5225.                eg   MID$("12345678",4,3)     ==> "456"
  5226.                     MID$("12345678",14,3)    ==> substring range error
  5227.                     MID$("12345678",4,20)    ==> "45678"
  5228.  
  5229.           LEFT$:    LEFT$(STRING,len)
  5230.                     Returns  a  substring  of  STRING,  starting from 1 with
  5231.                     length len. If len is larger  than the  actual length of
  5232.                     STRING, the whole STRING will be returned.
  5233.                eg   LEFT$("12345678",4)      ==> "1234"
  5234.                     LEFT$("12345678",20)     ==> "12345678"
  5235.  
  5236.           RIGHT$:   RIGHT$(STRING,len)
  5237.                     Returns  a  substring  of  STRING,  from  the  far right
  5238.                     portion of STRING with length len. If len is larger than
  5239.                     the length of STRING, then substring range error occurs.
  5240.                eg.  RIGHT$("12345678",4)     ==> "5678"
  5241.                     RIGHT$("12345678",20)    ==> substring range error
  5242.  
  5243.           SPACE$:   SPACE$(num)
  5244.                     Returns a string with num of blank spaces. num must be a
  5245.                     positive integer.
  5246.                eg.  SPACE$(4)                ==> "    "
  5247.  
  5248.           CHR$:     CHR$(num)
  5249.                     Returns a string with  one character  whose ASCII number
  5250.                     is equal to num. num is in the range of 0 to 255.
  5251.                eg   CHR$(82)                 ==> "R"
  5252.  
  5253.           STR$:     STR$([FORMAT,]value)
  5254.                     Changes a  number value  to a  string equivalent to that
  5255.                     value. FORMAT is optional. It is a string which consists
  5256.                     of  three  part  --  width, format, decimal point. It is
  5257.                     equivalent to  return a  cell string  with column width,
  5258.                     format and decimal place.
  5259.                eg   STR$(1234.5)             ==> "1234.5"
  5260.                     STR$("12$2",1234.5)      ==> "    $1234.50"
  5261.  
  5262.           VAL:      VAL(STRING)
  5263.                     Returns the  value of  STRING. This  function will strip
  5264.                     off characters other than "E", digits, "+", "-"  and "."
  5265.                     first and do the translation later.
  5266.                eg   VAL("abc123.45")         ==> 123.45
  5267.                     VAL(".23e-2")            ==> 0.0023
  5268.                     VAL(".23ae-2")           ==> 0.0023
  5269.  
  5270.           LEN:      LEN(STRING)
  5271.                     Returns the  length of the STRING. An empty string has a
  5272.                     len of zero.
  5273.                eg   LEN("")                  ==> 0
  5274.                     LEN("123456")            ==> 6
  5275.  
  5276.                                      Page 73
  5277.  
  5278.  
  5279.  
  5280.  
  5281.  
  5282.  
  5283.  
  5284.  
  5285.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  5286.  
  5287.  
  5288.           POS:      POS(STRING1,STRING2,start)
  5289.                     Return the position of  any  character  of  STRING1 from
  5290.                     STRING2  beginning  from  start.  All  the  character of
  5291.                     STRING1 and STRING2 will be changed to upper case first.
  5292.                     A zero  will be returned if none has been found or start
  5293.                     is larger than the len of STRING2.
  5294.                eg   POS(" ", "What is this?",1)==> 5
  5295.                          A space in position 5.
  5296.                     POS("ts","What is this?",1)==>4
  5297.                          "t" is in position 4
  5298.                     POS("ts","What is this?",5)==>7
  5299.                          "s" is in position 7
  5300.                     POS("AT","What is this?",1)==>3
  5301.                          "A" is in position 3. Case insensitive.
  5302.                     POS(",-","What is this?",1)==>0
  5303.  
  5304.  
  5305.  
  5306.  
  5307.                              Appendix B CONTROL KEYS                             _______________________
  5308.  
  5309.      Non-editing:     ___________
  5310.           <Esc>               stops a running BASIC program.
  5311.           <Up arrow>          moves cell cursor one row up.
  5312.           <Down arrow>        moves cell cursor one row down.
  5313.           <Left arrow>        moves cell cursor one column left.
  5314.           <Right arrow>       moves cell cursor one column right.
  5315.           <Shift><arrows>     moves cell  cursor to  the direction specified
  5316.                               by the arrow key by page.
  5317.           <Return>            changes the editing direction to neutral.
  5318.           <Control><A>        adjusts  TEXT  string  to  BASIC statements or
  5319.                               text justification.
  5320.           <Control><N>        creates a new sheet
  5321.           <Control><L>        loads a sheet file
  5322.           <Control><S>        saves current spreadsheet
  5323.           <Control><P>        prints current spreadsheet
  5324.           <Control><Q>        exits to desktop
  5325.           <Control><I>        inserts a row or a column
  5326.           <Control><D>        deletes a row or a column
  5327.           <Control><R>        reformats cells
  5328.           <Control><E>        erases cells
  5329.           <Control><C>        copies cells
  5330.           <Control><M>        moves cells
  5331.           <Control><mouse click> defines the starting cell of a block
  5332.           <Shift><mouse click> defines the stopping cell of a block
  5333.           <Alternate><1>      switches to the first window
  5334.           <Alternate><2>      switches to the second window
  5335.           <Alternate><3>      switches to the third window
  5336.           <Alternate><4>      switches to the fourth window
  5337.           <Alternate><F>      refreshes the current window.
  5338.           <Alternate><C>      recalculates the spreadsheet by column
  5339.           <Alternate><N>      recalculates the spreadsheet by natural order
  5340.           <Alternate><R>      recalculates the spreadsheet by row
  5341.  
  5342.                                      Page 74
  5343.  
  5344.  
  5345.  
  5346.  
  5347.  
  5348.  
  5349.  
  5350.  
  5351.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  5352.  
  5353.           <F2>                modifies the current cell's content
  5354.           <F5>                Goto a specified cell.
  5355.  
  5356.      Editing:     _______
  5357.           <Up arrow>          terminates and moves cell  cursor one  row up.
  5358.                               The editing direction changes to up direction.
  5359.           <Down arrow>        terminates and moves cell cursor one row down.
  5360.                               The editing direction changes to down.
  5361.           <Left arrow>        terminates and moves  cell  cursor  one column
  5362.                               left. The editing direction changes to left.
  5363.           <Right arrow>       terminates  and  moves  cell cursor one column
  5364.                               right. The editing direction changes to right.
  5365.           <Shift><Left arrow> moves editing cursor to left.
  5366.           <Shift><Right arrow> moves editing cursor to right.
  5367.           <Return>            terminates  and  moves  cell   cursor  to  the
  5368.                               direction specified by editing direction.
  5369.           <Mouse click>       if  the  mouse  cursor is within working area,
  5370.                               the coordinate of the cell under  mouse cursor
  5371.                               will be  inserted into  editing buffer; if the
  5372.                               mouse cursor is within  the editing  line, the
  5373.                               editing  cursor  will  move  to  the character
  5374.                               under the mouse cursor.
  5375.           <Control><mouse click> if the mouse cursor is within working area,
  5376.                               a comma  and the  coordinate of the cell under
  5377.                               mouse cursor  will  be  inserted  into editing
  5378.                               buffer.
  5379.           <Shift><mouse click> if the mouse cursor is within working area, a
  5380.                               through symbol ".." and the coordinate  of the
  5381.                               cell under  mouse cursor will be inserted into
  5382.                               editing buffer.
  5383.  
  5384.  
  5385.  
  5386.  
  5387.                         Appendix C Program specification:                        ________________________________
  5388.  
  5389.                SHEET is written in  Mark Williams  C. The  accuracy for real
  5390.           number (double)  in Mark  Williams C is up to 17 digits (Lotus 123
  5391.           is up to 15 digits). The range  of  calculation  is      -1E-37 to
  5392.           1E+37.   Each spreadsheet can accomdate up to 2,549,745 (255*9999)
  5393.           cells and the spreadsheet is implemented  by using  Sparse Matrix.
  5394.           Any input to a cell will be tokenized before it is being inserted.
  5395.           This program support up to 4 windows. The BASIC interpreter can be
  5396.           used to handle graphics, string, and ASCII text files.
  5397.  
  5398.           Accuracy:          Accuracy       up to 17 digits
  5399.           Range:          Range          -1E-37 to  1E+37 (If you find 1e+37 in a cell, that
  5400.                          means the calculation for that cell is not correct)
  5401.           Arithmetic operators:          Arithmetic operators
  5402.                          "+", "-", "*", "/", "^", MOD
  5403.           Logical operators:          Logical operators:
  5404.                          AND, OR, NOT,  "=",  "<>",  ">",  "<",  ">=", "<=",
  5405.                          "=>", "=<"
  5406.           Built-In functions:          Built-In functions
  5407.  
  5408.                                      Page 75
  5409.  
  5410.  
  5411.  
  5412.  
  5413.  
  5414.  
  5415.  
  5416.  
  5417.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  5418.  
  5419.                Math:     SIN, COS, TAN, ASIN, ACOS, ATAN, LOG, EXP, LN, ABS,
  5420.                          INT, FRAC, SQR, SQRT, DATE, FACT, RAD_DEG, DEG_RAD,
  5421.                          PI (constant)
  5422.                Statistics:
  5423.                          AVERAGE, MEDIAN, STD, VAR, SQR_SUM
  5424.                Miscellaneous:
  5425.                          MAX,  MIN,  SUM,  COUNT,  TODAY,  DAY, MONTH, YEAR,
  5426.                          TRUE, FALSE (TRUE and FALSE are constant, TRUE is 1
  5427.                          and  FALSE  is  0),  IFF, ISEMPTY, ALERT, LAST_ROW,
  5428.                          LAST_COL, SEARCH.
  5429.                Finance:  GRATE,   GBASE,   GFUTURE,   INVEST_PV,  INVEST_FV,
  5430.                          INVEST_INTEREST,       INVEST_TERM,       LOAN_PAY,
  5431.                          LOAN_AMOUNT,  LOAN_TERM,  WDRAW_SAVE, WDRAW_AMOUNT,
  5432.                          WDRAW_TERM,       DEPOSIT_FV,       DEPOSIT_AMOUNT,
  5433.                          DEPOSIT_TERM
  5434.                String:   MID$, CHR$, LEFT$, RIGHT$, SPACE$, STR$,  VAL, LEN,
  5435.                          ASC, FILENAME$(a string variable used for file item
  5436.                          selector) and BUF$(a string  variable  used  by the
  5437.                          command INPUT).
  5438.                Matrix:   MATRIX, TRANSPOSE, INVERSE, *, +, -
  5439.  
  5440.           Priority:          Priority
  5441.                Lowest: - AND, OR
  5442.                        - "+", "-"
  5443.                        - "*", "/", "^", MOD
  5444.                        - number,  cell  reference,  variable, function call,
  5445.                          NOT, "+", "-" (unary operator)
  5446.                Highest:- Parenthesis
  5447.           Constants:          Constants      PI(0.31415926535897932e+01), TODAY(Julian days when
  5448.                          you press TODAY), TRUE(1), FALSE(0).
  5449.           Cell reference:  A cell  can be  referred by using its spreadsheet          Cell reference
  5450.                          coordinate (e.g. D1) If you add  a "$"  in front of
  5451.                          the row  number (in  this example 1) or in front of
  5452.                          the column letter (D) then you make it  an absolute
  5453.                          reference. If  you add  "$" at  the end of the cell
  5454.                          reference, then you are using it  as a  string. You
  5455.                          can use  a cell  as BASE  and move it vertically or
  5456.                          horizontally by  appending  two  numbers  which are
  5457.                          separated by comma and embraced by "[" and "]". The
  5458.                          first number increases  the  BASE  horizontally and
  5459.                          the  second  number  increases the BASE vertically.
  5460.                          For example A2[3,4]. You  can separate  A2 to [1,2]
  5461.                          (Column A  has a  value of  1, B  has 2 and so on).
  5462.                          A2[3,4] = [1,2]+[3,4]=[4,6]=D6.
  5463.           Variables:          Variables      Up to 150 variables  can  be  defined.  This number
  5464.                          includes the  user defined function. It is intended
  5465.                          for BASIC usage. For the time being, you cannot use
  5466.                          those variables to hold any string.
  5467.  
  5468.  
  5469.  
  5470.                            Appendix D Lotus and SHEET                           __________________________
  5471.  
  5472.  
  5473.  
  5474.                                      Page 76
  5475.  
  5476.  
  5477.  
  5478.  
  5479.  
  5480.  
  5481.  
  5482.  
  5483.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  5484.  
  5485.                In Lotus,  you must  add a  '@' symbol  before every function
  5486.           name. In SHEET, no special symbol  is required  to put  before the
  5487.           function name. However, if a function name is the first element of
  5488.           your formula, a '+' or '('  is required  to differentiate  it from
  5489.           TEXT.
  5490.                Lotus requires  you to  put #  symbol to  embrace the logical
  5491.           operators. For example , "+A1 #AND# A2". It  is invalid  in SHEET.
  5492.           Actually, you will get 2 bombs if you enter the above formula. You
  5493.           should avoid adding special character in  your formula.  The valid
  5494.           form is "+A1 AND A2".
  5495.                Lotus  @COUNT  function  will  count  any  cell  containing a
  5496.           numeric value or a label. SHEET will count only numeric value. For
  5497.           example,
  5498.                     A                    _         B                              _
  5499.                1               _       12  This is a test
  5500.           @COUNT(A1..B1) will return 2 and COUNT(A1..B1) will return 1.
  5501.                Lotus @DATE function asks for arguments (YYYY,MM,DD) and DATE
  5502.           function in SHEET asks for (MM,DD,YY). The first  day of  @DATE is
  5503.           1-Jan-1900 while the first day of DATE is 1-Jan-4712 B.C.
  5504.                Here is a list of Lotus functions which have equivalent SHEET
  5505.           functions but using different names.
  5506.  
  5507.           @FV(amount,interest,terms) = DEPOSIT_FV(amount,interest,terms,1)
  5508.           @RATE(fv,pv,term) = INVEST_INTEREST(pv,fv,12,term*12)
  5509.           @TERM(pmt,int,fv) = DEPOSIT_TERM(pmt,fv,int,12)
  5510.           @PMT(amount,interest,terms) = LOAN_PAY(amount,interest,terms,12)
  5511.  
  5512.  
  5513.  
  5514.                             Appendix E Recalculation                            ________________________
  5515.  
  5516.           Natural:          Natural   Recalculates each cell  in  the  dependent  order. NOTE:
  5517.                     some spreadsheet programs use dependent list to find the
  5518.                     dependent order and they  can quickly  recalculate those
  5519.                     cells  being  affected.  SHEET  uses recursive method to
  5520.                     recalculates  cells.  The  effect  is  that,  it blindly
  5521.                     recalculate every  cell which contains formula and it is
  5522.                     slower than using dependent  list. The  positive side is
  5523.                     that, you have more memory to use than those spreadsheet
  5524.                     programs. This is a trade-off between speed and space.
  5525.           Row:          Row:      Recalculate each row in the ascending order.
  5526.           Column:          Column:   Recalculate each column in the ascending order.                    
  5527.           Manual:          Manual    The spreadsheet stops automatic  recalculation. User has
  5528.                     to press <ALT-N>, <ALT-R> or <ALT-C> for natural, row or
  5529.                     column   recalculation,   where   <ALT-N>   means  press
  5530.                     <Alternate> key with character key <N> simultaneously.
  5531.           Note:     It  is  no  longer  true  that  natural recalculation is
  5532.                     slower than row or column recalculation.
  5533.  
  5534.  
  5535.  
  5536.  
  5537.  
  5538.  
  5539.  
  5540.                                      Page 77
  5541.  
  5542.  
  5543.  
  5544.  
  5545.  
  5546.  
  5547.  
  5548.  
  5549.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  5550.  
  5551.  
  5552.                              Appendix F FILE FORMAT                             ______________________
  5553.  
  5554.      Header for SHT:     Header for SHT
  5555.           -    270 bytes reserved data.
  5556.             Currently, there are a few bytes have been used.
  5557.                -    2 bytes for file version number, current version is 1.4
  5558.                -    1 bytes for screen type when the file saved. 1 for color
  5559.                     monitor and 0 for monochrome monitor.
  5560.                -    2 bytes for maximum row number.
  5561.           -    40  bytes  for  window  title.  (39  characters  with  a null
  5562.                character)
  5563.           -    2 bytes: check-sum of the window  title to  make sure  we are
  5564.                handling the right work sheet.
  5565.           -    256 bytes for width of each columns
  5566.           -    2 bytes for window type (It is useless)
  5567.           -    8 bytes for current window size
  5568.           -    4 bytes for working area top row, top column
  5569.           -    4 bytes for current cell cursor address
  5570.           -    2 bytes for current recalculation mode
  5571.  
  5572.      Cell contents for SHT format:     Cell contents for SHT format
  5573.           -    1 bytes for cell type (use this byte with 0x23 to do bit-wise
  5574.                     and. If it is not 0, then it is NUMBER).
  5575.           -    2 bytes for length
  5576.             - IF NUMBER:
  5577.                2 bytes for row #, 1 byte for column #.
  5578.                2 bytes for attribute and 1 byte for decimal place
  5579.                8 bytes for calculating result.
  5580.             - IF NOT NUMBER (it may be TEXT or STATEMENT, its  decimal place
  5581.                     and calculating result are not needed)
  5582.                2 bytes for row#, 1 byte for column #.
  5583.                2 bytes for attribute (it may be blank cell)
  5584.           -    IF length <> 0, length bytes of tokens.
  5585.           -    The last cell type and length are 0 and 0.
  5586.  
  5587.      Header for PRT:     Header for PRT
  5588.           - 4 bytes holding "PART"
  5589.  
  5590.      Cell contents for PART format:      Cell contents for PART format
  5591.           -    4 bytes for cell row, column
  5592.           -    2 bytes for display attribute
  5593.           -    2 bytes for decimal place
  5594.           -    2 bytes for tokens length
  5595.           -    8 bytes for calculated result
  5596.           -    tokens length bytes of actual tokens
  5597.  
  5598.  
  5599.  
  5600.                                Appendix G Problems                               ___________________
  5601.  
  5602.           A user told me his cell cursor keep flashing
  5603.             ans:    It won't happen very often. It seems it happens when the
  5604.                     system is newly bootup and you load SHEET right away. In
  5605.  
  5606.                                      Page 78
  5607.  
  5608.  
  5609.  
  5610.  
  5611.  
  5612.  
  5613.  
  5614.  
  5615.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  5616.  
  5617.                     SHEET, you  can locate  the cell  cursor by mouse click.
  5618.                     You can also select a  block  by  prolonging  your mouse
  5619.                     click (drag). When you press your mouse to move the cell
  5620.                     cursor, SHEET  first  moves  your  cell  cursor  to that
  5621.                     position  and  inverts  the  color  of  that cell. Mouse
  5622.                     response time seems a  lot  faster  when  the  system is
  5623.                     newly bootup.  Because of  the fast response time, SHEET
  5624.                     thinks you are  still  pressing  your  mouse  button. It
  5625.                     thinks you  are trying  to select  a block then. That is
  5626.                     the reason why your cell cursor on and off. In  case you
  5627.                     have this  problem, you  should choose  some of the help
  5628.                     dialogs. 4 or 5 of  them  should  slow  down  your mouse
  5629.                     response  time.  Another  method  found  by  a  user  is
  5630.                     provided here. After the  system is  booted, you  type a
  5631.                     key and then load your SHEET program.
  5632.  
  5633.           Why some of my input characters are being truncated?
  5634.              ans:   For  versions  before  2.0,  if  you  type  any  illegal
  5635.                     character in your formula,  you will  be bombed  out and
  5636.                     you  must  reboot  your  system  to  use SHEET. This new
  5637.                     version of SHEET  prevents  this  problem  but  the rest
  5638.                     characters after the illegal character will be truncated
  5639.                     and a "#" symbol will be added at the end of the illegal
  5640.                     formula. You should rewrite your formula.
  5641.  
  5642.  
  5643.  
  5644.  
  5645.  
  5646.  
  5647.  
  5648.  
  5649.  
  5650.  
  5651.  
  5652.  
  5653.  
  5654.  
  5655.  
  5656.  
  5657.  
  5658.  
  5659.  
  5660.  
  5661.  
  5662.  
  5663.  
  5664.  
  5665.  
  5666.  
  5667.  
  5668.  
  5669.  
  5670.  
  5671.  
  5672.                                      Page 79
  5673.  
  5674.  
  5675.  
  5676.  
  5677.  
  5678.  
  5679.  
  5680.  
  5681.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  5682.  
  5683.                                 Biorthym program                                ________________                                                
  5684.  
  5685.           A   German   doctor   found   that  our  emotional,  physical  and
  5686.      intellectual  conditions  change   in   sine   curves   with  different
  5687.      frequencies. Emotional condition changes in 23 days per cycle, physical
  5688.      28 days, and intellectual 33 days. They are called biorthym.
  5689.  
  5690.           The following SHEET BASIC program uses the data  found to generate
  5691.      the biorthym  curves for you. You should enter your name in cell B1 and
  5692.      your birthday in B2 using +DATE(mm,dd,yy), then you  can run  it by the
  5693.      command "@run e1".
  5694.  
  5695.      E1    : !B3= TODAY
  5696.      E2    : !B4=B3-B2+1:START= DATE( MONTH( TODAY),1, YEAR( TODAY))-B2
  5697.      E3    : ! IF B3<0 THEN  MESSAGE "Date entry error": END 
  5698.      E4    : !EMOTION=START MOD 23
  5699.      E5    : !PHYSICAL=START MOD 28
  5700.      E6    : !INTELLECTUAL=START MOD 33
  5701.      E7    : ! WINDOW 1,0,11,417,199
  5702.      E8    : ! SCALE -4,-1.5,33,1.1
  5703.      E9    : ! CLEAR :EC=2*PI/23:PC=2*PI/28:IC=2*PI/33
  5704.      E10   : ! FOR X=1 TO 31
  5705.      E11   : !Z1=EMOTION*EC:EMOTION=EMOTION+1
  5706.      E12   : !Z2=PHYSICAL*PC:PHYSICAL=PHYSICAL+1
  5707.      E13   : !Z3=INTELLECTUAL*IC:INTELLECTUAL=INTELLECTUAL+1
  5708.      E14   : ! PLOT X, SIN(Z1),1: PLOT X, SIN(Z2),2: PLOT X, SIN(Z3),3
  5709.      E15   : ! NEXT X
  5710.      E16   : ! LINE 1,0,31,0
  5711.      E17   : ! LINE 1,-1,1,1
  5712.      E18   : ! MARKX 0,1,31,1
  5713.      E19   : ! MARKY 1,-1,1,0.1,0
  5714.      E20   : ! LABELX 0,2,30,2,"f0"
  5715.      E21   : ! LABELY 1,-1,1,0.1,"f1"
  5716.      E22   : ! PTEXT 11,-1.2,B1,1,1
  5717.      E23   : ! PLOT -2,-1.35,1: PTEXT -1,-1.4,"Emotional"
  5718.      E24   : ! PLOT 8,-1.35,2: PTEXT 9,-1.4,"Physical"
  5719.      E25   : ! PLOT 20,-1.35,3: PTEXT 21,-1.4,"Intellectual"
  5720.      E26   : ! EXITGRAPH 
  5721.      E27   : ! END 
  5722.  
  5723.      Explanations:
  5724.      E1:  Set the current date on cell B3.
  5725.      E2:  B4 holds the days of your life. Variable START holds the days from
  5726.           your birth to the first  day  of  current  month.  The  plus  1 in
  5727.           calculating  B4  means  that  your  first day is counted as 1. But
  5728.           biorthym calculates the first day as 0. (Sine curve starts  from 0
  5729.           to 2*PI).
  5730.      E3:  This is  unnecessary. I  just want  to show  you how  to display a
  5731.           message.
  5732.      E4:  Since our emotional condition changes in  a cycle  of 23  days, we
  5733.           can calculate  the condition  of the first day of current month by
  5734.           using the operator MOD.
  5735.      E5:  Similar to E4
  5736.      E6:  Similar to E4
  5737.  
  5738.                                      Page 80
  5739.  
  5740.  
  5741.  
  5742.  
  5743.  
  5744.  
  5745.  
  5746.  
  5747.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  5748.  
  5749.      E7:  Setup our graphic window
  5750.      E8:  Setup the scaling factor.  Making  the  scaling  factors  a little
  5751.           larger than  what they actually are will provide some blank spaces
  5752.           for texts.
  5753.      E9:  Clear  the  window  area.  EC  is  emotional  constant.  Emotional
  5754.           condition changes  in 23  days per cycle. Each cycle is 2*PI long.
  5755.           PC for physical condition and IC for intellectual condition.
  5756.      E10: A FOR loop to draw your graph. I  just assume  each month  have 31
  5757.           days. You may want to change 31 to its actual days.
  5758.      E11~E13:  Simple calculation for your conditions.
  5759.      E14: Plot emotional  condition with  marker 1,  physical with marker 2,
  5760.           and intellectual with marker 3
  5761.      E16~E17: Plot the x-axis and y-axis
  5762.      E18: Draw marks on x-axis
  5763.      E19: Draw marks on y-axis
  5764.      E20: Draw label on x-axis. It is integer.
  5765.      E21: Draw label on y-axis. It is real with 1 decimal place.
  5766.      E22: Plot your name on screen. (B1 holds your name)
  5767.      E23~E25: Plot texts showing the meaning for each marker.
  5768.      E26: Legal way to return to your current window
  5769.      E27: END program.
  5770.  
  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.                                      Page 81
  5805.  
  5806.  
  5807.  
  5808.  
  5809.  
  5810.  
  5811.  
  5812.  
  5813.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  5814.  
  5815.                                 Calendar program                                ________________
  5816.  
  5817.                The file name of  this  program  is  "CAL.SHT".  This program
  5818.           generates a month calendar and leaves some spaces for your monthly
  5819.           activity. Here is the listing. To run it, enter "@run q1"
  5820.  
  5821.      Q1     :!MON=10:YR=88:IBM= FALSE
  5822.      Q2     :!WEEKDAY=( DATE(MON,1,YR)+1) MOD 7
  5823.      Q3     :! IF (MON<12) THEN TDAY= DATE(MON+1,1,YR)- DATE(MON,1,YR): ELSE
  5824.      TDAY= DATE(1,1,YR+1)- DATE(MON,1,YR)
  5825.      Q4     :! IF IBM THEN  GOSUB Q34: ELSE  GOSUB Q42
  5826.      Q5     :! ERASE A1..O64
  5827.      Q6     :!B3$="^Sun":D3$="^Mon":F3$="^Tue":H3$="^Wed"
  5828.      Q7     :!J3$="^Thu":L3$="^Fri":N3$="^Sat"
  5829.      Q8     :!LINES=(WEEKDAY+TDAY)/7
  5830.      Q9     :!LINES= INT(LINES)+( FRAC(LINES)>0)
  5831.      Q10    :!WIDTH=60/LINES
  5832.      Q11    :! FOR I=0 TO 62
  5833.      Q12    :! FOR J=0 TO 14 STEP 2:A2[J,I]$= CHR$(VERT): NEXT J
  5834.      Q13    :! NEXT I
  5835.      Q14    :! FOR I=0 TO 12
  5836.      Q15      :! IF  (I MOD  2)=0 THEN B2[I,0]$="\"+ CHR$(HOR):B4[I,0]$="\"+
  5837.      CHR$(HOR): ELSE B2[I,0]$="\"+ CHR$(MDOWN):B4[I,0]$="\"+ CHR$(PLUS)
  5838.      Q16    :! NEXT I
  5839.      Q17        :!A2$=  CHR$(TLEFT):O2$=  CHR$(TRIGHT):A4$= CHR$(PLEFT):O4$=
  5840.      CHR$(PRIGHT)
  5841.      Q18    :! FOR I=1 TO LINES
  5842.      Q19    :!L=I*WIDTH: COPY A4..O4,A4[0,L]
  5843.      Q20    :! NEXT I
  5844.      Q21    :! FOR J=0 TO 12 STEP 2:C64[J,0]$= CHR$(MUP): NEXT J
  5845.      Q22    :!A64$= CHR$(BLEFT):O64$= CHR$(BRIGHT)
  5846.      Q23    :!L=1:J=1:M=WEEKDAY*2
  5847.      Q24    :! FOR I=WEEKDAY TO WEEKDAY+TDAY+1
  5848.      Q25    :! IF (I MOD 7)=0 THEN L=L+WIDTH:M=0
  5849.      Q26    :!B4[M,L]=J:J=J+1:M=M+2: IF J=TDAY THEN I=42
  5850.      Q27    :! NEXT I
  5851.      Q28    :! SAVE  SCREEN : REDIRECT  TO "prn:"
  5852.      Q29    :! PRINT  SPACE$((80- LEN(V1$))/2);V1$: PRINT 
  5853.      Q30    :! PRINT_BLOCK A2..O64,4,76
  5854.      Q31    :! WAIT 2: RESTORE  SCREEN 
  5855.      Q32    :! END 
  5856.      Q34    :!MDOWN=194:MUP=193
  5857.      Q35    :!PLEFT=195:PRIGHT=180
  5858.      Q36    :!PLUS=197:VERT=179:HOR=196
  5859.      Q37    :!TLEFT=218:TRIGHT=191
  5860.      Q38    :!BLEFT=192:BRIGHT=217
  5861.      Q39    :! RETURN 
  5862.      Q42    :!MDOWN=45:MUP=45
  5863.      Q43    :!PLEFT=124:PRIGHT=124
  5864.      Q44    :!PLUS=43:VERT=124:HOR=45
  5865.      Q45    :!TLEFT=43:TRIGHT=43
  5866.      Q46    :!BLEFT=43:BRIGHT=43
  5867.      Q47    :! RETURN 
  5868.  
  5869.  
  5870.                                      Page 82
  5871.  
  5872.  
  5873.  
  5874.  
  5875.  
  5876.  
  5877.  
  5878.  
  5879.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  5880.  
  5881.      Explanation:     Explanation
  5882.      Q1   Set the  month and  year we interest about in the variable mon and
  5883.           yr. You cannot use month and year for  the variable  names because
  5884.           they are names for built-in functions. IBM is TRUE if your printer
  5885.           can print the IBM graphic characters. If you change the  month and
  5886.           year in  cell Q1,  please change the string in cell V1 at the same
  5887.           time.
  5888.      Q2:  WEEKDAY stores the weekday of the first day of the  month. WEEKDAY
  5889.           is 0 if it is Sunday and 1 for Monday and so on.
  5890.      Q3:  TDAY is the total number of days in the specified month. It can be
  5891.           calculated easily by subtracting the first date of one month after
  5892.           mon from the first date of mon.
  5893.      Q4:  Initializes some constants depend on whether IBM is TRUE or FALSE.
  5894.      Q5:  Erase cells from A1 through O64
  5895.      Q6:  Row 2 and 4 holds the frame for the title of weekdays. Row 3 holds
  5896.           the title.
  5897.      Q8:  Normally, we need 4, 5 or 6 lines to hold  a monthly  calendar. To
  5898.           calculate how many lines are need for our current month, we can do
  5899.           it by adding the WEEKDAY and TDAY and divides it by 7.
  5900.      Q9:  This is a little  bit  tricky.  FRAC  is  a  function  returns the
  5901.           fractional part  of a numerical value. In this case, LINES from Q8
  5902.           is equal to 5.285714. FRAC(LINES) returns 0.285714. It  is greater
  5903.           than zero.  TRUE is  1 and  0 is  FALSE. (FRAC(LINES)>0) returns a
  5904.           value of 1 and the INT(LINES) returns a value of  5. So  we need 6
  5905.           lines to hold our current monthly calendar.
  5906.      Q10: The width  for each line is 60/LINES. Since the value of LINES can
  5907.           be 4,5 or 6. So, width is an integer.
  5908.      Q11~Q22 Fills the frame for  our  calendar.  TLEFT,  is  the  TOP left-
  5909.           corner, TRIGHT  is the TOP right-corner, BLEFT is the Bottom left-
  5910.           corner and BRIGHT is  the Bottom  right-corner. VER  is a vertical
  5911.           bar, HOR  is a  horizontal bar.  PLEFT is  a T character turns -90
  5912.           degree and PRIGHT is a T character turns 90 degrees. MDOWN is  a T
  5913.           character and  MUP is  a T  character turns  180 degrees. They are
  5914.           used to join lines in the edges. PLUS is a + character.
  5915.      Q23~Q27 Fills the Date into the calendar.
  5916.      Q28~Q31 prints the calendar to your printer.
  5917.      Q32: You should always end your program with END.
  5918.      Q34~Q39: Defines constants for IBM=TRUE
  5919.      Q42~Q47: Defines constants for IBM=FALSE
  5920.  
  5921.  
  5922.  
  5923.  
  5924.  
  5925.  
  5926.  
  5927.  
  5928.  
  5929.  
  5930.  
  5931.  
  5932.  
  5933.  
  5934.  
  5935.  
  5936.                                      Page 83
  5937.  
  5938.  
  5939.  
  5940.  
  5941.  
  5942.  
  5943.  
  5944.  
  5945.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  5946.  
  5947.  
  5948.                                       Roots                                      _____                                           
  5949.  
  5950.           ROOTS.SHT is  a sample  program which  finds roots  for any single
  5951.      variable functions.  There are some techniques which are not covered in
  5952.      other sample programs. You should study it even you have no interest in
  5953.      finding roots for a function.
  5954.  
  5955.      B1    : !XMIN=-5:YMIN=-5:XMAX=5:YMAX=100:ST=0.1:ERR=0.000001
  5956.      B2    : ! DEFINE F(X)=3*X*X-2
  5957.      B3            :   !   IF      ALERT(2,"[0][Which   resolution  you  are
  5958.      in?][Medium|High]")=2  THEN    WINDOW  0,0,20,639,399:  ELSE     WINDOW
  5959.      0,0,11,639,199
  5960.      B4    : ! SCALE XMIN,YMIN,XMAX,YMAX
  5961.      B5    : ! CLEAR 
  5962.      B6    : ! PLOT XMIN,F(XMIN)
  5963.      B7    : ! FOR X=XMIN TO XMAX STEP ST
  5964.      B8    : ! LINE_TO X,F(X)
  5965.      B9    : ! NEXT X
  5966.      B10   : ! LINE XMIN,0,XMAX,0: LINE 0,YMIN,0,YMAX
  5967.      B11   : !X= ALERT(1,"[0][Can you see any|root in your graph?][Yes|No]")
  5968.      B12    : ! IF X=2 THEN  MESSAGE "Change your minimum and|maximum values
  5969.      and try again": EXITGRAPH 
  5970.      B13   : ! IF X=2 THEN  END 
  5971.      B14   : ! MESSAGE "Locate mouse  cursor|to the  left of  a|root in your
  5972.      graph"
  5973.      B15   : ! MOUSE_POS AX,AY
  5974.      B16    :  ! MESSAGE "Locate mouse cursor|to the right of a|root in your
  5975.      graph"
  5976.      B17   : ! MOUSE_POS BX,BY
  5977.      B18   : ! LOOP 
  5978.      B19   : !AY=F(AX):BY=F(BX)
  5979.      B20   : ! EXIT  IF ( ABS(AY)<ERR OR  ABS(BY)<ERR)
  5980.      B21   : !HALF=(AX+BX)/2:HY=F(HALF)
  5981.      B22   : ! IF (AY*HY<0) THEN BX=HALF: ELSE AX=HALF
  5982.      B23   : ! ENDLOOP 
  5983.      B24   : ! IF  ABS(AY)<ERR THEN A1=AX: ELSE A1=BX
  5984.      B25   : ! EXITGRAPH 
  5985.      B26   : ! END 
  5986.  
  5987.           For solving different functions, you should adjust B1, B2.
  5988.  
  5989.      Explanations:     Explanations
  5990.  
  5991.      B1:  min,ymin,xmax,ymax setup the scaling factors. ST is step value for
  5992.           plot the function. ERR is the error tolerance. If you want to have
  5993.           a more accurate result, you should make ERR smaller.
  5994.      B2:  The function we are  trying  to  find  roots  for.  Remember, each
  5995.           function definition should have its own cell
  5996.      B3:  Open  the  largest  window  on Medium or High resolution. Remember
  5997.           WINDOW 0 is the current window.  The rest  numbers are  the raster
  5998.           coordinate.
  5999.      B4:  Set the scaling factors.
  6000.      B5:  Clear our window
  6001.  
  6002.                                      Page 84
  6003.  
  6004.  
  6005.  
  6006.  
  6007.  
  6008.  
  6009.  
  6010.  
  6011.  SHEET User manual             By Chor-ming Lung                October 9, 1988
  6012.  
  6013.      B6:  Plot the first point
  6014.      B7:  Plot the rest of the graph.
  6015.      B10: Draw the x- and y-axes.
  6016.      B11: A root  on a  graph is  the place where it hits the x-axis. If you
  6017.           see the curve hits the x-axis, you should answer Yes.
  6018.      B12: If the curve does not hit x-axis, then  leave a  reminder for user
  6019.           to change  the plotting  range. If  you set up a large value for x
  6020.           range, and you still can't see the root, then the function defined
  6021.           may not have a root. You cannot use this program to find it.
  6022.      B13: EXITGRAPH  command  is  not  working  quite well. It does not like
  6023.           anything following  it. I  still don't  know why.  The END command
  6024.           should follow  EXITGRAPH, but there is a bug which force us to end
  6025.           the program this way.
  6026.      B14: If you see a root, you can use the mouse to locate the left handed
  6027.           side value  for the root. This message just reminds user to select
  6028.           the left handed side value for the root. You may need to hold your
  6029.           mouse a little longer that usual.
  6030.      B15: User input the left handed side value by pointing the mouse cursor
  6031.           to the  left of  the point  that hits  the x-axis,  and click your
  6032.           mouse button. You can point to anywhere on the left handed side of
  6033.           the root.
  6034.      B16~B17:We need the right handed  side  value.  The  program  should be
  6035.           stopped quite fast. If you see nothing happen for a long time, you
  6036.           should press the mouse button again.  If it  is still  waiting for
  6037.           mouse button, <Esc> key will not stop the program.
  6038.      B18: A loop using bi-section method to find the root of a function.
  6039.      B24: If we found the root, we put it in cell A1
  6040.      B25: Normal exit
  6041.      B26  End of the program.
  6042.  
  6043.  
  6044.  
  6045.  
  6046.  
  6047.  
  6048.  
  6049.  
  6050.  
  6051.  
  6052.  
  6053.  
  6054.  
  6055.  
  6056.  
  6057.  
  6058.  
  6059.  
  6060.  
  6061.  
  6062.  
  6063.  
  6064.  
  6065.  
  6066.  
  6067.  
  6068.                                      Page 85
  6069.  
  6070.  
  6071.  
  6072.  
  6073.