Here is yet another header reader. But this one has some interesting features about it that will interest you. Even if you have a header reader which satisfies you this program has a number of programming techniques which are worth more than a passing glance.
The program POKEs code into a part of the memory which we seldom use, namely just below the system variable area. This was selected purposely. If you have a Larken RAMdisk this block of code can be stored as an integral part of the OMNIBUS program. In fact the code can be stored in any AUTOSTART program, and used independantly of this Basic program. When stored there, a simple PRINT USR 24800 will produce a near-instant screen listing of the disk in the drive the Larken system is currently pointing to. If necessary, change the drive by prefacing the command with a PRINT USR 100: GOTO x (where x = the selected drive number).
Put the code into an AUTOSTART program by first running this program to get the code into the 24800+ area of memory. Then do a SAVE with the command ‘PRINT USR 100: SAVE “code.C1” CODE 24800,178’. Load your AUTOSTART program, and then load the just-saved “code.C1” file. Now reSAVE the AUTOSTART program (with the NMI-button and “D” key, of course). It’s done. Test it by breaking out of the program, and doing a PRINT USR 24800. Or if the AUTOSTART is a menu program you could introduce this function as one of the menu options.
If you are using the OMNIBUS AUTOSTART menu program and have stored the code as described above you can “REM” LINE 7 of this program, since you have no need to move the code. This will speed program initialisation.
The address 24800 was purposely selected. The AUTOSTART program on the OMNIBUS disk (TTSUC Larken library disk #2) has a number of other m/c utilities stored in the memory area 24311/24989, and this was the last remaining space! If you wish to store the code in another location you may do so by using the m/c program reloc8.Cc, found on the OMNIBUS disk also.
This program can print to the screen, to the TS2040 printer, or to a large printer. It does this by pointing channel #2 to the desired output device. Normally channel #2 points to the screen, and that is where you see listings, etc. In the program LINE 330 causes the output to appear on the 2040 printer, while LINE 340 points it to the large printer. After the disk has been read LINE 370 points the computer back to the screen.
This program has been set up to work with an SCM Fastext 80 printer. You will probably need to customise it to suit your printer. The arrangement allows you to selct a normal printout, or one in compressed text form. Look at lines 290, 440, 460, and 470. LINE 290 first does a GOSUB to 460 (to restore the large printer to normal operation), then does a GOSUB 440 (if compressed text mode has been selected). The lines 440, 460, and 470 are essential to ensure the printer functions are properly set. Line 470 is used to delay computer operation until the printer indicates it is ready for the next printer instruction. Without it, the computer sends the instructions quicker than the printer can accept them, and they are missed. You will probably need to modify the value of 108 shown in line 470. You need to determine what code your printer returns to the computer as a “ready” signal. To do this, do the following test. With an empty computer, enter the following program line:
10 PRINT AT 10,10;" "; AT 10,10; IN 127: PAUSE 50: GOTO 10
Note the numbers that appear when you printer is turned on and off. The number you should put into you program is the one that appears while your printer is on. Some printers require that paper be present before they are really ready to go. Put paper in!
LINE 300 provides for printing two labels side by side on a large sheet of paper, as a paper-saving measure. Print labels on the left side of the sheet, then roll the paper back and print on the right-hand side. The values shown in the line (36 and 68) can be changed to print at the desired point on the paper.
LINE 420 will need to be modified to suit your particular system arrangements.
110 BORDER 1: PAPER 1: CLS
120 PRINT AT 2,2; INK 2; PAPER 7;" LARKEN DISK UTILITY v3.0 ";AT 4,7; PAPER 2; INK 7;"File Header Reader";AT 6,3; PAPER 2; INK 7;" 1990 George Chambers "
130 INK 7: PLOT 0,108: DRAW 0,62: DRAW 255,0: DRAW 0,-62: DRAW -255,0
140 INK 7: PLOT 8,114: DRAW 0,50: DRAW 238,0: DRAW 0,-50: DRAW -238,0
150 RESTORE 160: FOR n=24800 TO 24978: READ a: POKE n,a: NEXT n
160 DATA 205,134,97,175,50,29,32,205,126,0,205,123,0,33,136,32,17,112,52,213
170 DATA 175,18,35,126,254,250,40,14,254,253,32,246,35,126,254,249,40,240,18,19
180 DATA 24,234,209,26,167,202,186,0,33,29,32,190,56,9,40,11,245,205,129,0
190 DATA 241,24,241,119,205,126,0,19,213,205,123,0,33,114,32,6,6,126,254,46
200 DATA 40,6,35,215,16,247,24,5,62,32,215,16,251,6,3,126,35,215,16,251
210 DATA 33,124,32,205,94,97,195,82,97,24,187,1,1,0,33,134,32,205,94,97
220 DATA 62,13,215,195,10,97,62,32,215,78,35,70,33,9,0,205,138,97,33,99
230 DATA 0,205,138,97,33,231,3,205,138,97,33,15,39,205,138,97,58,100,0,251
240 DATA 205,233,48,205,161,49,243,195,98,0,167,237,66,216,62,32,215,201,0,0
250 RANDOMIZE USR 100: OPEN #4,"dd"
260 LET drv=0: PRINT #4: GO TO drv
270 POKE 23658,8: INPUT "Select 2)Screen 3)2040 5)Large ";ptr
280 IF ptr=5 THEN PRINT #4: POKE 16094,8: INPUT "Choose Column: L)eft R)ight ";b$
290 IF ptr=5 THEN INPUT "N)ormal or C)ompressed ";c$: GO SUB 460: IF c$="C" THEN GO SUB 440
300 IF ptr=5 THEN IF b$="R" THEN PRINT #4: POKE 16094,(68 AND c$="C")+(36 AND c$="N")
310 PRINT AT 20,0;"Drive Now>";drv: INPUT "Select Drive ";drv
320 IF drv<0 OR drv>4 THEN GO TO 310
325 PRINT #4: GO TO drv
330 IF ptr=3 THEN OPEN #2,"p"
340 IF ptr=5 THEN PRINT #4: OPEN #2,"lp"
350 CLS : PRINT : POKE 23658,0: INPUT "DISK TITLE ";C$: PRINT "Disk Name: "; C$
360 PRINT AT 2,0: RANDOMIZE USR 24800
370 PRINT #4: CLOSE #2
380 IF ptr<>2 THEN PRINT AT 16,5
390 POKE 23658,8: PRINT ''TAB 10;"End of file"'" Press a key to continue": INPUT "another? Y/N ";b$
400 IF b$<>"Y" AND b$<>"N" THEN GO TO 380
410 IF b$="Y" THEN CLS : GO TO 270
420 PRINT '"Going to RAMdisk in 10 seconds": PAUSE 500: PRINT #4: GO TO 130: PRINT #4: NEW
430 GO TO 380
440 GO SUB 470: OUT 127,15: GO SUB 470: OUT 127,27: GO SUB 470: OUT 127,48: GO SUB 470: RETURN
450 STOP
460 GO SUB 470: OUT 127,18: GO SUB 470: OUT 127,27: GO SUB 470: OUT 127,50: GO SUB 470: RETURN
470 IF IN 127<>108 THEN GO TO 470
480 RETURN
490 PRINT
8000 INK 0: PAPER 7: BORDER 7: CLS : LIST
8010 STOP
9000 PRINT USR 100:SAVE "header.B2"LINE 100
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.