Sigma AMSTRAD User manual

THE
AMSTRAD
NOTEPAD!
^
ADVANCED
■
s=7
USER
GUIDE
■


THE
AMSTRAD
NOTEPAD
ADVANCED
USER
GUIDE
ROBIN
NIXON
Programs
written
and
documented
by
Chris
Nixon
SIGMA
PRESS
-
Wilmslow,
United
Kingdom
Thi
s
One
5ZSR-LLP-2C3T

Copyright
©,
R.
Nixon
and
C.
Nixon,
1993
All
Rights
Reserved.
No
part
of
this
publication
may
be
reproduced,
stored
in
a
retrieval
system,
or
transmitted
in
any
form
or
by
any
means,
electronic,
mechanical,
photocopying,
recording
or
otherwise,
without
prior
written
permission.
First
published
in
1993
by
Sigma
Press,
1
South
Oak
Lane,
Wilmslow,
Cheshire
SK9
6AR,
England.
British
Library
Cataloguing
in
Publication
Data
A
CIP
catalogue
record
for
this
book
is
available
from
the
British
Library.
ISBN:
1-85058-515-6
Typesetting
and
design
by
Sigma
Press,
Wilmslow
Printed
in
Malta
by
Interprint
Ltd.
Distributed
by
John
Wiley
&
Sons
Ltd.,
Baffins
Lane,
Chichester,
West
Sussex,
England.
Acknowledgement
of
copyright
names
Within
this
book,
various
proprietary
trade
names
and
names
protected
by
copyright
are
mentioned
for
descriptive
purposes.
Full
acknowledgment
is
hereby
made
of
all
such
protection.

PREFACE
At
first
sight
it
might
seem
a
step
backwards and
a
rather
surprising
move
for
Amstrad
to
release
a
64K
Z80-based
'laptop'-type
computer
when
the
market
definitely
looks
like
PC-compatible
is
the
way
to
go,
and
laptops
being
the
fastest
growth
area.
But
maybe
that's
the
point.
There
is
a
large
group
of
people
who
know
that
all
they
need
is
a
cheap,
easy-to-use
and
(as
the
Notepads
proudly
proclaim)
user-friendly
interface
-
without
having
to
learn
about
using
DOS
or
Windows.
Amstrad
are
renowned
for
using
tried
and
tested
formulae,
which
the
Z80
certainly
is
-
just
look
at
how
well
they
did
with
the
PCW
family.
What's
more,
Z80s
are
cheap,
as
are
the
additional
chip
sets
that
go
with
them
and,
because
of
their
low
power
consumption,
you
get
up
to
40
hours
use
out
of
an
NC100
-
about
10
times
more
than
with
most
PC-compatible
laptops.
And
Amstrad
made
a
very
sensible
decision
in
their
choice
of
software.
By
porting
Protext
across
to
it
they
have
a
top-selling
word-processor
also
available
on
a
number
of
platforms,
including
the
Amstrad
CPC
and
PCW,
Archimedes,
Atari
ST,
Amiga
and
PC
compatibles.
In
one
go,
Amstrad
have
a
product
that
can
be
file
compatible
with
just
about every
other
popular
computer.
By
removing
Protext's
command
mode
(well,
not
entirely,
as
you'll
see
later),
they
came
up
with
a
very
simple
system
of
colour-coded
key
combinations
so
that,
no
matter
where you
are
in
the
Notepad,
you
can
move
to
any
other
in-built
application
at
a
key
press.
But,
in
my
opinion,
one
of
the
best
things
to
be
incorporated
was
the
BBC
Basic
ROM
which
allows
you
to
adapt
the
computer
fully
to
your
own
requirements.
And
that
is
what
this
book
concentrates
on.
In
it
you
will
discover
how
you
can
use
BBC
Basic
to
write
applications
to
complement
seamlessly
the
in-built
applications,
with
the
user
never
even
knowing
they
are
in
Basic.
Even
if
you're
not
a
programmer,
the
explanations
of
how
the
Notepad
works
should
interest
you,
but
if
not
a
large
proportion
of
this
book
is
taken
up
with
ready-made

iv
The
Amstrad
Notepad
programs
ready
for
you
to
type
in
and
run.
So,
without
needing
to
know
a
thing
about
programming,
you
can
add
a
writing
style
checker
to
your Notepad,
or
there's
a
full
scientific
calculator,
a
food
additive
database,
a
graphical
world
time
zone
viewer,
a
mortgage
calculator
and
a
whole
lot
more.
For
the
more
technically
minded,
full
details
on
the
Notepad's
firmware
calls,
input/output
ports
and
system
variables
are
provided,
including
how
you
can
make
use
of
them
yourself.
You'll
even
learn
how
to
create
enure
system
applications
to
run
from
a
RAM
card.
Everything
you
need
to
know
in
order
to
do
this
is
in
this
book,
even
down
to
a
fully
working
Z80
disassembler
you
can
type
in
and
use
immediately.
In
fact
this
book
is
packed
with
undocumented
information
about
the
Notepad
(and
even
the
Z80
microprocessor
itself)
that
you
are
unlikely
to
find
anywhere
else.
Along
with
the
comprehensive
index,
you
will
find
it
to
be
a
complete,
one-stop
reference
to
using
and
writing
Notepad
programs,
as
well
as
a
valuable
source
of
additional
software
for
your
Notepad.
Thanks
are
due
to
Mark
Tilley
and
Gavin
Every
at
Arnor
Ltd
(the
programming
team)
as
well
as
to
Cliff
Lawson
the
Notepad
Project
Manager
at
Amstrad
Pic
for
much
of
the
technical
information
that
appears
here.
Because
these
details
came
directly
from
the
programmers
you
can
be
sure
that
they
are
as
accurate
as
possible.
Thanks
also
to
John
Blackburn
for
his
invaluable
assistance
in
the
preparation
of
this
book,
and
to
Richard
Russell, the
author
of
the
Notepad
BBC
Basic
interpreter,
for
his
assistance
with
the
final
manuscript.
Robin
Nixon
To
Julie
and
Naomi

Contents
SECTION
1
-
THE
PROGRAMS
1
THREE
GOLDEN
RULES
2
GET
IT
RIGHT
2
AUTO
3
USING
THE
PROGRAM
3
HOW
IT
WORKS
4
BIOMON.BAS
6
USING
THE
PROGRAM
6
HOW
IT
WORKS
7
CALC.BAS
12
USING
THE
PROGRAM
13
HOW
IT
WORKS
15
CH
ART.B
AS
22
USING
THE
PROGRAM
23
HOW
IT
WORKS
23
COOKIE.BAS
26
USING
THE
PROGRAM
26
HOW
IT
WORKS
27
DEVIL.BAS
33
USING
THE
PROGRAM
34
HOW
IT
WORKS
35
FOOD.BAS
47
USING
THE
PROGRAM
48
HOW
IT
WORKS
49
INKEY.BAS
56
USING
THE
PROGRAM
57
HOW
IT
WORKS
57
MORTGAGE.BAS
58
USING
THE
PROGRAM
59
HOW
IT
WORKS
59

vi
The
Amstrad
Notepad
READYREC.BAS
61
USING
THE
PROGRAM
62
HOW
IT
WORKS
63
SCALES.BAS
68
USING
THE
PROGRAM
69
HOW
IT
WORKS
69
STYLE.BAS
75
USING
THE
PROGRAM
76
HOW
IT
WORKS
77
TIMEZONE.BAS
88
USING
THE
PROGRAM
89
HOW
IT
WORKS
89
ZAP.BAS
100
USING
THE
PROGRAM
101
HOW
IT
WORKS
101
SECTION
2
-
REFERENCE
121
1.
CONTINUED
. . .
FROM
THE
NOTEPAD
MANUAL
122
REGISTER
VARIABLES
126
2.
UNDOCUMENTED
FEATURES
129
TRANSFERRING
BBC
BASIC
PROGRAMS
129
QUICK
MACRO
ASSIGNING
129
LINE
DRAWING
CHARACTERS
130
PAGE
DISPLAY
MODE
130
USING
THE
FILE
SELECTOR
131
PEEKING
ABOUT
131
UNDOCUMENTED
SELF-TEST
133
SAVING
THE
SCREEN
134
3.
WRITING
EXTERNAL
PROGRAMS
145
USING
THE
NOTEPAD'S
LCD
DISPLAY
146
4.
THE
NOTEPAD'S
INPUT/OUTPUT
PORTS
151
5.
THE
JUMPBLOCK
ENTRIES
157
KEYBOARD
FUNCTIONS
158
SCREEN
DISPLAY
FUNCTIONS
160
PARALLEL
AND
SERIAL
PORT
FUNCTIONS
166
CLOCK
FUNCTIONS
169
MEMORY
ALLOCATION
FUNCTIONS
170
FILE
I/O
FUNCTIONS
172
MISCELLANEOUS
FUNCTIONS
178

Advanced
User
Guide
vii
6.
THE
SYSTEM
VARIABLES
182
BBC
BASIC
MAIN
SYSTEM
VARIABLES
185
7.
RECOVERING
FROM
LOCK-OUTS
186
8.
THE
COMPLETE
Z80
INSTRUCTION
SET
188
9.
THE
UNDOCUMENTED
Z80
INSTRUCTIONS
219
SECTION
3
-
APPENDICES
225
APPENDIX
1:
NC100
JUMPBLOCK
ENTRY
POINTS
226
APPENDIX
2:
INPUT/OUTPUT
PORTS
(&0000
-
&00FF)
229
APPENDIX
3:
KEYBOARD
SCAN
CODES
230
APPENDIX
4:
THE
COMPLETE
SET
OF
Z80
INSTRUCTION
CODES.
.
.
232
APPENDIX
5:
NEW
NOTEPAD
MODELS
247
APPENDIX
6:
EXTRAS
248
GET
CONNECTED
WITH
LAPCAT
248
EXPAND
YOUR
NOTEPAD
WITH
A
RAM
CARD
248
ORDER
THE
DISK
OF
THE
BOOK
248
ORDER
FORM
249


SECTION
1
THE
PROGRAMS
Whether
or
not
you
are
a
programmer,
this
collection
of
programs
has
been
designed
to
accompany
the applications
provided
with
your
Notepad.
They
have
been
written
in
such
a
way
that
no
knowledge
of
programming
is
required
to
use
them
and
you
can
call
them
up
by
simply
pressing
[Function]
[B],
so
you
don't
even
need
to
know
any
Basic
commands.
Just
type
in
the
programs,
check
them
and
save
them.
On
the
other
hand,
detailed
descriptions
accompany
every
program
in
this
section,
including
line
by
line
running
commentaries,
descriptions
of
the
functions
and
procedures
used,
and
an
explanation
of
all
the
main
arrays
and
variables.
Using
all
this
information
in
conjunction
with
the
listings
you
will
be
able
to
pick
up
on
the
various
methods
used
and
then
incorporate
any
ideas
you
like
into
your
own
programs.
To
this
end
the variety
of
programs
has
been
kept
as
wide
as
possible
and
a
broad
range
of
programming
styles
and
techniques
have
been
used,
covering
areas
such
as
using
the
built-in
assembler,
handling
strings,
variables
and
arrays,
processing
and
storing
data,
directly
accessing
the
display
RAM,
the
non-standard
Notepad
VDU
codes
and
much
more.
All
the
programs
are
written
in
BBC
Basic
and
some
contain
sections
of
assembly
language
to
achieve
effects
that,
if
written
in
Basic,
wouldn't
be
possible,
would
take
too
much
space
to
write,
or
would
run
unacceptably
slowly.
The
programs
are
self-contained,
and
range
from
a
useful
scientific
calculator
to
a
world
clock
featuring
a
map
of
the
earth.
There's
also
a
version
of
the
classic
game
Towers
of
Hanoi
to
while
away
the
odd
hour,
and
if
you
are
fond
of
writing
you

2
The
Amstrad
Notepad
might
like
to
pass
your
efforts
through
the
compact
style
checker
and
see
how
they
measure
up.
Programmers
may
be
particularly
interested
in
the
assembly
language
routine
that
performs
an
instant
scan
of
the
keyboard,
in
a
similar
fashion
to
BBC
Basic's
negative
INKEY(-n),
(as
opposed
to
Basic's
INKEY
or
INKEY$,
which
can only
return
keys
at
the
speed
of
the
current
keyboard
repeat
rate).
There's
a
full
chart
of
the
Notepad's
character
set
-
useful
for
designing
screen
layouts
or
games,
and
a
complete
Z80
disassembler
so
you
can
delve
into
the
inner
workings
of
other
programs.
THREE
GOLDEN
RULES
There
are
three
Golden
Rules
you
must
bear
in
mind
when
typing
in
program
listings,
and which
you
should
always
follow
in
order
to
prevent
typing
mistakes
-
or
even
crashing
or
erasing
programs.
Golden
Rule
number
one:
Make
sure
you
save
your
work
before
you
try
it
out.
It's
very
tempting
to
type
RUN
every
so
often
to
see
the
effect
so
far,
but
even
if
you
save
the
program
first
you
are
strongly
advised
against
it
-
especially
where
there
is
machine
code
involved,
as
you
could
lock-up
your
Notepad.
Golden
Rule
number
two:
Read
the
listing
carefully.
A
common
error
is
to
confuse
any
of
the
following
for
each
other:
Lower
case
"1"
(lower
L),
"i"
(lower
I)
and
"1"
(one).
Another
common
mistake
is
to
confuse
the
capital
letter
"O"
with
the
number
"0".
Golden
Rule
number
three:
Don't
delete
any
REM
lines
or
lines
containing
just
a
colon
As
a
matter
of
style
most
of
the
programs
in
this
book
avoid
GOTOs
in
the
main
code,
but
all
of
them
contain
at
least
one
ON
ERROR
GOTO
line
(and
listings
from
other
sources
may
make
more
liberal
use
of
GOTOs).
So,
if
any
GOTOs
happen
to
point
at
a
line that
you've
deleted
as
being
unnecessary
you'll
get
into
all
sorts
of
bother.
GET
IT
RIGHT
If
all
else
fails
(or
even
if
you
simply
prefer
not
to
type
in
the
programs),
you
can
order
a
disk
containing
all
the
listings
fully
tested
and
ready
to
run,
along
with
a lead
and
software
to
transfer
them
to
the
Notepad,
using
the
form
in
Appendix
6.
Please
also
remember
that
a
Notepad
without
a
RAM
card
may
only
be
able
to
hold
two
to
three
or
so
small
to
medium
Basic
programs
at
any
one
time.
If
you
really
want
to
make
use
of
your
computer
and
not run
into
memory
storage
problems
you
should
buy
a
RAM
card.
One
such
source
is
also
given
in
Appendix
6.

Advanced
User
Guide
3
AUTO
Menu
system
fiUTO
BIOMON.BRS
CfiLC.BfiS
:hrrt
:
"
":i.Rfip
f23l
494
C
2980
C
5=02=1
93-02-1
93-02-1
2995
C
93-C2-1
_
28
4235
3-02-1
3-02-1
14:28
14:23
14:29
14:29
15:11
_
10DE2.RR
COOKIE.
BAS
DEVIL.
BfiS
EXTERNAL
,
RfiP
FILESEL.RfiP
FILTRRNS.RfiP
FOOD
.
BfiS
ocuments
♦
5536
C
93-02-11
14:29
"
93-02-11
14:30
93-02-11
15:15
93-02-11
15:19
■*
02-11
14:53
02-11
14:30
AUTO,
the
menu
system
for
Basic
programs
This
is
the
first
and
most
important
of
the
programs
because
it
provides
an
easy-to-use
interface for
running
the
other
programs,
without
needing
to
enter
BBC
Basic's
command
mode.
It
works by
taking
advantage
of
a
feature
built
into
Notepad
Basic
which
checks
for
a
file
called
AUTO
whenever
you
enter
Basic
(normally
by
pressing
[Function]
[B]).
If
such
a
file
exists
Basic
proceeds
to
load
and
run
it,
rather
than
just
dropping
into
command
mode.
USING
THE
PROGRAM
Type
in
the
listing
and
save
it
as
AUTO
before
trying
it
out.
Note
that
you
must
NOT
call
it
AUTO.BAS
(although
all
the
other
programs
should use
the
.BAS
extension),
or
the
file
will
not
be
recognised
by
Basic's
initialisation
routines.
It
is
also
essential
that
you
save
the
program
before
running
it
in
case
you
have
made
any
typing
mistakes
and
something
goes
wrong
or,
perhaps,
you
did
type
it
in
correctly
but
accidentally
loaded
in
another
program
while
testing
it.
Once
saved
type:
RUN
and
press
[Return].
You
should
then
see
the
Notepad's
standard
file
selector
which
you
can
now
use
to
call
up
a
program
in
the
same
way
you
might
select
a
file
for
editing
in
the
word
processor.
Because
this
program
prevents
access
to
Basic's
command
mode
you
might
wonder
how
you
are
now
going
to
be
able
to
type
in
more
programs.
The
answer's
simple:
you
can
exit
from
AUTO
at
any
time
by
pressing
[Stop].
You
are
then
dropped
into
command
mode
and,
if
you
want
to
enter
a
new
program,
type:
NEW

4
The
Amstrad
Notepad
and
off
you
go.
Or,
if
you
accidentally
exited
from
AUTO
you
can
get
back
in
by
pressing
[Function]
[B].
HOW
IT
WORKS
The
program
is
described
as
follows,
with
line
numbers on
the
left
and
explanations
on
the
right.
30-40
Clear
memory
and
dimension
A%
so
that
it's
just
big
enough
to
hold
the
machine
code
which
will
be
assembled.
50-60
Assemble
the
code
and
call
it.
70
If
the
first
character
of
the
file
name
is
0
then
there
is
no
file
name
so
print
a
message
and
exit.
80-1
10
Copy
the
file
name
returned
by
the
machine
code
routine
into
the
variable
R$.
120
Check
whether
the
file
name
has
an
extension
of
.BAS.
If
not,
it
is
not
a
Basic
program
(at
least,
not
as
far
as
the
program
is
concerned,
because
the
.BAS
extension
is
the
recommended
method
of
declaring
whether
a
file
is
a
Basic
program).
So,
if
not,
refuse
to
attempt
to
run
it
and
call
the
file
selector
again.
130
Load
the
selected
program
into
memory
(replacing
AUTO)
and
run
it.
160-190
Prepare
for
a
two-pass
assembly
using
a
FOR..
.NEXT
loop
and
set
the
program
point
(P%)
to
the
machine
code
destination
address
at
the
start
of
each
pass.
200
Call
the
Notepad's
built-in
File
selector.
210
Set
the
register
DE
to
point
to
the
start
of
where
the
File
selector
will
have
stored
a
file
name
if
one
was
selected.
220-250
If
the
Carry
flag
is
set
then
no
file
was
selected
because
the
user
pressed
[Stop],
so
set
the
first
byte
of
the
file
name
which
is
to
be
passed
back
to
Basic
(pointed
to
by
DE)
to
a
zero
to
indicate
this,
and
then
return.
270-340
A
file
name
was
selected
so
copy
all
the
characters
in
the
name
to
a
known
location
in
memory
starting
at
'buffer'
and
then
return.
Functions
and
procedures
PROCselect
Assembles
the
machine
code
required
to
call
the
File
selector
and
then
return
the
name
of
any
selected
file
to
a
known
area
of
memory
that
can be
accessed
from
Basic.
Main
variables
and
arrays
A%
22
bytes
of
memory
used
to
hold
the
assembled
machine
code.

Advanced
User
Guide
5
buffer
The
start
of
13
bytes
of
memory
within
A%
which
are
used
to
hold
any
file
names.
R$
Holds
a
copy
of
a
selected
file
name
ready
to
CHAIN
it
in.
J%
Temporary
loop
counter
used
to
control
the
copying
of a
file
name
from
memory
into
the
string
RS.
P%
The
pointer
to
where
machine
code
is
to
be
assembled
by
the
assembler.
found
Start
of
machine
routine
where
a
file
name
has
been
found.
loop
Label
marking
the
start
of
the
machine
code
loop
to
copy
a
file
name
to
a
known
location,
useable
from
Basic.
The
program
10
REM
BBC
Basic
menu
system
20
:
30
CLEAR
40
DIM
A%
22
50
PROCselect
60
CALL A%
70
IF
buffer?0
=
0
THEN
CLS:
PRINT
"Press
[Function]
[B]
for
menu
.
"
:
PRINT
:
END
80
R$=""
90
FOR
J%=0
TO
11
100
IF
buf
fer?J%
THEN
R$=R$+CHR$
(buf
fer?J%)
ELSE
J%=12
110
NEXT
120
IF
RIGHT$(R$,4)
<>
"
.BAS"
THEN
GOTO
60
130
CHAIN
R$
140
:
150
DEF
PROCselect
160
FOR
PASS=0
TO
2
STEP
2
170
P%=A%
180
[
190
OPT
PASS
200
CALL
&B8C3
210
LD
DE,
buffer
220
JR
C,
found
230 LD
A,0
240
LD
(DE)
,
A
250
RET
260
.found
270 LD
B,12
280
.loop
290 LD
A,
(HL)
300
LD
(DE)
,
A
310
INC
HL
320
INC
DE
330
DJNZ
loop
340
RET
350
.buffer
360
]
370
NEXT
380
ENDPROC

6
The
Amstrad
Notepad
BIOMON.BAS
Biorhythm
Monitor
Biorhythm
Monitor
Enter
your
Date
of
Birth
Day
(1-31)
;
|
4*
I
FT
Si
...Uid..'
BIOMON.BAS,
showing
physical,
intellectual
and
emotional
strength
The
study
of
biorhythms
is
based
on
the
ancient
belief
that
our
physical,
intellectual
and
emotional
states
run
in
fixed,
regular
cycles
from
the
day
that
we
are
born.
Whether
you
believe
this
or
not,
it
means
that
we
can
calculate
these
states
for
any
day
of a
person's
life,
given
just
their
date
of
birth
and
today's
date.
And
as
the
cycles
are
regular,
they
lend
themselves
to
rather
attractive
looking
sine
wave
charts,
which
used
to
be
hand-drawn
by
astrologists
in
the
days
before
computers.
However,
this
is
extremely
time
consuming,
and
as
the
formulae
for
calculating
the
number
of days
that
lie
between
a
person's
birthday
and
any
other
date
are
complex,
they
make
an
ideal
subject
for
a
computer
program
to
handle.
In
fact,
there
probably
isn't
a
computer
in
existence
that
hasn't
had
a
biorhythm
calculator
written
for
it
(as
a
demonstration
of
the
machine's
graphics
capabilities
as
much
as
for
any
other
reason).
The
program
BIOMON.BAS
uses
the
standard
biorhythm
cycles
to
plot
a
personal
chart
for
a
35-day
period
with
today's
date
in
the
middle.
It
differs
slightly
from
other
programs
of
this
type
by
telling
the
user
in
plain
English
what
each
line
on
the
chart
represents,
and
whether
today's
level
is
good
or
bad
for
that
particular
chart
line.
USING
THE
PROGRAM
Type
in
the
listing
and
save
it
as
BIOMON.BAS
before
trying
it
out.
This
is
essential
in
case
you
have
made
any
typing
mistakes
and
something
goes
wrong.
Now
type:
RUN
and
press
[Return]
and
you
will
be
prompted
to
enter
your
date
of
birth.
Type
in
the
day
of
the
month
on
which
you
were
born,
and
press
[Return].
Then
type
in
the
number
of
the
month,
press
[Return],
and
then
enter
the
year
-
you
can
enter
this
either
in
full,
as
in
1964,
or
in
shorthand,
as
in
64.
Don't
forget
to
press [Return]
after

Advanced
User
Guide
7
entering
the
year.
If
you
make
a
mistake
at
any
one
of
these three
stages,
Biomon
will
repeat
that
stage
until
it's
happy
with
the
result.
Biomon
now
makes
a
final,
more
involved
check
to
see
if
the
date
you
have
just
entered
actually
existed.
It
does
this
by
checking
that
the
month
you
have
entered
has
at
least
the
number
of
days
you
have
given
as
the
day
of
the
month
on
which
you
were
born,
and
leap years
are
taken
into
account
at
this
stage.
If
Biomon
finds
an
error
it
will
report
Bad
date
-
press
SPACE,
and
you
will
have
to
re-enter
the
whole
date.
If
all
is
well
with
the
date,
the
screen
will
clear
and
the
plotting
will
begin.
Each
line
is
drawn
with
a
different
dot
pattern,
making
it
easier
to
tell
them
apart.
When
the
plot
is
finished
(it
takes
about
half
a
minute),
the
box
on
the
chart
representing
today's
date
will
be
highlighted
in
inverse,
and
the
window
on
the
left
will
show
a
key
for
each of
the
three
chart
lines
together
with
a
one-word
summary
of
how
good
or
bad
each
one
is
today.
If
you
can't
wait
for
the
full
plot
you
can
cut
it
short
by
pressing
[Q],
which
jumps
straight
to
the
summary
screen
-
useful
if
you're not
interested
in
seeing
the
general
pattern
of
cycles.
HOW
IT
WORKS
40
Points
the
Basic
error
handler
to
Biomon's
own
error
handling
routine
at
line
940.
Calls
PROCsetup
to
initialise
everything.
Calls
PROCinput
to
get a
birth
date,
followed
by
PROCdays
to
count
the
number
of
days
that
have
elapsed.
Then
calls
PROCgraph
to
plot
the
chart,
and
finally
PROCreport
to
summarise
the
current
state
of each
chart
line.
50
60
90-130
Initialise
the
main
graphics
constants.
Altering
these
values
will
have
a
major
effect
on
the
resulting
chart.
Dimension
all
arrays
and
read
in
all
the
data.
Draws
a
box
enclosing
the
entire
screen
area.
Draws
a
vertical line
to
separate
the
graph
area
from
the
information
window.
Prints
the
program
title.
Calls
the
date
prompt
window
into
operation
and
returns
from
the
procedure.
Flushes
the
keyboard
buffer
by
calling
INKEY$(0)
until
no
keys
are
returned.
Prompts
for
the
date
of
birth
to
be
entered.
140-180
190
200
210
220
250
260

8
The
Amstrad
Notepad
270
280
290
300-320
330
340
410
420
430
440^50
460
470-520
560
590-600
610
620-630
640
650
660
690
700
Repeatedly
prompts
for
the
day
of
the
month
until
the
input
is
within
legal
limits.
Repeatedly
prompts
for
the
month
unul
the
input
is
within
legal
limits.
Repeatedly
prompts
for
the
year
until
the
input
is
within
legal
limits.
Check
to
see
if
the
date
specified
exists.
Informs
the
user
if
the
date
doesn't
exist
and
waits
for
the
message
to
be
acknowledged.
Repeats
the
entire
input
process
if
the
date
entered
doesn't
exist.
Extracts
the
current
day
of
the
month
and
the
current
year
from
the
system
clock.
Extracts
the
name
of
the
month
from
the
system
clock
and
converts
it
into
a
number
between
1
and
12,
by
comparing
it
against
each
entry
in
the
array
m$().
Multiplies
the
elapsed
years
by
365
to
get
the
rough
number
of
days
involved.
Adjust
the
days
according
to
the
birth
month
and
current
month.
Adjusts
the
days
further
according
to
the
day
of
the
month
of
birth
and
the
current
day
of
the
month.
Adjust
the
days
further
according
to
the
number
of
leap
days
involved.
Calculates
whether
y%
is
a
leap
year
or
not.
Clear
the
information
box
and
print
the
current
date,
together
with
the
birthdate
being
plotted,
in
preparation
for
the
plot.
Sets
up
a
graphics
window
and
origin,
and
clears
the
new
graphics
window.
Draw
the
chart
axis,
and
dotted
boxes
to
delimit
each of
the
35
days
to
be
charted.
Sets
the
start
day
to
be
17
days
ago and
starts
the
main
FOR..
.NEXT
loop
for the
X
coordinate,
checking
for
the
[Q]
key
at
the
start
of
each
loop.
If
[Q]
wasn't
pressed,
calls
PROCbio()
inside
a
further
FOR..
.NEXT
loop
to
plot
the
current
Y
position
of
each
line.
Ends
the
main
plot
loop,
inverts
today's
box on
the
chart
and
exits
the
procedure.
Fetches
the
cycle
length
for
the
current
line
and
whether
it
is
in
its
dot
or
dash
phase.
Plots
a
new
point
for
the
current
line
if
it
is
inside
its
dot
phase.

Advanced
User
Guide
9
710
Checks
to
see
if
current
line's
dot
or
dash
phase
has
reversed.
If
so,
flips
the
line's
dot
phase
flag.
720
Stores
the
new
dot
phase
flag
setting
for
the
current
line.
760-830
Draw
a
short
sample
of each
line's
dot
pattern
to
be
used
as
a
key,
during
which
time
a
score
for
each
is
calculated
in
line
810,
representing
an
entry
in
the
array
of
comments
well$().
Display
the
report
header
when
the
loop
is
complete.
840-860
Print
the
name
of
each
cycle,
together
with
a
single-word
comment
from
the
list
held
in
well$0,
pointed
to
by
the
relevant
entry
in
the
score
table
well%()
(which
was
calculated
back
in
line
810).
870
Waits
until
[Space]
is
pressed
before
returning
from
the
procedure.
890
Holds
the
data
for
the
number
of days
in
each
month.
900
Holds
the
names
of each
month,
as
used
in
line
420
to
calculate
the
number
of
the
current
month.
910
Holds
the
cycle
length
in
days
for
each
of
the
three
chart
lines,
followed
by
the
length
of
the
dot
and
dash
for
that
line,
followed
by
the
initial
dot-dash
phase
to
start
with.
920
Holds
the
single-word
comments
which
are
used
at
the
end
of
each
plot
to
summarise
the
state
of
each
chart
line.
940
Points
the
Basic
error
handler
to
a
full
error
report
in
the
event
of
a
further
error
occurring
while
attempting
to
run
the
menu
program
AUTO.
This
is
in
case
AUTO
isn't
present
on
your
Notepad.
950
Attempts
to
run
the
menu
program
AUTO
if
the
error
was
generated
by
pressing
the
[STOP]
key.
960
If
the
error
was
caused
by
something
else,
or
if
AUTO
isn't
on
your
Notepad,
a
full
error
report
is
displayed.
970
After
the error
report
the
Notepad
will
be
left
in
BBC
Basic,
so
this
message
is
displayed
to
remind
users
of
how
to
return
to
the
Notepad
main
menu.
Functions
and
procedures
PROCsetup
Dimensions
arrays
and
reads
in
all
data,
initialises
main
variables
and
draws
a
box.
PROCinput
Prompts
for
the
day,
month
and
year
of
birth.
PROCwinl
Sets
up
a
text
window
for
the
birthdate
prompt.
PROCwin2
Sets
up
a
date
window
for
the
birthdate
input.
PROCdays
Calculates
number
of days
elapsed
since
birth.

10
The
Amstrad
Notepad
PROCgraph
Plots
a
biorhythm
chart
for
the
birthdate
just
entered.
PROCbio
Plots
a
dot
at
the
current
X
coordinate
for
any
of
the three
lines.
Called
by
PROCgraph.
PROCreport
Displays
a
key
for
the
graph
and
a
single-word
summary
for
each
line.
FNleap
Returns
TRUE
or
FALSE
according
to
whether
the
passed
variable
is
a
leap
year.
Main
variables
and
arrays
m%()
Number
of
days
in
each
month.
m$()
Abbreviation
of
month
names.
period%()
Length
of
each
cycle
in
days.
gap%()
Length
of
each
line's
dot
and
dash
in
pixels.
flag%()
Keeps
count
of each
line's
current
dot or
dash
phase.
well%()
Numbers
representing
how
good
or
bad
each
cycle
is
today.
well$()
Store
of
single-word
summaries.
yc%
Y
centre
of
graphic
window.
xc%
X
centre
of
graphic
window.
px%
Number
of
pixels
per
day
horizontally.
xm%
Width
of
graphic
window.
ym%
Height
of
graphic
window.
d%
Number
of days
since
birth,
as
returned
by
PROCdays.
sd%
Number
of
days
since
birth
up
to
15
days
ago
(the
start
of
the
plot).
dl%
Day
of
birth.
ml%
Month
of
birth.
yl%
Year
of
birth.
d2%
Today's
day
of
the
month.
m2%
Today's
month.
m3%
Today's
year.
t%
Number
of
current
line
being
processed
(1,
2
or
3).
quit%
Whether
Q
was
pressed
during
plot.
The
program
10
REM
Biorhythms
20
:
30
CLS
40
ON
ERROR
GOTO
940
50
PROC
setup
Table of contents