-----------------------------------------------------------------------------
 MEKA - Technical Document (for those who cares about technical stuff)
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
 SUMMARY
-----------------------------------------------------------------------------
1. Master System quick specifications
2. How to build an adapter to connect SMS Joypads to your PC
3. How to build an adapter to connect 3-D Glasses to your PC
4. More ?
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
 1. Master System & Game Gear quick specifications
 by Omar Cornut
-----------------------------------------------------------------------------
 Mainly intended for webmasters who would like to put some infos about the
 systems. If you want to know way more about them, check out S8-Dev at the
 following address: http://www.smspower.org/dev

  CPU:         Zilog Z80 at 3.58 mhz (3.579545 hz to be exact).

  RAM:         64 kbits (= 8 kbytes)

  Save RAM:    on certain cartridges only (mostly role playing games).
               usually one or two banks of 128 kbits each (= 16 kbytes).

  Video RAM:   128 kbits (= 16 kbytes)

  Colours:     32 (16*2) on-screen, choosed from a palette of 64 on the
               Master System and 512 on the Game Gear.

  Resolution:  256x224 pixels. In video modes used by the very most games,
               only the top 256x192 pixels or the top right 248x192 pixels
               are shown on the screen. On the Game Gear, a 160x144 pixels
               centered area is always shown.

  Characters:  8x8 pixels, using one of the two 16 colors palette. Up to
               512 characters can be stored in VRAM but usually only 448
               are used because there will be not enough room to store
               actual screen and sprite tables.

  Sprites:     maximum of 64 sprites on-screen, 8 per lines. Sized of 8x8
               or 8x16 pixels, using one of the two 16 colors palette (the
               same for all sprites). may be masked by foreground tiles.

  Scrolling:   hard scrolling, vertical and horizontal, line per line. the
               scrolling can be ignored for the upper 16 pixels (used in
               many games for the status bar) and for the 64 right pixels
               (used in Gauntlet and Golvellius in vertical stages).

  Audio:       three tone channels with 1024 different frequencies and one
               noise (sound) channel. 16 different volume step for each.

               optional YM-2413 FM chipset on Japanese systems: 9 channels
               (or 6 + 3 drums), 15+1 instruments, hardware vibrato and
               amplitude modulation.
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
 2. How to build an adapter to connect SMS Joypads (DB-9) to your PC
    (via the Parallel Port)
    Comments by Mike Gordon.
-----------------------------------------------------------------------------

 Note
 ----
 This is a copy based on the schematic available on the now defunct
 DirectPad Pro site. I'm not sure who is the original author of this
 schematic, but it is very simple and the common nature of the adapter
 make it somewhat public domain knowledge.

 D-Connector Pinouts
 -------------------

 Pinouts are shown looking into the holes of the connector itself.
 _____________
 \ 5 4 3 2 1 /    A DB-9 Connector (see also
  \ 9 8 7 6 /     Chapter 3 for detailed informations)
   ~~~~~~~~~
 DB-9 SMS Joypad plug (female)
 __________________________________________
 \ 13 12 11 10  9  8  7  6  5  4  3  2  1 /    
  \  25 24 23 22 21 20 19 18 17 16 15 14 / 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 DB-25 Parallel connector on PC (female)


 DB-9 joypads (and more generally, inputs peripherals) were of common
 usage on Sega Master System, Megadrive, but also Atari and Amiga. 

 Legend
 ------
 Resistor:  --vvvvv--

 Circuit
 -------

 PARALLEL PORT (DB-25)                          SMS PAD (DB-9)

     DB25:1  <----------------------------------->  DB-9:1      (Up)

     DB25:2  <------vvvvvvvvv---+---------------->  DB-9:6      (Button 1)
                       10K      |
     DB25:11 <------------------+

     DB25:3  <------vvvvvvvvv---+---------------->  DB-9:9      (Button 2)
                       10K      |
     DB25:12 <------------------+

     DB25:14 <----------------------------------->  DB-9:2      (Down)
     DB25:16 <----------------------------------->  DB-9:3      (Left)
     DB25:17 <----------------------------------->  DB-9:4      (Right)

     DB25:18 <------------------+---------------->  DB-9:8      (Ground)
                                |
     DB25:19 <------------------+

* You need a 25-pin male D-plug (DB-25) for the parallel port connection (to
  fit the female parallel port socket), and a 9-pin male D-plug (DB-9) for
  the SMS joypad connection (to fit the female joypad plug). The pin numbers 
  should be marked on the plug itself.

* The type of resistor used (metal film, carbon etc.) is not important. The
  resistors can be soldered directly to the DB-25 connector, i.e. connect one
  resistor between pin 3 and pin 12, another between pin 2 and pin 11. (And
  a wire link, between pins 18 and 19.)
 
  The resistor value (10K) is indicated by coloured bands on the body of the
  resistor, as follows, from left to right:

   Either: Brown Black Orange       (gap)  Brown or Gold
       or: Brown Black Black Red    (gap)  Brown or Gold

* Use shielded cable, and use the outer shield of the cable for the Ground
  connection. Try and keep the cable as short as possible.


-----------------------------------------------------------------------------
 3. How to build an adapter to connect 3-D Glasses to your PC
    (via the COM Port)
    by Unknown (long time ago). comments by Frank and Mike Gordon.
-----------------------------------------------------------------------------

 Note
 ----
 As of yet, MEKA supports 3-D Glasses only in pure DOS mode.
 This is due to a yet unknown bug.
 Do not bother building the adapter if you can't boot in DOS or you
 are not familiar with it.

 Legend
 ------
 Diode:      --|>|--

 Resistor:  --vvvvv--

                |
 Capacitor:    ---
               ---
                |

 Circuit
 -------

       RS-232
     DB25 / DB9
                                                   10K
RTS   4      7  Switching signal +/- 10V  --------vvvvv--+
                                                         |
                                                         |
GND   7      5  Ground ----+-------------+--+---------+--|----+
                           |             |  |         |  |    |
                           |             |  +-|>|--+  |  |    |
                           +--|>|--+    ---        |  |  |    |  Transistor
                                   |    ---  22 uF |  |  |    |   2N2222
                                   |     |         |  |  |  +-+---------+
                                   |     |         |  |  |  | Emitter   |
                                   |     |         |  |  |  |           |
DTR  20      4  Vdd +10V --|>|-----+-----+         +--|--+--+ Base      |
                                         |            |     |           |
                              +--+--+--+-+-vvvvv---+--|-----+ Collector |
                              |  |  |  |    10K    |  |     |           |
                              |  |  |  |           |  |     +-----------+
                      +-------+--+--+--+-----------+--+--+
                      |       1  9  13 14          5  7  |
                      |                                  |
                      |   RCA CD 4030 Quad XOR gate      |
                      |                                  |
                      | 2 11  12       3  6  8   10   4  |
                      +-+--+---+-------+--+--+----+---+--+
                        |  |   |       |  |  |    |   |
                        +--+   |       +--+--+    |   +--- Outside of jack
                           |   |             |    |
                           |   +-vvvvv-+     |    +------- Middle of jack
                           |      22K  |     |
                           |           |     +------------ Centre of jack
                           +-vvvvv-----+     |
                              22K      |     |
                                      ---    |
                              .01 uF  ---    |
                                       |     |
                                       +-----+

[FRANK]

This is my best attempt at a rendition of the circuit which connects my
SEGA glasses to my AT. I didn't design the circuit -- I'm a software
rather than hardware person. In fact I barely understand it -- as far as
I can tell, the .01uF capacitor & the 22K resistors act as a delay. The
outputs of the XOR gates feed back into their own inputs, thus producing
an oscillator. The "jack" mentioned in the diagram is the mini-jack
which is connected as standard to the glasses. "Centre", "middle", and
"outside" relate to the external connections, looking at the thing
end-on.

Caveat emptor... to paraphrase the standard software licence agreement:
It's as good as I can get it. If it doesn't work or blows up your
computer or your glasses and blinds you for life, I'll give you back all
the money you paid me.

[MIKE GORDON]

As far as I can see, the oscillator circuit is used to provide an AC supply
to power the glasses. The switching signal (+ or - 10 volts) applied to the
base of the transistor produces a high or low output on the collector, which
presumably is used to switch between left and right frames.

When building the adapter:

* Use a CMOS series 4030B (or 4070B, which is functionally equivalent). Do 
  not use a 74HC series chip.

  Chip pin numbering:

      7  6  5  4  3  2  1
     +-------------------+
     |                   |
     |   4070B           < - notch
     |                   |
     +-------------------+
      8  9 10 11 12 13 14


* Use 1N4148 (or equivalent) signal diodes. The positive end is marked by a
  black band around the component.

      Negative  -  --|>|--  +  Positive


* The resistors should ideally be metal film types (blue-coloured body). 
  The value is indicated by coloured bands, as follows, from left to right:

     22K - Red Red Orange           (gap)  Brown or Gold
      OR - Red Red Black Red        (gap)  Brown or Gold

     10K - Brown Black Orange       (gap)  Brown or Gold
      OR - Brown Black Black Red    (gap)  Brown or Gold


* The .01 uF (10 nF) capacitor should be a ceramic disc type, while the 22uF
  capacitor should be an electrolytic type.


* For the 2N2222A transistor (looking at it from below, with the pins towards
  you) :


                     o - Base


     Emitter -   o       o   - Collector

             
  Metal tab - /_/
                   

* The serial port is a 9-pin D-type male connector, so you need a 9-pin
  female D plug for the adapter. Looking into the serial port itself, this
  is the pin configuration:

                 1 2 3 4 5
               -------------
               \ o o o o o /
                \ o o o o /
                 ---------               
                  6 7 8 9


* Finally, the 3-D glasses jack is a 3.5mm stereo phone socket, i.e. the
  Walkman type.

Good luck building the adapter, and enjoy!

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
 4. More ?
-----------------------------------------------------------------------------
 If you feel you have something interesting to contribute to this
 document, you can have it posted by e-mailing me (omar @ cornut.fr).
-----------------------------------------------------------------------------
