Autofire Module

From IndividualComputers
(Redirected from Autofiremodule)
Jump to: navigation, search
(thumbnail)
Autofire Module
(thumbnail)
Autofire Module (Prototype)

Contents

Overview

The Autofire-Module adds speed-adjustable autofire capability to a standard DE-9 Joystick. Additionally four arbitrary user defined joystick movement sequences can be programmed into the device on platforms that have bidirectional I/O on the joystick port.

Compatibility

The Autofire-Module works with all computers that use a DB9 connector for "Atari compatible" joysticks, and which provides +5V at pin 7.

Due to the formfactor of the DB9 connector at the module, it will not fit directly into the joystick ports of some computers, for these you will have to use an extension cable of some sort. Known computers where this is the case are: Atari 65XE, Atari 130XL, Atari 1200XL, Atari XEGS, Atari 260ST

Usage

  • switch off your C64 and connect the autofire module. The first time that is being done a default config will be written to the EEPROM.
  • press and release button to enable/disable autofire playback. By holding the fire button when enabling autofire, one of the following modes is selected:
  1. (no fire) autofire when fire button is pressed
  2. (hold fire) always autofire, hold fire when firebutton is pressed
By pushing the joystick into any direction when releasing the button, one of the 5 available autofire sequences is selected:
  1. (centered) default "auto fire" sequence
  2. (press up) custom sequence 1 (see below)
  3. (press down) custom sequence 2 (see below)
  4. (press left) custom sequence 3 (see below)
  5. (press right) custom sequence 4 (see below)

config mode

  • To enter the config mode press and hold button until LED goes on, then release button (LED goes off). While in config mode, autofire sequence will be active regardless of whether FIRE is pressed or not, so you can observe the speed/pulse settings.
  • press down to increase speed
  • press up to decrease speed
  • press left to increase pulse duty factor
  • press right to decrease pulse duty factor
  • To exit the config mode press button. This will also write the config into the EEPROM.

Factory Reset

Press and hold button until LED starts blinking rapidly (a few seconds), blinking starts when factory reset was done until button is released. This will write the default config into the EEPROM.

C64 config tool

Cfgtool message.png
Cfgtool.png

The config tool can be used to edit custom sequences and save them to the device.

  • Download the Config Tool (contains .prg, .d64 and .crt versions)
  • Run the tool on your C64 with the autofire module in port 1

The main editor area looks like this:

 Up     ................................
 Down   ................................
 Left   ................................
 Right  ................................
 Fire   ................................
        ^^
        \\bits set in "off" period
         \bits set in "on" period

Every row represents an input line of the joystick port. Every odd column shows the "on" period, and every even column the "off" period off that like. A '*' means the respective line is active in this cycle, a '.' means it is inactive. Each column is one step in the programmed autofire sequence. Below the 5 rows there is one more row which indicates the length of the sequence - the sequence ends at the first column containing a '*'.

For example, a sequence that pushes the joystick into all 8 directions, starting with UP, and then presses and releases fire two times, would look like this:


 Up     **.....*........................
 Down   ...***..........................
 Left   .***............................
 Right  .....***........................
 Fire   ........*.*.....................
        
        ...........*********************

In the editor use the cursor keys to move around in the bitfield, and RETURN to set/clear individual bits/states. Additional keys are:

  • F1/F7 - select sequence
  • F2/F8 - select sequence length
  • F3 - read eeprom data from module
  • F5 - write eeprom data to module

Developer Information

Communication Protocol

DATA0BIT  = UP
CLK0BIT   = DOWN
DATA1BIT  = LEFT
CLK1BIT   = RIGHT

initiate transfer

to put the microcontroller in the module into programming mode, issue the following "magic sequence", this is needed to make sure the module is not accidently switched into programming mode:

C64                                     Micro
-------------------------------------   ----------------------------------
                                        - waits until UP and DOWN go low
- set UP and DOWN to low
- waits for FIRE to go low
                                        - sets FIRE low
- set UP and DOWN to high
                                        - waits for 256 UP pulses, any other input aborts init sequence
- toggles UP 256 times
                                        - ACKs by pulling left+right low
- waits for left+right to go low
                                        - waits for DAT0 lo
- sets DAT0 lo
                                        - waits for CLK0 lo
- sets CLK0 lo
                                        - waits for CLK0 hi
- sets CLK0 hi
                                        - waits for DAT0 hi
- sets DAT0 hi
                                        - goes to programming mode
- waits for left+right to go hi
                                        - releases left+right (=hi)

read/write the buffer

  • first put the module into programming mode as described above
  • send one byte to select the transfer mode
    • $00 read
    • $01 write
  • now transfer $40 bytes (4 * 16)

bit-banging scheme

a clock transition 1->0 means the bit on the related data line is ready

C64 sends Micro sends    C64                      Micro
CLK0 DAT0 CLK1 DAT1
          1              waits until CLK1=1       sets CLK1=1
     W                   puts data on DAT0
0                        sets CLK0=0              waits until CLK0=0
     R                                            reads DAT0
               W                                  Puts data on DAT1
          0              waits until CLK1=0       sets CLK1=0
               R         reads DAT1
1                        sets CLK0=1              waits until CLK0=1

data block format

Each of the 4 sequences consists of 16 bytes in the following format:

bit function
0 joystick down
1 joystick left
2 joystick right
3 unused, set to 0
4 joystick up
5 joystick button (fire)
6 unused, set to 0
7 0 if the current step belongs to the sequence, 1 for unused steps (sequence ends at first byte with bit 7 set)

Repository

The sourcecode of the C64 config tool can be found in the public SVN repository.



Shop


Resellers

Please shop locally. Our partners are listed in alphabetical order.

Personal tools
Namespaces

Variants
Actions
Navigation
Icomp
Print/export
Administration