Skip to content

Tandy 1000 support - #2467

Draft
maximilien-noal wants to merge 5 commits into
masterfrom
fix/tandy1000support
Draft

maximilien-noal wants to merge 5 commits into
masterfrom
fix/tandy1000support

Conversation

@maximilien-noal

@maximilien-noal maximilien-noal commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Description of Changes

🟦 Tandy 1000 support, thanks to DOSBox Staging

Makes OutRun's TANDY (16 COLOUR) option usable in Spice86, with native Tandy graphics and sound.

What is added
🟪 Video 40/80-column text, CGA-compatible modes, 160 x 200 and 320 x 200 in 16 colours, and 640 x 200 in 4 colours. Native palettes, CRTC addressing, independent CPU/display banks, and BIOS drawing.
🟨 Sound NCR8496 PSG and native DAC, with IRQ 7, DMA channel 1, filters, and configurable PSG fade-out.
🟩 BIOS and memory Tandy identification, BIOS services, and video memory shared with conventional RAM. The BIOS reports 624 KiB; physical conventional RAM remains 640 KiB.

Select it with --MachineType Tandy1000 (Tandy also works). Without that option, the existing PC/VGA platform stays the default.

Tandy video and BIOS services use native implementations selected during machine construction. Sound and DMA use direct ownership instead of new C# events. PSG and firmware initialize during construction.

The implementation follows DOSBox Staging's Tandy support.

Licensing remains open. DOSBox-derived GPL-2.0-or-later code and the BSD-licensed NCR8496 core are still present. This refactor is not an independent replacement. The upstream notices remain until the corresponding derived code is replaced.

Rationale behind Changes

Fixes #232.

Tandy software needs its BIOS identity, memory banking, video registers, and sound hardware to agree. Adding a 16-colour mode alone is not enough.

Fun fact: OutRun checks the firmware configuration block at FC000h. The model byte at FFFFEh alone does not convince it that a Tandy is present.

Suggested Testing Steps

Start params, from the repository root:

dotnet run --project src\Spice86 -- --MachineType Tandy1000 `
  -c C:\Games\OutRun -e C:\Games\OutRun\OUTRUN.EXE

Choose 2 - TANDY (16 COLOUR) in the game.

Checked against DOSBox Staging 0.83.0 (7b400), with machine=tandy:

  • 🟢 An original diagnostic: 19/19 captured states match pixel for pixel, including all ten supported BIOS modes, palette changes, CRTC start, CPU/display banks, blanking, and BIOS pixels, characters, and scrolling. Both diagnostic programs exit normally.
  • 🟢 OutRun's completed title, credits, and music-selection screens match the raw reference images exactly. Native gameplay reaches the race. Moving race frames were not synchronized for pixel comparison.

The committed ASM probes are original programs covering detection, mode 09h banking/palettes, and PSG/DAC programming. They contain no copied OutRun code or game assets.

Command Result
dotnet build src\Spice86.sln --no-restore --verbosity quiet Passed; 0 warnings, 0 errors
dotnet test tests\Spice86.Tests --no-build -- --filter-class '*TandyPlatformTest*' 13 passed
dotnet test tests\Spice86.Tests --no-build -- --filter-not-class '*SingleStepTest*' 7,211 passed

SingleStepTest is excluded; CPU instruction execution is not changed here.

Still limited: no claim of cycle-exact video timing or exact audio output. PCjr and composite video are not included. DOS memory allocation is unchanged; OutRun can still report MCB-chain corruption during process cleanup.

Copilot AI balanced review requested due to automatic review settings November 3, 2026 15:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved video scheduler races, Tandy bank-shadow corruption, and sound-buffer writes over installed interrupt routines pose critical correctness risks.

5 open issues
What changed in this PR

Adds an optional Tandy 1000 platform to Spice86 for OutRun and other native Tandy software, addressing #232 while retaining PC/VGA as the default.

Changes:

  • Adds Tandy firmware identification, BIOS services, shared video memory, native graphics modes, and rendering.
  • Implements PSG and DAC sound with DMA ownership handling, filters, and configurable fade-out.
  • Adds catalogue-driven hardware probes, platform-specific goldens, configuration options, and upstream licensing notices.
File Description
tests/​Spice86.Tests/​TandyPlatformTest.cs Runs hardware probes in interpreted and compiled modes.
tests/​Spice86.Tests/​Spice86Creator.cs Passes platform settings into test machines.
tests/​Spice86.Tests/​Resources/​TandyTests/​tandy_sound.asm Probes PSG programming and DAC DMA completion.
tests/​Spice86.Tests/​Resources/​TandyTests/​tandy_mode09.asm Probes graphics, palettes, and independent memory banks.
tests/​Spice86.Tests/​Resources/​TandyTests/​tandy_detection.asm Checks firmware identity and BIOS memory reporting.
tests/​Spice86.Tests/​Resources/​cpuTests/​res/​DumpedListing/​tandy_sound.tandy.txt Adds the sound probe listing golden.
tests/​Spice86.Tests/​Resources/​cpuTests/​res/​DumpedListing/​tandy_mode09.tandy.txt Adds the graphics probe listing golden.
tests/​Spice86.Tests/​Resources/​cpuTests/​res/​DumpedListing/​tandy_detection.txt Adds the PC detection listing golden.
tests/​Spice86.Tests/​Resources/​cpuTests/​res/​DumpedListing/​tandy_detection.tandy.txt Adds the Tandy detection listing golden.
tests/​Spice86.Tests/​Resources/​cpuTests/​res/​DumpedCfgPartitions/​tandy_sound.tandy.json Records sound probe control-flow partitions.
tests/​Spice86.Tests/​Resources/​cpuTests/​res/​DumpedCfgPartitions/​tandy_detection.tandy.json Records Tandy detection control-flow partitions.
tests/​Spice86.Tests/​Resources/​cpuTests/​res/​DumpedCfgPartitions/​tandy_detection.json Records PC detection control-flow partitions.
tests/​Spice86.Tests/​MachineGoldens.cs Separates machine goldens by platform.
tests/​Spice86.Tests/​GeneratedCodeMachineTestRunner.cs Separates generated-source goldens by platform.
tests/​Spice86.Tests/​AsmFixtures/​TandyScenarioCatalog.cs Registers probes and behavioral assertions.
tests/​Spice86.Tests/​AsmFixtures/​AsmScenarioCatalog.cs Includes Tandy scenarios in the shared catalogue.
tests/​Spice86.Tests/​AsmFixtures/​AsmRunSettings.cs Adds platform selection and golden suffixes.
src/​Spice86/​ViewModels/​Services/​DevicesTabPlugin.cs Hides VGA-specific debugger tabs on Tandy.
src/​Spice86/​Spice86DependencyInjection.cs Wires platform hardware, firmware, and lifecycle management.
src/​Spice86.Core/​Spice86.Core.csproj Packages upstream licensing notices.
src/​Spice86.Core/​Emulator/​ShutdownCoordinator.cs Disposes platform-specific devices during shutdown.
src/​Spice86.Core/​Emulator/​Platform/​MachineType.cs Defines PC and Tandy platform choices.
src/​Spice86.Core/​Emulator/​Platform/​MachineProfile.cs Defines platform-specific BIOS memory reporting.
src/​Spice86.Core/​Emulator/​Mcp/​EmulatorMcpTools.cs Guards unsupported Tandy video operations.
src/​Spice86.Core/​Emulator/​IOPorts/​IOPortDispatcher.cs Adds owner-checked port removal.
src/​Spice86.Core/​Emulator/​InterruptHandlers/​VGA/​VgaFunctionality.Tandy.cs Implements native modes, palettes, banking, and drawing.
src/​Spice86.Core/​Emulator/​InterruptHandlers/​VGA/​VgaFunctionality.cs Routes BIOS video helpers to Tandy behavior.
src/​Spice86.Core/​Emulator/​InterruptHandlers/​VGA/​VgaBios.cs Adds Tandy interrupt dispatch and capability restrictions.
src/​Spice86.Core/​Emulator/​InterruptHandlers/​VGA/​TandyVideoMode.cs Defines native BIOS mode metadata.
src/​Spice86.Core/​Emulator/​InterruptHandlers/​SystemClock/​SystemClockInt1AHandler.cs Connects INT 1Ah to Tandy sound services.
src/​Spice86.Core/​Emulator/​InterruptHandlers/​Common/​MemoryWriter/​MemoryWriter.cs Protects reserved firmware ranges during routine installation.
src/​Spice86.Core/​Emulator/​InterruptHandlers/​Bios/​TandyBios.cs Installs platform firmware and equipment data.
src/​Spice86.Core/​Emulator/​InterruptHandlers/​Bios/​SystemBiosInt15Handler.cs Adds configuration-table and joystick BIOS services.
src/​Spice86.Core/​Emulator/​InterruptHandlers/​Bios/​Structures/​TandyBiosRom.cs Supplies firmware signatures, reset entries, and video parameters.
src/​Spice86.Core/​Emulator/​InterruptHandlers/​Bios/​Structures/​BiosSystemConfigurationTable.cs Defines the Tandy system configuration table.
src/​Spice86.Core/​Emulator/​InterruptHandlers/​Bios/​Structures/​BiosDataArea.cs Exposes Tandy's physical conventional-memory size.
src/​Spice86.Core/​Emulator/​InterruptHandlers/​Bios/​BiosEquipmentDeterminationInt11Handler.cs Returns Tandy equipment information.
src/​Spice86.Core/​Emulator/​Devices/​Video/​VideoState.cs Holds optional native Tandy video state.
src/​Spice86.Core/​Emulator/​Devices/​Video/​VgaTimingParameters.cs Selects native Tandy timing calculations.
src/​Spice86.Core/​Emulator/​Devices/​Video/​VgaTimingEngine.cs Adds native resize scheduling and frame restarts.
src/​Spice86.Core/​Emulator/​Devices/​Video/​VgaIoPortHandler.cs Handles native registers, banking, and light-pen ports.
src/​Spice86.Core/​Emulator/​Devices/​Video/​VgaBeamTiming.cs Adds Tandy beam timing and light-pen positioning.
src/​Spice86.Core/​Emulator/​Devices/​Video/​TandyVideoMemory.cs Maps CPU and display banks onto shared RAM.
src/​Spice86.Core/​Emulator/​Devices/​Video/​Renderer.cs Renders native Tandy text and graphics.
src/​Spice86.Core/​Emulator/​Devices/​Sound/​Tandy/​TandySoundMode.cs Defines automatic, full, PSG-only, and disabled sound modes.
src/​Spice86.Core/​Emulator/​Devices/​Sound/​Tandy/​TandySoundDevice.cs Coordinates native sound devices and DMA conflicts.
src/​Spice86.Core/​Emulator/​Devices/​Sound/​Tandy/​TandyPsg.cs Integrates PSG ports and synthesis with the mixer.
src/​Spice86.Core/​Emulator/​Devices/​Sound/​Tandy/​TandyDac.cs Implements DAC playback, DMA transfers, and IRQ 7.
src/​Spice86.Core/​Emulator/​Devices/​Sound/​Tandy/​TandyAudioSettings.cs Parses and applies audio filter settings.
src/​Spice86.Core/​Emulator/​Devices/​Sound/​Tandy/​Ncr8496.cs Implements the native PSG synthesis core.
src/​Spice86.Core/​Emulator/​Devices/​Sound/​SoundChannel.cs Adds emulated-clock sleep and configurable fade-out.
src/​Spice86.Core/​Emulator/​Devices/​Sound/​SoftwareMixer.cs Supports device removal and unsigned-byte audio queues.
src/​Spice86.Core/​Emulator/​Devices/​Sound/​Blaster/​SoundBlaster.cs Adds BIOS DAC availability and DMA reacquisition handling.
src/​Spice86.Core/​Emulator/​Devices/​DirectMemoryAccess/​DmaChannel.cs Preserves transfer registers across ownership changes.
src/​Spice86.Core/​Emulator/​Devices/​DirectMemoryAccess/​DmaBus.cs Supports secondary-controller removal and reactivation.
src/​Spice86.Core/​Emulator/​Devices/​Cmos/​RealTimeClock.cs Mirrors BIOS equipment information into CMOS.
src/​Spice86.Core/​Emulator/​Devices/​Cmos/​CmosRegisterAddresses.cs Names the CMOS equipment register.
src/​Spice86.Core/​CLI/​RuntimeOptions/​TandyAudioOptions.cs Carries resolved Tandy audio preferences.
src/​Spice86.Core/​CLI/​RuntimeOptions/​RuntimeOptionsMapper.cs Maps configuration to platform and audio options.
src/​Spice86.Core/​CLI/​Configuration.cs Exposes platform and Tandy sound command-line options.
licenses/​dosbox-staging/​NOTICE.txt Records upstream attribution and source correspondence.
licenses/​dosbox-staging/​GPL-2.0-or-later.txt Adds the GPL licensing notice and license-text reference.
licenses/​dosbox-staging/​BSD-3-Clause.txt Adds BSD terms for the synthesis core.

Review effort: Balanced

@maximilien-noal maximilien-noal self-assigned this Nov 3, 2026
@maximilien-noal maximilien-noal added enhancement New feature or request audio Audio emulation or playback related Music Music emulation related. Can be any form of Music (FM Synth, MT-32, or General MIDI, ...) compatibility Emulator compatibility with DOS apps video Emulator video mode or video device related memory Emulator memory access mode and layout hardware hardware device (can be virtual) emulation 16 bit Related to 16 bit programs support IBM PC Compatible Related to a platform compatible with IBM PC programs BIOS Related to the IBM PC BIOS DMA Related to DMA emulation or DMA channels PCM related to sound effects playback or performance labels Nov 3, 2026
@maximilien-noal
maximilien-noal marked this pull request as draft November 3, 2026 16:03
@maximilien-noal
maximilien-noal marked this pull request as ready for review November 3, 2026 16:18
@maximilien-noal
maximilien-noal marked this pull request as draft November 3, 2026 16:22
@maximilien-noal
maximilien-noal marked this pull request as ready for review November 3, 2026 16:57
@maximilien-noal
maximilien-noal marked this pull request as draft November 3, 2026 16:57
private void ScheduleResize(double deadlineMs) {
_scheduler.RemoveEvents(OnResize);
double delayMs = Math.Max(0, deadlineMs - _scheduler.EventTimeMs);
if (delayMs == 0) {
Comment on lines +473 to +479
if (configuration.InitializeDOS is not false && (machineProfile.IsTandy || enableTandySound)) {
systemClockInt1AHandler = new TandySystemClockInt1AHandler(memory, biosDataArea,
realTimeClock, cfgCpu, stack, state, loggerService, tandySoundDevice);
} else {
systemClockInt1AHandler = new SystemClockInt1AHandler(memory, biosDataArea,
realTimeClock, cfgCpu, stack, state, loggerService);
}
Comment on lines +658 to +664
if (tandySoundDevice is not null) {
if (configuration.InitializeDOS is not false) {
TandySoundBios tandySoundBios = new(state, memory, stack, ioPortDispatcher,
interruptVectorTable, assemblyRoutineInstaller, tandySoundDevice, soundBlaster);
platformDevices.Insert(0, tandySoundBios);
}
}
@maximilien-noal
maximilien-noal marked this pull request as ready for review November 3, 2026 17:38
@maximilien-noal
maximilien-noal marked this pull request as draft November 3, 2026 17:38
maximilien-noal and others added 4 commits November 6, 2026 16:44
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep resize scheduling on its owner thread and preserve its deadline.
Do not overwrite the Tandy bank shadow or the fixed BIOS DAC buffer.
Preserve upstream DMA eviction and masked-read behaviour.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Select native video and BIOS implementations during composition. Replace Tandy event wiring with typed device ownership and initialize PSG and firmware during construction.

Preserve scanout timing, firmware layout, and upstream attribution while derived code remains.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

# Conflicts:
#	src/Spice86.Core/Emulator/InterruptHandlers/Bios/BiosEquipmentDeterminationInt11Handler.cs
#	src/Spice86.Core/Emulator/InterruptHandlers/Bios/SystemBiosInt15Handler.cs
#	src/Spice86.Core/Emulator/InterruptHandlers/SystemClock/SystemClockInt1AHandler.cs
#	src/Spice86.Core/Emulator/InterruptHandlers/VGA/VgaBios.cs
Make INT 15h C0h write the full AX, ES and BX its contract declares, count inherited interrupt service attributes once per hierarchy walk, add the matching SystemBiosServices helper, and regenerate the Tandy goldens for master's INT 8 handler changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

16 bit Related to 16 bit programs support audio Audio emulation or playback related BIOS Related to the IBM PC BIOS compatibility Emulator compatibility with DOS apps DMA Related to DMA emulation or DMA channels enhancement New feature or request hardware hardware device (can be virtual) emulation IBM PC Compatible Related to a platform compatible with IBM PC programs memory Emulator memory access mode and layout Music Music emulation related. Can be any form of Music (FM Synth, MT-32, or General MIDI, ...) PCM related to sound effects playback or performance video Emulator video mode or video device related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Emu: Support the Tandy-1000 Platform.

3 participants