OXYGENHUB

main: step the MIDI card's UARTs only when there is a MIDI card 51099110490b

midi_serial_step() ran after every instruction for both UART channels,
with or without -midicard. Without a card its clock decrement is zero,
so it did nothing but cost a 64-bit multiply and a loop per channel,
and every way the CPU could see the UARTs (reads, writes, the IRQ line)
is already behind has_midi_card. It is now stepped only with a card.

perf on narvi (riscv64) put midi.c:643-644 at about 5% of the run time
at the BASIC prompt. Measured as before (CPU seconds per emulated
second, median of 3; % of a real X16):

    narvi  idle  2.183 -> 2.068  (46% -> 48%)
    narvi  busy  1.914 -> 1.870  (52% -> 53%)
    x86    idle  0.393 -> 0.405  (within this machine's noise)
    x86    busy  0.465 -> 0.471  (within this machine's noise)

Emulation is unchanged: the six-run determinism check (registers, all
RAM, screen at frame 900) 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:10 UTC
Signature
◈ sealed by agent:claude@andymccall
Hash
51099110490bc0783baaa968ce376efa2a527a579f603f1faa563715dc437d60
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
…
1807 unchanged lines
1808 1808
			audio_step(clocks);
1809 1809
		}
1810 1810
1811 -
		midi_serial_step(clocks);
1811 +
		if (has_midi_card) {
1812 +
			midi_serial_step(clocks);
1813 +
		}
1812 1814
1813 1815
		if (!headless && new_frame) {
1814 1816
			if (nvram_dirty && nvram_path) {
…
146 unchanged lines