ROM Computer Magazine Archive ROM MAGAZINE ISSUE 1 — AUGUST/SEPTEMBER 1983 / PAGE 13

Scrolling Ship
By Bob Cockroft
    Below is a program which when run will first draw random mountains on the screen, then random stars and then a space ship in the middle of the screen. After in the lower left corner of the screen "O.K." will be printed. Move the joystick in port one to the left or right and watch the ship fly, The mountains below are scrolling giving the ship the effect of moving. The ship will also fly up and down and fire bullets by pushing the red button. The bullets are directional, meaning when a bullet is fired, by moving the ship the bullet can be directed to whatever direction you want. The movement and firing of the ship is done in machine code by using the USR command.

Documentation

15-36 Draws mountains
40-82 Set up player/missiles
144-152 Draws player to the left
160-194 Draws player to the right
480-570 Missiles firing
2400-2720 Stick detection for left and right movement
2750-2900 Movement down
3000-3200 Movement up

Scrolling Ship screen

1 REM *DEF9.MAS*
5 POKE 1782,0
10 GRAPHICS 8
15 COLOR 1
16 PLOT 0,156:DRANTO 319,156
17 POKE 559,62
10 SETCOLOR 2,16,1
20 FOR T=1 TO 18
21 F=INT(RND(0)*240)+50:G=INT(RND(0)*30)+120:C=F
22 IF F>316 OR F<3 THEN 27
23 F=F-1:C=C+1:G=G+1
24 PLOT F,G:DRANTO C,G
25 IF G=155 THEN RESTORE:GOTO 27
26 GOTO 23

27 IF G>316 OR G<3 THEN 27
28 NEXT T
30 POKE 53248,120
32 POKE 53252,120
33 FOF T2=1 TO 50
34 X3=INT(RND(0)*319):Y3=INT(RND(0)*150)
35 PLOT X3,Y3
36 NEXT T2
40 POKE 704,174
42 POKE 705,88:POKE 706,88:POKE 707,88
50 I=PEEK(106)-8
58 POKE 1783,120
60 POKE 54279,I
70 POKE 53277,3
75 POKE 53760,50
80 J=I*256+1024
82 M1=I*256+768
144 FOR X=1 TO 45
145 READ D
146 POKE 1535+X,D
147 NEXT X
148 DATA 172,254,6,169,192,153,1,156,169,252,153,2,156,169,255,153,3,156,169,3
150 DATA 153,3,155,169,0,153,4,156,153,0,156,153,2,155,153,4,155,169,1
152 DATA 141,253,6,76,232,46
160 FOR A=1 TO 45
170 READ R
175 POKE 1599+A,R
180 NEXT A
190 DATA 172,254,6,169,3,153,1,156,169,63,153,2,156,169,255,153,3,156
192 DATA 169,3,153,3,155,169,0,153,4,156,153,0,156,153,2,155,153,4,155,169,2
194 DATA 141,253,6,76,232,46
200 FOR T=1 TO 75
202 READ W
204 POKE 13999+T,W
205 NEXT T
207 DATA 173,255,6,201,0,208,9
208 DATA 173,253,6,141,248,6,141,255,6,173,248,6,201,1,240,13,160,206,140,222,54
,160,1,140,232,54
210 DATA 76,222,54,160,238,140,222,54,160,225,140,232,54,238,247,6,173,217,6,141
,4,208,201,225,208,13
212 DATA 169,120,141,247,6,169,0,141,248,6,141,255,6,76,27,47
480 FOR X1=1 TO 169
482 READ L1
188 POKE 14999+X1,L1
190 NEXT X1
500 DATA 169,50,141,0,210,160,0,200,192,254,208,251,172,254,6,238,246,6,174,246,
6,224,1,240
510 DATA 18,224,50,240,40,224,150,240,59,224,200,240,78,224,255,240,108
520 DATA 208,218,169,60,141,192,2,169,24,153,3,156,153,1,156,169,60,153,2,156,16
9,144,144,1,210
525 DATA 76,157,58
530 DATA 169,140,141,1,210,169,104,141,192,2,169,137,153,0,156
540 DATA 169,36,153,255,155,76,157,58,169,136,141,1,210,169,88,141,192,2,169,74,
153,251
550 DATA 155,169,16,153,253,155,76,157,58,169,132,141,1,210,169,60,141,192,2,169
560 DATA 149,153,253,155,169,34,153,252,155,169,8,153,251,155,169,90,153,1,156,7
6,157,58
570 DATA 169,0,153,0,156,153,255,155,153,254,155,153,253,155,153,252,155,153,251
,155,96
2400 FOR E=1 TO 290
2420 READ N
2430 POKE 11999+E,N
2440 NEXT E
2450 DATA 162,120,160,125,140,254,6,104
2460 DATA 172,84,128,192,80,208,5,160,40,140,84,128,192,8,240,247
2480 DATA 172,5,208,192,4,208,3,76,152,58
2500 DATA 160,5,140,1,210,172,132,2,192,0,208,3,76,176,54,172,255,6,192,0,240,3
2520 DATA 76,192,54,173,120,2,141,252,6,201,11,240,65
2550 DATA 201,7,240,40,201,14,240,30,201,6,240,26,201,5,240,25,201,9,240,21,201,
10,240,14,201,13
2600 DATA 240,13,160,0,200,192,254,208,251,76,232,46,76,123,47,76,190,47
2650 DATA 238,84,128,238,180,128,160,13,140,1,210,160,1,200,192,253,208,251,76,0
,6,206,84,128,206,180,128
2700 DATA 160,13,140,1,210,160,1,200,192,253,208,251,76,64,6
2720 DATA 160,15,140,1,210
2750 DATA 172,254,6,136,192,20,208,2,160,21,140,254,6,160,1,200,192,253,208,251,
173,252,6
2800 DATA 201,14,208,13,173,253,6,201,1,208,3,76,0,6,76,64,6
2900 DATA 201,10,240,9,238,180,128,238,84,128,76,0,6,206,180,128,206,84,128,76,6
4,6
2950 DATA 160,3,140,1,210
3000 DATA 172,254,6,200,192,185,208,2,160,184,140,254,6,160,1,200,192,253
3100 DATA 208,251,173,252,6,201,13,208,13,173,253,6,201,1,208,3
3200 DATA 76,0,6,76,64,6,201,9,240,9,238,180,128,238,84,128,76,0,6,206,180,128,2
06,84,128,76,64,6,96
4800 FOR G=1 TO 20
4900 PRINT "OK"
4960 NEXT G
5000 X=USR(12000)
5050 PRINT "TIM":GOTO 5050
6000 GRAPHICS 0
6010 RESTORE
6015 FOR P=12000 TO 14000
6020 PRINT P,PEEK(P)
6030 IF PEEK(764)=63 THEN 6080
6040 IF PEEK(753)=0 THEN 6040
6050 IF PEEK(764)=21 THEN 6130
6060 IF PEEK(764)=40 THEN 6190
6070 NEXT P
6080 RESTORE
6090 FOR P=1536 TO 1790
6100 PRINT P,PEEK(P)
6110 IF PEEK(753)=0 THEN 6110
6120 NEXT P
6130 RESTORE
6140 FOR X=14000 TO 15800
6150 PRINT X,PEEK(X)
6160 IF PEEK(753)=0 THEN 6160
6180 NEXT X
6190 RESTORE
6290 FOR X=14999 TO 18999
6300 PRINT X,PEEK(X)
6310 IF PEEK(753)=0 THEN 6310
6320 NEXT X