To: 999 (all members)
From: K6N (Brian Raw)
Subject: Resistor codes
Unless you mind going to Maplin's
and asking for a brown black orange
resistor this program will convert
from colour codes to the more familiar
10K M type codes.
It should be noticed that at no time
are real (floating point) numbers used
in the program, which is the reason
for using this program, since I
intended to convert it into Small 'C'
which does not support real numbers.
Small 'C' so far had defeated me, it
would not compile at all, but after
much reading and countless runs it
actually accepted a short nonsensical
program and compiled it. From there it
was a matter of making small changes
and seeing if it was still o.k. this
was a little like putting a monkey to
a typewriter and eventually getting
Shakespeare out of it, but rest assured
it does get easier as you progress.
The BASIC version is constructed in
the manner of the 'C' version for
comparison.
Quirks of Small 'C'
*******************
printf the 'C' version of PRINT is
much more versatile and you would do
well to standardise your use of it
eg PRINT"hello" is printf("½nhello")
where ½n causes a CR which is fine
until you want to print on the same
line in which case ½n is omitted. Also
when you CLS:PRINT"hello" in BASIC
this behaves as if TAB(0,0); preceeded
it so again in 'C' the first line
printed has ½n omitted.
printf also allows VDU type statements,
but these have to be given as octal
numbers which are taken as signed so
numbers above 277 octal or &7F are
treated as negative which it will not
accept. To get round this for mode 7
displays, assign to a string first.
eg char col[2];
col[0] = 131;
col[1] = 0; end of string marker
printf("½n%shello",col);
If you build your own strings up, the
end of string marker must be included.
Logical AND's , OR's are not supported
eg (exp) && (exp) !! (exp)
instead use bitwise AND's , OR'
eg (exp & exp ! exp)
TRUE in BBC BASIC = -1
TRUE in Small 'C' = 1
This subtle difference causes havoc.
eg BASIC num=c-48+(c>58)*7
which coverts key codes to Hex numbers
becomes in 'C'
num = c - 48 - (c > 58) * 7
Hopefully I will get the other half
of this program, to convert from
numerical to colour codes done for
next time.
Version 2.00 by Steven Flintham (15A) Main differences from version 1.08 Although version 2.00 has been largely
rewritten, so there will be many small
differences, this section attempts to
describe the main improvements over
version 1.08.
Message file corruption
Version 1.08 often corrupted the
message file slightly if an error
occured while trying to save a new or
edited message. It is almost
impossible to prevent these errors
from occuring but version 2.00 has
been changed so that although the
message being saved will be lost, the
message file will not be corrupted.
There is also a new utility, ChckMes,
which can be used in the now hopefully
rarer cases where the message file
does become corrupted. This should
also work on files produced by earlier
versions.
The message editor
Although the keys used have been kept
the same, the message editor has been
rewritten and should now be faster.
Even if it is still too slow, it
should no longer lose characters if
you type too fast for it.
Viewing, editing, deleting and printing existing messages
Instead of stepping through the
messages with the left and right
cursor keys the message you want to
view, edit, delete or print is now
chosen from a menu. This should be
much more convenient, especially for
accessing the later messages in the
file.
Also, scrolling through a long message
when viewing it should now be as fast
as it is when you are reading the
magazine.
Undeleting messages
The undelete facilities have been
improved quite considerably. Instead
of undeleting all the messages and
probably running into the 25 message
limit, you are now asked which
messages you want to undelete.
The earlier versions also made no
distinction between messages deleted
by you and messages deleted
automatically because they had been
replaced by new, edited versions.
Version 2.00 keeps track of why a
message was deleted and undelete
ignores messages which were
automatically deleted.
These two improvements should make
undelete much more useful but you
should still try not to rely on it too
much.
On-line help
The on-line help has not been included
in version 2.00. It was probably not
detailed enough for new users and
unnecessary for experienced users and
removing it has allowed more memory to
be used for other parts of the program.
Version 2.00 by Steven Flintham (15A) Technical information This section provides information
which most users will not need but
which may be of interest. It includes
an explanation of some of the
restrictions imposed by the program.
DFS restrictions
The advice to avoid putting any other
files on the same disc as the messages
when using DFS is given because DFS
cannot shuffle files around on a disc
as ADFS can.
When adding a new message or editing
an old message (which amount to the
same thing), the messaging system
needs to extend the message file. If
there is another file physically
following the message file on the
disc, there may not be enough space
for DFS to extend the message file and
it will give a "Can't extend" error.
Not being able to keep anything else
on the disc is a bit inconvenient -
probably the best solution is to use
two discs (or both sides of one disc)
to prepare your 8BS submissions, one
for messages and one for everything
else, and then copy the contents of
one onto the other when you are ready
to send it off.
If anyone has any suggestions as to
how this limitation can be overcome I
would be pleased to hear them.
ADFS can move files around to prevent
this from happening but if the free
space on the disc becomes too
fragmented then a similar problem may
occur. This is unlikely to occur but
you may like to *COMPACT the disc
regularly.
The message editor
The main limitation of the message
editor is the lack of any form of
automatic paragraph reformatting when
words are inserted and deleted. The
real difficulty is that the editor
allows the use of mode 7 control codes
to implement colour and graphics.
This means that any code to reformat
paragraphs would have to try to keep
any control codes inserted in the text
to change the colour and it would
ideally also have to avoid distorting
any graphics in the message.
Tidying the messages
To understand why tidying the messages
is necessary, an explanation of the
message file format is necessary.
Because messages vary considerably in
length, allowing each one a fixed
amount of space in the message file
would be very wasteful. Each message
can be up to 4K long, so this amount
of space would have to be left in the
file for every message, even if it
really only took up a few bytes.
To save space, each message is stored
using exactly the right amount of
space. This means that when a message
is edited, it cannot be saved back to
the same place in the file.
If it was then smaller, then the rest
of the messages in the file would have
to be moved 'down' so that they all
followed it. Similarly, if it was then
larger, the rest of the messages would
have to be moved 'up' so that it had
enough space.
Instead, the new version of the
message is saved at the end of the
file and the old version is marked to
tell the program to ignore it. This
means that it is effectively deleted
but it still takes up space in the
file.
If fixed size messages were used then
when a message was edited, it could be
saved over the old version of itself
as it would be guaranteed to fit,
avoiding the above problem.
When the file is tidied, a new copy is
made which contains only the messages
which are not being ignored, so that
old versions of edited messages do not
appear in it.
When a message is deleted because you
request it, using D from the message
list, the same method is used and the
message is simply marked to be ignored
rather than being physically removed
from the file. Tidying also removes
these messages, which is why you
cannot undelete after tidying the file.
Using filing systems other than DFS and ADFS
The program is only designed to work
with DFS and ADFS. If you have another
filing system then the program may
work but no guarantees can be given.
Pressing SPACE at the prompt to insert
your submission disc will leave the
current filing system selected.
The file format
If you want to write any utilities
which handle message files (or even
write your own replacement message
creation program!), the file !Mesg has
the following format:
Version byte - 0 at present (see below)
Sender's ID - a three character string
read using BASIC's INPUT #chan%, id$
command
Sender's name - a twenty character
string (padded with spaces at the end)
read using BASIC's INPUT #chan%, name$
command. It may be just spaces if the
sender wishes to remain anonymous.
Number of messages - the number of
messages (not counting deleted
messages) read using BASIC's INPUT
#chan%, num`mesg% command
This is followed by each message, in
the following format:
Destination ID - a three character
string read using BASIC's INPUT
#chan%, id$ command
Deleted flag - a single byte (see
below)
The message itself - pure mode 7
"text" containing control codes and
terminated by a 152 byte
Your program must complain if the
version byte is not zero, as this will
indicate that the file format has
changed. The version byte was zero for
earlier versions of the messaging
system but there is in fact a small
change in the handling of the deleted
flag.
As no-one has, to my knowledge,
written programs to handle the message
files I have changed the format
slightly without changing the version
number for convenience.
This means that if you use earlier
versions of SendMes with files which
have been edited by version 2.00, or
vice versa, you should not use the
undelete option.
The deleted flag can be any of 0, 128
or 255. 0 means that the message is
not deleted. 128 means that the
message has been deleted but that it
should not be considered for
undeletion. This is used for messages
deleted automatically when a message
is edited. 255 means that the message
has been deleted and that it is OK to
undelete it. This is used for messages
deleted at the user's request.
Simple Database.
÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷
By C.J.Richardson.
This database was written as an example
to try and fathom out what was
required by someone that was running a
catalogue. This person had never laid
hands on a computer before and wanted
to simply keep a total of what
customers had spent and how much they
owed. In the event, the whole exercise
was abandoned as the only suitable
software was far too complicated for
the person involved.
It seems a shame to consign the program
to the dustbin. So here it is.
The program is meant to be simple to
operate. Each record has only 3 fields.
Move between records using the right
and left cursor keys. Move between
fields using the up and down cursor
keys.
Enter data by typing when the highlight
bar is over the field you wish to
alter. Finish by pressing RETURN,
typing the maximum allowed for that
field, or pressing a cursor key.
Field 1 is the name and may be 18
characters in length. When 18
characters have been typed, the field
is full. If a further character is
typed, the field will be cleared.
Field 2 is a number field. The maximum
length for this field is 6. Only the
characters 0 to 9 . and - will be
accepted.
Field 3 is also a number field with the
same properties as field 2.
When first run the database will create
a blank record. Further blank records
are created as needed by pressing
the right cursor key. For this reason,
if you are using DFS, you should only
run the database after compacting the
disc or start with a new disc with the
database saved onto it first.
Printout of the data is possible by
pressing @.
End by pressing ESCAPE. This closes the
data and ensures everything is saved to
disc correctly.
Remember, this database is very simple
and therefore very limited.
Important! The program will not run
from a write protected disc due to the
OPENUP command used.
File Name : TotDB
Data File Name: Data