PC-Engine Pachinko controller
Hi all, I just thought I would share with you some developers' information I have found about the pachinko controller for the PC-Engine. This controller is made by Coconuts Japan, and was sold for use in the "Pachiokun" series of games by Coconuts. It was sold both as part of a package (controller + "Pachiokun Maboroshi no Densetsu"), and separately. It does not appear to be supported by the Games Express pachinko game. But it is quite a simple device, and it should be simple to implement on emulators, and use in newly-developed programs as well. The pachinko controller contains all the normal buttons for a 2-button controller, and additionally a single-axis analog input from a rotating control. Basically, this is a "volume control" which is spring-loaded to return to the counterclockwise limit of movement. The controller is NOT normally automatically recognized by the game, and the game instructions specifically state NOT to use the controller together with a multitap. This is all because the controller uses the scanning for the "second joypad" to transmit additional data to the PC-Engine. The normal 2-button joypad information is still transmitted in the position for joypad #1. The information from the analog control is transmitted instead of the second joystick. This information is in the range from $80 - $FF, but the device isn't absolutely accurate, so there are a few values at both limits which are unavailable. My unit has a range of $FB (default, counter-clockwise limit) to $8E (maximum clockwise rotation). It is important to note that the joypad-reading routine inverts the bits actually read from the port (the buttons pull a logic value 'low' when the circuit is closed, and the they float 'high' when open). This means that the actual values provided by the device are in the range $00 - $7F, and my specific unit will produce values between $04 (default, counterclockwise limit), and $71 (maximum clockwise rotation). From a game developer's point of view, there is no new code necessary, since the original joystick routines will carry all of the information. HuC and MagicKit already "support" this device. You simply need to ask the user whether they are using such a controller, and later read the value of joypad #2 (and interpret it differently). From an emulator author's point of view, you can easily emulate this device if you have an analog input device, and you calibrate it within the above-mentioned limits. The 2-button joystick and the analogue input value are alternated, with the 2=button hoystick information always being presented at the joypad/multitap 'reset' signal. So, the 5 joystick positions would then contain: joy1 analog joy1 analog joy1 Pachinko games don't normally use the arrow directional controls and the variable control at the same time, but we could certainly create new games which use the variable control as a throttle, or some such thing. So while it may be a good idea right now, it may not be the best idea to have a dual-use for one of the axes on an analogue joystick... From a hardware hacker's point of view, the device uses a bit of nifty circuitry, including a LM393 dual comparator, 74HC574 octal d-type flip-flop with tri-state outputs, a 4024 7-stage ripple counter, a 4013 dual d-type flip-flop, and the normal 74LS157. From what I can tell, one of the comparators is set up to be a clock oscillator, and is used as input to the ripple counter to begin counting up in binary. The oscillator must run at a pretty fast rate, since the device generates stable values in the time that it takes to read 2 joysticks (a few hundred CPU cycles). Each of the ripple-counter's (binary) outputs is attached via varying sizes of resistors to a common anchor point, effectively creating a cheap D-to-A converter (smaller resistor values for more significant binary bits). This anchor point is one of the inputs to the second comparator, to be measured against the variable input from the analog control (the potentiometer has its limits at ground and nearly +5V, and can vary continuously between these limits). The ripple-counter outputs (binary count) are also presented to the octal flip-flop with tri-state outputs (which is used as a bus-driving latch), and are latched by the flip-flop at the moment the comparator triggers (ie. the counted value = the measured input). Since I'm missing some background in analog circuitry, I'm not sure if the comparator is comparing voltage or current in this situation, but this little "upcounter/D-to-A/compare" setup works pretty well as a very cheap and fast A-to-D converter from that era. In an interesting twist, all of the digital inputs are presented to the inputs of the 74LS157 at once (both joypad keys, and d-flipflop outputs), but at any given time, one set or the other is tri-stated. The buttons can be tri-stated since their inputs are "whether a circuit is completed with reference to another line"; this other line is not necessarily supplied a logical high or low. The octal d-flipflop is also tri-stated at alternating scans. (The dual d-type flipflop handles the multiplexing of the two 8-bit values.) Interesting stuff, although these days all of that would likely be done with a single PIC microprocessor. - Dave