Years ago I was involved with the defunct Hampton Roads TSUG, and I compiled a list of commands that were barely or not at all mentioned in the 2068 manual. To liven up things, I’ll present them here.
1. PRINT #n [n = 0, 1, 2, 3, . . .]
PRINT #0 and PRINT #1 use the bottom portion of the screen where the error messages appear. Up to 22 lines are possible using AT x,y. Attributes such as BRIGHT, OVER, and INK are not available.
PRINT #2 is the same as PRINT, using the top portion of the display. All attributes are available.
PRINT #3 is the same as LPRINT and sends output to the T/S 2040 printer.
PRINT #4 and up return an error message O (invalid stream). These were probably meant for use with future peripherals.
2. INPUT #, INPUT AT, INPUT LINE b$
INPUT #0 inputs at the bottom portion of the screen at line 22.
INPUT #1 inputs at line 23 and is the same as normal INPUT.
INPUT #2 and INPUT #3 give error report J (invalid input/output device). INPUT #4 and up give error report 0 (invalid stream). These were probably meant for future peripherals.
INPUT AT x,y behaves like “PRINT #1; AT x, y” except for inputting instead of printing. To input on the “top” (note quotes) part of the screen requires a statement such as “INPUT AT 22,0;AT x,y; . . .” This involves moving the bottom portion of the screen to the top. Line 0 remains at the top.
INPUT LINE b$ deletes the quotation marks that usually automatically appear when inputting a string variable, so that only the L cursor appears, not “L”. You can then use quotation marks within a string without having to double them—that is, keying “” to get “. But the keyword STOP is read as a string in this mode, whereas in normal input mode you could delete the surrounding quotation marks and key the keyword STOP to stop the program.
Strings can generally be printed with the normal INPUT statement and these commands. Example: INPUT “How much money do you wish to bet?”; m
Quick note: to clarify a comment made in part 1, in PRINT # (and INPUT #) statements, attributes such as BRIGHT are available WITHIN the PRINT statement, but not as separate statements such as BRIGHT 1: PRINT # . . .
2. CLS #
This command works on Spectrum ROMs with the microdrive in use. Keying this on normal T/S 2068s gives the ? cursor before the #.
Usually the 2068 BASIC is portrayed as a superset of the ZX Spectrum BASIC. This is generally true, but here is one exception—an example of a Spectrum statement that cannot be used on the conventional 2068. Are there others?
3. OPEN #n,x$ CLOSE #n n = 0-15; x$ = “k”, “p”, “s”
These commands are related to the INPUT # and PRINT # commands. OPEN # opens a data stream for your use as follows:
x$ = “k” (keyboard): data prints on the bottom portion of the screen
x$ = “p” (printer): data prints on the printer
x$ = “s” (screen): data prints on the top portion of the screen, lines 0-21
For n = 0 or 1, the normal printing position is as for “k”. INPUT normally uses these streams. For n = 2, the normal printing position is as for “s”; LIST and PRINT use this stream. For n = 3, the normal printing position is as for “p”. LLIST and LPRINT use this stream. COPY will not be affected if you redefine this stream. For n = 4 through 15, these were meant for future peripherals and may be redefined for your own use.
CLOSE #n returns a channel to its normal value. What’s the point? Let’s say you want to conserve printer paper. Keying OPEN #3, “s” will have all printer output go to the screen instead. CLOSE #3 reverses this. Also, you may remember that INPUT #2 and up and PRINT #4 and up are invalid commands. OPEN can change this.
4. IN #n [n = 0-65535]
IN scans an input device and returns a value based on the output. OUT is related but is covered in the manual. n takes the form 256 (BIN bbbbbbbb) + y, where b is a binary number from 00000000 to 11111111 (0-255). y is the port number of the device being read; for the keyboard y = 254.
The keyboard is scanned by half-rows. Each half-row has 5 keys. The base value for each scan when reading the keyboard is 31, but some Spectrum ROMs use 255 instead. The keys in each half-row have the values 1, 2, 4, 8, and 16 as you move from the outside toward the center. Each key pressed in a row subtracts its value from this base value of 31. If all five keys in a half-row are pressed, the value returned is 0: 31 – 16 – 8 – 4 – 2 – 1. This chart sums it up:
BIN # Value Keys of values Half-for n of n 11111110 65278 cs: Z: X: C: V 1 11111101 65022 A: S: D: F: G 2 11111011 64510 Q: W: E: R: T 3 11110111 63486 1: 2: 3: 4: 5 4 11101111 61438 0: 9: 8: 7: 6 5 11011111 57342 P: O: I: U: Y 6 10111111 49150 en: L: K: J: H 7 01111111 32766 br: ss: M: N: B 8
cs = caps shift; en = enter; br = break; ss = symbol shift Both cs keys are considered to be in the same half-row. Here is an example of use:
FOR g=1 TO 100:PRINT IN 65022;" ";:PAUSE 20: NEXT g
Press various keys in half-row 2, ASDFG, as this runs. None pressed will give 31 every third of a second (note PAUSE line). Pressing A gives 30, etc.; pressing all five keys gives 0.
IN must be used within a statement and cannot stand alone. IN n by itself gives the ? cursor.
5. CHR$ n [n < 32]
This is more of a programming trick, but you may not have realized that using these values is possible. Characters < 32 control various attribute and editing functions. For example, CHR$ 8 is “cursor left” and is a handy backspace. Try this to create the Greek letter theta:
5 PRINT OVER 1;"O";CHR$ 8;"-"
Try this same statement with CHR$ 6, 9, and 13.
However, color attributes, CHR$ 16-20, can be accessed directly from the keyboard without using this statement. This is useful when printing to the screen so that you need not use separate INK and PAPER commands.
To change INK color: with E cursor, hold down caps shift and press the appropriate color key. This inserts CHR$ 16 plus the color code.
To change PAPER color: with E cursor, simply press the appropriate color key. This inserts CHR$ 17 plus the color code.
FLASH on: with E cursor, hold down caps shift and press 9 key. FLASH off: same but 8 key instead. These insert CHR$ 18 plus 1 for on or 0 for off.
BRIGHT on: with E cursor, simply press 9 key. BRIGHT off: same but with 8 key: These insert CHR$ 19 plus 1 for on or 0 for off.
INVERSE and TRUE are directly labeled on the keyboard. These insert CHR$ 20 plus 1 or 0.
When editing a programmed statement, extra clicks when moving the cursor within the line will tell you where such attributes have been inserted. Though you can’t directly see them, you may delete them with the DELETE key.
6. ‘ in PRINT, INPUT, LPRINT statements
This trick is barely touched on in the Timex manual. Using the apostrophe within a PRINT (etc.) statement moves the print position to the beginning of the next line. No semicolons are necessary around it. This saves using a TAB or PRINT AT x, 0 or separate PRINT statement, and it potentially could save a lot of memory in a long program with a lot of output. Here’s an example:
5 PRINT "Line 1"'"Line 2"
“Line 1” will print at 0,0; “Line 2” will print at 1,0. Unlike TAB the apostrophe does not print over anything else that may already have been on line 0 in this example.
7. BEEP abilities and limitations
Contrary to the manual, BEEP t, f (t = time from 0-10 in seconds), f– the number of semitones above/below middle C–is not limited to 69 as the maximum value. To the limit of the computer’s precision, the limit is actually 69.84586091. Minimum value is actually -60 as the book states. The full 10-second range is not available for higher f values. The T/S 2068 Technical Manual touches on this a little. Here are some relevant charts that I compiled:
f Max. t, sec t, sec highest f 69.8458 4.437 5.000 67.777 69 4.654 6.000 64.614 68 4.931 7.000 61.961 67 5.224 8.000 59.634 66 5.535 9.000 57.594 65 5.864 10.000 55.777 64 6.213 63 6.582 62 6.973 61 7.388 60 7.827 59 8.293 58 8.786 57 9.309 56 9.862 54-60 10.499
Note that 10.499 seconds is the absolute maximum time.
All right, gang, I’d be interested in any additions or comments. Thanks for your indulgence, and maybe this will spur some discussion.
Edwin Krampitz, Jr.
[e-mail address omitted]
Hi,
Why do you think that those are obscure commands? They are all (almost) reported in my TC2048 and TC2068 manual less this one about beep (the limit being 69.84586091), but what does this matters?
Beep 1,69 is almost un-earable… You can find some real obscure commands in my website:
www.timex.pt.vu
Johnny Red
[e-mail address omitted]