A Streamlined Boot

See all articles from CATS v5 n11
Author(s): Mark Fisher
Publication: CATS Newsletter
Pub Details: CATS v5 n11 (Volume 5, Issue 11)
Date: March 1988
Pages: 5

Introduction: What’s a BOOT?

There are a lot of messy little details that need to be straightened out before you can use one of the application programs that is included with the QL. But, you say, I haven’t ever had to do anything more than press F1 to get to Quill. You’re right, of course – the messy work has been automatically done by a program named BOOT. The name is important: The QL searches the current directory upon start-up for that name. If it finds it, the QL will automatically execute whatever commands it contains. As supplied with the QL, the BOOT programs with the Psion suite generally set up window sizes and load the machine code into the proper locations. If you wish, however, you can extend the functions of the BOOT program. One possibility is discussed below.

Operation: What’s this BOOT?

Here’s an application of the Toolkit II‘s CLOCK function. If Toolkit II has been installed in your QL, it will automatically date-stamp files as they are saved – but the clock has to be set. This BOOT program will allow you to set both the date and the clock, as well as offering you an alarm if you’ll need to blow the joint at a certain time. Unlike the date setting routines in IBM machines, you can short-cut the entire business if you wish. In addition, there is no required separator between fields, as long as you are consistent within each entry.

The program’s operation is straightforward. After setting up the screen and titles (100-150), it prompts for a date. If you press ENTER at this point, it will skip directly to the program loading sequence (you might want to do this if you just QUIT from another Psion program and had already set the clock). If you have entered a date, it will first evaluate your entry to find what seperator you used, then divide your entry into the values for day, month, and year. The sequence is repeated for time setting and alarm setting as well. When these are completed, the program loading steps are executed (350-370).

Upon QUITing the program, don’t reset the machine: Just type LRUN BOOT to load the next program and preserve the clock settings.

While the listing below would seem to be specific to Quill, it can be easily modified to work with the other Psion programs. I’ll insert comments that will let you know how to adapt this to the other programs.

One caution: this program is considerably longer that the original BOOT, and the QL doesn’t delete the BASIC when it goes to the machine code programs. Thus, you’ll lose some RAM space when you use this BOOT routine. I think you’ll agree that the convenience is worth the cost.

100 CLEAR
110 OPEN #1, con_512x256a0x0_10:CSIZE 2,1:CLS

This line ensures that INPUT commands will operate correctly, even if you have just QUIT from a previous Psion program.

120 AT 1,10:PRINT "LOADING QL T-QUILL+"
130 AT 3,13:PRINT "version ";2.3;
140 AT 4,6:PRINT "copyright 1984 PSION LTD"
150 AT 6,11:PRINT "word processing"

The first few lines (120 – 150) are specific to the particular program. They have been lifted from the BOOT program supplied with the programs – with a change in the PRINT locations to condense the titles and leave room for the time and date-setting routines.

160 AT 8,1:CSIZE 1,1
170 INPUT 'For date stamp type mm/dd/yy; ENTER for no date'!a$
180 IF LEN(a$)>5
190 what_sep : REMark searches string to find char used as separator - returned as sep$
200 slice1=sep$ INSTR a$ : REMark position of first seperator
210 slice2=slice1+(sep$ INSTR a$(slice1+1 TO)) : REMark position of seperator in remainder of a$
220 year= ('19'&a$(slice2+1 TO))
230 month=(a$(1 TO slice1-1))
240 day= (a$(slice1+1 TO slice2-1))
250 AT 8,1: CLS 3: INPUT 'For clock time, type hh/mm, ENTER for elapsed ';a$
260 time: SDATE year,month,day,hr,min,0

“Time” is a procedure that parses the time inputs, both for time and alarm setting.

270   OPEN#4, scr_60x20a451x236: PAPER#4,32: INK#4,7: CLOCK#4 : REMark sets up window for TKII command CLOCK
280 AT 8,1: CLS 3: INPUT 'For alarm, enter hh/mm. If not, press ENTER ';a$
290 IF LEN (a$)>3
300 time
310 ALARM hr,min : REMark TKII command
320 PRINT 'Alarm will ring at '&hr&' hours,'&min&' minutes.'
330 END IF
340 END IF
350 CLOSE #1:CLOSE #2:WINDOW #0,400,20,35,215
360 EXEC_W flp1_tquill
370 OPEN #1,scr:OPEN #2,scr

Lines 350 – 360 have also been lifted from the original BOOT program. It’s line 370 that keeps functions such as INPUT and ED from working after you’ve QUIT the program. If you’re using microdrives, change line 360’s flp to mdv (of course).

380 DEFine PROCedure what_sep
390 FOR i=1 TO LEN(a$)
400 IF a$(i)<'0' OR a$(i)>'9' THEN EXIT i
410 END FOR i
420 LET sep$=a$(i)
430 END DEFine
440 DEFine PROCedure time
450 IF LEN(a$)>3
460 what_sep
470 slice1=sep$ INSTR a$
480 hr=a$(1 TO slice1-1):min=a$(slice1+1 TO)
490 ELSE
500 hr=0:min=0
510 END IF
520 END DEFine time
530 DEFine PROCedure savit
540 SAVE flp1_boot
550 END DEFine

Savit is laginappe – you really don’t need it for proper operation of the program, but it makes backing the program up much easier – just type “savit” whenever you want to backup your program, to “lock in” a change to the boot program.

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.