Commit graph mandel-6502/mandel-core.s
Author SHA1 Message Date
2ed28e5590 drop some old commented out code 2026-08-23 16:08:18 -07:00
e58df379e7 step 2: break out the multiplication hotspot
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
2026-08-23 15:48:48 -07:00
d93dd2e6a6 step 1: sqr16_impl and imul16_impl take argument addresses
first step to removing function call overhead
2026-08-23 15:18:25 -07:00
f3a92708d2 unclobber arg in sqr16
this'll make it easier to use direct targets bypassing function args

costs 2 cycles on negatives in this version for now
but it should save us later
2026-08-22 18:48:05 -07:00
e029213c51 comment fix 2026-08-22 17:53:32 -07:00
65563b0e79 Decent speedup in XE mode
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
2026-08-22 16:45:09 -07:00
23fa002f33 comments 2026-08-22 16:30:41 -07:00
f6489670b1 comments 2026-08-22 15:58:17 -07:00
55d34cb388 Merge branch 'experiment' 2026-08-22 15:35:53 -07:00
4b352e8f63 Merge branch 'regression' 2026-08-22 15:35:29 -07:00
e284587edc Fix regression from merging ptr and pixel_ptr
the XE fast-path assumed low byte of ptr never changes
to save a couple cycles
2026-08-22 15:35:03 -07:00
27995007c5 experiment 2026-08-22 15:25:58 -07:00
829f46755a Save another few cycles per multiple
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!
2026-08-22 14:43:17 -07:00
b4cb773cf1 tweak comment 2026-08-22 14:34:53 -07:00
d9f7ce3e35 whoops missed a bit 2026-08-22 14:27:52 -07:00
3ce4c1e580 Add some timing notes 2026-08-22 13:01:23 -07:00
25c37a1188 zeropage tweaks
* 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
2026-04-08 20:16:31 -07:00
b27be3c159 Add a C shell, which currently just passes through
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.
2025-12-28 09:23:38 -08:00
Renamed from mandel.s (Browse further)