Programas C64
Basic
Actualizado el 28 de Diciembre del 2025 por Adelino (28 códigos) (Publicado el 2 de Julio del 2021)
10.042 visualizaciones desde el 2 de Julio del 2021
Recopilacion de 3 programas para commodore 64 en disco D64.

























TETRIS
------
10 poke 53280,0: poke 53281,0
20 print chr$(147)
30 dim A(2,7,3,3),C(7,3,3)
40 dim D(279),H(279),Q(279)
50 dim E(255),B(27),Y(27)
60 G(0)=1: G(1)=2: G(2)=3
70 X(0)=10: X(1)=1: X(2)=-1
80 E(29)=1: E(17)=2: E(32)=3
90 c=10: q=55200
100 rem **** Pantalla ****
110 for y=1 to 27120 a=11: B(y)=c
130 n=n+10: q=q+30
140 if y>2 then poke q+10,11: poke q-54262,207
150 for x=0 to 9160 if y<3 then Q(c)=2
170 if y>2 then Q(c)=q: poke q,a: poke q-54272,207
180 if a then D(c)=a: if y<27 then a=0
190 H(c)=y: c=c+1: q=q+1
200 next x,y210 for g=0 to 3: c=g<1
220 for a=1 to 7: n=0
230 for y=-c to c+3
240 for x=0 to 3250 if c then read q
260 if g then q=A(g-1,a,y,x)
270 if q then C(a,g,n)=x+B(y): n=n+1: if q>g then A(g,a,x,3-y)=3
280 next x,y,a,g
290 p=int(rnd(0)*7)+1
300 rem *** Inicio ***
310 for n=0 to 3320 c=C(p,0,n)+14
350 if D(c) goto 350
360 poke Q(c),p: poke Q(n),0
370 V(n)=c: D(c)=-1
380 next
390 a=p: c=14: g=0
400 p=int(rnd(0)*7)+1
410 for n=0 to 3420 Q(n)=Q(C(p,0,n)+80)+176
430 poke Q(n),p: poke Q(n)-54272,207
440 next
500 rem **** Rutina ****
510 get e$: if e$<>"" then n=asc(e$): goto 500
520 x=X(E(n)): y=g: if x=0 then g=G(y)
540 c=c+x: n=0
550 W(n)=c+C(a,g,n)
560 if D(W(n))>0 goto 700
570 if n<3 then n=n+1: goto 550
580 for n=0 to 3590 y=W(n): if D(y)=0 then poke Q(y),a
600 D(y)=D(y)-1
610 next
620 for n=0 to 3630 y=V(n): D(y)=D(y)+1
640 if D(y)=0 then poke Q(y),0
650 V(n)=W(n)
660 next
670 goto 500
700 rem **** Lineas ****
710 if x<10 then c=c-x: g=y: goto 500
720 for n=0 to 3730 y=H(V(n))
740 if Y(y)<8 then Y(y)=Y(y)+1: D(V(n))=a: goto 850
750 for c=B(y)+1 to B(y)+9
760 D(c)=D(c-10)
770 poke Q(c),D(c)
780 next
790 Y(y)=Y(y-1): y=y-1
800 if Y(y) goto 750
850 next
860 goto 300
900 rem **** Piezas ****
910 data 0,0,0,0,1,1,1,1
920 data 0,1,0,0,0,1,1,1
930 data 0,0,1,0,1,1,1,0
940 data 0,1,1,0,0,0,1,1
950 data 0,1,1,0,1,1,0,0
960 data 0,1,0,0,1,1,1,0
970 data 0,1,1,0,0,1,1,0
MURO
------
10 poke 53280,0: poke 53281,0
20 print chr$(147)
30 dim A(559)
40 a=55296: d=54272: h=248
50 c=a: b=a+940: n=a+159
100 rem **** Pantalla ****
110 for y=0 to 8: n=n+2: e=e=0
120 for x=1 to e+20
130 g=e<0 or x>1 and x<20
140 for p=0 to -g
150 poke n,h: poke n-d,40*p+207
160 A(n-a)=n-g-p-p: n=n+1
170 next p,x,y
180 for n=a to a+39
190 poke n,11: poke n-d,207
200 poke n+960,0: poke n+960-d,249
210 next
220 for y=1 to 23: c=c+40
230 poke c,11: poke c-d,207
240 poke c+39,11: poke c+39-d,207
250 next
260 c=b+40: g=20: p=246
270 x=-1: y=-40
300 rem **** Rutina ****
310 poke b,0: b=b+y+x
320 poke b,5: poke b-d,81
330 gosub 600
340 g=g+x: n=b-a: if n<80 then y=40
350 t=-1: if g=1 or g=38 then x=-x: t=1
360 if peek(b+x)=h then poke b+x,0: poke A(n+x),0: x=-x
370 if peek(b+y)=h then poke b+y,0: poke A(n+y),0: y=-y
380 if peek(b+y+x)=h then poke b+y+x,0: poke A(n+y+x),0: y=-y: x=x*t
390 gosub 600
400 if n<920 goto 300500 rem **** Rebote ****
510 n=peek(b+y)=p or peek(b+y+x)=p
520 if n=0 then gosub 600: goto 500
530 x=(c<b+38)*t-(c>b+39)*t: y=-40
540 goto 300
600 rem **** Teclado ****
610 get e$: if e$<>"" then e=asc(e$): goto 600
620 if e=29 and c<a+996 then poke c,0: poke c+4,p: c=c+1
630 if e=17 and c>a+960 then c=c-1: poke c,p: poke c+4,0
640 e=0: return
SUDOKU
--------
10 poke 53280,0: poke 53281,0
20 print chr$(151) chr$(147)
30 dim A(300),K(255),B(2)
40 dim C(80),Q(80),X(80),Y(80),Z(80)
50 K(32)=32: K(46)=32: K(48)=32
60 for v=49 to 57: K(v)=v
70 next
80 b=1133100 rem **** Pantalla ****
110 for v=0 to 2120 for x=0 to 2: read a$: b=b+62
130 for y=0 to 2140 for z=0 to 2150 X(a)=27*v+9*x
160 Y(a)=27*y+9*z+81
170 Z(a)=27*v+9*y+162
190 poke b,K(asc(mid$(a$,3*y+z+1)))
200 poke b-1,66: poke b+1,66
210 poke b-40,67: poke b+40,67
220 poke b+41,91: poke b+54272,15
230 if v+x=0 then poke b-39,114
240 if v+x=4 then poke b+41,113
250 if y+z=0 then poke b+39,107
260 if y+z=4 then poke b+41,115
270 Q(a)=b: a=a+1: b=b+2
280 next z,y,x,v
290 poke 1154,112: poke 1172,110
300 poke b+21,109: poke b+39,125
400 rem **** Teclado ****
410 if e=29 and c<80 then c=c+1
420 if e=157 and c>0 then c=c-1
430 if e=17 and c<72 then c=c+9
440 if e=145 and c>8 then c=c-9
450 if K(e) then poke Q(c),K(e): e=29: goto 400
460 poke Q(c),peek(Q(c))+128
470 get e$: if e$="" goto 470
480 poke Q(c),peek(Q(c))-128
490 e=asc(e$): if e<>13 goto 400
500 rem **** Validar ****
510 for c=0 to 80520 a=peek(Q(c))
530 x=X(c)+a: y=Y(c)+a: z=Z(c)+a
540 if A(x)+A(y)+A(z) then a=32
550 if a=32 then poke Q(c),48: goto 590
560 A(x)=1: A(y)=1: A(z)=1
570 poke Q(c)+54272,30
580 B(c/27)=B(c/27)+1
590 next
600 rem **** Grupos ****
610 for x=0 to 2: y=0
620 if B(1)>B(y) then y=1
630 if B(2)>B(y) then y=2
640 B(y)=-1: z=27*y
650 for c=z to z+26
660 if peek(Q(c))=48 then C(n)=c: n=n+1
670 next c,x680 b=sgn(n)
700 rem **** Rutina ****
710 if b=0 then end720 b=b-1
730 c=C(b)
740 a=peek(Q(c))
750 x=X(c)+a: y=Y(c)+a: z=Z(c)+a
760 if a>48 then A(x)=0: A(y)=0: A(z)=0
800 if a=57 then poke Q(c),48: goto 710
810 a=a+1: x=x+1: y=y+1: z=z+1
820 if A(x)+A(y)+A(z) goto 800
830 A(x)=1: A(y)=1: A(z)=1
840 poke Q(c),a
850 b=b+1: if b<n goto 730
860 get e$: if e$<>" " goto 860
870 goto 720
900 rem **** Ejemplo ****
910 data ....76...
920 data 1...3874.
930 data .7.......
940 data ..4.6.5.1
950 data .67...28.
960 data 3.1.4.6..
970 data .......1.
980 data .2561...9
990 data ...98....
Comentarios sobre la versión: 1.2 (0)
No hay comentarios