-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Conversation
Is working with a pty but not for on screen console. Hardware loopback is not working quite right yet.
src/mame/commodore/kim1.cpp
Outdated
// 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); | ||
} |
There was a problem hiding this comment.
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
.
src/mame/commodore/kim1.cpp
Outdated
// Write bit 0 to serial console | ||
m_rs232->write_txd(data & 0x01); |
There was a problem hiding this comment.
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.
src/mame/commodore/kim1.cpp
Outdated
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; |
There was a problem hiding this comment.
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.
src/mame/commodore/kim1.cpp
Outdated
|
||
int m_sync_state = 0; | ||
bool m_k7 = false; | ||
uint8_t m_u2_port_a = 0; |
There was a problem hiding this comment.
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.
src/mame/commodore/kim1.cpp
Outdated
|
||
#include "kim1.lh" | ||
|
||
|
||
namespace { | ||
|
There was a problem hiding this comment.
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.
src/mame/commodore/kim1.cpp
Outdated
} | ||
|
||
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 | ||
|
||
//************************************************************************** |
There was a problem hiding this comment.
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.
src/mame/commodore/kim1.cpp
Outdated
} | ||
|
||
// 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); | ||
} | ||
|
||
//************************************************************************** |
There was a problem hiding this comment.
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.
src/mame/commodore/kim1.cpp
Outdated
- add TTY support | ||
- Make console toggle a DIP switch? |
There was a problem hiding this comment.
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).
The MR was updated to address the review comments. |
…ix consistently, add new members to save states.
Hi & thank you!
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: |
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.