# ZX-Spectrum-BDI-TR-DOS-interface

## Open-source Beta Disk Interface (TR-DOS) for ZX Spectrum 48K/128K. Powered strictly by +5V using Fujitsu MB8877A FDC. No +12V required!

> [English](README.en.md) | [Русский](README.md)  

This is an open-source hardware project of the legendary **Beta Disk Interface (BDI)** tailored for original British **ZX Spectrum 48K / 128K** computers and their classic edge-connector compatible clones. 

The interface has been fully redesigned using modern component availability with your vintage hardware's safety in mind. The definitive difference from classic 1990s schematics is the core floppy disk controller (FDC) choice: it utilizes the **Fujitsu MB8877A** chip (a CMOS drop-in alternative to the WD1793), which operates strictly from a single **+5V** rail. No more dangerous +12V high voltage routed over the Spectrum's expansion bus!

The project guarantees 100% hardware and software compatibility with the **TR-DOS** operating system, granting immediate access to a massive global library of software, games, and demo-scene releases stored in standard `.TRD` and `.SCL` disc image formats. Both board variants have been thoroughly assembled, tested in real hardware, and are completely ready for DIY building.

***

## 🎛 Form-Factor Variants (PCB Versions)

The project is available in two structural options depending on your custom enclosure or aesthetic goals:

### 1. Classic Sandwich (Two-Board Layout)
*   An authentic, nostalgic look inspired by the classic peripheral expansions of the 1990s.
*   The circuitry is split across two separate stacked PCBs to facilitate clean routing of large through-hole (DIP) components.
*   The perfect choice for vintage enthusiasts who prefer simple, spacious home soldering.
*   Features a standard male Spectrum expansion Edge connector pass-through.
    *   **Bottom Board:** [Schematics](Export/ZX%20BDI%202%20PCB%20Lower.pdf) | [Placement](Export/ZX%20BDI%202%20PCB%20Lower.html) | [Gerber](Gerber/ZX_BDI_2_PCB_Lower_Gerbers.zip)
    *   **Top Board:** [Schematics](Export/ZX%20BDI%202%20PCB%20Upper.pdf) | [Placement](Export/ZX%20BDI%202%20PCB%20Upper.html) | [Gerber](Gerber/ZX_BDI_2_PCB_Upper_Gerbers.zip)

### 2. Compact Single (Single-Board Layout)
*   A modern, dense layout with all components tightly grouped onto a single printed circuit board.
*   Features minimal dimensions, looking very neat and compact when plugged straight into the computer's back edge expansion port.
    *   [Schematics](Export/ZX%20BDI%201%20PCB.pdf) | [Placement](Export/ZX%20BDI%201%20PCB.html) | [Gerber](Gerber/ZX_BDI_TR_DOS_Grbers.zip)

***

## 🛠 Technical Features & Advantages

*   **Strictly +5V Powered:** Due to the MB8877A silicon requirements, the standard legacy +12V line is completely omitted from the design. This effectively guarantees that you will never accidentally fry a rare FDC controller or your computer's Z80 CPU because of a random voltage cross-talk or power supply imbalance.
*   **Expansion Bus Safety:** Eliminating high voltages makes this unit as safe as possible for the delicate, easily worn gold fingers of original vintage computer expansion ports.
*   **Drive Versatility:** The interface works flawlessly with standard physical 3.5" floppy drives (provided they receive +5V power externally) as well as modern Gotek hardware drive emulators running FlashFloppy firmware.

⚠️ **ATTENTION:** It is highly recommended to strictly use the **MB8877** chip (or its direct 5V CMOS equivalents). Attempting to drop in a classic Soviet КР1818ВГ93 or Western Digital WD1793 chip without manually rerouting the power circuits to supply +12V **will instantly destroy the vintage FDC integrated circuit**.

*Note: You can also use my DIY hardware LGT8F328P-based FDC chip emulator instead of a physical 40-pin IC.* [VG93/MB8877/WD1793](https://github.com/Alex-2-Graf/VG93-MB8877-lgt8f328p-emulator)

***

## ⚙ Hardware Configuration Controls

### DIP Switch (TR-DOS Version Selection)
The board features an onboard DIP switch block that allows you to easily multi-boot between four different pre-flashed TR-DOS system firmware versions. Detailed configurations can be inspected [here](ROM).

### ON/OFF Toggle Switch (TR-DOS Shadow ROM Management)
The hardware toggle switch manages the physical mapping logic of the TR-DOS shadow ROM. This toggle is essential to prevent system memory banking conflicts across different computer mainboard models:

#### 💾 Mode for ZX Spectrum 128K (Switch set to OFF)
*   **Setup:** For all official 128K models ("Toastrack", grey +2, etc.), the toggle **must always stay in the OFF position**.
*   **Logic:** The computer manages its RAM/ROM banks independently via the official port `$7FFD`. The BDI hardware remains in a transparent standby state and will automatically hook the bus only when you select the "TR-DOS" option in the standard startup boot-menu or execute a `RANDOMIZE USR 15616` call from 48-BASIC. If you force the toggle to ON on a 128K system, a permanent ROM mapping conflict will occur, causing a boot loop or a black screen.

#### 📼 Mode for ZX Spectrum 48K (Switch set to ON)
*   **Setup:** For original 48K rubber-key or Plus models, flip the toggle switch to **ON**.
*   **Logic:** Upon power-up or a hardware RESET press, the interface immediately overrides the internal motherboard ROM, replacing it with the TR-DOS system environment. The computer will immediately poll the drive index. If a floppy or a virtual Gotek image containing a standard `boot` file is present, the system will **autoboot the software automatically** without requiring any command-line input. To bypass the disk and drop straight into stock 48K BASIC, simply flip the toggle back to **OFF** before resetting the machine.
