home *** CD-ROM | disk | FTP | other *** search
/ Windows CE - The Ultimate Companion / ROMMAN_CE.iso / Files / Programming / Basice / BASICE.TXT < prev    next >
Text File  |  1997-03-14  |  6KB  |  258 lines

  1. Basice user documentation                  March, 1997
  2.  
  3. Basice is a full implementation of the BASIC language for
  4. Microsoft Windows CE.  Basice features include support
  5. for floating point, long variable names, procedures,
  6. functions, a user extensible run time extension 
  7. library, and the ability to draw graphics.
  8.  
  9. Data Types
  10. ----------
  11. Three data types are supported.
  12.  
  13.   Integer (32 bit, signed)
  14.   Floating Point (64 bit, double precision, IEEE)
  15.   String (length up to 512 characters)
  16.  
  17. Variable names, procedure names
  18. -------------------------------
  19.  
  20.   Names start with letter, may contain letters, digits, and
  21.   underscores.  They may be up to 15 characters in length.  
  22.   
  23.   Variable names ending with a % are integer
  24.   Variable names ending with a # are floating point
  25.   Variable names ending with a $ are string
  26.   All other names are procedure names
  27.  
  28. Arrays
  29. ------
  30.  
  31.   One dimensional arrays of the above data types may be declared
  32.   (created) using the DIM statement, and deleted using the UNDIM
  33.   statement.
  34.  
  35.   DIM AA%[55]   ! creates an array 1..55 of integers
  36.  
  37.   UNDIM AA%     ! removes the array, free's up the memory
  38.  
  39. Line numbers
  40. ------------
  41.  
  42.   Line number are assigned to each line.  They may be from 1 to
  43.   10000000.
  44.  
  45. Commands
  46. --------
  47.  
  48.   These are interactive commands that can be entered at the command
  49.   line to enter, change, modify, erase, and control the execution
  50.   of programs.
  51.  
  52.   GO [ procedurename [ (argument list) ]  ]
  53.   
  54.      GO
  55.      GO CUBE(3)
  56.   
  57.   LIST [ first_line# [ TO last_line# ] ]
  58.   
  59.      LIST
  60.      LIST 100
  61.      LIST CUBE
  62.      LIST 100 TO 900
  63.  
  64.   DEL  [ first_line# [ TO last_line# ] ]
  65.  
  66.      DEL 100
  67.      DEL 100 TO 199
  68.  
  69.   SAVE  "file.bas"
  70.  
  71.      SAVE "myprogram.bas"
  72.  
  73.   LOAD  "file.bas"
  74.  
  75.      LOAD "\basice\squares.bas"
  76.  
  77.   MERGE "file.bas"
  78.  
  79.      Same as load, but does not remove existing program first.
  80.  
  81.   NEW
  82.  
  83.      Clear Basice workspace, make new, empty program.
  84.  
  85.   CONTINUE
  86.   
  87.      Continue from breakpoint
  88.   
  89.   SET TRACE/CANCEL TRACE
  90.  
  91.      Set or cancel trace mode
  92.  
  93.   SET BREAK/CANCEL BREAK
  94.  
  95.      Set or remove a break point
  96.  
  97.      SET BREAK 1900
  98.      CANCEL BREAK 1900
  99.  
  100.   STEP [ number_of_steps ]
  101.  
  102.      Step from breakpoint
  103.  
  104.      STEP 1
  105.      STEP
  106.      STEP 12
  107.  
  108. Key words
  109. ---------
  110.  
  111.   These are parts of statements that make up Basice programs.
  112.  
  113.   IF THEN ELSE ENDIF
  114.  
  115.       IF (A% = 1) THEN
  116.          PRINT "Success!"
  117.          ELSE
  118.          PRINT "Not done"
  119.          ENDIF
  120.  
  121.   LOOP ENDLOOP
  122.   FOR TO STEP
  123.   WHILE
  124.   BREAK
  125.  
  126.       LOOP FOR I%=1 TO 10
  127.          PRINT I%
  128.          ENDLOOP
  129.  
  130.       LOOP WHILE A# < 10.5
  131.          PRINT A#, SIN(A#)
  132.          A# = A# + 0.25
  133.          IF (A# = B#) THEN BREAK ENDIF
  134.          ENDLOOP
  135.  
  136.   CALL RETURN
  137.  
  138.       CALL CUBE(3)
  139.  
  140.       PROCEDURE CUBE(AA#)
  141.          PRINT AA#*AA#*AA#
  142.          RETURN
  143.          ENDPROC
  144.  
  145.   KILL   (delete file)
  146.  
  147.       KILL "file.dat"
  148.  
  149.   PRINT
  150.  
  151.       PRINT "Hello" SQR(A#+1)
  152.  
  153.       PRINT #1,A$
  154.  
  155.   INPUT
  156.  
  157.       INPUT A$,A%,A#
  158.   
  159.   LINPUT
  160.   
  161.       LINPUT A$
  162.       LINPUT #1,A$
  163.   
  164.   END
  165.   
  166.   DIM UNDIM
  167.   
  168.   OPEN "x.dat",1
  169.   
  170.   CREATE "x.dat",1
  171.   
  172.   CLOSE 1
  173.   
  174.   ON
  175.       ON "ERROR" CALL ERROR_HANDLER
  176.  
  177.      used to trap I/O errors, end of file, etc.
  178.  
  179.       DONE% = 0
  180.       ON "ERROR" CALL ERR_HANDLER
  181.       OPEN 1,"myfile.dat"
  182.       LOOP
  183.     WHILE NOT DONE%
  184.     LINPUT #1,A$
  185.     PRINT A$
  186.     ENDLOOP
  187.  
  188.  
  189.  
  190.       PROCEDURE ERROR_HANDLER
  191.     DONE% = 1
  192.     ENDPROC
  193.  
  194.   PROCEDURE ENDPROC
  195.  
  196.      PROCEDURE PRINTOUT(ANSWER#)
  197.     PRINT "The answer is " ANSWER#
  198.     ENDPROC
  199.   
  200.   WAIT  1.5        ! seconds
  201.   
  202.   EXIT
  203.  
  204. Functions
  205. ---------
  206.  
  207.   SQR - square root   SQR(9)
  208.   LN  - natural log   LN(2)
  209.   EXP - natural exp   EXP(2)
  210.   TAN - tangent (radians)  TAN(3.1415926)
  211.   ATN - arc tangent   ATN(1)
  212.   SIN - sine (radians) SIN(ANGLE# * 180/3.1415926)
  213.   COS - cosine(radians) COS(1.5)
  214.   ABS - absolute value   ABS(ANUMBER%)   ABS(ANUMBER#)
  215.   INT% - truncate        INT%(5.25)
  216.   RIGHT$ - rightmost substring   RIGHT$("ABCD",2)     is "AB"
  217.   LEFT$ - leftmost substring     LEFT$("ABCD",2)      is "CD"
  218.   MID$ - middle substring        MID$("ABCD",2,2)     is "BC"
  219.   LEN% - length of string        LEN%("ABCD")         is 4
  220.   CHR$ - convert to string       CHR$(65)             is "A"
  221.   ASC% - convert ascii-to-int    ASC%("ABCD",1)       is 65
  222.   ERR% - last error number       MY_ERR% = ERR%
  223.   ERL% - program line number of last error
  224.   MOD% - remainder               MOD%(10,6) is 4
  225.   POWER - raised to the power    POWER(2,2) is 2 squared is 4
  226.   POS% - string position         POS%("BC","ABCD") is 2
  227.   DTIME$ - date & time function  DTIME$(0) is current time, DTIME$(60) is
  228.                  time one minute from now
  229.   KEY$ - return last key pressed (or null string if none)
  230.   SHIFT% - shift bits            SHIFT%(2,1) is 4, SHIFT%(2,-1) is 1
  231.   CMDLINE$ - contents of command line that started Basice
  232.  
  233. Operators
  234. ---------
  235.  
  236.   +        add (integer, floating point, string concatenation)
  237.   -        subtract (integer, floating point), urnary minus (as in -5)
  238.   *        multiply (integer, floating point)
  239.   /        divide   (integer, floating point)
  240.   OR       logical or (integer)
  241.   AND      logical and (integer)
  242.   NOT      logical negate (integer)
  243.   XOR      logical exclusive-or (integer)
  244.   >        comparison (integer, floating point, string)
  245.   <          "
  246.   >=         "
  247.   <=         "
  248.   =          "
  249.   <>         "
  250.   ()       grouping 
  251.  
  252. Notes
  253.  
  254. 1) Urnary minus is the highest priority operator.
  255.  
  256.    -5+3 means -(5+3) not (-5)+3
  257.  
  258.