EasyManua.ls Logo

Commodore VIC-20 - Page 154

Commodore VIC-20
308 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...
absolute address.
VICMon
allows
you
to
lype
in
an
absolute
address,
and
it
calculates
the
correct
offset.
This
is
just
one
of
the
"comforts11
of
using
an
assembler.
Subroutines
In
machine
language
(in
the
same
way
as
using
BASIC),
you
can
call
subroutines.
The
instruction
to
call
a
subroutine
is
"JSR"
(jump
to
subroutine),
followed
by
the
specified
absolute
address.
Incorporated
in
the
operating
system
is
a
machine
language
subroutine
that
will
PRINT
a
character
to
the
screen.
The
CBM
ASCII
code
of
the
character
should
be
in
the
accumulator
beiore
calling
the
subroutine.
The
address
of 1his
subroutine
ts
SFFD2.
Therefore,
to
print
4'HI"
to
the
screen,
the
following
program
should
be
entered:
•
A
1400
LDA
#S48
load
the
CBM
ASCII
code
of
J'H"
•
A
1402
JSR
SFFD2
print
it
•
A
1405
LDA
#S49
load
the
CBM
ASCII
code
of
T
•
A
1407
JSR
SFFD2
print
that
too
•
A
140A
LDA
#$0D
print
a
carriage
return
as
well
-A
140C
JSR
SFFD2
•
A
140F
BRK
return
to
VICMon.
•
G
1400
will
print
"HI"
and
return
to
VICMon
The "PRINT
a
character1'
routine
we
have
jus1
used
is
part
of
the
KERNAL
J1jump
table."
The
Instruction
similar
to
GOTO
in
BASICr
is
"JMPT
which
means
"jump
to
the
specified
absolute
address/1
The
KERNAL
is
a
long
list
of
"standardized"
subroutines
that
control
ALL
input
and
output
of
the
VIC
20.
Each
entry
in
the
KERNAL
JMP's
to
a
subroutine
in
the
operating
system.
This
"jump
table"
resides
at
SFF84
lo
SFFF5
in
the
operating
system.
A
full
explanation
of
the
KERNAL
is
in
the
"KERNAL
REFERENCE
SECTION1'
in
1his
manual,
but
certain
routines
will
be
used
here
to
show
how
easy,
and
effective,
the
KERNAL
is.
We
will
now
use
these
new
principles
in
another
program
which
will
help
you
to
put
these
instructions
into
context:
This
program
will
display
the
alphabet
using
a
KERNAL
routine.
The
only
new
instruction
introduced
here
is
TXA
"transfer
the
contents
of
the
X
index
register,
into
the
accumulator."
•
A
1400
LDX
#S41
X-CBM
ASCII
of
"A".
•A
1402
TXA A=X.
•
A
1403
JSR SFFD2
print
character.
•
A
1406
INX
bump
count.
•
A
1407
CPX
#S51
have
we
gone
past
"Z"
?
138

Other manuals for Commodore VIC-20

Related product manuals