-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMANDELBR.BAK
72 lines (65 loc) · 1.29 KB
/
MANDELBR.BAK
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
program Mandelbroto_kreive;
{$DEFINE al}
const
maxsp : byte = 255;
minx ={ -2 } -0.2100050;
maxx ={ 1.25 } -0.2100055;
miny ={ -1.25} -0.8200050;
maxy ={ 1.25 } -0.8200055;
var
ckx, cky : word;
sp : byte;
pgx, pgy : real;
procedure putpixel (x, y : word; sp : byte);
begin
mem [$a000 : 320 * y + x] := sp
end;
procedure setpal;
var
ck : byte;
begin
for ck := 1 to maxsp do
begin
port [$3C8] := ck;
port [$3C9] := 0;
port [$3C9] := (maxsp - ck) div 12;
port [$3C9] := (maxsp - ck) div 4
end
end;
function mand (x, y : real) : byte;
var
ck : byte;
sa, a, b,
z : real;
begin
ck := 0; a := 0; b := 0;
repeat
sa := a;
a := sqr (a) - sqr (b) + x;
b := 2 * sa * b + y;
z := sqr (a) + sqr (b);
inc (ck)
until (z > 4) or (ck >= maxsp);
mand := ck
end;
begin
asm
mov ax, 13h
int 10h
end;
setpal;
{$IFNDEF pal}
pgx := (maxx - minx) / 320;
pgy := (maxy - miny) / 200;
for ckY := 0 to 199 do
for ckx := 0 to 319 do
putpixel (ckx, cky, mand (minx + pgx * ckx, miny + pgy * cky));
{$ELSE}
for ckx := 0 to 255 do for cky := 0 to 20 do putpixel (ckx, cky, ckx);
{$ENDIF}
repeat until port [$60] = 1;
asm
mov ax, 3h
int 10h
end
end.