Commodore 128

Cari Amici,
Il programma che segue utilizza il C64 come un generatore di note...sfrutta le enormi potenzialità del SID (il suo integrato sonoro). E' interamente scritto in basic 2.0 ed è suddiviso in due funzionalità. All'inizio un menù permette di accedere o ad un piano elettronico oppure ad un editor di suoni. Per mezzo dell'editor di suoni si possono inserire note (fino a 1000) che verranno poi suonate in sequenza...

 

Listato Generatore di suoni

10 poke775,191:clr:print chr$(147):poke53280,3:poke53281,3:a1$="Programma by Pastore Carlo"
20 a2$="(c) 1990":a3$="Premi un tasto":aa=len(a1$):bb=len(a2$):cc=len(a3$)
30 print"qqq]]] in reverse": for i=1 to aa:for j=1 to 50:next j:print mid$(a1$,i,1);:next
40 print"q in reverse":for i = 1 to bb : for j = 1 to 50 : next j : print mid$ (a,i,1):next 45 fori=1to600:next
50 print"q in reverse":fori=1tocc:forj=1to50:nextj:print mid$(a3$,i,1);:next
60 poke198,0:wait198,1:print chr$(147):poke646,1:poke53280,0:poke53281,0:poke198,0
70 print"5 q in reverse 5 ]Menù :":print"3 q in reverse 8 ]1- Music editor"
80 print"2 q in reverse 8 ]2- Piano elettronico" 90 get d$="": if d$="" then
90 100 if d$="1" then 1000 110 if d$="2" then 10000 120 if d$<>"1" or d$<>"2" then 90
1000 print chr$(147):poke 646,1
1010 input"3 q in reverse Quante note vuoi inserire (1-1000)";z
1020 if z<1 or z>1000 then 1000 1030 dim x(z),y(z):n=0
1040 if n=z then 1150
1041 n=n+1
1050 input"cuore in reverse Qual'è la nota";x$
1060 if x$="do" then x(n)=33:y(n)=135:goto 1040
1070 if x$="re" then x(n)=37:y(n)=162:goto 1040
1080 if x$="mi" then x(n)=42:y(n)=62:goto 1040
1090 if x$="fa" then x(n)=44:y(n)=193:goto 1040
1100 if x$="sol" then x(n)=50:y(n)=60:goto 1040
1110 if x$="la" then x(n)=56:y(n)=99:goto 1040
1120 if x$="si" then x(n)=63:y(n)=75:goto 1040
1121 if x$="hd" then x(n)=67:y(n)=15:goto 1040
1130 if x$<>"do" or x$<>"re" or x$<>"mi" or x$<>"fa" or x$<>"sol" then 1040
1140 if x$<>"la" or x$<>"si" or x$<>"hd" then 1040
1150 poke646,7:print chr$(147):print"suono il motivo (s/n) ?"
1160 get r$:if r$="" then 1160
1170 if r$="s" then 1190
1180 clr:print chr$(147):goto 70
1190 sid=54272:fori=0to24:pokesid+i,0:next 1191 print chr$(147):input"Volume (0-15)";v
1192 if v<0 or v>15 then v=15
1193 input "2 q in reverse Forma d'onda (17-33-65-129)";q
1200 print chr$(147):pokesid+24,v:pokesid+5,31:pokesid+6,31:pokesid+4,q
1210 fori=1ton:pokesid+1,x(i):pokesid,y(i):pokesid+4,q:forh=1to180:nexth
1220 pokesid+4,q-1:forj=1to20:nextj:nexti:pokesid+24,0:pokesid+4,q-1
1230 print chr$(147):input"Ancora";s$ 1240 if s$="si" then 1200
1250 clr:print chr$(147):poke646,1:goto 70
10000 w1$="Piano elettronico":w2$="Programma by Pastore Carlo (c) 1990"
10001 xx=len(w1$):yy=len(w2$):print"2 q in reverse";chr$(147)
10002 fori=1toxx:forj=1to50:nextj:print mid$(w1$,i,1);:next
10003 print"q in reverse":for i=1toyy:forj=1to50:nextj:print mid$(w2$,i,1);:next
10010 print"s in reverse 6 q in reverse Q = do - W = re - E = mi - R = fa"
10020 print"q in reverse T = sol - Y = la - U = si - I = do (alto)"
10021 print"q in reverse A = do# - S = re# - D = fa# - F = sol#"
10022 print"q in reverse G = la#":poke198,0
10030 sid=54272:fori=0to24:pokesid+i,0:next:pokesid+24,15:pokesid+4,17
10031 pokesid+5,10:pokesid+6,10
10040 get z$:if z$="" then 10040
10050 if z$="q" then pokesid+4,17:goto 12000
10060 if z$="w" then pokesid+4,17:goto 12010
10070 if z$="e" then pokesid+4,17:goto 12020
10080 if z$="r" then pokesid+4,17:goto 12030
10090 if z$="t" then pokesid+4,17:goto 12040
10100 if z$="y" then pokesid+4,17:goto 12050
10110 if z$="u" then pokesid+4,17:goto 12060
10120 if z$="i" then pokesid+4,17:goto 12070
10130 if z$="a" then pokesid+4,17:goto 12080
10140 if z$="s" then pokesid+4,17:goto 12090
10150 if z$="d" then pokesid+4,17:goto 12100
10160 if z$="f" then pokesid+4,17:goto 12110
10170 if z$="g" then pokesid+4,17:goto 12120
10171 if z$="1" then print chr$(147):clr:end
10180 if z$<>"q" or z$<>"w" or z$<>"e" or z$<>"r" or z$<>"t" then 10040
10190 if z$<>"y" or z$<>"u" or z$<>"i" or z$<>"a" or z$<>"s" then 10040
10200 if z$<>"d" or z$<>"f" or z$<>"g" or z$<>"1" then 10040
12000 pokesid+1,33:pokesid,135:fori=1to180:next:pokesid+4,16:goto 10040
12010 pokesid+1,37:pokesid,162:fori=1to180:next:pokesid+4,16:goto 10040
12020 pokesid+1,42:pokesid,62:fori=1to180:next:pokesid+4,16:goto 10040
12030 pokesid+1,44:pokesid,193:fori=1to180:next:pokesid+4,16:goto 10040
12040 pokesid+1,50:pokesid,60:fori=1to180:next:pokesid+4,16:goto 10040
12050 pokesid+1,56:pokesid,99:fori=1to180:next:pokesid+4,16:goto 10040
12060 pokesid+1,63:pokesid,75:fori=1to180:next:pokesid+4,16:goto 10040
12070 pokesid+1,67:pokesid,15:fori=1to180:next:pokesid+4,16:goto 10040
12080 pokesid+1,35:pokesid,134:fori=1to180:next:pokesid+4,16:goto 10040
12090 pokesid+1,39:pokesid,223:fori=1to180:next:pokesid+4,16:goto 10040
12100 pokesid+1,47:pokesid,107:fori=1to180:next:pokesid+4,16:goto 10040
12110 pokesid+1,53:pokesid,57:fori=1to180:next:pokesid+4,16:goto 10040
12120 pokesid+1,59:pokesid,190:fori=1to180:next:pokesid+4,16:goto 10040

Commodore 128

Sproteggere i giochi del Commodore 64.






Listato

10 poke 775,191:clr:poke53280,0:poke53281,0:a$="p greco in reverse e due parentesi quadre in riverse aperte a sinistra Programma di Pastore Carlo - 1990"
20 s$="0123456789abcdef":print chr$(147):print "12 q in reverse":s=len(a$)
30 fori=1tos:forj=1to50:nextj:print mid$(a$,i,1);:nexti
40 print "2 q in reverse Premi un tasto":poke198,0:wait198,1:poke198,0
50 print chr$(147):poke 646,1:print "Con questo programma potrai inserire":print "un valore in una"
60 print"locazione di memoria per dare ad un gioco vite infinite od altre caratteristiche"
70 print"Durante il caricamento del gioco non dovrai far altro che premere il tasto Restore"
80 print"per una sola volta":print:print
90 print"Premi un tasto":poke198,0:wait198,1:poke198,0
100 print chr$(147):d$=""
110 input "Qual è l'indirizzo della poke";d$:d=int(val(d$))
120 if d=53200 or d=52228 then 100
130 if d<0 or d>65535 then 100
140 print chr$(147):l$=""
150 input"Valore da inserire nella locazione di memoria";l$:xx=int(val(l$))
155 if xx<0 or xx>255 then 140
160 b%=0:h$="":forn=3to0 step -1:d=d-b%*16­(n+1):b%=d/16­n
170 h$=h$+mid$(s$,b%+1,1):next
180 x$=mid$(h$,1,2):v$=mid$(h$,3,4)
190 gg=0:ff=0:kk=len(x$):ll=len(v$)
200 fort=1tokk
210 a=asc(mid$(x$,t,1)):z=a-48+7*(a>57):gg=gg+z*16­(kk-t):next
220 forjj=1toll:bb=asc(mid$(v$,jj,1)):ww=bb-48+7*(bb>57)
230 ff=ff+ww*16­(ll-jj):next:goto1000
240 sys49152:sys53200:print"2 q in reverse due parentesi quadre in reverse aperte a sinistra Ora carica il gioco":end
1000 fori=53200to53228:readd:pokei,d:next
1005 fori=49152to49184:readd:pokei,d:next
1006 poke53213,xx:poke53215,ff:poke53216,gg:goto240
1010 data 169,219,141,24,3,169,207,141,25,3,96,72,169,0,141,0,0,169,71
1020 data 141,24,3,169,254,141,25,3,104,64
1030 data 169,1,141,134,2,169,254,141,32,208,169,246,141,33,208,76,68,229,169,15
1040 data 169,71,141,24,3,169,254,141,25,3,96,96,96

Commodore 128Programma creato da Carlo Pastore

Cari Amici,
questo programma è scritto interamente in basic V2 per Commodore 64. Vi è un uso intensivo di sprites e routines di ridefinizione del set di caratteri...
Credo sia un buon esempio di programmazione che viene dal lontano 1990...
Buon divertimento!!

 

Listato Battaglia navale

10 clr:print chr$(147):poke 646,1:poke53280,0:poke53281,0:poke53272,21
20 print”14 q in reverse 14 ] in reverse ATTENDERE....”
30 print “1 q in reverse 2 ] in reverse CARICAMENTO NUOVO SET DI CARATTERI”
40 poke56334,peek(56334)and254:poke1,peek(1)and251:for i=1 to 33: for j=0 to 7
50 poke12288+i*8+j,peek(12288+i*8+j):nextj:nexti
60 poke1,peek(1)or4:poke56334,peek(56334)or1
70 q1=0:q2=27:q3=28:q4=29:q5=32
80 forb=0to7 :readn :poke12288+(8*q1)+b,n :nextb
90 forb=0to7 :readn :poke12288+(8*q2)+b,n :nextb
100 forb=0to7 :readn :poke12288+(8*q3)+b,n :nextb
110 forb=0to7 :readn :poke12288+(8*q4)+b,n :nextb
120 forb=0to7 :readn :poke12288+(8*q5)+b,0 :nextb
130 data 24,28,30,31,24,255,126,60
140 data 0,56,56,24,24,255,126,60
150 data 129,66,36,24,24,36,66,129
160 data 255,129,129,129,129,129,129,255
170 fori=0to62:readd:poke320+i,d:next
180 fori=0to62:readd:poke832+i,d:next
190 fori=0to62:readd:poke896+i,d:next
200 fori=0to62:readd:poke960+i,d:next
210 fori=0to62:readd:poke15744+i,d:next
220 w1=64*247:fori=0to62:readd:pokew1+i,d:next
230 w2=64*248:fori=0to62:readd:pokew2+i,d:next
240 w3=64*249:fori=0to62:readd:pokew3+i,d:next
250 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,145,120,33,91,64
260 data 33,85,64,45,213,120,37,81,64,25,81,120,0,0,0,18,187,0,42,162,128,42
270 data 162,64,42,187,128,42,162,128,17,58,85,0,0,0,0,0,0
280 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,32,240,1,17,248,3,185,248,127
290 data 255,254,31,255,252,15,255,248,7,255,240,3,255,224,0,0,0,0,0,0,0,0,0
300 data 0,0,0,0,0,0,0,0,0,0,0,0
310 data 0,0,0,0,0,0,0,0,0,0,24,0,0,24,0,4,8,128,2,8,64,7,8,224
320 data 63,255,248,127,255,254,255,255,255,127,255,127,255,254,63,255,248
330 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
340 data 24,0,0,24,0,0,8,0,0,216,0,0,252,0,0,14,0,0,7,0,0,3,128,0
350 data 1,192,0,0,224,0,0,112,0,0,48,0,0,0,0,0,0,0,0,0,0,0,0,0
360 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
370 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

380 data 0,0,0,0,0,0,0,0,0,0,0,24,0,0,60,0,0,126,0,0,126,0,0,60,0,0,24,0
390 data 0,0,0,0,0,0,0,16,0,0,16,0,2,24,64,3,25,192,1,223,128,0,255,128,0,255,0
400 data 0,127,240,0,255,192,3,254,0,15,255,0,0,255,128,1,237,192,1,204,96,3,12
410 data 0,2,4,0,0,4,0,0,0,0,0,0,0
420 data 0,120,0,0,120,12,48,124,24,28,126,120,31,127,240,15,255,240,15,255
430 data 224,7,255,224,7,255,248,31,255,254,127,255,255,255,255,248,255,255
440 data 224,63,255,240,7,255,248,3,255,252,7,255,254,7,255,63,15,255,15
450 data 15,222,3,31,30,0
460 data 0,0,0,0,112,0,0,56,0,0,54,64,14,0,96,15,0,224,6,28,0,0,14,0,0,128,0
470 data 97,195,12,112,193,142,224,1,199,0,24,0,0,58,0,1,24,96,7,0,112,7,128,48
480 data 0,28,16,0,28,0,0,24,0,0,0,0
490 print chr$(147):poke646,1:poke53272,21
500 print”2 q in reverse 12 ] in reverse BATTAGLIA NAVALE”
510 print”2 q in reverse 2 ] in reverse PROGRAMMA BY PASTORE CARLO © 1990”:print”2 q in reverse”
520 print”13 ] in reverse PREMI UN TASTO”:poke198,0:wait198,1:poke198,0
530 print chr$(147):poke53280,1:poke53281,1:poke646,0
540 print”2 q in reverse QUESTO E’ UN GIOCO PER 2 GIOCATORI:”
550 input”1 q in reverse MI DICI IL TUO NOME GIOCATORE 1”;a1$
560 input”1 q in reverse MI DICI IL TUO NOME GIOCATORE 1”;a2$
570 print chr$(147):poke646,1:poke53280,0:poke53281,0
580 aa=0:bb=0:pp=15:oo=15:e$=”abcdefghi”:b$=”123456789”
590 fori=1to3:z(i)=int(rnd(1)*9)+1:d(i)=int(rnd(1)*9)+1
600 d$=mid$(e$,z(i),1):q$=mid$(b$,d(I),1):s$=d$+q$:nexti
610 fori=1to3:x(i)=int(rnd(1)*9)+1:f(i)=int(rnd(1)*9)+1
620 x$=mid$(e$,x(i),1):r$=mid$(b$,f(i),1):j$(i)=x$+r$:nexti
625 if pp<=0 and pp<=0 then 8000
626 if aa=3 or pp<=0 then 3000
630 print”2 q in reverse 2 ] in reverse 1 cuore in reverse GIOCATORE 1: “;a1$
640 print”1 q in reverse POSSIBILITA’ “;pp
650 input”1 q in reverse COORDINATA NUMERICA (1-9)”;l$
655 if len(l$)>1 then print chr$(147):goto 630
660 input”1 q in reverse COORDINATA ALFABETICA (a-i)”;k$
665 if len(k$)>1 then print chr$(147):goto 630
670 c$=k$+l$
671 if cc=1 then goto 681
680 if c$=s$(1) then kk=0:aa=aa+1:cc=1:goto 2000
681 if cc=2 then goto 691
690 if c$=s$(2) then kk=0:aa=aa+1:cc=2:goto 2000
691 if cc=3 then goto 710
700 if c$=s$(3) then kk=27:aa=aa+1:cc=3:goto 2000
710 if c$<>s$(1) or c$<>s$(2) or c$<>s$(3) then kk=28:pp=pp-1:goto 2000
2000 print”s in reverse 11 q in reverse CONTROLLO.”:fort=1to1500:next:poke646,1
2010 poke53272,(peek(53272)and 240)+12:print”cuore in reverse 10 q in reverse 17 ] in reverse ]]]]]”
2020 print”17 ] in reverse ] ]”
2030 print”17 ] in reverse ] ]”
2040 print”17 ] in reverse ] ]”
2050 print”17 ] in reverse ]]]]]”:u=0
2060 u=u+1:poke1523,kk:poke55795,1
2070 fori=1to600:next:poke1523,32:fori=1to600:next:if u=5 then goto 2090
2080 goto 2060
2090 print chr$(147):poke53272,21
2091 if c$=s$(1) then i(1)=2:i(2)=3:h=1:goto 7000
2092 if c$=s$(2) then i(1)=2:i(2)=3:h=1:goto 7000
2093 if c$=s$(3) then i(1)=4:i(2)=5:h=1:goto 7000
2094 goto 3000
3000 if pp<=0 and oo<=0 then 8000
3005 if oo<=0 then 5000
3010 print chr$(147):print”2 q in reverse 2 ] in reverse GIOCATORE 2: “;a2$
3020 print “1 q in riverse POSSIBILITA’: “;oo
3030 input “1 q in riverse COORDINATA NUMERICA (1-9)”;aa$
3040 if len(aa$)>1 then print chr$(147):goto 3030
3050 input”1 q in reverse COORDINATA ALFABETICA (a-i)”;ab$
3060 if len(ab$)>1 then print chr$(147):goto 3050
3070 i$=ab$+aa$
3071 if gg=1 then goto 3081
3080 if i$=j$(1) then kk=0:bb=bb+1:gg=1:goto 6000
3081 if gg=2 then goto 3091
3090 if i$=j$(2) then kk=0:bb=bb+1:gg=2:goto 6000
3091 if gg=3 then goto 3110
3100 if i$=j$(3) then kk=27:bb=bb+1:gg=3:goto 6000
3110 if i$<>j$(1) or i$<>j$(2) or i$<>j$(3) then kk=28:oo=oo-1:goto 6000
5000 if pp<=0 and oo<=0 then 8000
6000 print”s in reverse 11 q in reverse CONTROLLO.”:fort=1to1500:next:poke646,1
6010 poke53272,(peek(53272)and 240)+12:print”cuore in reverse 10 q in reverse 17 ] in reverse ]]]]]”
6020 print”17 ] in reverse ] ]”
6030 print”17 ] in reverse ] ]”
6040 print”17 ] in reverse ] ]”
6050 print”17 ] in reverse ]]]]]”:u=0
6060 u=u+1:poke1523,kk:poke55795,1
6070 fori=1to600:next:poke1523,32:fori=1to600:next:if u=5 then goto 6090
6080 goto 6060
6090 print chr$(147):poke53272,21
6091 if i$=j$(1) then i(1)=2:i(2)=3:h=1:goto 7000
6092 if i$=j$(2) then i(1)=2:i(2)=3:h=1:goto 7000
6093 if i$=j$(3) then i(1)=4:i(2)=5:h=1:goto 7000
6094 goto 625
7000 v=53248:pokev+21,255:pokev+23,255:pokev+29,255:pokev+27,255
7005 poke2041,13:poke2042,14:poke2043,15:poke2044,246:poke2045,247
7006 poke2046,248:poke2047,249
7010 pokev+40,7:pokev+41,2:pokev+42,7:pokev+43,1:pokev+44,1:pokev+45,1
7020 pokev+46,1
7030 fori=1904to2023:pokei,160:nexti
7040 fori=56176to56295:pokei,246:nexti
7050 pokev+i(1),197:pokev+i(2),197
7060 fori=50to190:pokev+6,i:pokev+7,i:nexti
7070 pokev+8,190:pokev+9,190:fori=247to249:poke2041,i:fork=1to100:nextk
7080 nexti:pokev+9,0
7090 pokev+8,195:pokev+9,195:fori=247to249:poke2041,i:fork=1to100:nextk
7100 nexti:pokev+9,0
7110 pokev+8,192:pokev+9,192:fori=247to249:poke2041,i:fork=1to100:nextk
7120 nexti:pokev+8,0:pokev+9,0:pokev+6,0:pokev+7,0:pokev+i(1),0:pokev+i(2),0
7130 if h=1 then 3000
7140 if h=2 then 625
8000 if aa>bb then w1$=”3 ] in reverse GIOCATORE 1”
8010 if bb>aa then w1$=”3 ] in reverse GIOCATORE 2”
8020 if aa=bb then goto 8100
8030 dd=len(w1$):poke2040,5:poke53248,200:poke53249,200:poke53248+21,255
8040 poke53248+23,255:poke53248+29,255:print”cuore in reverse 2 q in reverse 2 ] in reverse IL VINCITORE E’ IL”:y=0
8050 print”s in riverse 3 q in riverse”;”18 spazi”
8060 y=y+1:for i=1 to dd:for j=1 to 50:nextj:print mid$(w1$,i,1);:next i
8070 if y=5 then 8080
8075 goto 8050
8080 goto 8200
8100 print” 3 q in reverse LA GARA E’ PARI: “:poke53248+21,255:poke53248+23,255
8116 poke53248+29,255:poke2040,5:print”3 q in reverse 3 ] in reverse SIETE ENTRAMBI BRAVI!!”:goto 8200
8200 poke53248,200:poke53249,200:print”GIOCHI ANCORA?”:poke198,0
8210 get a$:if a$=”” then 8210
8220 if a$=”s” or a$=”si” then run
8230 print chr$(147):poke 53248,0:poke 53249,0:clr