10
POKE
7432,PEEK(7432)
AND
M0~(3)
20
POKE
7432,PEEK(7432)
OR
Mlr.(3)
Chapter
6:
Graphics 213
Even with techniques like precalculating masks, BASIC
is
usually too
slow for animation
of
high-resolution displays; there are just too many bits
'to be changed in order to move a player around the screen. This kind of
high-speed "bit juggling"
is
best done in machine language. BASIC is,
however, quite useful for displays that don't move, such as drawings and
graphs.
For
example; the following program will draw a triangle on the
screen:
100
REM
PROTECT
CHARACTER
MEMORY
110
POKE
52,24:
POKE
56,24:
CLR
120
POKE
36869,254
130
REM
COPY
UNREVERSEDCHARACTERS
140
FOR
1-6144
TO
7167
:
POKE
I,PEEK(26624+I)
NEXT
150
REM
CLEAR
CUSTOM
CHARACTERS
160
FOR
1=7168
TO
7679
:
POKE
I,e
:
NEXT
170
REM
BUILD
HI-RES
WORK
AREA
180
PRINT
":'lIDHPX
(08"
190
PRINT
"IIFIIQY!
>19"
200
PRINT
"IIlBJRZ";
CHR$(34);
CHR$(34);
CHR$(20);
"*2:
"
210
PRINT
"Il:KS[I+3i"
220
PRINT
"alDL
T£S,
4("
230
PRINT
"IIEMUJ~-5-"
240
PRINT
"FNVt&.6)"
250
PRINT
"130W+-'
In"
260
REM
BUILD
MASK
ARRAY
270
FOR
1-0
TO
7:Ml~(I)=2tI
:
NEXT
I
290
REM
DRAW
BOTTOM
OF
TRIANGLE
290
Y-63
300
FOR
X-0
TO
63
310
OOSUB
450
320
NEXT
330
REM
DRAW
LEFT
SIDE
OF
TRIANGLE
340
FOR
X=0
TO
30
350
Y =
63-XIII2'
360
OOSUB
450
370
NEXT
380
REM
DRAW
RIGHT
SIDE
OF
TRIANGLE
390
FOR
X-31
TO
62
400
Y -
63-(62-X)1IE2
410
OOSUB
450
420
NEXT
430
END
440
REM
BIT
SETTING
SUBROUTINE
450
COL-INT(X/8)
460
Pl-7168+Y+64*COL