-
Notifications
You must be signed in to change notification settings - Fork 0
/
27 - soldier.bas
201 lines (201 loc) · 7.14 KB
/
27 - soldier.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
5 REM SOLDIER
10 GOSUB10000
500 GOSUB1000
530 IF(PEEK(JOY)AND15)=15THENPOKEDIR+RP,0:POKEDIR+RT,0
550 GOSUB7000
560 IF(PEEK(JOY)AND15)=15THENPOKEDIR+RP,0:POKEDIR+RT,0
699 IF(FD=FALSE)AND(FC=FALSE)THEN500
700 FORK=0TO7:POKEDIR+K,0:NEXT
720 IFFCTHENGOSUB6000
730 IFFDTHENGOSUB6200
790 RUN
999 STOP
1000 POKEENSP,PEEK(ENSP)ANDR:R=255
1020 M=M+1:IFM>NETHENM=0
1040 GOSUB1500
1060 IF(YY>BM)AND(FX(M)=FALSE)THEN3000
1070 IFFX(M)THENGOSUB2000
1080 M1=M:M=INT(RND(0)*NE)
1090 IFFX(M)THENM=M1:GOTO1499
1110 GOSUB1500
1120 GOSUB3000
1130 M=M1
1499 RETURN
1500 RM=RB+M:RS=2^RM:RR=255-RS
1530 XX=PEEK(XSP+RM*2):YY=PEEK(YSP+RM*2)
1999 RETURN
2000 FX(M)=FALSE
2007 POKEVID+29,PEEK(VID+29)ANDRR
2008 POKEVID+23,PEEK(VID+23)ANDRR
2010 E=RND(0)*(NE+1)
2020 XE=XE(E):YE=YE(E)
2040 POKEDIR+RM,D(SGN(INT(PEEK(XSP+RP*2)/16-XE/16)*16)+1)
2050 POKECOLSP+RM,0
2060 POKEXSP+RM*2,XE:POKEYSP+RM*2,YE
2070 POKEHIGH,PEEK(HIGH)ANDRR
2080 POKEENSP,PEEK(ENSP)ORRS
2090 IF(PEEK(JOY)AND15)=15THENPOKEDIR+RP,0:POKEDIR+RT,0
2999 RETURN
3000 FX(M)=TRUE:R=RR
3010 POKECOLSP+RM,7
3025 POKESID+4,0:POKESID+4,WAVE+1
3030 POKEDIR+RM,0
3031 X=PEEK(XSP+RM*2)-12:IFX<0THENX=0
3032 Y=PEEK(YSP+RM*2)-10
3033 POKEXSP+RM*2,X
3034 POKEYSP+RM*2,Y
3040 POKEVID+29,PEEK(VID+29)ORRS
3041 POKEVID+23,PEEK(VID+23)ORRS
3045 IFFTTHEN3090
3050 IFABS(X+12-PEEK(XSP+RP*2))>24ORABS(Y+10-PEEK(YSP+RP*2))>20THEN3090
3060 IFSGN(PEEK(HIGH)AND(2^RP))=SGN(PEEK(HIGH)AND(2^RM))THENFD=TRUE
3090 IF(PEEK(JOY)AND15)=15THENPOKEDIR+RP,0:POKEDIR+RT,0
3999 RETURN
5000 POKEDIR+RP,15-(PEEK(JOY)AND15)
5030 IF(PEEK(BAKCLN)AND(2^RP))=FALSETHENRETURN
5040 IF(PEEK(YSP+RP*2))<YMTHENPOKECOLSP+RP,1:FG=TRUE:GOTO5099
5050 FD=TRUE:POKEDIR+RP,0:S1=M:S2=FX(M):S3=R:M=RP-RB:GOSUB1500
5060 GOSUB3000:M=S1:FX(M)=S2:S1=R:R=S3
5099 RETURN
6000 PRINT"{home}soldier dead"
6199 RETURN
6200 REM SOLDIER DEAD
6299 RETURN
6300 IFF2=FALSETHEN6310
6306 POKEENSP,PEEK(ENSP)ANDS1
6307 POKEVID+23,PEEK(VID+23)ANDS1:POKEVID+29,PEEK(VID+29)ANDS1
6308 POKECOLSP+RV,0:F2=FALSE:FH=FALSE:FV=FALSE:IFED>NETHENFC=TRUE
6309 RETURN
6310 Y=PEEK(YSP+RV*2)
6320 IFFHTHENIFY<YE(EH)+30THEN6330
6325 IFY>BT+30THENRETURN
6330 POKEDIR+RV,0
6340 S1=M:S2=FX(M):S3=R:M=RV-RB:GOSUB1500
6350 GOSUB3000:M=S1:FX(M)=S2:S1=R:R=S3
6355 IFEH=-1THEN6490
6360 POKE214,(YE(EH)-50)/8:PRINT:POKE211,(XE(EH)-24)/8:PRINTEB$;
6365 FORK=0TONE:IFXE(K)=XE(P2)THENXE(K)=XE(P1):YE(K)=YE(P1)
6366 NEXTK
6490 F2=TRUE
6499 RETURN
7000 IFFVTHENGOSUB6300
7010 J=PEEK(JOY)
7020 IF FT THEN 7100:REM(IE. TANK)
7025 IFPEEK(YSP+RP*2)<YTTHEN5000
7030 IFABS(PEEK(XSP+RP*2)-PEEK(XSP+RT*2))>10THEN5000
7035 IFSGN(PEEK(HIGH)AND(2^RP))<>SGN(PEEK(HIGH)AND(2^RT))THEN5000
7050 FT=TRUE:POKEENSP,PEEK(ENSP)AND(255-(2^RP)):POKESID+11,129
7100 IF FL THEN 7300:REM-FIRE
7120 POKEDIR+RT,12-(JAND12):POKESID+8,15+(PEEK(DIR+RT)=0)*5
7150 IF((JAND16)=0)AND(FG=TRUE)THENFL=TRUE:GOTO7299
7160 IF (JAND1)=1THEN7299
7170 FT=FALSE:POKEDIR+RT,0:POKEDIR+RP,0:POKESID+11,128:POKECOLSP+RP,0
7175 POKEXSP+RP*2,PEEK(XSP+RT*2):POKEYSP+RP*2,PEEK(YSP+RT*2)-22
7176 POKEHIGH,PEEK(HIGH)AND(255-2^RP)
7177 POKEHIGH,(PEEK(HIGH)OR((2^RP)*SGN(PEEK(HIGH)AND(2^RT))))
7180 POKEENSP,PEEK(ENSP)OR2^RP
7181 PK=PEEK(VID+30)
7299 RETURN
7300 FL=FALSE:FG=FALSE:FH=FALSE:FV=TRUE:EH=-1
7350 POKEDIR+RV,1
7360 X=PEEK(XSP+RT*2):Y=PEEK(YSP+RT*2)
7370 FORK=0TONE
7380 IFABS(X-XC(K))<10THENFH=TRUE:EH=K:XC(K)=-1
7390 NEXTK
7400 IFEH=-1THEN7500
7420 ED(EH)=-1:ED=ED+1
7430 FORK=0TONE:IFED(K)=0THENP1=K
7440 NEXTK
7450 P2=EH
7500 POKEXSP+RV*2,X:POKEYSP+RV*2,Y
7510 POKEHIGH,PEEK(HIGH)AND(255-2^RV)
7520 POKEHIGH,(PEEK(HIGH)OR((2^RV)*SGN(PEEK(HIGH)AND(2^RT))))
7530 POKEENSP,PEEK(ENSP)OR(2^RV)
7599 RETURN
7600 FORK=0TO3*64-1:READD:POKE13*64+K,D:NEXT
7620 DATA0,0,0,224,0,14,224,0,14,224,0,14,48,0,24,24,0,48,12,56,96
7630 DATA6,124,192,3,255,128,0,254,0,1,255,0,1,255,0,0,254,0,1,255,0
7640 DATA 3,125,128,6,56,192,12,0,96,24,0,48,240,0,30,224,0,14,224,0,14,0
7650 DATA 0,40,0,0,40,0,0,40,0,62,111,62,127,239,254,170,170,171,175,239,235
7660 DATA175,239,251,127,239,254,63,238,248,63,171,248,63,171,248,63,215,248
7670 DATA63,255,248,63,255,248,127,255,254,175,255,251,167,255,235
7675 DATA 170,170,171,127,255,254,62,127,62,0
7680 DATA0,192,0,1,96,0,2,240,0,2,244,0,1,106,0,0,250,0,3,252,0
7690 DATA55,252,0,47,252,0,47,252,0,31,232,0,31,224,0,11,240,0,3,240
7695 DATA0,7,240,0,7,240,0,7,248,0,7,232,0,11,232,0,9,176,0,6,0,0,0
7999 RETURN
8000 XINC=49309:YINC=49317:DIR=49301:ATAB=49293:OTAB=49285
8010 PRI=53275:SCLN=53278:MULT=53276:BAKCLN=53279:ENSP=53269:COLSP=53287
8015 XSP=53248:YSP=53249:HIGH=53264
8020 FORI=0TO148:READA:POKE49152+I,A:NEXT
8030 FORI=0TO7:POKEDIR+I,0:POKEXINC+I,0:POKEYINC+I,0:NEXT
8040 POKE56333,127:POKE788,0:POKE789,192:POKE56333,129
8050 RETURN
9000 DATA162,7,138,10,168,24,189,149
9010 DATA192,133,251,70,251,144,14,185
9020 DATA1,208,201,51,144,7,56,253
9030 DATA165,192,153,1,208,70,251,144
9040 DATA14,185,1,208,201,226,176,7
9050 DATA24,125,165,192,153,1,208,70
9060 DATA251,144,36,173,16,208,61,133
9070 DATA192,208,7,185,0,208,201,25
9080 DATA144,21,185,0,208,56,253,157
9090 DATA192,153,0,208,176,9,173,16
9100 DATA208,61,141,192,141,16,208,70
9110 DATA251,144,36,185,0,208,201,64
9120 DATA144,11,173,16,208,61,133,192
9130 DATA208,21,185,0,208,24,125,157
9140 DATA192,153,0,208,144,9,173,16
9150 DATA208,29,133,192,141,16,208,202
9160 DATA16,128,76,49,234,1,2,4
9170 DATA8,16,32,64,128,254,253,251
9180 DATA247,239,223,191,127
10000 GOSUB7600
10003 GOSUB8000
10005 TRUE=1:FALSE=0
10010 VID=53248:SID=54272:JOY=56320
10011 BDR=0:BCK=2
10015 RB=0:RM=RB:RP=5:RT=6:RV=7
10020 NE=5-1:NL=10:E$="{gray}{reverse on}{sh pound}{sh asterisk}{cm asterisk}{down}{left*3}{sh -}Q{sh -}{down}{left*3}{reverse off}{cm asterisk}{reverse on}{sh asterisk}{reverse off}{sh pound}":MINE$="{black}{cm e}"
10021 DUMP$="{reverse on}{yellow}{sh pound} {cm asterisk}{down}{left*5}{sh pound} {black}{space*3}{yellow} {cm asterisk}"
10022 EB$="{black}..{right}{down}{left*2}W.{down}{left*2}.{right}"
10025 D(0)=6:D(1)=2:D(2)=10
10030 SP=1:SM=1:TS=1:SV=1
10035 POKEXI+RP,SP:POKEYI+RP,SP
10036 POKEXI+RT,TS:POKEYI+RT,TS
10037 POKEXI+RV,00:POKEYI+RV,SV
10038 FORK=0TONE:POKEXI+RM+K,SM:POKEYI+RM+K,SM:NEXT
10050 BT=50:BB=230:BL=24:BR=255:BM=120
10060 XT=150:YT=BB-8:XP=XT:YP=YT
10120 FORE=0TONE:READXE(E),YE(E):NEXT
10130 DATA0,11,7,7,14,3,21,7,28,11
10150 YM=YE(2):XG=XE(2):YG=YM-3
10200 SID=54272:WAVE=128:EX=1
10220 FORK=0TO24:POKESID+K,0:NEXT
10230 FORK=0TO24:READD:POKESID+K,D:NEXT
10240 DATA0,1,0,0,128,10,0
10250 DATA0,10,0,0,128,0,80
10260 DATA0,0,0,0,0,0,0
10270 DATA0,100,243,47
10500 GOSUB11000
10510 FORE=0TONE:XE(E)=24+XE(E)*8:YE(E)=50+YE(E)*8
10515 XC(E)=XE(E):YC(E)=YE(E):NEXT:YM=50+YM*8
10520 PK=PEEK(VID+30)+PEEK(VID+31)
10600 FORK=0TONE:FX(K)=TRUE:NEXTK:R=255
10999 RETURN
11000 PRINT"{clear}";
11012 POKE53280,BDR:POKE53281,BCK
11015 FORK=1TONL:POKE214,6+RND(0)*10:PRINT:POKE211,RND(0)*40:PRINTMINE$;:NEXT
11017 POKE214,YG:PRINT:POKE211,XG:PRINTDUMP$;
11018 FORE=0TONE:POKE214,YE(E):PRINT:POKE211,XE(E):PRINTE$;:NEXT
11050 POKE2040+RT,14:POKE2040+RP,15:POKE2040+RV,13
11055 FORK=0TONE:POKE2040+RM+K,13:NEXT
11100 POKE ENSP,0
11130 POKEXSP+RP*2,XP:POKEYSP+RP*2,YP
11135 POKEXSP+RP*2,XT:POKEYSP+RP*2,YT
11140 POKECOLSP+RP,0:POKECOLSP+RT,0:POKECOLSP+RV,0
11150 FORK=0TONE:POKECOLSP+RM+K,1:NEXT
11190 POKEENSP,2^RP+2^RT:POKEHIGH,0
11195 POKEVID+23,0:POKEVID+29,0
11197 POKEVID+29,2^RP
11999 RETURN