home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Archive Magazine 1997
/
ARCHIVE_97.iso
/
text
/
hints
/
vol_06
/
issue01
next >
Wrap
Text File
|
1995-02-16
|
22KB
|
574 lines
Hints and Tips
6.1
Å Alt characters Ö On upgrading from RISC-OS 2 to RISC-OS 3.1, I thought
I had lost my É╫æ character. I eventually found that it had moved from
<alt-,> to <shift-alt-,>. (Even on RISC-OS 3.0 on the A5000 it is still
<alt-,>.) So I investigated all the possible ALTernatives(!). Here are
all the ALT characters I found. They are laid out in QWERTY order but
where no special character appeared, the key is not included in the
list.
6.1
key ALT shift ALT
6.1
` ¼ ░
6.1
1 ╣ í
6.1
2 ▓
6.1
3 │
6.1
4 ╝
6.1
5 ╜
6.1
6 ╛
6.1
9 ▒
6.1
r ╢ «
6.1
y Ñ
6.1
o ° ╪
6.1
p ■ ▐
6.1
\ ª
6.1
a µ ╞
6.1
s ▀ º
6.1
d ≡ ╨
6.1
f ¬
6.1
z ½
6.1
x ╗
6.1
c ó ⌐
6.1
m ╡ ║
6.1
, ╫
6.1
. ≈
6.1
/ ┐
6.1
I think that is all there is, but if anyone finds any more, let us know.
Ed.
6.1
Å Annual service kit Ö In answer to Paulæs comment about hard drives in
Archive 5.12, p.8, Iæd like to sing the praises of the Alarm application
(on one of the support disks or in ROM on RISC-OS 3). (You will see the
link if you read on! Ed)
6.1
I, too, would have forgotten completely about the annual replacement of
filter and batteries, but for this application (which, thanks to my Boot
file, always resides on the iconbar): When my machine was a year old,
Alarm reminded me of this fact in no uncertain terms, (Éurgentæ alarm,
repeating every hour), so there was very little chance of overlooking
this necessary bit of maintenance. Jochen Konietzko, K÷ln, Germany.
6.1
Å Apple Laser Writer II NT Ö Here is some information for anyone wanting
to make a cable link from an Archimedes to an Apple Laser Writer II NT.
The connections are as follows...
6.1
Archimedes LaserWriter II NT
6.1
Pin Pin
6.1
2 (RXD) ÖÖÖÖ 3 (TXD)
6.1
3 (TXD) ÖÖÖÖ 2 (RXD)
6.1
5 (0V) ÖÖÖÖ 7 (0V)
6.1
6 (DSR) ÖÖÖÖ 20 (DTR)
6.1
The Archimedes pins DCD (1), DTR (4) and CTS (8) are all linked
together.
6.1
When using a RISC-OS printer driver you should choose the Serial
connection with 9600 baud rate, 8 data bits, no parity and 1 stop bit.
XOn/XOff protocol should also be used.
6.1
Å DDE Pascal Ö Some would-be users of DDE !Pascal (on Careware 17) will
have discovered that it wonæt function in Computer Conceptsæ Compressed
Filing System (CFS), where it generates the error ÉSpecial field not
allowed in filesystem prefix to OS_CLIæ. This means that the command
line interpreter, which is invoked to run the Pascal tool, objects to
some pathname which begins with the prefix ÉCFS#æ. The offending
pathname turns out to be the <Pascal$Dir>.Pascal, as assigned into
Alias$Pascal by the !Run file with the apparent function of enabling the
compiler to be located in the application directory. The remedy is to
comment out the line which assigns Alias$Pascal and move the compiler
(i.e. <Pascal$Dir>.Pascal) to your library. This brings the configura
tion into line with that of the C compiler and other DDE tools and
causes É*Pascalæ commands to be serviced by default from the current
library without any explicit reference to a filesystem.ááMike Kinghan,
Oxford
6.1
Å DDE Pascal (Careware 17) Ö The release of the public-domain Norcroft
Pascal compiler for the Archimedes is potentially extremely useful,
since, although ISO-Pascal is very good, it does not interface well with
the operating system. More seriously, programs compiled with ISO-Pascal
do not interface well either.
6.1
The Norcroft system is easy to use and install and does everything that
is claimed of it. Unfortunately, users should be aware of some problems,
especially since Acorn obviously does not wish to maintain the product.
6.1
I have some extra severe tests for Pascal, which I have used to test the
compiler. This shows that the compiler has some errors in the evaluation
of set expressions: the following program failed (printing True rather
than False):
6.1
{4 5 6 4 0 3 3000 }
6.1
{the parameters from the full test which failed. }
6.1
program test (output);
6.1
const
6.1
ten = 10;
6.1
var
6.1
i: 1..ten;
6.1
begin
6.1
i := 11; (compilation error here?)
6.1
i := ten + 1; (compilation error here?)
6.1
writeln(ÉError not detectedÉ) ;
6.1
end.
6.1
The first error is caught at compile-time by almost all Pascal com
pilers, including ISO-Pascal. The second error is caught by almost all
compilers at run-time, and a few at compile-time.
6.1
When using the quit option in the Pascal menu, the system still allows
command line usage of Norcroft Pascal, although the icon is removed.
6.1
The final significant problem is that programs written in ISO-Pascal do
not necessarily compile without the ISO option being set. This is
annoying, since many programs will wish to use some extensions. I donæt
know of any other Pascal compiler for which the extension option means
less (in some cases). áBrian Wichmann, NPL.
6.1
Å Directory size Ö Regarding the issue on directory sizes, etc in the
hints & tips section, there are a few other points...
6.1
RISC-OS 2 has some problems with certain combinations of disk size and
allocation unit, so beware. The problem usually causes the machine to
hang when entering a directory. I have only experienced this using large
allocation units on small disks.
6.1
The fact that a new dir appears to take 38Kb isnæt the whole story, as I
believe that there is a facility for small files within a directory to
use some of the Éwastedæ space. However, if you tend to have lots of
directories with few files, space does tend to get wasted.
6.1
The best solution as far as both disk, space and speed is concerned is
to use D format, which uses the Écorrectæ amount of space for direc
tories and hardly anything for the map. (Remember that there are two
copies of the map in E format.) D format disks are also MUCH easier to
recover files from if the root directory or map gets corrupted and files
can never be fragmented (which slows down access). The only disadvantage
is the occasional need to compact but I find this a small price to pay.
I would only recommend E format for non-technical users.
6.1
The same issues will apply to all FireCore based filling systems such as
IDE, etc. áMike Harrison
6.1
Å Impression/Squirrel Ö CCæs !Importer (also in their Business Supple
ment) is supplied by Digital Services with Squirrel. Here is some
experience that might help other people.
6.1
Using Squirrel, I created a database with 22 fields. I then tried to
mail merge the resultant report CSV file using !Importer. I got an error
message saying ÉSubscript out of range (Code 6150).æ After some hours of
fiddling, I eventually found that if I reduced the number of fields in
the CSV file to 16, !Importer worked OK. Nick Horn, Thetford.
6.1
Å Second internal hard drive in an A410/1 Ö I fitted a 40Mb ST506 hard
drive to my A410, thinking it would be more than adequate. However, with
the acquisition of the PC Emulator and the formation of a 10Mb DOS
partition, I was rapidly running out of room. I subsequently purchased a
second hand 20Mb ST506 drive, which I decided to fit internally rather
than buy a p.s.u., case and fan. I thought of making some mounting
brackets but, having seen an advert for a SPACE kit from PRES which
included brackets and all the leads, I changed my mind and went for
that. Price was ú38.72 inc VAT. The work involved was to:
6.1
1) Remove top two podule blanking plates.
6.1
2) Fit metal brackets to drive using screws supplied.
6.1
3) Remove the 34 way data cable and replace it with the one supplied,
connecting it to the existing drive and mother board (SK11), leaving
spare connector to connect to the second drive later.
6.1
4) Connect the supplied 20 way control cable to the spare connector
(SK8) on the mother board, leaving the other end to be connected to the
second drive later.
6.1
5) Remove the power cable from the psu and existing drive and replace
it with the supplied cable, leaving the spare connector for the second
drive.
6.1
6) Lead all three cables to the back of the computer and through the
space left by removing the blanking plates and connect them to the
second drive.
6.1
7) Attach the blanking plates to the metal brackets on the second
drive using nuts & bolts supplied.
6.1
8) Ensure second drive is set to É1æ by changing the appropriate DIP
switch or DS-Jumper.
6.1
9) Insert the drive through the back of computer until the front of
the brackets rests on backplane connectors (psu side) and the blanking
plates line up with the back of the computer. Screw in blanking plate
screws.
6.1
10) Once computer is up and running it will have to be configured for
a second hard drive.
6.1
The work was very easy to carry out and the instructions supplied were
very good. The drive then has to be formatted using Acornæs HFORM
program. The program had to be modified to do the Éslowæ formatting by
altering the following lines:
6.1
7530 REMmed out
6.1
7540 REMmed out
6.1
7550 REM removed
6.1
7560 REM remove
6.1
Once this was done, the drive formatted with no problems and, using the
PC Emulatoræs configure program, I created a 19 Mb DOS partition.
6.1
I would recommend this solution of gaining extra drive capacity if you
have access to a cheap drive and do not mind losing the space of two
half width podules. áChris Bass, Grimsby
6.1
Å Mah Jong from CIS Ö If you have recently purchased the Mah Jong game
from Cambridge International Software, you may wish to check for the
presence of a Ébenignæ virus. This can be done by double-clicking on the
!MahJong game while holding the <shift> key down. Choose the ÉDisplay >
Full Infoæ option on the filer window. If the MemAlloc module is larger
that 2608 bytes then your copy is infected and you should contact CIS
directly at Unit 2a, Essex Road, London N1á3QP or telephone
071Ö226Ö3340.
6.1
Å Measuring free space Ö I would like to say a big thank you to all the
people who wrote in response to my plea for help in finding a way of
checking, from within a program, whether there is enough space for a
file before it is saved.
6.1
The most ingenious suggestion was to use the following commands:
6.1
*FREE {ram:ccc }
6.1
X=OPENUP(öRAM:CCCò)
6.1
REPEAT B=BGET#X: UNTIL B=ASCö=ò
6.1
REPEAT B=BGET#X
6.1
IF B>47 AND B<58 B$=B$+CHR$B
6.1
UNTIL B=ASCöBò
6.1
*SHUT
6.1
to put the free space in the variable B$.
6.1
Some people pointed me to ÉADFS_FreeSpaceæ (also RamFS_FreeSpace,
SCSIFS_FreeSpace, etc.) which can be used with syntax such as:
6.1
SYS öADFS_FreeSpaceò,Drive$ TO Free%,Largest%.
6.1
The same information was given on page 7 of the Archive 5.12.
6.1
Although all these answers have been very helpful, they have also taught
me a salutary lesson, namely that you have to be very precise when
describing your problem: because, although they have answered the
question (and told me things that I did not know) they havenæt actually
told me what I needed to know!
6.1
What I actually want is a filing system independent way of finding out
whether a file with any given path name can be saved. For instance, if
the user of my program indicates (by dragging an icon to a filer window
or typing into a save box) that he wants to save a file with the path
name ÉXXXFS::$....Filenameæ and if my program knows how long the file
will be, I want my program to be able to find out whether the file will
fit in the specified place, without knowing in advance whether ÉXXXFSæ
stands for ADFS or CFS or SCSIFS or RamFS or whatever. The program also
has to work if a path is not specified and the file is simply to be
saved to the CSD.
6.1
A couple of correspondents have pointed out that there is an SWI called
ÉFileCore_FreeSpaceæ (on page 1021 of the PRM). However, in order to use
this you have to know the Éprivate wordæ of the filing system in
question and, so far as I can see, this SWI can only therefore be called
by a filing system module, which is not much use to a mere mortal
programmer!
6.1
I still, therefore, believe that the only generalised way of doing what
I want is to use syntax like the following :
6.1
X%=OPENOUT(Filename$)
6.1
SYS öXOS_Argsò,6,X%,Length% TO ,,Allocated%
6.1
IF Allocated% >= Length% THEN ... go ahead and save it.
6.1
This is hardly elegant but it seems to work.
6.1
I understand that RISC-OS 3 will include the generalised SWI that I
want. However, this will not be much use, of course, in a program that
is designed to work in RISC-OS 2 as well!á Hugh Eagle, Horsham
6.1
Å Formatting numbers (continued) Ö Over the last two months, I have been
following the correspondence on Basicæs number formatting ability (PRINT
and STR$) with some interest. Has the increased size and complexity of
RISC-OS caused the oversight of some of the slightly esoteric but very
powerful features of BBC Basic? One such feature is the @% variable in
Basic. The @% variable controls the format of the PRINT and STR$
functions and much of last monthæs discussions could have been settled
by altering the @% variable so that STR$ was formatted in the same way
as PRINT.
6.1
@% is fully discussed in the manuals that accompany the computer under
the PRINT command but I will try to give some useful pointers here. As
with all Basic integers, the @% variable is four bytes long. When Byte 4
(the left-most byte) is zero Basic ignores @% when using the STR$
function (this is the default and the source of last monthæs problems)
otherwise STR$ is formatted exactly the same as PRINT. Byte 3 allows the
choice of three different formatting types: 0 Ö general (the default), 1
Ö exponent and 2 Ö fixed. Byte 2 specifies the number of digits printed
and Byte 1 gives the print field width when you use comma separators in
PRINT.
6.1
Our problem arises from two areas: the way computers represent numbers
and the value of @%. At this point, I think it is necessary to take an
aside into the nature of real number representation in computers so, if
you are only interested in how to circumvent Basicæs printing problems,
skip to the end of this article.
6.1
Common advice to novice programmers is not to use real variables unless
you really have to. Speed and storage reasons are normally given for
simplicity but a far more important reason is that real numbers are not
exact in the same way as integers and they must be treated differently.
A classic example is the problem in mathematics of dealing with two
representations of, say, the number one: which could be 1.000... or
0.999.... As far as we are concerned both are the same but if we ask a
computer whether or not they are equal, we find not. This is due to no
fault of the computer or the programmer but the acceptance that
computers cannot store the infinite expressions for real numbers but
must approximate to a number of decimal places and so springs up the
subject of numerical analysis.
6.1
How then do we equate real numbers? Well, we must choose a value for a
zero! That is a number where any number smaller than it we consider to
be Éas good as zeroæ. An example for Basic is 10Ö7, any smaller and the
errors in calculations become significant. So when we want to check
equality of two numbers a and b we use the expression (ABS(a¡b)á<á1E-7).
If this is true then the two numbers are Éas good as equalæ. (ABS is
used since we are only interested in the magnitude of the difference
between the numbers.)
6.1
The second important point with numbers stored in computers is that they
are stored in binary. Yes, of course, you all knew that but fewer people
are aware how computers store fractions. Much like in decimal when we
have a decimal point, computers use a binary point where the digits to
the right of the point have place values 1/2, 1/4, 1/8, etc. In decimal
there is a problem of representing fractions like 1/3 or 1/6 because the
prime factors of 3 or 6 are not divisible by the factors of 10 (2, 5) so
you get infinite decimal expansions for them. In binary, the problem is
greater because there is only one factor of two (unlike two factors of
ten) so even more numbers have infinite representations (this is why
some people advocate using base 12 instead of base 10 for day to day
life Ö it makes mental arithmetic so much easier). This means that
simple decimal numbers like 0.6 have an infinite expansion in binary.
6.1
What has all this got to do with printing numbers in Basic? Well, an
appreciation of what is going on when you store numbers will help you
avoid the pitfalls that last monthæs contributors highlighted. Now that
we are aware that innocuous looking numbers like 2.1 can have infinite
expansions when stored in binary, it becomes clear that 2.1 ╫ 10 may not
equal 21 but, perhaps, 20.99999999!
6.1
Is there anything that we can do about this? Yes, indeed there is. We
can tell Basic to round off the number to nine decimal places instead of
attempting to print 10 which extends the precision beyond the accuracy
(in general Basic is accurate to nine decimal places unless you are
using the floating point version where I believe 19 is the limit but not
having a RISC-OS 3...).
6.1
Now we come back to @%. At default, @% specifies 9 decimal places but it
only affects PRINT and not STR$ which defaults to ten. To alter this,
all we need to do is set the byteá4 flag in @% to one. Try PRINT
STR$(0.6) and then set @% = &0100090A and try again (by the way, &90A is
the default value for @% whereas STR$ uses &A0A if byteá4 is unset).
6.1
If we want to print money then we can set @% to two decimal places by
&0002020A (remember to set byte 4 to one if you want to use STR$). This
has the added bonus of allowing you to print the number rounded off but
still maintain the extra places for further calculations.
6.1
I hope you can now see the power and simplicity of using @%. My only
warning is that if you wish to use several formats in your program, then
either save the previous @% or declare it as a local variable.á Emmet
Spier, Guildford.
6.1
This subject seems to have opened up quite a debate. Emmet has agreed to
edit any comments regarding rounding errors for us and so if your wish
to add to the debate you should write to him directly. Emmet Spier, 6
Parklands Place, Guildford, Surreyá GU1 2PS.
6.1
Å PC keyboards for A4 Ö A word of warning Ö not all PC type keyboards
work on the A4 (or all PCs for that matter!), so take the A4 to the shop
and try before you buy! Reasonable ones can be had for about ú40 at some
computer fairs. Note that non PS/2 type keyboards (with the 5 pin DIN
plug) can be used with an adaptor or by changing the plug. áMike
Harrison
6.1
Å RISC-OS 3 DOS partitions Ö Because DOS filenames (including exten
sions) are in general longer than the maximum length of a valid ADFS
filename (10), it is not always possible to copy or move DOS files from
hard or floppy discs directly to the ADFS.
6.1
The !MultiFS utility as supplied with the PC Emulator solves this by
allowing you to truncate the DOS filename while the translation process
takes place. Another very useful option (which I often use when copying
files from C programs) is to force !MultiFS to handle DOS extensions as
(hierarchical) directories.
6.1
However, when the filetype of a DOS partition on your ADFS hard disc is
set to ÉDOSdiscæ, RISC-OS 3 will display a filer window for the
partition when you try to open the folder, while !MultiFS just ignores
it (i.e. no :C drive on the iconbar.) This is all very nice but RISC-OS
3 doesnæt offer the nice name translation options mentioned above. To
enable !MultiFS to display your DOS partitions, just set their filetype
to Édataæ before you start !MultiFS. Remember to use the command line
and not the filer menu because the latter doesnæt allow you to change
the the filetype of DOSdiscs. I inserted 3 lines for each DOS partition
in the !MultiFS !Run file to swap between ÉDOSdiscæ and Édataæ type
partitions when !MultiFS is started:
6.1
*Filer_CloseDir <PCe$Drive_X>
6.1
*SetType <PCe$Drive_X> Data
6.1
directly after setting the system variable <PCe$Drive_X>, and
6.1
*SetType <PCe$Drive_X> DOSDisc
6.1
at the end of the !Run file (although the comment tells us not to do
so).
6.1
Unfortunately, there are some bugs in !MultiFS: When you copy to a
MultiFS filer window, you must ensure name translation is not set to
hierarchical or you will end up with wildcards (É?æ) in filenames. When
this happens you must use DOS itself to delete the file because RISC-OS
fails to wipe those objects. Another bug appears if you shut down your
system after using !MultiFS. This results in an error report and a task
manager crash.á Paul Groot, Holland.
6.1
Å Saloon Cars Deluxe Ö If you are having problems running Saloon Cars
Deluxe, it may be worth knowing that you must have the Font Manager
installed for it to run.
6.1
Å Shareware 44 (Fortran Friends) update Ö There is a small bug in the
!Fortran77. DesktopF77 program. Line 1400 should read:
6.1
1400 IF INSTR(b$,örrorò) THEN E%+=1
6.1
This allows errors in the code generator part of the compiler to be
detected. Kate Crennell, Oxon.
6.1
Å Zelanites cheat Ö The following program provides a cheat for
Zelanites. It stops the number of lives decreasing below 9. áSteve
Edwards, Stourbridge.
6.1
10áREM >:0.$.hints.zelcheat
6.1
20áREM Archive hints & tips section
6.1
30áREM (c) S.EDWARDS 1992
6.1
40áREM infinite lives for Zelanites
6.1
50áREM ****************************
6.1
60áREM * When you have run the program the game should *
6.1
70áREM * then be run as normal. This time when you dieáá*
6.1
80áREM * you will have not gone down one life but upáá *
6.1
90áREM * to NINE lives, which stay with you for ever.áá*
6.1
100áREM *ááááááááááááááááááááááááá *
6.1
110áREM ****************************
6.1
120á:
6.1
130áDIM store% &400
6.1
140áMODE 0
6.1
150áPROCDisc_op
6.1
160áPRINTÉ********FINISHED********æ
6.1
170áPRINT
6.1
180áPRINTÉ****NOW GET BLASTING****æ
6.1
190áEND
6.1
200á:
6.1
210áDEF PROCDisc_op
6.1
220áPRINT ÉPut !ZELANITE disc into drive 0æ
6.1
230áPRINT Éáááand press a key.æ
6.1
240áA=GET
6.1
250áPRINT ÉLoadingáásector informationæ
6.1
260áSYS ÉADFS_DiscOpæ,0,1,&50400, store%,&400
6.1
270ástore%?&67=&6A:REM Original code =&2A
6.1
280áINPUTÉAre you are ready to make the change ?æ;A$
6.1
290áIF LEFT$(A$,1)=ÉNæ OR LEFT$(A$,1)=Énæ THEN END
6.1
300áIF LEFT$(A$,1)=ÉYæ OR LEFT$(A$,1)=Éyæ THEN
6.1
310áááPRINTÉSaving cheat back to diskæ
6.1
320áááSYS ÉADFS_DiscOpæ,0,2,&50400, store%,&400
6.1
330áENDIF
6.1
340áENDPROCááA