aboutsummaryrefslogtreecommitdiff
path: root/examples/mandel.zc
diff options
context:
space:
mode:
Diffstat (limited to 'examples/mandel.zc')
-rw-r--r--examples/mandel.zc11
1 files changed, 7 insertions, 4 deletions
diff --git a/examples/mandel.zc b/examples/mandel.zc
index 0a8f69e..b389d40 100644
--- a/examples/mandel.zc
+++ b/examples/mandel.zc
@@ -1,3 +1,6 @@
+namespace;
+include rt;
+
// the mandelbrot set in 16.16 fixed point. a word is 64 bits, so the product
// fits and the point sits 16 bits down. the jit inlines it as a multiply and a shift.
enhance fmul(a, b) micro "a = mul a b; a = sar a 16";
@@ -16,17 +19,17 @@ int escape(int cx, int cy) {
}
return MAXIT;
}
-fn main() {
+void main() {
int row = 0;
while (row < H) {
int col = 0, cy = (row * 2400 / (H - 1) - 1200) * ONE / 1000;
while (col < W) {
int cx = (col * 3200 / (W - 1) - 2200) * ONE / 1000, it = escape(cx, cy);
- put_c(it == MAXIT ? '@' : shades[it * 11 / MAXIT]);
+ rt.put_c(it == MAXIT ? '@' : shades[it * 11 / MAXIT]);
col++;
}
- put_c(10);
+ rt.put_c(10);
row++;
}
- return 0;
+ return;
}