Commodore CErco COmmodore - l'iniziativa di appassionati di retrocomputer


Listati BASIC per MSX, Apple II e ZX Spectrum

Non solo Commodore: listati in BASIC per MSX, Apple II e Sinclair ZX Spectrum, dai giochi completi alle curve in alta risoluzione.

I listati vanno digitati così come sono, rispettando numeri di riga e punteggiatura. Su emulatore si possono incollare direttamente nella finestra del BASIC.

Indice

L'msx che consente di creare un gioco

Si tratta di colpire degli aerei che si trovano in volo casuale con dei missili lanciati da un mirino che, all'inizio, compare al centro dello schermo.
Ci si sposta in tutte le direzioni con le frecce di movimento e si spara con il tasto zero

      10 Rem Combattimento aereo
      20 cls: input"fornisci un intero :";f
      30 for i=1 to f: y=RND(1): next 
      40 screen 1,1: data 24,24,60,255,255,60,66,0,0,8,8,8,28,62,28,0
      50 for i= 1 to 2
      60 a$="":for j= 1 to 8
      70 read a: a$=a$+chr$(a)
      80 next j
      90 sprite$(i)=a$:next i
      100 color 15,14,13: key off: cls
      110 a=5:b=15
      120 n=21
      130 put sprite 1,(8*b,8*a),4,1
      140 a=a+2*int(rnd(1)*2)-1
      150 b=b+2*int(rnd(1)*2)-1
      160 a$=inkey$
      170 b=b-2*(a$=chr$(28))+2*(a$=chr$(29))
      180 a=a-2*(a$=chr$(31))+2*(a$=chr$(30))
      190 if b<0 or b>37 then b=abs(b-37)
      200 if a<3 or a>22 then a=abs(a-22)
      210 locate 15,9:print "* *":locate 15,10
      215 print " X ":locate 15,11:print "* *"
      220 if a$="0" or n<21 then gosub 240
      230 goto 130
      240 put sprite 2,(8*(26-n),8*n),8,2
      245 put sprite 3,(8*(n+6),8*n),8,2
      250 n=n-1
      260 if n>9 then return
      270 if (a=9 or a=10 or a=11) and (b=15 or b=16 or b=17) then print "VINTO!!!"
      275 play "cde":end
      280 put sprite 2,(0,209),8,2
      285 put sprite 3,(0,209),8,2: goto 120
		  

L'msx che consente di creare un gioco

4 mucchi di 20 stelle appariranno all'inizio della partita ed ogni giocatore può prendere tante stelle quante ne desidera; ma questo in un solo mucchio per volta. Quello che prende l'ultima stella perde.

      20 screen 1: color 8,15: cls: key off
      30 for i=1 to 4
      40 locate 0,2*i: print i;"  ********************"
      45 rem graph e z
      50 next i
      60 t=0
      70 dim f(4)
      80 b=1
      90 locate 0,12: print "giocatore ";b
      100 print:input "linea :";l
      110 print:imput "caselle :";c
      120 if l>4 then 90
      130 if c+f(l)>20 then 90
      140 f(l)=f(l)+c
      150 t=t+c
      160 for j=f(l)-c to f(l)
      170 locate 25-j,2*l: print " ": play "l64n70"
      180 next j
      190 b=b+1
      200 if b=3 then b=1
      210 if t<80 then 90
      220 print"il giocatore";b;" VINCE":play "cge"
		  

L'MSX che consente di trovare tutti i modi di disporre delle regine su una scacchiera

Le regine verranno posizionate in modo che non si potranno fare scacco tra loro.

      20 scrren 1:color 9,15,7:key off:cls
      30 input "Dimensione scacchiera :";s
      40 dim d(s)
      50 i=1:a$=chr$(219)
      60 d(i)=1
      70 if i=1 then 110
      80 for j=1 to i-1
      90 if d(i)=d(j) or (abs(d(i)-d(j))=i-j) then 240
      100 next j
      110 i=i+1:if i<=s then 60
      120 cls
      130 for i=1 to s
      140 locate 2*f,0:print f
      150 locate 0,2*f:print f
      160 for k=1 to s
      170 locate 2*k+1,2*f:print "."
      180 next k
      190 locate 2*d(f)+1,2*f:print a$
      200 locate f,20:print right$(str$(d(f)),1)
      210 next f
      220 play "cge":locate 0,22:print "Premi un tasto":r$=input$(1)
      230 i=i-1
      240 d(i)=d(i)+1
      250 if d(i)<=s then 70
      260 i=i-1
      270 if i<>0 then 240
		  

L'MSX che crea un gioco di una automobile

Una piccola macchina si muove sullo schermo e si può spostare a destra ed a sinistra. Degli ostacoli le si fanno incontro; se urta contro gli ostacoli od il bordo del terreno il gioco termina.

      20 cls: input "Fornisci un numero intero :";f
      30 for i=1 to f:y=rnd(1):next
      40 screen 1,0:a$="": data 93,127,85,20,93,127,93,8
      45 for i=1 to 8:read a: a$=a$+chr$(a):next i:sprite$(1)=a$
      50 color 8,15,3:key off:width 32:cls
      60 s=0:y=7
      70 put sprite 1,(8*y,8),4,1
      80 locate 2,24:print chr$(219)+"        "+chr$(219);
      90 if rnd(1)<0.7 then locate int(rnd(1)*8+3),24
      95 print chr$(215);
      100 if rnd(1)<0.8 tehn locate int(rnd(1)*8+3),24
      105 print chr$(215)
      110 locate 17,5:print "               "
      120 locate 17,6:print"Punti  :";s
      130 a$=inkey$
      140 y=y-(a$=chr$(28) and y<11)+(a$=chr$(29) and y>2)
      150 c=vpeek (6176+y)
      160 if c=215 or c=219 then play "cde":end
      170 s=s+1
      180 goto 70
		  

L'MSX che crea il gioco tipo Arkanoid

      20 cls:input" Fornisci un numero intero :";f
      30 for i=1 to f:y=rnd(1):next
      40 screen 3:color 11,13,15:cls
      50 fori=1 to 18
      60 pset (36+4*i,20),1
      70 pset (40,4*i+20),0:pset (108,4*i+20),0
      80 next i
      90 for i=1 to 7
      100 for j=11 to 26
      110 pset (4*j,4*i+20),i+3
      120 next j
      130 next i
      140 h=-1:k=-0.5:j=18:i=17:y=j
      150 pset (4*y-8,96),13:pset (4*y-4,96),1:pset (4*y,96),1
      155 pset (4*y+4,96),1 :pset (4*y+8,96),13
      160 a$=inkey$
      170 y=y-(a$=chr$(28) and y<28)+(a$=chr$(29) and y>8)
      180 if t=1 then pset (4*j,4*i+20),13
      190 if i>22 then r$=input$(2)
      200 if i>22 then screen 0:print"Il tuo punteggio: ";s
      205 r$=input$(1):goto 40
      210 i=i+h:j=j+k
      220 c=point(4*j,4*i+20)
      230 if c=13 then pset (4*j,4*i+20),0:t=1:goto 150
      240 if c=0 then 280
      250 if c<>1 then f=c: pset (4*j,4*i+20),0 :t=1: goto 300
      260 h=-h
      270 k=rnd(1)-rnd(1)
      280 k=-k:t=0:play "l64n80"
      290 goto 150
      300 s=s+f:play "l64n60"
      310 k=-(k-(2*(rnd(1)<0.5)+1)*rnd(1)/3)
      320 h=-h
      330 goto 150
		  

L'Apple che consente di stampare lo schermo

Utilizzare la pressione dei tasti Control e P contemporaneamente (importante è di ricordarsi di accendere la stampante posta nello Slot 1)

      100 rem Stampa lo schermo
      110 for I = 768 to 868
      120 read a
      130 poke i,a
      140 ck=ck+a
      150 next I
      160 if ck<>11453 then print chr$(7);"errore nelle linee 1000-1090":end
      163 call 768
      164 home
      165 print"Lo screen printer è installato!!"
      168 print
      170 input "Vuoi salvarlo come file binario? ";a$
      175 print
      180 if left$(a$,1)<>"S" then end
      190 input "Con quale nome? ";a$
      195 print
      200 print chr$(4);"bsave ";a$;",A768,L100"
      205 print
      210 print "da adesso puoi usare 'brun ";a$;"' per"
      220 print "eseguire questo programma"
      1000 data 169,11,133,56,169,3,133,57,76,234
      1010 data 3,32,27,253,201,144,208,6,32,25
      1020 data 3,76,12,253,96,72,138,72,152,72
      1030 data 165,36,72,169,40,141,249,5,169,0
      1040 data 141,121,6,169,137,141,249,6,169,1
      1050 data 141,121,7,162,0,138,32,193,251,160
      1060 data 0,177,40,201,160,176,4,105,64,208
      1070 data 248,32,2,193,200,192,40,144,238,169
      1080 data 141,32,2,193,232,224,24,144,222,104
      1090 data 133,36,32,34,252,10,4,168,104,170,104,96
      1110 rem cifra di controllo = 11453
		  

Lo Spectrum per tracciare una curva ad alta risoluzione

      100 border 0: paper 0: cls
      110 ink 6
      120 for x= 0 to 255
      130 plot x,x*x/380
      140 next x
      150 for x= 0 to 255
      160 plot x,x*x/380
      170 draw 0,-(x*x/380)
      180 next x
      190 pause 200: ink 5: cls
      200 for x=0 to 255
      210 let y=rnd*x/1.5
      220 plot x,y
      230 draw 0,-y
      240 next x
      250 pause 200: ink 3: cls
      260 for x= 0 to 255
      270 plot x,ln(x/5+1)*40
      280 next x
      290 for x=0 to 255
      300 let y= ln(x/5+1)*40
      310 plot x,y
      320 draw 0,-y
      330 next x
      340 pause 200: ink 4:cls
      350 for x=0 to 255
      360 plot x,80+cos(pi/180*(180+x*1.41))*80
      370 next x
      380 for x=0 to 255
      390 let y=80+cos(pi/180*(180+x*1.41))*80
      400 plot x,y
      410 draw 0,-y
      420 next x
		

Tutti i listati BASIC



Copyright 2003 - 2026 (c) Cerco Commodore - Tutti i diritti riservati - Privacy e cookie - Termini e condizioni