Utility 2 - Renumber, Block Delete and Lister  27-NOV-1997 Geoff Wearmouth.
---------------------------------------------------------------------------

    This is the second in a series of screen-resident utilities for the
    ZX Spectrum range and emulators. These programs are different because
    the loading screen is the program. They are called using INPUT USR
    16384. All three are self-deleting and have to be reloaded every
    time they are required.

    The file is saved to a tapfile with a demo basic program that explains
    most features and is a good practice file for renumbering. All you really
    need is the SCREEN$. Resave it to your tools tapfile or microdrive.
    A snapshot is no good but a .scr file can be handy.

    The advantage of screen-resident utilities is that they are easy to load,
    easy to delete and can be used regardless of the size of your program
    and without altering RAMTOP.

    I developed 'u2' to provide customised output on my Alphacom 32 thermal
    printer. Once I had the line selection routines developed, it made sense
    to use these for a Block Delete and then the more challenging Renumber.

Printer Output
--------------

    The ZX printer output looks fine with the standard Spectrum font but the
    thermal Alphacom doesn't get a chance to warm up so single-pixel
    characters can be a bit faint especially with blue paper.
    I started using a thick character set and eventually developed a
    routine that emphasized characters on the fly. When the 128K Spectrum
    came out the program had another advantage as it didn't use the printer
    buffer but printed lines invisibly on line 15. The 128K Spectrum editor
    had it's faults but one nice feature was that it kept line numbers and
    program code separate. I introduced this formatting option although
    because of differences in the way 128K Basic prints some keywords, it
    does not give identical printouts to the 128K LLIST routines.

    I never imagined that this program could output to a more
    sophisticated printer but, as I was writing it, Gerton was developing the
    Z80 Spectrum emulator, which includes emulation of the ZX printer.
    No need for thick characters there, but it's nice to see Spectrum
    listings emerging from my laser printer.

    Select the portion of code you wish to print using the horizontal
    arrow keys while the bar is on the First Line/Last Line sections.
    To indent the code press the right arrow while on 'Format'. To
    deselect use the left arrow.
    To print using an emphasized character set press ENTER while the bar
    is on 'Character Set'. Pressing ENTER again will toggle the selection.
    Finally move to LLIST and press ENTER. While the ZX printer will
    burst into life, the emulated printer will just print to an internal
    buffer and the only indication that it has completed is when you can move
    the cursor keys again. I intend to improve this in v1.3.

Block Delete
------------

    This hardly requires an explanation except that, to prevent accidents
    on first entering the screen, entire program deletion is inhibited.
    Make a note of how much the free memory increases.

Renumber and Subroutine Relocator
---------------------------------

    Most Dartford BASIC programs I've seen have sections identified by
    a significant line number eg. 1000, 2000 etc.
    A simple renumber would ruin this structure so I used the line selection
    routines to define an area to be renumbered. I added a step selection
    line and also a destination number line ie. the number the program or
    subroutine renumber process would start with. 
    This also enables a section of code to be moved past another section
    to a new location - something I'd always wanted.
    During renumbering the original two-byte line numbers are written to
    the top third of the screen and the new line numbers to the middle third
    of the screen. The utility then searches the entire Basic program for
    qualifying line numbers substituting the number from the middle section.
    For a large program this can take quite some time and there's no room
    left to display anything.
    The 128K RS232 baud setting command FORMAT LINE 9600 will be incorrectly
    renumbered, so inhibit this by using FORMAT LINE VAL "9600". There's no
    room left to alter the utility.

History
-------

Jun 89      v1.1 published on Outlet magazine.

Nov 97      bar changed from green to cyan.
            Green spot indicator left when changing Destination increment -
            I prefer this.
            Main menu title changed to 'u2'.
            Basic demo tidied a bit.
            Wrong Outlet address removed from screen.
            v1.2 uploaded to ftp incoming directories.

Limitations and Features
------------------------

    Size limit of 1024 lines in BASIC program.
    In the unlikely event of program running out of memory during renumber
    menu bar changes to red. There will be something like
    GOTO VAL "line number" in the program.
    On the emulated ZX printer last page of listing is produced by placing
    printer offline and pressing Print or FormFeed.
    No indication when emulated ZX printing is complete.
    Program calls routines in 48K Rom but works with all variants I've
    tested.
    Not likely to work on standard TS2068.

    There may be others.
    Send bugs to geoff@wearall.demon.co.uk


