Sega Master System EverDrive, Light Phaser and True Hard Reset

Home Forums Console Hacking Sega Master System EverDrive, Light Phaser and True Hard Reset

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #834
    snaker's avatarsnaker
    Participant
      Up
      6
      Down
      ::

      A complete hardware and firmware tutorial

      This document describes, in full technical detail, the complete process required to make a Sega Master System 2 work reliably with an EverDrive, a Mega Drive controller and the Light Phaser, without manual power cycling, without unreliable soft resets and without electrical side effects. This is not a simple mod, but a tightly coupled hardware and firmware project built on top of SMS++.

      The original goal was to be able to navigate the EverDrive menu using a Mega Drive controller, load any game, unplug the controller when launching a light gun game, connect the Light Phaser and play immediately. After finishing the game, the system should be able to return to the EverDrive menu and continue normally. On the Sega Master System, achieving this requires far more than just software changes.

      Mods i allready had

      Sega Master System Model 2 Passive RGB Video Mod Kit

      Sega Master System Model 2 Switchless Region Mod Kit

       

      Starting point: SMS++ and the Light Phaser limitation

      https://github.com/SukkoPera/SMSPlusPlus

      The project is based on SMS++ by SukkoPera, which already provides In-Game Reset, Mega Drive controller support and several quality-of-life features. However, the original SMS++ firmware has no support for the Light Phaser. This is not an omission but a technical limitation: the Light Phaser relies on the TH line in a way that directly conflicts with Mega Drive controller detection and operation.

      https://github.com/RetroBazook/SMSPlusPlusEx

      The solution came from the SMSPlusPlusEx fork by RetroBazook. This fork introduces a 74HC4066 analog switch that allows the Arduino to electrically isolate the Mega Drive controller lines whenever a Light Phaser is detected. The 4066 effectively prevents both devices from driving or loading the same lines at the same time, which is essential for correct TH detection. Without this isolation, the Light Phaser cannot function reliably.

      EverDrive and the Master System reset problem

      This is where the main architectural problem appears. The EverDrive detects the connected controller only at power-up. If the console boots with a Mega Drive controller connected, that configuration is locked until the console loses power. In-Game Reset does not solve this, because the Sega Master System does not have a true hardware reset line.

      IGR simply restarts the currently loaded ROM. It does not return to the EverDrive menu. As a result, once a ROM is running, there is no way to change the input device without performing a real power cycle.

      This means that a true hard reset, implemented as an actual power interruption, is mandatory.

      What was needed:

      Keeping the Arduino powered during a power cycle

      Before cutting power to the console, a critical requirement had to be addressed: the Arduino must remain powered while the console is being power-cycled. If the Arduino resets, all internal state is lost and the control logic becomes unusable.

      To solve this, a compact MP1584 step-down converter was added, small enough to fit underneath the board. The converter is powered directly after the console’s physical power switch and provides a stable 5 V supply to the Arduino. As long as the console is switched on, the Arduino remains powered, even if the 12 V rail feeding the rest of the console is temporarily cut.

      A 220 µF capacitor was added to the output of the MP1584. This capacitor plays a crucial role by absorbing short voltage dips during power transitions and preventing brown-out resets on the Arduino. Without it, occasional unintended resets occurred exactly during power cycling.

      Implementing a true hard reset using MOSFETs

      To implement a real power cycle, the 12 V line after the console’s physical switch was cut and routed through a P-channel MOSFET, an IRF9540N. The MOSFET’s source is connected to the 12 V input, its drain to the console side, and its gate is controlled using a 2N2222 NPN transistor.

      A 100 kΩ resistor is placed between the MOSFET’s source and gate so that the MOSFET remains normally on. The 2N2222’s collector is connected to the MOSFET gate, its emitter to ground, and its base is driven by the Arduino through a 1 kΩ resistor. An additional 10 kΩ resistor from the base to ground ensures stable and predictable switching.

      When the Arduino activates the transistor, the MOSFET gate is pulled low, the MOSFET turns off and the 12 V supply to the console is cut. When the signal is released, power is restored. This produces a true power cycle equivalent to physically switching the console off and on.

      The black screen issue and backfeeding

      Initially, even though the 12 V rail was being cut correctly, the console frequently returned to a black screen. After extensive testing, the root cause was identified as backfeeding from Arduino I/O pins. Several signal lines were providing enough current through internal protection paths to partially power the console, preventing a clean shutdown.

      An early attempt involved resetting the Arduino before the power cycle, but this caused double resets and did not reliably eliminate the problem.

      Correctly eliminating backfeed

      The final solution was precise and selective. Before cutting power, only the truly dangerous pins are placed into a high-impedance state by configuring them as inputs with no pull-ups. These include the controller data lines, SMS trace outputs, the SELECT/TH line, the 4066 control pin, and the RESET and PAUSE lines.

      This completely removes every possible backfeed path. After the power cycle, only the required pins are re-initialized. The Arduino itself is never reset. This permanently eliminated the black screen issue and ensured the EverDrive always returned to its menu.

      Firmware cleanup and removal of 50/60 Hz logic

      Because the console already had a dedicated hardware 50/60 Hz modification, all related firmware code was removed. This freed up pins and simplified the firmware significantly. The pin previously used for video mode switching was reassigned to control the power-cycle function via a controller button combination.

      A 1.5-second delay was also added at the beginning of setup() to allow power rails and peripherals to stabilize before any controller or Light Phaser detection takes place. Without this delay, startup detection was unreliable.

      Handling the PAUSE button and why the original logic had to be removed

      Another important detail concerns the PAUSE button. In this setup, the physical PAUSE button on the console is already used for the separate hardware 50/60 Hz modification. Because of this, the original PAUSE circuitry cannot be used by the firmware.

      The original SMS++ code assumes the presence of a functional physical PAUSE button and expects PAUSE IN and PAUSE OUT to be bridged in order for controller-based pause to work correctly. In this configuration, that assumption is no longer valid. Keeping the original PAUSE handling caused conflicts and unpredictable behavior, as the firmware was effectively waiting for a physical button that was no longer wired for its original purpose.

      To resolve this, all original PAUSE-related code was removed. A custom pause function was implemented that works exclusively through the controller and does not depend on the physical PAUSE button at all. This avoids any need to bridge PAUSE IN and PAUSE OUT, eliminates electrical conflicts with the 50/60 Hz mod and results in consistent, predictable pause behavior.

      Dynamic Mega Drive and Light Phaser switching during gameplay

      The final challenge was enabling dynamic input switching during gameplay. The EverDrive requires a Mega Drive controller for menu navigation, while light gun games require the Light Phaser. This must work without rebooting the system.

      The solution was to treat In-Game Reset not as a reset, but purely as a trigger. After an IGR event, the firmware enters a 15-second window during which controller detection is blocked and all output lines are held in a neutral state. This gives the user enough time to disconnect the Mega Drive controller and connect the Light Phaser safely.

      For the reverse direction, the TH line is monitored continuously. If TH remains high for 20 consecutive seconds, the Light Phaser is considered inactive and the system returns to detection mode, allowing a Mega Drive controller to be recognized again.

      Multiple approaches without timers were tested, including interrupt-based and edge-triggered detection. However, the TH line proved unreliable in practice. Timer-based logic produced the most stable and predictable results.


      Final result

      The completed system allows seamless use of an EverDrive, a Mega Drive controller and the Light Phaser on a Sega Master System with no limitations. It supports true hard resets, in-game device switching and always returns cleanly to the EverDrive menu. There are no black screens, no lockups and no need for manual power cycling.

      This project demonstrates that the Sega Master System has hardware characteristics that do not tolerate shortcuts. When those characteristics are respected and handled properly, however, the result is a system that feels as if it were designed to work this way from the beginning.

      The code: https://drive.google.com/file/d/1qxP_4e0HRMqzDtguwbWLqenJFnoubZ7q/view?usp=sharing

      I would never have been able to complete this project without the help of ChatGPT. The code still contains some outdated comments in my native language and a few misleading variable names, but it works exceptionally well. It could benefit from further cleanup and refactoring, but those are minor details.

       

       

       

       

      • This topic was modified 5 months, 1 week ago by snaker's avatarsnaker.
    Viewing 1 post (of 1 total)
    • You must be logged in to reply to this topic.