BASIC for Programmers. (#2)
(C) Dm. Rudovsky 1995
________________________________
As promised in the last issue, today's article will be dedicated to functions and programs that extend the standard Basic 48.
This article will cover:
- Renumber of Basic 128
- Trace & Speed
- Blast Toolkit
- ZXeditor
Let's start with the closest extension - Basic 128. The only function worth mentioning is Renumber. When this function is called, the lines of the program are renumbered starting from the first with a step of 10. However, the number of the "first" line, as well as the step, can be changed by entering the necessary parameters into the system variables RNFIRST and RNSTEP (23444/45 and 23446/47 respectively) of Basic 128. If you are not satisfied with this method (it's quite understandable that entering four POKE commands in the editor of Basic 128 is not very pleasant), I recommend using either extensions of the standard Basic like Mega, Beta, or Laser Basic, or extensions like ZXED or the TOOLKIT utility, or subroutines from the Supercode and Newsupercode packages. If you come across an unknown product that claims to be able to renumber programs, you can test it using the following example:
1 LET A=10
3 PRINT A
4 GO SUB 19
6 PRINT A
8 GO TO 10
9 PRINT "NONSENSE"
10 RESTORE 110
11 READ A: PRINT A
13 STOP
19 LET A=2*A: RETURN
100 DATA 35
110 DATA 50
Run this test, write down or remember the results, then renumber it with the product you are testing and run it again. If the results of both runs match, the tested program is suitable for use; otherwise, delete it from the disk. A few comments. As you understand, this example checks all types of addressing in Basic, and if the renumber program forgets something, the results of the test will change drastically. Now let's move on to another type of programs - debuggers (Tracers). All extensions of the standard Basic have the TRACE command, and of the individual programs performing similar functions, I only know TRACE&SPEED by Eliseev, which allows not only to track the execution of the program through the commands but also to change the speed of its execution almost arbitrarily. I will tell you more about this program. The program takes two lines from you - 1 and 9999 (turning the debugger on and off respectively), as well as the upper part of RAM starting from 61000. By the way, for these reasons, you need to load your program using MERGE, not LOAD, as the latter will lead to the erasure of part of the debugger and its malfunction accordingly. You loaded the debugger, your program, and then as usual - RUN. You will see a prompt: Input speed (1-Max,255-Min): You are actually entering not the speed but the delay coefficient. If you lack the speed of the interpreter, compile the program (the debugger does not take compiled modules, unfortunately). Now about the negative aspects of the program:
1. It is categorically not recommended to:
- use the STOP command in the program and other emergency exit methods (they should be replaced with GOTO 9999)
- stop the program using BREAK or in INPUT
- use lines 1 and 9999.
2. Inconveniences of the program:
- the inability to stop the program at low speeds complicates debugging, and in the case of a fatal error (like 10 GO TO 10), it leads to real torment
- when slowed down, the program starts to work in jerks, which creates difficulties (for example, in checking the output quality).
If you still had to press BREAK, then without pressing ENTER type GO TO 9999 to return the computer to normal operation mode.
Having finished with debuggers, let's return to utilities and consider two of them - ZXEDITOR and BLAST TOOLKIT. The BLAST TOOLKIT utility is part of the BLAST compiler package (I know of another TOOLKIT that has nothing to do with the one described) and essentially has several functions that prepare the text of your program for compilation. However, I have not seen a proper disk version of this package, and therefore these functions become meaningless and will not be described here. So, you loaded TOOLKIT and saw that there were no external changes - TOOLKIT protects its codes using CLEAR and erases the loader from memory. But I still recommend reinstalling it as follows: NEW, then RANDOMIZE USR 60497. All utility functions start with "*" and consist of one letter and parameters. Below is a description of these functions:
*EN1 - edit the line with number N1.
*CN1-N2,N3 - copy lines from the interval N1-N2 to the area starting from line N3. If N2 is absent, one line is copied.
*DN1-N2 - delete lines from the interval N1-N2. If N2 is absent, one line is deleted.
*MN1-N2,N3 - move lines. Similar to copying, but the original lines are deleted.
*RN1-N2,N3,N4 - Renumber lines from the range N1-N2, the first is assigned number N3, renumbering goes with a step of N4. By default, N4=10.
*FN1-N2,N$ - search for text N$ in the range N1-N2. If N$ is absent, text specified by previous functions *F and *S is searched.
*SN1-N2,N1$,N2$ - similar to *F, but the found text N1$ is replaced with N2$.
*TN - tracing the program from line N. Slowing down the tracing - space, and stopping - ENTER.
*K - delete all REM lines from the text except those that start with !, % and &. This is because in BLAST, REM and these symbols have special meaning.
*Q - end of work.
In case of exiting TOOLKIT, use RANDOMIZE USR 60497 to return there.
Now let's move on to another utility - ZXEDITOR. This program, unlike the one described above, occupies lines in Basic starting from 9900 and adds 12 new functions to the standard Spectrum editor, which are set in cursor mode T. You can see it by executing the command GO TO 9900.
Here is a list of ZXEDITOR functions:
A - Search and replace text in the program. The utility finds the text, replaces it, provides listings of the replaced parts, and finally writes the number of replacements made.
B - Volume of free memory for Basic.
C - Copying lines of the program, similar to TOOLKIT.
D - Deleting a group of lines.
F - Searching for text in the program and listing starting from that text.
H - This function will output the same as written here, only shorter and in English.
L - By entering the line number, it will give its address in memory.
M - Moving lines, similar to *M in TOOLKIT.
P - Adding text to a line.
R - Renumbering lines.
S - Automatic input of the line number. The program listing is displayed on the screen, and the line number being entered is shown in the editor window.
V - List of changes.
Now some additional explanations:
From line - from line
To line - to line
base - start from
increment - step
insert after - where to insert?
to be - to replace with?
Quotes with the cursor usually mean a request to enter text. At the end, it should be noted that after loading this program, you can delete lines 9990 and 9991 (use them). But load your program only using MERGE; otherwise, you will not be able to make ZXEDITOR work by any means.
P.S. If you know of any cooler utilities, please let us know.
Contents of the publication: ZX Format #02
- IS-DOS
Announcement of a school-ready hardware-software complex by Iskra Soft and Peters, featuring a networked computer class setup on ZX Spectrum with IS-DOS.
- IS-DOS - Владимир Елисеев
Explanation of command line monitor and text editor restart in IS-DOS using mon.com utility as an example.
- IS-DOS
Introduction to IS-DOS system utilities, covering functions like help, user menu, file viewing, editing, and file operations.
- IS-DOS
Detailed description of the eliminat.com program for freeing memory from resident tasks and drivers, featuring interactive mode and command-line keys. Specific channel numbers allocated for task and driver types. Includes usage options and color customization.
- IS-DOS Window System - Владимир Елисеев
Exploration of IS-DOS window system restarts for printing text in windows and absolute screen coordinates. Examples of restart implementations such as lwt, adrwt, lenwt, prstr, str, and lnstr. Continuation to cover auxiliary restarts in next issue.
- Assembler
Introduction to assembly language basics, focusing on flags, arithmetic operations, and register manipulation. Discusses addition, subtraction, and complex operations like multiplication and division through examples. Highlights specific assembly commands and their functions for ZX Spectrum.
- Hardware
Discussion of hardware modifications for Scorpion ZS-256-Turbo, including the implementation of a Turbo/Normal switch. Pros and cons of software-based switching methods. Advice on soldering and circuit adjustments.
- Hardware
Discussion of a new music add-on for ZX Spectrum by X-TRADE and HACKER STINGER, called 'ZX GENERAL SOUND', offering high-quality audio and minimal processor usage.
- Hardware
Discussion on hardware innovations and marketing strategies, focusing on mouse and keyboard interfaces for ZX Spectrum. Critique of competitor's misleading advertising and analysis of serial versus passive mouse technology. Author questions necessity and cost of advanced features.
- Hardware
Discussion of hardware acceleration methods for ZX Spectrum, focusing on turbo-modes and their effects on performance and compatibility.
- Toys
Fantasy tale about magical creatures battling human intrusion. Main character recruits allies for a quest to restore the land's former glory. Challenges include finding tools, overcoming obstacles, and reviving companions.
- Toys
Review of 'Carrier Command' game, focusing on its strategic and simulation aspects. Includes detailed gameplay mechanics, controls, and objectives. Highlights strategies for success and unique features like managing resources and autonomous systems.
- Interview
Interview with Sergey Zonov and Andrey Larchenko discussing their experience with microprocessors and ZX Spectrum development, including the creation of the Scorpion ZS 256 computer.
- Information
Contact information and staff list of ZX-Format No. 2 (1995) including editor, coders, and designers.
- Information
Editor's address to readers of ZX Format, discussing the positive feedback, past errors, and the quest for a cartoonist, with future plans for the magazine.
- Information
Discussion on the new interpretation of the 'PULLDOWN' window menu system for ZX Spectrum, focusing on interface updates and user interaction enhancements.
- Information
Discussion about companies illegally distributing ZX Format, emphasizing the benefits of purchasing official copies.
- Competition
The article discusses the lack of participation in ZX Format's competition, detailing the rules and prizes, and encourages readers to engage with new ideas.
- Let's Relax
A humorous account of a software vendor's challenges dealing with clueless customers, illustrating the nerve-wracking nature of his job.
- Mailbox
Overview of hardware components and prices for ZX Spectrum enthusiasts with ordering details.
- Mailbox
Reader letters section in ZX Format #02 discusses reader feedback, addresses issues with ZX Format features, and offers future improvements.
- Premiere
Guide to Digital Studio v1.12, a music editor for ZX Spectrum, including features, menu navigation, and the use of Digital Studio Compiler.
- For Programmers
Exploration of tools that extend the standard Basic 48, including Renumber for Basic 128, Trace & Speed, Blast Toolkit, and ZXeditor, highlighting their functionalities and utilities.
- Various
History of Amiga computer models and their evolution from A1000 to A4000/60T with specifications and unique features. Explanation of technical terms and differences between chip and fast memory. Mention of new developments like AGA chipset and models for different needs.
- Miscellaneous
The article presents upcoming ZX Spectrum software releases and reviews game innovations like 'Adventures of Winnie the Pooh' and 'UFO 2: Devils of the Abyss'. It highlights features, creators, and technical requirements. It also includes announcements from SOFTLAND and Cracked Masters Group.
- Systems
Discussion of creating music with Instrument 3.01, focusing on digitized sound. Analysis of program's capabilities and conversion from ASC Sound Master. Instructions for composition and conversion.
- What's New
Review of new ZX Spectrum games entering the St. Petersburg market in late 1995. Detailed game descriptions, memory requirements, controls, and music/graphics evaluations. Highlights include Night Hunter, Extreme, Grell & Falla, and more.