Before I write a quick and dirty PERL program, is there a CL utility that will take a text listing of a ZX81 program (aka the outout from zxtool) and:
1. Remove all unused line numbers and auto intent the code (say 4 spaces)
2. Replace used line numbers with labels in the style of zxtext2p (ie @label)
Bill H
Also if anyone wants to use ConTEXT http://www.contexteditor.org/ to develop basic code I am attaching a highlighter I wrote for it.
Program Cleaner
Program Cleaner
- Attachments
-
- ZX81basic.txt
- ConTEXT ZX81 Highlighter
- (5.81 KiB) Downloaded 308 times
Re: Program Cleaner
Here is a quick and dirty Program cleaner. What it does it remove any unused line numbers and line numbers that are needed are converted to labels for use with zxtext2p
usage: zxclean source_file destination_file [indent value]
The source file is a text listing of a .P file (aka one created with zxtool), destination file is the finished file after cleaning. Indent value is the optional size of the left indent, if omited it will be set to 10 (if less than 10 it will be 10 also).
Any line numbers that are referenced in GOTO or GOSUB are changed to @L### where ### is the line number. It will not change any computed line numbers inside of a GOTO or GOSUB but you have to add a label to where the computed line was and also edit the computation to use a label.
Here is an example code snippet of before and after zxclean:
usage: zxclean source_file destination_file [indent value]
The source file is a text listing of a .P file (aka one created with zxtool), destination file is the finished file after cleaning. Indent value is the optional size of the left indent, if omited it will be set to 10 (if less than 10 it will be 10 also).
Any line numbers that are referenced in GOTO or GOSUB are changed to @L### where ### is the line number. It will not change any computed line numbers inside of a GOTO or GOSUB but you have to add a label to where the computed line was and also edit the computation to use a label.
Here is an example code snippet of before and after zxclean:
Code: Select all
10 RAND
20 GOSUB 5000
100 REM MAIN LOOP
110 LET P=INT (RND*M)+1
120 GOSUB 6000
130 GOSUB 6300
140 LET Q$="PRESS (S) TO SPIN"
150 LET R=14
160 LET Q=1
170 GOSUB 800
180 GOSUB 700
190 GOTO 7000
Code: Select all
RAND
GOSUB @L5000
REM MAIN LOOP
LET P=INT (RND*M)
GOSUB @L6000
GOSUB @L6300
@L140:
LET Q$="PRESS (S) TO SPIN"
LET R=14
LET Q=1
GOSUB @L800
GOSUB @L700
GOTO @L7000
@L200:
- Attachments
-
- zxclean.zip
- ZX81 Basic Program Cleaner
- (831.11 KiB) Downloaded 1130 times
Re: Program Cleaner
This is just an exe-file for Windows or MSDOS. Could you publish the source? since I use Linux on Raspberry Pi.Bill H wrote:Here is a quick and dirty Program cleaner. What it does it remove any unused line numbers and line numbers that are needed are converted to labels for use with zxtext2p
usage: zxclean source_file destination_file [indent value]
Started w/ BASIC on ABC80 & ZX81 then Forth, Z80… http://scratch.mit.edu/users/mobluse/ https://www.youtube.com/user/MOBiL4u/ https://twitter.com/mobluse/