Character
Definition
This
prOgTam allows you to define special
graphics
characters
using
the computer. An
8 X 8 grid is displayed
on
the screen.
You
then
choose which "dots"
to
turn
on
and which to leave
turned
off. After
the
character
has
been
designed, the
program
determines
and
displays the
HEX
string
to be
entered
in the
CALL
CHAR
statement.
These
statements
define the
off
dot
character
(line 120)
and
the
on
dot
character
(line 130).
Black
is
used
as
the foreground color (on
dot)
and
white
is
used
as
the
background
color
(off
dot).
The
screen
is then cleared
and
the labels needed on the
screen
are
displayed
at
the necessary locations.
Note
that
the
subroutine
beginning
at
line
770 is used to print a
string
horizontally on the
screen
and
the
subroutine
beginning
at
line
820
is used to print a
string
vertically
on the screen.
The
R-Ioop is
used
to place the 8 X Hgrid (all dots
turned
off)
on the screen.
This
loop allows you to
turn
the "dots"
either
on or off. To turn a
dot
on,
press
the
1 key. To leave a
dot
turned
off.
press
the 0 key.
The
cursor
slalls
ill tile ulJlJer
Idt
corner
(row
1.
column
1)
of the
grid.
Each
time you
press
a key. the dot is turned on
or
off
and
the
cursor
moves
to
the next position. When
the
end
of
a
row
is
reached. the
cursor
automatically moves
to
the
next
row. When the
last
"dot"
is
turned on
or
off. the
program
continues
to
determine
the
HEX
string,
Line
430
performs a logical OR.
If
the
key
you
pressed
was
not a zero
or
a one, the progTam transfers
back
to
line
370
to
accept
a
new
key
input.
Errors
in the grid
can
be
corrected
before
the
last dot (row 8. column
8)
is
entered
by
using the
LEFT
arrow
and
RIGHT
arrow
keys.
If
either
of
these
keys
is pressed,
then
the
program
transfers
to
the
subroutine
beginning
at
line 870.
The
subroutine
moves the
cursor
in the
appropriate
direction
and
to
the
next
row
up
or
down as necessary.
These
statements
determine
the hexadecimal code for
each
row in
the
grid. When the code is
determined.
character'l
02
iG
defined
to
be
the
character
shown
on
the large grid.
The
newly defined
character
is
then
displayed on the
screen
at
row
8. column 20.
The
character
is also displayed
in
a 3-by-3
pattern.
Then
the
hexadecimal code defining
that
character
is
displayed. Lines 630
through 720
print
instructions on
the
screen
for you to define a
new
character.
If
you
ur~
finished defining
characters.
prcss
Q
and
the
program
stops.
If
you press
any
other
key. the
program
transfers
to
line 140
to
clear
the
screen
and begin again.
IlIĀ·26
Examples:
>NElo/
>100
REM
CHARACTER
DEFINITION
>110
DIM
B(8,8)
>120
CALL
CHAR(100,""J
>130
CALL
CHAR(101,"FFFFFFfFF
FfFFFFF")
>140
CALL
CoLoR(9,2,16)
>150
CALL
CLEAR
>160
I'I$="AUTO
CHARACTER
DEFIN
I T
ION"
>170
Y=3
>180
X=4
>190
GOSUB
770
>200
M="12345678"
>210
Y=8
>220
GOSUB
770
>230
GOSUB
820
>240
M$""O"OFF=WHITE"
>250
Y=22
>260
X=4
>270
GOSUB
770
>280 M$="l"ON=BLACK"
>2'10
Y=2j
>300
GOSUB
770
>310
FOR
R=l
TO
8
>320
CALL
HCHAR(8+R,5,100,BJ
>330
Nt:.XT
H
>340
FOR
R=l
TO
8
>350
FOR
C=1
TO
8
>360
CALL
HCHAR(8+R,4+C,30J
~370
CALL
~ET(O,~ET,~TATUS)
>380
IF
STATUS=O
THEN
370
>390
IF (KEY<>8)+ (KEY<>9)=-2
THEN
420
>400
GOSUB
870
>410
GOTo
360
>420 KEY=KEY-48
>430 IF
(KEY<0)+(KEP1
)<=-1
T
HEN
370
>440
B(R,O=KEY
>450
CALL
HCHAR(8+R,4+C,100+K
EYl
>460
NEXT C
>470
NEXT
R
>480 HEX$="0123456789ABCDEF"
>490
1'1$=""
>500
FOR
R=l
TO
8
>510
LoW=B(R,5)*8+B(R,6)*4+B(
R,
7)*2+B
(R,8)+1
>520
HIGH=B(R,1)*8+B(R,2)*4+B
(R,3)*2+B(R,4J+1
>530 M$=M$&SEG$(HEX$,HIGH,1J&
SEG$(HEX$,LOW,1)
>540
NUT
R
>550
CALL
CHAR(102,M$)
>560
CALL
HCHAR(B,20,10Z)
>570
FOR
R=O
TO
2
>580
CALL
HCHAR(12+R,20,102,3
)
>590
NEXT
R
User's Reference Guide