mandelbrot_hotspot_impl macro calls through to the
sqr16_impl and imul16_impl macros with the xe mode
this is backed by two realized functions, as
mandelbrot_hotspot and mandelbrot_hotspot_xe
these are also called via direct jmp instead of jsr/rts
because there's only one call site so we can save 6 cycles
per iteration by jmp/jmp
could save 6 more cycles per iter by specializing all of
the mandelbrot proc but there isn't room in ram right now
sqr16_func is removed as it is unused and we ran out of
code space adding the hotspot's extra implementations
imul16_func is kept, as it's called via zoom_factor
in a couple of places. this forwards to the xe version
at a cost of 3 cycles, as the call sites aren't patched
Noticed that the separate addition for the low 1 bit case was
doing some dupe memory loads. Ended up making separate code
paths for even and odd values so the even saves two cycles
(from 52 down to 50 cycles) and the odd saves 14 cycles (from
69 down to 55 cycles). nice!
This gets the XE runtime on default view down from 3m38s to 3m33s,
a 5 second runtime improvement
add_carry took a fixed 8 cycles with a lda/adc/sta pattern
we can instead use bcc to handle the carry-not-set case in just
2 cycles, skipping over the inc which takes 5 cycles on the
carry-is-set case.
Result is 2-7 cycles instead of 8, saving 1-6 cycles twice
per 16-bit multiplication or square.
Neat!
* switched zero-page from hardcoded assignments to symbols
* moved most non-hotpath stuff out to .data
* merged ptr and pixel_ptr
Slight slowdown in Atari800MacX from 5m13s to 5m15s
This is a first step toward moving the UI to C and
adding file and network I/O in C. The fractal core
will remain in assembler as well as the multiplier.