ADVENTURE
GAMES-PART IV
BY
PETER ELLISON
In the last issue of this article (Issue 3), I made a machine language subroutine in order to move Lancelot (Player0) around the screen. In this issue I have redefined the character set in ANTIC MODE 4 to produce high resolution graphics. I used this ANTIC mode because of the little memory it takes up. Although ANTIC MODE 4 is recognized as a text mode, it does support multicolor characters. Each character in this mode is eight pixels wide, but the pixels are turned on or off in pairs. In effect, it actually gives us a character four bits wide. The color for each character is determined by the bit combination of every pair of bits in the byte. By turning them on or off in a certain way, this will produce different colors. See diagram below. The first bit pair is 11. The pixels which are turned on for this part of the character would produce the color equivalent to color register 3 or (Peek 711). For the second pair of bits, 01, this part of the character would equal color register 1 or (Peek 709). The third combination, 10, would produce the color of color register 2 or (Peek 710). And for the last bit combination, 00, it would produce the color of the background, color register 0 or (Peek 708).
--------------------------------
[ 1 [ 1 [ 0 [ 1 [ 1 [ 0 [ 0 [ 0 ]
--------------------------------
By designing the characters in this mode, each character is able to be one color or many. ANTIC mode 4 gives the appearence of being in graphic mode 7.
Lines 5000 to 7900 are the same as in the third issue of ROM, as not to leave anyone out. Those lines just move Lancelot around the screen with a joystick and player/missile graphics with a short machine language subroutine.
In the beginning of this program a short machine language subroutine was used to move the character set from ROM to RAM. Once this is accomplished the character set is redefined by the use of data statements. By defining different characters, I was able to produce different pictures on the screen. In this program I have drawn a boarder all the way around the playfield. These bricks were made by using the asterisk. The asterisk didn't even need to be redefined to make such a nice brick. The next thing that I drew with characters, was a Snake. To the left of it I wrote the word "snake",if you can read it. Next I drew a centipede and then last some trees. These are just some of the characters that I will be using in the adventure game to come. In the next issue I will have the characters moving and chasing poor Lancelot. Until next issue, Happy Adventuring!
10 REM DIMENSION ALL CHARACTERS
15 DIM P1$(20),CEN$(20),SNA$(20),TRE$(20)
20 REM INITIALIZE CHARACTER BASE FOR NEW CHARACTER SET
25 A=PEEK(106)-8:CB=A*256
30 REM STORE THE NEW ROM AND CHARACTERSET ADDRESS
35 POKE 204,A:POKE 206,224
40 REM LOAD MACHINE CODE TO CHANGE CHARACTER SET
45 FOR M=1 TO 20:READ B:P1$(M,M)=CHR$(B):NEXT M
50 DATA 104,162,4,160,0,177,205,145,203,200,208,249,230,206,230,204,202,208,242,96
55 U=USR(ADR(P1$))
60 FOR X=24 TO 79:READ D:POKE CB+X,D:NEXT X
65 REM MODIFY THE CHARACTER #
70 DATA 0,28,8,119,119,8,28,0
75 REM MODIFY THE CHARACTER $
80 DATA 0,120,143,191,191,143,120,0
85 REM MODIFY THE CHARACTER %
90 DATA 0,192,240,252,255,255,255,204
95 REM MODIFY THE CHARACTER &
100 DATA 3,7,14,28,56,112,224,192
105 REM MODIFY THE CHARACTER '
110 DATA 192,224,112,56,28,14,7,3
115 REM MODIFY THE CHARACTER (
120 DATA 255,255,0,0,0,0,0,0
125 REM MODIFY THE CHARACTER )
130 DATA 16,56,124,254,16,0,0,0
135 GRAPHICS 16
140 REM CHANGE FIRST LINE TO ANTIC MODE 4
145 DLIST=PEEK(560)+PEEK(561)*256
150 POKE DLIST+3,68
155 REM CHANGE THE REST OF THE LINES TO ANTIC MODE 4
160 FOR X=DLIST+6 TO DLIST+28
165 POKE X,4
170 NEXT X
175 POKE 756,A
180 REM TREES
185 TRE$="))))))))))))"
190 REM CENTIPEDE
195 CEN$="$######"
200 REM SNAKE
205 SNA$="('&'&"
210 POSITION 0,1
215 ? "****************************************"
220 FOR WW=1 TO 21:POSITION 0,WW:? "*":POSITION 39,WW:? "*":NEXT WW:IF WW>=21 THEN GOTO 230
225 GOTO 220
230 POSITION 0,21:? "****************************************"
235 POSITION 10,15:? "TREES=":POSITION 17,15:? TRE$
240 POSITION 11,14:? "CENTIPEDE=":POSITION 22,14:? CEN$
245 POSITION 15,13:? "SNAKE=":POSITION 22,13:? SNA$
4950 REM PLAYER POSITION
5000 X=100:Y=50
5050 REM SET UP PLAYER/MISSILE ADDRESS
5100 I=PEEK(106)-8:POKE 54279,I:PMBASE=I*256
5200 FOR Z=PMBASE+512 TO PMBASE+640
5300 POKE Z,0
5400 NEXT Z
5500 POKE 559,46:POKE 53277,3
5600 POKE 53248,X
5700 POKE 704,135
5800 FOR Z=0 TO 8:READ W:POKE PMBASE+512+Y+Z,W
5900 NEXT Z
5950 REM CHARACTER DATA
6000 DATA 49,50,36,56,32,32,56,232,140
6100 GOTO 6800
6200 A=STICK(0)
6250 REM JOYSTICK FOR PLAYER MOVEMENT
6300 IF A=11 THEN X=X-9:POKE 53279,0:POKE 53248,X:A=15:FOR P=1 TO 100:NEXT P:IF A=15 THEN MOVE=MOVE-1:GOTO 6300
6400 IF A=7 THEN X=X+9:POKE 53279,0:POKE 53248,X:A=15:FOR P=1 TO 100:NEXT P:IF A=15 THEN MOVE=MOVE-1:GOTO 6400
6500 IF A=13 THEN R=USR(1700):Y=Y+9:POKE 53279,0:A=15:FOR D=1 TO 100:NEXT D:IF A=15 THEN MOVE=MOVE-1:GOTO 6500
6600 IF A=14 THEN Q=USR(1600):Y=Y-9:POKE 53279,0:A=15:FOR E=1 TO 100:NEXT E:IF A=15 THEN MOVE=MOVE-1:GOTO 6600
6650 IF X>=55 AND Y<15 THEN X=55 AND Y=100:POKE 53248,X
6700 GOTO 6200
6800 FOR Q=1 TO 88:READ W:POKE 1600+Q-1,W:NEXT Q
6850 REM UPCODE
6900 POKE 1537,Y
7000 DATA 104,173,1,6,56,233,9,141,1,6,172,1,6,169,0,153,9,154,153,10,154,153,11,154,153,12,154,153,13,154
7100 DATA 153,14,154,153,15,154,153,16,154,153,17,154,169,49,153,0,154,169,50,153,1,154,169,36,153,2,154,169,56
7200 DATA 153,3,154,169,32,153,4,154,169,32,153,5,154
7300 DATA 169,56,153,6,154,169,232,153,7,154,169,140,153,8,154,96
7400 FOR R=1 TO 88:READ S:POKE 1700+R-1,S:NEXT R
7450 REM DOWNCODE
7500 DATA 104,173,1,6,24,105,9,141,1,6,172,1,6,169,0,153,247,153,153,248,153,153,249,153,153,250,153,153,251,153
7600 DATA 153,252,153,153,253,153,153,254,153,153,255,153,169,49,153,0,154,169,50,153,1,154,169,36,153,2,154,169,56
7700 DATA 153,3,154,169,32,153,4,154,169,32,153,5,154
7800 DATA 169,56,153,6,154,169,232,153,7,154,169,140,153,8,154,96
7900 GOTO 6200