8-Bit Software Online Conversion

Sliding Block Puzzle - Listing

10REM PUZZLE 20REM VERSION 1 30REM JUNE 84 40REM ROGER SANDO 50REM 30 FRENCH ST. NETHERBY 5062 PH .2720710 60REM 32K 70REM COLOUR OR B/W 80REM DOCUMENTATION IN REM'S ONLY 90REM PAGE=&1900 100MODE1 101*OPT1,0 110VDU23;8202;0;0;0; 120ENVELOPE1,7,2,1,1,1,1,1,121,-10,-5, -2,120,120 130RAM=&3000:SIZE=80 140Q=2:MOV=-1:BLANKX=0:BLANKY=3 150PROCINIT:PROCassemble 160PROCINFO 170PROCload 180PROCRND 190PRINT:PRINT 200REPEAT 210I=INKEY(1) 220*FX15,1 230FORD=0TO12:PROCTIME:NEXT 240IF I=64 THEN PROCcheck:FORD=0TO255: SOUND(D MOD4)+1,-15,D,1:NEXT:PRINTTAB((B LANKX*10)+1,(BLANKY*8)+1);" ";:PRINT TAB((BLANKX*10)+1,(BLANKY*8)+1);MOV;:I=0 :GOTO220 250IF I=88AND BLANKX <3 THENPROCMOVE(B LANKX+1,BLANKY):BLANKX=BLANKX+1 260IF I=90AND BLANKX >0 THENPROCMOVE(B LANKX-1,BLANKY):BLANKX=BLANKX-1 270IF I=58AND BLANKY >0 THENPROCMOVE(B LANKX,BLANKY-1):BLANKY=BLANKY-1 280IF I=47AND BLANKY <3 THENPROCMOVE(B LANKX,BLANKY+1):BLANKY=BLANKY+1 290UNTIL FALSE 300END 310DEFPROCMOVE(X,Y) 320SOUND1,-4,70,3:SOUND2,-4,80,3:SOUND 3,-4,60,3 330X=160*X:Y=640*Y*8 340LOC=&3000+X+Y 350?start=LOC MOD 256:start?1=LOC DIV 256 360MOV=MOV+1:IF MOV>0 PRINTTAB((BLANKX *10)+1,(BLANKY*8)+1);MOV; 370Z=USR(&900):REM BLOCK MOVE 380ENDPROC 390PROCINIT 400DEFPROCINIT:REM BLOCK MOVE 410start=&76:end=&78:row=&74:col=&75 420?start=&0:start?1=&6C:?end=&0:end?1 =&6C 430FORpass=0TO3STEP3 440P%=&900 450[ 460OPT 0 470LDA start 480PHA 490LDA start+1 500PHA 510LDA #7 520STA row 530.L2 LDA #159 540STA col 550LDY col 560.L1 LDA (start),Y 570TAX 580LDA (end),Y 590STA (start),Y 600TXA 610STA (end),Y 620DEY 630CPY #&FF 640BNE L1 650CLC 660LDA start 670ADC #128 680STA start 690LDA start+1 700ADC #2 710STA start+1 720CLC 730LDA end 740ADC #128 750STA end 760LDA end+1 770ADC #2 780STA end+1 790LDY row 800DEY 810STY row 820CPY #&FF 830BNE L2 840PLA 850STA end+1 860PLA 870STA end 880RTS 890] 900NEXT 910ENDPROC 920DEFPROCTIME:REM ALTERNATE COLOURS 930IF A%=1 THEN ENDPROC 940IF TIME<99 THEN ENDPROC 950Q=8-Q 960IF Q=6 THEN W=2 ELSE W=6 970VDU19,0,Q;0;:VDU19,2,W;0; 980TIME=0 990ENDPROC 1000DEFPROCRND:REM MIX SQUARES 1010PRINTTAB((BLANKX*10),(BLANKY*8)+1); "HIT SHIFT";:REPEAT UNTIL INKEY(-1):PRIN TTAB((BLANKX*10),(BLANKY*8)+1);" "; 1020FOR T=0 TO 40 1030SOUND1,-7,RND(255),1 1040FORD=0TO50:NEXT 1050BLANKX=RND(4)-1:BLANKY=RND(4)-1 1060PROCMOVE(BLANKX,BLANKY):MOV=-1 1070NEXT 1080PROCMOVE(BLANKX,BLANKY) 1090ENDPROC 1100DEFPROCassemble:REM VIDEO RAM CHECK SUM 1110FORQ%=0TO3STEP3 1120P%=&C00 1130[OPT0 1140.check 1150LDX #SIZE 1160STX &72 1170.calccrc 1180LDY #0 1190STY &70 1200STY &71 1210.crc1 1220LDA &71 1230EOR RAM,Y 1240STA &71 1250LDX #8 1260.crc2 1270LDA &71 1280ROL A 1290BCC crc3 1300LDA &71 1310EOR #8 1320STA &71 1330LDA &70 1340EOR #&10 1350STA &70 1360.crc3 1370ROL &70 1380ROL &71 1390DEX 1400BNE crc2 1410INY 1420CPY #0 1430BNE crc1 1440INC crc1+4 1450DEC &72 1460BNE crc1 1470RTS 1480] 1490NEXT 1500ENDPROC 1510DEFPROCcheck 1520PRINTTAB((BLANKX*10)+1,(BLANKY*8)+1 );" "; 1530SOUND1,-8,0,60 1540crc1?3=0:crc1?4=48 1550CALL check 1560IF (?&71*&100+?&70)=SUM THEN PROCfi n:REPEAT:PROCTIME:UNTIL FALSE 1570PRINTTAB((BLANKX*10)+1,(BLANKY*8)+1 );"WRONG"; 1580ENDPROC 1590DEFPROCfin 1600SOUND1,1,100,100 1610SOUND2,1,150,100 1620SOUND3,1,200,100 1630PRINTTAB((BLANKX*10)+1,(BLANKY*8)+1 );"CORRECT!"; 1640PRINTTAB((BLANKX*10)+1,(BLANKY*8)+2 );"IN ";MOV; 1650PRINTTAB((BLANKX*10)+1,(BLANKY*8)+3 );"MOVES"; 1660ENDPROC 1670DEFPROCload:REM LOAD PICTURE OF YOU R CHOICE 1680VDU19,3,0;0; 1690VDU19,1,1;0; 1700VDU19,2,3;0; 1710VDU19,0,7;0; 1720CLS 1730 REM 1740*LOAD Flower 1750GCOL0,1:COLOUR129 1760MOVE0,0:MOVE316,0:PLOT85,0,252:PLOT 85,316,252 1770GCOL0,3 1780PRINTTAB(0,30)" Sando 84":MOVE64,60 :DRAW140,60:MOVE160,60:DRAW184,60:MOVE36 ,28:DRAW184,28 1790IF ?&3000=225 THEN A%=0 ELSE A%=1 1800CALL check:SUM=(?&71*&100+?&70) 1810ENDPROC 1820DEFPROCINFO 1830CLS 1840PRINTTAB(4)"SLIDING BLOCK PUZZLE" 1850PRINTTAB(4)"-COMPLETE THE PICTURE." 1860PRINT 1870PRINT" UP" 1880PRINT 1890PRINT" <:>" 1900PRINT 1910PRINT"LEFT <Z> <X> RIGHT" 1920PRINT 1930PRINT" </>" 1940PRINT 1950PRINT" DOWN" 1960PRINT:PRINT:PRINT" <@> TO CHECK PICTURE" 1970PRINT:PRINT" <SPACE BAR> TO CONT INUE":REPEAT UNTIL INKEY(-99) 1980ENDPROC 1990REM 2000REM USER MAY ALTER LINES 1680 TO 1 780 TO LOAD PICTURE OF YOUR CHOICE 2010REM 2020REM A%=0 WILL ENABLE PROCTIME WHIC H CAN PERFORM ANY COLOUR CHANGE REQUIRED