1 REM DISPLAY A BARNSLEY FERN ON THE CROMEMCO DAZZLER 2 REM FOR MICROSOFT BASIC-80 FOR CP/M (REV 5.21) 3 REM BY BILL SUDBRINK JANUARY 1994 10 DIM A(4), B(4), C(4), D(4), E(4), F(4), P(4) 20 DATA 4 30 DATA 0, 0, 0, .16, 0, 0, .01 40 DATA .2, -.26, .23, .22, 0, 1.6, .07 50 DATA -.15, .28, .26, .24, 0, .44, .07 60 DATA .85, .04, -.04, .85, 0, 1.6, .85 70 READ M 80 PT = 0 90 FOR J = 1 TO M 100 READ A(J), B(J), C(J), D(J), E(J), F(J), PK 110 PT = PT + PK 120 P(J) = PT 130 NEXT J 135 REM DAZZLER ON, BUFFER AT C000 140 OUT 14,224 145 REM X4 COLOR 2K MEM HIGH INTENSITY GREEN 150 OUT 15,122 155 REM ZERO THE DISPLAY BUFFER 160 FOR X=0 TO 2047 170 POKE 49152!+X,0 180 NEXT X 190 GOTO 250 200 FOR ZZ = 0 TO 127 210 SX = ZZ 220 SY=ZZ 230 GOSUB 430 240 NEXT ZZ 250 XSCALE=14 260 YSCALE=19 270 XOFFSET = -20 280 YOFFSET=55 290 X = 0 300 Y = 0 310 N = 0 320 PK = RND (-2) 330 PK = RND (1) 340 IF PK <= P(1) THEN K = 1 ELSE IF PK <= P(2) THEN K = 2 ELSE IF PK <= P(3) THEN K = 3 ELSE K = 4 350 AX = A(K) * X + B(K) * Y + E(K) 360 AY = C(K) * X + D(K) * Y + F(K) 370 X = AX 380 Y = AY 390 SX = INT (Y * XSCALE + XOFFSET) 400 SY = INT (X * YSCALE + YOFFSET) 410 IF N < 10 THEN N = N + 1 ELSE GOSUB 430 420 GOTO 330 425 REM SUBROUTINE TO SET A BIT 430 PRINT SX,SY 435 REM BE SURE THE COORDINATES MAKE SENSE 440 IF SX < 0 THEN RETURN 450 IF SX > 127 THEN RETURN 460 IF SY < 0 THEN RETURN 470 IF SY > 127 THEN RETURN 475 REM AB ADDRESS OF BYTE 480 AB=49152! 490 IF SX < 64 THEN GOTO 520 500 AB = AB + 512 510 SX = SX - 64 520 IF SY < 64 THEN GOTO 550 530 AB = AB + 1024 540 SY = SY - 64 550 REM CALCULATE FINAL ADDRESS 560 AB = AB + (16 * INT (SY / 2)) 570 AB = AB + INT (SX / 4) 575 REM PEEK CURRENT CONTENTS 580 BB = PEEK(AB) 590 OD = SY AND 1 600 SF = SX AND 3 605 REM FIGURE OUT THE BIT 610 IF OD = 1 THEN GOTO 670 620 BT = 1 630 IF SF = 3 THEN BT = 32 640 IF SF = 2 THEN BT = 16 650 IF SF = 1 THEN BT = 2 660 GOTO 710 670 BT = 4 680 IF SF = 3 THEN BT = 128 690 IF SF = 2 THEN BT = 64 700 IF SF = 1 THEN BT = 8 705 REM SET THE BIT 710 BB = BB OR BT 720 POKE AB,BB 730 RETURN 735 REM A FEW LINES TO SET ARBITRARY PIXELS (NOT USED) 740 INPUT "X",SX 750 INPUT "Y",SY 760 GOSUB 430 770 GOTO 740