Skip to content

Commit

Permalink
Add a little Rust tool to generate the initial values for the steppin…
Browse files Browse the repository at this point in the history
…g width
  • Loading branch information
rmsk2 committed Dec 28, 2022
1 parent 5c1186f commit f97a000
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
10 changes: 9 additions & 1 deletion derive_stepping.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
// ***********************************
// This program can be used to derive the default stepping width
// for X16_mandelbrot. It calcuates the the stepping width depending
// on the section of the complex plane that should be visualized and
// the resolution of the target machine. The output can be used
// by the fixed point arithmetic as implemented in the assembly
// part of the software.
//
// Change here for new values
// ***********************************

Expand All @@ -11,7 +18,7 @@ const Y_LOWER_RIGHT: f64 = -Y_UPPER_LEFT;
// Resolution in X and Y direction
const PIXELS_X: f64 = 320.0;
const PIXELS_Y: f64 = 240.0;
// Accuracy in bytes after the comma
// Accuracy in bytes without the sign byte
const NUM_FIXED_BYTES: u16 = 4;

fn print_mandel_fixed_point(f_in: f64) {
Expand All @@ -31,6 +38,7 @@ fn print_mandel_fixed_point(f_in: f64) {
bit_count += 1;
}

// Also adapt this statement if you change NUM_FIXED_BYTES.
println!("{:06x}", res);
}

Expand Down
6 changes: 6 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

all: mandelbr.prg

deriver: derive_stepping

ifdef MAC
ACME=../acme/acme
WORKDIR=/Users/martin/data/X16_mandelbrot
Expand All @@ -14,6 +16,10 @@ endif
clean:
rm $(WORKDIR)/mandelbr.prg
rm $(WORKDIR)/mandelbr.txt
rm $(WORKDIR)/derive_stepping

mandelbr.prg: main.a arith16.a arith32.a string.a vera.a mandelhelp.a zeropage.a tests.a memory.a disk_io.a rtc.a
$(ACME) -l $(WORKDIR)/mandelbr.txt $(WORKDIR)/main.a

derive_stepping: derive_stepping.rs
rustc derive_stepping.rs
1 change: 1 addition & 0 deletions vera.a
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ drawPoint
lda NUM_ITER
cmp MAX_ITER
beq .plotBlack
clc
adc #47
sta VERA_DATA_0
rts
Expand Down

0 comments on commit f97a000

Please sign in to comment.