EasyManua.ls Logo

Commodore Plus 4 - Page 313

Commodore Plus 4
464 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...
Using
Interrupts
on
the
Plus/4
301
interrupt
status
register
($FF09)
to
1;
if
interrupt
enabled,
bit
7
of
this
register
is
also
set
to
1
and
an
interrupt
occurs.
These
timers
then
continue
to
count
down
from
zero
to
$FFFF
and
from
there
back
to
zero
unless
start
values
are
once
again
stored
for
them.
When
they
reach
zero,
the
process
repeats.
For
interrupts
to
continue
to
occur
properly,
bit
4 or
6
(as
the
case
may
be)
of
the
interrupt
status
register
($FF09)
must
be
cleared
by
storing
a
1
to
it,
after
detecting
a
timer
2
or
3
interrupt.
Example:
This
example
program
uses
timers
2
and
3
to
generate
interrupts.
Each
timer
controls
the
updating
of
a
separate
and
independent
counter
on
the
screen.
The
main
program
reads
the
keyboard
and
outputs
the
characters
to
the
screen.
This
program
illustrates
the
use
of
interrupts
to
update
information
on
a
regular
basis
while
response
to
user
input
is
maintained.
The
keyboard
is
read
using
an
operating
system
ROM
subroutine.
It
expects
the
keyboard
to
have
been
scanned
by
the
normal
operating
system's
raster
interrupt.
Hence,
this
program
maintains
the
system
interrupt
and
jumps
to
the
system
interrupt
service
routine
following
completion
of
the
counter
updates.
Before
executing
this
program,
check
the
default
contents
of
$0314-$0315
with
the
M
(Memory)
command.
The
low
byte
of
the
default
address
for
IRQ
process
ing
is
located
in
$0314
and
the
high
byte
in
$0315.
If
this
address
is
not
$CE0E,
replace
the
$CE0E
at
$2096
in
the
program
with
it.
Disable
interrupts
for
set
up.
Get
low
byte
of
interrupt
routine
address•
Store
in
low
byte
of
interrupt
vector.
Get
high
byte
of
interrupt
routine
address.
Store
in
high
byte
of
interrupt
vector.
Get low
byte
of
start
value
for
timer
two.
Store
in
start
value
register;
stop
timer
two.
Get
low
byte
of
start
value
for
timer
three.
Store
in
start
value
register;
stop
timer
three.
Get
high
byte
of
start
value
for
timer
two.
Store
in
start
value
register;
start
timer
two.
Get
high
byte
of
start
value
for
timer
three.
Store
in
start
value
register;
start
timer
three.
Get
value
with
bits
4
and
6
set
to
1.
Clear
interrupt
status
register
for
timers
two
and
three.
.
2024
A9
52
LDA
#$52
Get
value
with
bits
1,
4,
and
6
set
to
1.
.
2000
.
2001
.
2003
.
2006
.
2008
.
200B
.
200D
.
2010
.
2012
.
2015
.
2017
.
201A
.
201C
.
201F
.
2021
78
A9
8D
A9
8D
A9
8D
A9
8D
A9
8D
A9
8D
A9
8D
42
14
20
15
00
02
00
04
40
03
80
05
50
09
03
03
FF
FF
FF
FF
FF
SEI
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
#$42
$0314
#$20
$0315
#$00
$FF02
#$00
$FF04
#$40
$FF03
#$80
$FF05
#$50
$FF09