-
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 tk10 keyboard device for apple ii clones #13004
base: master
Are you sure you want to change the base?
Conversation
If it's part of the AM64 machine, then you should just hook it up to the AM64. Also, unless the keyboard was also used on non-Apple machines you can just put it in src/mame/apple. |
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.
This isn’t much use if it isn’t actually attached to anything. The device won’t be linked since there’s nothing referenced in the translation unit, so it won’t appear in -listxml
or detect things with -romident
, etc.
Also it should be in src/mame/apple.
m_tk10cpu->p1_in_cb().set([this] () -> u8 | ||
{ | ||
for (int i = 0; i < 8; i++) | ||
{ | ||
if (!BIT(m_tk10cpu->p2_r(), i)) return m_keyboard[i]->read(); | ||
// read key matrix: | ||
// a low value in p2 bit will drive bit of p1 low when switch contact made | ||
} | ||
return 0xff; | ||
}); |
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 should lift the p2_r
out of the loop.
PORT_START("P21") | ||
PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) // _ SHIFT=^ | ||
PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) // ] | ||
PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) // [ | ||
PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) // @ SHIFT=^ | ||
PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) // / | ||
PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) | ||
PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) | ||
PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) | ||
|
||
PORT_START("P22") | ||
PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) // BACKSLASH |
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.
Do these keys really have blank key caps? It’s bad to have inputs that lack either PORT_NAME
or PORT_CHAR
.
src/devices/machine/tk10_keyboard.h
Outdated
#ifndef MAME_TK10_KEYBOARD_H | ||
#define MAME_TK10_KEYBOARD_H |
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.
This doesn’t match the path.
src/devices/machine/tk10_keyboard.h
Outdated
INPUT_CHANGED_MEMBER( tk10_func ); | ||
INPUT_CHANGED_MEMBER( tk10_reset ); | ||
|
||
auto reset_write_cb() { return m_reset_write.bind(); } | ||
auto data_write_cb() { return m_data_write.bind(); } |
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.
Conventionally, configuration members come before other stuff.
src/devices/machine/tk10_keyboard.h
Outdated
// device-level overrides | ||
virtual void device_start() override; | ||
virtual void device_add_mconfig(machine_config &config) override; | ||
virtual ioport_constructor device_input_ports() const override; | ||
virtual const tiny_rom_entry *device_rom_region() const override; |
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 don’t copy/paste this meaningless comment. Also, please add ATTR_COLD
for typical cold lifecycle member functions as @holub has done for most existing devices.
I wanted to check with you on changes to apple2.cpp. adding a member variable to hold the value of tk10 reset line. void apple2_state::tk10_data_write(u8 data)
} void apple2_state::tk10_reset_write(u8 data) TIMER_DEVICE_CALLBACK_MEMBER(apple2_state::apple2_interrupt_tk10) void apple2_state::am64(machine_config &config)
} I didn't want to touch any of the existing code, like removing the normal keyboard. When you switch the keyboard selection under the Input Menu, the normal keyboard can be deactivated and the tk10 can be activated. |
I found a schematic of the TK10 keyboard and made a device for it.
The rom can be found as part of the am64 apple II clone in apple2.cpp.