------------------------------------------------------------------------ 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