Git Product home page Git Product logo

enhanced-dual-joystick's Introduction

Enhanced Dual Joystick for RC2014

Add-on board designed for the RC2014 computer to provide an enhanced dual joystick port for games and other applications.

The board is based on a Z80 PIO that provide two 8-bit bi-direction parallel ports. Software can configure each port independently to use a standard Atari-compatibile joystick, a NES-compatible gamepad or any other controller driven by digital I/O lines.

I/O ports can be configured with the on-board dip-switch.

Schematics

The schematic

Parts List
R1 10.000 ohm 1/4 watt
RN1, RN2 10.000 ohm, 9-pin resistor network
RN3 10.000 ohm, 7-pin resistor network
C1, C2 100.000 pF polyester
IC1 Z84C2010PEG
IC2 CD74HCT688N
S1 DIP-switch
CN1 40 pin male header, right angle
CN2, CN3 DB9 male connector

Additionally, a NES-compatible gamepad board is included for those who don't have access to an existing joystick.

The schematic

Parts List
R1-R8 10.000 ohm 1/4 watt
C1 100.000 pF polyester
IC1 CD4021
UP, DOWN, LEFT, RIGHT 6x6 mm tact switches
SELECT, START, B, A 6x6 mm tact switches
CN1 5-pin connector

Code Examples

The Z80 PIO must be initialized at startup by configuring both ports in control mode 3 followed by the pin direction settings appropriate for the game controller type.

Atari 2600 joystick.

PIO_BASE    .EQU    70H

            ; initialize

            LD      A,0CFH              ; set port A mode 3 (control)
            OUT     (PIO_BASE+1),A
            LD      A,0FFH              ; all pins as input
            OUT     (PIO_BASE+1),A

            LD      A,0CFH              ; set port B mode 3 (control)
            OUT     (PIO_BASE+3),A
            LD      A,0FFH              ; all pins as input
            OUT     (PIO_BASE+3),A

            ; read joystick 1

            IN      A,(PIO_BASE)

            ; read joystick 2

            IN      A,(PIO_BASE+2)

NES gamepad on Joystick 2.

The code assumes that the gamepad is wired to the DB9 connector as follows: 4=data, 5=load, 6=clk.

PIO_BASE    .EQU    70H

NES_LOAD    .EQU    20H
NES_CLK     .EQU    10H

            ; initialize

            LD      A,0CFH              ; set port A mode 3 (control)
            OUT     (PIO_BASE+1),A
            LD      A,0FFH              ; all pins as input
            OUT     (PIO_BASE+1),A

            LD      A,0CFH              ; set port B mode 3 (control)
            OUT     (PIO_BASE+3),A
            LD      A,~(NES_LOAD|NES_CLK)   ; clock and load pins as output, others as input
            OUT     (PIO_BASE+3),A
            LD      A,0
            OUT     (PIO_BASE+2),A

            ; read joystick 1

            IN      A,(PIO_BASE)

            ; read joystick 2

            LD      C,0

            LD      A,NES_LOAD          ; pulse load pin
            OUT     ((PIO_BASE+2),A
            LD      A,0
            OUT     (PIO_BASE+2),A

            LD      B,8
L1:         IN      A,(PIO_BASE+2)      ; read data from bit 0
            RRA
            RL      C

            LD      A,NES_CLOCK         ; pulse clock
            OUT     (PIO_BASE+2),A
            LD      A,0
            OUT     (PIO_BASE+2),A

            DJNZ    L1

            LD      A,C

Boards

Boards are shared on OSHPark:

Dual Joystick
Game Controller

A donation to support this and future projects is always welcome!

enhanced-dual-joystick's People

Contributors

maccasoft avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.