If you use a disk drive with your TS2068, you will probably already use disk menus to facilitate accessing the files on your disks. However, there is often a need or an opportunity to add a “Status Report” to such menus to display current disk or program information.
In this article, I shall describe some ways of gathering and displaying such data for programs in general and for the Larken Disk Drive system in particular.
These will include the following:
1) Printer Status On/Off Wide/2040 2) Printer Driver On/Off 3) Printer Driver Settings: Margin, Width, Line Feed 4) Drive Selected 5) File Now Loaded 6) Byte Length & Tracks Used 7) Disk/Tape Mode
PRINTERS, PRINTER DRIVER AND SETTINGS AND SELECTED DRIVE
Consider the following extract from a Disk Menu. This will serve to illustrate the first four of the above categories.
TS2040 ON Wide Printer ON PD OFFLL=64LM=0LF ON DRV=2
Here are the program lines that produced this data display:
15 PRINT PAPER 1; INK 9; AT 17,2;"TS2040 ";("ON" AND IN 251<126)+("OFF" AND IN 251>=126);" Wide Printer ";("ON" AND IN 127=237)+("OFF" AND IN 127<>237);TAB30
16 PRINT AT 18,2; PAPER 6;"PD ";("ON " AND lpd)+("OFF" AND NOT lpd;
17 PRINT #4: POKE 8200,16090: LET b=USR 110
18 PRINT "LL=";b+1;
19 PRINT #4: POKE 8200,16094: LET b=USR 110
20 PRINT PAPER 6;"LM=";b;
21 PRINT #4: POKE 8200,16092: LET b=USR 110
22 PRINT "LF ";("ON" AND b)+("OFF" AND NOT b)
23 PRINT #4: POKE 8200,8195: LET b=USR 110
24 LET b=(4 AND b=128)+(INT (SQR (b-2) AND b<128); PRINT AT 18,25; INVERSE 1;"DRV=";b
And here’s the explanation:
15 Print on blue PAPER with contrasting INK at line 17 col 2 <TS2040> followed by <ON> if IN 251 gives a value less than 126 or <OFF> if it gives a value greater than or equal to 126; then <Wide Printer> followed by <ON> if IN 127 equals 237 or <OFF> if it does not give 237; TAB over to col 30 to complete the colour arrangement. One caveat here: I am told that all TS2068s do not give the same values for these IN commands so try yours out and if necessary substitute the values you find to be correct. Here’s how: turn off your TS2040 and TYPE <FOR i=1 TO 100: PRINT IN 251: NEXT i>; run this and note the results; do this again with the 2040 turned on. Repeat the process for your wide printer changing 251 to 127 in the FOR….NEXT loop. My 2068 gave the following values:
ON OFF 2040 58 or 59 126 wide 237 233
16 Print at line 18, col 2 on Yellow PAPER <PD> for Printer Driver; followed by <ON> if lpd is 1 (or higher) or <OFF> if lpd is equal to zero. The variable <lpd> for Larken Printer Driver is changed elsewhere in the program to the value 1 if it is turned ON and to 0 if it is turned off. I have shown the routine for controlling the Printer Driver at the end of this section.
17-22 These lines do the following: Using a Larken extended BASIC command, an address in the LKDOS cartridge is poked into LKDOS address 8200 and a Larken routine returns the value in that address as the variable <b>. The first case gives the line length (ie, width) currently set either on power up default or as changed elsewhere in the program. The second case does the same for Left Margin setting and finally the status of Line Feed is PEEKED and presented; (in the last one, if the variable <b> is zero then the Line Feed is OFF, else it is ON).
23-24 This routine is similar to the previous three and using the same Larken command gets the value of variable <b> and changes it to <4> if b=128, to the integer of the square root of b-2 if b is less than 128. This calculation is required to decode the number of the drive currently selected from the value stored in LKDOS address 8195 (ie, drive 0=2; drive 1=4; drive 2=8; drive 3=16 and drive 4 (ramdisk)=128).
The arrangement of colours in screen line 18 is necessary to allow all the data to be presented on the one line and still be readable.
The Larken Printer Driver can be turned on and off and its settings altered using the following program lines.
240 IMPUT "1=ON 0=OFF ";lpd: IF NOT lpd THEN PRINT #4: CLOSE #3: GO TO 40
241 PRINT #4: OPEN #3, "lp"
242 OUT 127,18: INPUT "line length? ";a: PRINT #4: POKE 16090:a-1: INPUT "linefeed (0=no: 10=yes) ";a: PRINT #4: POKE 16092,a: INPUT "left margin? ";a: PRINT #4: POKE 16094,a
243 IF a+1>79 THEN OUT 127,15
244 LPRINT: GO TO 40
Explanation:
240 You are prompted to turn the printer driver ON or OFF. By the way, this is very useful if the printer driver is ON and you wish to print to the TS2040; you simply enter <0> and Larken channel 3 is closed. Then the 2040 will function. GO TO 40 is just my way of going back to the disk menu. In all these examples you will put in your own line numbers to suit.
241 So if lpd is not zero then the Larken Channel 3 is opened to the large printer, ie, <lp>.
242 OUT 127,18 resets the Centronics dot matrix printer I use to normal PICA size printing. This may not suit your printer but it should work with most. Then there is a series of prompts to tailor the printer driver settings. Remember to make the line length exactly what you want. The routine will poke in a value one less than that, which is the way the Larken command works. Line feed is straight forward; 0 for no line feed and 10 for one line feed. It is usual to use 10. Laft Margin is also straight forward; but remember to make the sum of the left margin setting and the line length a value not greater than the printer maximum width (for the print size selected).
243 However, with a dot matrix printer you can usually go to condensed print allowing a line length in excess of 120 characters. If your lone length is greater than 80 then this line switches over to condensed print.
244 This line does an LPRINT to clear the printer buffer and then returns action to the menu.
FILE LOADED, BYTE LENGTH AND TRACKS USED AND DISK/TAPE MODE
I have added some information to the Tasword menu which gives the name of the currently loaded file and its byte length and tracks used. Here are the lines to add or change to do this:
28 PRINT '"save text"; TAB t;"[";a;" bytes]";TAB th;"s"
29 PRINT TAB t;"["; INT (a/5090)+1;" tracks]"
30 DIM n$(6): FOR i=1 TO 6: LET n$(i)=CHR$ PEEK (i+33279): NEXT i
32 PRINT "load text now=>"; INVERSE 1;n$; INVERSE 0;TAB th;"l"
Explanations:
28 The variable <a> is already used by Tasword and is updated constantly as the text length is altered.
29 The variable <a> is divided by 5090 (the length of a Larken track); <1> is added to the integer of the result.
30 An array n$(6) is created and is filled with the contents of the first six bytes of the Tasword text area. This means that you should enter the file name as the first line of [illegible] text of each file and it can be anything up to six characters in length. In this example, I have entered the file name <name>.
32 The current file name is printed in INVERSE characters.
The affected menu lines should look something like this:
save text [7744 bytes] s
[2 tracks]
load text now=>name l
My disk index program has a menu with some status reports:
The loader (for the TIMACHINE compiled version) indicates whether it is in the DISK or TAPE mode for loading and saving. This choice was added when I decided to make tape back-ups; if you do that sort of thing, show the current status on your menus. In the case of index, it was done this way:
Index called for pressing <6> to toggle between DISK and TAPE mode. The variable <s> was initialized as <4> early in the loader and pressing <6> activated the following line: <IF d$=”6″ THEN LET s= ABS (s-6)>.
So, if s=4, then it becomes 2 and vice versa. The ABS cancels out the resulting negative sign in each case. Then variable <s> is used with the SAVE and LOAD commands to direct action either the ROM or LKDOS SAVE or LOAD routines, eg; <PRINT #s: SAVE n$CODE 29000,28066>.
If s=2, then the line does a TAPE SAVE because PRINT #2 is the same as it not being there and the normal TS2068 ROM routine is called.
If s=4, then the command is preceded by PRINT #4 and this activates the LARKEN DOS and does a DISK SAVE. This technique can be used in many other programs, of course, and really speeds up the switching back and forth between the two modes. Your program must have activated channel 4 for the Larken command PRINT #4 to work, ie, <RANDOMIZE USR 100: OPEN #4,”dd”>.
The way ABS is used in this example can be adapted to other uses, too. For example, if you want to toggle between a black and a white PAPER screen, <LET s=7> and use <IF d$=”A” THEN LET s= ABS (s-7): PRINT PAPER s; AT etc…. You can see that if s=7 (which will print on white PAPER), it changes to 0 which will make the PAPER black. Of course, make INK 9 for contrast.
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.