0 REM"[141][147][146]TOMZ/TIDE/THE DARK REALM 1 [143]"SYS 2 PRINT"[147]":POKE53280,0:POKE53281,0 10 DIMX(48),Y(48),S(3),T(3),U(12),V(12),XT(48),YT(48) 20 FOR K=1 TO 3 30 READX(K),Y(K) 40 NEXTK 50 DATA150,50,250,150,50,150 60 GOSUB500:REM HI-RES SCREEN 70 FOR N=0 TO 1 80 FOR K=1 TO4^N 90 GOSUB4000:REM SUB DIVIDE TRIANGLES 100 NEXT K 110 FOR K=1 TO 4^(N+1)*3 120 X(K)=XT(K): Y(K)=YT(K) 130 NEXT K 140 NEXT N 150 FOR K=1 TO 16 160 FOR J=1 TO 3 170 S(J)=X(J+3*(K-1)):T(J)=Y(J+3*(K-1)) 180 NEXT J 190 GOSUB3000:REM PLOT EACH TRIANGLE 200 NEXT K 210 END 500 POKE53272,PEEK(53272) OR 8 510 POKE53265,PEEK(53265) OR 32 520 FOR I=8192 TO 16192:POKE I,O:NEXT I 530 FOR I=1024 TO 2023:POKE I,22:NEXT I 540 RETURN 1000 RO=INT(R/8):CO=INT(C/8) 1010 L=R AND 7 1020 BIT=7-(C AND 7) 1030 BYTE=8192+RO*320+CO*8+L 1040 POKE BYTE,PEEK(BYTE) OR 2^BIT 1050 RETURN 2000 DX=X2-X1:DY=Y2-Y1 2010 IF DX=0 THEN 2070 2020 FOR C=X1 TO X2 STEP SGN(DX) 2030 R=INT(Y1+(C-X1)*DY/DX) 2040 GOSUB1000:REM PLOT POINT 2050 NEXT C 2060 RETURN 2070 C=X1 2080 FOR R=Y1 TO Y2 STEP SGN(DY) 2090 GOSUB1000:REM PLOT POINT 2100 NEXT R 2110 RETURN 3000 X1=S(3):Y1=T(3) 3010 FOR P=1 TO 3 3020 X2=S(P):Y2=T(P) 3030 GOSUB2000:REM DRAW LINE 3040 X1=X2:Y1=Y2 3050 NEXT P 3060 RETURN 4000 FOR M=1 TO 3 4010 S(M)=X(M+3*(K-1)):T(M)=Y(M+3*(K-1)) 4020 NEXT M 4030 GOSUB5000:REM SUB-DIVIDE THIS TRIANGLE 4040 FOR M=1 TO 12 4050 XT(M+12*(K-1))=U(M):YT(M+12*(K-1))=V(M) 4060 NEXT M 4070 RETURN 5000 A1=(S(1)-S(2))*0.2*(RND(0)-0.5) 5010 B1=(S(1)-S(3))*0.2*(RND(0)-0.5) 5020 C1=(S(2)-S(3))*0.2*(RND(0)-0.5) 5030 A=0.5*(S(1)+S(2))+A1 5040 D=0.5*(T(1)+T(2))+A1 5050 B=0.5*(S(1)+S(3))+B1 5060 E=0.5*(T(1)+T(3))+B1 5070 C=0.5*(S(2)+S(3))+C1 5080 F=0.5*(T(2)+T(3))+C1 5090 U(1)=S(1):U(4)=S(2):U(7)=S(3) 5100 V(1)=T(1):V(4)=T(2):V(7)=T(3) 5110 U(2)=A:U(6)=A:U(12)=A 5120 V(2)=D:V(6)=D:V(12)=D 5130 U(3)=B:U(8)=B:U(11)=B 5140 V(3)=E:V(8)=E:V(11)=E 5150 U(5)=C:U(9)=C:U(10)=C 5160 V(5)=F:V(9)=F:V(10)=F 5170 RETURN