Listing 1 /* The following declarations are excerpted from my Mandelbrot program's header file; since practically the whole program consists of specialized functions useful in this task only, all variables related to the screen and to the map are global and there is relatively little ``information hiding'' and parameter passing. */ struct pt target, center; struct {double x, y;} orig; /* this is a pixel, but it is stored as a double because it can easily get bigger than a long integer */ double a_step, b_step, a, b, xbeg, ybeg; int make_frame, imported; unsigned int scrwid, scrht, times, step, disc, pelrow, pelcol; unsigned int maxx, maxy, scrx0, scry0, discrim; unsigned long mag, ncalcs; #define VIEWAR 1.33 /* screen aspect ratio */ int iter(a,b,t,d) double a, b; int t, d; { register int n = 0, tt; double x, y, xx, yy, xxx; extern int chkkbd(); x = y = 0; tt = t; while (n < tt && (xx = x*x) + (yy = y*y) < d) { xxx = xx - yy + a; y = 2*x*y + b; x = xxx; n++; } if (chkkbd() == 27) return -1; if (n == t) return 0; else return n; } #include int chkkbd() { extern int kbhit(), getch(); return kbhit() ? getch() : 0; } Listing 2 void makemap() { register int n; for (;pelrow used in the aim-and-frame routine */ orig.y = scry0 + scrht/2 - (center.y/b_step); if (!imported) { b = ybeg; pelrow = 0; ncalcs = 0; } else b = ybeg + b_step * pelrow; /* resume incomplete map */ imported = 0; return make_frame; }