Sega '315-5242' reproduction

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Sega '315-5242' reproduction

      The '315-5242' is a custom IC used on some Sega arcade systems :

      • System C/C2
      • System 18/24/32
      • System X
      • System Y
      It's basically a video DAC connected to the color RAMs, which provides analog outputs for driving a monitor.It accomplishes also some special functions like making the video output grayscale instead of color or enabling shadow/highlight effect.It comes under the form of a ceramic module covered by black paint or epoxy :






      The 'core' of the '315-5242' is a surface mounted IC (PQFP44 package) located on top of the module, the 'M71064' from OKI manufacturer :



      No info or reference was available for this fully digital IC until some time ago when 'furrtek' decapped it and traced schematics from the silicon die revealing the internal structure and figuring out the functions :




      Most of the work was done so the step to a real replacement was the easy and logical consequence.And here we are!I designed a proper board based on a +5V CPLD :




      Testing on all boards I could try was successful.


      Columns II (System C2)




      Michael Jackson's MoonWalker (System 18)




      Spider-Man (System32)




      Thanks again to 'furrtek', without his brilliant work none of this would have been possible.

      The post was edited 1 time, last by caius ().

    • @caius as you know I reproduced it with a few TTL chips. Are the schematics from the decapping available? I'm really curious to know what can be so different from my simple design. Even bootlegs replace it by a few TTL chips.
      Looking for:
      - faulty Space Harrier or Enduro Racer
      - Sega Mega-CD 1 power board
      - Super Nintendo CPU (3 needed)



      "I'd 1cc games but I have a real life."
      01010011 01000101 01000011 01010010 01000101 01010100 00100000 01001101 01000101 01001110 01010101 00100000 01000111 01010101 01011001
    • You all know I NEED to understand things :D

      So this 315-5242 module is used on:
      • System C/C2
      • System 18/24/32
      • X board
      • Y board
      • And Game Gear TV converter used by Sega for development


      If you look at the colour depth:
      • System C/C2: 4096, 4 bits per colour thus not using the full 5 bits per colour the module supports, shadow/highlight supported (tripling the palette)
      • System 18: 32768, 5 bits per colour, shadow/highlight supported (tripling the palette)
      • System 24: 32768, 5 bits per colour, shadow/highlight supported (tripling the palette)
      • System 32: not sure how that one works but I assume what goes through the module is 32768, 5 bits per colour, shadow/highlight supported (tripling the palette)
      • X board: 32768, 5 bits per colour, shadow/highlight supported (tripling the palette)
      • Y board: : again not sure how that one works but I assume what goes through the module is 32768, 5 bits per colour, shadow/highlight supported (tripling the palette)
      • Game Gear: 4096, 4 bits per colour thus not using the full 5 bits per colour the module supports, no shadow/highlight used either


      So in some cases all functionalities of the module aren't used. For instance the Game Gear RGB output board can be reproduced using only few parts (mostly latches IIRC, just like in my 315-5242 repro design).

      Then I was curious about that greyscale effect the OG OKI chip seems to support.
      What can we find in MAME?

      MAME wrote:

      In segaic16.cpp



      c) Resistor network and latches believed to be equivalent to the 315-5242 (referring to Space Harrier and System 16B hardware)


      And in segas24.cpp


      // 315-5242

      READ16_MEMBER( segas24_state::sys16_paletteram_r )
      {
      return m_generic_paletteram_16[offset];
      }

      WRITE16_MEMBER( segas24_state::sys16_paletteram_w )
      {
      int r, g, b;
      COMBINE_DATA (m_generic_paletteram_16 + offset);
      data = m_generic_paletteram_16[offset];

      r = (data & 0x00f) << 4;
      if(data & 0x1000)
      r |= 8;

      g = data & 0x0f0;
      if(data & 0x2000)
      g |= 8;

      b = (data & 0xf00) >> 4;
      if(data & 0x4000)
      b |= 8;

      r |= r >> 5;
      g |= g >> 5;
      b |= b >> 5;

      m_palette->set_pen_color(offset, rgb_t(r, g, b));

      if(data & 0x8000) {
      r = 255-0.6*(255-r);
      g = 255-0.6*(255-g);
      b = 255-0.6*(255-b);
      } else {
      r = 0.6*r;
      g = 0.6*g;
      b = 0.6*b;
      }
      m_palette->set_pen_color(offset+m_palette->entries()/2, rgb_t(r, g, b));
      }



      In segaxbd.cpp


      //-------------------------------------------------
      // palette_init - precompute weighted RGB values
      // for each input value 0-31
      //-------------------------------------------------

      void segaxbd_state::palette_init()
      {
      //
      // Color generation details
      //
      // Each color is made up of 5 bits, connected through one or more resistors like so:
      //
      // Bit 0 = 1 x 3.9K ohm
      // Bit 1 = 1 x 2.0K ohm
      // Bit 2 = 1 x 1.0K ohm
      // Bit 3 = 2 x 1.0K ohm
      // Bit 4 = 4 x 1.0K ohm
      //
      // Another data bit is connected by a tristate buffer to the color output through a
      // 470 ohm resistor. The buffer allows the resistor to have no effect (tristate),
      // halve brightness (pull-down) or double brightness (pull-up). The data bit source
      // is bit 15 of each color RAM entry.
      //

      // compute weight table for regular palette entries
      static const int resistances_normal[6] = { 3900, 2000, 1000, 1000/2, 1000/4, 0 };
      double weights_normal[6];
      compute_resistor_weights(0, 255, -1.0,
      6, resistances_normal, weights_normal, 0, 0,
      0, nullptr, nullptr, 0, 0,
      0, nullptr, nullptr, 0, 0);

      // compute weight table for shadow/hilight palette entries
      static const int resistances_sh[6] = { 3900, 2000, 1000, 1000/2, 1000/4, 470 };
      double weights_sh[6];
      compute_resistor_weights(0, 255, -1.0,
      6, resistances_sh, weights_sh, 0, 0,
      0, nullptr, nullptr, 0, 0,
      0, nullptr, nullptr, 0, 0);

      // compute R, G, B for each weight
      for (int value = 0; value < 32; value++)
      {
      int i4 = (value >> 4) & 1;
      int i3 = (value >> 3) & 1;
      int i2 = (value >> 2) & 1;
      int i1 = (value >> 1) & 1;
      int i0 = (value >> 0) & 1;
      m_palette_normal[value] = combine_6_weights(weights_normal, i0, i1, i2, i3, i4, 0);
      m_palette_shadow[value] = combine_6_weights(weights_sh, i0, i1, i2, i3, i4, 0);
      m_palette_hilight[value] = combine_6_weights(weights_sh, i0, i1, i2, i3, i4, 1);
      }
      }


      //-------------------------------------------------
      // paletteram_w - handle writes to palette RAM
      //-------------------------------------------------

      WRITE16_MEMBER( segaxbd_state::paletteram_w )
      {
      // compute the number of entries
      if (m_palette_entries == 0)
      m_palette_entries = memshare("paletteram")->bytes() / 2;

      // get the new value
      uint16_t newval = m_paletteram[offset];
      COMBINE_DATA(&newval);
      m_paletteram[offset] = newval;

      // byte 0 byte 1
      // sBGR BBBB GGGG RRRR
      // x000 4321 4321 4321
      int r = ((newval >> 12) & 0x01) | ((newval << 1) & 0x1e);
      int g = ((newval >> 13) & 0x01) | ((newval >> 3) & 0x1e);
      int b = ((newval >> 14) & 0x01) | ((newval >> 7) & 0x1e);

      // normal colors
      m_palette->set_pen_color(offset + 0 * m_palette_entries, m_palette_normal[r], m_palette_normal[g], m_palette_normal);
      m_palette->set_pen_color(offset + 1 * m_palette_entries, m_palette_shadow[r], m_palette_shadow[g], m_palette_shadow[b]);
      m_palette->set_pen_color(offset + 2 * m_palette_entries, m_palette_hilight[r], m_palette_hilight[g], m_palette_hilight[b]);
      }

      And so on for other drivers...
      What we learn here is no hardware or games amongst S18/24/32/X/Y use the greyscale effect. Actually they all use the module as a DAC (12 or 15 bits) plus optional shadow/highlight effect.

      Sega probably had plans when designing that module but ended up never putting in application some of the functionalities.
      It explains why, altough having a somewhat complicated die, the OKI chip can be reproduced with only a few TTL chips and have the games displaying colours correctly.
      Looking for:
      - faulty Space Harrier or Enduro Racer
      - Sega Mega-CD 1 power board
      - Super Nintendo CPU (3 needed)



      "I'd 1cc games but I have a real life."
      01010011 01000101 01000011 01010010 01000101 01010100 00100000 01001101 01000101 01001110 01010101 00100000 01000111 01010101 01011001

      The post was edited 3 times, last by Apocalypse ().

    • New

      Digging some more.

      @caius pointed me to Japanese website with the pinout of the module:

      w.atwiki.jp/arcadegames/pages/37.html



      So the extra function my reproduction isn't supporting is the greyscale effect. This is extremely interesting cause when I decapped the faulty module I got I found out pin 2 of the module had a trace going to the OKI chip but on the motherboard side it was unconnected (leading me to believe there's a pull-up resistor in the OKI chip for the /GRAY signal).

      Now by looking at the schematics and probing the board I discovered that pin is either left unconnected or tied to +5V on the following hardware:
      - System C/C2
      - X board
      - Y board
      - System 24

      But on S18 it's definitely connected to some logic. S32 I haven't checked yet but probaly same situation than S18.
      I need to check MAME drivers to see which games on S18 on S32 actually use the greyscale effect.
      It also means my reproduction is suitable for System C/C2, X board, Y board and S24 only. I will add a note:
      arcade-projects.com/forums/ind…highlight=5242#post215754

      [EDIT]
      Confirmed by MAME drivers, some S18 & S32 games use the greyscale effect.
      Looking for:
      - faulty Space Harrier or Enduro Racer
      - Sega Mega-CD 1 power board
      - Super Nintendo CPU (3 needed)



      "I'd 1cc games but I have a real life."
      01010011 01000101 01000011 01010010 01000101 01010100 00100000 01001101 01000101 01001110 01010101 00100000 01000111 01010101 01011001

      The post was edited 1 time, last by Apocalypse ().