Repository navigation
Tandy 1000 support - #2467
Draft
maximilien-noal wants to merge 5 commits into
Draft
Tandy 1000 support#2467maximilien-noal wants to merge 5 commits into
maximilien-noal wants to merge 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 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
Marshal resize scheduling and handling to the video thread · New Preserve the Tandy page-bank shadow during initialization · New Reserve the sound buffer before installing handlers on PCs · New Track low- and high-DMA ownership separately · New Pause sample consumption when the DMA channel is masked · New
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
marked this pull request as draft
November 3, 2026 16:03
maximilien-noal
marked this pull request as ready for review
November 3, 2026 16:18
maximilien-noal
marked this pull request as draft
November 3, 2026 16:22
maximilien-noal
marked this pull request as ready for review
November 3, 2026 16:57
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
marked this pull request as ready for review
November 3, 2026 17:38
maximilien-noal
marked this pull request as draft
November 3, 2026 17:38
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>
maximilien-noal
force-pushed
the
fix/tandy1000support
branch
from
November 6, 2026 19:30
b97d5d4 to
299e6ff
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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.
Select it with
--MachineType Tandy1000(Tandyalso 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:
Choose 2 - TANDY (16 COLOUR) in the game.
Checked against DOSBox Staging 0.83.0 (7b400), with
machine=tandy: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.
dotnet build src\Spice86.sln --no-restore --verbosity quietdotnet test tests\Spice86.Tests --no-build -- --filter-class '*TandyPlatformTest*'dotnet test tests\Spice86.Tests --no-build -- --filter-not-class '*SingleStepTest*'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.