Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minitel2: fix modem and periinfo default configurations #13160

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fabio-d
Copy link

@fabio-d fabio-d commented Jan 1, 2025

I've tested the command line given at the top of the minitel_2_rpic.cpp file (-modem null_modem -bitb socket.127.0.0.1:20000) and it didn't work (transferred data was corrupted), because the correct serial parameters are set for terminal. This commit makes them apply to null_modem instead, so that the documented command line actually works.

While at it, I've also changed the parameters for the second serial port (periinfo) to match the Minitel's defaults and verified that it actually works, despite the comment at the top of the file stating the opposite.

These are all the test command lines I've successfully validated, to test that the two Minitel serial ports (modem and periinfo) work, both in isolation and together. I've used minipavi.fr as the test service to connect to.

Test n.1: Connecting to a Minitel service through the modem port

Run in two different terminals:

  • socat tcp-listen:20000,fork system:'"set -x; IFS= read -d S; echo -n \"Connecting...\"; exec nc go.minipavi.fr 516"'
  • ./mame -window minitel2 -modem null_modem -bitb socket.127.0.0.1:20000

Then power on the Minitel (F10) and start the connection (F8).
Notes:

  • IFS= read -d S: waits for the Connexion ou déconnexion modem message ("\x13S"), emitted when the emulated Minitel modem pretends to start detecting the carrier frequency.

Test n.2: Connecting to a Minitel service through the serial port

Run in two different terminals:

  • socat tcp-listen:20000,fork system:'"set -x; IFS= read -d r; IFS= read -d r; sleep 3; echo -en \"\\e\\x39\\x68\"; sleep 3; echo -en \"\\e\\x39\\x67\\e\\x3b\\x60\\x58\\x52Connecting...\"; exec nc go.minipavi.fr 516"'
  • ./mame -window minitel2 -periinfo null_modem -bitb socket.127.0.0.1:20000

Then just power on the Minitel (F10), the socat command above will do the rest to put the Minitel in the right mode and start the connection.
Notes:

  • IFS= read -d r (twice) : wait for the second Passage en veille ou sortie de veille message ("\x13r", emitted by the Minitel when powered on)
  • \e\x39\x68 (called PRO1 CONNEXION in the manual): tells the Minitel to connect the modem port.
  • \e\x39\x67 (called PRO1 DECONNEXION in the manual): tells the Minitel to disconnect the modem port.
  • We don't actually use the modem port at all, we just send PRO1 CONNEXION followed by PRO1 DECONNEXION to make it leave the initial address book screen and enter the mode that displays incoming data.
  • \e\x3b\x60\x58\x52 -> PRO3 OFF to disable local echo

Test n.3: Both ports at the same time

Run in three different terminals:

  • socat tcp-listen:20000,fork stdio
  • socat tcp-listen:20001,fork stdio
  • ./mame -window minitel2 -modem null_modem -bitb1 socket.127.0.0.1:20000 -periinfo null_modem -bitb2 socket.127.0.0.1:20001

Then power on the Minitel (F10), start the connection (F8) and notice how everything typed into one port is echoed on the other one, like on a real Minitel.

This commit matches the parameters used by the default ROM.
Comment on lines 539 to 547
RS232_PORT(config, m_modem, default_rs232_devices, nullptr);
m_modem->rxd_handler().set_inputline(m_maincpu, MCS51_INT1_LINE).invert();
m_modem->set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(m_modem));
m_modem->set_option_device_input_defaults("null_modem", DEVICE_INPUT_DEFAULTS_NAME(m_modem));

RS232_PORT(config, m_serport, default_rs232_devices, nullptr);
m_serport->rxd_handler().set(FUNC(minitel_state::serial_rxd));
m_serport->set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(m_serport));
m_serport->set_option_device_input_defaults("null_modem", DEVICE_INPUT_DEFAULTS_NAME(m_serport));

lineconnected = 0;
Copy link
Member

@angelosa angelosa Jan 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a bit of confusion here:

  1. why you changed m_serport DEVICE_INPUT_DEFAULTS_NAME if the plan is to change defaults for m_modem instead?
  2. Can have multiple set_option_device_input_defaults attached to the same port cfr.
    // serial debug port
    RS232_PORT(config, m_debug_serial, default_rs232_devices, nullptr);
    m_debug_serial->set_option_device_input_defaults("null_modem", DEVICE_INPUT_DEFAULTS_NAME(debug_serial));
    m_debug_serial->set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(debug_serial));
    m_debug_serial->set_option_device_input_defaults("pty", DEVICE_INPUT_DEFAULTS_NAME(debug_serial));
    and assuming is standard to have two modems attached for this system.
  3. m_modem / m_serport input naming on its own is ambiguous, i.e. the INPUT_PORTS definition shouldn't be the same name as the device it uses.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The device has two serial ports, one is actually a modem connected to the phone line and the other one ("peri-informatique" port) is a serial port for connecting local devices such as printers and card readers. Conceptually, the Minitel itself is very simple, it just forwards data from one port to the other, while also displaying it [in reality it's a bit more complicated, because the firmware can interpret some control sequences].

The modem port is asymmetric, 1200 baud 7E1 downstream and 75 baud 7E1 upstream. The peripheral port is 1200 baud 7E1 symmetric (by default, it can go up to 9600 baud if configured to do so).

That said...

  1. why you changed m_serport DEVICE_INPUT_DEFAULTS_NAME if the plan is to change defaults for m_modem instead?

This PR is actually two fixes in one: 1) make null_modem work for the modem port 2) make the peripheral port work too. The m_serport changes are for the latter.

  1. Can have multiple set_option_device_input_defaults attached to the same port

Thanks, I've re-added the old terminal configuration, so we can keep both. While attaching a terminal is not the typical usage of this device (which is itself a terminal), I guess it can still be useful for quick tests.

  1. m_modem / m_serport input naming on its own is ambiguous, i.e. the INPUT_PORTS definition shouldn't be the same name as the device it uses.

Keeping in mind that the two ports have different baud rates, I'm open to suggestions for renaming them. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants