Escolar Documentos
Profissional Documentos
Cultura Documentos
Hello, and
welcome to this,
the first edition
of 2011. it is the
start of our 5th
year, but even so,
I hope Ive still
managed to find bits with
Tandy interest for you
all to enjoy and experiment
with.
It all seems to have gone
very quiet on the Tandy
front over the last few
months. Even on EBay, if
you exclude the buy it
now merchants, theres not
been much up for grabs. A
Model 1 fetched just under
35, as did a Model 100. A
faulty Model 4 didnt even
manage that much!
The website is still
attracting visitors, I
think offering TRS8BIT for
sale on Ebay, as an
advertising ploy, has
helped.
I had a very complimentary
email about the one-liner
planets program in the last
issue. Please keep in touch
In this issue of
TRS8BIT
At the ready
prompt
Random thoughts
on Random
selections
Simulating
Forth
Review of
Ajedit
Time (part1)
TRS8BIT
page 1
at the
ready>
prompt
A couple of Seikosha/Tandy
LPVII clones recently
caught my eye in various
old advertisement. the
first was in the guise of
the Commodore "VIC 20 Dot
Matrix Printer" (with an
optional serial RS232
interface) and the second
had a BBC logo emblazoned
upon it and was called
"Acorn GP80A printer".
Perhaps further possible
sources for ribbon
cartridges. Something else
I'll keep my eye out for on
EBay!
SCRIPSIT UNDER NEWDOS 80V2
One of the many
frustrations experienced
when using Scripsit Is if
you suddenly needed to save
text without knowing which
disk had sufficient free
space! Now, thanks to Byte
6/82 I have found that
Scripsit, under ND80, you
can use the 'DFG' keys to
call up the Mini-Dos and
then do a 'free' or a
'dip'. Type MDRET and you
are back with your Scripsit
program.
try
10 P=0:m=10
20 p=p-(p<m)
30 print p;
40 goto 20
every little helps!
And to finish with, here's
a little puzzle to get the
'old grey matter' running.
A certain number ends with
the digit 6. When the 6 is
taken from the end of the
number and placed at the
beginning, a new number is
formed which is 6 times the
original number. What is
the original number. To be
fair, 6 is the easiest
number to find (so I am
told, any one any ideas
why?). If you don't believe
me, try it with 2,3,4,5,7,8
or 9 !
P=0:m=10
p=p+1
if p>m then p=m
print p;
goto 20
TRS8BIT
page 2
TRS8BIT
0o
--== o
page 3
==--
TRS8BIT
page 4
TRS8BIT
page 5
TRS8BIT
page 6
A review of Ajedit
Ken Grey
Before I review Ajedit, I
would like to say something
on the subject of reviewing
programs. It is not an easy
task to review a major piece
of software such as Ajedit
and be certain that you have
covered every aspect, found
any bugs (if they exist) and
highlighted all the
interesting or special
points. There are a number of
reasons for this, firstly you
must be very well acquainted
with the actual program by
having used it for some time
to appreciate the various
points. Secondly, you can not
help forming personal
opinions based on what you
like or dislike about the
program or compare it with
some favourite piece of
software. Lastly, "you can't
please all of the people all
of the time" meaning, what I
think is good in a program,
someone else may not, and
visa versa. Give ten
reviewers the same program
and at the end of the day you
will have ten very different
reviews.
Word processors are becoming
as common place as the
ubiquitous typewriter but
with fewer vices and far more
to offer. They are to be
found everywhere from a Fleet
street newspaper office to
the home computer in the
corner of the living room.
two programs In particular
electric Pencil and Scripsit
have been around for a long
thing
Up to som e with
w
e
n
l
a
i
spec
y?
your Tandin
g us
lett
How about
all know?
TRS8BIT
page 7
TRS8BIT
page 8
TRS8BIT
page 9
TRS8BIT
page 10
TRS8BIT
page 11
TRS8BIT
page 12
TRS8BIT
character.
* Move cursor to end of
line and add more text.
* Find a string in text.
Comments on the Edit mode
There are certainly
advantages in having the
same edit commands as
appear in Basic but, as
most of us know, they do
lack the ease of use that
full screen editing (as in
Pencil for example) gives
the user. There was a
change in release 1.4 to
add another command key to
permit intra-line text
addition as the previous
version did not support
wrap around when doing
text insertion and this
complicates the editing
procedure. Even though
there is a degree of
awkwardness in the edit
mode the text can be
manipulated as required.
One unusual feature is the
"text-tidy" command. This
is necessary when using
the add text with wraparound as there could be a
gap at the end of the line
after the last character
entered. After issuing the
tidy command the text on
screen is neatly sorted
and gives a better idea of
what the final output will
look like. As in the text
enter mode the lack of the
repeat key for cursor
movement is a handicap.
Conclusions
As I said when I started
the review, Ajedit is a
major piece of software
and it is very difficult
to ensure that you do not
miss any important points
during the review. I hope
I have covered the various
commands in not too boring
page 13
0o
--== o
==--
TRS8BIT
Next
the st issu e will
hit
ree ts
June 2 in earl y
011 .
Any
chanc
in a ce you could
ontrib
if it
utio send
s
would Tandy relat n?
e
be mos
t welc d, it
ome
page 14
TRS8BIT
page 15
TRS8BIT
page 16
TRS8BIT
page 17
TRS8BIT
page 18
TRS8BIT
page 19
Trs8bit
Hi everyone, and
welcome to the
June 2011 edition
of TRS8BIT.
Ill start off
with a bit of
very sad news; the recent
death of Rick Hanson, from
club100.org. Our
condolences go to his
family and many friends.
He was a real gentleman
and had worked, supporting
the model 100s since its
inception. Hell be sadly
missed. I hope the website
manages to continue, it
would be a most fitting
tribute to him.
The website is still
attracting interest, which
is most pleasing. the 8K
visit barrier having just
been broken was yet
another mile-stone. 10K is
the next big one! Thank
you, everyone, for your
interest, support and
infectious enthusiasm. Im
still enjoying every
minute of it, even after
30 years!
In this issue of
TRS8BIT
At the ready
prompt
Data storage
Level3 BASIC
review
TRS8BIT
page 1
DATA STORAGE
at the
from an original article by
DS Peckett
ready>
prompt
I noticed that Ira, whilst
sorting though a recent
software donation, came
across a little program
which claims to identify
whether your Model I ROM was
v1.0, 1.1, 1.2, 1.3, or
other. The ROMs out in the
wild are either v1.2 or
v1.3. Does anyone have a
Model I system with v1.0 or
v1.1?? The program is as
follows:
10 REM
PROGRAM TO FIND
VERSION OF MODEL I ROM
20 CLS
30 FOR I=11264 TO 12287
:V=PEEK(I):S=S+V:NEXT I
:X=S/16
40 A=(X-FIX(X))*16
:Y=FIX(X)/16
:B=(Y-FIX(Y))*256
50 V=(A+B)
60 IF V=176 PRINT"ROM 1.0"
: GOTO 100
70 IF V=142 PRINT"ROM 1.1"
: GOTO 100
80 IF V=10 PRINT"ROM 1.2"
: GOTO 100
90 IF V=162 PRINT"ROM 1.3"
: GOTO 100
92 PRINT"VERSION OF ROM
UNKNOWN"
100 END
thing
Up to som e with
w
e
n
l
a
speci
y?
your Tandin
g us
lett
How about
all know?
TRS8BIT
In this article,
I will
take a close look at ways of
using cassette tape more
effectively as a
microcomputer data storage
medium. Although cassettes
are the standard way of
storing data for small
micros, their effective use
is an area which does not
usually received a lot of
attention. Many micro
handbooks are unjustifiably
weak on the topic but, I
shall provided you with a
number of tools which, when
combined, will help you to
solve particular problems.
Since I use a Video Genie,
some of the information will
inevitably be biased to the
Level II BASIC of the Genie
and TRS-80. In some ways,
this may not be such a bad
thing since these computers
are among the worst around
when it comes to effective
data storage; if you know how
to solve their problems, most
other computers should be
pieces of silicon cake!
A good place to start is the
beginning, and in this case
that means looking at just
why cassettes are so widely
used, and at some of their
characteristics.
Cassettes are
used because most
small personal
computers - the
sort you might
have in your home
rather than your
office generally come
with cassette
facilities as standard.
Failing that, the interface
page 2
TRS8BIT
page 3
TRS8BIT
page 4
TRS8BIT
page 5
TRS8BIT
page 6
TRS8BIT
10010 PRINT#1,DT$(I),DT$(I+1),...,
DT$(I+P-1):REM ** SAVE P
ITEMS
10020 NEXT
10030 REM ** CONTINUE
We simply modify the PRINT
# - 1, to include the
correct number of data
items.
That's too easy though.
Let's stick with the
fixed-size data strings,
but assume that the size
is actually fixed by the
program. This means that
we cannot define in
advance the number of
items we will write. That,
in turn, means we cannot
use a multiple-item
statement like that in
line 10010 above, but must
write a single string, as
near to 249 bytes long as
possible, to tape each
time. Listing 1 is a
subroutine to do just that
job. It should be clear
how it works and, like all
these subroutines, it uses
variables beginning with
'Z' as 'local variables'.
If you avoid Z-variables
elsewhere, you can use my
offerings in your own
programs.
The only significant point
to note in the listing is
line 10040, which makes
sure that there are enough
strings left to completely
fill ZA$. If there are
not, it forces a reducedlength final save; in this
way, we avoid trying to
access possibly nonexistent positions in
DT$() at line 10060.
That's good - we are
saving data to tape as
effectively as we can. How
do we get it back again?
Listing 2 is the answer.
Again, the listing should
be fairly clear. Line
11020 extracts the total
page 7
TRS8BIT
page 8
TRS8BIT
page 9
page 10
page 11
TRS8BIT
page 12
TRS8BIT
page 13
be laboriously contrived in
Basic. However, after
Nigel Dibben
watching Level 3 cover the
screen with X's or flash
Level 3 BASIC is written past of it in milliseconds
by the authors of Levels 1
instead of 'maxi' seconds,
and 2 (Bill Gates 0f
you soon appreciate the
Microsoft) and provides
difference.
three broad functions:
The operational system
1. Use of commands that are
changes are a certain
otherwise available only on
improvement especially the
disc : (USR FN, TIMES$ &H,
shift key entries of which
LINETNPUT,MID$ etc)
26 are set by the programme
2. New instructions and
(shift A to shift Z) These
commands for graphics and
can all be changed by the
for Basic
user so that
renumbering,
for example:
RS232 output
LSET C= "CONT"
etc.
+ CHR$(13)
3. Improved
will mean that
operating;
every time
system with
shift C is
reduced LOAD
pressed, the
problems,
word CONT will
single key
appear and the
word entry,
computer will
keyboard
continue.
debounce, long
Interestingly,
error messages
one can make
Next i
and reset via
will hssue of TRS8
up graphic
in eait the streeBIT
BREAK.
words in this
rly Se
ts
p
way. For
2011. tem ber
To the user,
Any ch
example:
ance
in a c you could
especially
LSET A=
o
s
ntribu
end
if it
ti
s
with an
CHR$(191)+
would Tandy relaton?
e
be mos
t welc d, it
expansion
CHR$(140)
ome
interface, the
+CHR$(191)
additional
will display
commands mean
and assign:
that some of
whenever
the facilities
shift A is
otherwise
pressed. Reset
restricted to
through BREAK
disc only are available at a means that tapes can be
fraction of the cost. These
stopped during load and save
commands are as listed on
operations. Thus, an
page 104 of the reference
incorrect tape can be
manual. This is particularly stopped loading with the
true in the case of TIMES$
interface, the use of BREAK
which is physically present
does not lose the BASIC
in the expansion interface
programme - a thoroughly
but unattainable to the non- useful niece of software
disc-owner. The graphic
commands that are new to
To look on the other side,
Basic do not fundamentally
there are naturally some
do anything that could not
disadvantages: the first is
LEVEL 3 review
TRS8BIT
page 14
0o
--== o
TRS8BIT
by for now
Dusty
==--
page 15
TRS8BIT
page 16
Trs8bit
Welcome
t0 the
September 2011
edition!
Once again, I
have to start off
an edition of
TRS8BIT with sad
news. It is with much
regret I have to inform
you all of the death of
Roy T Beck. Roy was best
know to most of us in the
U.K. through his many
expert articles produced
for TRSTIMES, in the
1990s. Our condolences go
to his family and many
friends.
What a summer this has
been for anyone in the
trs-80 world. Prices on
Ebay, UK, seem to have
gone ballistic in every
sense of the word! Model
1s and Video Genies
fetching over 300. also,
see Ian Mavrics article
on page 2, a non-working
model 1 in Australia,
fetching over $A450!
I find it rather sad, and
hope that our interests
In this issue of
TRS8BIT
At the ready prompt
In Mavs Workshop
Accel 3 upgrades
Line editing
Working with
trs-80s
TRS8BIT
page 1
IN MAV'S WORKSHOP
by
at the
Ian Mavric
ready>
prompt
Tonec's Model 1s
Tone-Lc's
2)
0o
--== o
TRS8BIT
==--
page 2
TRS8BIT
page 3
TRS8BIT
page 4
References:
1. eBay Item # 120721832836
2. eBay Item # 120721835018
3. TRS-80 Micro Computer
Technical Reference Handbook
(RS Cat. No. 269-2103) page
26 "RAM Addressing"
4. TRS-80 Micro Computer
Technical Reference Handbook
(RS Cat. No. 269-2103) pages
21-22 "ROM Decoding"
5. The Custom TRS-80 & Other
Mysteries by D.B. Kitsz,
pages 237-238 "A New
Keyboard Cable"
6. TRS-80 Micro Computer
Technical Reference Handbook
(RS Cat. No. 269-2103) page
71 "Spelling Errors"
0o
--== o
==--
Next i
ss
will bue of TRS8BI
issue, e the Xm as T
Decemb o ut ear ly
er 201
1.
Any c
hance
you co
in
if it a contributuld send
s Tand
ion?
y
would
be mos related, it
t welc
ome
TRS8BIT
page 5
ACCEL 3
upgrade improvements
imaginatively named
ACCEL3. The new program is
apparently a complete rewrite of ACCEL2 and
incorporates some new
features.
ACCEL3 will compile non
structured FOR. . NEXT
loops making it possible to
compile programs containing
jumps out of loops,
conditional NEXT
statements and so
forth. ACCEL2
didn't do this
often leading to
changes being
made to a program
before it could
be compiled. The
snag is that the
extra code to
handle
unstructured
loops slows up
compiled programs
- FOR. NEXT
statements used
with the new
compiler are
about half as
fast as they were
under ACCEL2.
Similarly ACCEL3
now compiles
references to arrays with
more than one dimension but
the speed of access to onedimensional arrays has
suffered.
ACCEL3 compiles some functions that ACCEL2 used to
leave for the BASIC
interpreter to handle. In
particular, floating-point
FOR. NEXT loops and
functions such as INT and
SQR are now compiled into
ROM calls. The compilation
of the functions (e.g. SIN,
TRS8BIT
page 6
LINE EDITING
Heres a little
program
for the Level 2 16K fans,
who I regret, have been
somewhat neglected over the
last couple of issues.
Theres quite a bit of
history with this little
program. Yes, it would class
as a one-liner with very
little bother, but Ive left
it as 4 lines, to make it
easier to follow.
Initially, it started out as
a program called Auto Edit
written by Dan Rollins,
which appeared in 80Micro.
It was then patched by John
Couch for NATGUG News and
then simplified, as below.
0o
--== o
==--
TRS8BIT
page 7
TRS8BIT
page 8
TRS8BIT
page 9
thin g
Up to so me ew with
n
r
o
l
a
speci
?
your Tandgy us all
lettin
How about
know?
TRS8BIT
page 10
TRS8BIT
page 11
TRS8BIT
page 12
TRS8BIT
something as simple as
plain curiosity, or
something more structured
for either student projects
or final year degree
students projects, this was
a favourite activity for
me. Final year projects I
remember, included computer
networking & computer
controlled embroidery
equipment. The networking
one, involved connecting
three TRS80s together using
the simplistic RS232
interface we provided at
the walls socket. The
"switch" was a simple
passive setup using diodes.
The three TRS80s acted as
file server, workstation &
print server respectively,
so that besides writing the
basic drivers for the
computers, collision &
control software had to be
developed, to route the
data successfully between
the systems. The computer
controlled embroidery
equipment project came
about from a local
businessman, He
manufactured embroidered tshirts, tabards & jackets
for clubs & businesses.
The problem was that the
embroidery machines were
controlled by punched paper
tape, & was expensive, I
seem to recall that a new,
10 character name tape cost
400 to produce, & a
replacement tape was nearly
as costly.
The first thing to do was
to copy tapes, which was
done on a type33 teletype we had a number knocking
around, & they were on the
"to be disposed of" list,
eventually, they all went
to good homes, I used one
as a printer for a while.
The next thing was to see
page 13
TRS8BIT
page 14
0o
--== o
TRS8BIT
==--
page 15
TRS8BIT
page 16
Trs8bit
First and foremost
Dee and I would
like to wish you
all a very Merry
Christmas and a
Happy New Year.
Year
Many thanks for
your interest,
support and
encouragement with
trs8bit and the website over
the last 5 years. We had
over 90 download of the June
edition of the newsletter,
an all time record!
Quite out of the Blue, I had
a phone call from Leighton
Davies. (He was the M1
librarian for many years).
It was great to hear from
him. It must be 20 odd year
that we last met up. He has
a large amount of Tandy
equipment which he is
putting up for sale on Ebay.
Keep an eye out, theres a
M2, M12 and a M16 (with all
the bits attached) that
should be appearing in the
next few months.
In this issue of
TRS8BIT
At the READY > prompt
Extra terrestrial messages?
Twin Prime clusters
The annual
Xmas print out
In Mavs workshop
Cryptography
TRS8BIT
page 1
at the
ready>
prompt
Here's a little
snippet to extract the
individual digits in a
three character number
without using any string
functions.
for example, this will
place the individual
characters of the number
864 into the variables
b(1), b(2) and b(3).
10
20
30
40
50
a=864
b(1)=int(a/100)
B(2)=int(a/10)-b(1)
b(3)=A-b(1)*100-b(2)*10
print b(1);b(2);b(3)
TRS8BIT
Extra Terrestrial
Messages?
E.T. Fonhume
hello dusty,
heres an
amazing discovery which I
thought other TRS8BIT readers
might be interested in!!
consider the message
"GREETINGS EARTHLINGS" ...
if you convert the letters
into morse code you get
GREETINGS
dash dash dot
dot dash dot
dot
dot
dash
dot dot
dash dot
dash dash dot
dot dot dot
EARTHLINGS
dot
dot dash
dot dash dot
dash
dot dot dot dot
dot dash dot dot
dot dot
dash dot
dash dash dot
dot dot dot
take dot to be "zero" and
dash to be "one" the morse
code representation gives the
binary numbers
page 2
GREETINGS
110 010 0
110 000
00
10
Introduction to Twin
Prime Clusters
Roger Hargrave
EARTHLINGS
0 01 010 1 0000
00 10 110 000
0100
TRS8BIT
People have
been
fascinated by primes integer numbers greater
than 1 which are only
divisible by themselves and
1 - since the days of
Ancient Greece. Euclid
proved that their number is
infinite, and over the
years mathematicians have
discovered and proved that
ever larger numbers are
prime. From time to time
the media report that
another, bigger example has
been found and proved to be
prime, using large
computers and sophisticated
techniques. This has become
an activity way beyond the
expertise and equipment
available to most of us,
and we have to accept the
word of professional
mathematicians that the
record has been broken.
However, there is one
aspect of primes where an
interested amateur can
begin to gain some insight
with the aid of a personal
computer and little more
than the mathematics learnt
at school. This is the
mystery of their
distribution. It is too
much to hope that a general
explanation will be found.
That has eluded the best
brains tackling the problem
over more than two
millennia. Nevertheless,
there are certain
symmetrical groupings of
primes whose analysis can
elucidate, not a general
rule or formula that will
invariably produce examples
of such groups, but at
least some of the
conditions which must be
met for such examples to
exist.
page 3
Twin primes
TRS8BIT
page 4
TRS8BIT
page 5
TRS8BIT
page 6
TRS8BIT
page 7
TRS8BIT
page 8
TRS8BIT
page 9
IN MAVS WORKSHOP
by Ian Mavric
BUILDING THE SUPER MICRO PART 1
Project starts
The Model 4 was in very sad shape when I dug it out
earlier this year. It wouldnt even power up, and I found
the power switch had corroded internally and needed to be
disassembled, cleaned and re-assembled (see pic). Then
the power supply started smoking from the MKT Caps
immediately, the picture was shaky on the CRT, the disk
drives didnt want to spin, and it didnt respond to
keyboard input. In short, its not unlike most Model IIIs
and 4s you find on eBay which the seller states worked
fine when put away.
I continued with a complete disassembly and replaced the
MKT Caps on the power supply (C1, C2 and C13 on the 65W
Astec 120/240V supply2), as well as removing the HT video
board and keyboard. The HT video board needed its (solder
covered) contacts cleaned, but at the same time since it
was out I re-soldered all joints, as these have been known
TRS8BIT
page 10
TRS8BIT
page 11
3.
http://home.online.no/ kr-lund/repair.ht
4.
http://www.jaycar.com.au/
TRS8BIT
page 12
TRS8BIT
page 13
TRS8BIT
page 14
ATTENTION!
Radio Shack fans....
Find the computer equipment Tandy no longer sells!
-- COMPUTERS -Model
Model
Model
Model
Model
Tandy
1,
3,
4,
4,
4P,
4D,
$A499
$A495
$A195
$A450
$A495
$A550
-- SOFTWARE -BOOKS
from $A5
MAGAZINES
from $A10
HARDWARE MANUALS (orig) from $A10
AUS TRS-80 NEWSLETTERS CD $A10
* All equipment is guaranteed to be in good
working order
* Equipment is cleaned and tested
* Drives are cleaned and timed as needed
page 15
CRYPTOGRAPHY (Part 1)
By Peter Stone
While I was in the throws of writing my last article,
making use of the back issues of TRS8BIT for some technical
info I needed, I came across a comment written by Dusty that
I'd promised to write an article on cryptography,
specifically the ENIGMA machine. I then realised what my
next article could be based on.
Before we get into the technical things, a few definitions
need clarifying. The word cryptography comes from the
Greek, & can be translated as 'the study of secret writing'.
There are two types of secret writing, codes & ciphers.
Simply put, a code is when words are replaced either by
symbols, or other words. For example, the quick brown fox
could be represented by *&?+ or by the word mountain. A
cipher is when the individual letters in the words, are
replaced by other letters according to some predetermined
key. The problem with a code is that it requires the
distribution of a book showing the correlation between the
symbols & the words. Because of this codes are no longer
used, & these articles will deal solely with ciphers.
The earliest forms of ciphers were transposition types,
which simply rearranged the order of the letters. For
example, hello world could become, orlellohwd. An early
form of cipher known to everyone, is the Caesar cipher, also
known as a monoalphabetic substitution cipher. Use of this
cipher involves shifting the letters by a predetermined
number so a random message seems to appear. A modern
example of this is ROT13, used as a simple way to hide
spoilers & other info on the net from casual reading. In
ROT13 letters are simply moved by 13, so A becomes N & N
becomes A etc.
Solving a Caesar cipher is easy, because all you would have
to do is simply increment the letters by one, on a short
piece of ciphertext, until recognisable text appeared & the
cipher is broken. The weakness of a Caesar cipher was
identified, & eventually overcome by the use of a keyword.
A keyword was chosen, for example, PETER STONE, then
duplicate letters & spaces are removed e.g. PETRSON then
this would be followed by the remaining letters in a
particular order, agreed beforehand by the users, such as;
PETRSONABCDJKLMFGHIQUVWXYZ. This is then linked with an
alphabet & the ciphertext produced.
TRS8BIT
page 16
a b c d e f g h i j k l m n o p q r s t u v w x y z
P E T R S O N A B C D J K L M F G H I Q U V W X Y Z
In the above example, the plaintext is shown in lower case,
& the ciphertext shown in uppercase. This is a convention
that will be followed throughout this article. Using the
above grid, the plaintext message 'the cat sat on the mat',
would be enciphered by first removing all the spaces, so the
plaintext becomes 'thecatsatonthemat', then be converted by
reading the plaintext letter & taking the equivalent
ciphertext letter below it. So the ciphertext becomes
'QASTPQIPQMLQASKPQ'. It must be admitted that using such a
trivial arrangement of the cipher key provides enough clues
to allow an
attempt an
decipherment.
The above technique
was used for a
large period of time.
The next
advancement in the
field of
cryptography, came
from the Islamic
part of the world.
In the year 750,
the golden age of
Islamic
civilisation began,
which required
administration, which
in turn required
secure communication
achieved through
the use of
encryption. It
is recorded that tax
records were
protected through
cryptography.
Further evidence
comes from many
administrative
manuals, such as
the tenth-century
Adab al-Kuttab
('The Secretary's
Manual'). If this had been the only contribution made,
there wouldn't be much more to be said. However, this
golden age produced the science of destroying ciphers,
otherwise known as cryptanalysis, the science of
unscrambling a message without knowing the key.
Although it's not known who first discovered frequency
analysis, Islamic texts certainly made mention of the
technique, & how it could be applied. Basically, the letter
frequency of a language can easily be found by the simple
analysis of a piece of text. A classic example of
deciphering a cipher in this manner, is found in Sir Arthur
Conan-Doyle's short Sherlock Holmes story, 'The Sign of the
Dancing Men'.
The letter frequency commonly used in the English language
is shown below.
TRS8BIT
page 17
a b c d e f g h i j k l m n o p q r s t u v w x y z
F Z B V K I X A Y M E P L S D H J O R G N Q C U T W
G O X B F W T H Q I L A P Z J D E S V Y C R K U H N
For example, two possible cipher alphabets are shown above,
(in uppercase), with the plaintext above them. Let us take
our plaintext message 'the cat sat on the mat', which we saw
was trivial to solve, & encrypt it using the new cipher, by
taking the ciphertext from each of the alphabets
alternately. Again, we remove all the spaces,
'thecatsatonthemat' & the encrypted message becomes
GHKBGGVFYDZGHKPFY. Although my choice of plain text does
give some clues which would help an experienced cryptanalyst
to decrypt the message, GHK being the most obvious, the fact
that 'cat' encrypts to BGG does increase the strength of the
cipher. Although he'd hit on the most significant
breakthrough in encryption for over a thousand years, he
failed to follow it through to a fully formed system of
encryption. Others built on Alberti's work, until Blaise de
Vigenre examined the work of all the others, & built it
into its final form.
TRS8BIT
page 18
Plaintext
a b c d
A A B C D
B B C D E
C C D E F
D D E F G
E E F G H
F F G H I
G G H I J
H H I J K
I I J K L
J J K L M
K K L M N
L L M N O
M M N O P
N N O P Q
O O P Q R
P P Q R S
Q Q R S T
R R S T U
S S T U V
T T U V W
U U V W X
V V W X Y
W W X Y Z
X X Y Z A
Y Y Z A B
Z Z A B C
e
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
A
B
C
D
f
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
A
B
C
D
E
g
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
A
B
C
D
E
F
h
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
A
B
C
D
E
F
G
i
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
A
B
C
D
E
F
G
H
j
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
A
B
C
D
E
F
G
H
I
k
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
A
B
C
D
E
F
G
H
I
J
l
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
A
B
C
D
E
F
G
H
I
J
K
m
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
A
B
C
D
E
F
G
H
I
J
K
L
n
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
A
B
C
D
E
F
G
H
I
J
K
L
M
o
O
P
Q
R
S
T
U
V
W
X
Y
Z
A
B
C
D
E
F
G
H
I
J
K
L
M
N
p
P
Q
R
S
T
U
V
W
X
Y
Z
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
q
Q
R
S
T
U
V
W
X
Y
Z
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
r
R
S
T
U
V
W
X
Y
Z
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
s
S
T
U
V
W
X
Y
Z
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
t
T
U
V
W
X
Y
Z
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
u
U
V
W
X
Y
Z
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
v
V
W
X
Y
Z
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
w
W
X
Y
Z
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
x
X
Y
Z
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
y
Y
Z
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
z
Z
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
TRS8BIT
page 19
t
R
K
h
O
V
e
B
F
c
I
K
a
N
N
t
R
K
s
O
G
a
B
B
t
I
B
o
N
B
n
R
E
t
O
H
h
B
I
e
I
M
m
N
Z
a
R
R
t
O
H
TRS8BIT
page 20
Repeat
ed
sequen
ce
Repeat
spacing
2 3 4 5 6 7 8 9
EFIQ
PSDL
P
WCXY
M
ETRL
95
20
120
X X
X X X X X
1 1 1 1 1 1 1 1 1 1
0 1 2 3 4 5 6 7 8 9
X
X
X
20
X
X
It can be seen from the table that the only key length that
fits is 5. Therefore, if we split the ciphertext into 5
separate columns, they become 5 Ceaser ciphers, & the letter
frequencies can be calculated, which is what Babbage did.
He next analysed a piece of text of the same length, & again
did the frequency analysis. If the peaks & troughs of the
control text, is compared to the peaks & troughs of the
individual Ceaser ciphers, then the shift can be calculated
& the keyword worked out. It is worth reading Simon Singh's
book to see how the it was solved in detail.
If you use the Vigenre grid above to encrypt & decrypt
messages, the first thing that you notice is how intensive
the work is to do. This is a task that is eminently suited
to using a computer to carry out.
Below is a short program that will encipher & decipher a
Vigenre cipher.
10
20
30
40
50
60
100
110
120
140
150
160
'Vigenere Cipher
CLEAR 1000
INPUT "Enter Keyword : ";W$
LW=LEN(W$)
DIM W(LW)
FOR I=1 TO LW:W(I)= ASC (MID$(W$,I,1)) - 65:NEXT
INPUT "<E>ncrypt or <D>ecrypt : ";E$
E=+1:IF E$="D" THEN E=-1
INPUT "Enter Plaintext or Ciphertext, letters only ";C$
P$=""
FOR I =1 TO LEN(C$): X=ASC (MID$ (C$,I,1))-65
Y=(I-1)-LW*INT((I-1)/LW)
TRS8BIT
page 21
170
180
190
200
210
220
230
X=X+E*W(Y+1)
IF X>25 THEN X=X-26
IF X<0 THEN X=X+26
P$=P$+CHR$(X+65)
NEXT I
PRINT P$
END
TRS8BIT
page 22
TRS8BIT
page 23
TRS8BIT
page 24