include irvine16.inc .code .data ;double xmin = -2.5; // The ranges of x and y coordinates that ; double xmax = 1; // are represented by this drawing surface ; double ymin = -1.25; ; double ymax = 1.25; xmin dword -5 xmax dword 1 ymin dword -5 ymax dword 5 two word 2 four word 4 hundred word 100 status word ? main proc near mov ax,@data mov ds,ax mov es,ax ;;init double precision data values fild xmin fidiv two fistp xmin fild ymin fidiv four fistp ymin fild ymax fidiv four fistp ymax mov ah,0fh int 10h push ax call b10mode call c10display mov ah,10h int 16h pop ax mov ah,0 int 10h mov ax,4c00h int 21h main endp b10mode proc near mov ax,12h int 10h mov ah,0bh mov bx,7 int 10h ret b10mode endp c10display proc near pusha xor bx,bx mov cx,0 mov dx,0 @@20: mov ah,0ch mov al,bl int 10h inc cx cmp cx, 600;;;row/col delimiters in cx,dc jne @@20 mov cx,0 inc bl inc dx cmp dx,500 jne @@20 popa ret c10display endp countIterations proc mov zx,eax mov zy,ebx mov cx,0 top: cmp cx,80 je donecount fild hundred fild zx fabs fcomi st(0),st(1) jnb donecount fild zy fabs fcomi st(0),st(2) jnb donecount donecount:ret ;;;cx is ans ; int countIterations(double x, double y) { to be called XARG, YARG ; // The Mandelbrot set is represented by coloring ; // each point (x,y) according to the number of ; // iterations it takes before the while loop in ; // this method ends. For points that are actually ; // in the Mandelbrot set, or very close to it, the ; // count will reach the maximum value, 80. These ; // points will be colored purple. All other colors ; // represent points that are definitely NOT in the set. ; int count = 0; ; double zx = x; ; double zy = y; ; while (count < 80 && Math.abs(zx) < 100 && Math.abs(zy) < 100) { ; double new_zx = zx*zx - zy*zy + x; ; zy = 2*zx*zy + y; ; zx = new_zx; ; count++; ; } ; return count; ; } end main