ZXED SPECTRUM TOOLKIT ALTER - BYTES - COPY DELETE - FIND - HELP LINE - MOVE - APPEND RENUMBER - VERIFY AUTO LINE NUMBERS dk'tronics This cassette has been supplied with two versions of ZXED. Both versions can be used with the 16k or the 48k SPECTRUM. Because with the 16k SPECTRUM you only have 9k of free RAM you may wish to use the shortened version. This only contains the important functions; BYTES, DELETE, LINE, RENUMBER and AUTO LINE RENUMBER. This shortened version is 1675 BYTES. The full ZXED is 3612 BYTES. ZXED -TOOLKIT/EDITOR FOR THE ZX SPECTRUM INTRODUCTION ZXED is a powerful editor for use on the 16k or 48k SPECTRUM. It is intended for use by the serious BASIC programmer and offers several useful and time-saving features most helpful during all stages of program development. The Functions provided are as follows: KEY A ALTER - searches for and then replaces a string of characters. You specify both the original and the new string, and the range of line numbers where the changes are to be made. See also VERIFY below. B BYTES - tells you how much free memory space is available for your program/variables. C COPY - duplicates lines of your program. You specify the range of lines to be copied and where they are to be placed. D DELETE - deletes a block of lines from your program. You specify the range of lines to be deleted. F FIND - finds a string of characters. All lines containing the specified string are listed to the screen. H HELP - gives a menu of the options available along with a brief description of the Function. L LINE - returns the address of a specified line. This address is the first character of the line. M MOVE - as for COPY, except that the original lines are DELETED thus effectively moving lines from one part of your program to another. P APPEND - appends a specified string to lines. R RENUMBER - renumbers the line numbers of your program, including GOTO and GOSUB references. Will also amend the references for LIST, LLIST, RESTORE, RUN and SAVE ... LINE. You specify the start and end line numbers, the new base line number and the increment step. S SEQUENCE - gives AUTO LINE NUMBERS, which is very useful for entering long programs. You specify the starting line number and the increment. V VERIFY - when ON, will list all lines containing the string replaced by ALTER. When OFF, no listing is produced, just the total number of changes made in confirmation of successful amendments or otherwise. Thus all you have to do is to load ZXED into your SPECTRUM before you start and you have all these powerful new commands at your fingertips. PREPARATION FOR USE ZXED is in 4 parts: zxed - re-locating program zxed2 - m/c toolkit (3612 bytes) zxed3 - BASIC program to run zxed2 zxed4 - screen logo Switch on your SPECTRUM and load ZXED by typing the command; LOAD "zxed" (ENTER) RAMTOP (see p.165 of the SPECTRUM manual) will be moved down to make space for zxed2. As ZXED is fully relocatable, it can be used with other utilities which occupy the space above RAMTOP. Also the one version is suitable for both the 16k and 48k versions of the SPECTRUM. After zxed4 has been loaded, the process will stop with Report Code 0. OK. You can now MERGE your program into the SPECTRUM, but you should ensure that it contains no line numbers in the range 9900 to 9916. If it does, you may have to manually re-number them and then MERGE zxda3. You are now ready to use ZXED. One side of the cassette contains a shortened version (1675 BYTES). HOW TO USE ZXED When you want to use ZXED, type: RUN 9900 (ENTER) The display will show a flashing T cursor in the bottom left-hand corner of the screen. If you press H you will obtain a menu giving the options available and the keys to press to use the particular function. The following pages give full details of how to use the various functions. Appendix A contains a list of the Report Codes which may be encountered and their meaning when obtained using ZXED. In most cases the meaning is the same as that printed in the SPECTRUM manual, but there are one or two slight differences. With the display showing the T cursor, or the MENU, you can escape from ZXED by pressing SPACE or BREAK. The program will stop with REPORT L -BREAK into program. ZXED is not fussy whether the key pressed is in CAPITALS or lower case - it will accept either. ALTER - A Purpose: to search for a specified string and replace all occurrences of the string with a new string. Search and replace can be restricted to a range of lines. How to use ALTER: After pressing A, you will be greeted with the following display: A ALTER -Search & replace 'L' (the flashing L is the normal cursor.) Enter the string of characters to be replaced; end with ENTER. The display will now look like this: A ALTER -Search and replace 'original string' to be now enter the new string; again end with ENTER. You will then be asked for the line number from where the change is to be made; any occurrences of the string in lower numbered lines will not be replaced. The display should now look like this: A ALTER - Search and replace 'original string' to be 'new string' From line? Enter the line number followed by ENTER. You will then be asked for the line number of the last line in the block where the changes are to be made. Any occurrences of the original string in higher numbered lines will not be replaced. Thus the original string will be replaced wherever it occurs between the two lines (inclusive). Enter the last line number followed by ENTER and the display should now look like this: A ALTER - Search and replace 'original string' to be 'new string' From line 10 To line 900 (Assuming that you had answered with line 10 and 900). Provided that VERIFY is switched on, this will be followed by a list of all those lines where changes have been made. The total number of changes will then be printed and the process should end with Report 0 OK. Any other Report Code indicates that not all changes have been made. See Appendix A. ENTERING KEYWORDS: Use THEN to give the K cursor, enter the Keyword, then backspace to delete the THEN. BYTES - B Purpose: to display the amount of free memory available. How to use BYTES: Press B and the display will show you how many bytes are free for your use. The program will return to the T cursor. COPY - C Purpose: to copy a block of lines from one part of your program and insert them at another. How to use COPY: Press C then enter the line number of the first line to be copied. Then enter the last line number, and finally the line number after which the lines are to be inserted. The display will now look like this: (using example figures) C COPY lines of your program From line 1 To line 100 Insert After 600 The block of lines you have specified, (1 to 100 in this example) will be copied to the top of memory, re-numbered to be 601 onwards with an incre- ment of 1 and then inserted into your program at the appropriate point. If ZXED has to re-number the remainder of your program to make room for the block of lines to be inserted, ZXED will let you know what it has done by printing a message as follows: R RENUMBER line numbers From line 610 To line 9899 New Base 635 Increment 10 In any event, ZXED will confirm which lines have been inserted by printing a message thus: 601 to line 634 inserted Successful completion will be indicated by Report 0 OK. NB. No GOTO or GOSUB references will be amended in the copied section, though if the ZXED has to RENUMBER the remainder of your program, the references will be taken care of as normal. DELETE - D Purpose: to delete specified block of lines from your program. How to use DELETE: Press D and then enter the line number of the first line to be deleted. Then enter the last line number. ZXED will then delete all the lines you have specified. Successful completion is indi- cated by Report - OK. The line number in the Report will indicate the last line deleted where this is less than the last line specified. FIND - F Purpose: to search for a string of characters and list all lines containing the string to the screen. How to use FIND: Press F then enter the desired string. Keywords can be entered by typing THEN, entering the keyword then backspacing to delete the THEN. The lines containing the string will be listed followed by the total number of lines found containing the string (not the number of occurrences of the string). Successful completion is indicated by Report 0 OK. LINE - L Purpose: to give the address of a line. How to use LINE: Simply press L. The address will be given and will stop with report 0 OK. MOVE - M Purpose: to move a block of lines from one part of your program to another. How to use MOVE: Press M. Thereafter the procedure is exactly the same as for COPY. See page 4. The display will look like this: M MOVE lines of your program From line 1 To line 100 Insert after 600 601 To line 635 inserted APPEND - P Purpose: to add statements to the end of specified lines. For example, for long lines, it will save a lot of editing and use of the cursor control keys, if it was desired to add something to the end of a line or to add the same text to several lines. How to use APPEND: Press P (we cannot use A since that is reserved for ALTER), then enter the text to be added. As with ALTER and FIND, Keywords can be entered using THEN and backspacing to delete the THEN. ZXED will then request the line number of the line to which the text is to be added. Enter the line number. ZXED will then request another line number. If you want to add this same text to another line, enter the appropriate line number. If not, to end the process, enter 0. Successful completion is indicated by Report 0 OK. RENUMBER - R Purpose: to renumber lines of your program. Useful if you want to insert a new section of code but existing line numbers do not allow this. Simply use RENUMBER to create that space. How to use RENUMBER: Press R then enter the first line to be renumbered. Then enter the last line to be renumbered. ZXED will then request the "New Base" line number. This is the new value of the first line. After the New Base line number has been entered, the Increment must be input. This is the difference between successive line numbers. After entering the increment, the display will look like this (using example values): R RENUMBER line numbers From line 105 To line 396 New base 200 Increment 10 All GOTO, GOSUB, RESTORE, LIST, LLIST, RUN and SAVE ... LINE references will be automatically corrected to the new value so that the program will still run correctly. The only exception is the "computed" GOTO or GOSUB; eg. GOTO a+900. In these cases, the line will be listed so that you can decide whether any correction is needed. Renumbering will be completed. Successful completion is indicated by Report 0 OK. The Line number in the Report will he the line after the last renumbered line. SEQUENCE - S Purpose: to save you having to type the line number when entering programs into your SPECTRUM. How to use SEQUENCE: Press S, then ZXED will request the start line number and the increment. After entering these values, ZXED will automatically list the program and supply you with your first line number in the "command line" at the bottom of the screen. Enter new lines as normal. Each time you press ENTER, the line will be checked for syntax, and if correct, will be entered into your program, and a new line number will be generated. The program will be listed as it is entered so that you can check it and refer back to previously entered lines as necessary. To escape from entering lines, delete the line number (using the CAPS SHIFT 0 keys) and enter STOP. Should you make an error and enter a line with incorrect syntax ZXED will detect this and stop with Report "C Nonsense in BASIC". Re-type the line, including the line number, and should you repeat the mistake, the error will be identified with the '?'. After correcting this mistake, to resume with AUTO LINE NUMBERING, press CONTINUE. Existing lines with the same number as that being entered will be replaced with the new line in the normal way. If ENTER is pressed immediately after the line number, any existing line with that number will be deleted and ZXED will skip to the next number in the sequence. To skip a line without deleting an existing line, delete the line number and then press ENTER. A new line number, the next in sequence, will be generated. VERIFY-V Purpose: to enable the user to choose whether to list all changes made with ALTER to the screen or just the total number of changes. How to use VERIFY: Press V. The status of VERIFY will change from ON to OFF or if VERIFY was already OFF, it will enable VERIFication by switching VERIFY ON. ZXED will return to the 'T' cursor. APPENDIX A ZXED REPORT CODES 0 OK = Successful completion. 4 OUT OF MEMORY = Not enough room in the SPECTRUM. 9 STOP STATEMENT = Escape from SEQUENCE. A INVALID ARGUMENT = Number encountered (CHR$ 14) in string to be replaced during ALTER. B INTEGER OUT OF RANGE = Increment = 0 (RENUMBER, SEQUENCE). C NONSENSE in BASIC = Empty string (FIND, ALTER) or replacement string same as original. Also syntax error during SEQUENCE. G NO ROOM FOR LINE = ENTER (CHR$ 13) normally terminates a line. If this is missing for any reason; ie. your program has got corrupted, Report G will result. H STOP in INPUT = STOP was entered in response to request for parameters. CONTINUE will repeat the INPUT request. L BREAK into PROGRAM = BREAK or SPACE pressed when 'T' cursor or menu displayed. CONTINUE will not re-enter ZXED, but will skip to the next line (INPUT). N STATEMENT LOST = Specified line not found in your program. Check that you have entered the correct line number. In most cases you do not have to specify the exact line number; for example, DELETE 100 to line 200 will delete any lines within that range, but lines 100 and 200 need not exist. However, on receipt of this error code, the specified line must exist; eg. when ZXED requests the INSERT AFTER line number in COPY or MOVE. Q PARAMETER ERROR = Specified line numbers will result in an overlap of line numbers; e.g. during RENUMBER, if you try to renumber lines 100 to line 200 with a new base of 10 and a line in the range 10 to 99 exists. In addition to the above, if ZXED requests "Scroll?" and you press n or space, Report D will result. CONTINUE may give Report 5 OUT of SCREEN. To avoid this, enter PRINT : CONTINUE. End of APPENDIX A