/* SCSUB.C 03-13-92 */ /* see also PLOTSUB.C */ int esc,key,hres,vres,t3,xoff,yoff; int xinc,yinc,e,oldcnt,cnt,x,y,func; int mincnt,maxcnt,i,mode,px,py,pc; char za[6],zb[6],f0[6],temp[6]; char ttime[6],*ti1,*ti2; char t1[6],t2[6],tcnt[6]; esttime(lores,juliaflg,limit,ca,cb,gapx,gapy,acor,bcor) int lores,juliaflg,limit; char ca[6],cb[6],gapx[6],gapy[6]; char acor[6],bcor[6]; $( printf("↰ 1 Estimate plot time"); printf("\n 2 "); if(lores) printf("40 by 48"); else printf("80 by 48"); printf(" preview plot"); printf("\n\nAny Key to Plot"); mode=0;key=getkey(); if(key=='1')mode=1; if(key=='2')mode=2; if(mode) $( poke(82,8); itof(0,f0);vres=192;hres=320; if(lores) hres=160; itof(0,t1);itof(0,t2); mincnt=limit;maxcnt=0; cnt=0;itof(0,tcnt); yoff=73;xoff=121;if(lores)xoff=61; if(mode==1) $( yinc=24;y=12; xinc=40;if(lores)xinc=20; $) else $( yinc=4;y=4;xinc=4; $) poke(752,1);printf("↰↓"); py=0;esc=1; for(;y<vres&&esc;y+=yinc) $( itof(y,temp);fmul(temp,gapy,zb); fadd(zb,bcor,zb); if(mode==1) $( x=20;if(lores) x=10; $) else x=4; px=0;for(;x<hres&&esc;x+=xinc) $( ti1=dpeek(19); itof(x,temp); fmul(temp,gapx,za); fadd(za,acor,za); if(juliaflg) cnt=iterfix(ca,cb,limit,za,zb); else cnt=iterfix(za,zb,limit,f0,f0); pc=transfrm(cnt); i=0;for(;i<30;i++); ti2=dpeek(19); e=ti1>>8;ti1&=255; ti1=ti1<<8;ti1|=e; e=ti2>>8;ti2&=255; ti2=ti2<<8;ti2|=e; t3=ti2-ti1;t3&=1023; itof(t3,temp); if(cnt==limit)fadd(t2,temp,t2); else fadd(t1,temp,t1); itof(cnt,temp); fadd(tcnt,temp,tcnt); if(cnt<mincnt) mincnt=cnt; if(cnt>maxcnt) maxcnt=cnt; printf("X=%-4d Y=%-4d\n",x,y); printf("I=%-4d T=%-4d\n",cnt,t3); printf("↑↑"); if(mode==2) $( if(lores==0) $( if(px==0)pc=transfrm(cnt); if(cnt==limit)pc=(px+py)&1; $) pplot(px+xoff,py+yoff,pc); $) poke(77,0); key=peek(764);poke(764,255); if(key==28)esc=0;else esc=1; px++; $) py++; $) poke(82,2); if(esc) $( move(t2,ttime,6);itof(2,temp); fdiv(ttime,temp,ttime); move(t1,temp,6); fadd(ttime,temp,ttime); if(mode==1) $( if(lores)atof(temp,"7.5"); else atof(temp,"3.75"); $) else atof(temp,"225"); fdiv(ttime,temp,ttime); t3=ftoi(ttime); /* in minutes ti1=t3/60;ti2=t3;ti2-=ti1*60; if(mode==1)itof(64,temp); else $( if(lores)itof(1920,temp); else itof(3840,temp); $) fdiv(tcnt,temp,tcnt); printf("\fIteration count range...\n"); cnt=ftoi(tcnt); printf("Min:%-4d Max:%-4d Avg:%-4d\n",mincnt,maxcnt,cnt); printf("Estimated time %d:",ti1); if(ti2<10) printf("0"); printf("%d (hrs:min)",ti2); printf("\nPlot Image (Y/N)"); key=toupper(getchar()); if(key=='Y')mode=0; $) $) poke(764,255); return(mode); $) ptitle() $( printf("=== FRACTAL MICROSCOPE ===\n"); printf("Programmed by Terry Newton\n"); i=0;while(i<2000) $( i++;if(peek(764)<255)i=2000; $)poke(764,255); $) quitdos() $( poke(82,2); printf("↰↓Press RETURN for DOS\n"); i=getkey();if(i==155) $( dpoke(0x7FFE,43605); dpoke(0x6EFE,43605); poke(752,0);printf("↰");exit(); $) $) pnewplot() $( printf("↰↓New Plot\n"); printf("Are you sure? (Y/N)"); $) pplotima() $( printf("↰↓While plotting ESC Fast"); i=0;while(i<2000) $( i++;if(peek(764)<255)i=1000; $)poke(764,255); $) pnewjul() $( printf("↰↓Julia Plot\n"); printf("Are you sure? (Y/N)"); $) /* main menu screen */ pmenu(lores,juliaflg,drvnum) int lores,juliaflg,drvnum; $( poke(82,0); printf("↰FRACTAL MICROSCOPE "); if(lores)printf("(LR "); else printf("(HR "); if(juliaflg==0)printf("Mandelbrot)"); else printf("Julia)"); printf("\n N New P Plot D Data V View"); printf("\n S Save L Load F Files 1-8 D%d:",drvnum); printf("\n C Color X Exit M Magnify"); poke(764,255); while(peek(764)==255)poke(77,0); key=toupper(getkey()); if(key=='N')func=1; if(key=='P')func=2; if(key=='S')func=3; if(key=='L')func=4; if(key=='M')func=5; if(key=='V')func=6; if(key=='C')func=7; if(key=='D')func=8; if(key=='X')func=9; if(key=='F')func=10; if(key>'0'&&key<'9') $( drvnum=key-48;func=drvnum+20; $) poke(82,2);return(func); $)