------------------------------------------------------------------------ Apple II NES/SNES Joypad Interface Page ------------------------------------------------------------------------ 12/20/98 Interface Description: The interface is just a bunch of wires and connectors. There are no chips and no circuit boards! Also, if you follow my design the interface will work on an IBM PC with the popular SNESKEY. Warning: It has been brought to my attention that the pre Apple IIgs machines use the keyboard to simulate joystick buttons. This combination has the potential to interrupt the NES pad communication at the least and burn it up at the worst. This interface was designed for the Apple IIgs, so using it on earlier machines at your own risk. Apple II Joystick Interface Block Diagram: Block Diagram Internal Apple II Joystick Interface Pinout: Pinout NES Connector Pinout: Pinout What wires go where: Apple II Joystick Connector to 25 Pin D-Sub Connector Female: Joystick Connector 25 Pin D-Sub Female AN0 Pin 15 Pin 2 AN1 Pin 14 Pin 3 PB0 Pin 2 Pin 10 PB1 Pin 3 Pin 12 +5V Pin 1 Pins 7,8,9 GND Pin 8 Pin 19 25 Pin D-Sub Connector Male to NES Joypad: 25 Pin D-Sub Connector Male NES Joypads Pin 2 Pin 2 CLK Pin 3 Pin 3 LATCH Pin 10 Pin 4 Pad 0 Pin 12 Pin 4 Pad 1 Pin 7 Pin 5 +5V Pin 19 Pin 1 GND Note: You could go directly from the Joystick Connector to the NES Joypads. However, you would lose PC compatibility and would have to open your computer everytime you wanted to disconnect the Joypads. Programming: The NES joypad is based upon a single 4021 CMOS chip. It is simply a parallel to serial chip. In order to get data from it you have to LATCH the data from the buttons into the chip. Then CLK (clock) in the bits. Bit 0 is button A Bit 1 is button B Bit 2 is button SELECT Bit 3 is button START Bit 4 is arrow UP Bit 5 is arrow DOWN Bit 6 is arrow LEFT Bit 7 is arrow RIGHT Here is some sample code is Applesoft BASIC: 20 Z=PEEK(49240) 40 Z=PEEK(49242) 60 PRINT A$ 80 LET A$ = "" 100 Z=PEEK(49243) 120 Z=PEEK(49242) 140 B0=PEEK(49249) 160 IF B0>127 THEN LET A$=A$ + "1" 180 IF B0<=127 THEN LET A$=A$ + "0" 200 Z=PEEK(49241) 220 Z=PEEK(49240) 240 LET L0=LEN(A$) 260 IF L0>=8 THEN GOTO 60 280 GOTO 140 This code will output all 1's if no buttons have been pressed. If a button has been pressed then the corresponding 1 changes to a 0. Study the code. Convert it to assembly if you want. Have Fun. : ) Note: This code only reads joypad 0. You will have to add code to read joypad 1. ------------------------------------------------------------------------ For Questions or Comments: frankc@cyberhighway.net