Skip to content

Corpus generator spec: SOLO, TUTTI, DT and DE

Written 2026-08-09. For the RetroCore side to implement in Emulated.Tests.ND500/Validation/Generators/, so both emulators run the same cases. nd500x consumes the generated corpus; it does not author it. See docs/ND500-CONFORMANCE-CORPUS-HANDOFF-2026-08-08.md.

Every expectation below is derived from the ND-5000 control store or the printed manual, never from either emulator. Where something could not be derived it says so and is NOT given an expected value.

Sources of authority used

Source Path Used for
ND-5000 control store, symbolic listing /mnt/d/ND/5000/Decode/MICRO-5800-B30.LIST what SOLO and TUTTI actually do
Microword field definitions /mnt/d/ND/5000/Decode/mnemonics.md decoding BM04, MIC,STS, SPEC,MOD
ND-500 Reference Manual docs/ND-05.009.4 EN ND-500 Reference Manual.md ch.16.1, 16.2, 6.5.4 rules and the ST1 bit table

What the microcode says, byte for byte

SOLO_0 at control-store 004524, TUTTI_0 at 004534:

004527:  ALU,OR    A,BM04 B,SC3  D,MIC,STS      ; SOLO: status := status OR bit4   -> PSD set
004530:  ALU,AND   A,BM01 B,SC3                 ; SOLO: test bit1 of the OLD status -> PIA
004531:  ALU,ANDCA ALUF,OR A,BM25 B,SC13 D,SC13 COND,MZRO
                                                ; SOLO: set/clear modus bit 21 on privilege
004532:  ALU,A     A,SC13 B,X1   D,SPEC,MOD     ; SOLO: write modus register back

004535:  ALU,ANDCB A,MIC,STS B,SC3 D,MIC,STS    ; TUTTI: status := status AND NOT bit4 (SC3=BM04)
004536:  ALU,ANDCA A,BM25 B,SC13 D,SPEC,MOD     ; TUTTI: clear modus bit 21 unconditionally

Three things follow, and they are the reason this spec exists:

  1. PSD is status bit 4; SOLO sets it, TUTTI clears it. Matches the manual's ST1 table (bit 4 "Process switch disable", marked S - status, not instruction-modifiable except here).
  2. SOLO branches on PIA (bit 1) of the status as it was before the OR, and arms a modus-register bit only for unprivileged code. The privilege distinction is hardware, not an emulator convenience.
  3. SOLO arms with an OR - a level set. Nothing in the SOLO path resets a counter. So a second SOLO inside an open region does not restart the timer. Manual ch.16.1's "Disable process switch timeout occurs if unprivileged users attempt to repeat SOLO's" is a consequence of the timer continuing to run, not a separate immediate trap.

Two further microcode findings, 2026-08-09 - one PROVES a rule, one closes a question

DE is raised on trap delivery, gated on PSD - proven, not inferred. There is exactly one place in the whole control store that sets bit 31, and it is DEL_TRAP at 012537:

012537 DEL_TRAP: ALU,A   A,MIC,STS B,X1  D,SC13   ; read the status
012540:          ALU,AND A,BM04 B,SC13            ; test bit 4 = PSD
012541:          ... C,SEQ COND,MZRO ADDR=TRAP    ; PSD clear -> deliver normally
012542:          ALU,OR  A,BM37 B,SC13 D,MIC,STS  ; PSD set  -> OR in bit 31 = DE
012543/4:        ...                    ADDR=TRAP ; then deliver anyway

Both arms reach TRAP, so DE is set ALONGSIDE the provoking trap, never instead of it. That is what nd500x does (cpu.c:1266) and what C# does not do at all. Previously this rule rested on the manual sentence; it is now read off the hardware.

DT is never set anywhere in the microcode. BM36 (bit mask 30 = DT) does not appear with ANY D,MIC,... or D,SPEC,... destination in the whole listing. The only masks written into MIC,STS in that range are BM32, BM33 and the BM37 above. So the 256-cycle timeout is raised by HARDWARE watching the modus bit, not by microcode.

Two consequences:

  1. C#'s Solo.cs:52-58 is contradicted by the control store. SOLO's microroutine (004524-004533) sets PSD, tests PIA and writes the modus register. It never touches DT. A SOLO instruction that raises DT on the spot is not what this machine does.
  2. The repeat-SOLO timing cannot be settled from the listing at all, because the counter is not in it. The point-3 reading below stays INFERRED. It is now better supported - the whole timeout mechanism is external, so the absence of a counter reset in the SOLO path is expected rather than surprising - but it is still an argument from absence, and the thing that would settle it is the ND-5000 hardware description or real hardware.

Checked and NOT found: the microcode source. The floppy 211276D is the binary distribution (/mnt/d/ND/5000/211276D1-XX-P.TEXT lists only the two .DATA images and three .NRF libraries); the source is a separate product, ND-no. 250291D, which is not in /mnt/d/ND/5000/. And /mnt/d/ND/5000/Decode/MICRO-5800-B30.LIST is generated by that directory's own disasm.py, so it carries no designer comments. If 250291D ever turns up, it is the thing to read.

Inferred, not proven: the 256-cycle counter itself is not in the microcode. It is hardware watching the modus bit. Point 3 rests on the absence of any counter reset in the SOLO path. If a counter reset is later found in the hardware description, cases S4 and T9 below are the ones to revisit.

Also checked and rejected: SOLO_0's first microword, ALU,A-1 A,BM10 B,X1 D,MIC,MISTS, looks like a preset of 255 = 256-1. It is not. The identical idiom appears at RETT_USTS (014464) and MSG_UNIX5RE2 (025660), so it is a generic MIC status write, not SOLO's timer.

The oracle can be RUN, not just read

RetroCore already executes this control store: Nuget/HackerCorpLabs.Emulation.CPU.ND5000/tests/MacroInstructionOracle.cs RunBoth() drives one macroinstruction through the loaded microcode AND through the functional emulator and diffs them. That is a better authority than my reading of the listing, and it is the route asked for in shared-file item 15a.

It cannot answer SOLO today: tests/MacroOracleState.cs exposes Zro Sgn Cry Ovfl Pia but not Psd, and tests/ControlManualCoverageTests.cs:31 records that "solo's PSD ... [is] NOT directly" observable. Adding Psd the way Pia is already done makes all four SOLO/TUTTI questions executable, and the harness's one-instruction boundary is no obstacle - seeding Psd=1 IS "a region is already open", so the repeat-SOLO case needs no second SOLO.

If that oracle contradicts anything below, it wins and nd500x changes. One caveat on a null result: the 256-cycle counter is hardware watching the modus bit, not microcode, so the oracle can settle what the control store DOES and cannot settle what the counter does afterwards.

Encoding and bit values

Item Value
SOLO hex 0xFE00, octal 177000B, 0 operands
TUTTI hex 0xFE01, octal 177001B, 0 operands
PIA ST1 bit 1, mask 0x00000002
PSD ST1 bit 4, mask 0x00000010
Z / C / S / K / O bits 5 / 6 / 7 / 8 / 9, masks 0x20 0x40 0x80 0x100 0x200
DT trap bit 30, mask 0x40000000 - non-ignorable, After-class
DE trap bit 31, mask 0x80000000 - non-ignorable, After-class

Manual 16.1 "Data status bits: Unaffected" for SOLO; 16.2 the same for TUTTI, and 16.2's "Trap conditions: None" - TUTTI carries no "Privileged instruction" line, unlike the instructions that do.


Tier 1 - cases that fit the existing single-instruction corpus

Format as usual: set initial.regs, execute one instruction, assert final.regs and the trap condition. pc advances by 2 in every case. Unless a row says otherwise, the expected trap set is empty - that is the assertion, not a detail.

# Name initial st final st Trap What it pins
S1 Solo_SetsPsd_Unprivileged 0x00000000 0x00000010 none SOLO sets bit 4
S2 Solo_SetsPsd_Privileged 0x00000002 0x00000012 none privilege does not change the visible effect
S3 Solo_LeavesConditionFlagsUnchanged 0x000003E0 0x000003F0 none "Data status bits: Unaffected" - Z,C,S,K,O all survive
S4 Solo_Repeat_Unprivileged_NoImmediateTrap 0x00000010 0x00000010 none the discriminator. A nested SOLO does NOT trap on the spot
S5 Solo_Repeat_Privileged_NoTrap 0x00000012 0x00000012 none same, privileged
S6 Solo_DoesNotRaiseDtOrDe 0x00000000 0x00000010 none asserts bits 30 and 31 stay clear
S7 Tutti_ClearsPsd 0x00000010 0x00000000 none TUTTI clears bit 4
S8 Tutti_WhenPsdClear_NoOp 0x00000000 0x00000000 none idempotent, no trap
S9 Tutti_Unprivileged_NoIicTrap 0x00000010 0x00000000 none manual 16.2 "Trap conditions: None". TUTTI is not privileged
S10 Tutti_LeavesConditionFlagsUnchanged 0x000003F0 0x000003E0 none Z,C,S,K,O survive
S11 Solo_PreservesPia 0x00000002 0x00000012 none PIA is not instruction-modifiable
S12 Tutti_PreservesPia 0x00000012 0x00000002 none same

Known failures these will produce today, which is the point:

  • C# fails S4 and S5. Instructions/CONTROL/Solo.cs:53-58 raises DT immediately when PSD is already set and PIA is clear. S5 may pass by accident since that path is guarded on !PIA; S4 will fail.
  • nd500x failed S9 until 2026-08-09 - nd500_instr_Tutti() opened with nd500_require_privilege() while SOLO had no such guard, so unprivileged code could open a region and then be refused the only instruction that closes it. Fixed; see below.

An existing corpus case is WRONG and must be regenerated

tutti_Default (case 36424 of 40088) expects IllegalInstruction. It should expect no trap. TUTTI is not a privileged instruction:

  1. The manual marks privileged instructions with an explicit "Privileged instruction" line in the Description - 15.17 CLINIT and 16.13 DMON both have it, and both still say "Trap Conditions: None", so the trap list is not where privilege is recorded. Neither 16.1 SOLO nor 16.2 TUTTI carries that line.
  2. Ch.16.1 presumes unprivileged users execute SOLO: "Unprivileged users are not allowed to run in SOLO for more than 256 cycles." A privileged-only SOLO would make that rule, and the whole DT timeout, dead text.
  3. The ND-5000 control store has no privilege test in TUTTI_0 (004534-004537). SOLO_0 does read PIA, but only to decide whether to arm the timeout (004530/004531), never to reject the instruction.

Where the wrong expectation comes from: CreateGenericSystemScenario in Emulated.Tests.ND500/Validation/Generators/ComprehensiveSystemGenerator.cs:805 sets ExpectedTrap = TrapType.IllegalInstruction with the comment "Privileged instructions raise IIC when executed in user mode", for every SYSTEM-class instruction it falls through to, with st = 0. TUTTI was swept in by its instruction class, not by anything determined about TUTTI.

Two independent signs the corpus is the wrong side here, not the emulators:

  • RetroCore's own Instructions/SYSTEM/Tutti.cs does not enforce privilege, so the generator contradicts its own emulator.
  • The generator's own TrapConditionSpec.cs:621 lists TUTTI's conditions as "DT, DE" - not IIC. Its two halves disagree.

Action for the generator side: exclude tutti (and check the rest of the SYSTEM fall-through list: pmof dmof rpgu cpgu zpgu rwip cwip zwip rphs wphs freeb ddirt int) from the blanket-privileged catch-all, and drive privilege from the manual's "Privileged instruction" line rather than from the class. DMON/PMON/CLINIT genuinely are privileged; SOLO and TUTTI are not.

Until the corpus is regenerated, nd500x quarantines the single case in test/test_conformance.c (conformance_quarantine[]). It still runs, still prints, is not counted as a pass, and the run FAILS if it ever starts passing so the entry cannot go stale.

Three-emulator alignment status (2026-08-09)

There are THREE ND-500 CPU implementations, and the third one has never been checked here:

  1. nd500x - the C functional emulator, this repo.
  2. RetroCore CpuND500 - the C# functional emulator.
  3. RetroCore CpuND5000 - Nuget/HackerCorpLabs.Emulation.CPU.ND5000/, which EXECUTES MICRO-5800-B30.DATA. When it runs, it is the machine.
Rule (source: control store + ch.16) nd500x CpuND500 CpuND5000
SOLO sets PSD (bit 4) yes yes cannot run - throws
TUTTI clears PSD yes yes cannot run - throws
Neither instruction is privileged yes, fixed ea4ed54 yes in code (comment wrong) microcode has no privilege test
Unprivileged repeat SOLO: no immediate DT yes, fixed ea4ed54 no - Solo.cs:52-58 traps microcode never sets DT anywhere
256-cycle DT timeout yes, cpu.c:1397 no - counter never read hardware, not microcode
DE alongside the provoking trap yes, cpu.c:1266 no - never raised yes - DEL_TRAP 012542
Ignorable traps suppressed inside PSD yes, cpu.c:1462 no - PSD never read dispatch level, not checked

Why CpuND5000 cannot run SOLO or TUTTI today

Both opcodes ARE dispatched - Generated/DispatchMapB30.g.cs:689-690 maps 65024 (0xFE00) to control-store 457 = 711 octal and 65025 (0xFE01) to 458 = 712 octal, matching the .LABE entries. The engine also models MIC,MISTS (OperandRouter.cs:158/447) and MIC,STS (OperandRouter.cs:167/460, Registers.MicSts).

It does not model SPEC,MOD. OperandRouter.cs:25 states the policy outright: "Unimplemented selects (MMS, SPEC, IDU, AAP results) throw with the mnemonic so real gaps surface." So:

  • SOLO executes 004524 and 004525, then throws at 004526 (A,SPEC,MOD).
  • TUTTI throws on its first microword, 004534 (A,SPEC,MOD).

This is the single blocking gap for the whole three-way alignment, and it is the same gap that blocks the oracle run asked for in shared-file item 15a. Modelling SPEC,MOD as a plain 32-bit register on both the A and D sides is enough - the modus bit that SOLO/TUTTI touch (BM25 = bit 21) needs storage and readback, nothing more. Adding Psd to MacroOracleState then makes all four SOLO/TUTTI questions executable against real microcode.

Negative cases - use the corpus's own mutation encoding

The corpus already supports negative tests and the runner reports on them (3664 present, 100% correctly detected). The fields are isNegativeTest, negativeTestType (wrong_flag | wrong_register | wrong_memory) and expectedValidationFailure. A negative case carries a DELIBERATELY WRONG expectation and PASSES when the runner detects the mismatch.

These encode each bug found in this area as something the corpus itself will catch if it ever comes back:

# Type Case Detects
N1 wrong_flag SOLO, st 0 -> claimed final 0x00000000 (PSD missing) an emulator that never sets PSD - the pre-8a46aaf nd500x bug
N2 wrong_flag SOLO, st 0x00000010 -> claimed final 0x40000010 (DT set) the discriminator as a negative. Detected only if the emulator does NOT raise DT on a nested SOLO. CpuND500 fails this today
N3 wrong_flag TUTTI, st 0x00000010 -> claimed final 0x00000010 (PSD still set) a TUTTI that does not clear the region
N4 wrong_flag TUTTI, st 0x00000010, PIA clear -> claimed IIC raised the tutti_Default defect, re-expressed so the corpus asserts IIC must NOT happen
N5 wrong_flag SOLO, st 0x000003EE -> claimed final 0x000003DE (Z cleared) "Data status bits: Unaffected" being violated
N6 wrong_register SOLO -> claimed pc = DefaultPC+1 wrong instruction length
N7 wrong_flag SOLO, st 0x00000002 -> claimed final 0x00000010 (PIA cleared) PIA being modified, which ch.6.5.4 forbids
N8 wrong_flag TUTTI, st 0x000003FE -> claimed final 0x000003EE plus O cleared TUTTI touching condition flags

More positive cases - preservation, which is where emulators drift

# Name initial st final st What it pins
S13 Solo_PreservesPendingTrapBits 0xC0000000 0xC0000010 SOLO must not clear an already-set DT/DE
S14 Tutti_PreservesPendingTrapBits 0xC0000010 0xC0000000 nor must TUTTI
S15 Solo_PreservesPdIr 0x0000000C 0x0000001C PD (bit 2) and IR (bit 3) untouched
S16 Tutti_PreservesPdIr 0x0000001C 0x0000000C same
S17 Solo_AllNonTrapStatusSet 0x000003EE 0x000003FE every non-trap status bit survives at once
S18 Tutti_AllNonTrapStatusSet 0x000003FE 0x000003EE same, and ONLY bit 4 changes

0x000003EE is PIA, PD, IR, Z, C, S, K, O all set with PSD clear - deliberately no trap-condition bits, so these cases cannot accidentally depend on dispatch.

Tier 2 - cases the single-instruction corpus CANNOT express

These need a sequence harness: a state, a run of N instructions, then an assertion. Do not force them into the corpus format - a case that pre-loads an emulator-internal cycle marker would be testing the implementation, not the architecture.

# Sequence Expected What it pins
T1 PIA=0; SOLO; 300 filler instructions DT raised the timeout exists at all. C# has no timeout
T2 PIA=0; SOLO; 100 filler no DT negative - well inside the limit
T3 PIA=1; SOLO; 10000 filler no DT "In privilege mode there is no limitation"
T4 PIA=0; SOLO; 100 filler; TUTTI; 10000 filler no DT TUTTI disarms (microcode 004536 clears the modus bit unconditionally)
T5 SOLO; instruction that page-faults PGF and DE both set "Non-ignorable and fatal traps cause a disable process switch error trap". DE is raised ALONGSIDE, not instead of
T6 PSD clear; same page-faulting instruction PGF set, DE clear negative - DE only inside a region
T7 SOLO; instruction raising an enabled ignorable trap (e.g. IOV with IOV enabled in OTE) status bit set, no dispatch, PC not vectored to THA ch.6.5.4 "Ignorable trap conditions are ignored in SOLO-TUTTI sequences regardless of enabling of these traps"
T8 as T7, then TUTTI, then one more instruction dispatch now occurs the bits accumulated, they were only held back
T9 PIA=0; SOLO; 200 filler; SOLO again; 100 filler DT raised the nd500x discriminator. Total 300 > 256. nd500x currently re-stamps its start marker on every SOLO and will NOT trap
T10 CPU reset; 300 filler with PSD never set no DT regression guard for 712ba00
T11 DT delivery resumes at the NEXT instruction DT is After-class in the ST1 table (N A)

Known failures: C# fails T1, T4, T5, T7, T8, T9, T11 - it has no timeout, never raises DE, and never reads PSD on the trap path. nd500x fails T9.

One boundary deliberately left without an expected value

Manual ch.6.5.4: "If this bit is set for more than 256 microcycles (including the 2 spent in the SOLO instruction)". Ch.16.1 adds that on the ND-5000 the unit is macroinstruction cycles, not microcycles. Whether the boundary case is 256 or 257 or 258 counted instructions therefore depends on how the "+2" maps onto macroinstruction cycles, which neither the manual nor the listing settles.

Do not generate a case at the exact boundary. T1 and T2 sit at 300 and 100 so they cannot depend on it. If someone later wants the boundary pinned, the experiment is to run an unprivileged SOLO region on real hardware, or find the counter in the ND-5000 hardware description - not to copy whichever number an emulator currently uses. nd500x uses > 256 (SOLO_MAX_CYCLES in src/cpu/cpu.c), chosen to err long; that is a choice, not a measurement.

Filler instruction for Tier 2

Use an instruction with no operands and no side effects on ST1's condition bits, so the sequence tests only the timeout. A register-to-register move of a register onto itself, or a NOOP if the corpus already has one. It must NOT be a branch (BT is a trap condition) and must not fault.