Home » Personal collection » Commodore disks » disk50a2_progs1.d64 » cube render
cube render
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Personal collection » Commodore disks » disk50a2_progs1.d64 |
Filename: | cube render |
Read OK: | ✔ |
File size: | 06CE bytes |
Load address: | 0801 |
Exec address: | 0000 |
Duplicates
There is 1 duplicate copy of this file in the archive:
- Personal collection » Commodore disks » disk42a_unlabelled.d64 » basic
- Personal collection » Commodore disks » disk50a2_progs1.d64 » cube render
File contents
10 REM CUBE RENDER - BY D.FORD 20 : 100 XM=39:YM=24:CA=42 102 PRINT"<clr><red>" 103 FORR=$0400 TO $07F8:POKER,160:NEXT 104 FORR=$D800 TO $DC00:POKER,2:NEXT 110 FOR X=0 TO XM 120 FOR Y=0 TO YM 125 LS=0:SO=0:OM=0 130 XP=0:YP=0:ZP=0:THETA=20+X*50/XM 140 ALPHA=20+Y*50/YM 150 GOSUB 2000:REM CO-ORDS 155 POKE214,23:POKE211,0:SYS 58732 157 PRINT"<white> "; 158 POKE214,23:POKE211,0:SYS 58732 159 PRINTXN;YN;ZN; 160 GOSUB 50000 170 IF RI<>OM THEN GOSUB 500 175 OM=RI 180 IF INT(ZN)=40 AND INT((YN+XN)/2)=(YN+XN)/2 THEN LS=1 185 IF XN>40 OR XN<0 OR YN<0 OR YN>40 OR ZN<0 OR ZN>40 THEN SO=1000 187 XP=XN:YP=YN:ZP=ZN 190 SO=SO+1:IF SO<750AND LS<>1THEN 150 200 C=0 210 IF LS=1 THEN C=1 220 POKE $D800+X+Y*40,C 230 NEXT:NEXT 240 GOTO 240 490 : 500 REM LEAVE GLASS BLOCK 505 IF RI<>0 THEN 3000 510 GOSUB 1000 520 IF IT>CA THEN GOTO 6000 530 GOTO 5000 990 : 1000 REM GET ANGLE I 1010 XP=INT(X) 1020 IF XP=85 OR XP=170 THEN 1050 1030 IT=TH:IA=AL:SR=0 1035 TS=TH:AS=AL 1040 RETURN 1050 IT=90-TH:SR=1:IA=90-AL 1060 IF IT<0 THEN IT=IT+360 1070 IF AL<0 THEN AL=AL+360 1080 TS=TH:AS=AL 1090 RETURN 1990 : 2000 REM UPDATE CO-ORDINATES 2010 XN=XP+COS(π*TH/180)*SQR(1-SIN(π*AL/180)^2) 2020 YN=YP+SIN(π*AL/180) 2030 ZN=ZP+SIN(π*TH/180)*SQR(1-SIN(π*AL/180)^2) 2040 RETURN 2990 : 3000 REM REFRACTION 3005 POKE 53280,0 3010 GOSUB 1000 3030 IT=(SIN(π*IT/180)/RI) 3040 IT=ATN(IT/SQR(-IT*IT+1))/π*180 3050 IA=(SIN(π*IA/180)/RI) 3060 IA=ATN(IA/SQR(-IA*IA+1))/π*180 3070 GOSUB 4000 3080 RETURN 3990 : 4000 REM RESET ANGLE 4010 IF SR=0 THEN TH=IT:AL=IA 4020 IF SR=1 THEN TH=90-IT:AL=90-IA 4030 IF TH<0 THEN TH=TH+360 4040 IF AL<0 THEN AL=AL+360 4045 XN=INT(XN):YN=INT(YN):ZN=INT(ZN) 4050 RETURN 4990 : 5000 REM REFRACT NO MORE! 5005 POKE 53280,2 5010 TH=TS:AL=AS 5015 XN=INT(XN):YN=INT(YN):ZN=INT(ZN) 5020 RETURN 5990 : 6000 REM TOTAL INTERNAL REFLECTION 6005 POKE 53281,15 6010 TH=180-TH:AL=180-AL 6015 XN=INT(XN):YN=INT(YN):ZN=INT(ZN) 6020 RETURN 6990 : 50000 REM GET REFRACTIVE INDEX 50010 RI=0 50020 IF XN>15 AND XN<25 AND YN>15 AND YN<25 AND ZN>15 AND ZN<25 THEN RI=1.47 50030 RETURN 59990 :
� CUBE RENDER - BY D.FORD % : ;d XM�39:YM�24:CA�42 Ef �"�"