SuperBASIC for the TRS-80 Color Computer
- Latest superBASIC code. (Zip file, 18.9 KB)
- Latest superBASIC downloadable manual
- Latest superBASIC print manual•
There are a lot of things I’m nostalgic for about the early era of home computers. The cameraderie. The home-brew spirit. The assumption that we were going to control the computer rather than the computer control us—there were so many cartoons making fun of the Pavlovian response to computer notifications that seem sadly prophetic today. One thing I am not nostalgic for is programming in the BASIC of the era. I wrote a lot about that in Learning to program without BASIC. BASIC programs then were a sludgy melt of undifferentiated words and numbers.
But I have an old computer, and I want to program it. It is the Tandy Color Computer 2, and it is not an easy computer to write programs on. Even the TRS-80 Model 1 could show 1,024 characters at a time, 16 lines of 64 characters. The Color Computer had half that, at 16 lines of 32 characters each. There is no holding anything but the simplest subroutine onscreen intact.
That’s part of why I wrote basicize, to help me write programs for emulators using a modern text editor on a modern computer. Not having to deal with line numbers was also a major impetus, and labeling made it a lot easier to see where the code was going. But I mainly use basicize for modifying existing code. I’ll take the code, organize it into sections, and label them. This does not help structure the code, nor does it make the code self-commenting. The variables are still one to two characters and there are no loops other than FOR/NEXT and GOTO.
It occurred to me while writing a BASIC program to examine the video modes of the CoCo 21 that I should be able to easily convert long variables into short ones using Perl. It’s practically what Perl is designed for. And simple loops? It’s BASIC because it’s basic. That should be easy.
What I ended up with is a preprocessor that makes BASIC fun again. It will take something like this:
[toggle code]
-
loop
-
loop
- %key$=inkey$
- endloop unless (%key$="")
- print asc(%key$)
-
loop
- endloop
and generate something like this2:
- 10 KE$=INKEY$:IF KE$="" THEN 10
- 20 PRINT ASC(KE$)
- 30 GOTO 10
Here’s an example of what an actual program in superBASIC looks like. This code draws a simple clock on the screen, and then moves the three hands appropriately.
[toggle code]
- # display clock with minute, hour, and seconds hand
- # Jerry Stratton
- # hoboes.com/coco
- %xcenter% = 128
- %ycenter% = 96
- %second% = 0
- cls
- wrap-center \^LHigh resolution or \^Lcolors?
-
loop
- %mode$=inkey$
- endloop unless (%mode$ <> "H" and %mode$ <> "C")
- wrap-center Enter the hour and minute to start the clock at. Once the clock circle forms, press any key to start the clock.
-
loop
- input "Hour:minute"; %hour%, %minute%
- endloop unless (%hour% < 0 or %minute% < 0 or %hour% > 23 or %minute% > 59)
- if %hour% >= 12 then %hour% -= 12
- switch
-
case (%mode$ = "H")
- pmode 4,1
- color 2,1
- %delay% = 297
-
case (%mode$ = "C") #colors are orange(0), white(1), green(2), magenta(3)
- pmode 3,1
- color 3
- %delay% = 303
- endswitch
- #switch to graphics screen
- pcls
- screen 1,1
- circle(%xcenter%,%ycenter%),%ycenter%-1
- circle(%xcenter%,%ycenter%),%ycenter%-2
- circle(%xcenter%,%ycenter%),%ycenter%-3
- %firstTime% = 1
- color 2
- pause
-
loop
- #second hand
- line(%xcenter%,%ycenter%)-(%secondX%,%secondY%),preset
- %length% = 88
- %degrees% = %second%
- gosub getEndpoint
- %secondX% = x
- %secondY% = y
- line(%xcenter%,%ycenter%)-(%secondX%,%secondY%),pset
- switch
-
case (%second% = 0 or %second%-1 = %minute%) #minute hand
- line(%xcenter%,%ycenter%)-(%minuteX%,%minuteY%),preset
- %length% = 77
- %degrees% = %minute%
- gosub getEndpoint
- %minuteX% = x
- %minuteY% = y
- line(%xcenter%,%ycenter%)-(%minuteX%,%minuteY%),pset
-
case (%second% = 0 and %minute% = 0 or %second%-1 = %hour%*5 or %firstTime% = 1) #hour hand
- line(%xcenter%,%ycenter%)-(%hourX%, %hourY%),preset
- %length% = 55
- %degrees% = %hour%*5
- gosub getEndpoint
- %hourX% = x
- %hourY% = y
- line(%xcenter%,%ycenter%)-(%hourX%,%hourY%),pset
- endswitch
- circle(%xcenter%,%ycenter%),8
- for i = 1 to %delay%:next i
- %second%++
- switch
-
case (%second% = 60)
- %second%=0
- %minute%++
-
case (%minute% = 60)
- %minute%=0
- %hour%++
-
case (%hour% = 12)
- %hour%=0
- endswitch
- %firstTime% = 0
- endloop
- #endpoint using length and degrees
-
sub getEndpoint
- #adjust clock seconds to radians
- %degrees% *= 6
- %degrees% -= 90
- %radians% = %degrees%/57.29577951
- #calculate cartesian x and y from polar coordinates
- x = %length% * cos(%radians%) + %xcenter%
- y = %length% * sin(%radians%) + %ycenter%
- endsub
Turn this code into Extended Color BASIC for the CoCo by piping the output of superbasic to a file:
- superbasic clock.txt > CLOCK.BAS
Here’s the BASIC code it generates from that file:
[toggle code]
- 10 REM DISPLAY CLOCK WITH MINUTE,
- 11 REM HOUR, AND SECONDS HAND
- 20 REM JERRY STRATTON
- 30 REM HOBOES.COM/COCO
- 40 XC = 128
- 50 YC = 96
- 60 SE = 0
- 70 CLS
- 80 PRINT " hIGH RESOLUTION OR cOLORS?"
- 90 PRINT
- 100 MO$=INKEY$:IF MO$ <> "H" AND MO$ <> "C" THEN 100
- 110 PRINT " ENTER THE HOUR AND MINUTE TO"
- 111 PRINT " START THE CLOCK AT. ONCE THE"
- 112 PRINT " CLOCK CIRCLE FORMS, PRESS ANY"
- 113 PRINT " KEY TO START THE CLOCK."
- 120 PRINT
- 130 INPUT "HOUR:MINUTE"; HO, MI:IF HO < 0 OR MI < 0 OR HO > 23 OR MI > 59 THEN 130
- 140 IF HO >= 12 THEN HO=HO-12
- 150 IF MO$ = "H" THEN PMODE 4,1:COLOR 2,1:DE = 297
- 160 REM COLORS ARE ORANGE(0),
- 161 REM WHITE(1), GREEN(2),
- 162 REM MAGENTA(3)
- 170 IF MO$ = "C" THEN PMODE 3,1:COLOR 3:DE = 303
- 180 REM SWITCH TO GRAPHICS SCREEN
- 190 PCLS
- 200 SCREEN 1,1
- 210 CIRCLE(XC,YC),YC-1
- 220 CIRCLE(XC,YC),YC-2
- 230 CIRCLE(XC,YC),YC-3
- 240 FT = 1
- 250 COLOR 2
- 260 A$=INKEY$:IF A$ = "" THEN 260
- 270 REM SECOND HAND
- 280 LINE(XC,YC)-(SX,SY),PRESET
- 290 LE = 88
- 300 DG = SE
- 310 GOSUB 1000
- 320 SX = X
- 330 SY = Y
- 340 LINE(XC,YC)-(SX,SY),PSET
- 350 REM MINUTE HAND
- 360 IF SE = 0 OR SE-1 = MI THEN LINE(XC,YC)-(MX,MY),PRESET:LE = 77:DG = MI:GOSUB 1000:MX = X:MY = Y:LINE(XC,YC)-(MX,MY),PSET
- 370 REM HOUR HAND
- 380 IF SE = 0 AND MI = 0 OR SE-1 = HO*5 OR FT = 1 THEN LINE(XC,YC)-(HX, HY),PRESET:LE = 55:DG = HO*5:GOSUB 1000:HX = X:HY = Y:LINE(XC,YC)-(HX,HY),PSET
- 390 CIRCLE(XC,YC),8
- 400 FOR I = 1 TO DE:NEXT I
- 410 SE=SE+1
- 420 IF SE = 60 THEN SE=0:MI=MI+1
- 430 IF MI = 60 THEN MI=0:HO=HO+1
- 440 IF HO = 12 THEN HO=0
- 450 FT = 0
- 460 GOTO 270
- 470 END
- 1000 REM ENDPOINT USING LENGTH
- 1001 REM AND DEGREES
- 1010 REM ADJUST CLOCK SECONDS TO
- 1011 REM RADIANS
- 1020 DG=DG*6
- 1030 DG=DG-90
- 1040 RA = DG/57.29577951
- 1050 REM CALCULATE CARTESIAN X
- 1051 REM AND Y FROM POLAR
- 1052 REM COORDINATES
- 1060 X = LE * COS(RA) + XC
- 1070 Y = LE * SIN(RA) + YC
- 1080 RETURN
For a cheap clock, it’s fairly accurate. Since the Color Computer does not have a built-in real-time clock, this uses a FOR/NEXT loop to delay between each iteration of the second hand. This works because on these old computers the program you’re running is the only process on the computer. Which means that the code takes a predictable amount of time.
Because it takes longer to draw high-resolution clock hands than medium-resolution ones, the delay is shorter for the high-resolution clock.3
This code is a lot easier to read and follow than standard old-school BASIC. Variables have self-commenting names, subroutines are named, and loops, and their conditions, are clearly visible. SuperBASIC converts these subroutines, loops, and switch/case sections to standard BASIC. Unlike basicize
, superbasic
doesn’t support GOTO at all. I haven’t found any need for it yet. Of course, its loops and so on are handled under the hood by conditional GOTO statements.
Loops can be nested, as indefinitely as your memory allows.4 Switches cannot be nested. I don’t think it will be difficult, but I haven’t had a need for it yet. I don’t like to add complexity where it isn’t needed, and I also prefer to have a necessary example to code new features from instead of a made-up example. I also wanted to better understand how a multi-section block would work without the complications of multiple levels. I am not a language programmer, and am learning this as I go.
SuperBASIC will attempt to compress CASE blocks and LOOPS into one line if it can do so—basically, if there are no IF/THEN lines in that block of code.5 For short LOOP blocks, it will successfully create the standard 10 A$=INKEY$:IF A$="" THEN 10
type of loop.
If you look at the help text, you’ll see some features that aren’t used in either CLOCK.BAS or MODE.BAS, but I’m using them in other programs I’m writing, which I hope to post soon. SuperBASIC really has made writing BASIC fun again. For example, I don’t use it in the clock (it would make timing wonky) but I have two versions of Hunt the Wumpus: one for use on my Color Computer with a speech synthesizer, and one for use in XRoar, which does not have a speech synthesizer. When creating the Color Computer, with speech, code, I use:
- superbasic --switch speech cwumpus.txt > CWUMPUS.BAS
The option --switch speech turns on the speech synthesizer code.
The exception is LOOP WHILE. I thought I needed this, but every instance of it turned out to make more sense as ENDLOOP UNLESS, so I’m not currently using this in any code. I have a suspicion that LOOP WHILE will be most useful for iterative tasks such as reducing an existing variable to a standard range, such as:
[toggle code]
-
loop while (%degrees%>=90)
- %degrees%-=90
- endloop
Currently, one-line loops will turn this into:
- 100 IF DE>=90 THEN DE=DE-90:GOTO 100
Much in the same way that CASE statements are collapsed to a single line when possible. However, I don’t have any code that uses loops with opening conditionals, so don’t be surprised if I alter how conditions work at the start of a loop, or remove starting-loop conditions entirely, once I have real examples in hand.
SuperBASIC also supports a handful of directives that are replaced directly with BASIC code. PAUSE creates a FOR/NEXT loop that assumes $seconds
is the number of iterations needed for one second. I took this number directly from the Color Computer manual. WRAP takes the line of given text and prints it to the screen so that no word is chopped unless it’s longer than 32 characters. It can also WRAP-CENTER. DATA creates a series of DATA/ENDDATA lines that top out at 32-characters each for readability. You can see the latter in the included MODE.BAS code, which uses DATA statements to store the names of the screen colors.
- #border/foreground names
- DATA
- BLACK
- GREEN
- ORANGE
- ENDDATA
- #background names
- DATA
- GREEN
- ORANGE
- CYAN
- BROWN
- ENDDATA
This becomes:
- 3100 REM BORDER/FOREGROUND NAMES
- 3110 DATA BLACK,GREEN,ORANGE
- 3200 REM BACKGROUND NAMES
- 3210 DATA GREEN,ORANGE,CYAN
- 3220 DATA BROWN
Variable names begin with the percent symbol, and end with either the percent symbol (for numeric variables) or the dollar sign (for strings). Because single-letter variables are so ubiquitous in boilerplate code, SuperBASIC assumes that your programs will use single-letter variables. This means you can still write, for example, FOR I=1 TO 13:NEXT I
. When and if you use variables directly, always use single-character variables to avoid conflicting with an auto-generated variable. SuperBASIC creates only two-character variables, and in fact disallows a one-character variable name for its own use; %a$ not only isn’t a valid SuperBASIC variable, it won’t be detected as one. This isn’t necessary, I just find it completely unreadable.
If you want to see what variables SuperBASIC is creating, add --variables to the command line:
- superbasic clock.txt --variables
This lists the superBASIC variables in the clock program, along with their ECB variable names:
VARIABLES:
DE: | %delay% |
DG: | %degrees% |
FT: | %firstTime% |
HO: | %hour% |
HX: | %hourX% |
HY: | %hourY% |
LE: | %length% |
MI: | %minute% |
MO$: | %mode$ |
MX: | %minuteX% |
MY: | %minuteY% |
RA: | %radians% |
SE: | %second% |
SX: | %secondX% |
SY: | %secondY% |
XC: | %xcenter% |
YC: | %ycenter% |
It also lists the subroutines and the line number they ended up on. The clock only has one subroutine:
GETENDPOINT: | 1000 |
Here are the various things that superBASIC supports. You can see the same list by typing superbasic --help.6
SuperBASIC variables | |
---|---|
%ABC123_$: | string variable |
%ABC123_%: | numeric variable |
%ABC123_%++/--: | increment/decrement variable |
%ABC123_%+=/*=/-=//=: | add to, multiply by, subtract from, divide into variable |
SuperBASIC statements | |
---|---|
IF (condition) THEN: | start IF block |
ELSE: | inverse portion of IF block |
ENDIF: | end IF block |
LOOP: | start loop; also LOOP WHILE (condition) |
CONTINUE: | go to start of current loop |
ENDLOOP: | end loop; also ENDLOOP UNLESS (condition) |
SUB name: | start subroutine |
ENDSUB: | end SUB |
SWITCH: | start a series of CASEs |
CASE (condition): | a CASE inside of a SWITCH |
CASE (DEFAULT): | a CASE that applies to every case that reaches it |
BREAK: | go to end of SWITCH or LOOP; also BREAK IF (condition) |
ENDSWITCH: | end a series of CASEs |
DATA [maxlines ##]: | begin a series of DATA lines wrapped to 32 characters |
ENDDATA: | end a DATA series |
%DATASETS!: | the number of data/enddata sets in the program |
PAUSE[ seconds]: | pause for that many seconds or until key pressed |
WRAP <text>: | wrap text to PRINT statements of 32 characters; also WRAP-CENTER |
#: | REMARK line; # REMARKs can also be added to end of CASEs |
\^L: | force the next letter to be lower-case on the CoCo |
\^L…\^Q: | force the enclosed letters to be lower-case on the CoCo |
Preprocessor statements | |
---|---|
//: | comment lines not included in BASIC |
/* … */: | comment block not included in BASIC |
#IFDEF switch: | start block of code only for particular switch |
#ENDIFDEF: | end block of switch-only code |
I’m not trying to hide the underlying BASIC, just make it easier to create while making the code much more maintainable. That’s why the loops use ENDLOOP UNLESS instead of ENDLOOP IF. The latter would require reversing the logic of the underlying IF/THEN line. For example, ENDLOOP UNLESS (%mode$<>"H" AND %mode$<>"C")
produces the BASIC line IF MO<>"H" AND MO<>"C" THEN <start-of-loop>
; but ENDLOOP IF (%mode$ = "H" OR %mode$ = "C")
would require inverting the logic, to IF NOT(MO="H" OR MO="C") THEN <start-of-loop>
.
It’s not a huge deal, I’d just like to have what’s written be what’s used where possible. It makes it harder to see how the underlying BASIC code works if the underlying BASIC code is the inverse of the code that created it. I can easily see myself changing my mind. I can easily see preferring ENDLOOP IF, or, less easily, LOOP UNTIL.
When programming for the CoCo on my Macintosh, I find the XRoar emulator very useful for testing code as I write, and the CoCo SDC invaluable for transferring the resulting program to my Color Computer 2.
Unlike basicize, I wrote this specifically for the Color Computer. There’s nothing in it that couldn’t be easily modified for other BASICs, however. It does not enforce any particular kind of BASIC in the lines that are not SuperBASIC directives. The SuperBASIC directives themselves create relatively standard BASIC statements for the time, at least among the Microsoft variants. The only things that are CoCo-specific are the aforementioned $seconds for delay loops, and the screen width of 32 in $screenWidth. They should each be able to be changed simply by altering the value of the variable. The screen width is only used by SuperBASIC’s hash-to-REM, DATA, and WRAP directives, and the loops-per-second is only used by PAUSE.
I wrote SuperBASIC in Perl, and it should work on any computer that has Perl installed. The zip file includes SuperBASIC and three sample utilities: the clock program above, the program I first used SuperBASIC on, for flipping through the CoCo2’s video modes, and a program for displaying the ASCII value of keyboard keys and the joystick position and button status.
In response to TRS-80 Color Computer Programming Tools: The TRS-80 Color Computer was a fascinating implementation of the 6809 computer chip, and was, from the Color Computer 1 through 3, possibly the longest-running of the old-school personal computers.
The CoCo 2b was the last iteration of the CoCo 2 line, and it included a hidden option for lowercase characters.
↑It will also have an
↑END
statement at the very end.I’ve found that the xroar emulator is slightly off from the CoCo I’m using. It is slightly slower. When pausing between individual seconds in the clock, I pause for 303 iterations for the medium-resolution clock and 297 for the high-resolution clock. Xroar is more accurate at 302 and 295, respectively. That’s pretty close!
↑In these times of plenty, writing code for an early computer on a modern computer should mean that for all practical purposes loops can be nested infinitely without Perl crashing: it will fill up the RAM on a CoCo 2 before it causes any problem whatsoever in Perl on a modern computer.
↑Interestingly, having multiple statements per line appears to make the code run slower. I had to drop the per-second delay for the high-resolution clock from 298 to 296 after implementing one-line blocks for the CASE statement, and the medium-resolution clock from 304 to 303.
↑And in fact, I created this table by piping superbasic --help to makeHTMLTable from 42 Astounding Scripts.
↑
- SuperBASIC (Zip file, 18.9 KB)
- A preprocessor for writing BASIC code with loops, subroutines, and switch blocks. Mainly for the TRS-80 Color Computer.
- 42 Astoundingly Useful Scripts and Automations for the Macintosh
- MacOS uses Perl, Python, AppleScript, and Automator and you can write scripts in all of these. Build a talking alarm. Roll dice. Preflight your social media comments. Play music and create ASCII art. Get your retro on and bring your Macintosh into the world of tomorrow with 42 Astoundingly Useful Scripts and Automations for the Macintosh!
- BASIC auto-numbering and labels
- Write BASIC programs without line numbers, and add them later.
- CoCo SDC: Ed Snider at The Zippster Zone
- Ed Snider and Darren Atkinson’s SD card program pak for the Color Computer 1, 2, and 3 allows you to store all of your code on an SD card, emulating a disk drive so that the DSK files are compatible with any CoCo program that uses disk drives. It is phenomenal.
- Hunt the Wumpus: Conditional code and include files in SuperBASIC
- Hunt the Wumpus can talk to you if you have a speech synthesizer.
- Learning to program without BASIC
- If BASIC is dead, how can our children—or anyone else—learn to program? Today people interested in programming have far more options available to get started hacking their computers.
- SuperBASIC: The Manual: Jerry Stratton at Smashwords (ebook)
- “Do you want to write BASIC programs for your Color Computer, but don’t want to deal with two-character variables and invisible (or non-existent) structure? Consider superBASIC. Use loops, multi-line if/else/endifs, include files, and more. You can even use command-line switches to target the same BASIC program for computers with different hardware.”
- SuperBASIC: The Manual•: Jerry Stratton at Amazon.com (paperback)
- “Do you want to write BASIC programs for your Color Computer, but don’t want to deal with two-character variables and the complete lack of structure in old-school BASIC? Consider superBASIC. Use loops, multi-line if/else/endifs, include files, and more. You can even use the same code base to target computers with different hardware.”
- XRoar—Dragon & CoCo emulator
- “XRoar is a Dragon emulator for Linux, Unix, Mac OS X and Windows. Due to hardware similarities, XRoar also emulates the Tandy Colour Computer (CoCo) models 1 & 2. More features.”
More BASIC
- Simple game menu for the Color Computer 2 with CoCoSDC
- This simple menu provides one screen for cartridges saved in the CoCoSDC’s flash ROM, and any number of screens for your favorite games for your friends to play.
- BASIC tokenization examined
- Why do old BASIC programs have strange characters in their .BAS files? Why do they look like they’re compiled code?
- Read BASIC out loud
- Reading BASIC out loud is a great tool for verifying that what you’ve typed in from an old-school magazine or book is correct.
- Convert PCBASIC code to TRS-80 Extended Color BASIC
- If you have a book of code written in PCBASIC, it usually isn’t hard to convert it to other Microsoft BASICs, such as on the TRS-80 Color Computers.
- Rainbow Magazine BASIC program preflight tool
- This script takes 32-character lines typed in from Rainbow Magazine BASIC listings and assembles them together into full BASIC lines, doing some rudimentary error-checking along the way.
- Six more pages with the topic BASIC, and other related pages
More Color Computer
- Simple game menu for the Color Computer 2 with CoCoSDC
- This simple menu provides one screen for cartridges saved in the CoCoSDC’s flash ROM, and any number of screens for your favorite games for your friends to play.
- Rainbow Magazine preflight tool enhanced
- I’ve added several features to the Rainbow Magazine preflight tool, including a check for references to line numbers that don’t exist.
- CoCoFest! 2021
- Forty years later, I finally make it to CoCoFest!
- BASIC tokenization examined
- Why do old BASIC programs have strange characters in their .BAS files? Why do they look like they’re compiled code?
- What are the 8 bits in 8-bit computing?
- Retro computing is often called 8-bit computing. This is because the bytes that these computers use are composed of eight bits, and much of what the computer does is operating on these individual bits, not on the byte as a whole.
- 19 more pages with the topic Color Computer, and other related pages
More superBASIC
- Simple game menu for the Color Computer 2 with CoCoSDC
- This simple menu provides one screen for cartridges saved in the CoCoSDC’s flash ROM, and any number of screens for your favorite games for your friends to play.
- Hunt the Wumpus: Conditional code and include files in SuperBASIC
- Hunt the Wumpus can talk to you if you have a speech synthesizer.
- Reversi in SuperBASIC on the Color Computer
- One of the ubiquitous games of the early computer era was reversi. Very simple rules, very simple board, very complex play. It’s easy to see why it was so popular.
- A manual for superBASIC
- I’ve improved superBASIC and also made a short manual available on Amazon and most e-bookstores.
This is like peanut-butter hits chocolate sauce levels of cool!
Must investigate deeper this weekend...
R. Allen in Texas at 2:48 p.m. March 18th, 2020
moLXk
Thanks for linking to my site! Ron D. found a link to a book about this. When did that happen?
Allen Huffman in Des Moines, IA USA at 3:29 p.m. May 15th, 2020
bfmFA
I’m about to announce the book. At this point, it should be available on all of the ebook storefronts. I will also have a print version available on Amazon, though that won’t be free, obviously.
I’ve also done a rewrite of how the script parses loops and other blocks, which means that (a) SWITCH/CASE statements can now contain other blocks, such as loops, and (b) it will be easier to add new features, such as ELSEIF or a special form of SWITCH that translates into an ON GOTO.
Jerry Stratton in Texas at 5:27 p.m. May 15th, 2020
piIHT
I just mentioned this pre-processor on the maltedmedia listserv, in response to another poster's question.
Reading thru this page again, though...is this pre-processor CoCo 2 only? That is, does it handle/recognize SECB (and for that matter, DECB) keywords?
Anyhow, just something that popped into my head...
AndrewA in Arizona at 3:36 p.m. February 1st, 2023
+2QC/
The only sense in which it’s specialized for any specific computer at all is in the macros such as “wrap”, “pause”, and “data”. The preprocessor itself doesn’t care about the underlying language, as long as it doesn’t conflict with the preprocessor’s blocks (IF/THEN/ELSE; LOOP/ENDLOOP; SUB/ENDSUB; and SWITCH/CASE/ENDSWITCH.
So, while it doesn’t specifically support SECB, that’s not a problem. It doesn’t specifically support ECB either. If there are a different number of FOR loops per second on the CoCo 3 than on the 1 and 2 (460 loops), you’d want to change that line in the code; and if you use a different screen width than 32, you’d want to either change that line in the code, or make it a command line switch.
It does attempt to avoid reserved words when creating two-letter variables. So if there are more reserved words than AS, FN, GO, IF, ON, OR, or TO, let me know and I can add them to the list of $reservedWords.
Jerry Stratton in Texas at 4:18 p.m. February 1st, 2023
yFmrE
I am now at a point I want to start playing with some of these pre processors. Is this the current information on it, or do I need to be looking for follow up posts?
Allen Huffman in Des Moines, IA USA at 4:22 p.m. February 1st, 2023
SlFC2
The code and manual linked are the up-to-date code and manual. I’ve added those links to the top of the page so that you don’t have to go searching for them in the text of the post.
The examples in this post should still work, but is more limited than the current version. For example, SWITCH/CASE/ENDSWITCH is now a standard block and is nestable.
Jerry Stratton in Texas at 4:44 p.m. February 1st, 2023
yFmrE