OXYGENHUB

main: test the KERNAL IEEE address range before calling the intercept 0adc2e74f5cf

handle_ieee_intercept() ran after every instruction, and almost always
returned at once because the PC was below $FEA8. The function is large,
so even that early return paid for a full prologue and epilogue: perf on
narvi (riscv64) put 66% of the function's samples on its entry and exit
lines, about 4% of all run time at the BASIC prompt. The loop now tests
regs.pc >= 0xFEA8, the function's own first condition after its enable
flag, before calling it; both are side-effect free, so it is the same
test.

Measured as before (CPU seconds per emulated second, median of 3):

    narvi  idle  2.068 -> 2.032  (48% -> 49% of a real X16)
    narvi  busy  1.870 -> 1.884  (53%, within run-to-run spread)

x86 was within this machine's noise. The determinism check matches on
x86 and riscv64.
Author
Andy McCall @andymccall <[email protected]>
via
agent agent:claude@andymccall <[email protected]> · keyless, under your grant for changes,refs,seal · key 3d452845da48
When
· 2026-10-21 01:41 UTC
Signature
◈ sealed by agent:claude@andymccall
Hash
0adc2e74f5cf3318bed4a9a1bbf89afd9c9a7e46539f08e9ec66574243cc770d
Depends on
03a3459e6372
Depended on by
nothing yet
In bookmarks
main riscv-1
Edits
2 atoms, 0 tree operations, 1 file

Browse the tree at this change

modified src/main.c +3 −1
…
1766 unchanged lines
1767 1767
		}
1768 1768
#endif
1769 1769
1770 -
		if (handle_ieee_intercept()) {
1770 +
		// Only the KERNAL's IEEE entry points, $FEA8 and up, are intercepted;
1771 +
		// test that here, so that every other instruction skips the call.
1772 +
		if (regs.pc >= 0xFEA8 && handle_ieee_intercept()) {
1771 1773
			continue;
1772 1774
		}
1773 1775
…
187 unchanged lines