AN ALTERNATIVE TO NMI BUTTON PLUS THE F KEY
Here is an example of how to use a rather obscure LKDOS Extended BASIC Command. It concerns that pesky line of dots that appear at bottom of the screen whenever the NMI push button is pressed. Those dots, which actually represent the registers and stack pointers involved, clutter any graphics copies which print the bottom two lines. However, close reading of the LKDOS Operating Manual turns up an interesting item: Advanced machine code programmers can add an extra command to LKDOS by using the PRINT #4: DATA a,b,c…command. Moreover, more reading reveals another clue from the manual: LKDOS address 8214 “Userad” holds the address of the user NMI function OR the address of the User command (DATA).
If this could be used to trigger a graphics-copy machine-code routine without pressing the NMI button and the F key, then it should be possible to make an uncluttered copy on a wide printer, that is, without those dots. Graphics 24 is one such routine which copies all 24 lines of a SCREEN$ and is found in the Omnibus Collection where it loads into the LKDOS at address 16100. Thus, it ought to be possible to substitute the LKDOS DATA command for the NMI button. On investigation, this turned out to be the case. The following lines, which appear in the Omnibus program, were involved in making the DATA command work:
1020 INPUT AT oo,oo;(u$'"drive? (0-4) ");drv: PRINT #od: GO TO drv: RETURN
1050 PRINT #od: POKE oz,16100: LET b=USR oy: RETURN
2570 PRINT AT oo,oo;"Standby...": GO SUB 1050: IF b<>205 THEN FOR i=24605 TO 24788: PRINT #od: POKE i-8505,PEEK i: NEXT i
2580 PRINT #od: POKE 8214,16100
2590 CLS: PRINT AT oo,oo;"CHECK Printhead at left each time.": PAUSE 100:RETURN
5380 GO SUB 5410: ON ERR GO TO 5390: INPUT AT oo,oo;" COPY SCREEN$ "'" name? (<=9) "' LINE s$: GO SUB 1020: GO SUB 5500: PRINT #od: LOAD s$SCREEN$: PRINT #od: DATA 0
5390 ON ERR RESET: GO TO m3
5410 CLS: GO SUB 1050: IF b<>205 THEN GO SUB 2570: RETURN
5420 RETURN
Explanations:
Line 1020 is a sub routine to choose the drive. (u$ is used throughout the program to hold the name of a chosen option).
Line 1050 does a double poke into LKDOS RAM 8200 (variable oz) to get the value in LKDOS address 16100.
Lines 2570 to 2590 check that value and if it is not 205 then it reloads the contents of system variables free space 24605 to 24788 into the LKDOS RAM at address 16100 (24605 minus 8505); 2580 puts the value 16100 into LKDOS address 16100 and finally 2590 puts a reminder on-screen before returning.
Line 5380 checks that all is ready via 5410; if there is an ERR message (see below), the action jumps to line 5390 and thence back to the menu.
Don’t leave out 5420.
The crux of all this is the part at the end of line 5380: PRINT #od: DATA 0. Not knowing what to add after the DATA token, I stuck in the zero. However, no matter what was put in there, an error message resulted each time so ON ERR commands were added to overcome the error. Result: the routine worked and the line of dots was history. By the way, the NMI button + F still does its job when these changes are made, so it’s always there as an alternative.
One postscript to this story: I later had a go at making the autoboot code, stored at 16300, work in a similar fashion. During a lot of experimenting a funny thing came to light: the command line had to be <PRINT #4: DATA 0>; the computer crashed (locked up) if <RANDOMIZE USR 100: DATA 0> was used. (I haven’t the foggiest notion why. Can anyone help explain this?) So this means that to quit any program and get back to Omnibus, the PRINT #4 switch has to be operative in that program.
SOME MORE PROGRAMMING TIPS
PROFILE: When altering the BASIC program, be careful not to declare any variable ahead of d$. This string must be the first variable in the VARS area or the program simply will not work.
PRINTER CONTROL CODES: There are two distinct methods of sending these to your printer. The FIRST one often used in programming, uses OUT commands to do the job. For example, to switch to ELITE typeface requires OUT 127,27: OUT 127,77. BUT, there must be a check on printer readiness before the commands and this can vary from printer to printer and even from one TS2068 to another. Thus it is necessary to make the following:<GO SUB line#> prior to each OUT command. The “line#” is the line containing a routine such as <IF IN 127<>237 THEN GO TO line#>; line# +1 must be <RETURN>.
The SECOND one, perhaps not much used, is really more straight forward: This assumes you are using the LKDOS printer driver and depends on first switching off the detokenizing and filtering (by POKING PPAS at LKDOS RAM address 16093 to 32) which then causes all subsequent characters to be sent directly to the printer. PPAS is POKEd with a zero at the close of sending these printer commands to return to detokenizing and filtering. Thus the subroutine to turn on ELITE typeface becomes:
RANDOMIZE USR 100: POKE 16093,32
LPRINT CHRS 27; CHRS 77
RANDOMIZE USR 100: POKE 16093,0
RANDOMIZE USR 100: POKE 16094,marg: LPRINT: RETURN
No printer ready check is needed but note that the margin setting must be repoked since the double poke to 16093 upsets it. So if you find some of the first style printer commands cause you problems with your printer and/or TS2068, switch to the second kind.
MORE ON PRINTER CONTROL CODES
I’ve recently added the following to both my Tasword and Mscript lists.
First TASWORD: This assumes you have Graphics editing capabilities in your copy of Tasword. British Font ON (27 82 2) OFF (27 82 0); these could be different for your printer; check your manual. I put these on key 6 (137 and 134 respectively). The main use for this font is to get the pound sign to print instead of a # sign. But the application has other possibilities: If you write in French or Spanish and these fonts are included in your printer’s memory, substitute them to get the necessary accented letters.
Another addition (this time on the 5 key — 138 and 133)) was a quick switch from standard line spacing to narrow line spacing and vice versa. The commands will vary from printer to printer but for the Fastext 80 they were Narrow ON (27 65 8) OFF (27 50 ). This allows for packing more text into a page or part of a page.
Now MSCRIPT: You will need instructions for LCODES provided with Mscript version 5.5 to do this. The codes above or your equivalents will be added to the LCODE text. I put the line spacing against capital A for ON and small a for OFF. British font ON against capital B and OFF against small b. I see that the French font could go into capital F and small f. Mscript has lots of spare letters available for additional commands whereas Tasword is quite limited.
KEYBOARD IDIOSYNCRASIES
Using INKEY$ for keyboard input to any program invites some troubles since the ROM Debounce and Error Detection routines are not used. Debouncing is the conversion of mechanical contact bounce into a clean transition between two logic states. It involves the disabling of the software’s ability to accept a character for a few milliseconds after receiving one. This prevents false input or extra signals from a keyboard due the bouncing of the keys. Keys sometimes tend to bounce due to inherent design or the keyboard being old or heavily used.
If you have trouble with INKEY$, it may be wise to substitute some BASIC lines that call on the ROM LAST K routine which does use the ROM debounce and error detection routines. These will involve PEEKing system variable 23560 (LAST K) and will require some lines like the following (found in OMNIBUS):
3140 PAUSE oo: LET lk=PEEK 23560
3150 IF lk=13 THEN GO TO 3120
3160 IF lk>=48 AND lk<=52 THEN LET drv=lk-48: PRINT #4: GO TO drv: PRINT AT 18,29: FLASH 1;drv: GO SUB bp
3170 IF lk<97 OR lk>122 THEN GO TO 3140
3180 GO TO 3180+(lk-96)*10
To explain:
3140 assigns the value in address 23560 to variable lk.
3150 to 3170 put some conditions on lk: if it is 13 (ENTER), then go back to start of the input routine; if it is between 48 and 52 (keys 0-4) then select drive and show this number on-screen (bp is the variable in Omnibus for the BEEP subroutine; if lk is outside the values for keys a to z, then try again.
3180 if the input survives all these conditions, then go to the line number indicated by the formula.
There’s more to be read about this subject in Update Apr 89 p.12 and Apr 88 page 20.
Bob Mitchell Willowdale Ont
Dated: 910223
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.