EasyManua.ls Logo

Commodore 1541 - Page 56

Commodore 1541
80 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
10.
ASSEMBLY
LANGUAGE
AND
THE
1541
If
you
want
to
use
your
1541
disk
drive
to
manipulate
data
directly
from
assembly
language
you
can
use
the
information
presented
below.
Here
is
a
list
of
subroutines
that
provide
the
start
of
memory
locations
in
each
of
the
Kernal
routines.
These
routines
are
used
in
conjunction
with
the
assembly
language
command
JSR
10
jump
to
thai
subroutine
location
in
memory:
SUBROUTINE
SETLFS
=
SFFBA
;
set
logical,
physical
&.
secondary
addresses
SETNAM
=
SFFBD
;
save
length
&
address
of
filename
OPEN
=
SFFCO
;
open
a
logical
tile
CLOSK
=
SFFC3
;
close
a
logical
file
CHKIN
=
SFFC6
;
open
a
channel
far
input
CT.RCII
-
SFFCC
;
dear
all
channels
BASIN
=
SFFCF
;
get
a
byte
from
a
file
BSOUT
=
SFFD2
;
output
a
character
to
the
screen
For
a
more
complete
description
as to
what
each
routine
does
and
what
parameters
are
passed
lo
and
from
cadi
routine,
see
your
Commodore
64 or
V1C-20
Programmer's
Reference Guide.
Now,
for
a
practical
application
of
the
subroutines
listed
above,
here
is
a
sample
program
using
(hose
routines
to
read
a sequential
file
on
a
disk.
Assume
that
you
have
stored
the
filename
"TEST"
at
SC0O0.
INIT
;
initialise:
LDA
#$04
;
filename
length
LDX
#$00
;
low
byte
of
filename
address
LDV
#$C0
;
high byte
of
filename
address
JSR
SETNAM
;
save
length
&
address
of
filename
LDA
#503
;
logical
address
LDX
#$08
;
device
number
LDY
#500
;
secondary
address
(0
=
read
seq.
file)
JSR
SETLFS
;
set
logical,
physical
&
secondary
addresses
JSR
OPEN
;
open
logical
file
LDX
#$03
;
sei
x-rcgislcr
to
logical
address
JSR
CHKIN
;
open
input
channel
your
program
info
;
get
data
and
print
it
one
byte
at
a
time
JSR
BASIN
;
get
one
byte
BEQ
END
;
if
0
then
end
of
file
or
error
JSR
BSOUT
;
output
character
to
the
screen
JMP
jour
prog,
info
;
loop
END
LDA
#503
;
set
accumulator
to
logical
address
JSR
CLOSE
;
close
Hie
JSR
CLRCH
;
clear
channels
and
reset
defaults
RTS
;
end
of
assembly
language
program
SO

Other manuals for Commodore 1541

Related product manuals