home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 11 / 11.iso / m / m111 / 2.img / GRPCT3.EXE / READ2ND.ME < prev    next >
Encoding:
Text File  |  1991-02-15  |  37.1 KB  |  1,039 lines

  1. =============================================================================
  2.  
  3. ---------
  4. DATA (as in single @, databegin and so on) can have imbedded "-" characters
  5. so you can have negative numbers or filenames with a "-". This does not mean 
  6. you can have a filename with a "-" outside of a data statement without 
  7. quotes, so:
  8.  
  9.      pload pic-view,1
  10.  
  11. will still screw up, unless you use:
  12.  
  13.      pload "pic-view",1
  14.  
  15. BUT!
  16.  
  17.      data pic-view
  18.      pload @,1
  19.  
  20. will now work.
  21.  
  22. ---------
  23. GETMOUSE:
  24.         New command GETMOUSE, is similar to GETKEY.  The syntax is:
  25.  
  26.                 GETMOUSE VAR1 VAR2 VAR3
  27.  
  28.         The first value is button status, second and third are mouse 
  29.         coordinates.  The following example draws lines with the mouse when 
  30.         a button is pressed:
  31.  
  32.                 video a
  33.                 color 3
  34.                 mouse on
  35.                 lp:  getmouse but msx msy
  36.                 if @but
  37.                 dlp:      set ox @msx oy @msy
  38.                         getmouse but msx msy
  39.                         if @but
  40.                         line @ox @oy @msx @msy
  41.                         goto dlp
  42.                         endif
  43.                 endif
  44.                 goto lp
  45.  
  46.  
  47.         GETMOUSE when no driver installed will not change/setup variable 
  48.         values.
  49.         GETMOUSE with last click/release option will return a zero for 
  50.         button status if their were no clicks/releases since last check.
  51.  
  52. ---------
  53. IFMOUSE when used with reverse box option and a color of 0, will no longer
  54. pause from drawing a XOR box of color 0 (which does nothing).
  55.  
  56. =============================================================================
  57. Page 6
  58.  
  59. =============================================================================
  60.  
  61.  
  62. ---------
  63. Some new commands/variations on old commands:
  64.  
  65. mouse window x1 y1 x2 y2 ;restrict mouse movement window
  66. getmouse but x y         ;get current mouse position
  67. getmouse but x y 0       ;get last mouse release button pos
  68. getmouse but x y 1       ;get last mouse press button pos
  69.  
  70. ---------
  71. A new option for MOUSE command sets the current mouse cursor position:
  72.  
  73.         MOUSE POSITION X Y
  74.  
  75. Another new option for mouse command is mouse sense which lets you set
  76. the mouse sensitivity and velocity just like in PICTOR. It's syntax is:
  77.  
  78.         MOUSE SENSE              ;reset to sens 1, velo 5 (default)
  79.         MOUSE SENSE sens         ;set sens only (velo will be set to 5)
  80.         MOUSE SENSE sens velo         ;set sens and velo
  81.  
  82.  
  83. The MOUSE CURSOR command will now accept clipping buffer numbers as well
  84. as filenames.
  85.  
  86. ---------
  87. MOUSE WINDOW  with no parms will reset the mouse window to the current WINDOW
  88. setting, which is the same as:
  89.  
  90.  MOUSE WINDOW @MINX @MINY @MAXX @MAXY
  91.  
  92.  This is to make MOUSE WINDOW syntax consistent with WINDOW syntax.
  93.  
  94. ---------
  95. GETCOLOR now supports an optional variable name.  If the variable name is
  96. specified the drawing color will remain unchanged and the variable will
  97. contain the color at that coordinate.
  98.  
  99. ---------
  100. The GETKEY command will now handle Function and ALT keys via 2
  101. character strings with the second character being chr(1), so a check 
  102. for ALT-M would be:
  103.  
  104.      getkey k
  105.      if @k==chr(50)$chr(1)
  106.           text "you hit ALT-M"
  107.      endif
  108.  
  109. or you might prefer:
  110.  
  111.      getkey k
  112.      if peekw(adr(@k))==(50|256)
  113.           text "you hit ALT-M"
  114.      endif
  115. =============================================================================
  116. Page 7
  117.  
  118. =============================================================================
  119.  
  120. A major addition to the getkey command now gives it the option of getting a 
  121. key not by character, but name, so the following would be valid:
  122.  
  123.         getkey key name
  124.         if @key==home
  125.                 text "you hit the Home key"
  126.         else
  127.         if @key==ctrl-f1
  128.                 text "you hit the f1 key"
  129.         endif
  130.         endif
  131.  
  132.  
  133.  The parm which controls whether the variable will be a ascii value, or a
  134. key name is the second parm on the getkey command. You need to use the word
  135. "name".
  136.  
  137. ---------
  138. Glib:
  139.  
  140.     There's a new command option in Glib called Move (/M).  Like Update
  141.     (/U), it inserts the named files into the library file.  Unlike Update, 
  142.     it also deletes the files from the directory.  For example, the command
  143.  
  144.     GLIB /M MYAPP *.* 
  145.  
  146.     would copy all files in the current directory into MYAPP.GL, then
  147.     delete them, leaving only MYAPP.GL.  Be careful that you have a backup 
  148.     of files in another directory.
  149.  
  150.  
  151. ---------
  152. The new command LOAD is used to load .GRP files, and assorted data files such 
  153. as sound.  The following two commands are the same:
  154.  
  155.      local grasp readfile(c:\grasp\sound.grp)
  156. and
  157.      load c:\grasp\sound
  158.  
  159.  
  160. The LOAD command will only create a new variable if there is no global 
  161. variable of the same name.  This is so you can load sound data, and routines 
  162. within a subroutine by making your variables global before using LOAD.
  163.  
  164. ---------
  165. A new feature for CALL, LINK and MERGE. They will all accept an address of a 
  166. block of text in place of a filename.  Example:
  167.  
  168.      if !def(myfuncs)
  169.           global myfuncs 0
  170.           load myfuncs.txt
  171.      endif
  172.      merge @myfuncs
  173.      link fun
  174.  
  175. fun.txt:
  176.  
  177.      merge @myfuncs
  178. =============================================================================
  179. Page 8
  180.  
  181. =============================================================================
  182.  
  183. ---------
  184. SETUPSCR in mode S on PARADISE based cards has been disabled.  This allows
  185. the sequence:
  186.  
  187.      VIDEO S
  188.      SETUPSCR 1024 480
  189.      WINDOW 0 0 639 479
  190.  
  191. to work on virtually all SVGAs.  Previously, it was not necessary to use the
  192. SETUPSCR command when developing for a PARADISE system.  This was a problem
  193. if the program was going to be run on any other video system which would 
  194. require the SETUPSCR command.
  195.  
  196. ---------
  197. WHEN command:
  198.  
  199.     A WHEN command that calls a subroutine has to use the word GOSUB
  200.     before the subroutine's name.  This is the only instance where using a
  201.     subroutine's name alone will not work.
  202. =============================================================================
  203. Page 9
  204.  
  205. =============================================================================
  206.  
  207.                         Section 2: Variables and Functions
  208.                         ----------------------------------
  209.  
  210. list of functions:
  211. ------------------
  212. abs(), adr(), append(), asc(), chr(), close(), create(), dec(), def(),
  213. eval(), faralloc(), farfree(), farrealloc(), hex(), in(), left(), len(), 
  214. mid(), ofs(), open(), pad(), peek(), peekl(), peekw(), random(), read(), 
  215. readfile(), right(), seek(), seekgl(), seg(), size(), sqrt(), string(), 
  216. width(), widths(), write()
  217.  
  218. list of global readable variables:
  219. ----------------------------------
  220. cliptext, color, drawpage, elapsed, fontxsize, fontysize, gap, glfs
  221. maxx, maxy, memfree, memused, minx, miny, mouse, runtime, sgap, sptr,
  222. textx, texty, txtbuf, txtlen, vgap, viewpage, vmode, wrap, xoff, yoff
  223.  
  224. list of global SETable variables/options:
  225. -----------------------------------------
  226. esc, space, retrace, monospace, xor, quicktext, debug, cgetshift
  227. center, left, right, abort, msvert, wrap, cliptext, nocli, cgetshift, 
  228. maxcall
  229.  
  230. =============================================================================
  231.  
  232. FUNCTIONS:
  233. ---------
  234.  
  235. String function:
  236.  
  237.     The function STRING(LENGTH,CHAR) returns a string of the specified
  238.     length filled with the specified character (or filled with the first
  239.     character of CHAR if it's longer than one character).  For example,
  240.     this command displays a line of dashes:  TEXT STRING(80,"-")
  241.  
  242. ---------
  243. Some new functions for expressions are eval(), pad() and dec().  Eval is 
  244. just like eval macro, but much cleaner.  Example:
  245.  
  246.         eval(18$"-(5+7)")==18-(5+7)==6
  247.  
  248.         dec() is much like hex except that is has a second parameter which 
  249.         is the field width, so: 
  250.         dec(67,5)=="00067" and dec(167,1)=="167". 
  251.         dec() pads with zero characters.
  252.  
  253.         pad() pads a string with spaces, so:  pad("john",10)=="      john"
  254.  
  255. DATIME.TXT is a small example of DEC() and PAD() which displays
  256. date and time by calling DOS.
  257.  
  258.  
  259. =============================================================================
  260. Page 10
  261.  
  262. =============================================================================
  263.  
  264. ---------
  265. Another new function is WIDTH(), it returns the width in pixels of a string 
  266. in the current font. Example:
  267.  
  268.      video m
  269.      under 40 50 "Hi there"
  270.      waitkey
  271.      exit
  272.  
  273.      under:    text @1+1 @2+1 @3
  274.                line @1 @2 @1+width(@3) @2
  275.                return
  276.  
  277. ---------
  278. New operator is ->.  It's called arrow and it lets you get information on a 
  279. picture or clipping buffer. Valid values for the right hand side of the -> 
  280. are:
  281.  
  282.         xsize         ;width of a picture/clipping
  283.         ysize         ;height of a picture/clipping
  284.         xoff          ;X position on screen stored as part of image
  285.         yoff          ;Y position on screen stored as part of image
  286.  
  287. Example:
  288.  
  289.  
  290.      video m
  291.      cent image
  292.      waitkey
  293.      exit
  294.  
  295. cent:     cload @1,1
  296.           putup ((@maxx-@minx)-c1->xsize)/2+@minx$"
  297.           ",((@maxy-@miny)-c1->ysize)/2+@miny,1
  298.           cfree 1
  299.           return
  300.  
  301. the $"    " stuff is how to continue a very long line.
  302.  
  303. ---------
  304. A new math function ABS() gives absolute value.  As an example, this distx
  305. function will return the distance in pixels between two X coordinates:
  306.  
  307.         distx:
  308.                 return 1+abs(@1-@2)
  309.  
  310.  
  311. Another new math function SQRT() gives the square root of a number (integer 
  312. result).
  313.  
  314. ;
  315. ; DISTANCE X1 Y1 X2 Y2
  316. ;
  317. distance:
  318.      local x 1+abs(@1-@3)
  319.      local y 1+abs(@2-@4)
  320.      return sqrt(@x*@x+@y*@y)
  321. =============================================================================
  322. Page 11
  323.  
  324. =============================================================================
  325.  
  326. ---------
  327. Function seekgl(fname), will return the size of a file within the .GL which 
  328. is currently open and seek to the beginning of that file.  It will return 0 
  329. if the file was not found.
  330.  
  331. ---------     
  332. An example which uses wrap off, @glfs and seekgl:
  333.  
  334.      set wrap off                  ;keep original formatting
  335.      opengl fontbug                ;open fontbuf.gl
  336.      set ln seekgl(testfast.txt)-1      ;get length of testfast.txt
  337.      readstr @ln                   ;read whole text file into string
  338.      text @0                       ;display testfast.txt
  339.      waitkey
  340.      exit
  341.  
  342.      readstr:
  343.      local buf ofs(string(@1," "))      ;setup dummy buffer to read into
  344.      int 0x21 0x3F00,@glfs,@1,@buf,,,seg(@buf)    ;call dos to read data
  345.      return @((seg(@buf)<<16)+@buf)          ;return actual data
  346.  
  347. ---------
  348. Math function RANDOM() gives random number between two numbers.
  349.  
  350.      text random(1,6)$"-"$random(1,6)
  351.  
  352. ---------
  353. A pile of new built in functions have been added, most of them duplicating 
  354. functions found in DOSIO.TXT which is no longer needed.
  355.  
  356. ---------
  357. Two critical functions added are FARALLOC which allocates a memory buffer 
  358. and returns a 32 bit pointer to that buffer.  Also, FARFREE which frees up 
  359. the space that buffer takes up.  That space will automatically be freed up
  360. when your program exits, but it's best to not make lots of buffers and not
  361. free them up.  An example using new functions is:
  362.  
  363.      set wrap off                  ;keep original formatting
  364.      opengl fontbug                ;open fontbuf.gl
  365.      set ln seekgl(testfast.txt)-1      ;get length of testfast.txt
  366.      readstr @ln                   ;read whole text file into string
  367.      text @@0                 ;display testfast.txt
  368.      . farfree(@0)
  369.      waitkey
  370.      exit
  371.  
  372.      readstr:
  373.      local buf faralloc(@1+1)      ;setup buffer to read into
  374.      . read(@glfs,@buf,@1)              ;read data from gl file
  375.      return @buf                   ;return address of actual data
  376.  
  377.  
  378. =============================================================================
  379. Page 12
  380.  
  381. =============================================================================
  382.  
  383. ---------
  384. Other new functions are:
  385.  
  386.         fs=open(fname)                ;open a file for reading
  387.         fs=create(fname)              ;create a new file for writing
  388.         fs=append(fname)              ;open a file for reading/writing
  389.         len=size(fs)                  ;get length of file
  390.         pos=seek(fs,pos,rel)               ;seek to a position within file
  391.         len=read(fs,adr,len)               ;read a block of data with 32 bit 
  392.                                            ;address
  393.         len=read(fs,seg,ofs,len)      ;              with seg/ofs  
  394.         len=write(fs,adr,len)              ;write a block of data with 32 bit 
  395.                                            ;address
  396.         len=write(fs,seg,ofs,len)          ;         with seg/ofs       
  397.         err=close(fs)                 ;close an open file
  398.         buf=faralloc(size)            ;allocate a block of memory
  399.         err=farfree(buf)              ;free a block of memory
  400.  
  401.         The period alone can be used to execute functions without doing 
  402.         anything with their return value.  An example is the ". read(" in the 
  403.         given example.
  404.  
  405. ---------
  406. New Function READFILE() allows you to pass it a filename and it reads it
  407. from the currently open GL or currect directory.  It returns a 0 if the file
  408. was not found, otherwise it returns the 32 bit address just like FARALLOC(), 
  409. which can be free'd up with FARFREE().  Additionally, if you use a number for 
  410. a command which exceeds 256, the number will be treated as an address that 
  411. will be called.  Some example code which uses this feature:
  412.  
  413.      set lower readfile(lower.grp)
  414.      set upper readfile(upper.grp)
  415.      @lower "Hello There"
  416.      set str @@0
  417.      text @str           ;prints hello there
  418.      @upper @str
  419.      text @@0            ;prints HELLO THERE
  420.      . farfree(@lower)
  421.      . farfree(@upper)
  422.  
  423. ---------
  424. New function DEF(var) returns a 1 if a variable is defined, and a
  425. 0 if not.  Example:
  426.  
  427.      if !def(john)
  428.           set john 50
  429.      endif
  430.  
  431. =============================================================================
  432. Page 13
  433.  
  434. =============================================================================
  435.  
  436. ---------
  437. New function farrealloc() to be used in conjunction with faralloc() and
  438. farfree().  Farrealloc() is used to change the size of an allocated block of
  439. memory.  An example would be a buffer full of PCM sound which you would like 
  440. to add a digital echo.  In order for the echo to continue after the normal
  441. end of the sound, you would need to extend the length of your sound buffer to
  442. accomadate the extra data at the end.  Farrealloc has the side effect of 
  443. "compacting" memory, even if you resize a block of memory to the same size 
  444. it was already allocated.  In fact, if you give a new size of 0, GRASP 
  445. will default to the same size the block has already been allocated. 
  446. Example:
  447.  
  448.      pload john 1
  449.      set buf readfile(david.snd)
  450.      pfade 0 1
  451.      pfree 1
  452.      set buf farrealloc(@buf,0)
  453.      play @buf
  454.      . farfree(@buf)
  455.  
  456. ---------
  457. Also added are DELETE() and MOVEMEM.
  458.  
  459.         DELETE() is a new function which deletes a file and returns a zero 
  460.         if the delete succeeded.
  461.  
  462.         MOVEMEM is a new command containing 3 parameters; source 
  463.         address, destination address and number of bytes to move.  Some 
  464.         example code to save a picture buffer to a allocated buffer (pretty 
  465.         useless, but it's an example of what could be done).  With a 
  466.         bit more work this could be made to save to EMS.
  467.  
  468.                 ...
  469.                 savebuf p1
  470.                 set save @0
  471.                 ...
  472.                 restbuf p1 @save
  473.                 ...
  474.                 exit
  475.  
  476.         savebuf:
  477.                 local buf faralloc(@1->size+4)          ;allocate buffer
  478.                 pokew @buf @1->xsize               ;save xsize
  479.                 pokew @buf+2 @1->ysize             ;save ysize
  480.                 movemem @1->adr @buf+4 @1->size         ;save image data
  481.                 pfree @1                 ;free up picture buffer
  482.                 return @buf
  483.  
  484.         restbuf:
  485.                 pnewbuf @1 peek(@2) peek(@2+2)
  486.                 movemem @2+4 @1->adr @1->size
  487.                 . farfree(@2)
  488.                 return
  489.  
  490.  
  491.  
  492. =============================================================================
  493. Page 14
  494.  
  495. =============================================================================
  496.  
  497.         same code except it saves to disk:
  498.         ----------------------------------
  499.  
  500.         ...
  501.         savebuf p1 tmpfile.tmp
  502.         ...
  503.         restbuf p1 tmpfile.tmp
  504.         ...
  505.         exit
  506.  
  507.  
  508.         savebuf:
  509.                 local fs create(@2)           ;create temp file
  510.                 . write(@fs,adr(@1->xsize),2)      ;write ysize to file
  511.                 . write(@fs,adr(@1->ysize),2)      ;write ysize to file
  512.                 . write(@fs,@1->adr,@1->size)      ;write image data
  513.                 . close(@fs)
  514.                 pfree @1                 ;free up picture buffer
  515.                 return
  516.  
  517.         restbuf:
  518.                 local fs open(@2)             ;open file with saved data
  519.                 local tmp adr("1234")              ;create temp buffer to 
  520.                                                    ;read x,y
  521.                 . read(@fs,@tmp,4)            ;read in xsize and ysize
  522.                 pnewbuf @1 peek(@tmp) peek(@tmp+2) ;create new picture buffer
  523.                 . read(@fs,@1->adr,@1->size)       ;read image data into
  524.                                                    ;buffer
  525.                 . close(@fs)
  526.                 . delete(@2)                  ;delete old file
  527.                 return
  528.  
  529. ---------
  530. Address function:
  531.  
  532.     The function ADR(variable) returns a 32-bit address in hex, containing
  533.     both the segment and offset.  For example, ADR("myname") might return
  534.     the string "0x287B3E58".  In addition, the PEEK functions and POKE 
  535.     commands (PEEK, PEEKL, PEEKW, POKE, POKEL, POKEW) can use one 32-bit 
  536.     address parameter instead of two 16-bit ones.  This approach, however, 
  537.     limits you to Poking one value rather than multiple ones.  Here's an 
  538.     example:
  539.  
  540.     SET POINTER ADR("SHARY") ; put address of string "SHARY" in STRPOINTER
  541.     POKE @POINTER+4 ASC("I") ; write "I" to memory at fifth byte position
  542.     TEXT @@POINTER           ; display "SHARY"
  543.     WAITKEY
  544.  
  545. ---------
  546. Exclusive OR:
  547.  
  548.     The caret (^) is the exclusive-OR operator.  Comparison is bit-by-bit.
  549.  
  550. =============================================================================
  551. Page 15
  552.  
  553. =============================================================================
  554.  
  555.  
  556. ---------
  557. New function widths().  This is a VERY specific function which is intended
  558. for those interested in writing their own text routines.  It builds a table 
  559. of character widths for the current font. This is only valid in graphic 
  560. modes.  An example of use might be:
  561.  
  562.         video g
  563.         load height             ;load height.grp
  564.         @height                 ;pass height no parms to get address to
  565.                                 ;store width table
  566.         . widths(@0)            ;use width function with address of
  567.                                 ;array inside loaded height.grp
  568.  
  569.         set xs 50
  570.         set str "Hello there my name is unknown"
  571.         @height @xs @str
  572.         window 1+@maxx-@xs,1+@maxy-@0,@maxx,@maxy
  573.         color 1
  574.         rect @minx,@miny,@maxx,@maxy
  575.         color 14
  576.         text @str
  577.         waitkey
  578.  
  579.  
  580. The data is 256 bytes of character widths, followed by 4 bytes that are gap,
  581. vgap, xsize and ysize respectively for the current font.
  582.  
  583. The height.grp is a C routine which caculates the height of a string in 
  584. pixels given a wrap width.  This is very useful for generating a window for a 
  585. block of text whose size is not hardcoded.  Please do not complain about how 
  586. round about the code in height.c is, I simply took the text format routine 
  587. from the text command in grasp and stripped out the actual plot code to come 
  588. up with a height calculation algorithm.  You will find height.grp and 
  589. height.c in the GRASP subdirectory. 
  590.  
  591. =============================================================================
  592. VARIABLES:
  593. ---------
  594.  
  595. Global variables:
  596.  
  597.     In addition to SET and LOCAL, the GLOBAL command can create variables,
  598.     which can be used by any routine at any level.  See the disk file
  599.     CDCMD.TXT (in your GRASP directory) for an example.  The command is
  600.     used in the routine CDINIT to set the name of the CD drive.
  601.  
  602.     There is now support for system global variables (read only, they don't 
  603.     work with SET).  Currently supported ones are:
  604.  
  605.         @minx
  606.         @miny
  607.         @maxx
  608.         @maxy
  609.         @color
  610.  
  611.  
  612. =============================================================================
  613. Page 16
  614.  
  615.  
  616. =============================================================================
  617.  
  618. ---------
  619. Return variable:
  620.  
  621.     The return variable @0, which is discussed on page 3-40, is also set
  622.     when a subroutine is called.  It's set equal to the subroutine's name,
  623.     which makes it easy to trace program flow when debugging or reporting
  624.     errors.  The DOS routine DOSERR uses this feature.
  625.  
  626. ---------
  627. Memory and variables:
  628.  
  629.     This example illustrates a peculiarity of memory addressing in
  630.     GRASP.  You can't use the obvious method to directly alter variables:
  631.  
  632.     SET X "SHARY"            ; put string "SHARY" into variable X
  633.     SET POINTER ADR(@X)      ; put address of X into variable POINTER
  634.     POKE @POINTER+4 ASC("I") ; write "I" to memory at fifth byte position
  635.     TEXT @X                  ; still displays "SHARY"
  636.     WAITKEY
  637.  
  638.     You have to create a variable which is the address of a string and
  639.     refer to the string itself by double indirection.  Here's a correct
  640.     example:
  641.  
  642.     SET XPOINTER "SHARY"     ; create pointer variable to point to "SHARY"
  643.     POKE @XPOINTER+4 ASC("I"); write "I" to memory at fifth byte position
  644.     TEXT @@XPOINTER          ; display "SHARY"
  645.     WAITKEY
  646.  
  647.     This limitation is imposed by GRASP's own memory management routines
  648.     which are designed to maximize available memory for image buffers.
  649.  
  650. ---------
  651. Direct memory reference:
  652.  
  653.     As illustrated in the manual, the indirection function @ looks at the
  654.     contents of what follows.  For example, @X refers to the contents of X
  655.     instead of the string "X".  However, if @ is used with a number greater 
  656.     than 255, GRASP will interpret it as a reference to the contents of 
  657.     memory at the given location and will return the string at that address 
  658.     up to the first null (ASCII 0) character.  For example, @0x287B3E58 refers 
  659.     to the string at hex address 287B3E58.
  660.  
  661. ---------
  662. You may now set a variable with no value.
  663.  
  664. ---------
  665. Environment variables can now be referenced as regular variables, like:
  666.  
  667.      EXEC @COMSPEC       ;exec's command.com
  668.  
  669. ---------          
  670. Two new global variables have been added.  The first is @sptr which is the 
  671. current return stack depth.  Each time you do a gosub this variable is 
  672. incremented.  The other is @mouse, this variable is 1 if there is a mouse 
  673. driver installed, otherwise it is 0.
  674.  
  675. =============================================================================
  676. Page 17
  677.  
  678. =============================================================================
  679. ---------
  680. New global variables:
  681.  
  682.      @wrap         ;wrap on or off
  683.      @xoff         ;global offset on x axis
  684.      @yoff         ;global offset on y axis
  685.      @glfs         ;filestream number (for DOS) of current open GL
  686.  
  687. ---------
  688. New flag is:
  689.  
  690.  SET WRAP ON/OFF controls the wraping of text.  If on (the default), single 
  691.  CR/LF pairs are ignored unless the next line begins with a space character 
  692.  (actually a space or control character).  Off will still wrap normally EXCEPT 
  693.  CR/LF pairs will be treated as hard returns so tables and preformatted text 
  694.  will look ok.
  695.  
  696. ---------
  697. A new global variable has been added, @runtime.  It is TRUE if we are running 
  698. under GRASPRT.
  699.  
  700. ---------
  701. Global variables, @textx and @texty, are the current text pointer, where text 
  702. will continue to print with the next text statement if no coordinates are 
  703. given.
  704.  
  705. ---------
  706. Global variables, @viewpage and @drawpage, are the current view and draw 
  707. pages that have been set with setpage or revpage.
  708.  
  709. ---------
  710. More new global variables:
  711.  
  712.         @fontxsize          ;current font width
  713.         @fontysize          ;current font height
  714.         @gap                ;current gap between characters
  715.         @sgap               ;current width of a space character
  716.         @vgap               ;current vertical gap size (between lines)
  717.         @vmode              ;current video mode letter
  718.  
  719. ---------
  720. New variable @elapsed is the number of 1000ths of a second that have elapsed
  721. since the last TIMER command.
  722.  
  723. ---------
  724. Timer overflow variable (for low level routines that reprogram the PC's timer
  725. interrupt) has been added.  It's at offset 0 in SEG("") (GRASP's variable/text
  726. segment). 
  727.  
  728. ---------
  729. New global variable is CLIPTEXT, it can be either SET CLIPTEXT or read 
  730. @CLIPTEXT.  If set to ON, then text will not wrap at window boundries, instead 
  731. it will be clipped.
  732.  
  733. ---------
  734. Four new global read-only variables, @memfree, @memused, @txtbuf and @txtlen.  
  735. @txtbuf is the address of our current GRASP program in memory (which will 
  736. move around, so be careful).  @txtlen is the length of the current text buffer 
  737. (GRASP program).  @memfree is the current number of bytes free (available for 
  738. loading pictures, fonts and so on), @memused is the number of bytes GRASP has 
  739. currently used, just like the USED: display in the editor.
  740. =============================================================================
  741. Page 18
  742.  
  743. =============================================================================
  744.                       
  745.                       Section 3: General Information 
  746.                       ------------------------------
  747.  
  748. ---------
  749. CAP now supports 1024x768x256 modes
  750.  
  751. ---------
  752. Any POINT type commands (like LINE or slow TEXT) will now work in bitplane
  753. modes when done after a TEXT with QUICKTEXT turned on.
  754.  
  755. ---------
  756. SET DEBUG ON:  
  757.         
  758.         This actually displays a status line at the bottom of the screen. 
  759.         When you hit ESC while DEBUG is on you are put at that line in the
  760.         editor (like when you get an error).
  761.  
  762. ---------
  763. There is a new command line option for GRASP, GRASPC and GRASPRT.  It's -d 
  764. (or /d) which stands for debug and it will force GRASP to run in batch mode 
  765. with all error messages written to stderr (standard error).  This option is 
  766. mainly for folks who use editors like Brief to edit their GRASP files and 
  767. want Brief to "know" about errors when you run your text files.
  768.  
  769. ---------
  770. New option SET NOCLI ON is added which disables the few remaining lines of
  771. code that would normally run with interrupts turned off.  This option is not
  772. advised except for those with VERY critical background routines running on
  773. slower machines!
  774.  
  775. --------- 
  776.  New SET option, SET CLEARKEY ON/OFF  defaults to ON. This option controls
  777. whether GRASP allows type ahead.  Normally GRASP will throw away extra key
  778. presses, this can now be disabled with SET CLEARKEY OFF. This is most useful
  779. for text input routines.
  780.  
  781. ---------
  782. Sigma Legend VGA is now supported.
  783.  
  784. ---------
  785. Keyboard routines are speeded up to eliminate long delays from poorly written 
  786. BIOS's (big problem for background sound routines). This will cause problems 
  787. with some old keyboard enhancement programs like Repeat Performance (where 
  788. the repeat will no longer work).
  789. =============================================================================
  790. Page 19
  791.  
  792. =============================================================================
  793.  
  794. ---------
  795. Quotes:
  796.  
  797.  A long standing problem with strings and filenames that are not enclosed in
  798. quotes and yet have a minus character in them just as: 
  799.  
  800.         ifkey ctrl-a done
  801.         pload my-pic
  802.  
  803. is partially resolved, GRASP will now take a minus sign as part of a string 
  804. if the minus is followed by a letter, so ALT-F1 will work, but Alt-1 will 
  805. not.  This is because @alt-1 is a valid expression (the variable alt minus 
  806. one), and @alt-f1 would give the value of a variable called "alt-f1".  Please 
  807. don't use variable names with minus symbols in them.  Use underlines instead 
  808. since the minus characters can make reading an expression very hard. This 
  809. kludge is mainly to help out users of GRASP 3.1 and remove the general 
  810. annoyance of having to use quotes all the time.   
  811.  
  812. ---------
  813. New SET option MAXCALL will force the CALL statement to use FAR memory 
  814. (same memory as used for pictures, fonts, clippings, DFF's and so on) 
  815. to swap the current text file.  This allows you to nest many large text files
  816. with CALL statments and not run out of memory.
  817.  
  818. ---------
  819. All help is rewritten from scratch (sorry to all those folks who were using
  820. their own help screens). The help is still in GRHELP.OVR, but it is in 4
  821. script files:
  822.  
  823.      EDIT.TXT  --- editor help
  824.      COMMAND.TXT    --- command and function help
  825.      FADE.TXT  --- fade and mode help
  826.      PAGED.TXT --- code for paged display of help
  827.      USERA.TXT --- user defined help/code ALT-F3 key
  828.      USERB.TXT --- user defined help/code ALT-F4 key
  829. ...  
  830.      USERF.TXT --- user defined help/code ALT-F8 key
  831.  
  832. The text files are all standard GRASP scripts and can do almost anything
  833. that a standard script can do (The possibilites are pretty neat!).  Since
  834. this feature has so much more powerful than simple text screens, 5 more user 
  835. defined "help keys" ALT-F3 to ALT-F8 have been put in.  The screen is 
  836. automatically restored upon exit from the script.  Look at PAGED.TXT for 
  837. example.
  838.  
  839. ---------
  840. The ALT-F2 screen has been enhanced to include DFF, FLI, TXT and GRP.  It 
  841. also checks the first command on the current line for the default file type. 
  842. The number of lines of filenames displayed is doubled to 8 (as well as
  843. in the normal load screen off the menu).  PGUP and PGDN keys are now
  844. available in ALT-F2 screen.
  845.  
  846. ---------
  847.  PCX files are now saved at a origin of 0,0 instead of 1,1. Some programs had
  848. problems with a non 0,0 origin.
  849. =============================================================================
  850. Page 20
  851.  
  852. =============================================================================
  853. ---------
  854. New feature, if you use a number for a command which exceeds 256, the number
  855. will be treated as an address that will be called. Some example code which 
  856. uses this feature:
  857.  
  858.         set lower readfile(lower.grp)
  859.         set upper readfile(upper.grp)
  860.         @lower "Hello There"
  861.         set str @@0
  862.         text @str                       ;prints hello there
  863.         @upper @str
  864.         text @@0                        ;prints HELLO THERE
  865.         . farfree(@lower)
  866.         . farfree(@upper)
  867.  
  868. The code for lower.grp in C:
  869. ----------------------------
  870. unsigned _acrtused;             /* Dummy variable required by linker */
  871.  
  872. #define code _based(_segname("_CODE"))
  873.  
  874. unsigned char code buf[256]=""; /* Buffer to build result in */
  875.  
  876. /* Called function has standard C Parameters passed to it */
  877.  
  878. unsigned long far main(argc,argv)
  879. int argc;
  880. char **argv;
  881. {
  882.         unsigned char far *dpt;
  883. register unsigned char *spt;
  884.  
  885.         dpt=buf;
  886.         while(--argc)
  887.         {
  888.                 spt=*++argv;
  889.                 while(*spt)
  890.                 {
  891.                         if(*spt>'A' && *spt<='Z')     /* Is it Upper case? */
  892.                                 *spt+=32;
  893.  
  894.                         *dpt++=*spt++;               /* Copy char into buf */
  895.                 }
  896.         }
  897.         *dpt++=0;               /* Put the trailing Zero for end of string */
  898.  
  899.         /* Return far pointer to buf */
  900.         return (unsigned long)((unsigned char far *)buf);
  901. }
  902.  
  903. The MAKEGRP Batch file to compile .GRP files is as follows: 
  904.  
  905. c:\msc\bin\cl -AS -nologo -Oacgs -Gs -Zl -Zp -FPa -Zi -c %1.c
  906. link %1;
  907. exe2com %1.exe %1.grp
  908. del %1.exe
  909.  
  910.  Also EXE2COM is a public domain program written by Chris Dunford, it is
  911. available on Compuserve as EXECOM.ARC. This is required if you don't have
  912. EXE2BIN which IBM/Microsoft no longer ship.
  913. =============================================================================
  914. Page 21
  915.  
  916. =============================================================================
  917.  
  918. ---------
  919. LINE2.C, LINE2.GRP and LINE2.TXT are example routines.  LINE2.C is a example
  920. routine which draws a two dot wide line in 320x200 256 color mode.  LINE2.TXT
  921. has a simple example of calling LINE2.GRP.
  922.  
  923. ---------
  924. Digitzed Sound:
  925.  
  926.  The syntax of the SOUND.GRP options FIND and USE had to be changed, they no
  927. longer use the word "soundblaster", but rather "blaster", this is because the
  928. soundblaster specific data will in the near future be kept in a seperate file
  929. and the word "soundblaster" has too many letters for a filename. In future 
  930. the:
  931.  
  932.         @sound find blaster
  933.  
  934. command will look for a file called blaster.dev which will be loaded, the 
  935. .dev file will have the search/detect code, as well as the setup/init code 
  936. and actual DAC port information.
  937.  The 4.0 manual says:
  938.  
  939.         @sound find soundblaster
  940.         @sound port @0
  941.         @sound use soundblaster
  942.  
  943.  but that will have to read:
  944.  
  945.         @sound find blaster
  946.         @sound port @0
  947.         @sound use blaster
  948.  
  949.  The "@sound find" and "@sound port"  functions will work with the following 
  950.  code:
  951.         load sound
  952.         @sound find blaster
  953.         if @0
  954.                 @sound port @0
  955.                 @sound use blaster
  956.         endif
  957.  
  958.  
  959.  Also a new feature has been added to sound.grp.  It's a speed option, where 
  960.  you can adjust the playback speed.
  961.  
  962.         @sound speed 90         ;play back at only 90% of original speed
  963.  
  964.  
  965.  There is a new sound example file called PLAYSND.GL (which is called by
  966. PLAYSND.BAT).  To use try:
  967.  
  968.  PLAYSND GINMILL
  969.  
  970. ---------
  971. Automatic oversampling rate in SOUND.GRP.  If you specify a oversampling rate
  972. of 0, a correct oversampling rate will be automatically selected.
  973. =============================================================================
  974. Page 22
  975.  
  976. =============================================================================
  977.  
  978. ---------
  979. Editing Keys:
  980.  
  981.     When editing programs in the GRASP editor, the following Wordstar key
  982.     combinations can be used in addition to the keys listed on page 6-8 of
  983.     the manual.
  984.  
  985.     Ctrl-F     Next word               Ctrl-A     Previous word
  986.     Ctrl-R     Page up                 Ctrl-C     Page down
  987.     Ctrl-D     Next character          Ctrl-S     Previous character
  988.     Ctrl-X     Next line               Ctrl-E     Previous line
  989.     Ctrl-W     Scroll down one line    Ctrl-Z     Scroll up one line
  990.     Ctrl-Q C   Go to end of file       Ctrl-Q R   Go to beginning of file
  991.     Ctrl-Q D   Go to end of line       Ctrl-Q S   Go to beginning of line
  992.     Ctrl-Q B   Go to start of block    Ctrl-Q K   Go to end of block
  993.     Ctrl-K B   Mark start of block     Ctrl-K K   Mark end of block
  994.     Ctrl-K C   Copy block              Ctrl-K V   Move block
  995.     Ctrl-K R   Read in a file          Ctrl-K W   Write block to disk
  996.     Ctrl-K Y   Delete block            Ctrl-K H   Turn off block 
  997.     Ctrl-K D   Save changes & exit     Ctrl-K Q   Abandon changes & exit
  998.     Ctrl-K S   Save file & continue    Ctrl-K X   Exit to main menu 
  999.     Ctrl-N     Insert new line         Ctrl-Y     Delete line
  1000.     Ctrl-G     Delete character        Ctrl-Q Y   Delete to end of line
  1001.     Ctrl-P     Insert next character   Ctrl-V     Toggle insert on and off
  1002.                typed, even if it's a
  1003.                control character.
  1004.  
  1005. ---------    
  1006.  W option in editor search/replace is in, it will force a search/replace to 
  1007.  only find a match when the search string is found as a word, so if you 
  1008.  search for the word "go" it will not match "going" but will match "@go-10". 
  1009.  Words are defined as not surrounded by letters, so "feb" will match 
  1010.  "11feb91" but not "february".
  1011.  
  1012. ---------
  1013.  ^QA and ^QF  search/replace and search are available, options are N for 
  1014.  non-stop (search/replace until there are no more), U for ignore Uppercase 
  1015.  (match either upper or lower), B for backwards search, and G for global 
  1016.  (start from beginning of file (or end if backwards is set)).  Also a 
  1017.  repetition count can be specified, this is the number of times to replace or 
  1018.  find a certain string.  Spaces or commas are not required to seperate 
  1019.  options so 100gu or bg or nu are all valid (case is also ignored, so UG is 
  1020.  the same as ug).  All options except G remain in effect when using ^L 
  1021.  (repeat search/replace or search).
  1022.         
  1023. ---------
  1024.  New command line option /T, when turned on will write a list of all opened
  1025. files (and files loaded from a GL) to the file TRACK.LST.
  1026.  
  1027. ---------
  1028.  New sound utility called NEWRATE added, it lets you convert a sound file to
  1029. a higher OR lower sampling rate.
  1030.  
  1031. ---------
  1032.  You may add the tutor to a hotkey from the editor or run it as a standalone
  1033.  program.
  1034.  
  1035. ---------
  1036.  Split only works on EGA cards.
  1037.  
  1038.                           --- end of file ---  
  1039.