Planet Raith – GEOS C64 – BeckerBASIC

Rivista: RetroMagazine World – Numero: 34 – Anno 2021 – Listato di: Francesco Fiorentini

Questo gioco, nella versione originale per ZX81, mi é proprio piaciuto. Dopo averne fatto un porting per Commodore 64, ho deciso di farne anche uno per GEOS utilizzando una estensione Basic di nome BeckerBASIC

Ho scritto un articolo su RetroMagazine World numero 34 per documentare come sono riuscito a realizzare il porting per GEOS. In quell’articolo troverete dettagliate istruzioni su tutti i comandi utilizzati nel listato riportato qui sotto e le istruzioni per eseguirlo.

Il listato originale per ZX81 potete trovarlo sempre su RetroLiPS a questo indirizzo: Planet Raith ZX81, mentre il porting che ho realizzato per Commodore 64, lo trovate qui: Planet Raith per C64

Il listato per ZX81 originale é stato pubblicato sulla rivista inglese Popular Computing Weekly del 29 Aprile 1982 Vol. 1 Nr. 2.

Titolo: Planet Raith
Piattaforma: GEOS C64
Linguaggio: BeckerBasic
Versione originale: Dave Middleton per ZX81
Pubblicazione: Popular Computing Weekly nr. 2 per ZX81
Anno: 1982
Porting per GEOS: Francesco Fiorentini
Anno: 2021
Download: raith_GEOS
Note: Il titolo del gioco sulla rivista é Planet Ruler, ma ho preferito intitolarlo Planet Raith dal nome usato per identificare il pianeta all’interno del gioco.

Istruzioni
Sei il comandante del pianeta Raith ed il tuo compito é assicurare il perfetto funzionamento delle miniere. La popolazione iniziale é di soli 100 abitanti ma, essendo le 1000 miniere operate roboticamente, ogni uomo puó controllare 10 miniere per volta. Durante il ciclo annuale devi decidere quante miniere costruire e vendere. Devi inoltre gestire la vendita di minerali per sfamare la popolazione. Se sei generoso altri immigranti verranno a lavorare per te, ma se sei tirchio la popolazione potrebbe assassinarti. Devi inoltre difenderti dagli attacchi Klingon e dalla tua stessa corruzione. Troppo denaro accumulato e sarai tentato di scappare…
Buon divertimento!

Qui di seguito trovate il codice ottimizzato per essere copiato direttamente sull’editor del BeckerBASIC.

Se invece siete ansiosi di provare il gioco su un C64 reale o su un emulatore, scaricate il file raith_GEOS e seguite le istruzioni che ho inserito nell’articolo del numero 34.

Attenzione – Ci siamo resi conto che nel listato i caratteri ‘>’ e ‘<‘ potrebbero venir sostituiti dai rispettivi encoding html ‘&gt’ e ‘&lt’. Nel caso, sostituite questi valori nel listato prima di copiarlo sull’emulatore.

Listato: Planet Raith – GEOS C64 – BeckerBASIC


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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
10 'init sprite'
11 d$=""
12 gosub 10000
18 geoson
19 bl$="                                        "+chr$(0)
20 'go to intro routine'
21 gosub 2000
30 'init var'
31 p=100:i=5:d=0:s=3650:k=350:m=4000
32 l=1000:y=1:c=4:n=2576:
35 d=0
40 'start core'
41 hrdel
42 hrprint 20,20,chr$(27)+"annual controllers report for year "+str$(n)+chr$(0)
43 n=n+1
44 hrprint 20,40,chr$(27)+"sir, during the last year:"+chr$(0)
45 hrprint 20,50,str$(d)+" workers died from starvation"+chr$(0)
46 hrprint 20,60,chr$(27)+"and "+str$(i)+" immigrants came to raith"+chr$(0)
50 'klingons'
51 if y>0 then goto 57
52 p=int(p/2):
53 hrprint 20,70,chr$(24)+"klingons attacked our planet"+chr$(0)
54 hrprint 20,80,chr$(24)+"and half of the people are dead!"+chr$(0)
55 'info'
57 hrprint 20,90,chr$(27)+"the population is now"+str$(p)+chr$(0)
58 hrprint 20,100,chr$(27)+"there are "+str$(l)+" mine shafts"+chr$(0)
59 hrprint 20,110,chr$(27)+"the mines produced "+str$(m)+" tonnes"+chr$(0)
70 hrprint 20,120,chr$(27)+"of minerals at "+str$(c)+" tonne/mine"+chr$(0)
71 hrprint 20,130,chr$(27)+"but klingons pirated "+str$(k)+" tonnes"+chr$(0)
72 hrprint 20,140,chr$(27)+"leaving "+str$(s)+" tonnes in storage"+chr$(0)
73 hrprint 20,170,chr$(27)+"press any key to continue..."+chr$(0)
76 waitkeya
79 'new mines'
80 hrdel
81 hrprint 20,20,chr$(27)+"there are "+str$(s)+" tonnes"+chr$(0)
82 hrprint 20,30,chr$(27)+"of minerals in stock"+chr$(0)
83 c=int(rnd(1)*10+1): v=c+17
84 hrprint 20,40,chr$(27)+"it currently costs"+chr$(0)
85 hrprint 20,50,chr$(27)+str$(v)+" tonnes to open a mine"+chr$(0)
86 hrprint 20,70,chr$(27)+"how many mines do you want to"+chr$(0)
87 hrprint 20,80,chr$(27)+"build this year?"+chr$(0)
88 hrprint 20,90,chr$(27)+">>>"+chr$(0)
89 x$=chr$(0)+"     "
90 hrget 37,83,x$
91 x=val(x$)
92 if x=0 then goto 105:endif
93 if v*x<=s then goto 104:endif
94 hrprint 20,100,chr$(27)+"there is only enough stock to"+chr$(0)
95 hrprint 20,110,chr$(27)+"buy materials for"+chr$(0)
96 hrprint 20,120,chr$(27)+str$(int(s/v))+" mines"+chr$(0)
97 waitkeya
98 hrprint 20,100,bl$
99 hrprint 20,110,bl$
101 hrprint 20,120,bl$
102 hrprint 20,88,bl$
103 goto 88
104 l=l+x:s=s-v*x
105 'mine shafts'
106 hrdel
107 hrprint 20,20,chr$(27)+"raith currently has"+chr$(0)
108 hrprint 20,30,chr$(27)+str$(l)+" mine shafts"+chr$(0)
109 hrprint 20,40,chr$(27)+"how many mines will you sell?"+chr$(0)
110 hrprint 20,50,chr$(27)+">>>"+chr$(0)
111 x$=chr$(0)+"     "
112 hrget 37,43,x$
113 x=val(x$)
114 if x=0 then goto 130:endif
115 if x<l then goto 125:endif
116 hrprint 20,70,chr$(27)+"controller, you only have"+str$(l)+chr$(0)
117 hrprint 20,80,chr$(27)+"mines... try selling a few less"+chr$(0)
118 waitkeya
119 hrprint 20,70,bl$
120 hrprint 20,80,bl$
121 hrprint 20,48,bl$
122 goto 110
125 l=l-x: s=s+v*x
130 'selling stock'
131 hrdel
132 hrprint 20,20,chr$(27)+"there are "+str$(s)+" tonnes"+chr$(0)
133 hrprint 20,30,chr$(27)+"of minerals in stock"+chr$(0)
137 hrprint 20,50,chr$(27)+"how much stock will you sell"+chr$(0)
138 hrprint 20,60,chr$(27)+"to feed the hork force?"+chr$(0)
139 hrprint 20,70,chr$(27)+">>>"+chr$(0)
141 x$=chr$(0)+"     "
142 hrget 37,63,x$
143 f=val(x$)
144 if f<=s then goto 160:endif
145 hrprint 20,90,chr$(27)+"such generosity commander but"+chr$(0)
146 hrprint 20,100,chr$(27)+"there are only "+str$(s)+" tonnes"+chr$(0)
147 hrprint 20,110,chr$(27)+"of minerals in stock..."+chr$(0)
148 waitkeya
150 hrprint 20,90,bl$
151 hrprint 20,100,bl$
152 hrprint 20,110,bl$
153 hrprint 20,68,bl$
154 goto 139
160 s=s-f:d=p-int(f/20):i=0:
162 if d>=0 then goto 165:endif
165 i=-d/2:d=0
170 'mines work'
171 hrdel
172 hrprint 20,20,chr$(27)+"raith has "+str$(l)+" mines shafts"+chr$(0)
173 hrprint 20,30,chr$(27)+"how man mines will be worked?"+chr$(0)
175 hrprint 20,40,chr$(27)+">>>"+chr$(0)
176 x$=chr$(0)+"     "
177 hrget 37,33,x$
178 g=val(x$)
180 if g=0 then goto 400:endif
182 if g<=l then goto 195:endif
185 hrprint 20,60,chr$(27)+"imaginative thinking sir but"+chr$(0)
186 hrprint 20,70,chr$(27)+"we only have "+str$(l)+" mines shafts"+chr$(0)
188 waitkeya
190 hrprint 20,60,bl$
191 hrprint 20,70,bl$
192 hrprint 20,38,bl$
193 goto 175
195 if int(g/2)<=s then goto 220:endif
200 hrprint 20,60,chr$(27)+"0.5 tonne of stock has to be"+chr$(0)
202 hrprint 20,70,chr$(27)+"sold to purchase equipment for"+chr$(0)
204 hrprint 20,80,chr$(27)+"each active mine. we have enough"+chr$(0)
206 hrprint 20,90,chr$(27)+"stock to operate "+str$(int(s/2))+" mines"+chr$(0)
208 waitkeya
210 hrprint 20,60,bl$
211 hrprint 20,70,bl$
212 hrprint 20,80,bl$
213 hrprint 20,90,bl$
215 hrprint 20,38,bl$
217 goto 175
220 if g<=10*p then goto 400:endif
221 hrprint 20,60,chr$(27)+"commander, one worker can"+chr$(0)
222 hrprint 20,70,chr$(27)+"supervise only 10 mines. we can"+chr$(0)
224 hrprint 20,80,chr$(27)+"only have a maximum of "+str$(int(10*p))+chr$(0)
226 hrprint 20,90,chr$(27)+"mines operating at present"+chr$(0)
228 waitkeya
230 hrprint 20,60,bl$
231 hrprint 20,70,bl$
232 hrprint 20,80,bl$
233 hrprint 20,90,bl$
235 hrprint 20,38,bl$
237 goto 175
400 'computation'
410 c=int(rnd(1)*5+1): m=g*c: k=0: q=int(rnd(1)*5+1)
411 if int(q/2)<>q/2 then goto 415:endif
412 k=int(s/q)
415 s=s-k+m: q=int(rnd(1)*5+1): i=int(c*(20*l+s)/p/100+1)    
420 p=p+i: q=int(f/20): y=int(10*((rnd(1)*3+1)-.3))
425 if p<q then goto 35:endif
428 d=p-q
430 if d>.5*p then goto 1000:endif
440 if d>.35*p then goto 460:endif
450 if d>.2*p then goto 1200:endif
460 p=q    
490 if s>=100*p then goto 1300:endif
495 goto 40
1000 'assassinated'
1001 hrdel
1005 hrprint 20,30,chr$(27)+"you have been assassinated..."+chr$(0)
1010 hrprint 20,50,chr$(27)+"play again?  1.yes  0.no"+chr$(0)
1011 hrprint 20,60,chr$(27)+">>>"+chr$(0)
1015 x$=chr$(0)+" "
1017 hrget 37,53,x$
1018 r=val(x$)
1020 if r=0 then goto 1800
1025 else goto 30
1030 endif
1200 'rebellion'
1205 hrprint 20,30,chr$(27)+"the workers are hungry and"+chr$(0)
1210 hrprint 20,40,chr$(27)+"there is talk of rebellion..."+chr$(0)
1220 waitkeya
1280 goto 460
1300 'another planet'
1301 hrdel
1302 hrprint 20,30,chr$(27)+"you have gone to another planet"+chr$(0)
1303 hrprint 20,40,chr$(27)+"with the contents of the"+chr$(0)
1304 hrprint 20,50,chr$(27)+"treasury..."+chr$(0)
1310 hrprint 20,70,chr$(27)+"play again?  1.yes  0.no"+chr$(0)
1311 hrprint 20,80,chr$(27)+">>>"+chr$(0)
1315 x$=chr$(0)+" "
1317 hrget 37,73,x$
1318 r=val(x$)
1320 if r=0 then goto 1800
1325 else goto 30
1330 endif
1800 'return to geos after key press'
1801 hrdel
1805 hrprint 110,100,chr$(27)+"...goodbye... :-("+chr$(0)
1810 waitkeya
1820 geosoff
1830 desktop
1850 '--- end ---'
2000 'intro routine'
2001 hrdel
2150 hrprint 110,30,chr$(24)+"planet raith"+chr$(0)
2160 hrprint 80,50,"(c)2021 geos version by"+chr$(0)
2170 hrprint 90,70,chr$(24)+"francesco fiorentini"+chr$(0)
2175 hrprint 264,124,chr$(24)+chr$(14)+"raith"+chr$(15)+chr$(0)
2180 hrprint 130,170,chr$(24)+"press any key to continue"+chr$(0)
2500 'create the sprite and move it'
2510 hrline 10,10,310,10:hrline 10,190,310,190
2515 hrline 10,10,10,190:hrline 310,10,310,190
2550 mbdesign 552,d$
2551 mbblock 35,1,552
2552 mbsetpos 1,50,150
2553 mbsetcol 1,0
2555 mbon 1
2560 for e=50 to 290 step 1
2565 mbsetpos 1,e,150
2600 next e
2690 waitkeya
2695 mballoff
2900 return
10000 'sprite data and load into string'
10010 data 0,0,0,0,0,0,0,0
10020 data 0,0,0,0,0,0,0,0
10030 data 0,0,0,0,0,0,56,0
10040 data 1,252,0,3,3,0,26,91
10050 data 192,187,255,60,1,0,2,25
10060 data 42,163,186,0,2,3,255,252
10070 data 0,0,0,0,0,0,0,0
10080 data 0,0,0,0,0,0,0
10085 for e=1 to 63
10090 read sp: d$=d$+chr$(sp)
10095 next e
10100 return

Share

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

Questo sito usa Akismet per ridurre lo spam. Scopri come i tuoi dati vengono elaborati.