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

Add console support for KIM-1. #12161

Merged
merged 6 commits into from
Apr 15, 2024
Merged

Conversation

jefftranter
Copy link
Contributor

@jefftranter jefftranter commented Mar 21, 2024

Adds console support including emulation of hardware character echo.
Serial monitor commands work and I am able to load and run programs like Microsoft Basic.

Is working with a pty but not for on screen console.
Hardware loopback is not working quite right yet.
@jefftranter jefftranter marked this pull request as ready for review March 23, 2024 00:01
Comment on lines 305 to 311
// Called when serial data comes in from console.
void kim1_state::tty_callback(uint8_t data)
{
// Send data back to terminal to simulate the KIM-1 hardware
// echo.
m_rs232->write_txd(data);
}
Copy link
Member

Choose a reason for hiding this comment

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

You’re going to need to AND this with bit 0 of the port B output to avoid issues when they’re both changing at the same time. Also, as this is a write line handler, the parameter type should conventionally be int.

Comment on lines 263 to 264
// Write bit 0 to serial console
m_rs232->write_txd(data & 0x01);
Copy link
Member

Choose a reason for hiding this comment

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

You need to keep the state of line in tty_callback and AND it with bit 0 here to avoid issues when they’re both changing at once.

Comment on lines 130 to 135
required_device_array<mos6530_device, 2> m_miot;
required_device<pwm_display_device> m_digit_pwm;
required_device<cassette_image_device> m_cass;
required_ioport_array<3> m_row;
required_ioport_array<4> m_row;
required_ioport m_special;
required_device<rs232_port_device> m_rs232;
Copy link
Member

Choose a reason for hiding this comment

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

Please keep the devices together rather than mixing them with the I/O ports.


int m_sync_state = 0;
bool m_k7 = false;
uint8_t m_u2_port_a = 0;
Copy link
Member

Choose a reason for hiding this comment

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

Why did you add this data member? It doesn’t appear to be used for anything.

Comment on lines 97 to 101

#include "kim1.lh"


namespace {

Copy link
Member

Choose a reason for hiding this comment

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

Please restore the two blank lines between sections.

Comment on lines 174 to 184
}

static DEVICE_INPUT_DEFAULTS_START(terminal)
DEVICE_INPUT_DEFAULTS("RS232_RXBAUD", 0xff, RS232_BAUD_2400)
DEVICE_INPUT_DEFAULTS("RS232_TXBAUD", 0xff, RS232_BAUD_2400)
DEVICE_INPUT_DEFAULTS("RS232_DATABITS", 0xff, RS232_DATABITS_8)
DEVICE_INPUT_DEFAULTS("RS232_PARITY", 0xff, RS232_PARITY_NONE)
DEVICE_INPUT_DEFAULTS("RS232_STOPBITS", 0xff, RS232_STOPBITS_2)
DEVICE_INPUT_DEFAULTS_END

//**************************************************************************
Copy link
Member

Choose a reason for hiding this comment

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

Please restore the two blank lines between sections here, too.

Comment on lines 303 to 313
}

// Called when serial data comes in from console.
void kim1_state::tty_callback(uint8_t data)
{
// Send data back to terminal to simulate the KIM-1 hardware
// echo.
m_rs232->write_txd(data);
}

//**************************************************************************
Copy link
Member

Choose a reason for hiding this comment

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

Please restore the two blank lines between sections here, too.

Comment on lines 62 to 78
- add TTY support
- Make console toggle a DIP switch?
Copy link
Member

Choose a reason for hiding this comment

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

What is it physically? If it isn’t a DIP switch, it should not be a DIP switch in MAME. Did you choose IPT_KEYBOARD just so it could easily be enabled/disabled in the Keyboard Selection menu when you want to use the terminal keyboard?

Speaking of which, is the reason the terminal isn’t “working” because you have multiple devices with keyboard inputs in the system and the terminal keyboard isn’t enabled? MAME only enables the first keyboard in the system by default so you aren’t typing on all the keyboards at once. (go to main menu, Input Settings, Keyboard Selection to enable/disable keyboards).

@jefftranter
Copy link
Contributor Author

The MR was updated to address the review comments.

…ix consistently, add new members to save states.
@cuavas cuavas merged commit f6d6f06 into mamedev:master Apr 15, 2024
2 of 5 checks passed
@x48x4b
Copy link

x48x4b commented Aug 6, 2024

Adds console support including emulation of hardware character echo. Serial monitor commands work and I am able to load and run programs like Microsoft Basic.

Hi & thank you!

  • I started KIM-1 on my Linux (Fedora 39 on a Intel core i5 machine) box with
    ./mame kim1 -rs232 pty -resolution 800x600 -window

  • In the "Machine Configuration" I set the serial paramters to "300 baud no parity 1 stop bit".

  • I connected with
    minicom -p /dev/pts/0 -b 300 -8

So far everything is fine and I can connect to the KIM-1 console as designed.

However, loading a papertape file with "L" and sending the *.pap file with minicom is not stable. If I send a short file this is okay, if I send a long file it does not work properly, even when setting character and line feed delays in minicom (20ms/200ms).

Best regards

@x48x4b
Copy link

x48x4b commented Aug 7, 2024

Adds console support including emulation of hardware character echo. Serial monitor commands work and I am able to load and run programs like Microsoft Basic.

Hi & thank you!

  • I started KIM-1 on my Linux (Fedora 39 on a Intel core i5 machine) box with
    ./mame kim1 -rs232 pty -resolution 800x600 -window
  • In the "Machine Configuration" I set the serial paramters to "300 baud no parity 1 stop bit".
  • I connected with
    minicom -p /dev/pts/0 -b 300 -8

So far everything is fine and I can connect to the KIM-1 console as designed.

However, loading a papertape file with "L" and sending the *.pap file with minicom is not stable. If I send a short file this is okay, if I send a long file it does not work properly, even when setting character and line feed delays in minicom (20ms/200ms).

Best regards

With the following setup I was able to load the Basic interpreter papertape file and run it:
./mame kim1 -sl1 mtuk1016 -rs232 pty
Therefore, I conclude that yesterday, I did not load sufficient memory.

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.

3 participants