Operating instructions

Screen Write/File Routine
Here
is
a routine, both useful and instructive, which
makes it simple
to
Edit the Apple Screen
and
Save the
Screen Image
on
Disk.
B.E. Baxter
6761
King's
Harbor Drive
Rancho Palos Verdes, CA 90274
are:
In summary, the usage
commands
Edit Screen (See APPLE Ref. Materials)
(Escape)
@:
Home
cursor
(Clear text)
A:
Advance cursor
B:
Backspace curĀ·
sor
C:
Move
cursor
down 1 line
then
trace
over the remainder
of
the
line
with
the
right
arrow
to
place it
into
the
keyboard
buffer
and at
the
end
of
the
line
press RETURN.
Although
I
do
not
find
it
necessary, a
monitor
MOVE
to
page 2 could be set up and inserted at
line 225
of
the
source
listing.
This
would
provide back-up in case the BSAVE com-
mand
is
messed up. The
object
code is
assembled
at
$0350 and is $49 bytes
long.
D:
Move
cursor
up
1 line
E:
Clear
from
curĀ·
sor to end
of
line
F:
Clear from cur-
sor
to
end of screen
[l
= typed by user
[BSAVE file namejA$0400,L$03CF[CRl
Of course
it
doesn't
make much
sense
to
idly
write
to
the
screen
without
some useful purpose. I use the routine
to
create
instruction
and
documentation
files. These files are especially valuable
for
object
code
utilities
by providing
ready access
to
usage and entry
point
information.
Once the
file
has been
created, it can be handled
just
like any
other
file. BLOADing (file name) will im-
mediately
display
its
contents
on the
screen
without
requiring any
otherwise
useful
memory.
Instruction/print
statements
in BASIC programs can
therefore be eliminated;
to
be replaced
by deferred execution BLOAD
disk
com-
mands for a very
efficient
use
of
main
memory~
Save Screen
Image
Call 848
$0350G
(Control)
Q
Line 22
User
Automatic
From BASIC
From
Monitor
Exit
to
BASIC Mode
Entry
to
Routine
The source code is
straightforward
and makes liberal use
of
monitor
routines. Upon entry the cursor is homed
and placed on line 1 (not zero). The
block
labeled
KEY
continually
polls
the key-
board and
outputs
characters
through
COUT (VIDOUT [$FBFD)
could
also
be
used
if
printer
services are
not
wanted).
The
limited
editing
facilities
of
the
monitor
are invoked by
typing
(escape)
followed
by one of
the
command
char-
acters. Keyboard entry
of
(control) Q is
used
to
exit
the routine and return
to
BASIC via
$3DO.
Automatic
exit
is
also
obtained
at line
22.
Upon exit,
the
bell
will sound and
the
BASIC
prompt
char-
acter
will
appear
with
the
file
para-
meters displayed at
the
end
of
the
line.
At
this
point
the
file
must
be saved using
the
command,
(BSAVE
File
name)
A$0400, L$03CF (RETURN). The paren-
thetical
eXPressions
must
be typed by
the user;
that
is, type BSAVE
file
name,
The screen
write/file
routine is a
simple
73-byte device
to
take
control
away from the
monitor
and
write
directly
to
the screen. All
of
the
escape
editing
capabilities
are supported,
so
that
it
is
very easy
to
enter and
modify
up
to
and
including
21
lines
of
text.
It
is
equally
easy
to
then save the screen
image
to
disk
after
completion
of
text
entry.
20:30
MICRO
--
The 6502
Journal
January, 1980