Commit Graph

10 Commits

Author SHA1 Message Date
David Montero afad6a1ed0 test_intel: historic ROM boots — Busicom + Tiny BASIC + Galaksija
Wire up three real, public-domain ROMs from the silicon era and prove
they boot end-to-end on the clean-room chip implementations. Each
test reads a separate well-known boot artifact:

* Busicom 141-PF firmware (4004, 1 KB, Intel PD 2009)
  Wires real 4004 + real 4002 chips on the multiplexed nibble bus.
  Toggles TEST every ~400 phases to mimic the printer-drum encoder
  pulse the firmware polls. Asserts >2000 opcode fetches, >15 unique
  PC addresses, and >100 CMROM strobes.

* Palo Alto Tiny BASIC v2 (8080, 1.9 KB, Wang 1976 PD)
  CPUville port loaded from Intel HEX. Fake polled 8251 UART at port
  0x02 (data) / 0x03 (status). Asserts the captured TX stream
  contains the BASIC "OK" prompt — proving the interpreter reached
  its REPL.

* Galaksija ROM A (Z80, 4 KB, Voja Antonić PD 1984)
  ROM A+B at 0x0000..0x1FFF, system RAM at 0x2000..0x3FFF. Asserts
  PC visits the JP target 0x03DA from reset and the ASCII "READY"
  prompt appears in RAM after init.

ROMs are downloaded to roms/{4004,8080,z80}/ and gitignored — the
tests skip cleanly when the binaries are absent. License-clean: no
GPL ROMs, all PD by upstream provenance.

Total: 126 → 129 passing, 0 todo, 0 failed; 19 → 22 test files.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 04:18:00 +02:00
David Montero f429e113ab test_intel: phase D-4 — Busicom-style increment-and-blink demo
Convert the last outstanding it.todo (4004 Busicom-style program)
into a passing integration test. The Busicom 141-PF firmware itself
isn't available in-environment, so this is an original demo that
exercises the same bus paths the firmware used:

  CLB ; loop: SRC P0 ; WMP ; IAC ; JUN loop

Wires real 4004 + real 4002 chips on a shared D bus and uses the
JS-side nibble-bus driver to feed the 6-byte program. The 4002's
O0..O3 output port blinks through 0, 1, 2, 3, …, F, 0, … each
iteration. Test asserts the first 6 distinct outputs are 0..5 —
proving the loop iterates and the output port reflects each WMP-
driven ACC update faithfully.

Final state: 126 tests, 126 passing, 0 todo, 0 failed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 03:43:24 +02:00
David Montero 1aa9fb872c test_intel: phase D-3 + todo cleanup — 125/126 passing
Convert 7 outstanding it.todo markers into actual passing tests now
that the chips and bus infrastructure can support them:

  - 4004 LDM: ACC observed via SRC + WMP X2 bus drive
  - 4004 FIM: register pair observed via SRC X2/X3 nibble drives
  - 8080 hand-built loop: LXI/MVI/INR/DCR/JNZ decrements counter
  - Z80 IM 2: vector table at I:00 → ISR via INT̅ low
  - 8086 1 MB wrap: DS=0xFFFF + offset 0x11 lands at physical 0x00001
  - 8086 ALE pulse: counts ALE rising edges per bus cycle
  - 8086 AD release: external drive sticks during T2 (chip released)
  - 8086 hello-world: 5 MOV BYTE [imm], imm writes to memory-mapped
    "UART" at DS:0x9000; bus capture + RAM peek verify "Hello"

Plus: remove redundant 8080 CPUDIAG and Z80 ZEXDOC todos — the
actual end-to-end runs already pass in dedicated cpudiag.test.js
and zexdoc.test.js files.

Suite is now 125/126 passing, 1 todo (Busicom 141-PF demo, awaiting
firmware ROM), 0 failed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 03:20:50 +02:00
David Montero 076bb78b26 test_intel: phase D-2 — 4004 SRC + I/O bus wiring end-to-end
The 4004 chip now drives or samples the multiplexed nibble bus during
X2/X3 with CM-RAM (or CM-ROM) strobed for SRC, WRM, WMP, WRR, WPM,
WR0..3, SBM, RDM, RDR, ADM, RD0..3 — completing the I/O group that
was previously stubbed. The 4002 RAM chip is rewritten with a
phase-count-based timing model that samples the opcode at M1/M2 and
drives or latches the bus at the correct frame relative to the 4004's
drives.

Two new integration tests in 4002-ram.test.js wire a real 4004 + 4002
on the same board and prove the round-trip:
  1. SRC P0 + LDM 3 + WMP — 4002 output port goes to 3.
  2. SRC P0 + WRM 5 + CLB + RDM + WMP — 4002 output port goes to 5
     (proves both write and read paths through the bus).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 01:44:45 +02:00
David Montero 124b94b187 test_intel: status doc — 113/124 passing across all 14 chips
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 00:39:23 +02:00
David Montero e19c961982 test_intel: final status — 98/109 passing including CPUDIAG and ZEXDOC
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 20:44:17 +02:00
David Montero 1f2a4c5fca test_intel: status doc — 93/105 passing across phases A/B/E + partial C
Final tally for this session's work:
- Started at 37 passing tests after the initial 5-CPU baseline.
- Phase A (8080 INTA bus protocol): +1 test.
- Phase B (Z80 CB/DAA/RLD/ADC HL/CPI + X/Y flags): +10 tests.
- Phase C partial (rom-1m, 8255 PPI, 8251 USART): +13 tests.
- Phase E (8086 string ops, MUL/DIV, BCD, port I/O, shifts, etc):
  +7 tests.
Total: 93 passing, 12 todo, 0 failed.

Plan tracked in autosearch/18_complete_emulation_plan.md. Phases D
(4004/4040 I/O completion using deferred 4001/4002 chips), F (real
software validation: CPUDIAG/ZEXDOC), and G (cycle accuracy) remain
as future iterations.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 20:44:17 +02:00
David Montero 323366dc53 test_intel: status docs for completed chip lineup
All 5 retro CPUs (Intel 4004/4040/8080/8086 + Zilog Z80) plus all 3
bus devices (rom-32k, ram-64k, latch-8282) are now implemented.
Update top-level matrix and per-chip READMEs to reflect 63/80 tests
passing, 0 failed, 17 deferred.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 03:59:44 +02:00
David Montero ef812c3d9b test_intel: Intel 4004 + 4040 chip implementations
The two earliest commercial Intel CPUs as velxio custom chips:

- 4004.c (~150 LOC): 16-pin DIP, 8-phase frame (A1..X3), SYNC at A1
  with PC nibble walk on D0..D3 (low-first per MCS-4 Fig. 2), CMROM
  strobe during M1. ISA decoded as NOP for now — full 46-instruction
  set deferred to ISA phase.

- 4040.c (~250 LOC): 24-pin DIP per MCS-40 pp. 1-5/1-6 (STP/STPA/INT/
  INTA/CY/dual CMROM/dual standby Vdd). 4004-compatible bus + STP
  latched at M2 → STPA asserts at X3 + INT forced JMS to PC=0x003.
  14 new opcodes decoded as NOP for now.

Test refinements (analogous to bootCpu fix from 8080 work):
- bootChip no longer advances time post-RESET so first observed cycle
  starts at A1 of cycle 0 with PC=0.
- SYNC sampler latches on first edge (was over-collecting on
  subsequent SYNC pulses).
- 4040 test renamed STOP→STP, STOPACK→STPA per MCS-40 datasheet pin
  names; added INTA, CY, VDD1, VDD2 pins; SYNC-stops assertion
  removed (manual: STOP mode keeps clock and SYNC running).

Brings test_intel suite from 37 to 43 passing tests; 0 failures;
remaining 3 active are 8086 (deferred), 29 todo are intentional
deferred integration tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 22:45:34 +02:00
David Montero e493304cd6 autosearch — Research notes for Intel + Z80 custom-chip emulation 2026-04-29 22:24:02 +02:00