Block Execute - Commodore 1541 User Manual

Hide thumbs Also See for 1541:
Table of Contents

Advertisement

FORMAT FOR THE MEMORY-WRITE COMMAND:
PRINT# 15,'
'
M-W' 'CHR$(
<address)CHR$(>address)CHR$
(#of
bytes)CHR$(data byte(s))
where
"<address" is
the low order part, and
">address"
is the high
order
part
f
address in disk memory to begin writing,
"#
of bytes" is the number of
m
o
the
I
.
h
·11
.
emory
oc.allon.s
t at .w1 be wntten
(from
1-34), and
"data
byte"
is
I
or
more byte
values
to
be
wntt~n
.mto
disk memory, each as a CHR$()
value.
If desired,
a colon(:)
may
follow
M
W wl!hm the quotation marks
.
·
ALTERNATE
FORMAT:
PRINT# 15
,'
'M-W
:' '
CHR$(
<address )CHR$( >address
)CHR$
(#of
bytes)CHR$(data byte(s))
EXAMPLES
:
We
can
use this line to tum
off
the
"bum~s"
w~en
loading DOS-protected
program~
(i.e.,
prog:ams
.
that have been protected
agamst
bemg copied by
creating
and
checking
for
specific
disk errors)
.
PRINT# 15
, "
M-W"CHR$( 106)CHR$(0)CHR$( I
)CHR$(
133)
The following line
can
be used to recover bad sectors,
such
as when an important
file has
been damaged and
cannot
be read normally
.
PRINT# 15,' 1M-W
"
CHR$( I 06)CHR$(0)CHR$( I
)CHR$(3
I)
.
The
above
two
examples
may be
very
useful under some circumstances
.
They
are
the
~q~1valent
of POKE I 06
,
13~
and '.0KE I 06,31 respectively, but in disk memory
,
not
ms1de the
c?mput~r.
As mentioned m the previous
section's
first example, location
106
in
the 1541 d1.sk dnve
signifies
three
separate
activities to the drive, all related to
error
recov.ery ·.BI! 7
(the
high bit), if
set
means no bumps
(don't
thump the drive back to
track
I). Bit 6, if set, means no seeks
.
In that case, the drive won
'
t attempt to read the
half-track
a?<>ve and below the assigned track to see if it can read the data that way
.
The bottom
6
bi!~
are the count of how many times the disk will try to read each sector before and
after
trymg
see~s an~
bumps before giving up. Since 31 is the largest number that
can
be
expressed m 6 bits, that is the maximum number of tries allowed
.
Fro~
this example,
you can see
the value of knowing something about
Peeks,
Pokes,
~nd
machme-language before using direct-access disk
commands,
as well as their
poten-
llal power.
76
~MORY-EXECUTE
Any
routine
in
disk memory, either
in
RAM or ROM, can be executed with the
\fclllory-Execute command. It is the equivalent of the Basic Sys call to a machine
IJll8uage program or subroutine, but works in disk memory instead of within the
com-
p0ter.
f()RMAT FOR THE MEMORY-EXECUTE
COMMAND:
PRINT#15
, ''M-E''CHR$(<address)CHR$(>address)
*'1Cre
"<address"
is the low order part, and
">address" is
the high order part of the
address in disk memory at which execution
is
to begin
.
ALTERNATE FORMAT:
PRINT#
15
,
"M-E:'
'CHR$(
<address)CHRS(>address)
EXAMPLE:
Here
is a Memory-Execute command that does absolutely nothing. The first instruc-
tion it
executes is an RTS, which ends the command:
PRINT#
15,
"M-E"CHR$(88)CHR$(242)
A
more
plausible use for this command would be to artificially trigger an error message
.
Don't
forget to check the error channel, or you'll miss the message:
PRINT#15
,''M-E''CHR$(201)CHR$(239)
However,
most uses require intimate knowledge of the inner workings of the DOS, and
preliminary
setup
with other commands, such as Memory-Write.
BLOCK-EXECUTE
This rarely-used
command
will load a sector containing a machine language routine
into
a memory buffer from diskette, and execute it from the first location within the
buffer,
until a ReTum
from
Subroutine (RTS) instruction ends
the
command.
FORMAT
FOR THE BLOCK-EXECUTE COMMAND:
PRINT#l5
,
"B-E";channel
# ;drive #;track #;sector#
~re
"channel #
"
is
the
channel
number specified when the file
into
which
the
block
\\ill
be loaded was
opened,
"
drive#"
is
the drive number (always 0 on~ 1541), and
"track #"
and
"sector#
"
are
respectively the track and sector numbers
containing
the
desired block
of
data to be loaded into the file buffer and executed there
.
77

Advertisement

Table of Contents
loading

Table of Contents