Programas C64
Basic
Actualizado el 28 de Diciembre del 2025 por Adelino (28 códigos) (Publicado el 2 de Julio del 2021)
10.043 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$(0) 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),F(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: F(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+F(Y): N=N+1
280 if Q>G then A(G,A,X,3-Y)=3
290 next X,Y,A,G
300 P=int(rnd(0)*7)+1
390 rem *** Inicio ***
400 for N=0 to 3410 C=C(P,0,N)+14
420 if D(C) goto 420
430 poke Q(C),P: poke Q(N),0
440 V(N)=C: D(C)=-1
450 next
460 A=P: C=14: G=0
470 P=int(rnd(0)*7)+1
480 for N=0 to 3490 Q(N)=Q(C(P,0,N)+80)+176
500 poke Q(N),P: poke Q(N)-54272,207
510 next
520 rem **** Rutina ****
530 get E$: if E$<>"" then N=asc(E$): goto 530
540 X=X(E(N)): C=C+X: N=0
550 Y=G: if X=0 then G=G(Y)
560 W(N)=C+C(A,G,N)
570 if D(W(N))>0 goto 710
580 if N<3 then N=N+1: goto 560
590 for N=0 to 3600 Y=W(N): if D(Y)=0 then poke Q(Y),A
610 D(Y)=D(Y)-1
620 next
630 for N=0 to 3640 Y=V(N): D(Y)=D(Y)+1
650 if D(Y)=0 then poke Q(Y),0
660 V(N)=W(N)
670 next
680 goto 530
700 rem **** Lineas ****
710 if X<10 then C=C-X: G=Y: goto 530
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 810
750 for C=F(Y)+1 to F(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
810 next
820 goto 400
900 rem **** Datos ****
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$(0) chr$(147)
30 dim F(559): A=55296: D=54272
40 C=A: B=A+940: N=A+159: L=248
100 rem **** Pantalla ****
110 for Y=0 to 8: N=N+2: E=E=0
120 for X=1 to E+20
130 M=E<0 or X>1 and X<20
140 for P=0 to -M
150 poke N,L: poke N-D,40*P+207
160 F(N-A)=N-M-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: M=20: P=246: 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 M=M+X: N=B-A: if N<80 then Y=40
350 R=-1: if M=1 or M=38 then X=-X: R=1
360 if peek(B+X)=L then poke B+X,0: poke F(N+X),0: X=-X
370 if peek(B+Y)=L then poke B+Y,0: poke F(N+Y),0: Y=-Y
380 if peek(B+Y+X)=L then poke B+Y+X,0: poke F(N+Y+X),0: Y=-Y: X=X*R
390 gosub 600
400 if N<920 goto 310500 rem **** Rebote ****
510 N=peek(B+Y)=P or peek(B+Y+X)=P
520 if N=0 then gosub 600: goto 510
530 X=(C<B+38)*R-(C>B+39)*R
540 Y=-40: goto 310
590 rem **** Teclado ****
600 get E$: if E$<>"" then E=asc(E$): goto 600
610 if E=29 and C<A+996 then poke C,0: poke C+4,P: C=C+1
620 if E=17 and C>A+960 then C=C-1: poke C,P: poke C+4,0
630 E=0: return
SUDOKU
--------
10 poke 53280,0: poke 53281,0
20 print chr$(151) chr$(147)
30 dim A(242),B(2),C(80),Q(80)
40 dim K(255),X(80),Y(80),Z(80)
50 for V=49 to 57: K(V)=V: next
60 K(32)=32: K(46)=32: K(48)=32
70 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(C)=27*V+9*X
160 Y(C)=27*Y+9*Z+81
170 Z(C)=27*V+9*Y+162
180 A=asc(mid$(A$,3*Y+Z+1))
190 poke B,K(A): poke B+41,91
200 poke B-1,66: poke B+1,66
210 poke B-40,67: poke B+40,67
220 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(C)=B: B=B+2: C=C+1
280 next Z,Y,X,V
290 poke 1154,112: poke 1172,110
300 poke B+21,109: poke B+39,125
310 A=0: C=0
400 rem **** Teclado ****
410 if A=29 and C<80 then C=C+1
420 if A=157 and C>0 then C=C-1
430 if A=17 and C<72 then C=C+9
440 if A=145 and C>8 then C=C-9
450 if K(A) then poke Q(C),K(A): A=29: goto 410
460 poke Q(C),peek(Q(C))+128
470 get A$: if A$="" goto 470
480 poke Q(C),peek(Q(C))-128
490 A=asc(A$): if A<>13 goto 410
500 rem **** Revision ****
510 for C=0 to 80520 A=peek(Q(C))-49
530 if A<0 goto 590540 X=X(C)+A: Y=Y(C)+A: Z=Z(C)+A
550 if A(X)+A(Y)+A(Z) then poke Q(C),32: goto 590
560 B(C/27)=B(C/27)+1
570 A(X)=1: A(Y)=1: A(Z)=1
580 poke Q(C)+54272,6
590 next
600 rem **** Grupos ****
610 for V=0 to 2: X=0
620 for Y=0 to 2630 if B(Y)>B(X) then X=Y
640 next
650 B(X)=-1
660 for C=27*X to 27*X+26
670 if peek(Q(C))=32 then C(N)=C: N=N+1
680 next C,V690 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): Y=Y(C): Z=Z(C)
760 if A=32 then A=0: goto 820
770 A=A-49
780 if A then X=X+A: Y=Y+A: Z=Z+A
790 A(X)=0: A(Y)=0: A(Z)=0
800 if A=8 then poke Q(C),32: 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+49
850 B=B+1
860 if B<N goto 730870 get A$: if A$<>" " goto 870
880 goto 720
900 rem **** Datos ****
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....
No hay comentarios
Incuye el codigo en formato texto de los 3 programas.
Se ejecutan por separado, para su uso se utilizan las teclas de direccion, Espacio y ENTER.