home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Archive Magazine 1995
/
ARCHIVE95.iso
/
text
/
hints
/
volume_01
/
issue_11
< prev
next >
Wrap
Text File
|
1995-02-16
|
10KB
|
351 lines
Hints & Tips
1.11
Å *COMPACT Ö The User Guide says that *COMPACT ömoves files around on
the disc, collecting all the free space into a continuous blockò.
However, if you have a disc that has several gaps you will find that you
need several compactions. One disc which had 5 gaps in the FS map had to
be compacted eight times before the map showed only a single gap. (See
review of R.A.Engineeringæs Utilities, page ?????)
1.11
Å *COPY Ö When copying multiple files using wildcards, you must ONLY
specify the directory into which to copy and not try to specify the
actual file name in any way e.g. if you want to copy files PROGA, PROGB,
PROGC etc from the öBASICò directory into the öBACKUPò directory, use
*COPY $.BASIC.PROG* $.BACKUP.* but if you try to use *COPY $.BASIC.PROG*
$.BACKUP.PROG* it wonæt work. This is not desperately clear in the User
Guide and Iæve only just worked out why 90% of my attempts to do
wildcard copies have not worked!
1.11
Å CAPS LOCK Ö Another thing which is obvious if you know about it is
that you can set up the keyboard to print upper case normally but then
go into lower case when you press <shift>. This can be done either by
*Configure SHCAPS if you want it to start up in that mode (or CAPS or
NOCAPS if you donæt) or by holding the shift key down and pressing and
releasing the Caps Lock key.
1.11
Å CHAINing programs Ö In response to our complaint in last monthæs Bug
or Feature that programs chaining one another cannot be called from
drive 1 using the desktop, Philip Colmer of Acornæs Customer Support
Department tells us that it is definitely a feature. There are a number
of ways of avoiding the problem. Firstly, you could reference files by
disc name, so we could CHAINö:ProgDisc.$.Progs.Nextprogò or whatever.
Alternatively, you could use the fact that when you run a BASIC program
in drive 1 from the desktop, it generates a command something like
*basic Öquit öADFS::1.$.Progs.FirstProgò. You could then use OS_GetEnv
to read the command string and find out where the program has been
called from. Thridly, have a look at PC.PC from the 1.20 version of the
PC emulator to see an intelligent (incredibly so!) boot-up program which
has been very carefully commented to enable you to modify it for your
own use.
1.11
Å Auto-booting Ö Again from Philip Colmer comes the suggestion that
you should use the PC.PC program to boot up applications from within
directories on the hard disc. The program uses legal OS calls instead of
re-configuring. It does a *DIR and then runs the program specified. The
only restriction on it is that it cannot change the system sprite size
but, he points out, if programs were written properly, they would not be
using the system sprite area!
1.11
Å System Devices Ö You can treat devices as files, e.g.
C%=OPENOUT(öNETPRINT:ò). This is particularly useful in the example
given on page 9 last month because you can now open a channel to the
network printer, send some stuff to it when you are ready (using BPUT
#C%) and when everything is done, close the Éfileæ (CLOSE#0) and it will
then be printed! (This also came from Philip Colmer Ö Thanks PC! Ö
Funny, you know, I always thought that PC stood for Personal Computer!
Ed.)
1.11
The following Hints were prepared by Adrian Look╔
1.11
Å Smooth Scrolling Ö Using VDU 23,7 you can scroll the current text
window up, down, left, or right. Horizontally, the picture can be
scrolled by one byte, but vertically it can only be scrolled by one
character cell. This can produce a smooth scroll by placing a WAIT (for
the vertical sync pulse) command before the VDU 23,7. If any further
delay is implemented then the picture shudders as it scrolls. This means
that a slow smooth scroll cannot be used. The answer is to redefine the
screen base address manually (as we used to do on the BBC). This is done
using ÉOS_Wordæ &16.
1.11
DIM block% 4
1.11
:
1.11
block%?0=type
1.11
block%!1=offset
1.11
WAIT
1.11
SYS öOS_Wordò,&16,block%
1.11
ötypeò : when 1 Ö base used by VDU drivers (i.e. screen updated)
1.11
: when 2 Ö base used by hardware (i.e. screen displayed)
1.11
öoffsetò : from the address of the base of the screen buffer to the
start of the screen display.
1.11
The following example program should help to make it clearer.
1.11
10 REM >scrolling
1.11
20
1.11
30 REM **************************
1.11
40 REM * Scrolling Screens?? *
1.11
50 REM * written by Adrian Look *
1.11
60 REM * 21st July 1988 *
1.11
70 REM **************************
1.11
80
1.11
90 MODE 0:OFF
1.11
100 DIM block% &10
1.11
110 count=0
1.11
120
1.11
130 PRINTTAB(3,15);öSome textò
1.11
140
1.11
150 REPEAT
1.11
160 PROCscroll(1)
1.11
170 UNTIL 0
1.11
180 END
1.11
190
1.11
200 DEFPROCscroll(speed)
1.11
210 PROCinfo
1.11
220 add=x/m
1.11
230 IF SGN(count)>0 THEN speed=-speed
1.11
240 REPEAT
1.11
250 block%?0=2
1.11
260 block%!1=add*count
1.11
270 WAIT
1.11
280 SYS öOS_Wordò,22,block%
1.11
290 count+=speed
1.11
300 UNTIL add*count>x*y/m+4160 OR count<0
1.11
310 ENDPROC
1.11
320
1.11
330 DEFPROCinfo
1.11
340 SYS öOS_ReadModeVariableò,MODE,4 TO ,,x
1.11
350 x=4-x:x=8*(2^x)*10
1.11
360 SYS öOS_ReadModeVariableò,MODE,5 TO ,,y
1.11
370 y=3-y:y=y*256
1.11
380 SYS öOS_ReadModeVariableò,MODE,3 TO ,,c
1.11
390 CASE c OF
1.11
400 WHEN 1 : m=8
1.11
410 WHEN 3 : m=4
1.11
420 WHEN 15 : m=2
1.11
430 WHEN 63 : m=1
1.11
440 ENDCASE
1.11
450 ENDPROC
1.11
1.11
Å Desktop Utilities Ö The desktop is essentially a skeleton program
which allows the programmer to install his/her own icons, windows,
menus, commands, etc, which the DeskTop will then operate. This is done
with a very clever set of FNæs. for example:
1.11
PROCinstall(öadrianò)
1.11
:
1.11
DEFPROCinstall(file$)
1.11
INSTALL file$
1.11
void=EVAL(öFNinstall_file_ò+file$)
1.11
ENDPROC
1.11
This means that by EVALuating a string the DeskTop can call any file-
specific function. In the case above, FNinstall_file_adrian will be
called. By using this system, any command can be Éinstalledæ or even
replaced. Explaining or even listing the functions and procedures
available in the DeskTop program is not really possible in the magazine.
However, bearing in mind the methods used, you will find before long you
can write some very useful tools for the DeskTop. It should even
possible to completely re-write the it! As an example, here is a program
which will allow you to use star commands. Donæt forget to *SETTYPE
Éfilenameæ FE0 to indicate that the program is a desktop utility (We
have included several other utilities on the program disk).
1.11
10 REM >star
1.11
20
1.11
30 REM *******************************
1.11
40 REM * Star Commands for Desk Top *
1.11
50 REM * written by Adrian Look *
1.11
60 REM * original idea Denis Howlett *
1.11
70 REM *******************************
1.11
80
1.11
90 DEFFNinstall_file_star
1.11
100 file=OPENIN(filehandler_path$+ö.istarò):CLOSE #file
1.11
110 IF file=0 THEN ERROR 1,öCanæt find icon file Éistaræò
1.11
120 OSCLI(öSMERGE ò+filehandler_path$+ö.istarò)
1.11
130
PROCsys_addtoiconbar(östarò,öcommandò,&301A,icon_fgcol,icon_bgcol,48)
1.11
140 SYS öWimp_ForceRedrawò,-1,0,0,1279,100
1.11
150 =0
1.11
160
1.11
170 DEFFNaction_star
1.11
180 PROCstar_command(5,5,75,25,2,1)
1.11
190 =0
1.11
200
1.11
210 DEFPROCstar_command(x0,y0,x1,y1,bx,by)
1.11
220 *POINTER 0
1.11
230 VDU 26,4,28,x0,y1,x1,y0
1.11
240 y0=31-y0:y1=31-y1
1.11
250 gx=x0*16-bx*8:dx=(x1-x0)*16+bx*16+16
1.11
260 gy=y1*32-by*16:dy=(y0-y1)*32+by*32+32
1.11
270 GCOL 0,&4:RECTANGLE FILL gx-4,gy-4,dx+8,dy+8
1.11
280 GCOL 0,&0:RECTANGLE FILL gx,gy,dx,dy
1.11
290 LOCAL ERROR
1.11
300 REPEAT
1.11
310 ON ERROR LOCAL PRINT REPORT$
1.11
320 *FX 4,0
1.11
330 INPUTö*òstar$
1.11
340 *FX 4,1
1.11
350 OSCLI(star$)
1.11
360 UNTIL star$=öò
1.11
370 RESTORE ERROR
1.11
380 SYS öWimp_ForceRedrawò,-1,gx-4,gy-4,gx+dx+8,gy+dy+8
1.11
390 VDU 26,5
1.11
400 *FX 21,9
1.11
410 *POINTER
1.11
420 ENDPROC
1.11
N.B. (i) You will need a STAR shaped icon called Écommandæ, saved as
Éistaræ. However, if you want to test the program before designing an
icon, skip lines 100-120 and change öcommandò in line 130 to öunknownò.
1.11
(ii) Because the DeskTop uses the filename of the utility as a Éseedæ,
it important that the utilityæs filename be consistent with its
procedure names. For example: if you rename Éstaræ to Écommandæ then the
DeskTop will look for FNaction_command instead of FNaction_star, so you
will get an error!
1.11
Å Making the Print Key Save Ö Last month it was suggested in Neil
Strongæs article about making the print key print that a slight
modification of the program could make it save screen shots to the disc
using SCREENSAVE ö$.picò instead of HARDCOPYFX. However, this limits you
to one screen shot at a time (otherwise you will overwrite your last
one). If we use the system variables and update the Éprint keyæ program
we can get it to save a screen called É$.scr0æ, followed by, É$.scr1æ,
É$.scr2æ..etc!
1.11
871 adr r0,command1
1.11
872 swi öOS_CLIò
1.11
920 equs öScreenSave scr<file>ò ; FastSave even!#?
1.11
941 .command1
1.11
942 equs öSetEval file file+1ò
1.11
943 EQUB 0
1.11
944 ALIGN
1.11
1020 OSCLI(öSetEval file 0ò)
1.11
1030 END
1.11
If you wish to (re)set the Éfile countæ to n, then just type:
1.11
*SETEVAL file n
1.11
Å SpellMaster Browse in Wordwise Plus Ö If you have Spell-Master and
Wordwise Plus you can very easily write a two line segment program which
will call the browse window. i.e.
1.11
*BROWSE
1.11
DISPLAY
1.11
Thus if the program were in segment zero you could press <shift><print>
while editing your text and check your spelling using the browse window.
This obviously opens up all sorts of possibilities for Wordwise Plus to
use Spell Masteræs facilities.
1.11