Color Puzzle

By gdx

Prophet (2708)

gdx's picture

22-05-2019, 10:42

I try to use OCR to get this BASIC program from MSX-Magazine '88-12.

I copied and pasted the listing on one jpeg with Gimp.

And used the free online OCR below selecting English.
https://www.onlineocr.net/

The result was good! Only a few characters were different (maintly ", :, ;, $, &, <, >, B, K and specific characters). About 30 mn were needed to obtain a functional program.

Then I just a little improved the speed of stages display.

I did not know this game. It is pretty nice. :)

There is the listing:

10 '--------- BLOCK ---------
20 CLEAR 100,&HD000:SCREEN 1,2,0:COLOR 10,1,1:CLS
30 WIDTH 32:KEY OFF:DEFINT A-Z:GOSUB 970:RO=1
40 DI=3:MM=1:NN=1:GOSUB 580:GOSUB 270:GOSUB 300
50 PLAY"V15L32O6CEGB":FOR I=1 TO 3000:NEXT 
60 '--------- MAIN ---------
70 S=STICK(0) OR STICK(1):S=(S+1)\2
80 ST=STRIG(0) OR STRIG(1):V=6144+X+Y*32 
90 IF S=0 GOTO 180
100 DI=S:ON S GOTO 110,130,150,170
110 IF VPEEK(V-31)<97 AND VPEEK(V-32)<97 THEN Y=Y-1
120 GOTO 180
130 IF VPEEK(V+2)<97 AND VPEEK(V+34)<97 THEN X=X+1
140 GOTO 180
150 IF VPEEK(V+64)<97 AND VPEEK(V+65)<97 THEN Y=Y+1
160 GOTO 180
170 IF VPEEK(V-1)<97 AND VPEEK(V+31)<97 THEN X=X-1
180 GOSUB 270
190 IF M<2 OR M>22 THEN MM=-(M<2)+(M>22) 
200 IF N<2 OR N>20 THEN NN=-(N<2)+(N>20) 
210 M=M+MM:N=N+NN
220 GOSUB 300
230 IF ABS(X-M)<2 AND ABS(Y-N)<2 GOTO 950 
240 IF ST THEN GOSUB 340
250 GOTO 70
260 '--------- SPRITES ---------
270 PUT SPRITE 3,(X*8,Y*8),1,DI+2
280 PUT SPRITE 4,(X*8,Y*8),15,DI+6
290 RETURN
300 PUT SPRITE 1,(M*8,N*8),1,1
310 PUT SPRITE 2,(M*8,N*8),11,2
320 RETURN
330 '--------- BLOCKS ---------
340 V=6144+X+Y*32:VV=(DI=1)*64-(DI=2)*2-(DI=3)*64+(DI=4)*2
350 IF VPEEK(V+VV)<>112 AND VPEEK(V+VV)<>128 THEN RETURN
360 H=X-(DI=2)*2+(DI=4)*2:L=Y+(DI=1)*2-(DI=3)*2
370 V=VPEEK(V+VV):HH=H:LL=L
380 H=H-(DI=2)+(DI=4):L=L+(DI=1)-(DI=3) 
390 IF VPEEK(6144+H+L*32-(DI=2)-(DI=3)*32)>96 GOTO 430
400 LOCATE H,L:PRINT CHR$(V);CHR$(V+8);
410 LOCATE H,L+1:PRINT CHR$(V+1);CHR$(V+9);
420 GOTO 380
430 IF H1=HH AND L1=LL THEN H1=H+(DI=2)-(DI=4):L1=L-(DI=1)+(DI=3)
440 IF H2=HH AND L2=LL THEN H2=H+(DI=2)-(DI=4):L2=L-(DI=1)+(DI=3)
450 HH=H+(DI=2)*3-(DI=4)*3:H=X
460 LL=L-(DI=1)*3+(DI=3)*3:L=Y
470 IF H=HH AND L=LL GOTO 520
480 H=H-(DI=2)+(DI=4):L=L+(DI=1)-(DI=3) 
490 LOCATE H,L:PRINT CHR$(96);CHR$(96); 
500 LOCATE H,L+1:PRINT CHR$(96);CHR$(96); 
510 GOTO 470
520 IF (H1=H2 AND ABS(L1-L2)=2) OR (ABS(H1-H2)=2 AND L1=L2) GOTO 540
530 RETURN
540 IF H1=1 OR H2=1 OR H1=23 OR H2=23 THEN RETURN
550 IF L1=1 OR L2=1 OR L1=21 OR L2=21 THEN RETURN
560 RETURN 900
570 '--------- SCREEN ---------
580 FOR I=1 TO 4:PUT SPRITE I,(10,204):NEXT 
590 CLS:ON RO MOD 3+1 GOTO 600,610,620
600 A=&H89:B=&H86:C=&H23:D=&H2C:GOTO 630 
610 A=&H57:B=&H54:C=&H89:D=&H86:GOTO 630 
620 A=&H23:B=&H2C:C=&H57:D=&H54
630 VPOKE &H200E,A:VPOKE &H200F,B
640 VPOKE &H2010,C:VPOKE &H2011,D
650 ON RO GOTO 660,670,680,690,700
660 RESTORE 1450:GOTO 710
670 RESTORE 1470:GOTO 710
680 RESTORE 1490:GOTO 710
690 RESTORE 1510:GOTO 710
700 RESTORE 1530
710 READ X,Y,M,N,H1,L1,H2,L2
720 PRINT STRING$(26,CHR$(104))
730 FOR I=1 TO 22:PRINT CHR$(104);STRING$(24,CHR$(96));CHR$(104):NEXT
740 PRINT STRING$(26,CHR$(104));
750 FOR I=0 TO 20 STEP 2:READ A$
760 A=VAL("&H"+A$):B=2048
770 FOR J=0 TO 22 STEP 2
780 IF (A AND B)=0 GOTO 810
790 LOCATE J+1,I+1:PRINT CHR$(112);CHR$(120);
800 LOCATE J+1,I+2:PRINT CHR$(113);CHR$(121);
810 B=B\2:NEXT:NEXT
820 LOCATE H1,L1:PRINT CHR$(128);CHR$(136);
830 LOCATE H1,L1+1:PRINT CHR$(129);CHR$(137);
840 LOCATE H2,L2:PRINT CHR$(128);CHR$(136);
850 LOCATE H2,L2+1:PRINT CHR$(129);CHR$(137);
860 LOCATE 27,1:PRINT "BLOCK";
870 LOCATE 27,20:PRINT "ROUND";:LOCATE 28,22:PRINT RO;
880 RETURN
890 '--------- ROUND CLEAR ---------
900 RO=RO+1:IF RO>5 THEN LOCATE 5,11:PRINT "CONGRATULATIONS";
910 PLAY"O6CEGBDFAO7C":FOR I=1 TO 5000:NEXT
920 FOR I=1 TO 4:PUT SPRITE I,(0,209):NEXT 
930 IF RO>5 GOTO 930 ELSE 40
940 '--------- MISS ---------
950 PLAY"O6BGEC":FOR I=1 TO 3000:NEXT:GOTO 40
960 '--------- READ DATA ---------
970 FOR I=0 TO 11:READ A$:FOR J=0 TO 1
980 POKE &HD000+I+I+J,VAL("&H"+MID$(A$,J+J+1,2))
990 NEXT:NEXT:DEFUSR=&HD000:A=USR(0)
1000 FOR I=1 TO 10:B$="":FOR J=0 TO 15:READ A$:FOR K=0 TO 1
1010 B$=B$+CHR$(VAL("&H"+MID$(A$,K+K+1,2)))
1020 NEXT:NEXT:SPRITE$(I)=B$:NEXT
1030 FOR I=1 TO 10:READ A:FOR J=0 TO 3:READ A$:FOR K=0 TO 1
1040 VPOKE A*8+J+J+K,VAL("&H"+MID$(A$,K+K+1,2))
1050 NEXT:NEXT:NEXT
1060 FOR I=12 TO 17:READ A$:VPOKE &H2000+I,VAL("&H"+A$):NEXT
1070 RETURN
1080 '--------- DATA ---------
1090 DATA 2180,0111,5801,CD4A,004F,CB39,B1CD,4D00,231B,7AB3,20F0,C900
1100 '
1110 DATA 0003,0C10,2020,4040,4040,2020,100C,0300
1120 DATA 00C0,3008,0404,0202,0202,0404,0830,C000
1130 DATA 0003,0F1F,3F3F,7F7F,7F7F,3F3F,1F0F,0300
1140 DATA 00C0,F0F8,FCFC,FEFE,FEFE,FCFC,F8F0,C000
1150 '
1160 DATA 030C,1020,2040,4040,4020,2010,100C,0300
1170 DATA C030,0804,0402,0202,0204,0408,0830,C000
1180 DATA 030C,1020,2040,4040,4020,2010,1060,1F00
1190 DATA C030,0804,0432,424A,4A24,0408,1860,8000
1200 DATA 030C,1020,204C,5052,5228,2010,100C,0300
1210 DATA C030,0804,0432,0A4A,4A14,0408,0830,C000
1220 DATA 030C,1020,204C,4252,5224,2010,1806,0100
1230 DATA C030,0804,0402,0202,0204,0408,0806,F800
1240 DATA 030F,1F3F,3F7F,7F7F,7F3F,3F1F,1F0F,0300
1250 DATA C0F0,F8FC,FCFE,FEFE,FEFC,FCF8,F8F0,C000
1260 DATA 030F,1F3F,3F7F,7F7F,7F3F,3F1F,1F7F,1F00
1270 DATA C0F0,F8FC,FCCE,BEB6,B6DC,FCF8,F8E0,8000
1280 DATA 030F,1F3F,3F73,6F6D,6D37,3F1F,1F0F,0300
1290 DATA C0F0,F8FC,FCCE,F6B6,B6EC,FCF8,F8F0,C000
1300 DATA 030F,1F3F,3F73,7D6D,6D3B,3F1F,1F07,0100
1310 DATA C0F0,F8FC,FCFE,FEFE,FEFC,FCF8,F8FE,F800
1320 '
1330 DATA  96,0000,0000,0000,0000
1340 DATA 104,55AA,55AA,55AA,55AA
1350 DATA 112,0101,0303,0707,0F0F
1360 DATA 113,1F1F,3F3F,7F7F,FFFF
1370 DATA 120,8080,C0C0,E0E0,F0F0
1380 DATA 121,F8F8,FCFC,FEFE,FFFF
1390 DATA 128,0101,0303,0707,0F0F
1400 DATA 129,1F1F,3F3F,7F7F,FFFF
1410 DATA 136,8080,C0C0,E0E0,F0F0
1420 DATA 137,F8F8,FCFC,FEFE,FFFF
1430 DATA EE,DE,57,54,23,2C
1440 '
1450 DATA 13,11,13,1,9,9,15,13
1460 DATA 56A,FFF,56A,E07,402,E07,402,E07,56A,FFF,56A
1470 DATA 13,11,13,1,11,11,13,9
1480 DATA FDF,F77,FDD,D8F,F02,A07,F0D,D9F,FBB,EEF,FBF
1490 DATA 13,11,13,1,5,15,19,7
1500 DATA 1F8,0F0,06A,000,00A,000,500,000,560,0F0,1F8
1510 DATA 13,11,13,1,3,3,9,11
1520 DATA 000,000,E01,60C,00C,000,300,318,819,000,204
1530 DATA 13,15,13,1,3,11,21,11
1540 DATA 060,060,000,000,1F8,969,1F8,000,000,060,060
Login or register to post comments