home *** CD-ROM | disk | FTP | other *** search
/ Frostbyte's 1980s DOS Shareware Collection / floppyshareware.zip / floppyshareware / USCX / DOSUT-03.ZIP / NUMZAP.DOC < prev    next >
Text File  |  1984-06-07  |  20KB  |  925 lines

  1.  
  2.  
  3.  
  4.                                    READ
  5.                                    THIS
  6.                                   BEFORE
  7.                                  PRINTING!!!!
  8.  
  9.       This document has been formated in a special way. Virtually all dot
  10.       matrix printers have a condensed mode which prints 132 characters
  11.       across a standard 8 1/2 inch page.  When this file is printed out in
  12.       condensed mode, the resulting printed pages can be cut down to 5 1/2 X
  13.       8 1/2 inches.  The cut pages will fit nicely in the back of your
  14.       DOS manual for storage.
  15.  
  16.       Typically, you can turn on this mode by sending a special control
  17.       sequence to the printer from BASIC.  For example, you can turn on the
  18.       condensed mode of the IBM/Epson printer with the BASIC statement:
  19.       LPRINT chr$(15).  If your printer has such a condensed mode, turn it
  20.       on now, before printing the rest of this document.
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.                                          (tm)
  77.                                    NUMZAP
  78.  
  79.                          Selective Line Number Removing
  80.                      Utility for the IBM Personal Computer
  81.  
  82.                                 User's Manual
  83.  
  84.                           (c) 1983 by David Whitman
  85.  
  86.                                  Version 1.00
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.       David Whitman
  109.       136 Wellington Terrace
  110.       Lansdale, PA 19446
  111.  
  112.       (215) 362-8526 (evenings)
  113.       (215) 641-7114 (days)
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.                                                                      1
  135.  
  136.  
  137.  
  138.  
  139.  
  140.                             Table of Contents
  141.  
  142.  
  143.             I. What does NUMZAP do?..........................2
  144.  
  145.             II. Programming with NUMZAP......................4
  146.  
  147.             III. Running NUMZAP..............................5
  148.  
  149.             IV. Using Converted Programs.....................7
  150.  
  151.             V. Comments about Optimization...................8
  152.  
  153.             VI. Miscellaneous and a Word From Our Sponsor....9
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.                                                                      2
  201.  
  202.       I. What does NUMZAP do?
  203.  
  204.       NUMZAP is a utility for removing line numbers from BASIC
  205.       programs.  Just removing the line number from the beginning of
  206.       each line is rather easy, and somewhat pointless.  NUMZAP is
  207.       slightly more selective, however.  NUMZAP removes only those line
  208.       numbers which are not referenced from other parts of the program.
  209.       For example, consider the following short BASIC program:
  210.  
  211.           100 PRINT "Help me out of this loop!"
  212.           110 C$ = INKEY$: IF C$<>"" THEN STOP
  213.           120 GOTO 100
  214.  
  215.       After passing through NUMZAP, the program will look like:
  216.  
  217.           100 PRINT "Help me out of this loop!"
  218.               C$ = INKEY$: IF C$ <>"" THEN STOP
  219.               GOTO 100
  220.  
  221.       You might think that this selective filtering is just as
  222.       pointless as removing *all* the line numbers.  Certainly the
  223.       resulting file is not usable by the BASIC interpreter.  The
  224.       reason for this particular conversion is to take advantage of a
  225.       little used feature of the IBM/Microsoft BASIC compiler.  The
  226.       following is quoted from the BASIC compiler manual, page 42, in
  227.       the section on compiler parameters:
  228.  
  229.       "/N     The /N parameter tells the compiler to relax line
  230.               numbering constraints.  When /N is specified, line
  231.               numbers in your source file may be in any order, or they
  232.               may be eliminated entirely.  Any line numbers which exist
  233.               have nothing to do with the sequence of the lines; they
  234.               serve only as labels for GOSUBs, GOTOs, and any other
  235.               statements which use line numbers as references for
  236.               branching.
  237.  
  238.               With /N, lines are compiled normally, but unnumbered
  239.               lines cannot be targets for GOTOs or GOSUBs."
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.                                                                      3
  267.  
  268.              " There are three advantages to using /N:
  269.  
  270.                *   Elimination of line numbers increases program
  271.                    readability.
  272.  
  273.                *   The BASIC compiler optimizes over entire blocks of
  274.                    code rather than single lines (for example in
  275.                    FOR...NEXT loops).
  276.  
  277.                *   BASIC source code can more easily be included in a
  278.                    program with $INCLUDE."
  279.  
  280.       Another advantage, not mentioned in the manual, is that reducing
  281.       the number of numbered lines will enable the compiler to handle
  282.       larger source files.   Since BASCOM only uses 64K regardless of
  283.       the actual memory available, remembering the offset of each line
  284.       number in a large program can soon eat up all the usable memory.
  285.       When this happens, BASCOM rather ungracefully begins to emit an
  286.       unending series of TC (Too Complex) error messages until it
  287.       reaches the end of your program.
  288.  
  289.       NUMZAP, then, is a utility to allow effective use of BASCOM's /N
  290.       parameter.  When programs are passed through NUMZAP prior to
  291.       compilation, BASCOM can do a better job of optimizing the
  292.       resulting object code.  The object code produced tends to be
  293.       tighter, more compact, and faster running.  As an added bonus,
  294.       since fewer line numbers need to be remembered, larger programs
  295.       can be compiled.
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.                                                                      4
  333.  
  334.       II. Programming With NUMZAP
  335.  
  336.       There are four steps to producing an optimized BASIC program with
  337.       NUMZAP:
  338.  
  339.          1. Enter the program using the BASIC interpreter's screen
  340.             editor.
  341.  
  342.          2. Run and debug the program from within the interpreter.
  343.  
  344.          3. Pass the debugged program through NUMZAP.
  345.  
  346.          4. Compile the 'zapped program with BASCOM, using the /N
  347.             parameter.
  348.  
  349.          5. Link the compiled program with LINK.
  350.  
  351.       It is assumed that users are familiar with steps 1,2 and 5. Steps
  352.       3 and 4 will be covered in the following sections.
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.                                                                      5
  399.  
  400.       III. Running NUMZAP
  401.  
  402.       Your program must be in ASCII format or NUMZAP will be unable to
  403.       read it.  This means that you must use the "A" option when saving
  404.       the program from BASIC:
  405.  
  406.           SAVE"myprog.bas",A
  407.  
  408.       There are two ways to start up NUMZAP:
  409.  
  410.       1. Prompt mode:
  411.  
  412.          From DOS, type:
  413.  
  414.              NUMZAP
  415.  
  416.          After a few seconds, NUMZAP prints a hello screen, then
  417.          prompts:
  418.  
  419.              Input file name? [.bas]
  420.  
  421.          Type in the name of the program you want converted.  If you
  422.          don't provide an extension, NUMZAP assumes it to be .BAS.  If
  423.          NUMZAP is unable to find the file, you will be given the
  424.          option of naming another file, or returning to DOS.  The same
  425.          options will be presented to you if NUMZAP discovers that the
  426.          file is not in ASCII mode.
  427.  
  428.          Once the input file has been specified, NUMZAP will prompt:
  429.  
  430.              Output file name? [.zap]
  431.  
  432.          Type in a name for the converted program.  If you just press
  433.          enter, the name defaults to that of the input file, with an
  434.          extension of .ZAP.
  435.  
  436.          NUMZAP will now convert your program.  Two passes are made
  437.          over the program.  On the first pass, NUMZAP builds a table of
  438.          all the referenced line numbers.  On the second pass, the
  439.          converted program is built.
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.                                                                      6
  465.  
  466.          During the conversion process, a status line is maintained on
  467.          the screen, letting you know how much progress has been made.
  468.          You may abort and return to DOS at any time by pressing the
  469.          Esc key.
  470.  
  471.          When finished, NUMZAP returns you to DOS, and you see the
  472.          prompt:
  473.  
  474.                   A>
  475.  
  476.       2. Expert mode:
  477.  
  478.          You can specify the input and output filenames when you invoke
  479.          NUMZAP.  The syntax is:
  480.  
  481.             NUMZAP [inputname[.ext]] [outputname]
  482.  
  483.          The defaults are as under prompt mode.  If you leave off the
  484.          extension on the input filename, NUMZAP assumes it to be .BAS.
  485.          If you don't provide the output filename, it will default to
  486.          the input name with a .ZAP extension.  If there are any
  487.          problems with the input file, NUMZAP will dump you out to
  488.          prompt mode.
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.                                                                      7
  531.  
  532.       IV.  Using Converted Programs
  533.  
  534.          You must use the /N option when compiling programs converted
  535.          with NUMZAP.  Thus, to compile MYPROG.ZAP you would type:
  536.  
  537.             BASCOM myprog.zap /n;
  538.  
  539.          or (Prompts upper case, your responses in lower case):
  540.  
  541.             bascom
  542.             SOURCE FILENAME [.BAS]: myprog.zap /n
  543.             OBJECT FILENAME [MYPROG.OBJ]: <return>
  544.             SOURCE LISTING  [NUL.LST]: <return>
  545.  
  546.          If you forget to specify the /N, BASCOM will deluge you with
  547.          error messages.  Unlike other, more friendly programs, there
  548.          is no way to abort compilation once started.  Just sit through
  549.          the messages and try again.
  550.  
  551.          Hang onto your un'zapped source file!  Zapped programs can NOT
  552.          be read by the BASIC interpreter (you'll get a "Direct
  553.          statement in File" message).  If you intend to do any further
  554.          debugging under the interpreter, don't erase your source file.
  555.  
  556.          A rudimentary renumbering utility is provided on your NUMZAP
  557.          disk, but don't depend on RENUM if you do extensive editing of
  558.          the 'zapped file.  RENUM simply adds line numbers
  559.          sequentially, with a step size of one.  If you add too many
  560.          new lines, there won't be enough line numbers to use between
  561.          the existing numbers.
  562.  
  563.          If this happens, RENUM will abort with a "Fatal Error"
  564.          message.  Your only recourse should this happen is to split
  565.          the file at the point where the Fatal Error occurred, and
  566.          renumber the parts separately.  The moral of all this is to do
  567.          your editing on the original BAS file, and use ZAP files
  568.          for compilation only.
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.                                                                      8
  597.  
  598.       V.  Comments About Optimization
  599.  
  600.           In general, programs passed through NUMZAP prior to
  601.           compilation will be both smaller and faster running.  The
  602.           magnitude of these effects will vary from program to program.
  603.  
  604.           As a rule, the larger the program, the more noticable will
  605.           the the reduction in size.  This is because all compiled
  606.           BASIC programs have a constant size contribution from the
  607.           various run-time routines which are either linked in, or are
  608.           a part of BASRUN.EXE.
  609.  
  610.           It turns out that the smallest compiled BASIC program will
  611.           take up almost 20K, the size of the run-time enviroment.  If
  612.           you have a 22K compiled program, the *percent* change in size
  613.           after using NUMZAP is not going to be very big, since most of
  614.           the size is the invarient run-time stuff which NUMZAP can't
  615.           affect.  Larger programs, in which more of the size is
  616.           actually caused by the code you write, will show more
  617.           noticable shrinkage, even though the decrease in size per
  618.           line is about the same.
  619.  
  620.           The increase in speed noted will depend on just what the
  621.           program *does*.  Programs which do a lot of number crunching,
  622.           or screen handling, will show the greatest improvements.
  623.  
  624.           On the other hand, programs which do a lot of disk access
  625.           will show little if any speed enhancement.  These programs
  626.           are "I/O bound" -  the program is killing time waiting for
  627.           the disk drives to catch up.   In cases such as this, making
  628.           the program code more efficient doesn't help, since you just
  629.           end up waiting longer for the disk.  NUMZAP version 1.0 is in
  630.           fact I/O bound, and shows no improvement in speed after
  631.           operating on itself.
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.                                                                      9
  663.  
  664.       VI.  Miscellaneous and A Word From Our Sponsor...
  665.  
  666.            A. System Requirements:
  667.  
  668.               NUMZAP requires 64K of memory, and at least one disk
  669.               drive. Obviously, BASCOM is required for the program to
  670.               have any utility.
  671.  
  672.            B. Programming Notes:
  673.  
  674.               NUMZAP was written in BASIC, and passed through itself
  675.               prior to compilation.  The source code for NUMZAP is
  676.               distributed along with the compiled version, in case
  677.               you'd care to customize.  I would appreciate hearing
  678.               about any improvements people make, for possible
  679.               inclusion in future releases.
  680.  
  681.               If you attempt to modify NUMZAP, you should be aware that
  682.               the machine language subroutine which reads the DOS
  683.               command line to handle "expert mode" is incompatible with
  684.               the BASIC interpreter.  If you attempt to run NUMZAP's
  685.               source code under the interpreter without disabling this
  686.               subroutine, a system crash will result, and you'll have
  687.               to reboot.  This routine only gets called once, and I
  688.               generally convert the call into a comment while debugging
  689.               with the interpreter.
  690.  
  691.            C. Red Tape and Legal Nonsense:
  692.  
  693.               1. Disclaimer:
  694.  
  695.                  NUMZAP is distributed as is, with no guarantee that it
  696.                  will work correctly in all situations.  In no event
  697.                  will the Author be liable for any damages, including
  698.                  lost profits, lost savings or other incidental or
  699.                  consequential damages arising out of the use of or
  700.                  inability to use this program, even if the Author has
  701.                  been advised of the possibility of such damages, or
  702.                  for any claim by any other party.
  703.  
  704.                  Despite the somewhat imposing statement above, it *is*
  705.                  my intention to fix any bugs which are brought to my
  706.                  attention.  Drop me a line if you think you've found a
  707.                  problem.
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.                                                                     10
  729.  
  730.               2. Copyright Information:
  731.  
  732.                  The entire NUMZAP distribution package, consisting of
  733.                  source, object, and documentation files, is copyright
  734.                  (c) 1983 by David Whitman.  The author reserves the
  735.                  exclusive right to distribute this package, or any
  736.                  part therof, for profit.  The name NUMZAP (tm) applied
  737.                  to a microcomputer programming utility is a trademark
  738.                  of David Whitman.
  739.  
  740.                  This package may be copied freely by individuals for
  741.                  evaluation purposes.  It is expected that those who
  742.                  find the package useful will make a contribution
  743.                  directly to the author of the program, regardless of
  744.                  where they obtained their copy.
  745.  
  746.           D. Tanstaafl (i.e. There Ain't No Such Thing As a Free Lunch)
  747.  
  748.              CHASM is distributed under the Freeware marketing scheme,
  749.              developed by Andrew Fluegelman, whose efforts are
  750.              gratefully acknowleged.
  751.  
  752.              Anyone may obtain a free copy of this program by sending a
  753.              blank, formatted diskette to the author.  An addressed,
  754.              postage-paid return mailer must accompany the disk (no
  755.              exceptions, please).
  756.  
  757.              A copy of the program, with documentation, will be sent by
  758.              return mail.  The program will carry a notice suggesting a
  759.              contribution to the program's author.  Making a
  760.              contribution is totally voluntary on the part of the
  761.              users.  Regardless of whether a contribution is made, the
  762.              user is encouraged to share the program with others.
  763.              Payment for use is discretionary on the part of each
  764.              subsequent user.
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.                                                                     11
  795.  
  796.              The underlying philosophy here is based on three
  797.              principles:
  798.  
  799.                 First, that the value and utility of software is best
  800.                    assessed by the user on his/her own system.  Only
  801.                    after using a program can one really determine
  802.                    whether it serves personal applications, needs, and
  803.                    tastes.
  804.  
  805.                 Second, that the creation of independent personal
  806.                    computer software can and *should* be supported by
  807.                    the computing community.
  808.  
  809.                 Finally, that copying and networking of programs should
  810.                   be encouraged, rather than restricted.  The ease with
  811.                   which software can be distributed outside traditional
  812.                   commercial channels reflects the strength, rather
  813.                   than the weakness, of electronic information.
  814.  
  815.       If you like this way of distributing software, please support it.
  816.       Send a contribution, and tell your friends and collegues about
  817.       software you find useful.  Write to the editor of your favorite
  818.       computer magazine and tell *him* (or *her*) also.  Only with your
  819.       support can authors of programs such as this continue to provide
  820.       quality software under a system so favorable to YOU, the user.
  821.  
  822.                David Whitman
  823.                136 Wellington Terrace
  824.                Lansdale, PA 19446
  825.                (215) 641-7114
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.                                                                     12
  861.  
  862.  
  863.  
  864.              ==============Also Available===============
  865.  
  866.       CHASM is a full featured assembler for the IBM personal computer.
  867.       Much simpler than the IBM Macro Assembler, CHASM is well suited
  868.       for learning assembly language, as well as for production coding.
  869.  
  870.       Programs assembled by CHASM do not require linking, and are
  871.       already in the fast loading COM format produced by the DOS
  872.       utility EXE2BIN.  This design decision eliminates two "hidden"
  873.       steps involved in producing a running program with the Macro
  874.       Assembler.
  875.  
  876.       CHASM supports two distinct, simple ways to get machine language
  877.       subroutines into programs written in BASIC, the most popular
  878.       language for the IBM personal computer.  (The only way to use the
  879.       Macro Assembler with BASIC is long, convoluted and confusing.)
  880.  
  881.       CHASM comes complete with sixty pages of documentation, plus
  882.       a twenty page primer which introduces assembly language for total
  883.       beginners.
  884.  
  885.       CHASM is available in two forms, an interpreted version and a
  886.       compiled version.  The interpreted version is available free of
  887.       charge for evaluation.  Those who find the program useful are
  888.       requested to make a contribution to the author.  A compiled
  889.       version, which runs about 6 times faster, is available as a free
  890.       upgrade to those who make a contribution of $30 or more.
  891.  
  892.       To obtain a copy of CHASM, send a blank, formatted diskette, plus
  893.       a stamped return mailer (no exceptions, please) to:
  894.  
  895.          David Whitman
  896.          136 Wellington Terrace
  897.          Lansdale, PA 19446
  898.  
  899.       If you would prefer to directly receive the compiled version,
  900.       enclose a check for $30 with your disk.
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.