home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Archive Magazine 1997
/
ARCHIVE_97.iso
/
text
/
hints
/
vol_03
/
issue_07
< prev
next >
Wrap
Text File
|
1995-02-16
|
20KB
|
642 lines
Å !Draw Ö I used to find it difficult to get to grips with !Draw
because I couldnæt visualise the final layout. However, if you use the
Énew viewæ option together with Ézoomæ you can get a WYSIWYG view. Not
only this, but it is possible to manipulate the major view from the
minor view. L Kennedy.
Å Acorn DTP Ö This may seem obvious but I only just figured it out!
When printing documents from Acorn DTP, I found that footers (in
particular) wouldnæt print. I spent ages looking through the DTP manual
trying to figure out why. I suddenly occurred to me that it might be the
printer driver and sure enough, it was. The page size for A4 paper has
margins set all round, in particular a bottom margin of 20 mm is set,
and it is this which is Éclippingæ out the footers. Set this to 0 (say)
and the problem is solved. Kevin Quinn
3.7
Å BASIC programs from !Edit Ö When in !Edit you can actually run BASIC
programs etc from within the desktop without pressing <f12>. I happened
to come across this accidentally. Press <menu> on the Edit icon and
click on New Task Window. This will produce a task window on the screen
and will allow you to execute the BASIC environment without leaving the
desktop and allow you to format disks also allowing you to nearly multi-
task formatting disks, you can suspend the task get on with something
then resume the task and the formatter will continue where it left off!
Press-ing <menu> from within the task window will give a list of
commands (anyone know what link/unlink does??) Graham Bisset
3.7
Å Changing your batteries and keeping your CMOS RAM settings intact.
If you connect a 100 microfarads capacitor in series with a 100 ohm
resistor and clip them across the battery connec-tions, (+ve of the
capacitor to +ve of the battery) you will have about 70-100 seconds to
change your batteries without losing your CMOS settings. The computer
should be kept switched off throughout the operation. J W E Jones
3.7
Å Current directory path Ö With reference to Richard Skempæs query in
Archive 3.5 p43 about getting the full pathname of the current direc
tory, the Éeasiest on your fingersæ method uses system variables. It was
difficult to implement and required a fair amount of digging in the
manuals but it does demonstrate the use of *Set, *SetMacro and *SetEval,
so here it is:
3.7
Place the following two lines into an Obey file, either via *Build or by
using !Edit. Save it in the library directory of your current disc as
öPathò and set the filetype to be an Obey file (*SetType %.Path Obey).
Execute it with *Path. Subsequent use of *Path will have other effects Ö
see later.
3.7
Set Path$ $
3.7
SetMacro Alias$Path Dir %%0||mIf ö%%0ò = öò Then Set Path$ $ Else If
ö%%0òLEFT1 = ö$ò Then Set Path$ %%0 Else SetEval Path$ Path$ + ö.%%0ò
3.7
How it works: öSet Path$ $ò sets up a system variable called öPath$ò and
assigns to it the string value ö$ò, which you will recognise as being
the name of the root directory.
3.7
öSetMacro Alias$Path ╔ò creates a macro system variable called öPathò.
3.7
When ö*Path [<directory path>]ò is executed, the macro first selects the
directory specified in <dir-ectory path> by way of the old *Dir command.
3.7
If no directory path is specified, the old *Dir selects the root
directory. The macro examines <directory path> and, if it is a null
string (öò), it sets Path$ to ö$ò.
3.7
If the leftmost character of <directory path> is ö$ò, the macro replaces
Path$ with <directory path>.
3.7
If <directory path> is not null and does not have ö$ò as its leftmost
character, the macro appends a full stop and the string specified in
<directory path> to whatever Path$ contains.
3.7
Path$ thus always contains the full pathname of the currently selected
directory (CSD).
3.7
You can actually redefine *Dir itself to do this, so that you donæt have
to remember to use *Path ins-tead of *Dir. In other words, it becomes
transparent.
3.7
All you do is to change the first occurrence of Path (in öAlias$Pathò)
to Dir (i.e. öAlias$Dirò) and change the öDir %%0ò to ö%Dir %%0ò. The
extra % sign in front of Dir is to enable the original version of Dir to
be used (FORTH programmers will recognise this as smudging). I have not
actually tried this, but it should work!!
3.7
How to use it:
3.7
Use öPathò wherever you would use öDirò. In fact, do not use öDirò at
all (more on this later). Also use full pathnames, as opposed to
wildcarded path-names. This is not really necessary, but it looks
neater.
3.7
The command ö*Path Basic.Games.Adventureò, executed from the root
directory, would set sub-directory öAdventureò as the CSD, exactly in
the same way as ö*Dir Basic.Games.Adventureò would do.
3.7
Notes:
3.7
1. No leading asterisks. You may enter them, but they are superfluous,
as these lines are sent direct to the CLI.
3.7
2. The use of two double bar characters in ||m. This is so that Obey
will insert it in the macro variable as |m, instead of as ASCII 13.
3.7
Alias$Path is a multi-line (well, a 2-line) com-mand. This is quite
acceptable, provided each line is separated by a carriage return (ASCII
13, or |m).
3.7
Note that the (*)Dir command is at the start of the macro. Putting it
at the end causes errors related to the (*)If╔Then╔Else construct.
3.7
3. Double percentage character in %%0. This is so that Obey will insert
it in the macro variable as %0, instead of attempting to evaluate a
(non-existent) parameter when the command *SetMacro is executed.
3.7
4. Double quote marks where the parameter is to be evaluated as a
string. This is so that string evaluation will proceed correctly.
3.7
5. Use of upper and lower case. In general they are interchangeable at
will.
3.7
(*)Eval supports a number of operators (see p.394 in the Archimedes User
Guide). Some are in the form of ordinary words, such as LEFT, MOD, AND,
OR, etc, and others are symbols, such as *, +, >>, etc. The ordinary
words must be in UPPER CASE, otherwise they are not recognised.
3.7
Disc-related commands seem to be quite happy when offered system
variables as pathnames. If an application sets up its own pathname as,
say, öApplication$Dirò, you can make the first line of a BASIC program.
3.7
10 REM > <Application$Dir>.Program
3.7
and be confident that the BASIC command SAVE will put it in the right
place, as the Filer (I think) evaluates <Application$Dir> correctly.
Also *Eval Application$Dir (without the <>) also returns the value of
the variable.
3.7
You can get the value of the system variable into a BASIC variable with
the following FN:
3.7
buffer_length%=255
3.7
DIM buffer% buffer_length%
3.7
PRINT FNevalOS(öApplication$Dirò) : REM NB!! no < >
3.7
END
3.7
3.7
DEF FNevalOS(A$) LOCAL T%,L%
3.7
SYS öOS_EvaluateExpressionò, A$,buffer%,buffer_length% TO ,T%,L%
3.7
IF T%=0 THEN = L% : REM integer result
3.7
buffer%?L%=13
3.7
=$buffer% : REM string result
3.7
Anton Mans, Durban
3.7
Å Double height in Fortran Ö The following short FORTRAN routine can
be used for the Archimedes to Étart upæ screen output. It is a routine
for printing text in double height on the screen and uses OS_Word call
10 to read the system font bit pattern. A VDU23 call is used to define a
pair of characters consisting of the upper and lower halves of the input
character. These two characters are then printed, one above the other,
giving a double-height character. Itæs very useful for printing headings
in screen output and doesnæt require messing about with special fonts
(Iæm going to go on to that next!).
3.7
I claim no originality for the overall method. A routine in BBC BASIC to
do this was published in Beebug some years ago (I forget who the author
was), but I thought it was worth publicising a FORTRAN version of it in
Archive because I donæt think the translation is immediately obvious and
readers may not have been aware of the technique anyway. It should be
easily extendible to double width, quadruple height, etc.
3.7
Rather than just give the bare routine, I have produced a short program
incorporating it, that writes out a couple of strings. Much use is made
of the É$æ format to suppress CRLF when characters are being sent to the
VDU driver. The routine is more complex than the BASIC equivalent for
two reasons. Firstly, although there is a word ÉLENæ in FORTRAN, it only
seems to give the maximum length of any given string, i.e. the length
that it is originally declared to be (e.g. CHARACTER*78 TXT; LEN(TXT)
gives 78). So in SUBROUTINE DOUBLE, there are a few lines to find the
length of the string passed to it by counting backwards from the maximum
length until a non-space character is reached. N.B. this will fail if
the string is put into the argument list, e.g. CALL DOUBLE(10,20,ÉHi
thereæ). Secondly, since individual bytes in memory are not accessible
to FORTRAN, you have to get the result back as three (4-byte) integers,
and use IAND with ISHFT to gain access to the bytes.
3.7
PROGRAM DHTEST
3.7
C *******************************
3.7
C A DEMONSTRATION PROGRAM FOR
3.7
PRINTING DOUBLE HEIGHT
3.7
C TEXT IN ANY MODE (NOT 7) ON THE
3.7
ACORN ARCHIMEDES,
3.7
C IN ACORNSOFT FORTRAN. USES ACORN
3.7
EXTENSIONS: OSWORD, ISHFT, IAND
3.7
C BY R.D.WRIGHT
3.7
C *******************************
3.7
CHARACTER*78 TXT
3.7
WRITE(6,æ($,2A)æ)CHAR(22)
3.7
,CHAR(12)
3.7
WRITE(6,*)æDOUBLE HEIGHT TESTæ
3.7
TXT=æTHIS IS A VERY LONG TEST
3.7
STRINGæ
3.7
CALL DOUBLE(10,20,TXT)
3.7
TXT=ÉAND MOREæ
3.7
CALL DOUBLE(10,23,TXT)
3.7
STOP ÉEND OF DEMOæ
3.7
END
3.7
SUBROUTINE DOUBLE(ICOL,IROW,TXT)
3.7
CHARACTER*78 TXT
3.7
INTEGER BLOCK(0:2)
3.7
INTEGER B(0:8)
3.7
N=79
3.7
10 N=N-1
3.7
IF (TXT(N:N).EQ.É æ) GO TO 10
3.7
DO 20 I=1,N
3.7
BLOCK(0)=ICHAR(TXT(I:I))
3.7
CALL OSWORD(10,BLOCK)
3.7
DO 2010 J=1,3
3.7
BLOCK(0)=ISHFT(BLOCK(0),-8)
3.7
B(J)=IAND(BLOCK(0),?IFF)
3.7
2010 CONTINUE
3.7
B(4)=IAND(BLOCK(1),?IFF)
3.7
DO 2020 J=5,7
3.7
BLOCK(1)=ISHFT(BLOCK(1),-8)
3.7
B(J)=IAND(BLOCK(1),?IFF)
3.7
2020 CONTINUE
3.7
B(8)=IAND(BLOCK(2),?IFF)
3.7
WRITE(6,É($,10A)æ)CHAR(23),CHAR(
3.7
240),CHAR(B(1)),CHAR(B(1))
3.7
+,CHAR(B(2)),CHAR(B(2)),CHAR(B(3
3.7
)),CHAR(B(3)),
3.7
+CHAR(B(4)),CHAR(B(4))
3.7
WRITE(6,É($,10A)æ)CHAR(23),CHAR(
3.7
241),CHAR(B(5)),CHAR(B(5))
3.7
+,CHAR(B(6)),CHAR(B(6)),CHAR(B(7
3.7
)),CHAR(B(7))
3.7
+,CHAR(B(8)),CHAR(B(8))
3.7
IX=ICOL+I-1
3.7
IYU=IROW
3.7
IYL=IROW+1
3.7
WRITE(6,É($,8A)æ)CHAR(31),CHAR(
3.7
IX),CHAR(IYU),CHAR(240)
3.7
+,CHAR(31),CHAR(IX),CHAR(IYL)
3.7
,CHAR(241)
3.7
20 CONTINUE
3.7
RETURN
3.7
END
3.7
R.D.Wright
3.7
Å Easy ÉCæ Compilation I Ö While working on a C program it can become
quite tedious to type in the same parameters every time you want to
compile the latest version of your program. One way to get around this
is to use something like öC-Frontò from Mitre which allows you to
compile directly from the desktop. A simpler and cheaper way is to use
an ÉObeyæ file which will do the job for you. Below is an example that
has been written to make the compilation of C (Release 3) programs
easier. Using this method, you can still work from the desktop editing
your text in !Edit, saving it, then pressing <f12>. You can then use the
following command:
3.7
*c <inputname> [outputname]
3.7
It will then automatically Compile and Link your new masterpiece!
3.7
The program has been fully commented to aid understanding. It should be
saved as an ÉObeyæ file in the ÉLibraryæ directory under the name öCò.
Obviously it should be customised to suit your own directory layout and
preferred compiler options.
3.7
| ÉCæ Obey file, Compiler & Linker -
3.7
16/02/90 Mark Taylor
3.7
| Syntax : ö*C <inputname> [output
3.7
name]ö
3.7
| Where Éinputnameæ is the name of
3.7
the file to be compiled
3.7
| and Éoutputnameæ is the name of the
3.7
output file, e.g. !RunImage, etc.
3.7
|
3.7
| Check for parameters. If none
3.7
present then error and output
3.7
a message.
3.7
if ö%0ò = öò then error 0 Error in
3.7
ÉCæ Compiler & Linker. Syntax : *C |<inputname|> [outputname]
3.7
|
3.7
| Set system variable Éipname$æ to
3.7
first parameter after the öcò.
3.7
Set ipname$ %0
3.7
|
3.7
| Check for a second and if there is
3.7
one set Éopname$æ to that
3.7
variable,
3.7
| else set Éopname$æ equal Éipname$æ.
3.7
If ö%1ò > öò then Set opname$ %1 else
3.7
Set opname$ %0
3.7
|
3.7
| Compile with Éipname$æ, do NOT Link
3.7
(-c). ANSI 3 Standard method.
3.7
cc -c <ipname$> -I$.RISC-OSLib
3.7
|
3.7
| Link Éipname$æ with standard lib-
3.7
raries and output as Éopname$æ.
3.7
link -o <opname$> o.<ipname$> $.RISC
3.7
-OSLib.o.RISC-OSLib $.CLib.o.Stubs
3.7
|
3.7
| Echo finishing message.
3.7
Echo File É<ipname$>æ successfully
3.7
compiled as É<opname$>æ.
3.7
| Unset the temporary variables.
3.7
Unset ipname$
3.7
Unset opname$
3.7
Below is a cut down version that is not quite as sophisticated but is
easier to understand.
3.7
| ÉCæ Obey file, Compiler & Linker -
3.7
16/02/90 Mark Taylor
3.7
| Syntax : ö*C nameò Where Énameæ is
3.7
the name of the file to be
3.7
compiled.
3.7
cc -c %0 -I$.RISC-OSLib
3.7
link -o %0 o.%0 $.RISC-OSLib.o.RISC
3.7
-OSLib $.CLib.o.Stubs
3.7
Echo File É%0æ successfully compiled.
3.7
3.7
Å Easy ÉCæ Compilation II Ö This is not a new idea but it is still
worth mentioning. To speed up the compilation of ÉCæ programs it is a
good idea to copy the necessary files to a RAM disc. I have written an
Obey file to achieve this. It is best saved into the Library directory
so that it may be called from the star (*) prompt any time. The way the
file is set up at the moment means that it will copy files from the hard
disc to a RAM disc of some 1.5M. The RAM disc is set up using the
öMemAllocò module (this can be found in the !Lander directory on the
Apps2 disc of RISC-OS). It should be copied in the mod-ules directory of
the !System folder. The directory layout reflects a fairly standard
system under release 3 of Acornæs ANSI C.
3.7
Important!
3.7
You must remember to copy the files you have changed during your session
back to disc before switching off!
3.7
| Obey file to set up RAM disc as the
3.7
working disc for ÉCæ 18/1/90
3.7
|
3.7
| First create large RAM disc: 1.5MB!
3.7
RMensure MemAlloc 0.11 RMload :4.$.
3.7
!System.modules.memalloc
3.7
RAMFSSize 1500
3.7
RMensure SharedClibrary 3.50 RMload
3.7
:4.$.!System.modules.clib
3.7
RMensure FPEmulator 2.80 RMload :4.$.
3.7
!System.modules.FPE280
3.7
|
3.7
CDir RAM:$.RISC-OSlib
3.7
CDir RAM:$.Clib
3.7
CDir RAM:$.User
3.7
Copy ADFS:$.RISC-OSlib.* RAM:$.RISC-
3.7
OSlib.* ~cr~v
3.7
Copy ADFS:$.CLib.* RAM:$.Clib.* ~cr~v
3.7
Copy ADFS:$.User.* RAM:$.User.* ~cr~v
3.7
CDir RAM:$.Library
3.7
Copy ADFS:$.Library.link RAM:$.Library.* ~c~v
3.7
Copy ADFS:$.Library.cc RAM:$.Library.* ~c~v
3.7
Copy ADFS:$.Library.squeeze RAM:$.Library.* ~c~v
3.7
| Copy my single letter Obey file ÉCæ.
3.7
Copy ADFS:$.Library.c RAM:$.Library
3.7
.* ~c~v
3.7
|
3.7
|Define function keys.
3.7
k.1c
3.7
k.2cc -c
3.7
k.3-I$.RISC-OSLib
3.7
k.4link -o
3.7
k.5$.RISC-OSLib.o.RISC-OSLib
3.7
k.6$.CLib.o.Stubs
3.7
k.7Squeeze -v
3.7
| Delete all unwanted object files!
3.7
k.12wipe o.* ~c
3.7
|Perform *RAM at the end!
3.7
RAM
3.7
|Select $.User directory!
3.7
Dir $.User
3.7
Echo RAM Disc now setup correctly
3.7
(DIR=$.User)
3.7
Echo
3.7
free
3.7
Filer_OpenDir RAM:$.User.c
3.7
Å Music Maestro please! Ö The !Maestro applic-ation provided by Acorn
is very powerful, if very complex. However, it still has a number of
short-comings relative to the old Island Logicæs öMusic Systemò for the
BBC micro. These include the inability to delete whole bars or several
bars; the inability to handle triplets; the inability to change Tempo
within a passage. Also, entering scores by dragging icons is extremely
slow and laborious and finally, öMusic Systemò counted notes in a bar
and, when the right time had been used, automatically entered a bar-
line. This not only saved an operation, it also provided a cross-check
on typing accuracy: the unexpected appearance of a bar-line indicated a
mistake somewhere.
3.7
!Maestroæs !RunImage file has been modified to permit changing of the
Tempo during a passage. This required a new sprite, placed in the space
in the top right corner, next to the hemi-demi-semi-quaver rest; ÉMæ for
Metronome seemed to be a reasonable choice. This sprite can be picked
up, just like the others, and placed above the appropriate bar-line.
When it is Éclickedæ to fix it in position, it changes into the crotchet
symbol followed by ö=<num>ò, where <num> is a number from 40 to 210,
representing the Tempo as selected by the Tempo sub-menu from the main
Maestro menu. The numbers (of beats per minute) are given on page 1810
of the Programmeræs Reference Manual.
3.7
During these investigations, a few small errors were noticed in the
Programmeræs Reference Manual (RISC-OS Edition). In Vol.4, under Music
Files:
3.7
p.1809 öMaestroò is followed by öLine-feedò, &0A (not &0D)
3.7
Music Data: Not ö4*8 length of queue of notes╔ò but ö5*8ò because the
length is written to file as an integer variable, FINE%(C%) (as in DC al
fine!), so it consists of one byte (&40:integer) followed by 4 bytes
(value).
3.7
p.1811 Attributes: Clef Bit 5 is unused Bits 6 & 7 are (StaveÖ1), range
0Ö3. The attributes as defined in !Maestro. !RunImage lines 28900Ö29020
agree with those obtained by a *DUMP of a Music file. Alan Quayle
3.7
Å Shift Caps Lock will give you capitals normally but will enable
lower case characters to be typed by holding down the shift key Ö very
useful when writing BASIC programs. Fred Lee
3.7
Å SID Ö There is a mail-server on the SID database and so if you can
use E-MAIL (e.g. if you are a student at University, like me) then you
can mail it at SIDInfo@uk.co.acorn with a message contain-ing the word
Éhelpæ and it will mail you a file telling you how to download stuff.
It only has the free PD stuff though (obviously). The advantages of this
service work both ways Ö the SID machine can schedule the replies in
non-peak times and you are not using lots of on-line time down-loading.
Kevin F. Quinn
3.7
Å TinyDirs Ö it may be obvious to most of you but╔ The TinyDirs
program not only allows directories to be installed on the icon bar but
allows applications to be as well. After all they are only directories
really. The application can then be run by clicking on the icon on the
icon bar in just the same way as any other application. This means you
can have your favourite programs on the icon bar without having to worry
about how to install them there. The TinyDirs program will also cope
with more than one directory. (A friend was running a new copy of
TinyDirs each time he wanted a new directory installed.) If you just
drag the icon for the directory you want installed onto one of those
already there it will be added to the list. Andrew Ling.
3.7
Å Turkish Éiæ Ö There is a minute error in the char-acter set supplied
as öLatin3ò on the Archimedes which, according to Acornæs manual,
corresponds to ISO 8859/3 covering German, Spanish, Turkish etc.
Character 185 is supposed to be the Turkish lower case Éiæ, i.e. like
the English Éiæ but without the dot. (The Mac has let me down for once Ö
no Turkish Éiæ! Ed.) Instead, it replicates the standard Latin Éiæ.
3.7
To overcome this, insert the following in a boot file:
3.7
*echo <23><185><0><0><56><24><24>
3.7
<24><60><0>
3.7
John Morgan
3.7
Å Working on a 1Mbyte machine Ö When loading applications within the
desktop especially on a 1Mb machine, always call up the task display and
reduce the size of the next slot to as low as the machine will allow,
some applications will allow you to set it to 8k and they will just grab
as much memory as they need, however some will report ÉApp need XXXk to
startæ so change the slot to about XXX+20k for workspace. If you do this
then the application can only grab as much memory as it needs. However,
if you leave say 640k in the next and you click on an application then
its likely that the application will grab about 600k or so leaving
precious little for other programs, data etc Users of 2Mb+ machines
donæt have the problem, but they still need to be careful of memory
grabbing applications! Graham Bisset
3.7