6502 by dbhqGitHub

Journal

Journal

Written as the work happens, in the same pull request as the work.

The machine pages made short: the machine first, the reference folded

Dan asked for less text around the machines. Every machine page now has one shape: what the machine is, the machine itself, how to try it, and one short line saying whose ROM or game it runs. The rest, what is modelled, how it is checked, the photographs, the credits and the full rights, is in closed sections at the foot of the page, still in the page and still tested.

The registry's words made short: the photographs' descriptions, the notes and the try-it steps

The machine pages' pass left the registry's text and the try-it files alone. Dan asked for all of the site's text to be short and plain, so this pass did them too: the photographs' alt text lost about a third of its words, the try-it steps and the notes were tightened, and the rights kept every fact and caveat, changing only where a sentence ran on.

The site uses its width

Dan found the margins too big. Every reading section was a narrow strip centred in the page, which left wide empty margins on a desktop and squeezed the machine panels. Now each section takes the whole container, left-aligned with the header, and only running text is held to a readable line. The side padding and the space between sections are smaller, a machine's screen fits the window, and a phone no longer scrolls sideways on the NES page.

The home, about, status and inside pages made shorter

Part of the site tidy pass. The home page now says what the project is, which machines run and where to start, in about half the words. The about, status and inside pages keep every fact in fewer, plainer sentences. Every figure is still computed.

What was left of the BBC Micro's robustness items

The second pass at the issue of small items from the BBC Micro's reviews. Every bullet was checked against main again. The CRTC's remarks now name the four registers that read back, where they named six, and the equivalence test on the machine's clock compares the chip's outputs as well as its events, so the CRTC's outputs are checked at one megahertz for the first time. The five wording nits from one review still cannot be identified, so the issue stays open. No behaviour changed.

The BBC Micro's keys on a phone: the screen stays put

On a phone the BBC Micro's on-screen keys stand taller than the screen, so a visitor could not see the picture and the keys together. The keys cannot be made shorter without breaking the touch size, so the picture is now pinned under the site header while the machine runs and the keys scroll past it. The browser check scrolls to the last key and fails if the screen is not still in view.

What the Atari VCS's task reviews found

Every task of the Atari VCS had a review. None found a critical fault. What they found was claims that went further than their evidence and guesses left untagged, and later tests that could not fail. This entry records the reviews of the second, sixth, seventh, eighth and ninth tasks, which no other entry does, and the final review's fix wave.

The Atari VCS's mutation pass, its known differences and its issues

The fifteenth task of the Atari VCS, its first three steps: the plan's list of mutations, each planted alone and run against every test; the one that got through and the test that now catches it; the known differences checked against the plan's list and against every guess the fact sheets left open; and a comment on each issue the page links.

The Atari VCS's page, its photographs, its registry row and the count

The fourteenth task of the Atari VCS: the machine gets its page, with its panel, the bundled game credited and its licence linked, a section on how it is checked and whose console the trusted results describe, and the parts left out, each with its issue. Two public domain photographs of the console are credited, the registry row says it runs, CI builds it and runs it in a real browser, passing on the fix commit, and the home page counts it from the registry.

The Atari VCS's panel, its WebAssembly host, and the console parts it shares with the NES

The thirteenth task of the Atari VCS: the WebAssembly host gains the picture, the sound, the joysticks, the switches and the region switch, and the panel that drives them is written. The parts of the NES's page a second console needs, the cartridge slot, the region control, the gamepads, the held buttons and the sound, moved into shared modules, with the NES's own tests unedited and passing.

The Atari VCS's bundled game, its boot check and its acceptance test

The twelfth task of the Atari VCS: the bundled game, a port of the tile-joining puzzle by Carlos Duarte do Nascimento under the MIT licence, is committed in its own folder with its licence, its provenance and its notice. It draws its title screen in both regions, the frames are recorded and were looked at, and the acceptance test calls the suite's checks and the boot check in both regions.

The Atari VCS's suite in full: what each test showed

The eleventh task of the Atari VCS: every test of the console's test suite that the trust split runs, run in both regions, with the outcomes of the recorded tests written by a recorder and checked in CI. Four trusted tests about a player's pattern scan under a merged motion step fail, and Dan agreed, one test at a time, to record them with the cause written down. Two PAL pictures differ only because the reference draws several colours in one grey.

The Atari VCS's sound: the two channels, the samples and the resampler

The tenth task of the Atari VCS: the TIA's two sound channels, each a frequency divider and two polynomial counters, clocked twice a line; their mix; and the samples made from it at the host's rate. The resampler was chosen by a rule written down and committed before anything was measured.

The Atari VCS's joysticks, fire buttons and console switches

The ninth task of the Atari VCS: two joysticks on the RIOT's first port, their fire buttons on the TIA with the latch the vertical blank register turns on, the paddle ports with nothing plugged in, and the console switches on the second port, every one active low and any combination taken as written. Before it, a mismatch the HMOVE task left unexplained was traced to one missile width, where the suite says the console's missile and ball differ and every document read gives them one circuit.

The Atari VCS's speed milestone: the rule, the bench and the workflow

The eighth task of the Atari VCS: the machine as WebAssembly, a browser bench that times the suite's calibration program in both regions, compiled ahead of time and in the interpreter, the rule that judges it, committed before any launch, and a workflow started by hand that runs it on a GitHub runner and never on this box. Its first run, judged by that rule, says stop: Dan decides before the sound is built.

The Atari VCS's HMOVE: the motion clocks, early and late, and the screenshot runner

The seventh task of the Atari VCS: HMOVE, its ripple counter, the latches that stop each object's extra clocks, the comb, and late and early HMOVE, all from one mechanism with no table of cases; and the runner that compares a frame with the suite's reference pictures. Most of the suite's HMOVE self-tests pass; four about a player's scan counter do not, and wait for the triage.

The order of the machines after the Atari VCS

Dan fixed the order of the machines after the Atari VCS. The Atari eight-bit family is next, and the rest follow the research memo of the day before. The Commodore machine starts only when its ROM question is settled.

The Atari VCS's TIA: the players, the missiles, the ball and the collisions

The sixth task of the Atari VCS: the two players, the two missiles and the ball, each on a position counter with its own start decodes and reset, their copies, sizes, reflection and vertical delay, priority and score mode, and the fifteen collision latches, all taken from the same signals the picture is drawn from. Every self-test of the suite the plan gives this task passes, and two more pass a task early.

The Atari VCS's TIA: the line, the playfield, the palette and the frame

The fifth task of the Atari VCS: the TIA's horizontal counter built as the chip's own polynomial counter, RSYNC, VSYNC and VBLANK, the playfield, a palette computed from each region's colour signal, and the frame. The plan's rule for the order inside a processor cycle ended in a tie, which went to the order the sources state, and the reason for the tie is written down.

The Atari VCS's bus, its machine and the WSYNC halt

The fourth task of the Atari VCS: the bus that keeps the processor's thirteen address lines, decodes the TIA, the RIOT and the cartridge with every mirror, keeps the floating data bus and halts the processor on WSYNC, a whole cycle at a time; the machine on the core's NMOS processor unchanged; the hooks the speed pass will need; and the first run of the suite's own programs, through the real bus.

The KIM-1's phone step, and a line that changed height

The browser check's phone step for the KIM-1 failed now and then because the page moved under the pointer. The cause was the one-line speed sentence under each machine, which changes every second and sometimes wraps onto a second line on a phone. The sentence now sits in a box as tall as the tallest sentence, so it never changes the height of the page.

The Atari VCS's RIOT

The third task of the Atari VCS: the RIOT chip alone, its RAM, its two ports, its interval timer around zero and its edge detect, each test taken from a worked example in the fact sheet and each shown able to fail by breaking the chip on purpose, one fault at a time.

The Atari VCS's regions, its cartridge and its boards

The second task of the Atari VCS: the two regions' clocks, picture window and pixel shape; the cartridge, its board chosen by the file's size and the Superchip by its filler; and Atari's and CBS's bank switching boards, each tested alone against images the tests build and through the core's own bus accesses. Every test file was shown able to fail by breaking the code on purpose, one fault at a time.

The Atari VCS's fact sheets and the suite's pins

The first task of the Atari VCS: six fact sheets written before any code, from Atari's programmer's guide, the chips' data sheets, a study of the TIA's schematics, Korth's specifications, three patents and the test suite's own headers. They corrected the plan in several places, among them which data lines a TIA read drives, which bank a hotspot read returns, which task each suite test waits for, when HMOVE combs a line and what the reference pictures are made of. The suite's files are pinned through one manifest of git blob hashes whose own hash is pinned, and the new test project checks it.

The Atari VCS plan: Dan's answers

Dan answered the six open points of the Atari VCS plan. The bundled game goes in a cartridge folder under the machine's own directory, by the rule that already covers discs, which now names cartridges. The speed run reuses the BBC Micro's hand-started workflow pattern, one per machine that needs one, and the rule in the repository's guide says so. The picture alignment is fixed once on a calibration test, the suite's real-console captures are left out of the first version and tracked in an issue as recorded-only evidence, and the other two points stand as the plan had them. The spec, the plan and the guide are amended; no code was started.

The journal's orders are unique within a day

Four pairs of journal entries shared a date and an order, so the site listed them by file name, not by the order the work happened in. Each pair now has distinct orders that follow the work, the rule is written down in the journal's README, and a test fails on a new tie.

The plan for the Atari VCS

The Atari VCS has its implementation plan, written from the merged design: the same tasks in the same order, each with its files, its tests first, what done means, what its reviewer looks for and the issues it closes or comments on. Every number a check depends on is fixed in the plan before anything runs, several of them taken from the test suite's own harness. Reading the forks turned up two things the design did not say: the suite contradicts itself about which lines its reference pictures start on, and it holds real-console captures beside its references. Six points go back to Dan, among them where the bundled game should live and a second speed workflow in CI. No code was started.

The test floor in one file

The floor under the site's passing tests was a number typed into two workflows, each above a long comment of its history. Every pull request that added tests raised both, and in the merge train of this day three of six conflicted on the number and its comment. The number now lives in one file that both workflows read, the history is kept here, and a test fails if a workflow holds a number of its own or stops reading the file.

How the work is tracked: an epic per machine, and a roadmap in git

The open issues had no shape: machine parts, flaky checks, speed and the models' loose ends sat side by side. Each machine now has an epic, and so do the site and CI, speed, the models and the machines to come. Every open issue sits under exactly one, new issues record what was only in notes, blockers carry their reasons, and the order of what comes next is a file in the repository.

The design of the Atari VCS

The Atari VCS is written up as the next machine, from Dan's answers to the design interview: a picture exact to the colour clock, with the HMOVE effects and the object quirks, and a speed pass planned for after it counts; NTSC and PAL in one row; the common Atari boards, CBS's RAM board and the Superchip; two joysticks and the console switches; a bundled homebrew; and an MIT test suite forked and pinned, with one expected frame of the game. The rights pass opened each candidate game's licence file. Dan chose the port of the sliding-tile game, which is MIT: the author's own build is bundled with its notice, and the cartridge art, which has its own copyright, is not in it. The suite turned out to keep its built test files in a second repository, so both were forked, and only part of the suite is trusted for the count. No code was started.

The Electron counts

The Electron's page goes live in the build: a credited photograph of an original machine, the registry switched to running, and the home page's count of machines going up by one, from the registry and never typed. The preview that built the page before it counted is deleted again, and the page's tests and the browser check read the site that deploys.

The small notes from the NES models' reviews, worked through

One issue collected six small notes left from the reviews of the NES models. Each was checked against current main first. The frame's corners are now checked against the marks they were fitted from. The journal wording was corrected in four places, and one of the four notes could not be reproduced. A model's status line no longer keeps its sentence about a missing console. The sound chip's jobs on one board are read from the redrawing's nets by a script and a test. Three claims on the page that no test touched now have one. One bound in a test turned out to do nothing and is now said to. Nothing on the page changed.

The NES panel tests waited for a count of turns, not for the page

Two NES panel tests failed once each in CI with the panel still loading. The helper that waits for Start spun a fixed number of event-loop turns, which is not a wait when the page's start-up does real work. It now waits for the state, with a time limit, and a slowed fetch shows the old loop fails and the new wait does not.

The BBC Micro's small robustness items, from the reviews

One issue collected the small items the BBC Micro's reviews left. Four are done, each with a test that fails without the change: the VIA's catch-up guard is let go in a finally, SystemVia.VsyncInput and BbcBus.Irq are internal, and the CRTC gets tests for the cycle each event carries and for a handler that writes to the chip. Two were found already done on main, and one list could not be recovered. No cycle behaviour changed.

The Electron's mutation pass

The last task of the Electron plan, its first two steps. Twenty-three faults were planted one at a time in a scratch copy, the plan's seventeen and six close variants, and the Electron's tests were run against each. Every one was caught; the thinnest catches are a ROM select fault that one test sees and the RTS dummy read that two see. The known differences were checked against the plan's list of twelve, and three things the model does without saying so were added: what absent devices read, the ROM latch at power on, and that BREAK resets only the 6502.

Which machines next, after the Electron

A research pass weighed nine machines for the place after the Electron, against the repository's rules on ROMs and inputs, what the core and the browser host already cover, the test material that exists, and the BBC Micro's and NES's records as the yardstick. It recommends keeping the Atari VCS next, as published in October, and moving the Atari eight-bit family ahead of the Commodore Sixty-Four. It is a recommendation for Dan, not a decision, and no machine code was started.

Keyboard focus stays in the page after the analytics notice is answered

Pressing OK or Opt out on the first visit hid the button that had focus, so the browser dropped focus to the top of the page. Focus now goes to the Cookie settings button in the footer, without scrolling the page. The status line is a live region. The notice moved from after the footer to just after the skip link, because it is a fixed panel and nothing in the layout or the tests depended on its place. Four tests fail without the change.

The analytics tests: five gaps closed, and a sixth found

The review of the analytics notice port found five changes to analytics.js that the sandbox tests did not catch. Each now has an assertion, and each was shown able to fail by making the change by hand and running the test. One of the five still passed after its assertion was added, because the sandbox ran analytics.js as a classic script and the page loads it as a module. The sandbox now runs it in a module-like scope.

The NES chip counters' speed, measured again on a quiet ARM machine

The chip counters the NES models added to the bus were measured again on an idle ARM machine, after the lazy PPU made the machine faster. By the rule fixed beforehand the first result is a fail: in NTSC the build with the counters was a little under three per cent slower. A profile showed the counter's own code takes almost none of the time, so two variants were tried that change only how the bus counts. Both passed in both regions, in a run with the original as a control that showed the slowdown again. The smaller variant, plain field increments in the bus with no call, is now in the branch. The differential check shows the counters, in every version, change no behaviour.

Building on ARM

Everything in the repository was built and tested on an ARM Linux machine. All of it worked except Dormann's tests, whose assembler, as65, is an x86 program that ARM cannot run. The tests now run it under qemu's user-mode emulator on any machine that is not x86, with Ubuntu's i386 libraries, and say what to install when either is missing. The browser checks need a Chromium there, because Google Chrome has no Linux ARM build.

The NES's fast scanline renderer: the gate first, then the lines without sprites

Dan said to merge the lazy PPU and continue, which was read as building the fast scanline renderer the lazy chips plan specified and left unbuilt: a second way to run a line of the PPU, used when nothing can see the line. Before any of it is written, the gate that must hold it equal to the first was made able to see it fail, closing the three gaps the last review named. The differential now hashes the picture as far as it is drawn at every point where the PPU can be seen, not only at the end of a frame. Its sprite 0 cartridges sweep sprite 0 down the whole picture, at every named x, with the left clips on and off, where before they covered the top half. A new layer of scene tests puts the PPU at any dot directly and makes register accesses on every dot of visible lines, the VBlank lines and the pre-render line, in both regions. Four faults of the kind a fast renderer could make were planted one at a time. The old differential saw each of them, two in only a handful of runs, and the old unit tests saw none. The new differential sees the pixel fault in many times as many runs and the sprite 0 fault in twice as many, and the scene tests catch all four. The review of this work found holes in the scene layer: sprite 0 hit its line a line early because the scenes kept the last scene's sprites, and the scenes left the right pixels behind. Both were fixed, the scenes were widened, and the differential now presses reset a second time on a dot phase chosen for each run, so every dot of PAL's pre-render line is reached by programs as well as by the scenes. The differential's output changed format twice, so its baseline was recorded again from the per-dot reference each time, and the lazy build matches it on every run. Then the renderer itself was built for the lines that draw no sprite: the lines after the picture and in VBlank, the visible lines with rendering off, and those with the background alone, on which sprite evaluation still runs and is run with the per-dot code. The gate stayed identical to its baseline, and every fault planted in the new code was caught both by the differential and by new scene tests that also say how many lines the fast path must take. Against main, in the browser, the homebrew's title screen runs about a third faster and SNOW, whose every visible line has sprites, no faster at all, so the stopping rule set before the work was reached. After its review the new tests ran under every nametable layout, and the differential gained cartridges that scroll the background alone, which the renderer's faults now show in many more runs. Last, the bundled game was played by a script and measured in play, not only at its title: there the sprite layer is on for every visible line, so the renderer takes almost none of them and the browser gain is small. A scratch change that also takes the lines with no sprite on them, which is nearly every line in play, was measured as the cheapest part of a sprite path, and it passes the existing gate. That one clause was then built: a line with both layers on and no sprite fetched for it is rendered whole, with sprite drawing and the sprite hit still left to the exact path. Twelve new cartridges that keep a few sprites on were added to the differential so that the clause is seen by many runs, the baseline was recorded again, every planted fault in the clause was caught by the differential and the scene tests, and in play the browser gain over main went from small to about a third.

The KIM-1's teletype

The KIM-1 gets the terminal most of its owners used: a teletype on its twenty milliamp loops, its bits sent and decoded in machine cycles while the original monitor bit-bangs the line itself. The monitor times RUB OUT, prints KIM, and takes a program typed at the teletype, runs it and prints the result; the page has the terminal, with the session from the test's own file.

Every photograph's credit now says it is a resized copy

Creative Commons attribution licences ask that a change to a work is indicated. Every photograph on the site is a resized copy, converted to WebP, but the credit line under each one never said so; only the photographs' README did. The credit now ends with a sentence that says it, on every photograph, and a test fails a credit without it.

The NES chip counters' speed, measured at last with the machine's own method

The NES models added a counter to the bus: one call whenever the CPU touches the PPU, the sound unit or the I/O registers. The claim was that it costs no more than two per cent of the machine's speed, and earlier runs on a busy host could not show it. This time both builds were compiled ahead of time and run alternately, eight launches each in both regions, measured in the main thread's CPU time. By the rule fixed beforehand it passes: the median ratio was above one in both regions. But the launches differ by a fifth, so the data rule out a slowdown beyond about three and a half per cent, not two. The host was never empty, though its load average was low. The differential check shows the counters change no behaviour.

The reset button in the middle of sprite evaluation

A fault pass in the lazy chips work found a crash that has been in the NES's PPU since it was built: press reset in the middle of sprite evaluation, switch rendering on after dot 1 of a line with sprites in range, and evaluation writes past the end of secondary OAM and stops the machine. The test came first and failed with the exception. The fix wraps the place in secondary OAM, as the chip's counter does, rather than clearing evaluation in the reset, which the sheet does not say. Nothing else changed: the whole NES project, the community ROMs and the differential's output are as they were.

The NES's lazy chips: the gate first

Dan chose to let the NES's PPU and sound unit be brought up to date only when something can see them, on one condition: the lazy build must give bit for bit what the per-dot build gives at every point where a chip can be seen. Before any chip changes, the differential was extended to be that test. The bus now tells an observer of each such point, every chip reports its whole state, a reflection test fails if a field is left out, and the per-ROM output of the build before the work is committed as the baseline. Ten deliberate one-dot or one-cycle faults in the parts the work will touch, planted one at a time in a scratch copy, each changed the output. The review found the gate's real gap: the test ROMs hardly touch the chips while a line is drawn, which is what the lazy work will change. So the differential now also builds 38 small cartridges of its own, whose register writes sweep across the dots of the lines frame by frame, and with them every fault changes at least 20 runs. A fault also turned up a crash in the PPU that has been there since the NES was built: the reset button in the middle of sprite evaluation can leave it writing past secondary OAM. The second task made the PPU lazy: the bus gives it its dots, and it runs them, with the same per-dot code, only where something can see it. The gate gave output identical to the baseline on every run, the old faults are still seen, and so is each of four new faults planted in the catch-up. Natively, a cycle of the benchmark ROM takes about half the time it did. In the browser, the build the live page runs, the gain is smaller, about a third more speed, because the part of the cycle the change did not touch costs more there. A profile of the lazy build in the browser shows the PPU's per-dot work is still the largest part of the time, ahead of the bus's cycle, the CPU core and the sound unit, and a fast scanline renderer is the one option the profile says is worth more than a small gain. Even so, by the profile's own estimates neither the renderer nor a lazy sound unit, nor every option together, reaches the speed the work set out for, and each is a second implementation for the gate to hold equal to the first. So they were not built: they stay in the plan, specified and unstarted, for Dan to order. The crash the gate found is fixed in a pull request of its own.

The core's speed: what the shared 6502 costs, and what made it cheaper

Task 17: after the NES was finished, Dan chose to speed up the shared core first. Two changes were kept: the interrupt poll is worked out once an instruction instead of every cycle, and a machine's bus is called through an abstract class instead of the interface. In the browser's AOT build the BBC Micro got about 17 % faster; natively the core alone about 13 %. The NES did not move beyond noise, because in its AOT build the core is about a tenth of the time. Ten times real time for the NES was not reached and cannot be reached from the core: the PPU, the sound unit and the bus's own cycle are most of its cost. A generic CPU made for each machine's bus, the obvious large change, was built, measured and dropped: Mono's AOT compiler gives it no direct calls.

The NES's mutation pass, and the known differences checked

Task 16 of the NES plan, its first two steps. Faults were planted one at a time in a scratch copy of the NES, the plan's list, the further ones the task named and some of the pass's own, and the whole NES test project was run after each. Almost all were caught by the project's own tests, and many by those alone, since the community ROMs miss the tables, the boards' details and the controllers. One was seen only by nestest's log on PAL and three by nothing; each of the four now has a test that fails on it. Then docs/known-differences.md was checked against the plan's list and the fact sheets' open guesses, and what it did not say was added. Later the same day, Dan decided that the Ricoh 2A03's LXA uses $FF, so the two instr_test-v5 ROMs that failed on it now pass, and its Harte run leaves that opcode out and says so.

The NES's page, and the NES counts

The NES gets its page: the panel from the day before on a page that says both regions are modelled, that the machine needs a fast computer, what is not modelled with an issue for each part, and whose the bundled game is, with a public-domain photograph of an original console. The registry says it runs, so the home page's count goes up by one, from the registry and never typed. On the way, the pull request turned out never to have been checked by CI, because it had conflicted with main from the day it opened.

The NES's WebAssembly host and its panel

The NES now has what its page will run: a WebAssembly host in the BBC Micro's shape, a panel with the picture in the region's own pixel shape, the region control and the sentence saying which region was chosen and why, a cartridge picker that refuses a bad or oversized file and keeps the machine as it was, the keyboard, gamepads and an on-screen pad for the two controllers, Reset and the power switch, and sound through a worklet whose ring never grows. The shared host took two small additions, and the KIM-1's and the BBC Micro's browser checks pass unchanged. Task fifteen puts the panel on the page.

The NES's bundled homebrew, its boot check and its acceptance test

The NES page needs one title it can run before a visitor loads their own. A rights pass through the fork's other/ folder and its authors' own pages found that only a few say in words that their work may be copied, and the clearest is Shiru, whose Lan Master manual says it is released into the public domain. Lan Master is now committed with its provenance, its title screen is the boot check's recorded picture in both regions, and NesAcceptanceTests runs nestest, every test ROM in the table, the boot check and the PRG RAM rule through the same checks the other test files make.

The NES's speed in a browser, with the bus and the PPU

The NES as built so far, with its bus and a PPU that draws the background and sprites, runs at about two times real time in a browser compiled ahead of time, on a machine that was busy, and about a fifth of the BBC Micro's rate on the same machine at the same time. The plan's rule says under ten times is a stop before the sound is built. The loaded figures alone do not make it a stop, but the estimate for a quiet machine is about three times, so the stop is almost certain, and the decision is Dan's. Task 6b, later that day, made it about a third faster on a quiet machine (the figures are in the entry), and estimated that ten times is out of reach without changing the core, the runtime or the design.

The NES's models: the inputs, and the eight checks they rest on

Before the NES's two models are built, the work measures what they rest on. The bare board scan's scale holds, its solder side lies on its component side, and the European board's chips sit where the American board's do. The case took three tries. Read from the two corner photographs, its depth came out well short of the published figure, and Dan ruled that this measured the camera, not the case. Judged on the design patent's drawings it was still just over the limit, and the European front then stopped against the drawing too. The sources disagree with each other by more than those limits could resolve, so the check was turned back to its purpose, catching a gross error of scale, with wider limits set after the drawings were seen and said so. On those it passes, and every stop stays on record. On the way, the cartridge connector's fingers turned out to be on a metric pitch, not the tenth of an inch the plan assumed.

Planning the NES

The third machine is the NES, in both its NTSC and PAL forms. Before any of its code, six fact sheets were written from the nesdev wiki, and every number the plan had written from memory was checked against them. Most held. The PAL frame counter's last step was one cycle out, the DMA cycle counts were stated too simply, the test ROM signature could not be confirmed, and the PPU test ROM the plan meant to run first turned out to need a mapper that arrives six tasks later. The project, its test project and the test ROM pins went in with the sheets.

The NES's models: what they can be built from

The NES gets two models, the outside and the board, as its own piece of work after the machine. Before any design, a search for freely licensed sources found a bare board scanned on both sides, public-domain photographs of the American console and its board, and a Creative Commons set of a European one. Dan chose both consoles, inside and out, and live rates on the board. The design reuses the BBC Micro's views, and a first task checks the inputs, with rules for when the work stops.

The Electron's fact sheets and plan

Two fact sheets and a plan for the Electron, written before any code: what the ROM search and the sources settled, a contention rule that reproduces real timings, and what is left to be found by running the ROM.

The Electron's design

The Acorn Electron is written up as the third machine: tape for storage, the ULA holding the CPU off modelled access by access, and a search for ROMs that found them in a place other than where the BBC's came from.

A library of discs for the BBC Micro

The BBC Micro's page gets a library of homebrew and freely licensed discs, each kept in the repository with its author's licence and, where the licence asks for it, its source. One click puts a disc in and starts it the way the machine does, with SHIFT held through BREAK, and a test starts every one of them that way. A disc of your own still goes in as before.

The next four machines

After the BBC Micro, four more machines, one at a time and smallest first, starting with the Acorn Electron. The NES gives up third place, because half of the reason it held it went with the port.

The BBC Micro's models: the inputs, and what they rest on

Before the BBC Micro's two models are built, the work measures what both rest on: the scale of a flatbed scan of the bare board, how well the solder side lies on the component side, and how well a photograph of the keyboard fits an open keyboard layout. The keys, the scan's scale down the board, and the board's size and outline hold, and the solder side holds except for a few holes. Two checks failed and were revised the same day, each kept on record as it failed: the case's front edge, measured on the plane of the keys, which it does not lie in; and a row by row check of the board's width scale, which magnified the noise of short rows and met one long row off the pitch, and as revised lands between pass and stop. The solder side then lies on the component side within the plan's limits over every hole found, and the board's chips come out as footprints, pin one read from the print. Both faces' copper is then traced from the scans with its method fixed first, but its check on the board's power nets fails, and so does its comparison with a photograph of a populated board, so the track map is offered to look at, not as a netlist. Every chip is then placed on its footprint and named from the Service Manual, with the disc interface fitted and Econet left out; the places miss a few of the manual's approximate ones, and the markings on a populated board disagree with the manual for four causes, one a flaw in the rule, so both of those checks fail too, and are kept as they failed. The machine then reports its keyboard lights and how often the processor reaches each chip, counted without changing a single cycle; its speed in a browser, measured afterwards in CI against a rule written down first, passed that rule. The inside model's drawing, its words and its figures are then built and tested, waiting off the page until the outside joins it; every word it says about the copper calls it traced to look at, and its note gives every failed check beside the figures. The outside is then measured: every key of an open keyboard drawing is matched to the machine's, two photographs of one machine are triangulated to set the keys and lights in the case, and the rear ports are checked against their sockets on the board; both checks pass. The front edge's correction for parallax cannot be measured, for want of the camera's height, and three measures of the case's width point different ways, two narrower than the manual's size if the keyboard drawing is true to size and one wider, which is recorded, not resolved. The outside's drawing, its words and its figures are then built and tested off the page, as the inside's were: its keys go down as the machine's are pressed, its lights are the machine's, and its note says the case's size is the manual's and that the photographs' measures disagree with it. Both views then go on the machine's page together, as tabs, the machine claiming its case and both models at once, each view crediting exactly what it was made from, and a browser in CI checks that each loads only when it is reached and follows the machine. Last, faults are planted one at a time in a copy of the work to see which tests notice each, every fault no test noticed gains a test that does, and the known differences gain the models' limits.

The first deploy of the BBC Micro, and what it taught the deploy

The merge that put the BBC Micro on the site failed its own check of the live pages, because the new pages were not at the edge yet. The site was fine a few seconds later. The check now waits for a page that is late, and the deploy now counts a build's machine files before it publishes anything, not only after.

The BBC Micro's final pass

The last task of the BBC Micro plan: faults planted across the seams between the chips to see which tests notice, the known differences gathered and checked against the code, the minor findings the reviews deferred cleared or set out, and the browser speed measured again on a quiet machine. Then the branch in summary.

The BBC Micro counts

The BBC Micro's page goes live in the build: a credited photograph of an original machine, the registry switched to running, and the home page's count of machines going up by one, from the registry and never typed. The preview that built the page before it counted is deleted, and the page's tests and the browser check now read the site that deploys.

The BBC Micro's page

The BBC Micro gets its page: a screen drawn from the machine's own picture, the keyboard by position and the machine's own keys on screen for touch, sound once asked for, a disc drive, and a Start button that says how much it downloads. It runs in a real browser and types BASIC through the page's own keys, but stays unlisted until its photograph is chosen and the registry says it runs.

One browser host for every machine page

The part of the KIM-1's page that loads the machine, keeps it in step with real time and says how fast the browser runs it moves into a host every machine page shares, ready for the BBC Micro. The KIM-1 now runs on it, and the real-browser check passes as it did before. The build script publishes a machine by name, and the KIM-1's published files are byte for byte the same.

The BBC Micro reads and writes a disc

The floppy disc controller is in, with disc images, and the real DFS lists, saves, loads and runs files through it. It is never ticked: it works out each byte when it is looked at, and a copy ticked every cycle agrees with it on every access. The disc found a bug in the processor core: an interrupt held through the moment another one fetches its address was lost, where the real chip takes it. And DFS throws its catalogue away after every listing.

The BBC Micro makes a sound

The sound chip is in: three tones and a noise channel, written through the system VIA as the OS writes them, and turned into samples a page can play. It is never ticked; it works out its clocks when it is written to or its samples are read, and a clock-by-clock copy kept beside it gives the same samples to the last bit. The start-up beep now sounds, and the fact sheet's list of what the OS writes at reset turned out to be short.

The BBC Micro at the prompt, read off the picture

Every screen mode now boots to the BASIC prompt and the tests read it back from the pixels the video chips drew, not from screen memory: typed BASIC runs, the screen scrolls, the palette turns the background blue and a flashing colour flashes. The decode found no fault in the chips, and planted faults show what it can see that the memory-level boot test cannot.

The BBC Micro speaks teletext

The default screen mode now draws real teletext: a public-domain glyph table checked dot for dot against the chip's own datasheet, the control codes, double height, hold graphics and flash, and the chip's own count of lines and rows, so the machine boots to its banner in the chip's characters. The entry records the licensing position, every behaviour the sources leave open and what the code does instead, and a bug the oracle caught in a shortcut taken for speed.

The BBC Micro draws its first pixels

The video ULA turns screen memory into pixels in every mode but the teletext one, a line at a time from the CRTC's state, and a palette change in the middle of a line now changes the colour from the next character. A plain model that draws every character in its own cycle agrees with it frame for frame, and the entry says exactly what is and is not cycle-exact.

The BBC Micro gets its CRTC

The chip that times the picture now counts characters, lines and rows the way the Hitachi part does, and its vertical sync reaches the system VIA in the cycle it happens, so the operating system takes a vertical sync interrupt every field. It runs lazily like the VIAs and works its next event out ahead, a plain model that steps every character agrees with it through millions of random characters, and the browser build runs as fast as before.

The BBC Micro's bus, made cheap to run

The two VIAs now work out their own cycles only when something looks at them, and the bus only looks at them when an interrupt could change. The machine runs well over twice as fast in a browser, past the speed this task aimed for, and a copy of the old chips kept as an oracle shows it does exactly what it did before, cycle for cycle.

The BBC Micro's speed in a browser, with the chips so far

The machine as built so far runs well short of the speed the plan asked for in a browser, compiled ahead of time, and under real time interpreted. The plan said to stop here and tell Dan before building the video chips, so that is what happened.

The BBC Micro boots to the BASIC prompt

The real operating system runs on the core for the first time and reaches BASIC's prompt with no video chip at all: in teletext mode the screen is character codes in memory, so the banner can be read straight out of RAM. It booted on the first run. The one difference from the expected screen was the ROM's own doing: with no disc controller fitted, the DFS stays silent.

The BBC Micro's two VIAs, wired, and its keyboard

The VIA chip becomes the BBC Micro's system and user VIAs: the keyboard and the sound chip on one port, an eight-bit latch on the other, vsync and the keyboard on the control lines, and both interrupt outputs on the processor's one IRQ line. The keyboard's tests read every key the way the operating system does, and its start-up links give the screen mode. Where sources disagree about which line is which, the code follows the ROM.

The BBC Micro's VIA, cycle by cycle

The VIA, the BBC Micro's interface chip, is written on its own, one microsecond at a time, and tested against the fact sheet's worked examples without a processor or a bus. The hard part is the half cycle: a timer's flag rises in the middle of a cycle, and an acknowledge in that same cycle does not clear it, which real BBC Micros showed. Where the sources disagree the code follows the real machine, and where nobody measured anything the guess has a name.

Planning the BBC Micro

Before any code, four fact sheets were written for the BBC Micro's chips, and they changed the plan. The picture is interlaced, two fields to a frame. The disc software cannot cope with the controller presenting bytes too close together, so the controller needs the real byte rate. The operating system needs particular answers from parts of the machine that are absent. The plan gives each task its tests but not its code, and the project, the three ROMs and their rights go in first.

Designing the BBC Micro

The second machine is designed before any code: the disc controller is in the first version, the chips tick on every cycle, and the machine is proven by our own tests. The ROMs come from jsbeeb with their rights position written down, and the disc test turned out to need a third ROM.

A photograph and a model of the KIM-1

The KIM-1's page gets a credited photograph of an original board and a 3D model of it, measured from that photograph, whose six red digits show what the running machine shows and whose keys press the machine's own. The model loads only when a visitor reaches it. Later the same day its board gets the real copper tracks, traced from the photograph, and then five photographs of two boards and a replica of the layout are cross-referenced: tracks on both faces, measured heights, every part, and the page says how well it all agrees.

The KIM-1 in the browser

The KIM-1 gets its page: the machine compiled to WebAssembly ahead of time, MOS Technology's monitor ROM fetched at build time, a drawn keypad and display, and a headless browser that types the acceptance test's program in through the page and reads the answer off the digits. It is the first machine to count.

The KIM-1

The first machine: two 6530s, the keypad, the six digits and the original monitor ROM, built from the manual and the data sheet, and proven by typing the User Manual's own first program in on the keypad.

Inside the chip

A 3D diagram of the 6502 you can fly round, lit by a recorded run of this project's core, and why it is a diagram rather than the die.

The analytics notice

The site launched with an opt-in analytics prompt the day after every other DBHQ site dropped that pattern, so it moved to the estate's opt-out notice, and its analytics code is now tested by running it.

Building the site

The Astro site for 6502.dbhq.uk is built one task at a time, starting with a registry of machines that a test keeps in step with the family document.

The programme changes shape

The site's look, its imagery, and a mission that grew from three machines to as many as possible.

The browser speed check

How fast the core runs in a browser, interpreted and compiled ahead of time, measured on one machine.

Building the core

Eleven tasks, each reviewed, and a final review: what was built, what the tests showed, and the corrections the reviews forced.

Checking the ground

Every outside fact the core depends on was checked, and every behaviour its code would assume was tested against the data it will be tested against.

Deciding what to build

Why the KIM-1 comes before the BBC Micro, why the 65C02 is in the core, and why every bus access is one cycle.