-
Notifications
You must be signed in to change notification settings - Fork 1
/
mandel.fiv
128 lines (127 loc) · 1.71 KB
/
mandel.fiv
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
MANDEL
!0000003B
: mandel
gcls
begin 1 while
draw
repeat
key drop
;
-*-
v
XMAX
!00000027
( Maximum X value)
320 constant xmax
-*-
>
YMAX
!00000013
200 constant ymax
-*-
>
GCLS
!0000004A
: GCLS cls <graphics> 4 vmode
0 0 0 xmax 1- ymax 1- FILLBOX
;
-*-
>
DIS
!00000029
: dis
8 0 do
i 0 palette
loop
;
-*-
>
DRAW
!00000289
\ Exploring the Mandelbrot set
: draw <float> <graphics>
x gx f- xc f! \ Compute X corner
xmax 0 do
y gy f- yc f! \ Compute Y corner
gx xc f@ f+ xc f! \ New X corner
ymax 0 do \
gy yc f@ f+ yc f! \ New Y corner
0. fdup \ Stk: 0 0
64 cnt !
64 1 do
fover fover f* 2. f* yc f@ f+ yt f!
fdup f* fswap fdup f* fover fover f+
4. f> if fdrop fdrop i cnt ! leave endif
fswap f- xc f@ f+ yt f@
loop
cnt @ j i pset
loop drop ?term if key drop abort endif
loop
;
-*-
v
X
!00000024
\ Real part start
-2. fconstant x
-*-
>
Y
!00000029
\ Imaginary part start
-2. fconstant y
-*-
>
SX
!00000026
\ Size of real part
4. fconstant sx
-*-
>
SY
!0000002B
\ Size of imagniary part
4. fconstant sy
-*-
>
GX
!00000038
\ Real pixel gap
<float> sx xmax i->f f/ fconstant gx
-*-
>
GY
!0000003D
\ Imaginary pixel gap
<float> sy ymax i->f f/ fconstant gy
-*-
>
XC
!00000032
\ real corner of pixel in progress
fvariable xc
-*-
>
YC
!00000037
\ imaginary corner of pixel in progress
fvariable yc
-*-
>
CNT
!00000037
\ count of iterations until z explodes
fvariable cnt
-*-
>
XT
!0000000E
fvariable xt
-*-
>
YT
!0000000E
fvariable yt
-*-
^
^