SB BBC @ GBR Oldie hints/tips #087-090 Hints and tips from the archives of Wakefield BBC Micro User Group... 87. Acorn DFS page setting ~~~~~~~~~~~~~~~~~~~~~~ The normal setting of PAGE with the Acorn DFS 0.90 and 1.20, (DNFS), is &1900. It is possible to set it at a lower value, in order to gain valuable memory space, but only at a price. Here is a list of the possible PAGE values, together with a note of the facilities available. The limitation revolves around the number of files which can be simultaneously open, and whether you can use *SPOOL and *EXEC, which is a type of file. Note that LOAD/SAVE also refers to all the similar commands CHAIN, *LOAD, *RUN etc.. It is interesting to note that a PAGE value of &1700 would appear to be just a good as &1900, and that &1100 is just as good as &1200. &1100 is the absolute minimum value possible without nasty things happening if you access the disc drive(s), even just to do a *CAT. For those of you who are interested in making use of the information contained in the disc workspace, details were given in tip #71. In order to get most of the information into the workspace, the disc must have been accessed at least once; just a *CAT will do. If you don't actually want the catalogue to come up on the screen, then precede the *CAT with VDU21, and follow it with VDU6 on the next line. This will temporarily inhibit the screen. PAGE VALUE FACILITIES &1900 5 Files + LOAD/SAVE + SPOOL/EXEC 1800 5 Files + LOAD/SAVE + SPOOL/EXEC 1700 5 Files + LOAD/SAVE + SPOOL/EXEC 1600 4 Files + LOAD/SAVE + SPOOL/EXEC 1500 3 Files + LOAD/SAVE + SPOOL/EXEC 1400 2 Files + LOAD/SAVE + SPOOL/EXEC 1300 1 File + LOAD/SAVE + SPOOL/EXEC 1200 0 Files + LOAD/SAVE 1100 0 Files + LOAD/SAVE less than 1100 No disc operations possible 88. Auto-loading of disc files ~~~~~~~~~~~~~~~~~~~~~~~~~~ When using programs that save and load data files frequently, care has to be taken to load the most recently saved file. If files are saved with numbers as filenames which are increased by one each time, the procedure will load the file with the highest number. The example below assumes that the highest possible number is 10, but the lowest can be 0 or 1. LISTING-1: 100 file%=11:REPEAT:file%=file%-1:REM start with highest possible plus 1. 110 chan%=OPENIN(STR$(file%)):REM Use OPENUP on Basic 2. 120 UNTIL chan%<>0 OR file%=0 130 IF chan% THEN 200 140 PRINT"No file found":*CAT 150 STOP:REM This bit is up to you. 200 PRINT"Found file number ";file% 210 REM INPUT#chan% can now be used in normal way. 220 CLOSE#chan%:REM Tidy up afterwards. 230 REM Rest of the program. LISTING-2: 100 FOR file%=0 TO 9:REM Save dummy files to disc. 110 chan%=OPENOUT(STR$(file%)) 120 CLOSE#chan%:NEXT In listing 1, Line 110 converts file% to a string and attempts to open a file of that name on the disc for input. A number is allocated to chan% for this operation, but this is 0 if the file is not found. The program loops between lines 100 and 120 until either chan% is not 0 or file% has reached 0. To test this, write some dummy files to disc as shown in listing 2, and then try the example in listing 1. Rather than have just numbers as the filenames, you could save files as "data1", "data2" etc., by modifying the (STR$(file%)) to ("data"+STR$(file%)). Note that this technique can be adapted to automatically load a series of files in turn, performing a search or other operation on each one. 89. Moving text (1) ~~~~~~~~~~~~~~~ This is a very simple routine which 'assembles' text from the right-hand margin. It is an example of moving graphics at the very simplest level, and illustrates the use of *FX19 to create smooth movement. It is written for a 40-column mode, but can be modified for 80 if required. You can omit any spaces, which are shown only for clarity. 10 MODE 7:VDU23,1,0;0;0;0; 20 PROCmove("HELLO THERE!!",12,10) 30 PRINT'':VDU23,1,1;0;0;0;:END 40 : 100 DEFPROCmove(text$,pos%,vpos%) 110 FOR let%=1 TO LEN(text$) 120 FOR p%=37 TO pos%+let%-1 STEP-1 130 PRINT TAB(p%,vpos%) MID$(text$,let%,1)" ";:*FX19 140 NEXT:NEXT:ENDPROC 90. Moving text (2) ~~~~~~~~~~~~~~~ Here is another short demonstration of moving text. It uses MID$ in a rather cunning way to achieve the movement very simply. If you omit the CLS from line 10, then you get quite a different effect. The routine repeats until you press any key. 10 MODE2:VDU23,1,0;0;0;0;:COLOUR1:COLOUR131:CLS 20 ME$=STRING$(20," ")+"******* THIS PROGRAM HAS BEEN BROUGHT TO YOU BY COURTESY OF THE WAKEFIELD BBC MICRO USER GROUP *******" 30 REPEATa%=0:REPEATa%=a%+1:PRINTTAB(0,29)MID$(ME$,a%,20): b%=INKEY(15):UNTILa%=LEN(ME$)ORNOTb%:UNTILNOTb% 40 MODE7:END 73 Rick G4BLT @ GB7WRG