8-Bit Software Online Conversion
Magic Eye - Listing
5ONERROR IF ERR=254 GOTO20 ELSE:REPO
RT:PRINTERL:END
10*RAMOFF
20REM MAGIC3D by L Knight May 1994
30MODE4:DIMA%(60):DIMB%(60)
40FORY%=0TO1023 STEP4
50pD%=15:pP%=0
60FORN%=0TO60:A%(N%)=RND(2)-1:NEXT
70FORX%=0TO1279STEP4
80K%=ABS(740-X%)+ABS(512-Y%):IFK%<450
D%=K%DIV30 ELSED%=15
90L%=D%+45:pL%=pD%+45
100IFpD%>D% PROCforward:GOTO130
110IFpD%<D% PROCback:GOTO130
120P%=(pP%+1)MOD(L%+1)
130GCOL0,A%(P%):PLOT69,X%,Y%
140pP%=P%:pD%=D%:NEXT:NEXT
150*SAVE PICTURE FFFF5800 FFFF8000
155PRINTTAB(0,0)" COMPLETED "'SPC11:VD
U7
160END
170
180DEFPROCforward
190I%=pD%-D%
200FORN%=0TOpL%:B%(N%)=A%((N%+pP%+1)MO
D(pL%+1)):NEXT
210FORN%=0TOL%:A%(N%)=B%(N%+I%):NEXT
220P%=0
230ENDPROC
240
250DEFPROCback
260I%=D%-pD%
270FORN%=0TOpL%:B%(N%)=A%((N%+pP%+1)MO
D(pL%+1)):NEXT
280FORN%=I%TOL%:A%(N%)=B%(N%-I%):NEXT
290FORN%=0TO(I%-1):A%(N%)=RND(2)-1:NEX
T
300P%=0:ENDPROC
310
320REM Line 80 defines a pyramid.
330REM Alternatives for some other
340REM images are given below
350REM FURROWS:-
360REM 80 D%=5.5*SIN((X%+Y%)/100)+7
370REM MEX-HAT:-
380REM 80 K%=450-SQR((740-X%)^2+(512-Y
%)^2):IFK%>0 D%=15-(SIN(K%/55))*K%/70-K%
/60 ELSED%=15
390REM DISKS:-
400REM 80 IF(540-X%)^2+(700-Y%)^2<6200
0 D%=10 ELSE D%=15
410REM 81 IF(940-X%)^2+(700-Y%)^2<6200
0 D%=5
420REM 82 IF(740-X%)^2+(300-Y%)^2<6200
0 D%=0
430REM BALL:-
440REM 80 K%=(740-X%)^2+(512-Y%)^2:IFK
%<93000 D%=7-((SQR(93000-K%))DIV49)MOD16
ELSED%=15
450
460REM Major variables:-
470REM D% = current depth (0 to 15)
480REM pD%= previous depth
490REM L% = current loop length
500REM pL%= previous loop length
510REM P% = current position in loop
520REM pP%= previous position in loop
530
540REM Action of PROCforward:-
550REM Line 200 transfers loop from
560REM array A% to array B%, rotating
570REM the loop so pointer pP% is at
580REM bottom.
590REM Line 210 transfers loop back,
600REM removing the bottom I% digits.
610
620REM Action of PROCback:-
630REM Line 270 - as line 200.
640REM Line 280 transfers loop back,
650REM opening gap at bottom.
660REM Line 290 fills the gap.