EasyManua.ls Logo

Commodore Plus 4 - Page 331

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...
Interfacing
with
BASIC
319
20
IF]Sr<32THEN10
30
IFN<64THENM=N:G0T0100
40
IPW<96THE]SrM=]Sr-64:G0T0100
50
IPN<128THENM=]Sr-32:G0T0100
60
IP1T<16OTHEW1O
70
IPN<192THE]iTM=lir-64:G0T0100
80
IFW<224THEKrM=]Sr-128:G0T0100
90
IFU<255THE1TM=1T-128:ELSEM=126
100
PIiINTA#
110
PRIWT//I]SrPUT
UPPER
LEFT
CORNER
(X;Yy';:INPUTXl,Yl
120
PRINT^INPUT
LOWER
RIGHT
COBJSTER
(X,Y)7/;:I]SrPUTX2,Y2
130
P0KE216^1:P0KE217,Yl:P0KE218^:2:P0KE219,Y2:
P0KE220,M
140
SYS8192:IFPEEK(221)>127THE1IPRIWT
"ERROR
IN
COORDINATES"
Line-by-Line
Explanation
10
Ask
user
for the
character
to
fill
with,
and
get
one
key.
20-90
Translate
CHR$
code
into
screen
code
for
use
by
the
machine
code
routine.
100
Echo
the
character
back
to
the
user.
110
Ask
for,
and
get,
the
upper
left
coordinate
of area
to
fill.
120
Ask
for,
and
get,
the
lower
right
coordinate
of
area
to
fill.
130
Set
up
the
parameters
in
$D8-$DC
for
the
machine
code
routine.
140
Call
the
machine-language
routine.
Check
for
error
return
($DD
con
tains
$FF),
and
put
out
error
message
if
necessary.
The
machine
code
subroutine
to
process
the
SYS
command
can
be
entered
with
the
machine-language
monitor.
The
subroutine
fills
the
specified
area of
the
screen
with
the
specified
character.
Byte
with
low
two
bits
set.
Initialize
high
byte
of screen
pointer.
Get
upper
left
corner
y-coordinate.
Compare
to
maximum
y
value
(plus
one).
If
greater
than,
or
equal
to,
return
with
error.
Multiply
y-coordinate
by
two.
Multiply
by
two
again.
Add
y-coordinate
to
get
y-coordinate
times
five.
2000
2002
2004
2006
2008
200A
200B
200C
A9
85
A5
C9
B0
0A
0A
65
03
DF
D9
19
52
D9
LDA
STA
LDA
CMP
BCS
ASL
ASL
ADC
#$03
$DF
$D9
#$19
$205C
$D9