Arduino Megadrive Cart Experimentation Shield

The Megadrive/Genesis Cart Experimentation Shield allows you to read Megadrive / Genesis game cartridges using an Arduino Mega.

The shield provides the Arduino Mega with access to the 23 address bus and 16 data bus pins of a standard game cartridge so that data can be read from an original cartridge.

Example Usage

The below Arduino sketch shows how to use the MegadriveCart library to read data from the game cartridge header.

#include <MegadriveCart.h&rt;

#define SWITCH1 5
#define SWITCH2 4

MegadriveCart Md;

void setup() {

// Serial command menu
  Serial.begin(115200);
  Serial.println("Commands:");
  Serial.println(" ?? - Device response");
  Serial.println(" ?c - Cartridge check");
  Serial.println(" ?1 - Header: Console name");
  Serial.println(" ?2 - Header: Company code");
  Serial.println(" ?3 - Header: Release date");

  // SSet switches as inputs
  pinMode(SWITCH1, INPUT);
  pinMode(SWITCH2, INPUT);
  
  //Turn on internal pull-up resistors
  digitalWrite(SWITCH1, HIGH);
  digitalWrite(SWITCH2, HIGH);
}

void loop() {

  // LED 1 (cart inserted)
  if (Md.CartInserted()) {
    Md.Led1(1);
  } else {
    Md.Led1(0);
  }

  // Switches
  if (PINE & (1<<PINE3)) {
    Md.Led2(0);
  } else {
    Md.Led2(1);
  }

  // Serial commands
  if (Serial.available()) {
    
    // Command
    if (Serial.read() == '?') {

      // Wait for command
      while (Serial.available() == false) { }

      // Output the user request
      switch (Serial.read()) {
        
        // Cartridge check
        case 'c': {
          Serial.println(Md.CartInserted() ? "Cartridge is inserted" : "No cartridge inserted");
          break;
        }
        // Console Name
        case '1': {
          Serial.println(Md.ConsoleName());
          break;
        }
        // Company Code
        case '2': {
          Serial.println(Md.CompanyCode());
          break;
        }
        // Release Date
        case '3': {
          Serial.println(Md.ReleaseDate());
          break;
        }
        // Domestic Name
        case '4': {
          Serial.println(Md.DomesticName());
          break;
        }
        // Unknown command
        default:  {
          Serial.println("Unknown Command!");
          break;
        }
      }
    }
  }
}

Downloads

MegadriveCart Arduino library & example - unzip and copy the MegadriveCart folder into your libraries folder.

Images