This project is to allows the connection of 2 Megadrive (Sega Genesis) controllers to the MSX joystick port. The Circuit shall support either 3 or 6 button controllers mapped as follows:
Megadrive -> MSX UP -> ditto DOWN -> ditto LEFT -> ditto RIGHT -> ditto Button A -> Trigger A Button B -> Trigger B Button C -> Trigger A + Trigger B Button X -> Autofire Trigger A Button Y -> Autofire Trigger B Button Z -> Autofire Trigger A + Trigger B Start -> LEFT+RIGHT Mode -> UP + DOWN
The circuit is based on an ATMegaxx8 with internal clock. The board was routed to fit within 1x1 inch and optimized for DIY construction (no vias under the microcontroller, 16/12 mils traces and olly 11 vias with 56 diameter and 27 mils (0.7mm) holes.
The MSX shall be connected to the board using a 9 way cable with DE-9 female connector on one side. The using of 9 way MOLEX 0.1" connector is optional as the wires can be soldered to the board. The board provides 2 DE-9 male connectors for attaching the Megadrive/Genesis controllers.
The selection of either controller to be read is according with the state of pin 8 from MSX joystick port. Low level for controller 1 and High level for controller 2, hence it is necessary to use assembly code to read the second controller.
The software architecture is based on a main task and one interrupt task.
The main task sample both controllers at a rate around 60Hz and updates the internal variables as well as the currently selected controller.
The interrupt code is attached to PIN CHANGE event and updates the state of the output according to the last sample. At the end it updates the state of the currently selected controller.
Autofire is provided as a modulation function at 1/6 of the sampling frequency.