Skip to content

Latest commit

 

History

History
234 lines (210 loc) · 12.7 KB

File metadata and controls

234 lines (210 loc) · 12.7 KB

Serial PAD

It allows you to use a PC keyboard or mouse on a real PSX connected to the command port, as well as to send data to the PSX. Supports:

The features to be highlighted are:
  • PS/2 Mouse (USB) - 100% functional, includes test screen
  • PS/2 keyboard (usb) - function code, missing test display
  • Slow serial communication - function code, missing test display

This way you can enter data by keyboard or mouse on any model of PSX or PsOne by connecting a keyboard to a control port of the PSX, giving it greater autonomy, being able to act as a personal computer, for example.

The mouse and keyboard that will be used are from PC, so this project, will not make use of PSX mice, that is, it is not compatible with the original PSX mouse, and it will only work with our program that translates button clicks.
The results in real machine, are impressive, since it is very fast, both the mouse, as the keyboard. To upload it to a real machine, the most comfortable way is to use a cable skywalker, as I have it, and a usb to serial converter, as well as the modified version send.exe for Windows 64 bits.

Simulation

For those who don't want to modify a real PSX controller, tests can be done by emulation:

Once the Auto Hot Key is installed, we will be able to launch the KeyboardMouse.ahk, which will translate the mouse movements and button presses into keyboard strokes, which the ePSX emulator will interpret as button presses of the controller.

We must set the triggers of the control with the keys:
  • R1 - R
  • R2 - T
  • L1 - W
  • L2 - E
If we launch the KeyboardMouse.ahk script in a command window, we'll see how moving the mouse generates keystrokes:

We must be careful, and make sure we are in the ePSX emulator window, because every time we do something with the mouse, it will be pressing keys.

In the emulator, if we launch the main.exe, we will get the menu with the buttons:
  • Fast - Fast mouse speed
  • Normal - Normal speed
  • Slow - Slow speed
  • X - Reverses X-axis movement
  • Y - Reverse the Y-axis movement
  • Left - Left-handed
At the top, we will see information about the coordinates and mouse buttons, as well as the status of the PSX controller. If we pass over the buttons, they will be illuminated, and if we click it will be activated.
We must take into account that the emulation is not going well, since the keyboard script and the emulator have some delays, which in the end results in some non-flowing movements of the mouse and sporadic failures. However it is very useful to see that at least it works.

Modify control

If we want a fluid response, we must modify the actual command.

The 4 buttons (side triggers) will be used, i.e. R1, R2, L1 and L2. The reason for this is that they are the easiest to modify without using a soldering iron, i.e. anyone can do it. These buttons are attached to the control plate with a wire for each of the buttons, and another for the ground. The way to detect a pressed button is very simple, just by joining it to the ground. Not all controllers use the mass system, so we'll have to consider whether our controller is suitable for this project.

We must look with the multitester at the mass, which corresponds to the real mass of the control. Then we will use a transistor buffer system that will activate the buttons. These transistors will be controlled by an ARDUINO, so that the data of the PS/2 mouse will be read and the buttons of the control will be activated. We must cut the cables (the easiest way) or solder the board, an extension of cables to the outside, and then connect to the transistor buffer.

The resistance for the base of the transistor is 470 Ohms, and the transistor serves us 2n3904, which is the most basic and cheapest on the market. That doesn't stop us from doing the same with optocouplers or even solid relays.

Physical control in Emulator

Once the ARDUINO has been updated with the mouse code, and connected to the PS/2, we can test the ePSX emulator, before trying a real PSX, thanks to a PSX to usb converter.

We have to configure the controller in the PSX emulator, so that we use the buttons on the controller, instead of the letters.

And if everything is correct, when running the main.exe, we can use the mouse.

Physical control in real console

The following materials are required

  • PSX control buttons R1,R2,L1,L2
  • USB to PS/2 adapter or PS/2 mouse
  • PS/2 keyboard
  • PS/2 Mouse
  • Arduino Nano or UNO
Once everything is connected and the main.exe is started, when you move the mouse, you will be able to see it on the screen. We must guarantee that our mouse is compatible with a PS/2 communication. Not all modern mice accept a conversion from USB to PS/2. To be sure, it is as simple as, debugging in ARDUINO following the output trace to the serial console, decomposing the code.



Mouse Protocol

A very simple protocol similar to how mice were used in the early COMMODORE and MSX has been used per game port, but with several speed improvements.
Every 25 milliseconds 4 bits are sent, containing:

  • 2 bits X movement
  • 2 bits Y movement
Or:
  • 2 bits left button
  • 2 bits right button

Movement bits can be:

  • 00 - No movement
  • 01 - Positive movement
  • 11 - Negative movement
For the buttons, if the option 10 is given, the button is active. Remember, that the PSX in each vertical delay, the data are read from the PAD, so they are read between 16 and 20 milliseconds.
The 25 millisecond delay code is set on the Arduino, but we can change it to 50 milliseconds. In the case of the keyboard emulator, it is set to 50 milliseconds, since at lower times, synchronism problems occur.

ARDUINO

Almost any ARDUINO board can be used, but I have tested the NANO, which has 2 interruption pins, useful for the PS/2. The pin layout is as follows:

  • 2 - CLK PS/2 connector
  • 4 - pin data PS/2 connector
  • 5 - transistor base L1
  • 6 - transistor base L2
  • 7 - transistor base R1
  • 8 - transistor base R2
A very basic library has been used to read the mouse PS2Mouse.h, which is in charge of reading the mouse movement, as well as the state of the buttons.
The pins will activate the base of the transistor, which will allow the buttons on the controller to be activated.

Upload PSexe

I am testing to use this command hack as a communications channel, modem style (slow) serial. I am using a SPI communications bus hack, with a hardcore fake slave spi, so there is no need to modify the remote. And the most important thing, it is allowed to upload a ps-exe directly to memory or to the memory card.

Remember, the PSX can have up to 8 PSX controls by means of multitaps:
  • 8 x 14 buttons x 50 = 5600 bits/s
  • 8 x 14 buttons x 60 = 6720 bits/s
  • 8 x 16 buttons (analog mode) x 50= 6400 bits/s
  • 8 x 16 buttons (analog mode) x 60= 7680 bits/s
  • 8 x 48 bits (analog mode) x 50 = 19200 bits/s
  • 8 x 48 bits (analog mode) x 60 = 23040 bits/s

Putting it into practice physically is quite cumbersome, but it is easy to simulate.

Simulation

For quick tests I am using a psx emulator (epsx) and a script (autohotkey) that sends the keystrokes to the emulator. There are 8 buttons on the controller, along with 1 more (L1) for the data pulse (synchronization).
ButtonKeyBit
L1W(sync)
L2EQ7
R1RQ6
R2TQ5
TriangleD
SquareSQ3
CirculoXQ2
XZQ1
StartVQ0


Other development fronts

An attack is made on several fronts, from the simplest to the most complex:
  • Remote and real keyboard control (PS2 PC port) with 9 Gamepad buttons activated by of a very simple protocol of rising edge and transistors, but slow in speed. A program that sends the data in msdos x86 100% compatible DOSBOX for the remote via serial emulator, as well as the possibility of reading directly from the keyboard with the PS2keyboard library.
  • Sending PS-exe to PSOne memory or PSOne memory card with arduino by activating 9 buttons on the Gamepad by means of a very simple protocol of ascending flank, but slow in speed. A program that sends data in msdos x86 100% compatible DOSBOX for the remote via serial emulsion will be made
  • Loading PS-exe from PSX memory (128 KB), with the possibility of splitting the exe in several cards. A 100% DOSBOX compatible msdos x86 program will be made to slice the exe into multiple .MCR 128 KB. These .MCR can be saved in real card from PS2 by means of the sakura of parallel port (vmware with windows 95 and 98 with parallel port support) or the memcarduino.
  • Receiving data by sound from the PSX, the 2 audio channels. A program will be made in psx that generates tones with pulses that can be decoded as binary data. The psx will receive remote commands and send the data as sound.
  • Command and memory simulation by means of arduino. I have captured the commands of the psx command, as well as those of the memory, using a 250 Khz SPI protocol. I am making a program in arduino that when it receives the commands, it sends the answers to a program in the psone that it interprets to load data.


Use of MSDOS

The reason for using MSDOS, is to achieve maximum compatibility with DOSBOX, so that you can use the entire 16bits psyq development kit, as it can be used in almost any current machine that is not a PC. You can also use the msdosplayer for Windows 7 64 bits and above.

History

  • 2020/05/25 - 100% PS/2 mouse
  • In tests - PAD simulation with keyboard and ePSX emulator
  • Commented code for keyboard use, and file sending (receives 100 bytes).


Conclusion

This option is used because while the psx has a serial port, the white psone does not. You must therefore make modifications. In addition, an alternative to SIOCONS is achieved.