home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / batch / bvars.arj / BVARS.DOC < prev    next >
Encoding:
Text File  |  1992-04-09  |  17.2 KB  |  415 lines

  1.  
  2.        BATCH FILE COMMAND EXTENSIONS (c)  1992  Scott A. Armitage
  3.               DOS VERSION 3.30 or greater recommended.
  4.  
  5.                             Scott A. Armitage
  6.                             Done Office & Consulting Service
  7.                             Assembler specialists.
  8.                             9250 Timber lane
  9.                             Peoria, Il  61615
  10.  
  11.  
  12. PCHAR.COM   1305 BYTES  -  DISPLAYS ENVIRONMENT VARIABLES OR TEXT CONSTANTS
  13.                            ON DISPLAY SCREEN WITH CURSOR ADVANCE AND LINE WRAP.
  14.                            COMMAND LINE OPTIONS:
  15.  
  16.                     Var name = DISPLAY CONTENTS OF VAR AT CURRENT SCREEN POS.
  17.                            $ = CARRIAGE RETURN/LINE FEED.
  18.                            @ = USE NEXT BYTE AS ATTRIBUTE VALUE.
  19.                            ( = COLUMN VALUE FOLLOWS. (1-2 DIGITS. 0-79) *
  20.                            ) = ROW      "     "      (1-2 DIGITS. 0-24) *
  21.                            / = USE FOLLOWING BYTE(S) AS CONSTANT UNTIL COMMA.
  22.                                CHAR IMMEDIATLY AFTER / MAY BE A COMMA.
  23.  
  24.                          i.e.  "/,,"   = 1 CHAR CONSTANT CONTAINING COMMA.
  25.  
  26.  
  27.                          If no attribute byte is on the PCHAR command line,
  28.                       the attribute at the current screen position will
  29.                       be used.   If command is entered at DOS prompt this
  30.                       will be at column 0 one row below where you entered
  31.                       the command.
  32.  
  33.                          Monochrome display users.  3 files are provided
  34.                       to allow you to read in attribute bytes into your
  35.                       editor.
  36.                                NV.ATR  =  ascii   7 for norm video.
  37.                                HV.ATR  =  ascii  15 for high video.
  38.                                RV.ATR  =  ascii 112 for reverse video.
  39.  
  40.                          Color display users.   The example batch files
  41.                       and all .COM files were written on a 1983 IBM P.C.
  42.                       with a MDA display.  If you would like different
  43.                       color values, change the byte/character IMMEDIATLY
  44.                       following the @ operator in the batch files.
  45.  
  46.                          If non-numeric or out of range values are used
  47.                       for ROW or COLUMN values, the current position will
  48.                       be used for next output.
  49.  
  50.  
  51.            PCHAR Error codes:
  52.  
  53.            ERRORLEVEL 5   = BAD/MISSING command line.
  54.            ERRORLEVEL 4   = BAD MCB chain/environment not found.
  55.            ERRORLEVEL 3   = Variable not found.  (op1)
  56.  
  57.  
  58.                          * MAX # OF ROWS & COLUMNS DEPENDENT ON VIDEO MODE
  59.                            STATUS INFO AT 0040:004AH & 0040:004CH.
  60.  
  61.  
  62.  
  63.  
  64. PCHAR2.COM    88 BYTES  -  DISPLAYS TEXT ON SCREEN IN TELETYPE MODE.
  65.                            NO OPTIONS.
  66.                            USE CR.COM OR LF.COM FOR LINE/CURSOR CONTROL.
  67.                            SEE SPIN.BAT & TUMBLE.BAT FOR EXAMPLES.
  68.  
  69.  
  70. KEYHIT.COM    17 BYTES  -  RETURNS ERRORLEVEL 1 IF KEYHIT ELSE ERRORLEVEL 0.
  71.  
  72.  
  73. GETKEY.COM   565 BYTES  -  WAITS FOR KEY.  RETURNS KEYCODE IN ERRORLEVEL &
  74.                        ENVIRONMENT VAR "K".  Installs "K=?" in environment
  75.                        if 5 or more bytes free.  If space not available,
  76.                        only returns KEYCODE in ERRORLEVEL.
  77.  
  78.                        OPTIONS:  U/u FOR UPCASE OF KEY.
  79.                                  E/e FOR ECHO OF CHAR.
  80.  
  81.  
  82.  
  83.  
  84. QPAUSE.COM  3613 BYTES  -  WAITS FOR KEY.  RETURNS KEYCODE IN ERRORLEVEL &
  85.                        ENVIRONMENT VAR "K".  Installs "K=?" in environment
  86.                        if 5 or more bytes free.  If space not available,
  87.                        only returns KEYCODE in ERRORLEVEL.
  88.                        If key = < > | space or Return, K=ascii(255).
  89.                        Errorlevel will contain ascii code.
  90.                        GETK will return chars < > | space and Return in
  91.                        variable K.
  92.  
  93.                        If Function or control key is pressed, ERRORLEVEL
  94.                        will return 0 and "K" will be ascii value of scan
  95.                        code.
  96.  
  97.  
  98.                        COMMAND LINE PARAMETERS:
  99.                     nn      = ANY 1 TO 2 DIGIT NUMBER USED FOR SCROLL SPEED.
  100.                               RANGE 0-30.  IF ABOVE 30, 30 USED.
  101.                               0 = Fastest, 30 = slowest.
  102.  
  103.                     A or a  = ANINIMATE OFF, NO HORIZ OR VERT SCROLLING.
  104.                     B or b  = BEEP.  Will beep once for each occurence of B/b
  105.                               on the command line.
  106.                     D or d  = NO SCREEN DISPLAY.
  107.                     F or f  = Don't flush key buffer.
  108.                     S or s  = ENABLE SNOW CHECKING (CGA cards only).
  109.                               This option will slow down display.
  110.                               Use a lower speed value.
  111.                     U  or u = Return environment var K in upcase if in a-z.
  112.                     E  or e = ECHO K value on screen.
  113.                     P  or p = ECHO text string on screen.
  114.                     @c      = Use ascii value of char IMMEDIATLY after @ as
  115.                               attribute byte for Frame OR text if Frame
  116.                               attribute already obtained.
  117.                     '       = Use text with Left/Right scroll. (28 chars max)
  118.                     "       = Use text, no Left/Right scroll.  (74 chars max)
  119.  
  120.     If ' or " options are used, they must be last on command line.
  121.     ALL character following 1st occurence of ' or " will be used until
  122.     end of command line encounterd or field full.
  123.  
  124.     If less than 26/72 chars are in text, it will be centered within 28/74
  125.     char field.  Pad out your text with blank spaces to disable centering.
  126.  
  127.     The other parameters may be placed on the command line in any order
  128.     with or without any delimiters you choose.  Invalid chars are ignored.
  129.     Only the first 1 or 2 digit number found will be used for speed.  Other
  130.     digits/numbers on command line will be ignored.
  131.  
  132.     If the MCB chain or DOS's environment is corrupt, has an unknown format,
  133.     or if there is no room to install K=  in environment,  ASCII Key code will
  134.     only be returned in ERRORLEVEL.
  135.  
  136.  
  137.  
  138.  
  139. While QPAUSE is running:   Press RIGHT SHIFT        = speed up.
  140.                              "   LEFT SHIFT         = slow down.
  141.                              "   CTRL+RIGHT SHIFT   = TOGGLE DISPLAY ON/OFF
  142.                              "   CTRL+LEFT SHIFT    = TOGGLE ANIMATE ON/OFF
  143.                              "   CTRL+ALT           = TOGGLE SNOW CHECKING
  144.                                                       (CGA only.)
  145.  
  146.  
  147. QPAUSE DEFAULTS = ANIMATE ON, DISPLAY ON, NO BEEP, NO SNOW CHECKING
  148.                   SPEED = 8, TEXT = 'Press any key to continue...'
  149.  
  150. FORMAT - QPAUSE ba "HERE IS SOME TEXT !
  151.   =  BEEP at start, no scrolling, show text until keyhit...
  152.  
  153.  
  154. NOTE  -  QPAUSE READS values from the ROM BIOS data area locations
  155.          0040:0017H (keyboard status) & 0040:006CH (master clock count)
  156.          for use in the delay routine.  If TSR programs are active which
  157.          WRITE or MODIFIY either of these locations, QPAUSE may lock up.
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166. BVAR.COM   1819 BYTES - Provide access to DOS environment variables.
  167.  
  168. FORMAT - BVAR [-] [op1] [func] [op2] [,] [op1] [func] [op2].....
  169.  
  170.          FUNCtion operators:
  171.  
  172.           NONE (op1[,])   = If no func for op1, 1st char of op1 is incremented
  173.                             by 1.
  174.           - (before op1)  = Decrement 1st char of op1 by 1.
  175.           - (after op1)   = Subtract 1st char of op2 from 1st char of op1,
  176.                             result in 1st char of op1.
  177.           +   "    "      = Add 1st char of op2 to 1st char of op1,
  178.                             result in 1st char of op1.
  179.           =   "    "      = Copy op2 into op1.
  180.           $   "    "      = Process rest of command line if op1=op2.
  181.           &   "    "      =  "      "        "      "     " op1<>op2.
  182.           /   "    "      = Use char(s) IMMEDIATELY after / as op1/op2 value.
  183.           ~   "    "      = Append op1 to last environment variable SET.
  184.           #  NO OP1/OP2   = Remove 1 char from last environment variable.
  185.                             (Will not remove an equal sign. = )
  186.           ,  after op1 or op2 =  additional commands on command line.
  187.           ;               = Rest of command line is comment.
  188.  
  189.  
  190.      Comma's should be used to seperate multiple commands on the command line.
  191.      Blank spaces after commas are optional.
  192.  
  193.      NOTE  -  Blank spaces are valid characters in environment variable names
  194.      except as the first character.
  195.        The DOS SET command uses spaces as valid chars.
  196.      i.e   SET K = x and SET K=x result in 2 different variables.
  197.  
  198.      For all functions (except # and ~) op1 must be an existing environment
  199.      variable name.   Op2 may be a environment variable name or a
  200.      character/string constant (/chars).
  201.  
  202.      Characters which indicate the end of a constant are: , ; or ~ AFTER the
  203.      first character of the constant OR the end of the command line.
  204.      Blank spaces will NOT terminate a constant.
  205.  
  206.      Constants may only be used as op1 with the append function operator (~).
  207.  
  208.  
  209.  
  210.  
  211. **  USE CAUTION WITH BATCH SUBSITUTE FUNCTION. %VAR%
  212.  
  213.         Make SURE that ANY command line in your batch file does not
  214.      get larger than 128 chars when expanded by command.com.
  215.      DOS will probably lock up if this occurs.
  216.  
  217.      See BVLEN.COM for example of determining length of variables.
  218.  
  219.         The REMOVE function (#) can set vars to a length of 0 (empty).
  220.      References to an environment variable in this state in DOS/BATCH commands
  221.      are not recommended. (via %var% subsitute function)
  222.  
  223.         The BVAR compare functions ($,&) will work on an
  224.      empty variable.  (It will be less than anything you compare it to.)
  225.      Only 1 empty variable can be in the envrionment and it will be the last
  226.      variable there.
  227.  
  228.         Op1 will only be appended if there is sufficient room in the current
  229.      DOS environment.  i.e.  Free space available must be greater than
  230.      length of op1+4.  Free space is determined each time bvar loads
  231.      BEFORE the command line is processed.  Only ONE command that changes the
  232.      number of chars used in the environment (# and ~) should be used in each
  233.      call to bvar UNLESS steps are taken to insure that plenty of spare
  234.      environment space is available.   4 append operations seems to be the
  235.      max allowed.  If more than 1 append function is placed on one command line,
  236.      check that all desired commands are executed during testing.
  237.      See MCCCOM.BAT for example.
  238.  
  239.  
  240.         To load a secondary copy of COMMAND.COM with 32,000 bytes of
  241.      environment space enter:  COMMAND /E:32000
  242.      at DOS prompt.   Type EXIT to return to original copy of DOS.
  243.      See your DOS manuals for more info on setting environment size.
  244.  
  245.  FOR LAST COMMAND ON COMMAND LINE  - ERRORLEVEL RETURNS:
  246.  
  247.            ERRORLEVEL 5   = BAD/MISSING command line.
  248.            ERRORLEVEL 4   = BAD MCB chain/environment not found.
  249.            ERRORLEVEL 3   = Variable not found.  (either op1 or op2)
  250.            ERRORLEVEL 1   = CARRY/BORROW flag is set.
  251.                             Only for functions +- or none (inc op1).
  252.                             If inc or + indicates var's value went from
  253.                             ascii 255 to ascii 1.
  254.                             If dec or - indicates var's value went from
  255.                             ascii 1 to ascii 255.
  256.            ERRORLEVEL 0   = Operation sucessful.
  257.  
  258.  For compare commands (op1 & op2 or op1 $ op2) RETURNS:
  259.  
  260.            ERRORLEVEL 2   = OP1>OP2
  261.            ERRORLEVEL 1   = OP1<OP2  OR OP1>OP2
  262.            ERRORLEVEL 0   = OP1=OP2
  263.  
  264.  For conditional process commands (op1 $ op2/op1 & op2) ERRORLEVEL
  265.  will reflect result from last compare executed UNLESS a subsequent
  266.  command on that command line results in a ERRORLEVEL value other than 0.
  267.  (carry/borrow flag set OR variable not found).
  268.  
  269.  
  270.  
  271.  
  272.  
  273. Valid char range = 1 to 255.  If an environment variable is set to ascii 0,
  274.                          DOS losses everything which follows that variable.
  275.                          BVAR will not allow this.
  276.  
  277.    The = function will allow you to reset the value of an environment
  278. variable without using the DOS SET command.  SET would move the variable
  279. to the end of the environment list.
  280.  
  281.    The = function will not change the length of op1.
  282.  
  283. example:
  284.  
  285.  BVAR op1=op2   ;where op1=123 and op2=abcde
  286.  results in op1=abc
  287.  
  288.  BVAR op1=op2   ;where op1=12345 and  op2=abc
  289.  results in op1=abc45
  290.  
  291.  
  292. BVAR will accept either upper or lower case for op1/op2.
  293. If op2 is to be a constant (/ function), it will not be converted to
  294. upper case.
  295.  
  296.  
  297.  
  298.  
  299. BVLEN.COM    766 BYTES  - Return length of environment variables value.
  300.  
  301.     BVLEN op1
  302.  
  303.     Returns length of environment variable op1 in variable K.
  304.     i.e. ascii value of K = length of op1.
  305.  
  306.     Error codes:
  307.            ERRORLEVEL 5   = BAD/MISSING command line.
  308.            ERRORLEVEL 4   = BAD MCB chain/environment not found.
  309.            ERRORLEVEL 3   = Variable not found.  (op1)
  310.  
  311.  
  312. GDENV.EXE   1814 BYTES  - Environment status utility program.
  313.  
  314.    Use to determine space available and check if currently active DOS
  315. environment has been found.
  316.  
  317. Lists contents of all environment blocks in MCB chain. ($ shown as space).
  318. Shows size and bytes free for all environments owned by DOS.
  319. Shows bytes free in DOS environment currently active.
  320.  
  321.    Will increment variable K=  if found in environment.  i.e. if K=A in
  322. DOS environment.  Run GDENV at DOS prompt,  type SET at DOS prompt,
  323. if K=B is shown, GDENV found the currently active DOS environment correctly.
  324.    If variable K= is not in the current DOS environment, GDENV will install
  325. it, IF 5 or more bytes are free.   Subtract 4 from the number of bytes
  326. GDENV reports as free if K=  is installed by GDENV.  (or run it again.)
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  Example batch files:
  334.  
  335.  BVCMP.BAT   -  Compares 2 variables.  Place names on BVCMP command line.
  336.                 2nd parameter may be a BVAR constant.  i.e  /123
  337.  
  338.  BVCNT.BAT   -  Count from 0 to 999 and starts over.  Press a key to quit.
  339.  
  340.  ELT.BAT     -  Use to test QPAUSE or GETK.  Use QPAUSE or GETK command and
  341.                 command line to test as parameter to ELT.
  342.                 Shows use of ERRORLEVEL and result value of K= .
  343.                 Use to show results of Funtion/Ctrl/Alt key combos.
  344.                 i.e.  C:\ELT getk u,e
  345.                  =    Test getk with echo and uppercase conversion
  346.                       until ESC pressed.
  347.  
  348.  GRID.BAT    -  Displays row & column grid on screen.
  349.  
  350.  DEMO.BAT    -  Runs GRID.BAT, MCC.BAT and TUMBLE.BAT until keypress.
  351.  
  352.  
  353.                 The next 3 files have had the main loop compiled by
  354.                 BAT2EXEC Ver. 1.2 (c) 1990 Ziff C Co.
  355.                 This is the only batch file compiler tested with the
  356.                 bvars programs.   Since COM files generated by BAT2EXEC
  357.                 only have access to the COM files copy of the environment
  358.                 and not the currently active DOS environment, all refrences
  359.                 to vars within the main loop must be from one of the bvars
  360.                 programs.   Other batch compilers that support the SET
  361.                 command and allow access to the active DOS environment should
  362.                 compile the entire batch program.
  363.  
  364.  
  365.  MCC.BAT     -  Displays all characters and attributes available valid
  366.                 for display in a batch file.     (MCCCOM.BAT/COM)
  367.  
  368.  
  369.  SPIN.BAT & TUMBLE.BAT - Demos of some character animation from batch.
  370.          Change lines SPINCOM/TUMCOM to CALL SPINCOM/CALL TUMCOM to see
  371.          how slow they are executed by command.com.
  372.  
  373.          Main loops for these are also compiled.  See SPINCOM.BAT
  374.          and TUMCOM.BAT for batch source.
  375.  
  376.  
  377.  
  378. NOTE  -  If you abort one of these batch files (or any others) by pressing
  379.          Control-Break, all environment variables set by the batch file
  380.          will remain in your environment.
  381.  
  382.          For best results copy all *.com files to a RAMDISK and set your
  383.          PATH so DOS looks there first.
  384.  
  385.  
  386.          BVARS licence agreement.
  387.  
  388.          Single copy users                            $  5.00
  389.          (programs installed on 1 PC)
  390.  
  391.          Consultant/business users                    $ 10.00 1st copy.
  392.                                                          2.00 each additional
  393.                                                               machine running
  394.                                                               BVARS programs.
  395.  
  396.          Please keep yours and your clients/employers systems from being
  397.          in violation of FEDERAL LAW by registering this program if you
  398.          find it to be useful.
  399.  
  400.          SUPPORT THE EFFORTS OF INDEPENDENT PROGRAMMERS !
  401.  
  402.  
  403.          Send payments to:
  404.                             Scott A. Armitage
  405.                             9250 Timber lane
  406.                             Peoria, Il  61615
  407.  
  408.          Cash, checks and money orders accepted.
  409.  
  410.  
  411.           Your comments and suggestions for Ver. 2 are also welcome.
  412.  
  413.  
  414.  
  415.