Arkanoid controller: Difference between revisions

From NESdev Wiki
Jump to navigationJump to search
(A major update with corrections and new information about conversions, variants, ranges, scale pots, software tips, and hardware. (Thanks to lidnariq for working out the conversion behavior.))
(Improves potentiometer terminology (centering and scaling).)
Line 2: Line 2:


==Layout==
==Layout==
The controller has a single fire button and a control knob connected to a potentiometer. On the ''Arkanoid II'' and some ''Arkanoid'' versions, there is a second potentiometer under a small plastic cover that adjusts the control knob output's range. The ''Arkanoid II'' version has a third potentiometer also under this cover to control the output's scale and a Famicom expansion port next to the cord.
The controller has a single fire button and a control knob connected to a potentiometer. On the ''Arkanoid II'' and some ''Arkanoid'' versions, there is a second potentiometer under a small plastic cover that adjusts the centering of the control knob output's range. The ''Arkanoid II'' version has a third potentiometer also under this cover that adjusts the scaling of the output's range and has a Famicom expansion port next to the cord.


<pre>
<pre>
Line 64: Line 64:
Control knob data is returned in 9 bits, most-significant-bit first. The data is also inverted. Only the first 8 bits are read by contemporary software. Because the data is latched when the conversion completes, the results of the previous conversion can be read in the period after strobing and before the new conversion completes, but they may also be read before the strobe. The 9th bit is not latched when a conversion completes, so at least one read must be performed before the strobe to latch it in the shift register. For reliability, reading the control knob data before strobing is recommended, though this may add a frame of input lag in some emulators.
Control knob data is returned in 9 bits, most-significant-bit first. The data is also inverted. Only the first 8 bits are read by contemporary software. Because the data is latched when the conversion completes, the results of the previous conversion can be read in the period after strobing and before the new conversion completes, but they may also be read before the strobe. The 9th bit is not latched when a conversion completes, so at least one read must be performed before the strobe to latch it in the shift register. For reliability, reading the control knob data before strobing is recommended, though this may add a frame of input lag in some emulators.


The whole range is about 180 degrees and returned in approximately $A0 steps, though the Arkanoid II controller's scale pot can change the number of steps. The knob boundaries are set by plastic, so wear or additional force may result in values beyond the norm, and fast clockwise turns have been observed returning values briefly exceeding the maximum. Experimentally, the range pot at minimum on an Arkanoid I controller allows a range of $0D-$AD and at maximum a range of $5C-FC. Variations in the analog-to-digital and pot physical range can vary the result slightly.
The whole range is about 180 degrees and returned in approximately $A0 steps, though the Arkanoid II controller's scaling pot can change the number of steps. The knob boundaries are set by plastic, so wear or additional force may result in values beyond the norm, and fast clockwise turns have been observed returning values briefly exceeding the maximum. Experimentally, the centering pot at minimum on an Arkanoid I controller allows a range of $0D-$AD and at maximum a range of $5C-FC. Variations in the analog-to-digital and pot physical range can vary the result slightly.


The expected range depends on the game. ''Arkanoid'' expects the value range (after the inversion is undone) to be $62 to $02. ''Arkanoid II'' expects $4D-$E2 for normal gameplay and $4D-$F2 with a tiny paddle; $4D should be the minimum to allow left-side warps, so with $A0 steps, the tiny paddle will be unable to warp off the right edge. To avoid requiring adjustment of the range pot, which is not even present on all versions, new games can attempt to find the edges programmatically. One possible approach is to accept $A0 steps from the leftmost position seen because the left edge is more reliable, and another is to track the minimum and maximum positions seen and use the middle $A0 steps.
The expected range depends on the game. ''Arkanoid'' expects the value range (after the inversion is undone) to be $62 to $02. ''Arkanoid II'' expects $4D-$E2 for normal gameplay and $4D-$F2 with a tiny paddle; $4D should be the minimum to allow left-side warps, so with $A0 steps, the tiny paddle will be unable to warp off the right edge. To avoid requiring adjustment of the centering pot, which is not even present on all versions, new games can attempt to find the edges programmatically. One possible approach is to accept $A0 steps from the leftmost position seen because the left edge is more reliable, and another is to track the minimum and maximum positions seen and use the middle $A0 steps.


Each read will load the current value of the lowest counter bit into the shift register, so repeatedly reading during a conversion and measuring the rate at which this bit toggles can be used to identify the current scale. The first 8 reads should be ignored because these bits were latched before the conversion started.
Each read will load the current value of the lowest counter bit into the shift register, so repeatedly reading during a conversion and measuring the rate at which this bit toggles can be used to identify the size of the range. The first 8 reads should be ignored because these bits were latched before the conversion started.


Because conversions take substantial time, a function that reads the controller multiple times in a row to avoid DPCM glitches will not work. One alternative is to check for spurious accelerations, where the [[wikipedia:finite difference|second difference]] ''x''<sub>''t''</sub> - 2''x''<sub>''t'' - 1</sub> + ''x''<sub>''t'' - 2</sub> exceeds about eight units. Another is to use [[Controller_reading#Synchronized_OAM_Solution|synchronized controller reads]] with timed code.
Because conversions take substantial time, a function that reads the controller multiple times in a row to avoid DPCM glitches will not work. One alternative is to check for spurious accelerations, where the [[wikipedia:finite difference|second difference]] ''x''<sub>''t''</sub> - 2''x''<sub>''t'' - 1</sub> + ''x''<sub>''t'' - 2</sub> exceeds about eight units. Another is to use [[Controller_reading#Synchronized_OAM_Solution|synchronized controller reads]] with timed code.
Line 102: Line 102:


== Hardware ==
== Hardware ==
The controller uses a 556 timer (containing 2 timers), a 4040B 12-bit binary counter, and an 8-bit shift register. One timer repeatedly clocks the binary counter and the other measures the control knob position. A range pot adjusts the control knob timer and a scale pot adjusts the counter timer. When OUT0 goes high, the counter clears and the control knob timer starts and releases the counter timer from reset, allowing it to begin incrementing the counter. When the control knob timer expires, it puts the counter timer back into reset and latches bits 9-2 of the counter into the shift register. Bit 1 of the counter connects to the shift register's serial input.
The controller uses a 556 timer (containing 2 timers), a 4040B 12-bit binary counter, and an 8-bit shift register. One timer repeatedly clocks the binary counter and the other measures the control knob position. A centering pot adjusts the control knob timer and a scanling pot adjusts the counter timer. When OUT0 goes high, the counter clears and the control knob timer starts and releases the counter timer from reset, allowing it to begin incrementing the counter. When the control knob timer expires, it puts the counter timer back into reset and latches bits 9-2 of the counter into the shift register. Bit 1 of the counter connects to the shift register's serial input.


== Test ROMs ==
== Test ROMs ==
*[http://forums.nesdev.org/viewtopic.php?f=22&t=10662 Vaus Test] shows adaptation to trimpot setting, repeated read rate, and first and second differences
*[http://forums.nesdev.org/viewtopic.php?f=22&t=10662 Vaus Test] shows adaptation to trimpot setting, repeated read rate, and first and second differences
[[Category:Controllers]]
[[Category:Controllers]]

Revision as of 05:22, 4 April 2022

The Arkanoid controller (commonly called the Vaus controller) was included with Arkanoid and Arkanoid II, and is only used for these and Tatio Chase HQ. Multiple versions of this controller were produced. The Famicom and NES versions use different joypad bits and must be handled by software separately. The Arkanoid II controller has a Famicom expansion port intended for multiplayer using another Famicom Arkanoid controller of either type. No version is compatible with four player adapters.

Layout

The controller has a single fire button and a control knob connected to a potentiometer. On the Arkanoid II and some Arkanoid versions, there is a second potentiometer under a small plastic cover that adjusts the centering of the control knob output's range. The Arkanoid II version has a third potentiometer also under this cover that adjusts the scaling of the output's range and has a Famicom expansion port next to the cord.

Arkanoid I controller:
            ,--------------------------------------.   |
            |                  %%                  |   |
            |   ,---.          %%                % |   |
            |  /     \         %%         ,-.   %% |   |
 Control  ->| |       |        %%        (   )  %% |<- Fire button
   knob     |  \     /         %%         `-'   %% |   |    
            |   `---'          %%                % |==/
Adjustment->|     ()           %%                  |
   screw    `--------------------------------------'

Interface

Input ($4016 write)

7  bit  0
---- ----
xxxx xxxC
        |
        +- Start ADC

When C goes from 0 to 1, a conversion is started. The results of this conversion are collected in a counter that is reset while C is 1, so C should be quickly returned to 0. Once the conversion is complete, the shift register is automatically loaded with the results of the counter. Additional strobes during a conversion do not restart the conversion. Keeping C at 1 or strobing again before the conversion is complete will negatively shift the result's range (shift it left) based on when during the conversion C was last set to 0.

The analog to digital conversion time depends on the control knob's position; smaller results will convert faster. Experimentally, the conversion takes up to 7 ms, so at least this amount of time should pass between strobes. Strobing again too soon will return bad data.

Arkanoid II and Taito Chase H.Q. perform a strobe of OUT1, but the controller cannot see this because the pin is not connected, so it has no effect. The reason for this strobe is not known.

Output ($4016/$4017 read)

Famicom:

$4016:
7  bit  0
---- ----
xxxx xxBx
       |
       +-- Fire button (1: pressed)

$4017:
7  bit  0
---- ----
xxxx xxDx
       |
       +-- Serial control knob data

NES:

7  bit  0
---- ----
xxxD Bxxx
   | |
   | +---- Fire button (1: pressed)
   +------ Serial control knob data

Fire button status is returned directly from the button and is not affected by the strobe. On the NES, repeated reads of this button can be used as a hint that an Arkanoid controller is being used instead of a Power Pad or Zapper.

Control knob data is returned in 9 bits, most-significant-bit first. The data is also inverted. Only the first 8 bits are read by contemporary software. Because the data is latched when the conversion completes, the results of the previous conversion can be read in the period after strobing and before the new conversion completes, but they may also be read before the strobe. The 9th bit is not latched when a conversion completes, so at least one read must be performed before the strobe to latch it in the shift register. For reliability, reading the control knob data before strobing is recommended, though this may add a frame of input lag in some emulators.

The whole range is about 180 degrees and returned in approximately $A0 steps, though the Arkanoid II controller's scaling pot can change the number of steps. The knob boundaries are set by plastic, so wear or additional force may result in values beyond the norm, and fast clockwise turns have been observed returning values briefly exceeding the maximum. Experimentally, the centering pot at minimum on an Arkanoid I controller allows a range of $0D-$AD and at maximum a range of $5C-FC. Variations in the analog-to-digital and pot physical range can vary the result slightly.

The expected range depends on the game. Arkanoid expects the value range (after the inversion is undone) to be $62 to $02. Arkanoid II expects $4D-$E2 for normal gameplay and $4D-$F2 with a tiny paddle; $4D should be the minimum to allow left-side warps, so with $A0 steps, the tiny paddle will be unable to warp off the right edge. To avoid requiring adjustment of the centering pot, which is not even present on all versions, new games can attempt to find the edges programmatically. One possible approach is to accept $A0 steps from the leftmost position seen because the left edge is more reliable, and another is to track the minimum and maximum positions seen and use the middle $A0 steps.

Each read will load the current value of the lowest counter bit into the shift register, so repeatedly reading during a conversion and measuring the rate at which this bit toggles can be used to identify the size of the range. The first 8 reads should be ignored because these bits were latched before the conversion started.

Because conversions take substantial time, a function that reads the controller multiple times in a row to avoid DPCM glitches will not work. One alternative is to check for spurious accelerations, where the second difference xt - 2xt - 1 + xt - 2 exceeds about eight units. Another is to use synchronized controller reads with timed code.

Arkanoid II expansion port

Arkanoid II's controller has its own Famicom expansion port. The connected device is able to see OUT0 and Joypad 2 /OE, and its Joypad 1 and 2 D1 outputs are redirected to Joypad 2 D3 and D4. No other signals are passed through. Because of this, any additional devices daisy-chained beyond two Arkanoid II controllers will be unable to send input to the console, but will still receive OUT0 and Joypad 2 /OE.

 Arkanoid II EXP |  | Famicom EXP
-----------------+--+-----------------
         GND   1 |--| 1   GND
 Joypad 2 D1   7 |->| 4   Joypad 2 D4
Joypad 2 /OE   9 |<-| 9   Joypad 2 /OE
        OUT0  12 |<-| 12  OUT0
 Joypad 1 D1  13 |->| 5   Joypad 2 D3
          5V  15 |--| 15  5V

(All other Arkanoid II EXP pins not connected)

This port is intended to be used with another Arkanoid controller, but is not limited to this. When used with an Arkanoid controller, $4017 works as follows:

$4017 read:
7  bit  0
---- ----
xxxD BxDx
   | | |
   | | +-- Controller 1 serial control knob data
   | +---- Controller 2 fire button
   +------ Controller 2 serial control knob data

It has been observed that adjustments on one controller's control knob can cause slight changes in the result from the other controller's knob.

Although Arkanoid II uses a Family BASIC Keyboard with Family BASIC Data Recorder for saving and loading custom levels, the device cannot work correctly over the Arkanoid II controller's expansion port because OUT2, a required input, is not connected. Thus, the keyboard must be plugged directly into the console to save and load.

Hardware

The controller uses a 556 timer (containing 2 timers), a 4040B 12-bit binary counter, and an 8-bit shift register. One timer repeatedly clocks the binary counter and the other measures the control knob position. A centering pot adjusts the control knob timer and a scanling pot adjusts the counter timer. When OUT0 goes high, the counter clears and the control knob timer starts and releases the counter timer from reset, allowing it to begin incrementing the counter. When the control knob timer expires, it puts the counter timer back into reset and latches bits 9-2 of the counter into the shift register. Bit 1 of the counter connects to the shift register's serial input.

Test ROMs

  • Vaus Test shows adaptation to trimpot setting, repeated read rate, and first and second differences