Zellyn HunterandClaude Opus 4.8 30dd09b558 videoscan: lazy floating-bus scan for headless (Sargon) path
Tick() ran the video scanner (Scan1) every CPU cycle even under a no-op
Plotter: it computed the beam address, RamRead a byte, decoded text/lores/
hires, and did a last[row][col] compare — all purely to keep a2.lastRead
(the floating bus) current and to feed a real Plotter. Headless (the Sargon
driver's nullPlotter) renders nothing, so that per-cycle work is dead weight
and was the dominant cost of the headless emulation loop.

Add WithLazyVideoScan(): in headless mode Tick() skips Scan1 entirely, and
EmptyRead computes the floating-bus byte on demand from the cycle counter.
The Apple II beam position is closed-form (65 cycles/scanline, 262 scanlines/
frame), so no per-cycle state walk is needed; the byte the CPU sees on a
floating-bus read is bit-identical to what the per-cycle scan would have
latched (proven for every h,v and soft-switch config in floatingbus_test.go).

The default (rendering) machine is unchanged: it still scans every cycle so
the Plotter sees every byte and the latch stays current. address() is left
byte-for-byte identical; scanAddress is a separate pure implementation the
test proves equal.

Measured on the Sargon III driver (boot + moves): ~1.9x wall-clock speedup
(steady-state search 30.0x -> 57.3x realtime). Sargon plays bit-identically
(RAM, screen, and cycle counts match across full A/B games); a poison
experiment confirms it does not even depend on the floating-bus value.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 02:04:16 -04:00
2014-08-05 22:17:11 -07:00
2018-05-20 21:12:12 -04:00
2018-05-20 21:12:12 -04:00
2017-01-26 21:52:02 -06:00
2016-07-13 22:00:26 -06:00
2014-05-21 21:45:38 -07:00
2017-01-26 21:52:49 -06:00
2017-03-06 22:05:13 -05:00

goapple2

Apple ][+ emulator written in Go.

Install

go get -u github.com/zellyn/goapple2/{texty,shiny}

Status

No Maintenance Intended

Basic functionality (keyboard input, text, low and hires graphics) works.

Very basic (and fake) read-only disk access works, for .dsk images where no trickery is involved.

This was one of my early Go-learning projects: the code organization is pretty horrible.

Shiny

This is the main "supported" interface, hacked together during hack day at GopherCon2016. It's almost certainly doing things wrong Shiny-wise: pull requests welcome. Press backquote/tilde to exit.

Texty

texty/ contains a hackish version of the emulator that runs in a terminal. It interprets all videoscan outputs as text, regardless of any other settings. Press ~ to exit.

Where to find ROMs

cd data/roms ./getroms.sh

Contributing

Pull requests welcome. If you have any questions, feel free to get in touch with me: username "zellyn" on gmail, twitter, facebook, github, golang slack.

Contributors

S
Description
Apple ][+ emulator written in Go.
Readme MIT
1 MiB
0 Stars 1 Watchers 0 Forks
Languages
Assembly 76%
Go 23.5%
Shell 0.5%