diff options
Diffstat (limited to 'src')
191 files changed, 4900 insertions, 4397 deletions
diff --git a/src/devices/bus/a7800/a78_slot.cpp b/src/devices/bus/a7800/a78_slot.cpp index c5170169ce4..9e028502170 100644 --- a/src/devices/bus/a7800/a78_slot.cpp +++ b/src/devices/bus/a7800/a78_slot.cpp @@ -22,7 +22,7 @@ even if not all carts use all of them (in particular no cart type seems to use access to the ranges $0500 to $0fff and $2800 to $2fff) - + ***********************************************************************************************************/ diff --git a/src/devices/bus/apricot/cards.cpp b/src/devices/bus/apricot/expansion/cards.cpp index 9a97adffca6..9a97adffca6 100644 --- a/src/devices/bus/apricot/cards.cpp +++ b/src/devices/bus/apricot/expansion/cards.cpp diff --git a/src/devices/bus/apricot/cards.h b/src/devices/bus/apricot/expansion/cards.h index 67766d51a8e..67766d51a8e 100644 --- a/src/devices/bus/apricot/cards.h +++ b/src/devices/bus/apricot/expansion/cards.h diff --git a/src/devices/bus/apricot/expansion.cpp b/src/devices/bus/apricot/expansion/expansion.cpp index 5dd7eb5ae58..5dd7eb5ae58 100644 --- a/src/devices/bus/apricot/expansion.cpp +++ b/src/devices/bus/apricot/expansion/expansion.cpp diff --git a/src/devices/bus/apricot/expansion.h b/src/devices/bus/apricot/expansion/expansion.h index fc581f50fb4..fc581f50fb4 100644 --- a/src/devices/bus/apricot/expansion.h +++ b/src/devices/bus/apricot/expansion/expansion.h diff --git a/src/devices/bus/apricot/ram.cpp b/src/devices/bus/apricot/expansion/ram.cpp index 2221ae37227..2221ae37227 100644 --- a/src/devices/bus/apricot/ram.cpp +++ b/src/devices/bus/apricot/expansion/ram.cpp diff --git a/src/devices/bus/apricot/ram.h b/src/devices/bus/apricot/expansion/ram.h index c2b2f771953..c2b2f771953 100644 --- a/src/devices/bus/apricot/ram.h +++ b/src/devices/bus/apricot/expansion/ram.h diff --git a/src/devices/bus/apricot/keyboard/hle.cpp b/src/devices/bus/apricot/keyboard/hle.cpp new file mode 100644 index 00000000000..4fb94c1f1a4 --- /dev/null +++ b/src/devices/bus/apricot/keyboard/hle.cpp @@ -0,0 +1,294 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + ACT Apricot Keyboard (HLE) + + Keyboard to System: + - 01-60: Key make codes + - 70-7f: Mouse codes + - 80: RAM test failed + - 81-e0: Key break codes + - e9: ROM test failed + - ea: X-on (keyboard ready to receive) + - eb: X-off (keyboard buffer full) + - ec: Reset request + - ed: Time prefix + - ee: Date prefix + - ef: Mouse header + - f0-f9: BCD data + - fa: Invalid clock data + - fb: Acknowledge firmware version/reset + + System to keyboard: + - 01-7f: Character codes for MicroScreen + - 80-cf: Cursor address + - d0: Clear screen + - d1: Cursor left + - d2: Cursor right + - d3: Cursor on + - d4: Cursor off + - d5: Display on + - d6: Display off + - e0: Query + - e1: Time and date request + - e2: Display time/data on MicroScreen + - e3: Set LED prefix + - e4: Set time and date + - e5: Mouse enable + - e6: Mouse disable + - e7: Execute processor diagnostics + - e8: Keyboard reset + - f0-f9: BCD data + - fa: Invalid clock data + +***************************************************************************/ + +#include "hle.h" +#include "machine/keyboard.ipp" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type APRICOT_KEYBOARD_HLE = &device_creator<apricot_keyboard_hle_device>; + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( keyboard ) + PORT_START("row_0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_NAME("Help") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) PORT_NAME("Undo") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) PORT_NAME("Repeat") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_NAME("Calc") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PRTSCR) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) PORT_NAME("Print") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CANCEL) PORT_CHAR(UCHAR_MAMEKEY(CANCEL)) PORT_NAME("Intr") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) PORT_NAME("Menu") + + PORT_START("row_1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) PORT_NAME("Finish") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_NAME("Function 1") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_NAME("Function 2") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_NAME("Function 3") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_NAME("Function 4") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_NAME("Function 5") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) PORT_NAME("Function 6") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('^') + + PORT_START("row_2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR(0xa3) // pound + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('$') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + + PORT_START("row_3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) // actually a dedicated % key + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + + PORT_START("row_4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + + PORT_START("row_5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) + + PORT_START("row_6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_NAME("Clear") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + + PORT_START("row_7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + + PORT_START("row_8") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + + PORT_START("row_9") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + PORT_START("row_a") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + + PORT_START("row_b") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(PAUSE)) PORT_NAME("Stop") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + + PORT_START("row_c") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) +INPUT_PORTS_END + +ioport_constructor apricot_keyboard_hle_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( keyboard ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// apricot_keyboard_hle_device - constructor +//------------------------------------------------- + +apricot_keyboard_hle_device::apricot_keyboard_hle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, APRICOT_KEYBOARD_HLE, "Apricot Keyboard (HLE)", tag, owner, clock, "apricotkb_hle", __FILE__), + device_apricot_keyboard_interface(mconfig, *this), + device_buffered_serial_interface(mconfig, *this), + device_matrix_keyboard_interface(mconfig, *this, "row_0", "row_1", "row_2", "row_3", "row_4", "row_5", "row_6", "row_7", "row_8", "row_9", "row_a", "row_b", "row_c") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void apricot_keyboard_hle_device::device_start() +{ + device_buffered_serial_interface::register_save_state(machine().save(), this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void apricot_keyboard_hle_device::device_reset() +{ + clear_fifo(); + + receive_register_reset(); + transmit_register_reset(); + + set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1); + set_rcv_rate(7800); + set_tra_rate(7800); + + reset_key_state(); + start_processing(attotime::from_hz(7800)); +} + +void apricot_keyboard_hle_device::tra_callback() +{ + m_host->in_w(transmit_register_get_data_bit()); +} + +void apricot_keyboard_hle_device::tra_complete() +{ + device_buffered_serial_interface::tra_complete(); +} + +void apricot_keyboard_hle_device::received_byte(UINT8 byte) +{ + logerror("received command: %02x\n", byte); +} + +//------------------------------------------------- +// key_make - handle a key being pressed +//------------------------------------------------- + +void apricot_keyboard_hle_device::key_make(UINT8 row, UINT8 column) +{ + // send the make code + transmit_byte((row << 3) | column); +} + +//------------------------------------------------- +// key_break - handle a key being released +//------------------------------------------------- + +void apricot_keyboard_hle_device::key_break(UINT8 row, UINT8 column) +{ + // send the break code + transmit_byte(0x80 | (row << 3) | column); +} + +void apricot_keyboard_hle_device::out_w(int state) +{ + device_buffered_serial_interface::rx_w(state); +} + +//------------------------------------------------- +// transmit_byte - send a byte or queue it +//------------------------------------------------- + +void apricot_keyboard_hle_device::transmit_byte(UINT8 byte) +{ + device_buffered_serial_interface::transmit_byte(byte); +} + +//------------------------------------------------- +// device_timer - device-specific timer +//------------------------------------------------- + +void apricot_keyboard_hle_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + device_matrix_keyboard_interface::device_timer(timer, id, param, ptr); + device_buffered_serial_interface::device_timer(timer, id, param, ptr); +} diff --git a/src/mame/machine/apricotkb_hle.h b/src/devices/bus/apricot/keyboard/hle.h index 5a5189c9247..a0d8b1b306f 100644 --- a/src/mame/machine/apricotkb_hle.h +++ b/src/devices/bus/apricot/keyboard/hle.h @@ -8,20 +8,12 @@ #pragma once -#ifndef __APRICOTKB_HLE__ -#define __APRICOTKB_HLE__ +#ifndef __APRICOT_KEYBOARD_HLE_H__ +#define __APRICOT_KEYBOARD_HLE_H__ #include "emu.h" - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_APRICOT_KEYBOARD_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, APRICOT_KEYBOARD_HLE, 0) - -#define MCFG_APRICOT_KEYBOARD_TXD_HANDLER(_write) \ - devcb = &apricot_keyboard_hle_device::set_txd_handler(*device, DEVCB_##_write); +#include "keyboard.h" +#include "machine/keyboard.h" //************************************************************************** @@ -30,17 +22,17 @@ // ======================> apricot_keyboard_hle_device -class apricot_keyboard_hle_device : public device_t, public device_serial_interface +class apricot_keyboard_hle_device : public device_t, + public device_apricot_keyboard_interface, + public device_buffered_serial_interface<8>, + protected device_matrix_keyboard_interface<13> { public: // construction/destruction apricot_keyboard_hle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - template<class _Object> static devcb_base &set_txd_handler(device_t &device, _Object object) - { return downcast<apricot_keyboard_hle_device &>(device).m_txd_handler.set_callback(object); } - - DECLARE_WRITE_LINE_MEMBER(rxd_w); - DECLARE_INPUT_CHANGED_MEMBER(key_callback); + // from host + virtual void out_w(int state) override; protected: // device_t overrides @@ -48,21 +40,19 @@ protected: virtual void device_start() override; virtual void device_reset() override; - // device_serial_interface overrides + // device_buffered_serial_interface overrides virtual void tra_callback() override; virtual void tra_complete() override; - virtual void rcv_callback() override; - virtual void rcv_complete() override; + virtual void received_byte(UINT8 byte) override; + + // device_matrix_keyboard_interface overrides + virtual void key_make(UINT8 row, UINT8 column) override; + virtual void key_break(UINT8 row, UINT8 column) override; + void transmit_byte(UINT8 byte); virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; private: - devcb_write_line m_txd_handler; - - int m_rxd; - - UINT8 m_data_in; - UINT8 m_data_out; }; @@ -70,4 +60,4 @@ private: extern const device_type APRICOT_KEYBOARD_HLE; -#endif // __APRICOTKB_HLE__ +#endif // __APRICOT_KEYBOARD_HLE_H__ diff --git a/src/devices/bus/apricot/keyboard/keyboard.cpp b/src/devices/bus/apricot/keyboard/keyboard.cpp new file mode 100644 index 00000000000..e045b319e4f --- /dev/null +++ b/src/devices/bus/apricot/keyboard/keyboard.cpp @@ -0,0 +1,105 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + ACT Apricot Keyboard Interface + +***************************************************************************/ + +#include "keyboard.h" +#include "hle.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type APRICOT_KEYBOARD_INTERFACE = &device_creator<apricot_keyboard_bus_device>; + + +//************************************************************************** +// SLOT DEVICE +//************************************************************************** + +//------------------------------------------------- +// apricot_keyboard_bus_device - constructor +//------------------------------------------------- + +apricot_keyboard_bus_device::apricot_keyboard_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, APRICOT_KEYBOARD_INTERFACE, "Apricot Keyboard Interface", tag, owner, clock, "apricot_kbd", __FILE__), + device_slot_interface(mconfig, *this), + m_kbd(nullptr), + m_in_handler(*this) +{ +} + +//------------------------------------------------- +// apricot_keyboard_bus_device - destructor +//------------------------------------------------- + +apricot_keyboard_bus_device::~apricot_keyboard_bus_device() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void apricot_keyboard_bus_device::device_start() +{ + // get connected keyboard + m_kbd = dynamic_cast<device_apricot_keyboard_interface *>(get_card_device()); + + // resolve callbacks + m_in_handler.resolve_safe(); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void apricot_keyboard_bus_device::device_reset() +{ +} + +//------------------------------------------------- +// host to module interface +//------------------------------------------------- + +WRITE_LINE_MEMBER( apricot_keyboard_bus_device::out_w ) +{ + if (m_kbd) + m_kbd->out_w(state); +} + + +//************************************************************************** +// KEYBOARD INTERFACE +//************************************************************************** + +//------------------------------------------------- +// device_apricot_keyboard_interface - constructor +//------------------------------------------------- + +device_apricot_keyboard_interface::device_apricot_keyboard_interface(const machine_config &mconfig, device_t &device) : + device_slot_card_interface(mconfig, device) +{ + m_host = dynamic_cast<apricot_keyboard_bus_device *>(device.owner()); +} + +//------------------------------------------------- +// ~device_apricot_keyboard_interface - destructor +//------------------------------------------------- + +device_apricot_keyboard_interface::~device_apricot_keyboard_interface() +{ +} + + +//************************************************************************** +// SLOT INTERFACE +//************************************************************************** + +SLOT_INTERFACE_START( apricot_keyboard_devices ) + SLOT_INTERFACE("hle", APRICOT_KEYBOARD_HLE) +SLOT_INTERFACE_END diff --git a/src/devices/bus/apricot/keyboard/keyboard.h b/src/devices/bus/apricot/keyboard/keyboard.h new file mode 100644 index 00000000000..577d2dee683 --- /dev/null +++ b/src/devices/bus/apricot/keyboard/keyboard.h @@ -0,0 +1,109 @@ +// license:GPL-2.0+ +// copyright-holders:Dirk Best +/*************************************************************************** + + ACT Apricot Keyboard Interface + + Host interface: 9-pin D-SUB + + 1 +12V + 2 OUT + 3 IN + 4 N/C + 5 N/C + 6 GND + 7 -12V + 8 0V + 9 N/C + + Keyboard interface: + + A 0V + B +12V + C -12V + D N/C + E OUT + F IN + +***************************************************************************/ + +#pragma once + +#ifndef __APRICOT_KEYBOARD_H__ +#define __APRICOT_KEYBOARD_H__ + +#include "emu.h" + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_APRICOT_KEYBOARD_INTERFACE_ADD(_tag, _def_slot) \ + MCFG_DEVICE_ADD(_tag, APRICOT_KEYBOARD_INTERFACE, 0) \ + MCFG_DEVICE_SLOT_INTERFACE(apricot_keyboard_devices, _def_slot, false) + +#define MCFG_APRICOT_KEYBOARD_IN_HANDLER(_devcb) \ + devcb = &apricot_keyboard_bus_device::set_in_handler(*device, DEVCB_##_devcb); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class device_apricot_keyboard_interface; + +// ======================> apricot_keyboard_bus_device + +class apricot_keyboard_bus_device : public device_t, public device_slot_interface +{ +public: + // construction/destruction + apricot_keyboard_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~apricot_keyboard_bus_device(); + + // callbacks + template<class _Object> static devcb_base &set_in_handler(device_t &device, _Object object) + { return downcast<apricot_keyboard_bus_device &>(device).m_in_handler.set_callback(object); } + + // called from keyboard + DECLARE_WRITE_LINE_MEMBER( in_w ) { m_in_handler(state); } + + // called from host + DECLARE_WRITE_LINE_MEMBER( out_w ); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + +private: + device_apricot_keyboard_interface *m_kbd; + + devcb_write_line m_in_handler; +}; + +// ======================> device_apricot_keyboard_interface + +class device_apricot_keyboard_interface : public device_slot_card_interface +{ +public: + // construction/destruction + device_apricot_keyboard_interface(const machine_config &mconfig, device_t &device); + virtual ~device_apricot_keyboard_interface(); + + virtual void out_w(int state) {}; + +protected: + apricot_keyboard_bus_device *m_host; +}; + + +// device type definition +extern const device_type APRICOT_KEYBOARD_INTERFACE; + +// supported devices +SLOT_INTERFACE_EXTERN( apricot_keyboard_devices ); + + +#endif // __APRICOT_KEYBOARD_H__ diff --git a/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp b/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp index 0c5c01f965f..11e97624e54 100644 --- a/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp +++ b/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp @@ -98,15 +98,15 @@ void bbc_1mhzbus_slot_device::device_reset() SLOT_INTERFACE_START( bbc_1mhzbus_devices ) -// SLOT_INTERFACE("teletext", BBC_TELETEXT) /* Acorn ANE01 Teletext Adapter */ -// SLOT_INTERFACE("ieee488", BBC_IEEE488) /* Acorn ANK01 IEEE488 Interface */ -// SLOT_INTERFACE("music500", BBC_MUSIC500) /* Acorn ANV02 Music500 */ -// SLOT_INTERFACE("music2000", BBC_MUSIC2000) /* Hybrid Music 2000 MIDI Interface */ -// SLOT_INTERFACE("music3000", BBC_MUSIC3000) /* Hybrid Music 3000 Expander */ -// SLOT_INTERFACE("music5000", BBC_MUSIC5000) /* Hybrid Music 5000 Synthesiser */ -// SLOT_INTERFACE("opus3", BBC_OPUS3) /* Opus Challenger 3 */ -// SLOT_INTERFACE("torchg400", BBC_TORCHG400) /* Torch Graduate G400 */ -// SLOT_INTERFACE("torchg800", BBC_TORCHG800) /* Torch Graduate G800 */ -// SLOT_INTERFACE("beebsid", BBC_BEEBSID) /* BeebSID */ -// SLOT_INTERFACE("prisma3", BBC_PRISMA3) /* Prisma 3 - Millipede 1989 */ +// SLOT_INTERFACE("teletext", BBC_TELETEXT) /* Acorn ANE01 Teletext Adapter */ +// SLOT_INTERFACE("ieee488", BBC_IEEE488) /* Acorn ANK01 IEEE488 Interface */ +// SLOT_INTERFACE("music500", BBC_MUSIC500) /* Acorn ANV02 Music500 */ +// SLOT_INTERFACE("music2000", BBC_MUSIC2000) /* Hybrid Music 2000 MIDI Interface */ +// SLOT_INTERFACE("music3000", BBC_MUSIC3000) /* Hybrid Music 3000 Expander */ +// SLOT_INTERFACE("music5000", BBC_MUSIC5000) /* Hybrid Music 5000 Synthesiser */ +// SLOT_INTERFACE("opus3", BBC_OPUS3) /* Opus Challenger 3 */ +// SLOT_INTERFACE("torchg400", BBC_TORCHG400) /* Torch Graduate G400 */ +// SLOT_INTERFACE("torchg800", BBC_TORCHG800) /* Torch Graduate G800 */ +// SLOT_INTERFACE("beebsid", BBC_BEEBSID) /* BeebSID */ +// SLOT_INTERFACE("prisma3", BBC_PRISMA3) /* Prisma 3 - Millipede 1989 */ SLOT_INTERFACE_END diff --git a/src/devices/bus/bbc/analogue/analogue.cpp b/src/devices/bus/bbc/analogue/analogue.cpp index 2ab1c4b8344..954e7a7e958 100644 --- a/src/devices/bus/bbc/analogue/analogue.cpp +++ b/src/devices/bus/bbc/analogue/analogue.cpp @@ -91,6 +91,6 @@ void bbc_analogue_slot_device::device_reset() SLOT_INTERFACE_START( bbc_analogue_devices ) -// SLOT_INTERFACE("joystick", BBC_JOYSTICKS) /* Acorn ANH01 BBC Micro Joysticks */ -// SLOT_INTERFACE("quinkey", BBC_QUINKEY) /* Microwriter Quinkey */ +// SLOT_INTERFACE("joystick", BBC_JOYSTICKS) /* Acorn ANH01 BBC Micro Joysticks */ +// SLOT_INTERFACE("quinkey", BBC_QUINKEY) /* Microwriter Quinkey */ SLOT_INTERFACE_END diff --git a/src/devices/bus/bbc/tube/tube.cpp b/src/devices/bus/bbc/tube/tube.cpp index d0d473def07..8ce07531fcc 100644 --- a/src/devices/bus/bbc/tube/tube.cpp +++ b/src/devices/bus/bbc/tube/tube.cpp @@ -96,13 +96,13 @@ void bbc_tube_slot_device::device_reset() SLOT_INTERFACE_START( bbc_tube_ext_devices ) -// SLOT_INTERFACE("6502copro", BBC_6502_COPRO) /* Acorn ANC01 6502 2nd processor */ -// SLOT_INTERFACE("z80copro", BBC_Z80_COPRO) /* Acorn ANC04 Z80 2nd processor */ -// SLOT_INTERFACE("32016copro", BBC_32016_COPRO) /* Acorn ANC05 32016 2nd processor */ -// SLOT_INTERFACE("cambcopro", BBC_CAMB_COPRO) /* Acorn ANC06 Cambridge Co-Processor */ -// SLOT_INTERFACE("armcopro", BBC_ARM_COPRO) /* Acorn ANC13 ARM Evaluation System */ -// SLOT_INTERFACE("unicopro", BBC_UNIVERSAL) /* Acorn ANC21 Universal 2nd Processor Unit */ -// SLOT_INTERFACE("a500copro", BBC_A500_COPRO) /* Acorn A500 2nd Processor */ +// SLOT_INTERFACE("6502copro", BBC_6502_COPRO) /* Acorn ANC01 6502 2nd processor */ +// SLOT_INTERFACE("z80copro", BBC_Z80_COPRO) /* Acorn ANC04 Z80 2nd processor */ +// SLOT_INTERFACE("32016copro", BBC_32016_COPRO) /* Acorn ANC05 32016 2nd processor */ +// SLOT_INTERFACE("cambcopro", BBC_CAMB_COPRO) /* Acorn ANC06 Cambridge Co-Processor */ +// SLOT_INTERFACE("armcopro", BBC_ARM_COPRO) /* Acorn ANC13 ARM Evaluation System */ +// SLOT_INTERFACE("unicopro", BBC_UNIVERSAL) /* Acorn ANC21 Universal 2nd Processor Unit */ +// SLOT_INTERFACE("a500copro", BBC_A500_COPRO) /* Acorn A500 2nd Processor */ SLOT_INTERFACE_END @@ -118,8 +118,8 @@ SLOT_INTERFACE_END SLOT_INTERFACE_START( bbc_tube_int_devices ) -// SLOT_INTERFACE("65c102copro", BBC_65C102_COPRO) /* Acorn ADC06 6502 co-processor */ -// SLOT_INTERFACE("80186copro", BBC_80186_COPRO) /* Acorn ADC08 80186 co-processor */ -// SLOT_INTERFACE("80286copro", BBC_80286_COPRO) /* Acorn ADC08 80286 co-processor */ -// SLOT_INTERFACE("arm7copro", BBC_ARM7_COPRO) /* Sprow ARM7 co-processor */ -SLOT_INTERFACE_END
\ No newline at end of file +// SLOT_INTERFACE("65c102copro", BBC_65C102_COPRO) /* Acorn ADC06 6502 co-processor */ +// SLOT_INTERFACE("80186copro", BBC_80186_COPRO) /* Acorn ADC08 80186 co-processor */ +// SLOT_INTERFACE("80286copro", BBC_80286_COPRO) /* Acorn ADC08 80286 co-processor */ +// SLOT_INTERFACE("arm7copro", BBC_ARM7_COPRO) /* Sprow ARM7 co-processor */ +SLOT_INTERFACE_END diff --git a/src/devices/bus/bbc/userport/userport.cpp b/src/devices/bus/bbc/userport/userport.cpp index b866348678b..e044e0177d4 100644 --- a/src/devices/bus/bbc/userport/userport.cpp +++ b/src/devices/bus/bbc/userport/userport.cpp @@ -96,7 +96,7 @@ UINT8 bbc_userport_device::read_portb() SLOT_INTERFACE_START( bbc_userport_devices ) -// SLOT_INTERFACE("amxmouse", BBC_AMXMOUSE) /* AMX Mouse */ -// SLOT_INTERFACE("tracker", BBC_TRACKER) /* Acorn Tracker Ball */ -// SLOT_INTERFACE("music4000", BBC_MUSIC4000) /* Hybrid Music 4000 Keyboard */ +// SLOT_INTERFACE("amxmouse", BBC_AMXMOUSE) /* AMX Mouse */ +// SLOT_INTERFACE("tracker", BBC_TRACKER) /* Acorn Tracker Ball */ +// SLOT_INTERFACE("music4000", BBC_MUSIC4000) /* Hybrid Music 4000 Keyboard */ SLOT_INTERFACE_END diff --git a/src/devices/bus/electron/m2105.cpp b/src/devices/bus/electron/m2105.cpp index 8632d1ad154..6b6a701f7b5 100644 --- a/src/devices/bus/electron/m2105.cpp +++ b/src/devices/bus/electron/m2105.cpp @@ -50,7 +50,7 @@ ROM_END //------------------------------------------------- //static ADDRESS_MAP_START( m2105_mem, AS_IO, 8, electron_m2105_device ) -// AM_RANGE(0x30000, 0x3ffff) AM_MIRROR(0x4000) AM_ROM AM_REGION("m2105_rom", 0) +// AM_RANGE(0x30000, 0x3ffff) AM_MIRROR(0x4000) AM_ROM AM_REGION("m2105_rom", 0) //ADDRESS_MAP_END diff --git a/src/devices/bus/isa/isa.cpp b/src/devices/bus/isa/isa.cpp index 3bbb41b5589..94f6b7bf9b9 100644 --- a/src/devices/bus/isa/isa.cpp +++ b/src/devices/bus/isa/isa.cpp @@ -52,7 +52,7 @@ void isa8_slot_device::device_start() { device_isa8_card_interface *dev = dynamic_cast<device_isa8_card_interface *>(get_card_device()); const device_isa16_card_interface *intf; - if (get_card_device()->interface(intf)) + if (get_card_device() && get_card_device()->interface(intf)) fatalerror("ISA16 device in ISA8 slot\n"); if (dev) device_isa8_card_interface::static_set_isabus(*dev,m_owner->subdevice(m_isa_tag)); diff --git a/src/devices/bus/isa/p1_sound.cpp b/src/devices/bus/isa/p1_sound.cpp index 7629ee6fb7d..03499c77643 100644 --- a/src/devices/bus/isa/p1_sound.cpp +++ b/src/devices/bus/isa/p1_sound.cpp @@ -4,7 +4,7 @@ Poisk-1 sound card. DAC, ADC, MIDI in/out and 6 music channels. - Memory-mapped, uses IRQ3 and IRQ7, no DMA. + Memory-mapped, uses IRQ3 and IRQ7, no DMA. Copyright MESS Team. Visit http://mamedev.org for licensing and usage restrictions. @@ -36,7 +36,7 @@ static MACHINE_CONFIG_FRAGMENT( p1_sound ) MCFG_DEVICE_ADD("d14", PIT8253, 0) MCFG_PIT8253_CLK0(XTAL_12_5MHz/10) -// sampler at 10 KHz +// sampler at 10 KHz MCFG_PIT8253_OUT0_HANDLER(WRITELINE(p1_sound_device, sampler_sync)) MCFG_PIT8253_CLK1(XTAL_12_5MHz/10) MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("midi", i8251_device, write_txc)) @@ -45,19 +45,19 @@ static MACHINE_CONFIG_FRAGMENT( p1_sound ) MCFG_DEVICE_ADD("d16", PIT8253, 0) MCFG_PIT8253_CLK0(XTAL_12_5MHz/10) -// MCFG_PIT8253_OUT0_HANDLER(XXX) +// MCFG_PIT8253_OUT0_HANDLER(XXX) MCFG_PIT8253_CLK1(XTAL_12_5MHz/10) -// MCFG_PIT8253_OUT1_HANDLER(XXX) +// MCFG_PIT8253_OUT1_HANDLER(XXX) MCFG_PIT8253_CLK2(XTAL_12_5MHz/10) -// MCFG_PIT8253_OUT2_HANDLER(XXX) +// MCFG_PIT8253_OUT2_HANDLER(XXX) MCFG_DEVICE_ADD("d17", PIT8253, 0) MCFG_PIT8253_CLK0(XTAL_12_5MHz/10) -// MCFG_PIT8253_OUT0_HANDLER(XXX) +// MCFG_PIT8253_OUT0_HANDLER(XXX) MCFG_PIT8253_CLK1(XTAL_12_5MHz/10) -// MCFG_PIT8253_OUT1_HANDLER(XXX) +// MCFG_PIT8253_OUT1_HANDLER(XXX) MCFG_PIT8253_CLK2(XTAL_12_5MHz/10) -// MCFG_PIT8253_OUT2_HANDLER(XXX) +// MCFG_PIT8253_OUT2_HANDLER(XXX) MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_DAC_ADD("dac") @@ -135,7 +135,7 @@ READ8_MEMBER( p1_sound_device::adc_r ) WRITE8_MEMBER( p1_sound_device::dac_w ) { -// logerror("DAC write: %02x <- %02x\n", offset>>1, data); +// logerror("DAC write: %02x <- %02x\n", offset>>1, data); m_dac_data[offset>>1] = data; m_isa->irq7_w(CLEAR_LINE); } diff --git a/src/devices/bus/isa/p1_sound.h b/src/devices/bus/isa/p1_sound.h index d99669294c9..95a6878f395 100644 --- a/src/devices/bus/isa/p1_sound.h +++ b/src/devices/bus/isa/p1_sound.h @@ -54,15 +54,15 @@ protected: virtual void device_reset() override; private: - UINT8 m_dac_data[16]; - int m_dac_ptr; - - required_device<dac_device> m_dac; - optional_device<filter_rc_device> m_filter; - required_device<i8251_device> m_midi; - required_device<pit8253_device> m_d14; - required_device<pit8253_device> m_d16; - required_device<pit8253_device> m_d17; + UINT8 m_dac_data[16]; + int m_dac_ptr; + + required_device<dac_device> m_dac; + optional_device<filter_rc_device> m_filter; + required_device<i8251_device> m_midi; + required_device<pit8253_device> m_d14; + required_device<pit8253_device> m_d16; + required_device<pit8253_device> m_d17; }; diff --git a/src/devices/bus/rs232/keyboard.cpp b/src/devices/bus/rs232/keyboard.cpp index af8cb01420b..c6462022ea3 100644 --- a/src/devices/bus/rs232/keyboard.cpp +++ b/src/devices/bus/rs232/keyboard.cpp @@ -2,35 +2,8 @@ // copyright-holders:smf #include "keyboard.h" -serial_keyboard_device::serial_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : generic_keyboard_device(mconfig, SERIAL_KEYBOARD, "Serial Keyboard", tag, owner, clock, "serial_keyboard", __FILE__), - device_serial_interface(mconfig, *this), - device_rs232_port_interface(mconfig, *this), - m_curr_key(0), - m_key_valid(false), - m_rs232_txbaud(*this, "RS232_TXBAUD"), - m_rs232_startbits(*this, "RS232_STARTBITS"), - m_rs232_databits(*this, "RS232_DATABITS"), - m_rs232_parity(*this, "RS232_PARITY"), - m_rs232_stopbits(*this, "RS232_STOPBITS") -{ -} - -serial_keyboard_device::serial_keyboard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) - : generic_keyboard_device(mconfig, type, name, tag, owner, clock, shortname, source), - device_serial_interface(mconfig, *this), - device_rs232_port_interface(mconfig, *this), - m_curr_key(0), - m_key_valid(false), - m_rs232_txbaud(*this, "RS232_TXBAUD"), - m_rs232_startbits(*this, "RS232_STARTBITS"), - m_rs232_databits(*this, "RS232_DATABITS"), - m_rs232_parity(*this, "RS232_PARITY"), - m_rs232_stopbits(*this, "RS232_STOPBITS") -{ -} - -static INPUT_PORTS_START(serial_keyboard) +namespace { +INPUT_PORTS_START(serial_keyboard) PORT_INCLUDE(generic_keyboard) MCFG_RS232_BAUD("RS232_TXBAUD", RS232_BAUD_9600, "TX Baud", serial_keyboard_device, update_serial) @@ -39,37 +12,60 @@ static INPUT_PORTS_START(serial_keyboard) MCFG_RS232_PARITY("RS232_PARITY", RS232_PARITY_NONE, "Parity", serial_keyboard_device, update_serial) MCFG_RS232_STOPBITS("RS232_STOPBITS", RS232_STOPBITS_1, "Stop Bits", serial_keyboard_device, update_serial) INPUT_PORTS_END +} // anonymous namespace + +serial_keyboard_device::serial_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : serial_keyboard_device(mconfig, SERIAL_KEYBOARD, "Serial Keyboard", tag, owner, clock, "serial_keyboard", __FILE__) +{ +} + +serial_keyboard_device::serial_keyboard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : generic_keyboard_device(mconfig, type, name, tag, owner, clock, shortname, source) + , device_buffered_serial_interface(mconfig, *this) + , device_rs232_port_interface(mconfig, *this) + , m_rs232_txbaud(*this, "RS232_TXBAUD") + , m_rs232_startbits(*this, "RS232_STARTBITS") + , m_rs232_databits(*this, "RS232_DATABITS") + , m_rs232_parity(*this, "RS232_PARITY") + , m_rs232_stopbits(*this, "RS232_STOPBITS") +{ +} ioport_constructor serial_keyboard_device::device_input_ports() const { return INPUT_PORTS_NAME(serial_keyboard); } -void serial_keyboard_device::device_start() +WRITE_LINE_MEMBER( serial_keyboard_device::input_txd ) { - generic_keyboard_device::device_start(); - device_serial_interface::register_save_state(machine().save(), this); - save_item(NAME(m_curr_key)); - save_item(NAME(m_key_valid)); + device_buffered_serial_interface::rx_w(state); } -WRITE_LINE_MEMBER(serial_keyboard_device::update_serial) +WRITE_LINE_MEMBER( serial_keyboard_device::update_serial ) { reset(); } +void serial_keyboard_device::device_start() +{ + generic_keyboard_device::device_start(); + device_buffered_serial_interface::register_save_state(machine().save(), this); +} + void serial_keyboard_device::device_reset() { generic_keyboard_device::device_reset(); - int startbits = convert_startbits(m_rs232_startbits->read()); - int databits = convert_databits(m_rs232_databits->read()); - parity_t parity = convert_parity(m_rs232_parity->read()); - stop_bits_t stopbits = convert_stopbits(m_rs232_stopbits->read()); + clear_fifo(); + + int const startbits = convert_startbits(m_rs232_startbits->read()); + int const databits = convert_databits(m_rs232_databits->read()); + parity_t const parity = convert_parity(m_rs232_parity->read()); + stop_bits_t const stopbits = convert_stopbits(m_rs232_stopbits->read()); set_data_frame(startbits, databits, parity, stopbits); - int txbaud = convert_baud(m_rs232_txbaud->read()); + int const txbaud = convert_baud(m_rs232_txbaud->read()); set_tra_rate(txbaud); output_rxd(1); @@ -79,39 +75,28 @@ void serial_keyboard_device::device_reset() output_dsr(0); output_cts(0); receive_register_reset(); + transmit_register_reset(); } void serial_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - if (id) - device_serial_interface::device_timer(timer, id, param, ptr); - else - generic_keyboard_device::device_timer(timer, id, param, ptr); + // give both bases a chance to handle it + device_buffered_serial_interface::device_timer(timer, id, param, ptr); + generic_keyboard_device::device_timer(timer, id, param, ptr); } -void serial_keyboard_device::send_key(UINT8 code) +void serial_keyboard_device::tra_callback() { - if(is_transmit_register_empty()) - { - transmit_register_setup(code); - return; - } - m_key_valid = true; - m_curr_key = code; + output_rxd(transmit_register_get_data_bit()); } -void serial_keyboard_device::tra_callback() +void serial_keyboard_device::send_key(UINT8 code) { - output_rxd(transmit_register_get_data_bit()); + transmit_byte(code); } -void serial_keyboard_device::tra_complete() +void serial_keyboard_device::received_byte(UINT8 byte) { - if(m_key_valid) - { - transmit_register_setup(m_curr_key); - m_key_valid = false; - } } const device_type SERIAL_KEYBOARD = &device_creator<serial_keyboard_device>; diff --git a/src/devices/bus/rs232/keyboard.h b/src/devices/bus/rs232/keyboard.h index 37e2097b8fb..fd9ad0f80f8 100644 --- a/src/devices/bus/rs232/keyboard.h +++ b/src/devices/bus/rs232/keyboard.h @@ -1,26 +1,26 @@ // license:BSD-3-Clause // copyright-holders:smf -#ifndef __RS232_KEYBOARD_H__ -#define __RS232_KEYBOARD_H__ +#ifndef MAME_BUS_RS232_KEYBOARD_H +#define MAME_BUS_RS232_KEYBOARD_H #pragma once #include "rs232.h" #include "machine/keyboard.h" -class serial_keyboard_device : - public generic_keyboard_device, - public device_serial_interface, - public device_rs232_port_interface +class serial_keyboard_device + : public generic_keyboard_device + , public device_buffered_serial_interface<16U> + , public device_rs232_port_interface { public: serial_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); serial_keyboard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - virtual DECLARE_WRITE_LINE_MEMBER( input_txd ) override { device_serial_interface::rx_w(state); } - virtual ioport_constructor device_input_ports() const override; + virtual DECLARE_WRITE_LINE_MEMBER( input_txd ) override; + DECLARE_WRITE_LINE_MEMBER(update_serial); protected: @@ -28,12 +28,10 @@ protected: virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; virtual void tra_callback() override; - virtual void tra_complete() override; virtual void send_key(UINT8 code) override; private: - UINT8 m_curr_key; - bool m_key_valid; + virtual void received_byte(UINT8 byte) override; required_ioport m_rs232_txbaud; required_ioport m_rs232_startbits; @@ -44,4 +42,4 @@ private: extern const device_type SERIAL_KEYBOARD; -#endif /* __RS232_KEYBOARD_H__ */ +#endif // MAME_BUS_RS232_KEYBOARD_H diff --git a/src/devices/bus/rs232/rs232.h b/src/devices/bus/rs232/rs232.h index 75e1e963eca..8959d276dc7 100644 --- a/src/devices/bus/rs232/rs232.h +++ b/src/devices/bus/rs232/rs232.h @@ -1,7 +1,7 @@ // license:BSD-3-Clause -// copyright-holders:smf -#ifndef __BUS_RS232_H__ -#define __BUS_RS232_H__ +// copyright-holders:smf,Vas Crabb +#ifndef MAME_BUS_RS232_H +#define MAME_BUS_RS232_H #pragma once @@ -256,8 +256,38 @@ protected: } }; +template <UINT32 FIFO_LENGTH> +class buffered_rs232_device : public device_t, public device_buffered_serial_interface<FIFO_LENGTH>, public device_rs232_port_interface +{ +public: + virtual DECLARE_WRITE_LINE_MEMBER( input_txd ) override + { + device_buffered_serial_interface<FIFO_LENGTH>::rx_w(state); + } + +protected: + buffered_rs232_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source) + , device_buffered_serial_interface<FIFO_LENGTH>(mconfig, *this) + , device_rs232_port_interface(mconfig, *this) + { + } + + virtual void device_start() override + { + device_buffered_serial_interface<FIFO_LENGTH>::register_save_state(machine().save(), this); + } + + virtual void tra_callback() override + { + output_rxd(this->transmit_register_get_data_bit()); + } + + using device_buffered_serial_interface<FIFO_LENGTH>::device_timer; +}; + extern const device_type RS232_PORT; SLOT_INTERFACE_EXTERN( default_rs232_devices ); -#endif +#endif // MAME_BUS_RS232_H diff --git a/src/devices/bus/rs232/terminal.cpp b/src/devices/bus/rs232/terminal.cpp index c242184b387..b56071b2bee 100644 --- a/src/devices/bus/rs232/terminal.cpp +++ b/src/devices/bus/rs232/terminal.cpp @@ -3,17 +3,15 @@ #include "terminal.h" serial_terminal_device::serial_terminal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : generic_terminal_device(mconfig, SERIAL_TERMINAL, "Serial Terminal", tag, owner, clock, "serial_terminal", __FILE__), - device_serial_interface(mconfig, *this), - device_rs232_port_interface(mconfig, *this), - m_rs232_txbaud(*this, "RS232_TXBAUD"), - m_rs232_rxbaud(*this, "RS232_RXBAUD"), - m_rs232_startbits(*this, "RS232_STARTBITS"), - m_rs232_databits(*this, "RS232_DATABITS"), - m_rs232_parity(*this, "RS232_PARITY"), - m_rs232_stopbits(*this, "RS232_STOPBITS"), - m_curr_key(0), - m_key_valid(false) + : generic_terminal_device(mconfig, SERIAL_TERMINAL, "Serial Terminal", tag, owner, clock, "serial_terminal", __FILE__) + , device_buffered_serial_interface(mconfig, *this) + , device_rs232_port_interface(mconfig, *this) + , m_rs232_txbaud(*this, "RS232_TXBAUD") + , m_rs232_rxbaud(*this, "RS232_RXBAUD") + , m_rs232_startbits(*this, "RS232_STARTBITS") + , m_rs232_databits(*this, "RS232_DATABITS") + , m_rs232_parity(*this, "RS232_PARITY") + , m_rs232_stopbits(*this, "RS232_STOPBITS") { } @@ -36,21 +34,24 @@ ioport_constructor serial_terminal_device::device_input_ports() const void serial_terminal_device::device_start() { generic_terminal_device::device_start(); + device_buffered_serial_interface::register_save_state(machine().save(), this); } WRITE_LINE_MEMBER(serial_terminal_device::update_serial) { - int startbits = convert_startbits(m_rs232_startbits->read()); - int databits = convert_databits(m_rs232_databits->read()); - parity_t parity = convert_parity(m_rs232_parity->read()); - stop_bits_t stopbits = convert_stopbits(m_rs232_stopbits->read()); + clear_fifo(); + + int const startbits = convert_startbits(m_rs232_startbits->read()); + int const databits = convert_databits(m_rs232_databits->read()); + parity_t const parity = convert_parity(m_rs232_parity->read()); + stop_bits_t const stopbits = convert_stopbits(m_rs232_stopbits->read()); set_data_frame(startbits, databits, parity, stopbits); - int txbaud = convert_baud(m_rs232_txbaud->read()); + int const txbaud = convert_baud(m_rs232_txbaud->read()); set_tra_rate(txbaud); - int rxbaud = convert_baud(m_rs232_rxbaud->read()); + int const rxbaud = convert_baud(m_rs232_rxbaud->read()); set_rcv_rate(rxbaud); output_rxd(1); @@ -59,6 +60,8 @@ WRITE_LINE_MEMBER(serial_terminal_device::update_serial) output_dcd(0); output_dsr(0); output_cts(0); + receive_register_reset(); + transmit_register_reset(); } void serial_terminal_device::device_reset() @@ -70,19 +73,13 @@ void serial_terminal_device::device_reset() void serial_terminal_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - device_serial_interface::device_timer(timer, id, param, ptr); + generic_terminal_device::device_timer(timer, id, param, ptr); + device_buffered_serial_interface::device_timer(timer, id, param, ptr); } void serial_terminal_device::send_key(UINT8 code) { - if (is_transmit_register_empty()) - { - transmit_register_setup(code); - return; - } - - m_key_valid = true; - m_curr_key = code; + transmit_byte(code); } void serial_terminal_device::tra_callback() @@ -90,19 +87,9 @@ void serial_terminal_device::tra_callback() output_rxd(transmit_register_get_data_bit()); } -void serial_terminal_device::tra_complete() -{ - if (m_key_valid) - { - transmit_register_setup(m_curr_key); - m_key_valid = false; - } -} - -void serial_terminal_device::rcv_complete() +void serial_terminal_device::received_byte(UINT8 byte) { - receive_register_extract(); - term_write(get_received_char()); + term_write(byte); } const device_type SERIAL_TERMINAL = &device_creator<serial_terminal_device>; diff --git a/src/devices/bus/rs232/terminal.h b/src/devices/bus/rs232/terminal.h index 0cde8f71f32..b3a550381eb 100644 --- a/src/devices/bus/rs232/terminal.h +++ b/src/devices/bus/rs232/terminal.h @@ -1,20 +1,20 @@ // license:BSD-3-Clause // copyright-holders:smf -#ifndef __RS232_TERMINAL_H__ -#define __RS232_TERMINAL_H__ +#ifndef MAME_BUS_RS232_TERMINAL_H +#define MAME_BUS_RS232_TERMINAL_H #include "rs232.h" #include "machine/terminal.h" class serial_terminal_device : public generic_terminal_device, - public device_serial_interface, + public device_buffered_serial_interface<16U>, public device_rs232_port_interface { public: serial_terminal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - virtual DECLARE_WRITE_LINE_MEMBER( input_txd ) override { device_serial_interface::rx_w(state); } + virtual DECLARE_WRITE_LINE_MEMBER( input_txd ) override { device_buffered_serial_interface::rx_w(state); } DECLARE_WRITE_LINE_MEMBER(update_serial); @@ -25,22 +25,19 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; virtual void tra_callback() override; - virtual void tra_complete() override; - virtual void rcv_complete() override; virtual void send_key(UINT8 code) override; private: + virtual void received_byte(UINT8 byte) override; + required_ioport m_rs232_txbaud; required_ioport m_rs232_rxbaud; required_ioport m_rs232_startbits; required_ioport m_rs232_databits; required_ioport m_rs232_parity; required_ioport m_rs232_stopbits; - - UINT8 m_curr_key; - bool m_key_valid; }; extern const device_type SERIAL_TERMINAL; -#endif /* __RS232_TERMINAL_H__ */ +#endif // MAME_BUS_RS232_TERMINAL_H diff --git a/src/devices/bus/sunkbd/hlekbd.cpp b/src/devices/bus/sunkbd/hlekbd.cpp index 87f5d799905..8696a97d704 100644 --- a/src/devices/bus/sunkbd/hlekbd.cpp +++ b/src/devices/bus/sunkbd/hlekbd.cpp @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb #include "hlekbd.h" -#include <numeric> +#include "machine/keyboard.ipp" /* @@ -759,26 +759,16 @@ hle_device_base::hle_device_base( char const *shortname, char const *source) : device_t(mconfig, type, name, tag, owner, clock, shortname, source) - , device_serial_interface(mconfig, *this) + , device_buffered_serial_interface(mconfig, *this) , device_sun_keyboard_port_interface(mconfig, *this) + , device_matrix_keyboard_interface(mconfig, *this, "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7") , m_dips(*this, "DIP") - , m_key_inputs{ - { *this, "ROW0" }, { *this, "ROW1" }, - { *this, "ROW2" }, { *this, "ROW3" }, - { *this, "ROW4" }, { *this, "ROW5" }, - { *this, "ROW6" }, { *this, "ROW7" } } - , m_scan_timer(nullptr) , m_click_timer(nullptr) , m_beeper(*this, "beeper") - , m_current_keys{ 0, 0, 0, 0, 0, 0, 0, 0 } - , m_next_row(0) - , m_fifo{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - , m_head(0) - , m_tail(0) - , m_empty(0) + , m_make_count(0U) , m_rx_state(RX_IDLE) - , m_keyclick(0) - , m_beeper_state(0) + , m_keyclick(0U) + , m_beeper_state(0U) { } @@ -811,7 +801,7 @@ machine_config_constructor hle_device_base::device_mconfig_additions() const WRITE_LINE_MEMBER( hle_device_base::input_txd ) { - device_serial_interface::rx_w(state); + device_buffered_serial_interface::rx_w(state); } @@ -823,17 +813,11 @@ WRITE_LINE_MEMBER( hle_device_base::input_txd ) void hle_device_base::device_start() { - device_serial_interface::register_save_state(machine().save(), this); + device_buffered_serial_interface::register_save_state(machine().save(), this); - m_scan_timer = timer_alloc(SCAN_TIMER_ID); m_click_timer = timer_alloc(CLICK_TIMER_ID); - save_item(NAME(m_current_keys)); - save_item(NAME(m_next_row)); - save_item(NAME(m_fifo)); - save_item(NAME(m_head)); - save_item(NAME(m_tail)); - save_item(NAME(m_empty)); + save_item(NAME(m_make_count)); save_item(NAME(m_rx_state)); save_item(NAME(m_keyclick)); save_item(NAME(m_beeper_state)); @@ -849,16 +833,13 @@ void hle_device_base::device_start() void hle_device_base::device_reset() { // initialise state - std::fill(std::begin(m_current_keys), std::end(m_current_keys), 0x0000U); - m_next_row = 0; - std::fill(std::begin(m_fifo), std::end(m_fifo), 0); - m_head = m_tail = 0; - m_empty = 1; + clear_fifo(); + m_make_count = 0U; m_rx_state = RX_IDLE; - m_keyclick = 0; - m_beeper_state = 0; + m_keyclick = 0U; + m_beeper_state = 0x00U; - // configure device_serial_interface + // configure device_buffered_serial_interface set_data_frame(START_BIT_COUNT, DATA_BIT_COUNT, PARITY, STOP_BITS); set_rate(BAUD); receive_register_reset(); @@ -874,21 +855,18 @@ void hle_device_base::device_reset() machine().output().set_led_value(LED_CAPS, 0); machine().output().set_led_value(LED_KANA, 0); - // send reset response - send_byte(0xffU); - send_byte(ident_byte()); - UINT16 const acc( - std::accumulate( - std::begin(m_key_inputs), - std::end(m_key_inputs), - UINT16(0), - [] (UINT16 a, auto const &b) { return a | b->read(); })); - if (!acc) - send_byte(0x7fU); - - // kick the scan timer - m_scan_timer->adjust(attotime::from_hz(1'200), 0, attotime::from_hz(1'200)); + // no beep m_click_timer->reset(); + + // kick the base + reset_key_state(); + start_processing(attotime::from_hz(1'200)); + + // send reset response + transmit_byte(0xffU); + transmit_byte(ident_byte()); + if (are_all_keys_up()) + transmit_byte(0x7fU); } @@ -901,17 +879,14 @@ void hle_device_base::device_timer(emu_timer &timer, device_timer_id id, int par { switch (id) { - case SCAN_TIMER_ID: - scan_row(); - break; - case CLICK_TIMER_ID: m_beeper_state &= ~UINT8(BEEPER_CLICK); m_beeper->set_state(m_beeper_state ? 1 : 0); break; default: - device_serial_interface::device_timer(timer, id, param, ptr); + device_matrix_keyboard_interface::device_timer(timer, id, param, ptr); + device_buffered_serial_interface::device_timer(timer, id, param, ptr); } } @@ -935,43 +910,94 @@ void hle_device_base::tra_callback() void hle_device_base::tra_complete() { - assert(!m_empty || (m_head == m_tail)); - assert(m_head < ARRAY_LENGTH(m_fifo)); - assert(m_tail < ARRAY_LENGTH(m_fifo)); + if (fifo_full()) + start_processing(attotime::from_hz(1'200)); + + device_buffered_serial_interface::tra_complete(); +} - if (!m_empty) + +/*-------------------------------------------------- + hle_device_base::key_make + handle a key being pressed +--------------------------------------------------*/ + +void hle_device_base::key_make(UINT8 row, UINT8 column) +{ + // we should have stopped processing if we filled the FIFO + assert(!fifo_full()); + + // send the make code, click if desired + transmit_byte((row << 4) | column); + if (m_keyclick) { - transmit_register_setup(m_fifo[m_head]); - m_head = (m_head + 1) & 0x0fU; - m_empty = (m_head == m_tail) ? 1 : 0; + m_beeper_state |= UINT8(BEEPER_CLICK); + m_beeper->set_state(m_beeper_state ? 1 : 0); + m_click_timer->reset(attotime::from_msec(5)); } + + // count keys + ++m_make_count; + assert(m_make_count); } /*-------------------------------------------------- - hle_device_base::rcv_complete + hle_device_base::key_break + handle a key being released +--------------------------------------------------*/ + +void hle_device_base::key_break(UINT8 row, UINT8 column) +{ + // we should have stopped processing if we filled the FIFO + assert(!fifo_full()); + assert(m_make_count); + + // send the break code, and the idle code if no other keysa are down + transmit_byte(0x80U | (row << 4) | column); + if (!--m_make_count) + transmit_byte(0x7fU); + + // check our counting + assert(are_all_keys_up() == !bool(m_make_count)); +} + + +/*-------------------------------------------------- + hle_device_base::transmit_byte + send a byte or queue it to send later +--------------------------------------------------*/ + +void hle_device_base::transmit_byte(UINT8 byte) +{ + device_buffered_serial_interface::transmit_byte(byte); + if (fifo_full()) + stop_processing(); +} + + +/*-------------------------------------------------- + hle_device_base::received_byte handle received byte frame --------------------------------------------------*/ -void hle_device_base::rcv_complete() +void hle_device_base::received_byte(UINT8 byte) { - receive_register_extract(); - UINT8 const code(get_received_char()); switch (m_rx_state) { case RX_LED: - machine().output().set_led_value(LED_NUM, BIT(code, 0)); - machine().output().set_led_value(LED_COMPOSE, BIT(code, 1)); - machine().output().set_led_value(LED_SCROLL, BIT(code, 2)); - machine().output().set_led_value(LED_CAPS, BIT(code, 3)); - machine().output().set_led_value(LED_KANA, BIT(code, 4)); + machine().output().set_led_value(LED_NUM, BIT(byte, 0)); + machine().output().set_led_value(LED_COMPOSE, BIT(byte, 1)); + machine().output().set_led_value(LED_SCROLL, BIT(byte, 2)); + machine().output().set_led_value(LED_CAPS, BIT(byte, 3)); + machine().output().set_led_value(LED_KANA, BIT(byte, 4)); m_rx_state = RX_IDLE; break; default: assert(m_rx_state == RX_IDLE); case RX_IDLE: - switch (code) + switch (byte) { case COMMAND_RESET: device_reset(); @@ -990,12 +1016,12 @@ void hle_device_base::rcv_complete() break; case COMMAND_CLICK_ON: - m_keyclick = 1; + m_keyclick = 1U; m_rx_state = RX_IDLE; break; case COMMAND_CLICK_OFF: - m_keyclick = 0; + m_keyclick = 0U; m_click_timer->reset(); m_beeper_state &= ~UINT8(BEEPER_CLICK); m_beeper->set_state(m_beeper_state ? 1 : 0); @@ -1007,104 +1033,19 @@ void hle_device_base::rcv_complete() break; case COMMAND_LAYOUT: - send_byte(0xfeU); - send_byte(UINT8(m_dips->read() & 0x3fU)); + transmit_byte(0xfeU); + transmit_byte(UINT8(m_dips->read() & 0x3fU)); m_rx_state = RX_IDLE; break; default: - logerror("Unknown command: 0x%02x", code); + logerror("Unknown command: 0x%02x", byte); m_rx_state = RX_IDLE; } } } -/*-------------------------------------------------- - hle_device_base::scan_row - scan the next row in the keyboard matrix and - send update to host ---------------------------------------------------*/ - -void hle_device_base::scan_row() -{ - // ensure we aren't in a stupid state - assert(m_next_row < ARRAY_LENGTH(m_key_inputs)); - assert(m_next_row < ARRAY_LENGTH(m_current_keys)); - - // get last read state and new state of row - UINT16 const row(m_key_inputs[m_next_row]->read()); - UINT16 ¤t(m_current_keys[m_next_row]); - bool keydown(false), keyup(false); - - // while the buffer isn't full, look for changed keys in this row - for (UINT8 bit = 0; (bit < 16) && (m_empty || (m_head != m_tail)); ++bit) - { - UINT16 const mask(UINT16(1) << bit); - if ((row ^ current) & mask) - { - UINT8 const make_break((row & mask) ? 0x00U : 0x80U); - keydown = keydown || !bool(make_break); - keyup = keyup || bool(make_break); - current = (current & ~mask) | (row & mask); - send_byte(make_break | (m_next_row << 4) | bit); - } - } - - // if a key was pressed and keyclick is enabled, turn on the beeper - if (keydown && m_keyclick) - { - m_beeper_state |= UINT8(BEEPER_CLICK); - m_beeper->set_state(m_beeper_state ? 1 : 0); - m_click_timer->reset(attotime::from_msec(5)); - } - - // if a key was released and no keys are down, send all keys up code - if (keyup) - { - UINT16 const acc( - std::accumulate( - std::begin(m_current_keys), - std::end(m_current_keys), - UINT16(0), - [] (UINT16 a, UINT16 b) { return a | b; })); - if (!acc) - send_byte(0x7fU); - } - - // advance to the next row - m_next_row = (m_next_row + 1) & 0x07U; -} - - -/*-------------------------------------------------- - hle_device_base::send_byte - send a byte or queue it to send later ---------------------------------------------------*/ - -void hle_device_base::send_byte(UINT8 code) -{ - assert(!m_empty || (m_head == m_tail)); - assert(m_head < ARRAY_LENGTH(m_fifo)); - assert(m_tail < ARRAY_LENGTH(m_fifo)); - - if (m_empty && is_transmit_register_empty()) - { - transmit_register_setup(code); - } - else if (m_empty || (m_head != m_tail)) - { - m_fifo[m_tail] = code; - m_tail = (m_tail + 1) & 0x0fU; - m_empty = 0; - } - else - { - logerror("FIFO overrun (code = 0x%02x)", code); - } -} - - /*************************************************************************** BASE TYPE 4/5/6 HLE KEYBOARD DEVICE diff --git a/src/devices/bus/sunkbd/hlekbd.h b/src/devices/bus/sunkbd/hlekbd.h index 545817783e5..c34e438a53a 100644 --- a/src/devices/bus/sunkbd/hlekbd.h +++ b/src/devices/bus/sunkbd/hlekbd.h @@ -6,6 +6,7 @@ #pragma once #include "sunkbd.h" +#include "machine/keyboard.h" #include "sound/beep.h" @@ -18,7 +19,11 @@ extern device_type const SUN_TYPE5_JP_HLE_KEYBOARD; namespace bus { namespace sunkbd { -class hle_device_base : public device_t, public device_serial_interface, public device_sun_keyboard_port_interface +class hle_device_base + : public device_t + , public device_buffered_serial_interface<16U> + , public device_sun_keyboard_port_interface + , protected device_matrix_keyboard_interface<8U> { public: virtual machine_config_constructor device_mconfig_additions() const override; @@ -42,19 +47,24 @@ protected: virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - // device_serial_interface overrides + // device_buffered_serial_interface overrides virtual void tra_callback() override; virtual void tra_complete() override; - virtual void rcv_complete() override; + + // device_matrix_keyboard_interface overrides + virtual void key_make(UINT8 row, UINT8 column) override; + virtual void key_break(UINT8 row, UINT8 column) override; + + // customised transmit_byte method + void transmit_byte(UINT8 byte); required_ioport m_dips; - required_ioport m_key_inputs[8]; private: // device_serial_interface uses 10'000 range + // device_matrix_keyboard_interface uses 20'000 range enum { - SCAN_TIMER_ID = 20'000, - CLICK_TIMER_ID + CLICK_TIMER_ID = 30'000 }; // TODO: ensure these don't clash with diagnostic LEDs on host computer @@ -86,22 +96,15 @@ private: COMMAND_LAYOUT = 0x0fU }; - virtual UINT8 ident_byte() = 0; + // device_buffered_serial_interface overrides + virtual void received_byte(UINT8 byte) override; - void scan_row(); - void send_byte(UINT8 code); + virtual UINT8 ident_byte() = 0; - emu_timer *m_scan_timer; emu_timer *m_click_timer; required_device<beep_device> m_beeper; - UINT16 m_current_keys[8]; - UINT8 m_next_row; - - UINT8 m_fifo[16]; - UINT8 m_head, m_tail; - UINT8 m_empty; - + UINT8 m_make_count; UINT8 m_rx_state; UINT8 m_keyclick; diff --git a/src/devices/bus/ti99_peb/ti_rs232.h b/src/devices/bus/ti99_peb/ti_rs232.h index 129561d9bf5..f244843fc09 100644 --- a/src/devices/bus/ti99_peb/ti_rs232.h +++ b/src/devices/bus/ti99_peb/ti_rs232.h @@ -127,7 +127,7 @@ public: bool is_reset_on_load() const override { return false; } const char *image_interface() const override { return ""; } const char *file_extensions() const override { return ""; } - + protected: virtual void device_start(void) override; bool call_load() override; diff --git a/src/devices/cpu/alto2/a2hw.cpp b/src/devices/cpu/alto2/a2hw.cpp index 4ece160d206..9c436433453 100644 --- a/src/devices/cpu/alto2/a2hw.cpp +++ b/src/devices/cpu/alto2/a2hw.cpp @@ -311,6 +311,7 @@ WRITE16_MEMBER( alto2_cpu_device::utilout_w ) // FIXME: write printer data // printer_write(); + m_speaker->level_w(data ? 1 : 0); } /** diff --git a/src/devices/cpu/alto2/a2mem.cpp b/src/devices/cpu/alto2/a2mem.cpp index e4fa65184f1..e64dd4a0a28 100644 --- a/src/devices/cpu/alto2/a2mem.cpp +++ b/src/devices/cpu/alto2/a2mem.cpp @@ -824,15 +824,7 @@ void alto2_cpu_device::init_memory() void alto2_cpu_device::exit_memory() { - // no need for this since it free on exit by itself - // if (m_mem.ram) { - // auto_free(machine(), m_mem.ram); - // m_mem.ram = 0; - // } - // if (m_mem.hpb) { - // auto_free(machine(), m_mem.hpb); - // m_mem.hpb = 0; - // } + // nothing to do } void alto2_cpu_device::reset_memory() diff --git a/src/devices/cpu/alto2/alto2cpu.cpp b/src/devices/cpu/alto2/alto2cpu.cpp index 85e87765cf7..49db9fb2297 100644 --- a/src/devices/cpu/alto2/alto2cpu.cpp +++ b/src/devices/cpu/alto2/alto2cpu.cpp @@ -207,6 +207,7 @@ alto2_cpu_device::alto2_cpu_device(const machine_config& mconfig, const char* ta memset(m_sysclka1, 0x00, sizeof(m_sysclka1)); memset(m_sysclkb0, 0x00, sizeof(m_sysclkb0)); memset(m_sysclkb1, 0x00, sizeof(m_sysclkb1)); + m_speaker = 0; } alto2_cpu_device::~alto2_cpu_device() @@ -241,6 +242,16 @@ void alto2_cpu_device::set_diablo(int unit, diablo_hd_device* ptr) } //------------------------------------------------- +// driver interface to set speaker_sound_device +//------------------------------------------------- + +void alto2_cpu_device::set_speaker(speaker_sound_device* speaker) +{ + logerror("%s: speaker_sound_device=%p\n", __FUNCTION__, speaker); + m_speaker = speaker; +} + +//------------------------------------------------- // device_rom_region - device-specific (P)ROMs //------------------------------------------------- @@ -832,7 +843,7 @@ void alto2_cpu_device::device_start() m_madr_a91 = prom_load(machine(), &pl_madr_a91, memregion("madr_a91")->base()); #if DEBUG_ALU_A10_PROM - // dump ALU a10 PROM after loading + // dump ALU a10 PROM after loading for (UINT8 i = 0; i < 32; i++) { UINT8 a = m_alu_a10[i]; printf("%03o: S3-S0:%u%u%u%u M:%u CI:%u T:%u ?:%u\n", diff --git a/src/devices/cpu/alto2/alto2cpu.h b/src/devices/cpu/alto2/alto2cpu.h index 34d959480ab..a0b7af2442a 100644 --- a/src/devices/cpu/alto2/alto2cpu.h +++ b/src/devices/cpu/alto2/alto2cpu.h @@ -12,6 +12,7 @@ #include "emu.h" #include "debugger.h" +#include "sound/speaker.h" #include "machine/diablo_hd.h" /** @@ -191,6 +192,9 @@ public: //! driver interface to set diablo_hd_device void set_diablo(int unit, diablo_hd_device* ptr); + //! driver interface to set a speaker sound device + void set_speaker(speaker_sound_device* speaker); + //! call in for the next sector callback void next_sector(int unit); @@ -276,6 +280,8 @@ private: int m_icount; + speaker_sound_device* m_speaker; + typedef void (alto2_cpu_device::*a2func)(); //! task numbers @@ -558,8 +564,8 @@ private: UINT8 m_d_bs; //!< decoded BS[0-2] bus source UINT8 m_d_f1; //!< decoded F1[0-3] function UINT8 m_d_f2; //!< decoded F2[0-3] function - UINT8 m_d_loadt; //!< decoded LOADT flag - UINT8 m_d_loadl; //!< decoded LOADL flag + UINT8 m_d_loadt; //!< decoded LOADT flag + UINT8 m_d_loadl; //!< decoded LOADL flag UINT16 m_next; //!< current micro instruction's next UINT16 m_next2; //!< next micro instruction's next UINT16 m_r[ALTO2_REGS]; //!< R register file diff --git a/src/devices/cpu/m6809/hd6309.cpp b/src/devices/cpu/m6809/hd6309.cpp index caba599adef..213464d90dc 100644 --- a/src/devices/cpu/m6809/hd6309.cpp +++ b/src/devices/cpu/m6809/hd6309.cpp @@ -26,11 +26,11 @@ machine must be twos complement History: - -July 2016 ErikGav: + +July 2016 ErikGav: Unify with 6809 pairs and quads (A+B=D, E+F=W, D+W=Q) Initialize V register to $FFFF at startup - + March 2013 NPW: Rewrite of 6809/6309/Konami CPU; attempted to make cycle exact. @@ -795,4 +795,3 @@ void hd6309_device::execute_run() execute_one(); } while(m_icount > 0); } - diff --git a/src/devices/cpu/m6809/m6809.cpp b/src/devices/cpu/m6809/m6809.cpp index aa380c14e0f..c02450c1ea2 100644 --- a/src/devices/cpu/m6809/m6809.cpp +++ b/src/devices/cpu/m6809/m6809.cpp @@ -21,10 +21,10 @@ machine must be twos complement History: - -July 2016 ErikGav: - Unify with 6309 pairs and quads (A+B=D, E+F=W, D+W=Q) - + +July 2016 ErikGav: + Unify with 6309 pairs and quads (A+B=D, E+F=W, D+W=Q) + March 2013 NPW: Rewrite of 6809/6309/Konami CPU; attempted to make cycle exact. @@ -147,7 +147,7 @@ void m6809_base_device::device_start() state_add(M6809_CC, "CC", m_cc).mask(0xff); state_add(M6809_DP, "DP", m_dp).mask(0xff); - if (is_6809()) + if (is_6809()) { state_add(M6809_A, "A", m_q.r.a).mask(0xff); state_add(M6809_B, "B", m_q.r.b).mask(0xff); diff --git a/src/devices/cpu/m6809/m6809.h b/src/devices/cpu/m6809/m6809.h index ebcde8f554d..8a2f5f9e400 100644 --- a/src/devices/cpu/m6809/m6809.h +++ b/src/devices/cpu/m6809/m6809.h @@ -141,14 +141,14 @@ protected: union M6809Q { #ifdef LSB_FIRST - union + union { struct { UINT8 f, e, b, a; }; struct { UINT16 w, d; }; } r; struct { PAIR16 w, d; } p; #else - union + union { struct { UINT8 a, b, e, f; }; struct { UINT16 d, w; }; diff --git a/src/devices/cpu/mcs51/mcs51.cpp b/src/devices/cpu/mcs51/mcs51.cpp index cb680438e96..48674fdb6b8 100644 --- a/src/devices/cpu/mcs51/mcs51.cpp +++ b/src/devices/cpu/mcs51/mcs51.cpp @@ -2101,7 +2101,7 @@ void mcs51_cpu_device::device_start() /* ensure these pointers are set before get_info is called */ update_ptrs(); - + m_serial_rx_cb.resolve_safe(0); m_serial_tx_cb.resolve_safe(); diff --git a/src/devices/cpu/sparc/mb86901.cpp b/src/devices/cpu/sparc/mb86901.cpp index 8ed13db2778..1e9eafebcb1 100644 --- a/src/devices/cpu/sparc/mb86901.cpp +++ b/src/devices/cpu/sparc/mb86901.cpp @@ -695,9 +695,9 @@ void mb86901_device::execute_add(UINT32 op) PSR |= (BIT31(result)) ? PSR_N_MASK : 0; PSR |= (result == 0) ? PSR_Z_MASK : 0; PSR |= ((BIT31(rs1) && BIT31(operand2) && !BIT31(result)) || - (!BIT31(rs1) && !BIT31(operand2) && BIT31(result))) ? PSR_V_MASK : 0; + (!BIT31(rs1) && !BIT31(operand2) && BIT31(result))) ? PSR_V_MASK : 0; PSR |= ((BIT31(rs1) && BIT31(operand2)) || - (!BIT31(result) && (BIT31(rs1) || BIT31(operand2)))) ? PSR_C_MASK : 0; + (!BIT31(result) && (BIT31(rs1) || BIT31(operand2)))) ? PSR_C_MASK : 0; } } @@ -740,8 +740,8 @@ void mb86901_device::execute_taddcc(UINT32 op) UINT32 result = rs1 + operand2; bool temp_v = (BIT31(rs1) && BIT31(operand2) && !BIT31(result)) || - (!BIT31(rs1) && !BIT31(operand2) && BIT31(result)) || - ((rs1 & 3) != 0 || (operand2 & 3) != 0) ? true : false; + (!BIT31(rs1) && !BIT31(operand2) && BIT31(result)) || + ((rs1 & 3) != 0 || (operand2 & 3) != 0) ? true : false; if (TADDCCTV && temp_v) { @@ -755,7 +755,7 @@ void mb86901_device::execute_taddcc(UINT32 op) PSR |= (result == 0) ? PSR_Z_MASK : 0; PSR |= temp_v ? PSR_V_MASK : 0; PSR |= ((BIT31(rs1) && BIT31(operand2)) || - (!BIT31(result) && (BIT31(rs1) || BIT31(operand2)))) ? PSR_C_MASK : 0; + (!BIT31(result) && (BIT31(rs1) || BIT31(operand2)))) ? PSR_C_MASK : 0; if (RD != 0) RDREG = result; @@ -810,9 +810,9 @@ void mb86901_device::execute_sub(UINT32 op) PSR |= (BIT31(result)) ? PSR_N_MASK : 0; PSR |= (result == 0) ? PSR_Z_MASK : 0; PSR |= ((BIT31(rs1) && !BIT31(operand2) && !BIT31(result)) || - (!BIT31(rs1) && BIT31(operand2) && BIT31(result))) ? PSR_V_MASK : 0; + (!BIT31(rs1) && BIT31(operand2) && BIT31(result))) ? PSR_V_MASK : 0; PSR |= ((!BIT31(rs1) && BIT31(operand2)) || - (BIT31(result) && (!BIT31(rs1) || BIT31(operand2)))) ? PSR_C_MASK : 0; + (BIT31(result) && (!BIT31(rs1) || BIT31(operand2)))) ? PSR_C_MASK : 0; } } @@ -856,8 +856,8 @@ void mb86901_device::execute_tsubcc(UINT32 op) UINT32 result = rs1 - operand2; bool temp_v = (BIT31(rs1) && !BIT31(operand2) && !BIT31(result)) || - (!BIT31(rs1) && BIT31(operand2) && BIT31(result)) || - ((rs1 & 3) != 0 || (operand2 & 3) != 0) ? true : false; + (!BIT31(rs1) && BIT31(operand2) && BIT31(result)) || + ((rs1 & 3) != 0 || (operand2 & 3) != 0) ? true : false; if (TSUBCCTV && temp_v) { @@ -871,7 +871,7 @@ void mb86901_device::execute_tsubcc(UINT32 op) PSR |= (result == 0) ? PSR_Z_MASK : 0; PSR |= temp_v ? PSR_V_MASK : 0; PSR |= ((!BIT31(rs1) && BIT31(operand2)) || - (BIT31(result) && (!BIT31(rs1) || BIT31(operand2)))) ? PSR_C_MASK : 0; + (BIT31(result) && (!BIT31(rs1) || BIT31(operand2)))) ? PSR_C_MASK : 0; if (RD != 0) RDREG = result; diff --git a/src/devices/cpu/sparc/sparc.h b/src/devices/cpu/sparc/sparc.h index fa8b9dd234b..424305a1924 100644 --- a/src/devices/cpu/sparc/sparc.h +++ b/src/devices/cpu/sparc/sparc.h @@ -11,8 +11,8 @@ #include "sparcdasm.h" -#define SPARCV8 (0) -#define LOG_FCODES (0) +#define SPARCV8 (0) +#define LOG_FCODES (0) #if LOG_FCODES #include <map> diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp index b9f5ea19767..44b80e6629a 100644 --- a/src/devices/imagedev/floppy.cpp +++ b/src/devices/imagedev/floppy.cpp @@ -363,7 +363,7 @@ floppy_image_format_t *floppy_image_device::identify(std::string filename) util::core_file::ptr fd; std::string revised_path; - osd_file::error err = util::zippath_fopen(filename.c_str(), OPEN_FLAG_READ, fd, revised_path); + osd_file::error err = util::zippath_fopen(filename, OPEN_FLAG_READ, fd, revised_path); if(err != osd_file::error::NONE) { seterror(IMAGE_ERROR_INVALIDIMAGE, "Unable to open the image file"); return nullptr; diff --git a/src/devices/machine/68230pit.cpp b/src/devices/machine/68230pit.cpp index 3354738f954..fa7142c2306 100644 --- a/src/devices/machine/68230pit.cpp +++ b/src/devices/machine/68230pit.cpp @@ -5,13 +5,13 @@ * Motorola MC68230 PI/T Parallell Interface and Timer * * PORT MODES INCLUDE : -* - BIT I/O +* - BIT I/O * - UNIDIRECTIONAL 8 BIT AND 16 BIT -* - BIDIRECTIONAL 8 BIT AND 16 BIT -* PROGRAMMABLE HANDSHAKING OPTIONS -* 24-BIT PROGRAMMABLE TIMER MODES -* FIVE SEPARATE INTERRUPT VECTORS SEPARATE PORT AND TIMER INTERRUPT SERVICE REQUESTS -* REGISTERS AREREAD/WRITEAND DIRECTLY ADDRESSABLE +* - BIDIRECTIONAL 8 BIT AND 16 BIT +* PROGRAMMABLE HANDSHAKING OPTIONS +* 24-BIT PROGRAMMABLE TIMER MODES +* FIVE SEPARATE INTERRUPT VECTORS SEPARATE PORT AND TIMER INTERRUPT SERVICE REQUESTS +* REGISTERS AREREAD/WRITEAND DIRECTLY ADDRESSABLE * REGISTERS ARE ADDRESSED FOR MOVEP (Move Peripheral) AND DMAC COMPATIBILITY * * Revisions: 2015-07-15 JLE initial @@ -77,9 +77,9 @@ pit68230_device::pit68230_device(const machine_config &mconfig, device_type type , m_tcr(0) , m_tivr(0) , m_cpr(0) - // , m_cprh(0) // Collectivelly handled by m_cpr - // , m_cprm(0) // Collectivelly handled by m_cpr - // , m_cprl(0) // Collectivelly handled by m_cpr + // , m_cprh(0) // Collectivelly handled by m_cpr + // , m_cprm(0) // Collectivelly handled by m_cpr + // , m_cprl(0) // Collectivelly handled by m_cpr , m_cntr(0) , m_tsr(0) { @@ -113,9 +113,9 @@ pit68230_device::pit68230_device(const machine_config &mconfig, const char *tag, , m_tcr(0) , m_tivr(0) , m_cpr(0) - // , m_cprh(0) // Collectivelly handled by m_cpr - // , m_cprm(0) // Collectivelly handled by m_cpr - // , m_cprl(0) // Collectivelly handled by m_cpr + // , m_cprh(0) // Collectivelly handled by m_cpr + // , m_cprm(0) // Collectivelly handled by m_cpr + // , m_cprl(0) // Collectivelly handled by m_cpr , m_cntr(0) , m_tsr(0) { @@ -193,9 +193,9 @@ void pit68230_device::device_timer (emu_timer &timer, device_timer_id id, INT32 { switch(id) { - case TIMER_ID_PIT: + case TIMER_ID_PIT: if (m_cntr-- == 0) // Zero detect - { + { /* TODO: Check mode and use preload value if required or just rollover 24 bit */ if ((m_tcr & REG_TCR_ZD) == 0) m_cntr = m_cpr; @@ -203,9 +203,9 @@ void pit68230_device::device_timer (emu_timer &timer, device_timer_id id, INT32 m_cntr &= 0xffffff; } break; - default: - LOG(("Unhandled Timer ID %d\n", id)); - break; + default: + LOG(("Unhandled Timer ID %d\n", id)); + break; } } @@ -400,21 +400,21 @@ void pit68230_device::wr_pitreg_tcr(UINT8 data) switch (m_tcr & REG_TCR_TOUT_TIACK_MASK) { case REG_TCR_PC3_PC7: - case REG_TCR_PC3_PC7_DC: LOG(("- PC3 and PC7 used as I/O pins\n")); break; + case REG_TCR_PC3_PC7_DC: LOG(("- PC3 and PC7 used as I/O pins\n")); break; case REG_TCR_TOUT_PC7_SQ: - case REG_TCR_TOUT_PC7_SQ_DC: LOG(("- PC3 used as SQuare wave TOUT and PC7 used as I/O pin - not supported yet\n")); sqr = 1; break; - case REG_TCR_TOUT_TIACK: LOG(("- PC3 used as TOUT and PC7 used as TIACK - not supported yet\n")); tout = 1; tiack = 1; break; - case REG_TCR_TOUT_TIACK_INT: LOG(("- PC3 used as TOUT and PC7 used as TIACK, Interrupts enabled - not supported yet\n")); tout = 1; tiack = 1; irq = 1; break; - case REG_TCR_TOUT_PC7: LOG(("- PC3 used as TOUT and PC7 used as I/O pin - not supported yet\n")); break; - case REG_TCR_TOUT_PC7_INT: LOG(("- PC3 used as TOUT and PC7 used as I/O pin, Interrupts enabled - not supported yet\n")); break; + case REG_TCR_TOUT_PC7_SQ_DC: LOG(("- PC3 used as SQuare wave TOUT and PC7 used as I/O pin - not supported yet\n")); sqr = 1; break; + case REG_TCR_TOUT_TIACK: LOG(("- PC3 used as TOUT and PC7 used as TIACK - not supported yet\n")); tout = 1; tiack = 1; break; + case REG_TCR_TOUT_TIACK_INT: LOG(("- PC3 used as TOUT and PC7 used as TIACK, Interrupts enabled - not supported yet\n")); tout = 1; tiack = 1; irq = 1; break; + case REG_TCR_TOUT_PC7: LOG(("- PC3 used as TOUT and PC7 used as I/O pin - not supported yet\n")); break; + case REG_TCR_TOUT_PC7_INT: LOG(("- PC3 used as TOUT and PC7 used as I/O pin, Interrupts enabled - not supported yet\n")); break; } switch (m_tcr & REG_TCR_CC_MASK) { - case REG_TCR_CC_PC2_CLK_PSC: LOG(("- PC2 used as I/O pin,CLK and x32 prescaler are used\n")); clk = 1; psc = 1; break; - case REG_TCR_CC_TEN_CLK_PSC: LOG(("- PC2 used as Timer enable/disable, CLK and presacaler are used\n")); pen = 1; clk = 1; psc = 1; break; - case REG_TCR_CC_TIN_PSC: LOG(("- PC2 used as Timer clock and the presacaler is used - not supported yet\n")); psc = 1; break; - case REG_TCR_CC_TIN_RAW: LOG(("- PC2 used as Timer clock and the presacaler is NOT used - not supported yet\n")); break; + case REG_TCR_CC_PC2_CLK_PSC: LOG(("- PC2 used as I/O pin,CLK and x32 prescaler are used\n")); clk = 1; psc = 1; break; + case REG_TCR_CC_TEN_CLK_PSC: LOG(("- PC2 used as Timer enable/disable, CLK and presacaler are used\n")); pen = 1; clk = 1; psc = 1; break; + case REG_TCR_CC_TIN_PSC: LOG(("- PC2 used as Timer clock and the presacaler is used - not supported yet\n")); psc = 1; break; + case REG_TCR_CC_TIN_RAW: LOG(("- PC2 used as Timer clock and the presacaler is NOT used - not supported yet\n")); break; } LOG(("%s", m_tcr & REG_TCR_ZR ? "- Spec violation, should always be 0!\n" : "")); LOG(("- Timer %s when reaching 0 (zero)\n", m_tcr & REG_TCR_ZD ? "rolls over" : "reload the preload values")); @@ -475,29 +475,29 @@ WRITE8_MEMBER (pit68230_device::write) { LOG(("%s %s \n",tag(), FUNCNAME)); switch (offset) { - case PIT_68230_PGCR: wr_pitreg_pgcr(data); break; - case PIT_68230_PSRR: wr_pitreg_psrr(data); break; - case PIT_68230_PADDR: wr_pitreg_paddr(data); break; - case PIT_68230_PBDDR: wr_pitreg_pbddr(data); break; - case PIT_68230_PCDDR: wr_pitreg_pcddr(data); break; - case PIT_68230_PIVR: wr_pitreg_pivr(data); break; - case PIT_68230_PACR: wr_pitreg_pacr(data); break; - case PIT_68230_PBCR: wr_pitreg_pbcr(data); break; - case PIT_68230_PADR: wr_pitreg_padr(data); break; - case PIT_68230_PBDR: wr_pitreg_pbdr(data); break; - case PIT_68230_PAAR: break; // Ignores write per spec, read only register - case PIT_68230_PBAR: break; // Ignores write per spec, read only register - case PIT_68230_PCDR: wr_pitreg_pcdr(data); break; - case PIT_68230_PSR: wr_pitreg_psr(data); break; - case PIT_68230_TCR: wr_pitreg_tcr(data); break; - case PIT_68230_TIVR: wr_pitreg_tivr(data); break; - case PIT_68230_CPRH: wr_pitreg_cprh(data); break; - case PIT_68230_CPRM: wr_pitreg_cprm(data); break; - case PIT_68230_CPRL: wr_pitreg_cprl(data); break; - case PIT_68230_CNTRH: break; // Ignores write per spec, read only register - case PIT_68230_CNTRM: break; // Ignores write per spec, read only register - case PIT_68230_CNTRL: break; // Ignores write per spec, read only register - case PIT_68230_TSR: wr_pitreg_tsr(data); break; + case PIT_68230_PGCR: wr_pitreg_pgcr(data); break; + case PIT_68230_PSRR: wr_pitreg_psrr(data); break; + case PIT_68230_PADDR: wr_pitreg_paddr(data); break; + case PIT_68230_PBDDR: wr_pitreg_pbddr(data); break; + case PIT_68230_PCDDR: wr_pitreg_pcddr(data); break; + case PIT_68230_PIVR: wr_pitreg_pivr(data); break; + case PIT_68230_PACR: wr_pitreg_pacr(data); break; + case PIT_68230_PBCR: wr_pitreg_pbcr(data); break; + case PIT_68230_PADR: wr_pitreg_padr(data); break; + case PIT_68230_PBDR: wr_pitreg_pbdr(data); break; + case PIT_68230_PAAR: break; // Ignores write per spec, read only register + case PIT_68230_PBAR: break; // Ignores write per spec, read only register + case PIT_68230_PCDR: wr_pitreg_pcdr(data); break; + case PIT_68230_PSR: wr_pitreg_psr(data); break; + case PIT_68230_TCR: wr_pitreg_tcr(data); break; + case PIT_68230_TIVR: wr_pitreg_tivr(data); break; + case PIT_68230_CPRH: wr_pitreg_cprh(data); break; + case PIT_68230_CPRM: wr_pitreg_cprm(data); break; + case PIT_68230_CPRL: wr_pitreg_cprl(data); break; + case PIT_68230_CNTRH: break; // Ignores write per spec, read only register + case PIT_68230_CNTRM: break; // Ignores write per spec, read only register + case PIT_68230_CNTRL: break; // Ignores write per spec, read only register + case PIT_68230_TSR: wr_pitreg_tsr(data); break; default: LOG (("Unhandled Write of %02x to register %02x", data, offset)); } @@ -601,7 +601,7 @@ UINT8 pit68230_device::rr_pitreg_pcdr() return m_pcdr; } -/* The port A alternate register is an alternate register for reading the port A pins. +/* The port A alternate register is an alternate register for reading the port A pins. It is a read-only address and no other PI/T condition is affected. In all modes, the instantaneous pin level is read and no input latching is performed except at the data bus interface. Writes to this address are answered with DTACK, but the data is ignored.*/ @@ -697,29 +697,29 @@ READ8_MEMBER (pit68230_device::read){ UINT8 data; switch (offset) { - case PIT_68230_PGCR: data = rr_pitreg_pgcr(); break; - case PIT_68230_PSRR: data = rr_pitreg_psrr(); break; - case PIT_68230_PADDR: data = rr_pitreg_paddr(); break; - case PIT_68230_PBDDR: data = rr_pitreg_pbddr(); break; - case PIT_68230_PCDDR: data = rr_pitreg_pcddr(); break; - case PIT_68230_PIVR: data = rr_pitreg_pivr(); break; - case PIT_68230_PACR: data = rr_pitreg_pacr(); break; - case PIT_68230_PBCR: data = rr_pitreg_pbcr(); break; - case PIT_68230_PADR: data = rr_pitreg_padr(); break; - case PIT_68230_PBDR: data = rr_pitreg_pbdr(); break; - case PIT_68230_PAAR: data = rr_pitreg_paar(); break; - case PIT_68230_PBAR: data = rr_pitreg_pbar(); break; - case PIT_68230_PCDR: data = rr_pitreg_pcdr(); break; - case PIT_68230_PSR: data = rr_pitreg_psr(); break; - case PIT_68230_TCR: data = rr_pitreg_tcr(); break; - case PIT_68230_TIVR: data = rr_pitreg_tivr(); break; - case PIT_68230_CPRH: data = rr_pitreg_cprh(); break; - case PIT_68230_CPRM: data = rr_pitreg_cprm(); break; - case PIT_68230_CPRL: data = rr_pitreg_cprl(); break; - case PIT_68230_CNTRH: data = rr_pitreg_cntrh(); break; - case PIT_68230_CNTRM: data = rr_pitreg_cntrm(); break; - case PIT_68230_CNTRL: data = rr_pitreg_cntrl(); break; - case PIT_68230_TSR: data = rr_pitreg_tsr(); break; + case PIT_68230_PGCR: data = rr_pitreg_pgcr(); break; + case PIT_68230_PSRR: data = rr_pitreg_psrr(); break; + case PIT_68230_PADDR: data = rr_pitreg_paddr(); break; + case PIT_68230_PBDDR: data = rr_pitreg_pbddr(); break; + case PIT_68230_PCDDR: data = rr_pitreg_pcddr(); break; + case PIT_68230_PIVR: data = rr_pitreg_pivr(); break; + case PIT_68230_PACR: data = rr_pitreg_pacr(); break; + case PIT_68230_PBCR: data = rr_pitreg_pbcr(); break; + case PIT_68230_PADR: data = rr_pitreg_padr(); break; + case PIT_68230_PBDR: data = rr_pitreg_pbdr(); break; + case PIT_68230_PAAR: data = rr_pitreg_paar(); break; + case PIT_68230_PBAR: data = rr_pitreg_pbar(); break; + case PIT_68230_PCDR: data = rr_pitreg_pcdr(); break; + case PIT_68230_PSR: data = rr_pitreg_psr(); break; + case PIT_68230_TCR: data = rr_pitreg_tcr(); break; + case PIT_68230_TIVR: data = rr_pitreg_tivr(); break; + case PIT_68230_CPRH: data = rr_pitreg_cprh(); break; + case PIT_68230_CPRM: data = rr_pitreg_cprm(); break; + case PIT_68230_CPRL: data = rr_pitreg_cprl(); break; + case PIT_68230_CNTRH: data = rr_pitreg_cntrh(); break; + case PIT_68230_CNTRM: data = rr_pitreg_cntrm(); break; + case PIT_68230_CNTRL: data = rr_pitreg_cntrl(); break; + case PIT_68230_TSR: data = rr_pitreg_tsr(); break; default: LOG (("Unhandled read register %02x\n", offset)); data = 0; diff --git a/src/devices/machine/68230pit.h b/src/devices/machine/68230pit.h index 0c304bd1970..06736741867 100644 --- a/src/devices/machine/68230pit.h +++ b/src/devices/machine/68230pit.h @@ -174,23 +174,23 @@ class pit68230_device : public device_t//, public device_execute_interface protected: enum { - REG_TCR_ENABLE = 0x01, - REG_TCR_CC_MASK = 0x06, - REG_TCR_CC_PC2_CLK_PSC = 0x00, - REG_TCR_CC_TEN_CLK_PSC = 0x02, - REG_TCR_CC_TIN_PSC = 0x04, - REG_TCR_CC_TIN_RAW = 0x06, - REG_TCR_ZR = 0x08, - REG_TCR_ZD = 0x10, - REG_TCR_TOUT_TIACK_MASK = 0xe0, // 1 1 1 - REG_TCR_PC3_PC7 = 0x00, // 0 0 0 - REG_TCR_PC3_PC7_DC = 0x20, // 0 0 1 - REG_TCR_TOUT_PC7_SQ = 0x40, // 0 1 0 - REG_TCR_TOUT_PC7_SQ_DC = 0x60, // 0 1 1 - REG_TCR_TOUT_TIACK = 0x80, // 1 0 0 - REG_TCR_TOUT_TIACK_INT = 0xa0, // 1 0 1 - REG_TCR_TOUT_PC7 = 0xc0, // 1 1 0 - REG_TCR_TOUT_PC7_INT = 0xe0, // 1 1 1 + REG_TCR_ENABLE = 0x01, + REG_TCR_CC_MASK = 0x06, + REG_TCR_CC_PC2_CLK_PSC = 0x00, + REG_TCR_CC_TEN_CLK_PSC = 0x02, + REG_TCR_CC_TIN_PSC = 0x04, + REG_TCR_CC_TIN_RAW = 0x06, + REG_TCR_ZR = 0x08, + REG_TCR_ZD = 0x10, + REG_TCR_TOUT_TIACK_MASK = 0xe0, // 1 1 1 + REG_TCR_PC3_PC7 = 0x00, // 0 0 0 + REG_TCR_PC3_PC7_DC = 0x20, // 0 0 1 + REG_TCR_TOUT_PC7_SQ = 0x40, // 0 1 0 + REG_TCR_TOUT_PC7_SQ_DC = 0x60, // 0 1 1 + REG_TCR_TOUT_TIACK = 0x80, // 1 0 0 + REG_TCR_TOUT_TIACK_INT = 0xa0, // 1 0 1 + REG_TCR_TOUT_PC7 = 0xc0, // 1 1 0 + REG_TCR_TOUT_PC7_INT = 0xe0, // 1 1 1 }; // device-level overrides @@ -217,18 +217,18 @@ protected: UINT8 m_paddr; // Port A Data Direction register UINT8 m_pbddr; // Port B Data Direction register UINT8 m_pcddr; // Port C Data Direction register - UINT8 m_pivr; // Ports Interrupt vector + UINT8 m_pivr; // Ports Interrupt vector UINT8 m_pacr; // Port A Control register UINT8 m_pbcr; // Port B Control register UINT8 m_padr; // Port A Data register UINT8 m_pbdr; // Port B Data register UINT8 m_pcdr; // Port C Data register UINT8 m_psr; // Port Status Register - UINT8 m_tcr; // Timer Control Register - UINT8 m_tivr; // Timer Interrupt Vector register - int m_cpr; // Counter Preload Registers (3 x 8 = 24 bits) - int m_cntr; // - The 24 bit Counter - UINT8 m_tsr; // Timer Status Register + UINT8 m_tcr; // Timer Control Register + UINT8 m_tivr; // Timer Interrupt Vector register + int m_cpr; // Counter Preload Registers (3 x 8 = 24 bits) + int m_cntr; // - The 24 bit Counter + UINT8 m_tsr; // Timer Status Register // Timers emu_timer *pit_timer; diff --git a/src/devices/machine/fga002.cpp b/src/devices/machine/fga002.cpp index 4cd77414612..ceb54043211 100644 --- a/src/devices/machine/fga002.cpp +++ b/src/devices/machine/fga002.cpp @@ -4,31 +4,31 @@ * * Force Computer FGA-002 Force Gate Array * -* Documetation: http://bitsavers.informatik.uni-stuttgart.de/pdf/forceComputers/201559_FGA-002_Nov96.pdf +* Documetation: http://bitsavers.informatik.uni-stuttgart.de/pdf/forceComputers/201559_FGA-002_Nov96.pdf * -* The FGA-002 gate array is a high speed CMOS device manufactured in 1.2 micron technology and containing 24,000 gates in a 281 pin PGA -* package. It provides interfaces to the 68020/30 microprocessor as well as a VMEbus compatible interface. -* The auxilary interface of the gate array is a high speed data channel used by the internal 32 bit DMA controller. The interface -* allows data transfer rates of up to 6 MByte/second. The timing of the local I/O interface is programmable and provides -* easy interfacing of local I/O devices. All control, address and data lines of the CPU and the VMEbus are either directly connected or -* connected via buffers to the gate array allowing easy implementation and usage. The gate array registers are programmed by the local CPU. +* The FGA-002 gate array is a high speed CMOS device manufactured in 1.2 micron technology and containing 24,000 gates in a 281 pin PGA +* package. It provides interfaces to the 68020/30 microprocessor as well as a VMEbus compatible interface. +* The auxilary interface of the gate array is a high speed data channel used by the internal 32 bit DMA controller. The interface +* allows data transfer rates of up to 6 MByte/second. The timing of the local I/O interface is programmable and provides +* easy interfacing of local I/O devices. All control, address and data lines of the CPU and the VMEbus are either directly connected or +* connected via buffers to the gate array allowing easy implementation and usage. The gate array registers are programmed by the local CPU. * -* FEATURES: -* - Programmable decoding for CPU and VME access to the local main memory -* - Interrupt management for internal and external interrupt sources -* - 32 bit multi-port DMA Controller -* - FORCE Message Broadcast slave interface with 2 message channels -* - 8 interrupt capable MAILBOXES -* - 8 bit TIMER with 16 selectable internal source clocks +* FEATURES: +* - Programmable decoding for CPU and VME access to the local main memory +* - Interrupt management for internal and external interrupt sources +* - 32 bit multi-port DMA Controller +* - FORCE Message Broadcast slave interface with 2 message channels +* - 8 interrupt capable MAILBOXES +* - 8 bit TIMER with 16 selectable internal source clocks * * -* CAUTION (from the documentation - no unducumented registers are currently emulated ) -* The FGA-002 gate array contains registers, which are used to configure the gate array for special external hardware -* requirements. These registers are reserved and will be setup by the boot software according to the hardware environment in which the gate array is -* implemented. These registers must not be changed by the user. Some of these hardware configuration registers also contain user selectable bits. -* Programming the contents of these registers has to be done carefully without changing the bits initialized by the boot software. -* Registers not described must not be programmed. Unqualified changes of register bits may have unpredictable consequences for the gate array and -* external hardware. It is expressly forbidden to change register bits, except those defined for the user. +* CAUTION (from the documentation - no unducumented registers are currently emulated ) +* The FGA-002 gate array contains registers, which are used to configure the gate array for special external hardware +* requirements. These registers are reserved and will be setup by the boot software according to the hardware environment in which the gate array is +* implemented. These registers must not be changed by the user. Some of these hardware configuration registers also contain user selectable bits. +* Programming the contents of these registers has to be done carefully without changing the bits initialized by the boot software. +* Registers not described must not be programmed. Unqualified changes of register bits may have unpredictable consequences for the gate array and +* external hardware. It is expressly forbidden to change register bits, except those defined for the user. * */ #include "fga002.h" @@ -112,14 +112,14 @@ void fga002_device::device_timer (emu_timer &timer, device_timer_id id, INT32 pa { switch(id) { - case TIMER_ID_FGA: + case TIMER_ID_FGA: if (m_tim0count-- == 0) // Zero detect - { + { if ((m_fga002[FGA_TIM0CTL] & REG_TIM0CTL_ZERO_STOP) == 0) { fga_timer->adjust(attotime::never, TIMER_ID_FGA, attotime::never); } - else + else { if ((m_fga002[FGA_TIM0CTL] & REG_TIM0CTL_AUTOPRELOAD) == 0) m_tim0count &= 0xff; @@ -128,34 +128,34 @@ void fga002_device::device_timer (emu_timer &timer, device_timer_id id, INT32 pa } } break; - default: - LOG(("Unhandled Timer ID %d\n", id)); - break; + default: + LOG(("Unhandled Timer ID %d\n", id)); + break; } } -/* The FGA002 Timer +/* The FGA002 Timer - FEATURES - - 8 bit Synchronous Counter - - 16 selectable clocks with frequencies from 1MHz to 0.5 Hz - - Autopreload and Zerostop operating modes - - Watchdog Timer operation - - SYSFAIL and/or interrupt generation - - Vectored interrupt - - Interrupt levels selectable by software + FEATURES + - 8 bit Synchronous Counter + - 16 selectable clocks with frequencies from 1MHz to 0.5 Hz + - Autopreload and Zerostop operating modes + - Watchdog Timer operation + - SYSFAIL and/or interrupt generation + - Vectored interrupt + - Interrupt levels selectable by software */ -/* Timer Preload Register TIM0PRELOAD - The Timer Preload Register TIM0PRELOAD contains the preset value which can be loaded into the counter circuit. The default - value of this register after reset is $00. The TIM0PRELOAD register can be read at any time but must not be altered if the - timer is running. - [7:0] The Timer Preload register contains the 8 bit value that is loaded into the counter if the - Autopreload option in the TIM0CTL register is selected and the counter reaches the value zero. - Also, if a write access to the TIM0COUNT register is performed, the counter is loaded with the value - stored in the Timer Preload Register. +/* Timer Preload Register TIM0PRELOAD + The Timer Preload Register TIM0PRELOAD contains the preset value which can be loaded into the counter circuit. The default + value of this register after reset is $00. The TIM0PRELOAD register can be read at any time but must not be altered if the + timer is running. + [7:0] The Timer Preload register contains the 8 bit value that is loaded into the counter if the + Autopreload option in the TIM0CTL register is selected and the counter reaches the value zero. + Also, if a write access to the TIM0COUNT register is performed, the counter is loaded with the value + stored in the Timer Preload Register. */ void fga002_device::do_fga002reg_tim0preload_w(UINT8 data) { @@ -169,44 +169,44 @@ UINT8 fga002_device::do_fga002reg_tim0preload_r() return m_fga002[FGA_TIM0PRELOAD]; } -/* Timer Control Register TIM0CTL - In the Timer Control Register TIM0CTL the operating mode and the clock source of the timer can be selected. The Timer - Control Register is grouped into two major fields. Bits 7-4 define the operating mode of the timer and the sysfail option. - Bits 3-0 select the source clock applied to the timer. The TIM0CTL register is cleared to $00 after any reset operation. - [7] Zerostop This bit selects whether the counter stops when reaching zero count or continues counting down. The value the - counter will decrement to next depends on the setting of bit 6 of this register, which is the Autopreload bit. - 1 = The counter continues counting down. - 0 = The counter stops on zero count. - [6] Autopreload This bit selects whether the counter rolls over from $00 to the value $FF and continues counting down or is - preset by the contents of the timer preload register after reaching the zero count. The Autopreload option may be - ignored if the counter is programmed to stop on zero count. - 1 The Autopreload option is enabled. When the counter has passed from $01 to $00, the value stored in the Preload - register will be transferred to the counter on the first clock edge following the zero count clock. After - that transfer the counter continues decrementing from the new value. - 0 The Autopreload option is disabled. After the counter has reached zero it will roll over to the value $FF and - continue counting down. - [5] Sysfail This bit enables/disables the sysfail generation by the timer. If this option is enabled, the SFAILO output pin of the FGA-002 - gate array will be asserted low when the timer triggers the timer interrupt. The sysfail signal is negated when the timer - interrupt is cleared. 1 = enabled 0 = disabled - [4] Start/Stop: This bit controls the timer start and stop operation. 1 = start 0 = stop - [3:0] Clock select This bitfield provides selection of the source clock for timer operation. - 3..0 source clock period - 0000 1 microsecond - 0001 2 microseconds - 0010 4 microseconds - 0011 8 microseconds - 0100 16 microseconds - 0101 32 microseconds - 0110 64 microseconds - 0111 128 microseconds - 1000 256 microseconds - 1001 512 microseconds - 1010 2 milliseconds - 1011 8 milliseconds - 1100 32 milliseconds - 1101 125 milliseconds - 1110 500 milliseconds - 1111 2 seconds +/* Timer Control Register TIM0CTL + In the Timer Control Register TIM0CTL the operating mode and the clock source of the timer can be selected. The Timer + Control Register is grouped into two major fields. Bits 7-4 define the operating mode of the timer and the sysfail option. + Bits 3-0 select the source clock applied to the timer. The TIM0CTL register is cleared to $00 after any reset operation. + [7] Zerostop This bit selects whether the counter stops when reaching zero count or continues counting down. The value the + counter will decrement to next depends on the setting of bit 6 of this register, which is the Autopreload bit. + 1 = The counter continues counting down. + 0 = The counter stops on zero count. + [6] Autopreload This bit selects whether the counter rolls over from $00 to the value $FF and continues counting down or is + preset by the contents of the timer preload register after reaching the zero count. The Autopreload option may be + ignored if the counter is programmed to stop on zero count. + 1 The Autopreload option is enabled. When the counter has passed from $01 to $00, the value stored in the Preload + register will be transferred to the counter on the first clock edge following the zero count clock. After + that transfer the counter continues decrementing from the new value. + 0 The Autopreload option is disabled. After the counter has reached zero it will roll over to the value $FF and + continue counting down. + [5] Sysfail This bit enables/disables the sysfail generation by the timer. If this option is enabled, the SFAILO output pin of the FGA-002 + gate array will be asserted low when the timer triggers the timer interrupt. The sysfail signal is negated when the timer + interrupt is cleared. 1 = enabled 0 = disabled + [4] Start/Stop: This bit controls the timer start and stop operation. 1 = start 0 = stop + [3:0] Clock select This bitfield provides selection of the source clock for timer operation. + 3..0 source clock period + 0000 1 microsecond + 0001 2 microseconds + 0010 4 microseconds + 0011 8 microseconds + 0100 16 microseconds + 0101 32 microseconds + 0110 64 microseconds + 0111 128 microseconds + 1000 256 microseconds + 1001 512 microseconds + 1010 2 milliseconds + 1011 8 milliseconds + 1100 32 milliseconds + 1101 125 milliseconds + 1110 500 milliseconds + 1111 2 seconds */ void fga002_device::do_fga002reg_tim0ctl_w(UINT8 data) @@ -250,12 +250,12 @@ UINT8 fga002_device::do_fga002reg_tim0ctl_r() return m_fga002[FGA_TIM0CTL]; } -/* Timer Count Register TIM0COUNT - The Timer Count Register TIM0COUNT contains the current value of the timer/counter. A write access to this register will - load the counter with the value stored in the Timer Preload Register. The written data will be ignored. - It is permitted to perform read/write accesses to the Timer Count Register when the timer is running. - The Timer Count Register is initialized to the value $FF after reset. - [7:0] Timer Count Value +/* Timer Count Register TIM0COUNT + The Timer Count Register TIM0COUNT contains the current value of the timer/counter. A write access to this register will + load the counter with the value stored in the Timer Preload Register. The written data will be ignored. + It is permitted to perform read/write accesses to the Timer Count Register when the timer is running. + The Timer Count Register is initialized to the value $FF after reset. + [7:0] Timer Count Value */ void fga002_device::do_fga002reg_tim0count_w(UINT8 data) { @@ -269,11 +269,11 @@ UINT8 fga002_device::do_fga002reg_tim0count_r() return m_tim0count; } -/* Timer Interrupt Control Register ICRTIM0 - Timer Interrupt Control is performed by the Timer Interrupt Control Register ICRTIM0 which enables/disables the interrupt - and selects the interrupt level. - [3] IRQ enable, 1 = timer interrupt channel enabled, 0 = disabled - [2:0] IRQ level 000 = interrupt disabled 001-111 = Level 1 to 7 interrupt +/* Timer Interrupt Control Register ICRTIM0 + Timer Interrupt Control is performed by the Timer Interrupt Control Register ICRTIM0 which enables/disables the interrupt + and selects the interrupt level. + [3] IRQ enable, 1 = timer interrupt channel enabled, 0 = disabled + [2:0] IRQ level 000 = interrupt disabled 001-111 = Level 1 to 7 interrupt */ void fga002_device::do_fga002reg_icrtim0_w(UINT8 data) { @@ -287,10 +287,10 @@ UINT8 fga002_device::do_fga002reg_icrtim0_r() return m_fga002[FGA_ICRTIM0]; } -/* Timer Interrupt Status Register ISTIM0 - ISTIM0 displays a pending timer interrupt. This bit is always readable and indicates 0 if the timer interrupt has been triggered. A write access to the - ISTIM0 register clears the timer interrupt. The data written to this register will be ignored. - [7] The IRQ Status register bit displays if a timer interrupt request is pending. 1 = no interrupt is pending. 0 = interrupt is pending +/* Timer Interrupt Status Register ISTIM0 + ISTIM0 displays a pending timer interrupt. This bit is always readable and indicates 0 if the timer interrupt has been triggered. A write access to the + ISTIM0 register clears the timer interrupt. The data written to this register will be ignored. + [7] The IRQ Status register bit displays if a timer interrupt request is pending. 1 = no interrupt is pending. 0 = interrupt is pending [6:0] not used */ void fga002_device::do_fga002reg_istim0_w(UINT8 data) @@ -390,7 +390,7 @@ WRITE8_MEMBER (fga002_device::write){ case FGA_CTL14 : LOG(("FGA_CTL14 - not implemented\n")); m_fga002[FGA_CTL14] = data; break; case FGA_CTL15 : LOG(("FGA_CTL15 - not implemented\n")); m_fga002[FGA_CTL15] = data; break; case FGA_CTL16 : LOG(("FGA_CTL16 - not implemented\n")); m_fga002[FGA_CTL16] = data; break; - case FGA_ISTIM0 : do_fga002reg_istim0_w(data); break; + case FGA_ISTIM0 : do_fga002reg_istim0_w(data); break; case FGA_ISDMANORM : LOG(("FGA_ISDMANORM - not implemented\n")); m_fga002[FGA_ISDMANORM] = data; break; case FGA_ISDMAERR : LOG(("FGA_ISDMAERR - not implemented\n")); m_fga002[FGA_ISDMAERR] = data; break; case FGA_ISFMB0REF : LOG(("FGA_ISFMB0REF - not implemented\n")); m_fga002[FGA_ISFMB0REF] = data; break; @@ -401,7 +401,7 @@ WRITE8_MEMBER (fga002_device::write){ case FGA_ISFMB0MES : LOG(("FGA_ISFMB0MES - not implemented\n")); m_fga002[FGA_ISFMB0MES] = data; break; case FGA_ISFMB1MES : LOG(("FGA_ISFMB1MES - not implemented\n")); m_fga002[FGA_ISFMB1MES] = data; break; case FGA_ABORTPIN : LOG(("FGA_ABORTPIN - not implemented\n")); m_fga002[FGA_ABORTPIN] = data; break; - case FGA_TIM0COUNT : do_fga002reg_tim0count_w(data); break; + case FGA_TIM0COUNT : do_fga002reg_tim0count_w(data); break; default: LOG(("Unsupported register %04x\n", offset)); } @@ -493,7 +493,7 @@ READ8_MEMBER (fga002_device::read){ case FGA_CTL14 : ret = m_fga002[FGA_CTL14]; LOG(("FGA_CTL14 returns %02x - not implemented\n", ret)); break; case FGA_CTL15 : ret = m_fga002[FGA_CTL15]; LOG(("FGA_CTL15 returns %02x - not implemented\n", ret)); break; case FGA_CTL16 : ret = m_fga002[FGA_CTL16]; LOG(("FGA_CTL16 returns %02x - not implemented\n", ret)); break; - case FGA_ISTIM0 : ret = do_fga002reg_istim0_r(); break; + case FGA_ISTIM0 : ret = do_fga002reg_istim0_r(); break; case FGA_ISDMANORM : ret = m_fga002[FGA_ISDMANORM]; LOG(("FGA_ISDMANORM returns %02x - not implemented\n", ret)); break; case FGA_ISDMAERR : ret = m_fga002[FGA_ISDMAERR]; LOG(("FGA_ISDMAERR returns %02x - not implemented\n", ret)); break; case FGA_ISFMB0REF : ret = m_fga002[FGA_ISFMB0REF]; LOG(("FGA_ISFMB0REF returns %02x - not implemented\n", ret)); break; @@ -504,7 +504,7 @@ READ8_MEMBER (fga002_device::read){ case FGA_ISFMB0MES : ret = m_fga002[FGA_ISFMB0MES]; LOG(("FGA_ISFMB0MES returns %02x - not implemented\n", ret)); break; case FGA_ISFMB1MES : ret = m_fga002[FGA_ISFMB1MES]; LOG(("FGA_ISFMB1MES returns %02x - not implemented\n", ret)); break; case FGA_ABORTPIN : ret = m_fga002[FGA_ABORTPIN]; LOG(("FGA_ABORTPIN returns %02x - not implemented\n", ret)); break; - case FGA_TIM0COUNT : ret = do_fga002reg_tim0count_r(); break; + case FGA_TIM0COUNT : ret = do_fga002reg_tim0count_r(); break; default: LOG(("Unsupported register %04x\n", offset)); } diff --git a/src/devices/machine/fga002.h b/src/devices/machine/fga002.h index 80401da5b84..86b7ffc7b4c 100644 --- a/src/devices/machine/fga002.h +++ b/src/devices/machine/fga002.h @@ -5,7 +5,7 @@ #include "emu.h" -#define MCFG_FGA002_ADD(_tag, _clock) MCFG_DEVICE_ADD(_tag, FGA002, _clock) +#define MCFG_FGA002_ADD(_tag, _clock) MCFG_DEVICE_ADD(_tag, FGA002, _clock) //************************************************************************** // TYPE DEFINITIONS @@ -15,19 +15,19 @@ class fga002_device : public device_t { - public: + public: // construction/destruction fga002_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, const char *shortname, const char *source); fga002_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); DECLARE_WRITE8_MEMBER (write); DECLARE_READ8_MEMBER (read); - protected: + protected: // device-level overrides virtual void device_start() override; virtual void device_reset() override; virtual void device_timer (emu_timer &timer, device_timer_id id, int param, void *ptr) override; - private: + private: UINT8 m_tim0count; UINT8 m_fga002[0x500]; @@ -48,128 +48,128 @@ class fga002_device : public device_t TIMER_ID_FGA }; enum { - REG_TIM0CTL_ZERO_STOP = 0x80, - REG_TIM0CTL_AUTOPRELOAD = 0x40, - REG_TIM0CTL_SYSFAIL = 0x20, - REG_TIM0CTL_START_STOP = 0x10, - REG_TIM0CTL_CLK_MSK = 0x0f, - REG_TIM0CTL_CLK_1_MIC = 0x00, - REG_TIM0CTL_CLK_2_MIC = 0x01, - REG_TIM0CTL_CLK_4_MIC = 0x02, - REG_TIM0CTL_CLK_8_MIC = 0x03, - REG_TIM0CTL_CLK_16_MIC = 0x04, - REG_TIM0CTL_CLK_32_MIC = 0x05, - REG_TIM0CTL_CLK_64_MIC = 0x06, - REG_TIM0CTL_CLK_128_MIC = 0x07, - REG_TIM0CTL_CLK_256_MIC = 0x08, - REG_TIM0CTL_CLK_512_MIC = 0x09, - REG_TIM0CTL_CLK_2_MIL = 0x0a, - REG_TIM0CTL_CLK_8_MIL = 0x0b, - REG_TIM0CTL_CLK_32_MIL = 0x0c, - REG_TIM0CTL_CLK_125_MIL = 0x0d, - REG_TIM0CTL_CLK_500_MIL = 0x0e, - REG_TIM0CTL_CLK_2_SEC = 0x0f, + REG_TIM0CTL_ZERO_STOP = 0x80, + REG_TIM0CTL_AUTOPRELOAD = 0x40, + REG_TIM0CTL_SYSFAIL = 0x20, + REG_TIM0CTL_START_STOP = 0x10, + REG_TIM0CTL_CLK_MSK = 0x0f, + REG_TIM0CTL_CLK_1_MIC = 0x00, + REG_TIM0CTL_CLK_2_MIC = 0x01, + REG_TIM0CTL_CLK_4_MIC = 0x02, + REG_TIM0CTL_CLK_8_MIC = 0x03, + REG_TIM0CTL_CLK_16_MIC = 0x04, + REG_TIM0CTL_CLK_32_MIC = 0x05, + REG_TIM0CTL_CLK_64_MIC = 0x06, + REG_TIM0CTL_CLK_128_MIC = 0x07, + REG_TIM0CTL_CLK_256_MIC = 0x08, + REG_TIM0CTL_CLK_512_MIC = 0x09, + REG_TIM0CTL_CLK_2_MIL = 0x0a, + REG_TIM0CTL_CLK_8_MIL = 0x0b, + REG_TIM0CTL_CLK_32_MIL = 0x0c, + REG_TIM0CTL_CLK_125_MIL = 0x0d, + REG_TIM0CTL_CLK_500_MIL = 0x0e, + REG_TIM0CTL_CLK_2_SEC = 0x0f, }; enum { - REG_ISTIM0_TIM_INT = 0x80, + REG_ISTIM0_TIM_INT = 0x80, }; /* Register offsets */ enum { - FGA_ICRMBOX0 = 0x0000, - FGA_ICRMBOX1 = 0x0004, - FGA_ICRMBOX2 = 0x0008, - FGA_ICRMBOX3 = 0x000c, - FGA_ICRMBOX4 = 0x0010, - FGA_ICRMBOX5 = 0x0014, - FGA_ICRMBOX6 = 0x0018, - FGA_ICRMBOX7 = 0x001C, - FGA_VMEPAGE = 0x0200, - FGA_ICRVME1 = 0x0204, - FGA_ICRVME2 = 0x0208, - FGA_ICRVME3 = 0x020c, - FGA_ICRVME4 = 0x0210, - FGA_ICRVME5 = 0x0214, - FGA_ICRVME6 = 0x0218, - FGA_ICRVME7 = 0x021c, - FGA_ICRTIM0 = 0x0220, - FGA_ICRDMANORM = 0x0230, - FGA_ICRDMAERR = 0x0234, - FGA_CTL1 = 0x0238, - FGA_CTL2 = 0x023c, - FGA_ICRFMB0REF = 0x0240, - FGA_ICRFMB1REF = 0x0244, - FGA_ICRFMB0MES = 0x0248, - FGA_ICRFMB1MES = 0x024c, - FGA_CTL3 = 0x0250, - FGA_CTL4 = 0x0254, - FGA_ICRPARITY = 0x0258, - FGA_AUXPINCTL = 0x0260, - FGA_CTL5 = 0x0264, - FGA_AUXFIFWEX = 0x0268, - FGA_AUXFIFREX = 0x026c, - FGA_CTL6 = 0x0270, - FGA_CTL7 = 0x0274, - FGA_CTL8 = 0x0278, - FGA_CTL9 = 0x027c, - FGA_ICRABORT = 0x0280, - FGA_ICRACFAIL = 0x0284, - FGA_ICRSYSFAIL = 0x0288, - FGA_ICRLOCAL0 = 0x028c, - FGA_ICRLOCAL1 = 0x0290, - FGA_ICRLOCAL2 = 0x0294, - FGA_ICRLOCAL3 = 0x0298, - FGA_ICRLOCAL4 = 0x029c, - FGA_ICRLOCAL5 = 0x02a0, - FGA_ICRLOCAL6 = 0x02a4, - FGA_ICRLOCAL7 = 0x02a8, - FGA_ENAMCODE = 0x02b4, - FGA_CTL10 = 0x02c0, - FGA_CTL11 = 0x02c4, - FGA_MAINUM = 0x02c8, - FGA_MAINUU = 0x02cc, + FGA_ICRMBOX0 = 0x0000, + FGA_ICRMBOX1 = 0x0004, + FGA_ICRMBOX2 = 0x0008, + FGA_ICRMBOX3 = 0x000c, + FGA_ICRMBOX4 = 0x0010, + FGA_ICRMBOX5 = 0x0014, + FGA_ICRMBOX6 = 0x0018, + FGA_ICRMBOX7 = 0x001C, + FGA_VMEPAGE = 0x0200, + FGA_ICRVME1 = 0x0204, + FGA_ICRVME2 = 0x0208, + FGA_ICRVME3 = 0x020c, + FGA_ICRVME4 = 0x0210, + FGA_ICRVME5 = 0x0214, + FGA_ICRVME6 = 0x0218, + FGA_ICRVME7 = 0x021c, + FGA_ICRTIM0 = 0x0220, + FGA_ICRDMANORM = 0x0230, + FGA_ICRDMAERR = 0x0234, + FGA_CTL1 = 0x0238, + FGA_CTL2 = 0x023c, + FGA_ICRFMB0REF = 0x0240, + FGA_ICRFMB1REF = 0x0244, + FGA_ICRFMB0MES = 0x0248, + FGA_ICRFMB1MES = 0x024c, + FGA_CTL3 = 0x0250, + FGA_CTL4 = 0x0254, + FGA_ICRPARITY = 0x0258, + FGA_AUXPINCTL = 0x0260, + FGA_CTL5 = 0x0264, + FGA_AUXFIFWEX = 0x0268, + FGA_AUXFIFREX = 0x026c, + FGA_CTL6 = 0x0270, + FGA_CTL7 = 0x0274, + FGA_CTL8 = 0x0278, + FGA_CTL9 = 0x027c, + FGA_ICRABORT = 0x0280, + FGA_ICRACFAIL = 0x0284, + FGA_ICRSYSFAIL = 0x0288, + FGA_ICRLOCAL0 = 0x028c, + FGA_ICRLOCAL1 = 0x0290, + FGA_ICRLOCAL2 = 0x0294, + FGA_ICRLOCAL3 = 0x0298, + FGA_ICRLOCAL4 = 0x029c, + FGA_ICRLOCAL5 = 0x02a0, + FGA_ICRLOCAL6 = 0x02a4, + FGA_ICRLOCAL7 = 0x02a8, + FGA_ENAMCODE = 0x02b4, + FGA_CTL10 = 0x02c0, + FGA_CTL11 = 0x02c4, + FGA_MAINUM = 0x02c8, + FGA_MAINUU = 0x02cc, FGA_BOTTOMPAGEU = 0x02d0, FGA_BOTTOMPAGEL = 0x02d4, - FGA_TOPPAGEU = 0x02d8, - FGA_TOPPAGEL = 0x02dc, - FGA_MYVMEPAGE = 0x02fc, + FGA_TOPPAGEU = 0x02d8, + FGA_TOPPAGEL = 0x02dc, + FGA_MYVMEPAGE = 0x02fc, FGA_TIM0PRELOAD = 0x0300, - FGA_TIM0CTL = 0x0310, - FGA_DMASRCATT = 0x0320, - FGA_DMADSTATT = 0x0324, - FGA_DMA_GENERAL = 0x0328, - FGA_CTL12 = 0x032c, - FGA_LIOTIMING = 0x0330, - FGA_LOCALIACK = 0x0334, - FGA_FMBCTL = 0x0338, - FGA_FMBAREA = 0x033c, + FGA_TIM0CTL = 0x0310, + FGA_DMASRCATT = 0x0320, + FGA_DMADSTATT = 0x0324, + FGA_DMA_GENERAL = 0x0328, + FGA_CTL12 = 0x032c, + FGA_LIOTIMING = 0x0330, + FGA_LOCALIACK = 0x0334, + FGA_FMBCTL = 0x0338, + FGA_FMBAREA = 0x033c, FGA_AUXSRCSTART = 0x0340, FGA_AUXDSTSTART = 0x0344, - FGA_AUXSRCTERM = 0x0348, - FGA_AUXDSTTERM = 0x034c, - FGA_CTL13 = 0x0350, - FGA_CTL14 = 0x0354, - FGA_CTL15 = 0x0358, - FGA_CTL16 = 0x035c, - FGA_SPECIALENA = 0x0424, - FGA_ISTIM0 = 0x04a0, - FGA_ISDMANORM = 0x04b0, - FGA_ISDMAERR = 0x04b4, - FGA_ISFMB0REF = 0x04b8, - FGA_ISFMB1REF = 0x04bc, - FGA_ISPARITY = 0x04c0, - FGA_DMARUNCTL = 0x04c4, - FGA_ISABORT = 0x04c8, - FGA_ISACFAIL = 0x04cc, - FGA_ISFMB0MES = 0x04e0, - FGA_ISFMB1MES = 0x04e4, - FGA_ISSYSFAIL = 0x04d0, - FGA_ABORTPIN = 0x04d4, - FGA_RSVMECALL = 0x04f0, - FGA_RSKEYRES = 0x04f4, - FGA_RSCPUCALL = 0x04f8, - FGA_RSLOCSW = 0x04fc, - FGA_TIM0COUNT = 0x0c00, + FGA_AUXSRCTERM = 0x0348, + FGA_AUXDSTTERM = 0x034c, + FGA_CTL13 = 0x0350, + FGA_CTL14 = 0x0354, + FGA_CTL15 = 0x0358, + FGA_CTL16 = 0x035c, + FGA_SPECIALENA = 0x0424, + FGA_ISTIM0 = 0x04a0, + FGA_ISDMANORM = 0x04b0, + FGA_ISDMAERR = 0x04b4, + FGA_ISFMB0REF = 0x04b8, + FGA_ISFMB1REF = 0x04bc, + FGA_ISPARITY = 0x04c0, + FGA_DMARUNCTL = 0x04c4, + FGA_ISABORT = 0x04c8, + FGA_ISACFAIL = 0x04cc, + FGA_ISFMB0MES = 0x04e0, + FGA_ISFMB1MES = 0x04e4, + FGA_ISSYSFAIL = 0x04d0, + FGA_ABORTPIN = 0x04d4, + FGA_RSVMECALL = 0x04f0, + FGA_RSKEYRES = 0x04f4, + FGA_RSCPUCALL = 0x04f8, + FGA_RSLOCSW = 0x04fc, + FGA_TIM0COUNT = 0x0c00, }; }; @@ -178,4 +178,3 @@ class fga002_device : public device_t // device type definition extern const device_type FGA002; #endif // __FGA002_H__ - diff --git a/src/devices/machine/hp_taco.cpp b/src/devices/machine/hp_taco.cpp index 4938d2f4c4b..adb369c59f2 100644 --- a/src/devices/machine/hp_taco.cpp +++ b/src/devices/machine/hp_taco.cpp @@ -183,8 +183,8 @@ enum { #define SHORT_GAP_LENGTH ((tape_pos_t)(0.066 * ONE_INCH_POS)) // Minimum length of short gaps: 0.066" ([1], pg 8-10) #define LONG_GAP_LENGTH ((tape_pos_t)(1.5 * ONE_INCH_POS)) // Minimum length of long gaps: 1.5" ([1], pg 8-10) #define NULL_TAPE_POS ((tape_pos_t)-1) // Special value for invalid/unknown tape position -#define PREAMBLE_TIMEOUT ((tape_pos_t)(2.6 * ONE_INCH_POS)) // Min. length of gap making preamble search time out (totally made up) -#define DATA_TIMEOUT ((tape_pos_t)(0.066 * ONE_INCH_POS)) // Min. length of gap that will cause data reading to time out (totally made up) +#define PREAMBLE_TIMEOUT ((tape_pos_t)(2.6 * ONE_INCH_POS)) // Min. length of gap making preamble search time out (totally made up) +#define DATA_TIMEOUT ((tape_pos_t)(0.066 * ONE_INCH_POS)) // Min. length of gap that will cause data reading to time out (totally made up) #define FILE_MAGIC 0x4f434154 // Magic value at start of image file: "TACO" // Parts of command register diff --git a/src/devices/machine/input_merger.cpp b/src/devices/machine/input_merger.cpp index d75a3f994d2..ceedca5d556 100644 --- a/src/devices/machine/input_merger.cpp +++ b/src/devices/machine/input_merger.cpp @@ -64,8 +64,8 @@ void input_merger_device::device_start() // input_merger_active_high_device - constructor //------------------------------------------------- -input_merger_active_high_device::input_merger_active_high_device(machine_config const &mconfig, char const *tag, device_t *owner, UINT32 clock) - : input_merger_device(mconfig, INPUT_MERGER_ACTIVE_HIGH, "Input Merger (Active High)", tag, owner, clock, "input_merger_hi", __FILE__) +input_merger_active_high_device::input_merger_active_high_device(machine_config const &mconfig, char const *tag, device_t *owner, UINT32 clock) + : input_merger_device(mconfig, INPUT_MERGER_ACTIVE_HIGH, "Input Merger (Active High)", tag, owner, clock, "input_merger_hi", __FILE__) { } @@ -97,8 +97,8 @@ void input_merger_active_high_device::update_state() // input_merger_active_low_device - constructor //------------------------------------------------- -input_merger_active_low_device::input_merger_active_low_device(machine_config const &mconfig, char const *tag, device_t *owner, UINT32 clock) - : input_merger_device(mconfig, INPUT_MERGER_ACTIVE_LOW, "Input Merger (Active Low)", tag, owner, clock, "input_merger_lo", __FILE__) +input_merger_active_low_device::input_merger_active_low_device(machine_config const &mconfig, char const *tag, device_t *owner, UINT32 clock) + : input_merger_device(mconfig, INPUT_MERGER_ACTIVE_LOW, "Input Merger (Active Low)", tag, owner, clock, "input_merger_lo", __FILE__) { } diff --git a/src/devices/machine/input_merger.h b/src/devices/machine/input_merger.h index 9ede71f2ab8..c649d723b55 100644 --- a/src/devices/machine/input_merger.h +++ b/src/devices/machine/input_merger.h @@ -2,7 +2,7 @@ // copyright-holders:Dirk Best /*************************************************************************** - Input Merger + Input Merger Used to connect multiple lines to a single device input while keeping it pulled high or low diff --git a/src/devices/machine/keyboard.cpp b/src/devices/machine/keyboard.cpp index d801bbf7dcf..099767399f3 100644 --- a/src/devices/machine/keyboard.cpp +++ b/src/devices/machine/keyboard.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:smf +// copyright-holders:Vas Crabb /*************************************************************************** Generic ASCII Keyboard @@ -24,378 +24,349 @@ WRITE8_MEMBER( xxx_state::kbd_put ) ***************************************************************************/ -#include "machine/keyboard.h" +#include "machine/keyboard.ipp" + + + +namespace { +UINT8 const TRANSLATION_TABLE[][2][4][16] = { + { + { // ANSI + { '`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0x08U, 0x7fU, 0x1bU }, + { 0x09U, 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\\', 0xffU, 0xffU }, + { 0xffU, 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', 0x0dU, 0xffU, 0xffU, 0x0aU }, + { 0xffU, '\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 0xffU, 0xffU, 0xffU, ' ' } + }, + { // JIS + { '\\', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '^', 0x08U, 0x7fU, 0x1bU }, + { 0x09U, 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '@', '[', ']', 0xffU, 0xffU }, + { 0xffU, 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', ':', 0x0dU, 0xffU, 0xffU, 0x0aU }, + { 0xffU, '\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 0xffU, 0xffU, 0xffU, ' ' } + } + }, + { + { // ANSI shift + { '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', 0x08U, 0x7fU, 0x1bU }, + { 0x09U, 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', '|', 0xffU, 0xffU }, + { 0xffU, 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', 0x0dU, 0xffU, 0xffU, 0x0aU }, + { 0xffU, '_', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?', 0xffU, 0xffU, 0xffU, ' ' } + }, + { // JIS shift + { '|', '!', '"', '#', '$', '%', '&', '\'', '(', ')', 0xffU, '=', '~', 0x08U, 0x7fU, 0x1bU }, + { 0x09U, 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '`', '{', '}', 0xffU, 0xffU }, + { 0xffU, 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', '+', '*', 0x0dU, 0xffU, 0xffU, 0x0aU }, + { 0xffU, '_', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?', 0xffU, 0xffU, 0xffU, ' ' } + } + }, + { + { // ANSI ctrl + { 0x00U, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 0x1fU, 0x1eU, 0x08U, 0x7fU, 0x1bU }, + { 0x09U, 0x11U, 0x17U, 0x05U, 0x12U, 0x14U, 0x19U, 0x15U, 0x09U, 0x0fU, 0x10U, 0x1bU, 0x1dU, 0x1cU, 0xffU, 0xffU }, + { 0xffU, 0x01U, 0x13U, 0x04U, 0x06U, 0x07U, 0x08U, 0x0aU, 0x0bU, 0x0cU, ';', '\'', 0x0dU, 0xffU, 0xffU, 0x0aU }, + { 0xffU, 0x1cU, 0x1aU, 0x18U, 0x03U, 0x16U, 0x02U, 0x0eU, 0x0dU, ',', '.', 0x1fU, 0xffU, 0xffU, 0xffU, 0x00U } + }, + { // JIS ctrl + { 0x1cU, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 0x1fU, 0x1eU, 0x08U, 0x7fU, 0x1bU }, + { 0x09U, 0x11U, 0x17U, 0x05U, 0x12U, 0x14U, 0x19U, 0x15U, 0x09U, 0x0fU, 0x10U, 0x00U, 0x1bU, 0x1dU, 0xffU, 0xffU }, + { 0xffU, 0x01U, 0x13U, 0x04U, 0x06U, 0x07U, 0x08U, 0x0aU, 0x0bU, 0x0cU, ';', ':', 0x0dU, 0xffU, 0xffU, 0x0aU }, + { 0xffU, 0x1cU, 0x1aU, 0x18U, 0x03U, 0x16U, 0x02U, 0x0eU, 0x0dU, ',', '.', 0x1fU, 0xffU, 0xffU, 0xffU, 0x00U } + } + } +}; + + +bool const CAPS_TABLE[4][16] = { + { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false }, + { false, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false }, + { false, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false }, + { false, false, true, true, true, true, true, true, true, false, false, false, false, false, false, false } +}; + +} // anonymous namespace + + + +/*************************************************************************** + REUSABLE I/O PORTS +***************************************************************************/ + +INPUT_PORTS_START( generic_keyboard ) + PORT_START("GENKBD_CFG") + PORT_CONFNAME( 0x0001U, 0x0000U, "Layout" ) + PORT_CONFSETTING( 0x0000U, "ANSI" ) + PORT_CONFSETTING( 0x0001U, "JIS" ) + PORT_CONFNAME( 0x0006U, 0x0004U, "Typematic Delay" ) + PORT_CONFSETTING( 0x0000U, "0.25s" ) + PORT_CONFSETTING( 0x0002U, "0.5s" ) + PORT_CONFSETTING( 0x0004U, "0.75s" ) + PORT_CONFSETTING( 0x0006U, "1.0s" ) + PORT_CONFNAME( 0x00f8U, 0x0098U, "Typematic Rate" ) + PORT_CONFSETTING( 0x0000U, "2.0cps" ) + PORT_CONFSETTING( 0x0008U, "2.1cps" ) + PORT_CONFSETTING( 0x0010U, "2.5cps" ) + PORT_CONFSETTING( 0x0018U, "2.7cps" ) + PORT_CONFSETTING( 0x0020U, "2.0cps" ) + PORT_CONFSETTING( 0x0028U, "2.1cps" ) + PORT_CONFSETTING( 0x0030U, "2.5cps" ) + PORT_CONFSETTING( 0x0038U, "2.7cps" ) + PORT_CONFSETTING( 0x0040U, "3.3cps" ) + PORT_CONFSETTING( 0x0048U, "3.8cps" ) + PORT_CONFSETTING( 0x0050U, "4.0cps" ) + PORT_CONFSETTING( 0x0058U, "4.3cps" ) + PORT_CONFSETTING( 0x0060U, "4.6cps" ) + PORT_CONFSETTING( 0x0068U, "5.0cps" ) + PORT_CONFSETTING( 0x0070U, "5.5cps" ) + PORT_CONFSETTING( 0x0078U, "6.0cps" ) + PORT_CONFSETTING( 0x0080U, "8.0cps" ) + PORT_CONFSETTING( 0x0088U, "8.6cps" ) + PORT_CONFSETTING( 0x0090U, "9.2cps" ) + PORT_CONFSETTING( 0x0098U, "10.0cps" ) + PORT_CONFSETTING( 0x00a0U, "10.9cps" ) + PORT_CONFSETTING( 0x00a8U, "12.0cps" ) + PORT_CONFSETTING( 0x00b0U, "13.3cps" ) + PORT_CONFSETTING( 0x00b8U, "15.0cps" ) + PORT_CONFSETTING( 0x00c0U, "16.0cps" ) + PORT_CONFSETTING( 0x00c8U, "17.1cps" ) + PORT_CONFSETTING( 0x00d0U, "18.5cps" ) + PORT_CONFSETTING( 0x00d8U, "20.0cps" ) + PORT_CONFSETTING( 0x00e0U, "21.8cps" ) + PORT_CONFSETTING( 0x00e8U, "24.0cps" ) + PORT_CONFSETTING( 0x00f0U, "26.7cps" ) + PORT_CONFSETTING( 0x00f8U, "30.0cps" ) + + PORT_START("GENKBD_MOD") + PORT_BIT( 0x01U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x02U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x04U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT( 0x08U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Meta") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) + + PORT_START("GENKBD_ROW0") + PORT_BIT( 0x0001U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x00) PORT_CHAR('`') PORT_CHAR('~') + PORT_BIT( 0x0001U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x01) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x0002U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x0004U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x00) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x0004U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x01) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x0008U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x0010U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x0020U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x0040U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x00) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT( 0x0040U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x01) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x0080U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x00) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT( 0x0080U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x01) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x0100U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x00) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT( 0x0100U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x01) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x0200U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x00) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x0200U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x01) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x0400U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x00) PORT_CHAR('0') PORT_CHAR('(') + PORT_BIT( 0x0400U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x01) PORT_CHAR('0') + PORT_BIT( 0x0800U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x00) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT( 0x0800U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x01) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x1000U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x00) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT( 0x1000U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x01) PORT_CHAR('^') PORT_CHAR('~') + PORT_BIT( 0x2000U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Backspace") PORT_CHAR(0x08U) + PORT_BIT( 0x4000U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_NAME("Del") PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT( 0x8000U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_NAME("Escape") PORT_CHAR(UCHAR_MAMEKEY(ESC)) + + PORT_START("GENKBD_ROW1") + PORT_BIT( 0x0001U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') + PORT_BIT( 0x0002U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT( 0x0004U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x0008U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x0010U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x0020U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x0040U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x0080U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x0100U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x0200U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x0400U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x0800U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x00) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x0800U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x01) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT( 0x1000U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x00) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x1000U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x01) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x2000U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x00) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x2000U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x01) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x4000U, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x8000U, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("GENKBD_ROW2") + PORT_BIT( 0x0001U, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0002U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('Q') + PORT_BIT( 0x0004U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('W') + PORT_BIT( 0x0008U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('E') + PORT_BIT( 0x0010U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('R') + PORT_BIT( 0x0020U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('T') + PORT_BIT( 0x0040U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('Y') + PORT_BIT( 0x0080U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('U') + PORT_BIT( 0x0100U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('I') + PORT_BIT( 0x0200U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('O') + PORT_BIT( 0x0400U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x00) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT( 0x0400U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x01) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x0800U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x00) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT( 0x0800U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CONDITION("GENKBD_CFG", 0x01, EQUALS, 0x01) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x1000U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Return") PORT_CHAR(0x0dU) + PORT_BIT( 0x2000U, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x4000U, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x8000U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_INSERT) PORT_NAME("Linefeed") PORT_CHAR(UCHAR_MAMEKEY(INSERT)) + + PORT_START("GENKBD_ROW3") + PORT_BIT( 0x0001U, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x0002U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('_') + PORT_BIT( 0x0004U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x0008U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x0010U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x0020U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x0040U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x0080U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x0100U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x0200U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x0400U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x0800U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x1000U, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x2000U, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x4000U, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x8000U, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') +INPUT_PORTS_END + + + +/*************************************************************************** + DEVICE TYPE GLOBALS +***************************************************************************/ + +device_type const GENERIC_KEYBOARD = &device_creator<generic_keyboard_device>; + + /*************************************************************************** IMPLEMENTATION ***************************************************************************/ +generic_keyboard_device::generic_keyboard_device( + machine_config const &mconfig, + device_type type, + char const *name, + char const *tag, + device_t *owner, + UINT32 clock, + char const *shortname, + char const *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source) + , device_matrix_keyboard_interface(mconfig, *this, "GENKBD_ROW0", "GENKBD_ROW1", "GENKBD_ROW2", "GENKBD_ROW3") + , m_config(*this, "GENKBD_CFG") + , m_modifiers(*this, "GENKBD_MOD") + , m_last_modifiers(0U) + , m_keyboard_cb(*this) +{ +} + -generic_keyboard_device::generic_keyboard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) - : device_t(mconfig, type, name, tag, owner, clock, shortname, source), - m_io_kbd0(*this, "TERM_LINE0"), - m_io_kbd1(*this, "TERM_LINE1"), - m_io_kbd2(*this, "TERM_LINE2"), - m_io_kbd3(*this, "TERM_LINE3"), - m_io_kbd4(*this, "TERM_LINE4"), - m_io_kbd5(*this, "TERM_LINE5"), - m_io_kbd6(*this, "TERM_LINE6"), - m_io_kbd7(*this, "TERM_LINE7"), - m_io_kbd8(*this, "TERM_LINE8"), - m_io_kbd9(*this, "TERM_LINE9"), - m_io_kbdc(*this, "TERM_LINEC"), - m_timer(nullptr), - m_last_code(0), - m_scan_line(0), - m_keyboard_cb(*this) +generic_keyboard_device::generic_keyboard_device(machine_config const &mconfig, char const *tag, device_t *owner, UINT32 clock) + : generic_keyboard_device(mconfig, GENERIC_KEYBOARD, "Generic Keyboard", tag, owner, clock, "generic_keyboard", __FILE__) { } -generic_keyboard_device::generic_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, GENERIC_KEYBOARD, "Generic Keyboard", tag, owner, clock, "generic_keyboard", __FILE__), - m_io_kbd0(*this, "TERM_LINE0"), - m_io_kbd1(*this, "TERM_LINE1"), - m_io_kbd2(*this, "TERM_LINE2"), - m_io_kbd3(*this, "TERM_LINE3"), - m_io_kbd4(*this, "TERM_LINE4"), - m_io_kbd5(*this, "TERM_LINE5"), - m_io_kbd6(*this, "TERM_LINE6"), - m_io_kbd7(*this, "TERM_LINE7"), - m_io_kbd8(*this, "TERM_LINE8"), - m_io_kbd9(*this, "TERM_LINE9"), - m_io_kbdc(*this, "TERM_LINEC"), - m_timer(nullptr), - m_last_code(0), - m_scan_line(0), - m_keyboard_cb(*this) + +ioport_constructor generic_keyboard_device::device_input_ports() const { + return INPUT_PORTS_NAME(generic_keyboard); } -UINT8 generic_keyboard_device::row_number(UINT8 code) +void generic_keyboard_device::device_start() { - if BIT(code,0) return 0; - if BIT(code,1) return 1; - if BIT(code,2) return 2; - if BIT(code,3) return 3; - if BIT(code,4) return 4; - if BIT(code,5) return 5; - if BIT(code,6) return 6; - if BIT(code,7) return 7; - return 0; + m_keyboard_cb.resolve_safe(); + + save_item(NAME(m_last_modifiers)); } -UINT8 generic_keyboard_device::keyboard_handler(UINT8 last_code, UINT8 *scan_line) + +void generic_keyboard_device::device_reset() { - int i; - UINT8 code = 0; - UINT8 key_code = 0; - UINT8 retVal = 0; - UINT8 shift = BIT(m_io_kbdc->read(), 1); - UINT8 caps = BIT(m_io_kbdc->read(), 2); - UINT8 ctrl = BIT(m_io_kbdc->read(), 0); - i = *scan_line; - { - if (i == 0) code = m_io_kbd0->read(); - else - if (i == 1) code = m_io_kbd1->read(); - else - if (i == 2) code = m_io_kbd2->read(); - else - if (i == 3) code = m_io_kbd3->read(); - else - if (i == 4) code = m_io_kbd4->read(); - else - if (i == 5) code = m_io_kbd5->read(); - else - if (i == 6) code = m_io_kbd6->read(); - else - if (i == 7) code = m_io_kbd7->read(); - else - if (i == 8) code = m_io_kbd8->read(); - else - if (i == 9) code = m_io_kbd9->read(); - - if (code != 0) - { - if (i==0 && shift==0) { - key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs - } - if (i==0 && shift==1) { - key_code = 0x20 + row_number(code) + 8*i; // for shifted numbers - } - if (i==1 && shift==0) { - if (row_number(code) < 4) { - key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs - } else { - key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs - } - } - if (i==1 && shift==1) { - if (row_number(code) < 4) { - key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs - } else { - key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs - } - } - if (i>=2 && i<=4 && (shift ^ caps)==0 && ctrl==0) { - key_code = 0x60 + row_number(code) + (i-2)*8; // for small letters - } - if (i>=2 && i<=4 && (shift ^ caps)==1 && ctrl==0) { - key_code = 0x40 + row_number(code) + (i-2)*8; // for big letters - } - if (i>=2 && i<=5 && ctrl==1) { - key_code = 0x00 + row_number(code) + (i-2)*8; // for CTRL + letters - } - if (i==5 && shift==1 && ctrl==0) { - if (row_number(code)<7) { - if (row_number(code)<3) { - key_code = (caps ? 0x60 : 0x40) + row_number(code) + (i-2)*8; // for big letters - } else { - key_code = 0x60 + row_number(code) + (i-2)*8; // for upper symbols letters - } - } else { - key_code = 0x40 + row_number(code) + (i-2)*8; // for DEL it is switched - } - } - if (i==5 && shift==0 && ctrl==0) { - if (row_number(code)<7) { - if (row_number(code)<3) { - key_code = (caps ? 0x40 : 0x60) + row_number(code) + (i-2)*8; // for small letters - } else { - key_code = 0x40 + row_number(code) + (i-2)*8; // for lower symbols letters - } - } else { - key_code = 0x60 + row_number(code) + (i-2)*8; // for DEL it is switched - } - } - - if (i==6) { - switch(row_number(code)) - { -/* case 0: key_code = 0x11; break; - case 1: key_code = 0x12; break; - case 2: key_code = 0x13; break; - case 3: key_code = 0x14; break;*/ - case 4: key_code = 0x20; break; // Space - case 5: key_code = 0x0A; break; // LineFeed - case 6: key_code = 0x09; break; // TAB - case 7: key_code = 0x0D; break; // Enter - } - } - if (i==7) - { - switch(row_number(code)) - { - case 0: key_code = 0x1B; break; // Escape - case 1: key_code = 0x08; break; // Backspace - } - } - else - if (i==8) - { - key_code = row_number(code)+0x81; - if (ctrl) key_code+=0x10; - if (shift) key_code+=0x20; - } - else - if (i==9) - { - key_code = row_number(code)+0x89; - if (ctrl) key_code+=0x10; - if (shift) key_code+=0x20; - } - - retVal = key_code; - } - else - { - *scan_line += 1; - if (*scan_line==10) - *scan_line = 0; - } - } - return retVal; + reset_key_state(); + m_last_modifiers = 0; + + start_processing(attotime::from_hz(2'400)); + typematic_stop(); } + void generic_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - UINT8 new_code; - new_code = keyboard_handler(m_last_code, &m_scan_line); - if ((m_last_code != new_code) && (new_code)) - send_key(new_code); - m_last_code = new_code; + device_matrix_keyboard_interface::device_timer(timer, id, param, ptr); } -/*************************************************************************** - VIDEO HARDWARE -***************************************************************************/ -static MACHINE_CONFIG_FRAGMENT( generic_keyboard ) -MACHINE_CONFIG_END +void generic_keyboard_device::key_make(UINT8 row, UINT8 column) +{ + send_translated((row << 4) | column); + typematic_start(row, column, typematic_delay(), typematic_period()); +} + -machine_config_constructor generic_keyboard_device::device_mconfig_additions() const +void generic_keyboard_device::key_repeat(UINT8 row, UINT8 column) { - return MACHINE_CONFIG_NAME(generic_keyboard); + send_translated((row << 4) | column); } -void generic_keyboard_device::device_start() + +void generic_keyboard_device::send_key(UINT8 code) { - m_keyboard_cb.resolve_safe(); - m_timer = timer_alloc(); - save_item(NAME(m_last_code)); - save_item(NAME(m_scan_line)); + m_keyboard_cb(offs_t(0), code); } -void generic_keyboard_device::device_reset() + +bool generic_keyboard_device::translate(UINT8 code, UINT8 &translated) const { - m_last_code = 0; - m_scan_line = 0; - m_timer->adjust(attotime::from_hz(2400), 0, attotime::from_hz(2400)); + unsigned const row((code >> 4) & 0x03U); + unsigned const col((code >> 0) & 0x0fU); + + unsigned const layout(m_config->read() & 0x0001U); + + UINT16 const modifiers(m_modifiers->read()); + bool const shift(bool(modifiers & 0x02U) != (bool(modifiers & 0x04U) && CAPS_TABLE[row][col])); + bool const ctrl(modifiers & 0x01U); + bool const meta(modifiers & 0x08U); + + unsigned const map(ctrl ? 2U : shift ? 1U : 0U); + UINT8 const result(TRANSLATION_TABLE[map][layout][row][col]); + if (result == UINT8(~0U)) + { + return false; + } + else + { + translated = result | (meta ? 0x80U : 0x00U); + return true; + } } -/* -Char Dec Oct Hex | Char Dec Oct Hex | Char Dec Oct Hex | Char Dec Oct Hex -------------------------------------------------------------------------------------- -(nul) 0 0000 0x00 | (sp) 32 0040 0x20 | @ 64 0100 0x40 | ` 96 0140 0x60 -(soh) 1 0001 0x01 | ! 33 0041 0x21 | A 65 0101 0x41 | a 97 0141 0x61 -(stx) 2 0002 0x02 | " 34 0042 0x22 | B 66 0102 0x42 | b 98 0142 0x62 -(etx) 3 0003 0x03 | # 35 0043 0x23 | C 67 0103 0x43 | c 99 0143 0x63 -(eot) 4 0004 0x04 | $ 36 0044 0x24 | D 68 0104 0x44 | d 100 0144 0x64 -(enq) 5 0005 0x05 | % 37 0045 0x25 | E 69 0105 0x45 | e 101 0145 0x65 -(ack) 6 0006 0x06 | & 38 0046 0x26 | F 70 0106 0x46 | f 102 0146 0x66 -(bel) 7 0007 0x07 | ' 39 0047 0x27 | G 71 0107 0x47 | g 103 0147 0x67 -(bs) 8 0010 0x08 | ( 40 0050 0x28 | H 72 0110 0x48 | h 104 0150 0x68 -(ht) 9 0011 0x09 | ) 41 0051 0x29 | I 73 0111 0x49 | i 105 0151 0x69 -(nl) 10 0012 0x0a | * 42 0052 0x2a | J 74 0112 0x4a | j 106 0152 0x6a -(vt) 11 0013 0x0b | + 43 0053 0x2b | K 75 0113 0x4b | k 107 0153 0x6b -(np) 12 0014 0x0c | , 44 0054 0x2c | L 76 0114 0x4c | l 108 0154 0x6c -(cr) 13 0015 0x0d | - 45 0055 0x2d | M 77 0115 0x4d | m 109 0155 0x6d -(so) 14 0016 0x0e | . 46 0056 0x2e | N 78 0116 0x4e | n 110 0156 0x6e -(si) 15 0017 0x0f | / 47 0057 0x2f | O 79 0117 0x4f | o 111 0157 0x6f -(dle) 16 0020 0x10 | 0 48 0060 0x30 | P 80 0120 0x50 | p 112 0160 0x70 -(dc1) 17 0021 0x11 | 1 49 0061 0x31 | Q 81 0121 0x51 | q 113 0161 0x71 -(dc2) 18 0022 0x12 | 2 50 0062 0x32 | R 82 0122 0x52 | r 114 0162 0x72 -(dc3) 19 0023 0x13 | 3 51 0063 0x33 | S 83 0123 0x53 | s 115 0163 0x73 -(dc4) 20 0024 0x14 | 4 52 0064 0x34 | T 84 0124 0x54 | t 116 0164 0x74 -(nak) 21 0025 0x15 | 5 53 0065 0x35 | U 85 0125 0x55 | u 117 0165 0x75 -(syn) 22 0026 0x16 | 6 54 0066 0x36 | V 86 0126 0x56 | v 118 0166 0x76 -(etb) 23 0027 0x17 | 7 55 0067 0x37 | W 87 0127 0x57 | w 119 0167 0x77 -(can) 24 0030 0x18 | 8 56 0070 0x38 | X 88 0130 0x58 | x 120 0170 0x78 -(em) 25 0031 0x19 | 9 57 0071 0x39 | Y 89 0131 0x59 | y 121 0171 0x79 -(sub) 26 0032 0x1a | : 58 0072 0x3a | Z 90 0132 0x5a | z 122 0172 0x7a -(esc) 27 0033 0x1b | ; 59 0073 0x3b | [ 91 0133 0x5b | { 123 0173 0x7b -(fs) 28 0034 0x1c | < 60 0074 0x3c | \ 92 0134 0x5c | | 124 0174 0x7c -(gs) 29 0035 0x1d | = 61 0075 0x3d | ] 93 0135 0x5d | } 125 0175 0x7d -(rs) 30 0036 0x1e | > 62 0076 0x3e | ^ 94 0136 0x5e | ~ 126 0176 0x7e -(us) 31 0037 0x1f | ? 63 0077 0x3f | _ 95 0137 0x5f | (del) 127 0177 0x7f - -*/ -INPUT_PORTS_START( generic_keyboard ) - PORT_START("TERM_LINEC") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("TERM_LINE0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - - PORT_START("TERM_LINE1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - - PORT_START("TERM_LINE2") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_CHAR('`') PORT_CHAR('@') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - - PORT_START("TERM_LINE3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - - PORT_START("TERM_LINE4") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - - PORT_START("TERM_LINE5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - - PORT_START("TERM_LINE6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LF") PORT_CODE(KEYCODE_RALT) PORT_CHAR(10) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - - PORT_START("TERM_LINE7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - - PORT_START("TERM_LINE8") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) - - PORT_START("TERM_LINE9") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) -INPUT_PORTS_END -ioport_constructor generic_keyboard_device::device_input_ports() const +void generic_keyboard_device::will_scan_row(UINT8 row) { - return INPUT_PORTS_NAME(generic_keyboard); + UINT16 const modifiers(m_modifiers->read()); + if (modifiers != m_last_modifiers) + typematic_restart(typematic_delay(), typematic_period()); + + m_last_modifiers = modifiers; } -const device_type GENERIC_KEYBOARD = &device_creator<generic_keyboard_device>; + +void generic_keyboard_device::send_translated(UINT8 code) +{ + UINT8 translated; + if (translate(code, translated)) + send_key(translated); +} + + +attotime generic_keyboard_device::typematic_delay() const +{ + return attotime::from_msec(250 * (1 + ((m_config->read() >> 1) & 0x03U))); +} + + +attotime generic_keyboard_device::typematic_period() const +{ + unsigned const rate(~(m_config->read() >> 3) & 0x1fU); + return attotime::from_ticks((8U + (rate & 0x07U)) * (1 << ((rate >> 3) & 0x03)), 240U); +} diff --git a/src/devices/machine/keyboard.h b/src/devices/machine/keyboard.h index 79a91f923c9..343c8991bcb 100644 --- a/src/devices/machine/keyboard.h +++ b/src/devices/machine/keyboard.h @@ -1,7 +1,9 @@ // license:BSD-3-Clause -// copyright-holders:smf -#ifndef __KEYBOARD_H__ -#define __KEYBOARD_H__ +// copyright-holders:Vas Crabb +#ifndef MAME_DEVICES_MACHINE_KEYBOARD_H +#define MAME_DEVICES_MACHINE_KEYBOARD_H + +#pragma once #include "emu.h" @@ -9,52 +11,122 @@ DEVICE CONFIGURATION MACROS ***************************************************************************/ -#define MCFG_GENERIC_KEYBOARD_CB(_devcb) \ - devcb = &generic_keyboard_device::set_keyboard_callback(*device, DEVCB_##_devcb); +#define MCFG_GENERIC_KEYBOARD_CB(cb) \ + devcb = &generic_keyboard_device::set_keyboard_callback(*device, DEVCB_##cb); + + + +/*************************************************************************** + DEVICE TYPE GLOBALS +***************************************************************************/ + +extern const device_type GENERIC_KEYBOARD; + + /*************************************************************************** - FUNCTION PROTOTYPES + REUSABLE I/O PORTS ***************************************************************************/ INPUT_PORTS_EXTERN( generic_keyboard ); -class generic_keyboard_device : public device_t + + +/*************************************************************************** + TYPE DECLARATIONS +***************************************************************************/ + +template <UINT8 ROW_COUNT> +class device_matrix_keyboard_interface : public device_interface +{ +protected: + template <typename... T> + device_matrix_keyboard_interface(machine_config const &mconfig, device_t &device, T &&... tags); + + virtual void interface_pre_start() override; + virtual void interface_post_start() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + void start_processing(const attotime &period); + void stop_processing(); + void reset_key_state(); + + void typematic_start(UINT8 row, UINT8 column, attotime const &delay, attotime const &interval); + void typematic_restart(attotime const &delay, attotime const &interval); + void typematic_stop(); + bool typematic_is(UINT8 row, UINT8 column) const { return (m_typematic_row == row) && (m_typematic_column == column); } + + virtual void key_make(UINT8 row, UINT8 column) = 0; + virtual void key_repeat(UINT8 row, UINT8 column); + virtual void key_break(UINT8 row, UINT8 column); + virtual void will_scan_row(UINT8 row); + + bool are_all_keys_up(); + +private: + // device_serial_interface uses 10'000 range + enum { + TIMER_ID_SCAN = 20'000, + TIMER_ID_TYPEMATIC + }; + + void scan_row(); + + emu_timer *m_scan_timer; + emu_timer *m_typematic_timer; + required_ioport m_key_rows[ROW_COUNT]; + ioport_value m_key_states[ROW_COUNT]; + UINT8 m_next_row; + UINT8 m_processing; + UINT8 m_typematic_row; + UINT8 m_typematic_column; +}; + + +class generic_keyboard_device : public device_t, protected device_matrix_keyboard_interface<4U> { public: - generic_keyboard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - generic_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + generic_keyboard_device( + const machine_config &mconfig, + device_type type, + char const *name, + char const *tag, + device_t *owner, + UINT32 clock, + char const *shortname, + char const *source); + generic_keyboard_device( + const machine_config &mconfig, + const char *tag, + device_t *owner, + UINT32 clock); - template<class _Object> static devcb_base &set_keyboard_callback(device_t &device, _Object object) { return downcast<generic_keyboard_device &>(device).m_keyboard_cb.set_callback(object); } + template <class Object> static devcb_base &set_keyboard_callback(device_t &device, Object object) { return downcast<generic_keyboard_device &>(device).m_keyboard_cb.set_callback(object); } virtual ioport_constructor device_input_ports() const override; - virtual machine_config_constructor device_mconfig_additions() const override; -protected: - required_ioport m_io_kbd0; - required_ioport m_io_kbd1; - required_ioport m_io_kbd2; - required_ioport m_io_kbd3; - required_ioport m_io_kbd4; - required_ioport m_io_kbd5; - required_ioport m_io_kbd6; - required_ioport m_io_kbd7; - required_ioport m_io_kbd8; - required_ioport m_io_kbd9; - required_ioport m_io_kbdc; +protected: virtual void device_start() override; virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - virtual void send_key(UINT8 code) { m_keyboard_cb((offs_t)0, code); } - emu_timer *m_timer; + virtual void key_make(UINT8 row, UINT8 column) override; + virtual void key_repeat(UINT8 row, UINT8 column) override; + virtual void send_key(UINT8 code); + virtual bool translate(UINT8 code, UINT8 &translated) const; + + required_ioport m_config; + required_ioport m_modifiers; + private: - virtual UINT8 keyboard_handler(UINT8 last_code, UINT8 *scan_line); - UINT8 row_number(UINT8 code); - UINT8 m_last_code; - UINT8 m_scan_line; + virtual void will_scan_row(UINT8 row) override; - devcb_write8 m_keyboard_cb; -}; + void typematic(); + void send_translated(UINT8 code); + attotime typematic_delay() const; + attotime typematic_period() const; -extern const device_type GENERIC_KEYBOARD; + UINT16 m_last_modifiers; + devcb_write8 m_keyboard_cb; +}; -#endif /* __KEYBOARD_H__ */ +#endif // MAME_DEVICES_MACHINE_KEYBOARD_H diff --git a/src/devices/machine/keyboard.ipp b/src/devices/machine/keyboard.ipp new file mode 100644 index 00000000000..91c6992962e --- /dev/null +++ b/src/devices/machine/keyboard.ipp @@ -0,0 +1,174 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +#ifndef MAME_DEVICES_MACHINE_KEYBOARD_IPP +#define MAME_DEVICES_MACHINE_KEYBOARD_IPP + +#pragma once + +#include "keyboard.h" + +#include <numeric> + + +template <UINT8 ROW_COUNT> +template <typename... T> +device_matrix_keyboard_interface<ROW_COUNT>::device_matrix_keyboard_interface(machine_config const &mconfig, device_t &device, T &&... tags) + : device_interface(device, "matrix_keyboard") + , m_scan_timer(nullptr) + , m_typematic_timer(nullptr) + , m_key_rows{ { device, std::forward<T>(tags) }... } + , m_next_row(0U) + , m_processing(0U) + , m_typematic_row(0U) + , m_typematic_column(0U) +{ +} + + +template <UINT8 ROW_COUNT> +void device_matrix_keyboard_interface<ROW_COUNT>::interface_pre_start() +{ + m_scan_timer = device().timer_alloc(TIMER_ID_SCAN); + m_typematic_timer = device().timer_alloc(TIMER_ID_TYPEMATIC); + reset_key_state(); + typematic_stop(); +} + + +template <UINT8 ROW_COUNT> +void device_matrix_keyboard_interface<ROW_COUNT>::interface_post_start() +{ + device().save_item(NAME(m_key_states)); + device().save_item(NAME(m_next_row)); + device().save_item(NAME(m_processing)); + device().save_item(NAME(m_typematic_row)); + device().save_item(NAME(m_typematic_column)); +} + + +template <UINT8 ROW_COUNT> +void device_matrix_keyboard_interface<ROW_COUNT>::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_ID_SCAN: + scan_row(); + break; + case TIMER_ID_TYPEMATIC: + assert((m_typematic_row != UINT8(~0U)) || (m_typematic_column != UINT8(~0U))); + key_repeat(m_typematic_row, m_typematic_column); + break; + } +} + + +template <UINT8 ROW_COUNT> +void device_matrix_keyboard_interface<ROW_COUNT>::start_processing(const attotime &period) +{ + m_processing = 1U; + m_scan_timer->adjust(period, 0, period); +} + + +template <UINT8 ROW_COUNT> +void device_matrix_keyboard_interface<ROW_COUNT>::stop_processing() +{ + m_scan_timer->reset(); + m_processing = 0U; +} + + +template <UINT8 ROW_COUNT> +void device_matrix_keyboard_interface<ROW_COUNT>::reset_key_state() +{ + std::fill(std::begin(m_key_states), std::end(m_key_states), ioport_value(0U)); + m_next_row = 0U; +} + + +template <UINT8 ROW_COUNT> +void device_matrix_keyboard_interface<ROW_COUNT>::typematic_start(UINT8 row, UINT8 column, attotime const &delay, attotime const &interval) +{ + m_typematic_row = row; + m_typematic_column = column; + m_typematic_timer->adjust(delay, 0, interval); +} + + +template <UINT8 ROW_COUNT> +void device_matrix_keyboard_interface<ROW_COUNT>::typematic_restart(attotime const &delay, attotime const &interval) +{ + if ((m_typematic_row != UINT8(~0U)) || (m_typematic_column != UINT8(~0U))) + m_typematic_timer->adjust(delay, 0, interval); +} + + +template <UINT8 ROW_COUNT> +void device_matrix_keyboard_interface<ROW_COUNT>::typematic_stop() +{ + m_typematic_row = UINT8(~0U); + m_typematic_column = UINT8(~0U); + m_typematic_timer->reset(); +} + + +template <UINT8 ROW_COUNT> +void device_matrix_keyboard_interface<ROW_COUNT>::scan_row() +{ + assert(m_next_row < ARRAY_LENGTH(m_key_rows)); + assert(m_next_row < ARRAY_LENGTH(m_key_states)); + + will_scan_row(m_next_row); + + ioport_value &state(m_key_states[m_next_row]); + ioport_value const keys(m_key_rows[m_next_row]->read()); + ioport_value const change(state ^ keys); + + ioport_value mask(1U); + for (UINT8 column = 0U; m_processing && (state != keys); ++column, mask <<= 1) + { + if (change & mask) + { + state ^= mask; + if (keys & mask) + key_make(m_next_row, column); + else + key_break(m_next_row, column); + } + } + + m_next_row = (m_next_row + 1) % ARRAY_LENGTH(m_key_rows); +} + + +template <UINT8 ROW_COUNT> +void device_matrix_keyboard_interface<ROW_COUNT>::key_repeat(UINT8 row, UINT8 column) +{ +} + + +template <UINT8 ROW_COUNT> +void device_matrix_keyboard_interface<ROW_COUNT>::key_break(UINT8 row, UINT8 column) +{ + if (typematic_is(row, column)) + typematic_stop(); +} + + +template <UINT8 ROW_COUNT> +void device_matrix_keyboard_interface<ROW_COUNT>::will_scan_row(UINT8 row) +{ +} + + +template <UINT8 ROW_COUNT> +bool device_matrix_keyboard_interface<ROW_COUNT>::are_all_keys_up() +{ + return 0U == std::accumulate( + std::begin(m_key_rows), + std::end(m_key_rows), + ioport_value(0), + [] (ioport_value a, auto const &b) { return a | b->read(); }); +} + +#endif // MAME_DEVICES_MACHINE_KEYBOARD_IPP diff --git a/src/devices/machine/pdc.cpp b/src/devices/machine/pdc.cpp index b993531a14b..f5a75d87f72 100644 --- a/src/devices/machine/pdc.cpp +++ b/src/devices/machine/pdc.cpp @@ -324,7 +324,6 @@ pdc_device::pdc_device(const machine_config &mconfig, const char *tag, device_t void pdc_device::device_start() { - /* Save States */ save_item(NAME(reg_p0)); save_item(NAME(reg_p1)); diff --git a/src/devices/machine/scnxx562.cpp b/src/devices/machine/scnxx562.cpp index cbd3f67a861..491e00ccdca 100644 --- a/src/devices/machine/scnxx562.cpp +++ b/src/devices/machine/scnxx562.cpp @@ -37,12 +37,12 @@ DONE (x) (p=partly) NMOS CMOS Synch data rates 4Mbps 10Mbps ----- asynchrounous features ------------------ x 5-8 bit per char Y Y - p 1-2 stop bits Y Y TODO: 1/16 bit increments - p odd/even parity Y Y TODO: parity generation on Tx + p 1-2 stop bits Y Y TODO: 1/16 bit increments + p odd/even parity Y Y TODO: parity generation on Tx x1,x16 Y Y break det/gen Y Y - p parity, framing & Y Y TODO: parity check on Rx - overrun error det + p parity, framing & Y Y TODO: parity check on Rx + overrun error det -- byte oriented synchrounous features -- Int/ext char sync Y Y 1/2 synch chars ? ? @@ -58,7 +58,7 @@ DONE (x) (p=partly) NMOS CMOS -- x Receiver FIFO 4 16 x Transmitter FIFO 4 16 - NRZ, NRZI, FM1 or Y Y + NRZ, NRZI, FM1 or Y Y FM2 enc/dec Manchester dec Y Y x Baud gen per chan Y Y @@ -88,7 +88,7 @@ DONE (x) (p=partly) NMOS CMOS #define VERBOSE 0 #define LOG(x) do { if (VERBOSE) logerror x; } while (0) -#define LOGR(x) +#define LOGR(x) #if VERBOSE > 1 #define logerror printf #endif @@ -276,13 +276,13 @@ void duscc_device::device_reset() Each of the above conditions occupies a bit in the General Status Register (GSR). If ICR[2] is set, the eight conditions are encoded into three bits which are inserted into bits [2:0] or [4:2] of the interrupt vector register. This forms the content of the IVRM during an interrupt acknowledge cycle. Unmodified and modified vectors can read directly through specified registers. Two of the conditions - are the inclusive OR of several other maskable conditions: + are the inclusive OR of several other maskable conditions: - Extemal or CIT special condition: Delta DCD, Delta CTS or CIT zero count (ICTSR[6:4j). - Rxrrx error or special condition: any condition in the Receiver Status Register (RSR[7:0J) or a transmitter or DPLL condition in the Transmitter and Receiver Status Register (TRSR[7:3J). The TxRDY and RxRDY conditions are defined by OMR[4] and OMR[3], respectively. Also associated with the interrupt system are the Interrupt Enable Register (IER), one bit in the Countermmer Control Register (CTCR), and the Interrupt Control Register (lCR). - + The IER is programmed to enable specified conditions or groups of conditions to cause an interrupt by asserting the corresponding bit. A negated bit prevents an interrupt from occurring when the condition is active and hence masks the interrupt. In addition to the IER, CTCR[?] could be programmed to enable or disable an interrupt upon the CfT zero count condition. The interrupt priorities @@ -292,7 +292,7 @@ void duscc_device::device_reset() is to cause an interrupt. The CPU vector mode is specified by ICR[5:4] which selects either vectored or non-vectored operation. If vectored mode is selected, the content of the IVR or IVRM is placed on the data bus when lACK is activated. If ICR[2] is set, the content of IVRM is output which contains the content of IVR and the encoded status of the interrupting condition. - Upon receiving an interrupt acknowledge, the DUSCC locks its current interrupt status until the end of the acknowledge cycle. + Upon receiving an interrupt acknowledge, the DUSCC locks its current interrupt status until the end of the acknowledge cycle. If it has an active interrupt pending, it responds with the appropriate vector and then asserts DTACKN. If it does not have an interrupt, it propagates the acknowledge through its X2/1DCN output if this function is programmed in PCRA[7]; otherwise, the IACKN is ignored. Locking the interrupt status at the leading edge of IACKN prevents a device at a High position in the interrupt daisy chain from @@ -306,8 +306,8 @@ int duscc_device::z80daisy_irq_state() int state = 0; LOG(("%s %s A:[%02x][%02x][%02x][%02x] B:[%02x][%02x][%02x][%02x] ",tag(), FUNCNAME, - m_int_state[0], m_int_state[1], m_int_state[2], m_int_state[3], - m_int_state[4], m_int_state[5], m_int_state[6], m_int_state[7])); + m_int_state[0], m_int_state[1], m_int_state[2], m_int_state[3], + m_int_state[4], m_int_state[5], m_int_state[6], m_int_state[7])); // loop over all interrupt sources for (auto & elem : m_int_state) @@ -333,7 +333,6 @@ int duscc_device::z80daisy_irq_state() int duscc_device::z80daisy_irq_ack() { - LOG(("%s %s()\n",tag(), FUNCNAME)); // loop over all interrupt sources @@ -360,7 +359,6 @@ int duscc_device::z80daisy_irq_ack() void duscc_device::z80daisy_irq_reti() { - LOG(("%s %s \n",tag(), FUNCNAME)); // loop over all interrupt sources @@ -381,7 +379,7 @@ void duscc_device::z80daisy_irq_reti() void duscc_device::check_interrupts() { LOG(("%s %s()\n",tag(), FUNCNAME)); - int state = (z80daisy_irq_state() & Z80_DAISY_INT) ? ASSERT_LINE : CLEAR_LINE; + int state = (z80daisy_irq_state() & Z80_DAISY_INT) ? ASSERT_LINE : CLEAR_LINE; // "If no interrupt is pending, an H'FF' is output when reading the IVRM." if (state == 0) @@ -431,8 +429,8 @@ UINT8 duscc_device::modify_vector(UINT8 vec, int i, UINT8 src) if ((m_icr & REG_ICR_VEC_MOD) != 0) // Affect vector? { // Modify vector according to "Vector Include Status" bit (REG_ICR_V2V4_MOD) - if ((m_icr & REG_ICR_V2V4_MOD) != 0) - { // Affect V2-V4 + if ((m_icr & REG_ICR_V2V4_MOD) != 0) + { // Affect V2-V4 vec &= 0x07 << 3; vec |= src << 3; } @@ -447,7 +445,7 @@ UINT8 duscc_device::modify_vector(UINT8 vec, int i, UINT8 src) /* Interrupt Control and Status Registers - This group of registers define mechanisms for communications between the DUSCC and the processor and contain the device status + This group of registers define mechanisms for communications between the DUSCC and the processor and contain the device status information. Four registers, available for each channel, and four common device registers comprise this group which consists of the following: 1. Interrupt Enable Register (IERA/B). @@ -538,11 +536,11 @@ duscc_channel::duscc_channel(const machine_config &mconfig, const char *tag, dev LOG(("%s\n",FUNCNAME)); // Reset all registers - m_cmr1 = m_cmr2 = m_s1r = m_s2r = m_tpr = m_ttr = m_rpr = m_rtr - = /* m_ctprh = m_ctprl = */ m_ctpr = m_ctcr = m_omr - = /* m_cth = m_ctl = */ m_ct = m_pcr + m_cmr1 = m_cmr2 = m_s1r = m_s2r = m_tpr = m_ttr = m_rpr = m_rtr + = /* m_ctprh = m_ctprl = */ m_ctpr = m_ctcr = m_omr + = /* m_cth = m_ctl = */ m_ct = m_pcr = m_ccr = m_rsr = m_trsr = m_ictsr /*= m_gsr*/ = m_ier /*= m_rea*/ - = m_cid = /*m_ivr = m_icr = m_sea = m_ivrm = */ m_mrr = m_ier1 + = m_cid = /*m_ivr = m_icr = m_sea = m_ivrm = */ m_mrr = m_ier1 = m_ier2 = m_ier3 = m_trcr = m_rflr = m_ftlr = m_trmsr = m_telr = 0; // Reset all states @@ -591,13 +589,13 @@ void duscc_channel::device_start() save_item(NAME(m_ttr)); save_item(NAME(m_rpr)); save_item(NAME(m_rtr)); - // save_item(NAME(m_ctprh)); - // save_item(NAME(m_ctprl)); + // save_item(NAME(m_ctprh)); + // save_item(NAME(m_ctprl)); save_item(NAME(m_ctpr)); save_item(NAME(m_ctcr)); save_item(NAME(m_omr)); - // save_item(NAME(m_cth)); - // save_item(NAME(m_ctl)); + // save_item(NAME(m_cth)); + // save_item(NAME(m_ctl)); save_item(NAME(m_ct)); save_item(NAME(m_pcr)); save_item(NAME(m_ccr)); @@ -606,14 +604,14 @@ void duscc_channel::device_start() save_item(NAME(m_rsr)); save_item(NAME(m_trsr)); save_item(NAME(m_ictsr)); - // save_item(NAME(m_gsr)); // Moved this to the device instead, it is a global register + // save_item(NAME(m_gsr)); // Moved this to the device instead, it is a global register save_item(NAME(m_ier)); - // save_item(NAME(m_rea)); + // save_item(NAME(m_rea)); save_item(NAME(m_cid)); - // save_item(NAME(m_ivr)); // Moved this to the device instead, it is a global register - // save_item(NAME(m_icr)); // Moved this to the device instead, it is a global register - // save_item(NAME(m_sea)); - // save_item(NAME(m_ivrm)); // Moved this to the device instead, it is a global register + // save_item(NAME(m_ivr)); // Moved this to the device instead, it is a global register + // save_item(NAME(m_icr)); // Moved this to the device instead, it is a global register + // save_item(NAME(m_sea)); + // save_item(NAME(m_ivrm)); // Moved this to the device instead, it is a global register save_item(NAME(m_mrr)); save_item(NAME(m_ier1)); save_item(NAME(m_ier2)); @@ -642,7 +640,7 @@ void duscc_channel::device_start() save_item(NAME(m_rts)); save_item(NAME(m_sync)); - // device_serial_interface::register_save_state(machine().save(), this); + // device_serial_interface::register_save_state(machine().save(), this); } @@ -659,39 +657,39 @@ void duscc_channel::device_reset() transmit_register_reset(); // Soft/Channel Reset values according to DUSCC users guide - m_cmr1 =0x00; - m_cmr2 =0x00; - m_s1r =0x00; - m_s2r =0x00; - m_tpr =0x00; - m_ttr =0x00; - m_rpr =0x00; - m_rtr =0x00; - m_ctcr =0x00; - m_omr =0x00; - m_pcr =0x00; - m_ccr =0x00; - m_rsr =0x00; - m_trsr =0x00; - m_ictsr =0x00; - // m_gsr =0x00; - m_ier =0x00; - // m_rea =0x00; - // m_ivr =0x0f; - // m_icr =0x00; - // m_sea =0x00; - // m_ivrm =0x00; - m_mrr =0x00; // TODO: Need a read after reset to enable CMOS features - m_ier1 =0x00; - m_ier2 =0x00; - m_ier3 =0x00; - m_trcr =0x00; - m_rflr =0x00; - m_ftlr =0x33; - m_trmsr =0x00; - m_telr =0x10; - m_rtxc =0x00; - m_trxc =0x00; + m_cmr1 =0x00; + m_cmr2 =0x00; + m_s1r =0x00; + m_s2r =0x00; + m_tpr =0x00; + m_ttr =0x00; + m_rpr =0x00; + m_rtr =0x00; + m_ctcr =0x00; + m_omr =0x00; + m_pcr =0x00; + m_ccr =0x00; + m_rsr =0x00; + m_trsr =0x00; + m_ictsr =0x00; + // m_gsr =0x00; + m_ier =0x00; + // m_rea =0x00; + // m_ivr =0x0f; + // m_icr =0x00; + // m_sea =0x00; + // m_ivrm =0x00; + m_mrr =0x00; // TODO: Need a read after reset to enable CMOS features + m_ier1 =0x00; + m_ier2 =0x00; + m_ier3 =0x00; + m_trcr =0x00; + m_rflr =0x00; + m_ftlr =0x33; + m_trmsr =0x00; + m_telr =0x10; + m_rtxc =0x00; + m_trxc =0x00; // reset external lines TODO: check relation to control bits and reset @@ -711,14 +709,14 @@ void duscc_channel::device_timer(emu_timer &timer, device_timer_id id, int param { switch(id) { - case TIMER_ID: - if (m_ct-- == 0) // Zero detect - { + case TIMER_ID: + if (m_ct-- == 0) // Zero detect + { m_ictsr |= REG_ICTSR_ZERO_DET; // set zero detection bit // Generate interrupt? - if ( ( (m_ctcr & REG_CTCR_ZERO_DET_INT) == 1 ) && - ( (m_uart->m_icr & (m_index == duscc_device::CHANNEL_A ? duscc_device::REG_ICR_CHA : duscc_device::REG_ICR_CHB) ) != 0) ) + if ( ( (m_ctcr & REG_CTCR_ZERO_DET_INT) == 1 ) && + ( (m_uart->m_icr & (m_index == duscc_device::CHANNEL_A ? duscc_device::REG_ICR_CHA : duscc_device::REG_ICR_CHB) ) != 0) ) { //trigger_interrupt(); } @@ -728,7 +726,7 @@ void duscc_channel::device_timer(emu_timer &timer, device_timer_id id, int param { m_ct = m_ctpr; } - else + else { m_ct = 0xffff; } @@ -774,7 +772,7 @@ void duscc_channel::device_timer(emu_timer &timer, device_timer_id id, int param m_ictsr &= ~REG_ICTSR_ZERO_DET; } break; - case TIMER_ID_RTXC: // Terminate zero detection pulse + case TIMER_ID_RTXC: // Terminate zero detection pulse m_rtxc = 0; rtxc_timer->adjust(attotime::never); if (m_index == duscc_device::CHANNEL_A) @@ -782,7 +780,7 @@ void duscc_channel::device_timer(emu_timer &timer, device_timer_id id, int param else m_uart->m_out_rtxcb_cb(m_rtxc); break; - case TIMER_ID_TRXC: // Terminate zero detection pulse + case TIMER_ID_TRXC: // Terminate zero detection pulse m_trxc = 0; trxc_timer->adjust(attotime::never); if (m_index == duscc_device::CHANNEL_A) @@ -790,53 +788,53 @@ void duscc_channel::device_timer(emu_timer &timer, device_timer_id id, int param else m_uart->m_out_trxcb_cb(m_trxc); break; - default: - LOGR(("Unhandled Timer ID %d\n", id)); - break; + default: + LOGR(("Unhandled Timer ID %d\n", id)); + break; } // LOG(("%s %d\n", FUNCNAME, id)); device_serial_interface::device_timer(timer, id, param, ptr); } -/* The DUSCC 16 bit Timer - Counter/Timer Control and Value Registers - There are five registers in this set consisting of the following: - 1. Counterltimer control register (CTCRAlB). - 2. Counterltimer preset Highland Low registers (CTPRHAlB, CTPRLAlB). - 3. Counter/bmer (current value) High and Low registers (CTHAlB, CTLAlB) - The control register contains the operational information for the counterltimer. The preset registers contain the count which is - loaded into the counterltimer circuits. The third group contains the current value of the counterltimer as it operates. +/* The DUSCC 16 bit Timer + Counter/Timer Control and Value Registers + There are five registers in this set consisting of the following: + 1. Counterltimer control register (CTCRAlB). + 2. Counterltimer preset Highland Low registers (CTPRHAlB, CTPRLAlB). + 3. Counter/bmer (current value) High and Low registers (CTHAlB, CTLAlB) + The control register contains the operational information for the counterltimer. The preset registers contain the count which is + loaded into the counterltimer circuits. The third group contains the current value of the counterltimer as it operates. */ /* Counter/Timer Control Register (CTCRA/CTCRB) - [7] Zero Detect Interrupt - This bit determines whether the assertion of the CIT ZERO COUNT status bit (ICTSR[6)) causes an - interrupt to be generated if set to 1 and the Master interrupt control bit (ICR[0:1]) is set - [6] Zero Detect Control - his bit determines the action of the counter upon reaching zero count - 0 - The counter/timer is preset to the value contained in the counterltimer preset registers (CTPRL, CTPRH) at the next clock edge. - 1 - The counterltimer continues counting without preset. The value at the next clock edge will be H'FFFF'. - [5] CounterlTimer Output Control - This bit selects the output waveform when the counterltimer is selected to be output on TRxC or RTxC. - 0 - The output toggles each time the CIT reaches zero count. The output is cleared to Low by either of the preset counterltimer commands. - 1 - The output is a single clock positive width pulse each time the CIT reaches zero count. (The duration of this pulse is one clock period.) - [4:3] Clock Select - This field selects whether the clock selected by [2:0J is prescaled prior to being applied to the input of the CIT. - 0 0 No prescaling. - 0 1 Divide clock by 16. - 1 0 Divide clock by 32. - 1 1 Divide clock by 64. - [2:0] Clock Source - This field selects the clock source for the counterltimer. - 000 RTxC pin. Pin must be programmed as input. - 001 TRxC pin. Pin must be programmed as input. - 010 Source is the crystal oscillator or system clock input divided by four. - 011 This selects a special mode of operation. In this mode the counter, after receiving the 'start CIT' command, delays the - start of counting until the RxD input goes Low. It continues counting until the RxD input goes High, then stops and sets - the CIT zero count status bit. The CPU can use the value in the CIT to determine the bit rate of the incoming data. - The clock is the crystal oscillator or system clock input divided by four. - 100 Source is the 32X BRG output selected by RTR[3:0J of own channel. - 101 Source is the 32X BRG output selected by TTR[3:0J of own channel. - 110 Source is the internal signal which loads received characters from the receive shift register into the receiver - FIFO. When operating in this mode, the FIFOed EOM status bit (RSR[7)) shall be set when the character which - causes the count to go to zero is loaded into the receive FIFO. - 111 Source is the internal signal which transfers characters from the data bus into the transmit FIFO. When operating in this - mode, and if the TEOM on zero count or done control bit (TPR[4)) is asserted, the FIFOed send EOM command will - be automatically asserted when the character which causes the count to go to zero is loaded into the transmit FIFO. + [7] Zero Detect Interrupt - This bit determines whether the assertion of the CIT ZERO COUNT status bit (ICTSR[6)) causes an + interrupt to be generated if set to 1 and the Master interrupt control bit (ICR[0:1]) is set + [6] Zero Detect Control - his bit determines the action of the counter upon reaching zero count + 0 - The counter/timer is preset to the value contained in the counterltimer preset registers (CTPRL, CTPRH) at the next clock edge. + 1 - The counterltimer continues counting without preset. The value at the next clock edge will be H'FFFF'. + [5] CounterlTimer Output Control - This bit selects the output waveform when the counterltimer is selected to be output on TRxC or RTxC. + 0 - The output toggles each time the CIT reaches zero count. The output is cleared to Low by either of the preset counterltimer commands. + 1 - The output is a single clock positive width pulse each time the CIT reaches zero count. (The duration of this pulse is one clock period.) + [4:3] Clock Select - This field selects whether the clock selected by [2:0J is prescaled prior to being applied to the input of the CIT. + 0 0 No prescaling. + 0 1 Divide clock by 16. + 1 0 Divide clock by 32. + 1 1 Divide clock by 64. + [2:0] Clock Source - This field selects the clock source for the counterltimer. + 000 RTxC pin. Pin must be programmed as input. + 001 TRxC pin. Pin must be programmed as input. + 010 Source is the crystal oscillator or system clock input divided by four. + 011 This selects a special mode of operation. In this mode the counter, after receiving the 'start CIT' command, delays the + start of counting until the RxD input goes Low. It continues counting until the RxD input goes High, then stops and sets + the CIT zero count status bit. The CPU can use the value in the CIT to determine the bit rate of the incoming data. + The clock is the crystal oscillator or system clock input divided by four. + 100 Source is the 32X BRG output selected by RTR[3:0J of own channel. + 101 Source is the 32X BRG output selected by TTR[3:0J of own channel. + 110 Source is the internal signal which loads received characters from the receive shift register into the receiver + FIFO. When operating in this mode, the FIFOed EOM status bit (RSR[7)) shall be set when the character which + causes the count to go to zero is loaded into the receive FIFO. + 111 Source is the internal signal which transfers characters from the data bus into the transmit FIFO. When operating in this + mode, and if the TEOM on zero count or done control bit (TPR[4)) is asserted, the FIFOed send EOM command will + be automatically asserted when the character which causes the count to go to zero is loaded into the transmit FIFO. */ UINT8 duscc_channel::do_dusccreg_ctcr_r() { @@ -852,54 +850,54 @@ void duscc_channel::do_dusccreg_ctcr_w(UINT8 data) } /* Counterrrimer Preset High Register (CTPRHA, CTPRHB) - [7:0) MSB - This register contains the eight most significant bits of the value loaded into the counter/timer upon receipt of the load CIT - from preset regsiter command or when.the counter/timer reaches zero count and the zero detect control bit (CTCR[6]) is negated. - The minimum 16-bit counter/timer preset value is H'0002'. + [7:0) MSB - This register contains the eight most significant bits of the value loaded into the counter/timer upon receipt of the load CIT + from preset regsiter command or when.the counter/timer reaches zero count and the zero detect control bit (CTCR[6]) is negated. + The minimum 16-bit counter/timer preset value is H'0002'. */ UINT8 duscc_channel::do_dusccreg_ctprh_r() { UINT8 ret = ((m_ctpr >> 8) & 0xff ); LOG(("%s(%02x)\n", FUNCNAME, ret)); - // return m_ctprh; + // return m_ctprh; return ret; } void duscc_channel::do_dusccreg_ctprh_w(UINT8 data) -{ +{ LOG(("%s(%02x) - not supported yet\n", FUNCNAME, data)); - // m_ctprh = data; + // m_ctprh = data; m_ctpr &= ~0x0000ff00; m_ctpr |= ((data << 8) & 0x0000ff00); - return; + return; } /* CounterfTimer Preset Low Register (CTPRLA, CTPRLB) - [7:0) lSB - This register contains the eight least significant bits of the value loaded into the counter/timer upon receipt of the load CIT - from preset register command or when the counter/timer reaches zero count and the zero detect control bit (CTCR[6]) is negated. - The minimum 16-bit counter/timer preset value is H'0002'. + [7:0) lSB - This register contains the eight least significant bits of the value loaded into the counter/timer upon receipt of the load CIT + from preset register command or when the counter/timer reaches zero count and the zero detect control bit (CTCR[6]) is negated. + The minimum 16-bit counter/timer preset value is H'0002'. */ UINT8 duscc_channel::do_dusccreg_ctprl_r() { UINT8 ret = (m_ctpr & 0xff); LOG(("%s(%02x)\n", FUNCNAME, ret)); - // return m_ctprl; + // return m_ctprl; return ret; } void duscc_channel::do_dusccreg_ctprl_w(UINT8 data) -{ +{ LOG(("%s(%02x) - not supported yet\n", FUNCNAME, data)); - // m_ctprl = data; + // m_ctprl = data; m_ctpr &= ~0x000000ff; m_ctpr |= (data & 0x000000ff); - return; + return; } /* Counter/Timer High Register (CTHA, CTHB) Read only - [7:0] MSB - A read of this 'register' provides the eight most significant bits of the current value of the counter/timer. it is - recommended that the CIT be stopped via a stop counter command before it is read in order to prevent errors which may occur due to - the read being performed while the CIT is changing. This count may be continued after the register is read. + [7:0] MSB - A read of this 'register' provides the eight most significant bits of the current value of the counter/timer. it is + recommended that the CIT be stopped via a stop counter command before it is read in order to prevent errors which may occur due to + the read being performed while the CIT is changing. This count may be continued after the register is read. */ UINT8 duscc_channel::do_dusccreg_cth_r() @@ -912,15 +910,15 @@ UINT8 duscc_channel::do_dusccreg_cth_r() /* Counter/Timer Low Register (CTLA, CTLB) Read only - [7:0] lSB - A read of this 'register' provides the eight least significant bits of the current value of the counter/timer. It is - recommended that the CIT be stopped via a stop counter command before it is read, in order to prevent errors which may occur due to - the read being performed while the CIT is changing. This count may be continued after the register is read. + [7:0] lSB - A read of this 'register' provides the eight least significant bits of the current value of the counter/timer. It is + recommended that the CIT be stopped via a stop counter command before it is read, in order to prevent errors which may occur due to + the read being performed while the CIT is changing. This count may be continued after the register is read. */ UINT8 duscc_channel::do_dusccreg_ctl_r() { UINT8 ret = (m_ct & 0xff); LOG(("%s(%02x)\n", FUNCNAME, ret)); - // return m_ctl; + // return m_ctl; return ret; } @@ -1134,31 +1132,31 @@ int duscc_channel::get_tx_word_length() // register read methods - see correspondning write method for details on each register UINT8 duscc_channel::do_dusccreg_cmr1_r() -{ +{ LOG(("%s(%02x)\n", FUNCNAME, m_cmr1)); - return m_cmr1; + return m_cmr1; } UINT8 duscc_channel::do_dusccreg_cmr2_r() -{ +{ LOG(("%s(%02x)\n", FUNCNAME, m_cmr2)); - return m_cmr2; + return m_cmr2; } UINT8 duscc_channel::do_dusccreg_s1r_r() { LOG(("%s(%02x)\n", FUNCNAME, m_s1r)); - return m_s1r; + return m_s1r; } UINT8 duscc_channel::do_dusccreg_s2r_r() { LOG(("%s(%02x)\n", FUNCNAME, m_s2r)); - return m_s2r; + return m_s2r; } UINT8 duscc_channel::do_dusccreg_tpr_r() -{ +{ LOG(("%s(%02x)\n", FUNCNAME, m_tpr)); return m_tpr; } @@ -1227,9 +1225,9 @@ UINT8 duscc_channel::do_dusccreg_rxfifo_r() } UINT8 duscc_channel::do_dusccreg_rsr_r() -{ +{ LOG(("%s: %02x\n", FUNCNAME, m_rsr)); - return (UINT8) m_rsr; + return (UINT8) m_rsr; } UINT8 duscc_channel::do_dusccreg_trsr_r() @@ -1239,9 +1237,9 @@ UINT8 duscc_channel::do_dusccreg_trsr_r() } UINT8 duscc_channel::do_dusccreg_ictsr_r() -{ - logerror("%s is not implemented yet\n", FUNCNAME); - return (UINT8) m_ictsr; +{ + logerror("%s is not implemented yet\n", FUNCNAME); + return (UINT8) m_ictsr; } /* General Status Register (GSR) @@ -1266,15 +1264,15 @@ UINT8 duscc_channel::do_dusccreg_ictsr_r() receiver' command is invoked. */ UINT8 duscc_channel::do_dusccreg_gsr_r() -{ +{ LOGR(("%s <- %02x\n", FUNCNAME, m_uart->m_gsr)); - return (UINT8) m_uart->m_gsr; + return (UINT8) m_uart->m_gsr; } UINT8 duscc_channel::do_dusccreg_ier_r() -{ +{ LOGR(("%s <- %02x\n", FUNCNAME, m_uart->m_ier)); - return (UINT8) 0; + return (UINT8) 0; } UINT8 duscc_channel::do_dusccreg_cid_r() @@ -1310,7 +1308,7 @@ UINT8 duscc_channel::do_dusccreg_ivr_ivrm_r() } UINT8 duscc_channel::do_dusccreg_icr_r() -{ +{ LOG(("%s(%02x)\n", FUNCNAME, m_uart->m_icr)); return m_uart->m_icr; } @@ -1376,9 +1374,9 @@ UINT8 duscc_channel::do_dusccreg_telr_r() primary function of these registers is to define configuration of the channels and the function of the programmable pins. A channel cannot be dynamically reconfigured. Do not write to CMRI or CMR2 if the receiver or transmitter is enabled. */ -/* CMR1 register - - [7:6] Data Encoding - These bits select the data encoding for the received and transmitted data: - 00 If the DPLL is set to NRZI mode (see DPLL commands), it selects positive logic (1 = high, 0 = low). +/* CMR1 register - + [7:6] Data Encoding - These bits select the data encoding for the received and transmitted data: + 00 If the DPLL is set to NRZI mode (see DPLL commands), it selects positive logic (1 = high, 0 = low). If the DPLL is set to FM mode (see DPLL commands), Manchester (bi-phase level) encoding is selected. 01 NRZI. Non-return-to-zero inverted. 10 FMO. Bi-phase space. @@ -1514,7 +1512,7 @@ void duscc_channel::do_dusccreg_cmr2_w(UINT8 data) } /* SYN1/Secondary Address 1 Register (S1RA, S1RB) - [7:O} Character Compare + [7:O} Character Compare - In ASYNC mode this register holds a 5 to 8-bit long bit pattern which is ocmpared with received characters. if a match occurs, the character compare status bit (RSR[7]) is set. This field is ignored if the receivEII is in a break condition. @@ -1526,10 +1524,10 @@ void duscc_channel::do_dusccreg_cmr2_w(UINT8 data) TODO: Add check in receive_data and set status bits accordingly */ void duscc_channel::do_dusccreg_s1r_w(UINT8 data) -{ +{ LOG(("%s(%02x) - not supported yet\n", FUNCNAME, data)); m_s1r = data; - return; + return; } /* SYN2ISecondary Address 2 Register (S2RA, S2RB) @@ -1540,10 +1538,10 @@ void duscc_channel::do_dusccreg_s1r_w(UINT8 data) match. If parity Is specified, then any unused bits in this register must be programmed to zeros. In BOP secondary mode using two address octets, it contains the partial address used to compare the second received address octet.*/ void duscc_channel::do_dusccreg_s2r_w(UINT8 data) -{ +{ LOG(("%s(%02x) - not supported yet\n", FUNCNAME, data)); m_s2r = data; - return; + return; } /* Transmitter Parameter Register (TPRA, TPRB) @@ -1907,7 +1905,7 @@ void duscc_channel::do_dusccreg_pcr_w(UINT8 data) default: LOG(("Wrong programming\n")); break; // Should never happen } - return; + return; } /* @@ -1941,7 +1939,7 @@ void duscc_channel::do_dusccreg_ccr_w(UINT8 data) /* Enable transmitter. Enables transmitter operation, conditioned by the state of the CTS ENABLE Tx bit, TPR[2]. Has no effect if invoked when the transmitter has previously been enabled.*/ - case REG_CCR_ENABLE_TX: LOG(("- Enable Tx\n")); + case REG_CCR_ENABLE_TX: LOG(("- Enable Tx\n")); m_uart->m_gsr |= (m_index == duscc_device::CHANNEL_A ? REG_GSR_CHAN_A_TXREADY : REG_GSR_CHAN_B_TXREADY); m_tra = 1; set_tra_rate(m_brg_tx_rate); @@ -1995,7 +1993,7 @@ void duscc_channel::do_dusccreg_ccr_w(UINT8 data) duscc_timer->adjust(attotime::from_hz(rate), TIMER_ID_RTXC, attotime::from_hz(rate)); break; - /* Stop. Stops the counter/timer and prescaler. Since the command may be asynchronous with the selected clock source, + /* Stop. Stops the counter/timer and prescaler. Since the command may be asynchronous with the selected clock source, the counter/timer and/or prescaler may count one or more additional cycles before stopping.. */ case REG_CCR_STOP_TIMER: LOG(("- Stop Counter/Timer\n")); duscc_timer->adjust(attotime::never); @@ -2073,21 +2071,21 @@ void duscc_channel::do_dusccreg_txfifo_w(UINT8 data) before reading the character data from RxFIFO. For block status, the status register is initially cleared and then read after the message is received. Asserted status bits can be programmed to generate an interrupt (see Interrupt Enable Register).*/ void duscc_channel::do_dusccreg_rsr_w(UINT8 data) -{ +{ LOG(("%s: %02x\n", FUNCNAME, data)); m_rsr &= ~data; // Clear only bits which are 1:s - return; + return; } void duscc_channel::do_dusccreg_trsr_w(UINT8 data) -{ +{ LOG(("%s: %02x - not supported yet\n", FUNCNAME, data)); m_trsr = data; return; } void duscc_channel::do_dusccreg_ictsr_w(UINT8 data) -{ +{ LOG(("%s: %02x - not supported yet\n", FUNCNAME, data)); m_ictsr = data; return; @@ -2095,57 +2093,57 @@ void duscc_channel::do_dusccreg_ictsr_w(UINT8 data) /* This register provides a 'quick look' at the overall status of both channels of the DUSCC. A write to this register with ls at the corresponding bit pOSitions causes TxRDY (bits 5 and 1) and/or RxRDY (bits 4 and 0) to be reset. The other status bits can be reset - only by resetting the individual status bits that they point to. + only by resetting the individual status bits that they point to. [7] Channel 8 External or Coutnerrrimer Status - This bit indicates that one of the following status bits is asserted: ICTSRB[6:4]. [6] Channel B Receiver or Transmitter Status - This bit indicates that one of the following status bits is asserted: RSRB[7:0], TRSRB[7:3]. - [5] Channel 8 Transmitter Ready - The assertion of this bit indicates that one or more characters may be loaded into the Channel B + [5] Channel 8 Transmitter Ready - The assertion of this bit indicates that one or more characters may be loaded into the Channel B transmitter FIFO to be serialized by the transmit shift register. See description of OMR[4j. This bit can be asserted only - when the transmitter is enabled. Reselling the transmitter negates TxRDY. + when the transmitter is enabled. Reselling the transmitter negates TxRDY. [4] Channel 8 Receiver Ready - The assertion of this bit indicates that one or more characters are available in the Channel B receiver FIFO to be read by the CPU. See deSCription of OMR[3]. RxRDY is initially reset (negated) by a chip reset or when a 'reset Channel B - receiver' command is invoked. + receiver' command is invoked. [3] Channel A External or Countermmer Status - This bit indicates that one of the following status bits is asserted: ICTSRA[6:4]. [2] Channel A Receiver or Transmitter Status - This bit indicates that one of the following status bits is asserted: RSRA(7:0], TRSRA(7:3]. - [1) Channel A Transmitter Ready - The assertion of this bit indicates that one or more characters may be loaded into the Channel A + [1) Channel A Transmitter Ready - The assertion of this bit indicates that one or more characters may be loaded into the Channel A transmitter FIFO to be serialized by the transmit shift register. See description of OMR[4]. This bit can be asserted only when the transmitter is enabled. Resetting the transmitter negates TxRDY. [0) Channel A Receiver Ready - The assertion of this bit indicates that one or more characters are available in the Channel A receiver FIFO to be read by the CPU. See description of OMR[3]. RxRDY is initially reset (negated) by a chip reset or when a 'reset Channel A - receiver' command is invoked.*/ + receiver' command is invoked.*/ void duscc_channel::do_dusccreg_gsr_w(UINT8 data) -{ +{ LOG(("%s(%02x)\n", FUNCNAME, data)); m_uart->m_gsr &= (data & REG_GSR_XXREADY_MASK); // Reset only XXREADY bits, the rest needs to be reset by the source - return; // TODO: Check of the XXREADY source bits should be reset too + return; // TODO: Check of the XXREADY source bits should be reset too } /* Interrupt Enable Register (IERA, IERB) This register controls whether the assertion of bits in the channel's status registers causes an interrupt to be generated. An additional condition for an interrupt to be generated is that the channel's master interrupt enabled bit, ICR[O] or ICR[1], be asserted.*/ void duscc_channel::do_dusccreg_ier_w(UINT8 data) -{ +{ m_ier = data; LOG(("%s(%02x)\n", FUNCNAME, data)); m_uart->check_interrupts(); - return; + return; } void duscc_channel::do_dusccreg_ivr_w(UINT8 data) -{ +{ m_uart->m_ivr = data; LOG(("%s(%02x)\n", FUNCNAME, data)); return; } void duscc_channel::do_dusccreg_icr_w(UINT8 data) -{ +{ m_uart->m_icr = data; LOG(("%s(%02x)\n", FUNCNAME, data)); return; } void duscc_channel::do_dusccreg_sea_rea_w(UINT8 data) -{ +{ LOG(("%s(%02x)\n", FUNCNAME, data)); if ( m_uart->m_variant != SET_CMOS ) { @@ -2157,7 +2155,7 @@ void duscc_channel::do_dusccreg_sea_rea_w(UINT8 data) m_a7 = (m_index == duscc_device::CHANNEL_A ? 0x40 : 0); // Set or Reset depending in channel } - return; + return; } void duscc_channel::do_dusccreg_mrr_w(UINT8 data){ logerror("%s is not implemented yet\n", FUNCNAME); return; } @@ -2178,36 +2176,36 @@ UINT8 duscc_channel::read(offs_t &offset) switch (reg) { - case REG_CMR1: data = do_dusccreg_cmr1_r(); break; - case REG_CMR2: data = do_dusccreg_cmr2_r(); break; - case REG_S1R: data = do_dusccreg_s1r_r(); break; - case REG_S2R: data = do_dusccreg_s2r_r(); break; - case REG_TPR: data = do_dusccreg_tpr_r(); break; - case REG_TTR: data = do_dusccreg_ttr_r(); break; - case REG_RPR: data = do_dusccreg_rpr_r(); break; - case REG_RTR: data = do_dusccreg_rtr_r(); break; - case REG_CTPRH: data = do_dusccreg_ctprh_r(); break; - case REG_CTPRL: data = do_dusccreg_ctprl_r(); break; - case REG_CTCR: data = do_dusccreg_ctcr_r(); break; - case REG_OMR: data = do_dusccreg_omr_r(); break; - case REG_CTH: data = do_dusccreg_cth_r(); break; - case REG_CTL: data = do_dusccreg_ctl_r(); break; - case REG_PCR: data = do_dusccreg_pcr_r(); break; - case REG_CCR: data = do_dusccreg_ccr_r(); break; - case REG_RXFIFO_0: data = do_dusccreg_rxfifo_r(); break; - case REG_RXFIFO_1: data = do_dusccreg_rxfifo_r(); break; - case REG_RXFIFO_2: data = do_dusccreg_rxfifo_r(); break; - case REG_RXFIFO_3: data = do_dusccreg_rxfifo_r(); break; - case REG_RSR: data = do_dusccreg_rsr_r(); break; - case REG_TRSR: data = do_dusccreg_trsr_r(); break; - case REG_ICTSR: data = do_dusccreg_ictsr_r(); break; - case REG_GSR: data = do_dusccreg_gsr_r(); break; - case REG_IER: data = do_dusccreg_ier_r(); break; - // case REG_IVR: data = do_dusccreg_ivr_r(); break; // Chan A = IVR, B = IVRM - case REG_IVRM: data = do_dusccreg_ivr_ivrm_r(); break; - case REG_ICR: data = do_dusccreg_icr_r(); break; + case REG_CMR1: data = do_dusccreg_cmr1_r(); break; + case REG_CMR2: data = do_dusccreg_cmr2_r(); break; + case REG_S1R: data = do_dusccreg_s1r_r(); break; + case REG_S2R: data = do_dusccreg_s2r_r(); break; + case REG_TPR: data = do_dusccreg_tpr_r(); break; + case REG_TTR: data = do_dusccreg_ttr_r(); break; + case REG_RPR: data = do_dusccreg_rpr_r(); break; + case REG_RTR: data = do_dusccreg_rtr_r(); break; + case REG_CTPRH: data = do_dusccreg_ctprh_r(); break; + case REG_CTPRL: data = do_dusccreg_ctprl_r(); break; + case REG_CTCR: data = do_dusccreg_ctcr_r(); break; + case REG_OMR: data = do_dusccreg_omr_r(); break; + case REG_CTH: data = do_dusccreg_cth_r(); break; + case REG_CTL: data = do_dusccreg_ctl_r(); break; + case REG_PCR: data = do_dusccreg_pcr_r(); break; + case REG_CCR: data = do_dusccreg_ccr_r(); break; + case REG_RXFIFO_0: data = do_dusccreg_rxfifo_r(); break; + case REG_RXFIFO_1: data = do_dusccreg_rxfifo_r(); break; + case REG_RXFIFO_2: data = do_dusccreg_rxfifo_r(); break; + case REG_RXFIFO_3: data = do_dusccreg_rxfifo_r(); break; + case REG_RSR: data = do_dusccreg_rsr_r(); break; + case REG_TRSR: data = do_dusccreg_trsr_r(); break; + case REG_ICTSR: data = do_dusccreg_ictsr_r(); break; + case REG_GSR: data = do_dusccreg_gsr_r(); break; + case REG_IER: data = do_dusccreg_ier_r(); break; + // case REG_IVR: data = do_dusccreg_ivr_r(); break; // Chan A = IVR, B = IVRM + case REG_IVRM: data = do_dusccreg_ivr_ivrm_r(); break; + case REG_ICR: data = do_dusccreg_icr_r(); break; // CDUSCC Extended registers - requires A7 to be set through REG_SEA - case REG_CID: data = do_dusccreg_cid_r(); break; + case REG_CID: data = do_dusccreg_cid_r(); break; default: logerror(" \"%s\" %s: %c : Unsupported RRx register:%02x\n", m_owner->tag(), FUNCNAME, 'A' + m_index, reg); } @@ -2228,44 +2226,44 @@ void duscc_channel::write(UINT8 data, offs_t &offset) LOG(("\"%s\" %s: %c : Register write '%02x' -> [%02x]", m_owner->tag(), FUNCNAME, 'A' + m_index, data, reg )); switch (reg) { - case REG_CMR1: do_dusccreg_cmr1_w(data); break; - case REG_CMR2: do_dusccreg_cmr2_w(data); break; - case REG_S1R: do_dusccreg_s1r_w(data); break; - case REG_S2R: do_dusccreg_s2r_w(data); break; - case REG_TPR: do_dusccreg_tpr_w(data); break; - case REG_TTR: do_dusccreg_ttr_w(data); break; - case REG_RPR: do_dusccreg_rpr_w(data); break; - case REG_RTR: do_dusccreg_rtr_w(data); break; - case REG_CTPRH: do_dusccreg_ctprh_w(data); break; - case REG_CTPRL: do_dusccreg_ctprl_w(data); break; - case REG_CTCR: do_dusccreg_ctcr_w(data); break; - case REG_OMR: do_dusccreg_omr_w(data); break; -// case REG_CTH: LOG(("REG_CTH \n")); break; // Read only register -// case REG_CTL: LOG(("REG_CTL \n")); break; // Read only register - case REG_PCR: do_dusccreg_pcr_w(data); break; - case REG_CCR: do_dusccreg_ccr_w(data); break; - case REG_TXFIFO_0: do_dusccreg_txfifo_w(data); break; - case REG_TXFIFO_1: do_dusccreg_txfifo_w(data); break; - case REG_TXFIFO_2: do_dusccreg_txfifo_w(data); break; - case REG_TXFIFO_3: do_dusccreg_txfifo_w(data); break; - case REG_RSR: do_dusccreg_rsr_w(data); break; - case REG_TRSR: do_dusccreg_trsr_w(data); break; - case REG_ICTSR: do_dusccreg_ictsr_w(data); break; - case REG_GSR: do_dusccreg_gsr_w(data); break; - case REG_IER: do_dusccreg_ier_w(data); break; - case REG_IVR: do_dusccreg_ivr_w(data); break; - case REG_ICR: do_dusccreg_icr_w(data); break; + case REG_CMR1: do_dusccreg_cmr1_w(data); break; + case REG_CMR2: do_dusccreg_cmr2_w(data); break; + case REG_S1R: do_dusccreg_s1r_w(data); break; + case REG_S2R: do_dusccreg_s2r_w(data); break; + case REG_TPR: do_dusccreg_tpr_w(data); break; + case REG_TTR: do_dusccreg_ttr_w(data); break; + case REG_RPR: do_dusccreg_rpr_w(data); break; + case REG_RTR: do_dusccreg_rtr_w(data); break; + case REG_CTPRH: do_dusccreg_ctprh_w(data); break; + case REG_CTPRL: do_dusccreg_ctprl_w(data); break; + case REG_CTCR: do_dusccreg_ctcr_w(data); break; + case REG_OMR: do_dusccreg_omr_w(data); break; +// case REG_CTH: LOG(("REG_CTH \n")); break; // Read only register +// case REG_CTL: LOG(("REG_CTL \n")); break; // Read only register + case REG_PCR: do_dusccreg_pcr_w(data); break; + case REG_CCR: do_dusccreg_ccr_w(data); break; + case REG_TXFIFO_0: do_dusccreg_txfifo_w(data); break; + case REG_TXFIFO_1: do_dusccreg_txfifo_w(data); break; + case REG_TXFIFO_2: do_dusccreg_txfifo_w(data); break; + case REG_TXFIFO_3: do_dusccreg_txfifo_w(data); break; + case REG_RSR: do_dusccreg_rsr_w(data); break; + case REG_TRSR: do_dusccreg_trsr_w(data); break; + case REG_ICTSR: do_dusccreg_ictsr_w(data); break; + case REG_GSR: do_dusccreg_gsr_w(data); break; + case REG_IER: do_dusccreg_ier_w(data); break; + case REG_IVR: do_dusccreg_ivr_w(data); break; + case REG_ICR: do_dusccreg_icr_w(data); break; // CDUSCC Extended registers - requires A7 to be set through REG_SEA -// case REG_MRR: LOG(("REG_MRR \n")); break; - case REG_SEA: do_dusccreg_sea_rea_w(data); break; /* Also supports REG_REA depending on which channel is written to */ - case REG_IER1: LOG(("REG_IER1\n")); break; - case REG_IER2: LOG(("REG_IER2\n")); break; - case REG_IER3: LOG(("REG_IER3\n")); break; - case REG_TRCR: LOG(("REG_TRCR\n")); break; - case REG_RFLR: LOG(("REG_RFLR\n")); break; - case REG_FTLR: LOG(("REG_FTLR\n")); break; - case REG_TRMSR: LOG(("REG_TRMSR\n")); break; - case REG_TELR: LOG(("REG_TELR\n")); break; +// case REG_MRR: LOG(("REG_MRR \n")); break; + case REG_SEA: do_dusccreg_sea_rea_w(data); break; /* Also supports REG_REA depending on which channel is written to */ + case REG_IER1: LOG(("REG_IER1\n")); break; + case REG_IER2: LOG(("REG_IER2\n")); break; + case REG_IER3: LOG(("REG_IER3\n")); break; + case REG_TRCR: LOG(("REG_TRCR\n")); break; + case REG_RFLR: LOG(("REG_RFLR\n")); break; + case REG_FTLR: LOG(("REG_FTLR\n")); break; + case REG_TRMSR: LOG(("REG_TRMSR\n")); break; + case REG_TELR: LOG(("REG_TELR\n")); break; default: logerror(" \"%s\" %s: %c : Unsupported WRx register:%02x(%02x)\n", m_owner->tag(), FUNCNAME, 'A' + m_index, reg, data); @@ -2323,7 +2321,7 @@ void duscc_channel::receive_data(UINT8 data) { // receive overrun error detected m_rsr |= REG_RSR_OVERRUN_ERROR; - // m_rx_error_fifo[m_rx_fifo_wp] &= ~REG_RSR_OVERRUN_ERROR; // The overrun error is NOT fifoed obviously... + // m_rx_error_fifo[m_rx_fifo_wp] &= ~REG_RSR_OVERRUN_ERROR; // The overrun error is NOT fifoed obviously... logerror("Receive_data() Error %02x\n", m_rsr); } else @@ -2338,7 +2336,7 @@ void duscc_channel::receive_data(UINT8 data) m_rx_fifo_wp = 0; } - // if (m_eir & REG_IER_) + // if (m_eir & REG_IER_) } } diff --git a/src/devices/machine/scnxx562.h b/src/devices/machine/scnxx562.h index ee07df1b124..5365f5f70ac 100644 --- a/src/devices/machine/scnxx562.h +++ b/src/devices/machine/scnxx562.h @@ -241,13 +241,13 @@ public: UINT8 m_ttr; UINT8 m_rpr; UINT8 m_rtr; - // UINT8 m_ctprh; - // UINT8 m_ctprl; + // UINT8 m_ctprh; + // UINT8 m_ctprl; unsigned int m_ctpr; UINT8 m_ctcr; UINT8 m_omr; - // UINT8 m_cth; - // UINT8 m_ctl; + // UINT8 m_cth; + // UINT8 m_ctl; unsigned int m_ct; UINT8 m_pcr; UINT8 m_ccr; @@ -256,13 +256,13 @@ public: UINT8 m_rsr; UINT8 m_trsr; UINT8 m_ictsr; - // UINT8 m_gsr; // moved to the device since it is global + // UINT8 m_gsr; // moved to the device since it is global UINT8 m_ier; // UINT8 m_rea; UINT8 m_cid; //UINT8 m_ivr; //UINT8 m_icr; - // UINT8 m_sea; + // UINT8 m_sea; //UINT8 m_ivrm; UINT8 m_mrr; UINT8 m_ier1; @@ -275,12 +275,12 @@ public: UINT8 m_telr; protected: - enum // Needs to be 0-3 in unmodified prio level + enum // Needs to be 0-3 in unmodified prio level { - INT_RXREADY = 0, - INT_TXREADY = 1, - INT_RXTXSTAT = 2, - INT_EXTCTSTAT = 3 + INT_RXREADY = 0, + INT_TXREADY = 1, + INT_RXTXSTAT = 2, + INT_EXTCTSTAT = 3 }; enum @@ -292,9 +292,9 @@ protected: REG_CCR_ENABLE_RX = 0x42, REG_CCR_DISABLE_RX = 0x43, REG_CCR_START_TIMER = 0x80, - REG_CCR_STOP_TIMER = 0x81, - REG_CCR_PRST_FFFF = 0x82, - REG_CCR_PRST_CTPR = 0x83, + REG_CCR_STOP_TIMER = 0x81, + REG_CCR_PRST_FFFF = 0x82, + REG_CCR_PRST_CTPR = 0x83, }; enum @@ -403,24 +403,24 @@ protected: enum { - REG_RSR_CHAR_COMPARE = 0x80, - REG_RSR_OVERRUN_ERROR = 0x20, - REG_RSR_FRAMING_ERROR = 0x02, - REG_RSR_PARITY_ERROR = 0x01, + REG_RSR_CHAR_COMPARE = 0x80, + REG_RSR_OVERRUN_ERROR = 0x20, + REG_RSR_FRAMING_ERROR = 0x02, + REG_RSR_PARITY_ERROR = 0x01, }; enum { - REG_GSR_CHAN_A_RXREADY = 0x01, - REG_GSR_CHAN_B_RXREADY = 0x10, - REG_GSR_CHAN_A_TXREADY = 0x02, - REG_GSR_CHAN_B_TXREADY = 0x20, - REG_GSR_XXREADY_MASK = 0x33 + REG_GSR_CHAN_A_RXREADY = 0x01, + REG_GSR_CHAN_B_RXREADY = 0x10, + REG_GSR_CHAN_A_TXREADY = 0x02, + REG_GSR_CHAN_B_TXREADY = 0x20, + REG_GSR_XXREADY_MASK = 0x33 }; enum { - REG_ICTSR_ZERO_DET = 0x40, + REG_ICTSR_ZERO_DET = 0x40, REG_ICTSR_DELTA_CTS = 0x10, REG_ICTSR_DCD = 0x08, REG_ICTSR_CTS = 0x04, @@ -428,14 +428,14 @@ protected: enum { - REG_IER_DCD_CTS = 0x80, - REG_IER_TXRDY = 0x40, - REG_IER_TRSR73 = 0x20, - REG_IER_RXRDY = 0x10, - REG_IER_RSR76 = 0x08, - REG_IER_RSR54 = 0x04, - REG_IER_RSR32 = 0x02, - REG_IER_RSR10 = 0x01, + REG_IER_DCD_CTS = 0x80, + REG_IER_TXRDY = 0x40, + REG_IER_TRSR73 = 0x20, + REG_IER_RXRDY = 0x10, + REG_IER_RSR76 = 0x08, + REG_IER_RSR54 = 0x04, + REG_IER_RSR32 = 0x02, + REG_IER_RSR10 = 0x01, }; // Register offsets, stripped from channel bit 0x20 but including A7 bit @@ -494,13 +494,13 @@ protected: UINT8 m_rtxc; UINT8 m_trxc; - + enum { - REG_CTCR_ZERO_DET_INT = 0x80, - REG_CTCR_ZERO_DET_CTL = 0x40, - REG_CTCR_TIM_OC = 0x20, + REG_CTCR_ZERO_DET_INT = 0x80, + REG_CTCR_ZERO_DET_CTL = 0x40, + REG_CTCR_TIM_OC = 0x20, }; enum @@ -731,15 +731,15 @@ protected: enum { - REG_ICR_CHB = 0x01, - REG_ICR_CHA = 0x02, - REG_ICR_VEC_MOD = 0x04, - REG_ICR_V2V4_MOD = 0x08, - REG_ICR_PRIO_MASK = 0xC0, - REG_ICR_PRIO_AHI = 0x00, - REG_ICR_PRIO_BHI = 0x40, - REG_ICR_PRIO_AINT = 0x80, - REG_ICR_PRIO_BINT = 0xC0, + REG_ICR_CHB = 0x01, + REG_ICR_CHA = 0x02, + REG_ICR_VEC_MOD = 0x04, + REG_ICR_V2V4_MOD = 0x08, + REG_ICR_PRIO_MASK = 0xC0, + REG_ICR_PRIO_AHI = 0x00, + REG_ICR_PRIO_BHI = 0x40, + REG_ICR_PRIO_AINT = 0x80, + REG_ICR_PRIO_BINT = 0xC0, }; }; diff --git a/src/devices/machine/terminal.cpp b/src/devices/machine/terminal.cpp index a2be090b261..15a7897e816 100644 --- a/src/devices/machine/terminal.cpp +++ b/src/devices/machine/terminal.cpp @@ -141,24 +141,20 @@ static const UINT8 terminal_font[256*16] = }; generic_terminal_device::generic_terminal_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) - : device_t(mconfig, type, name, tag, owner, clock, shortname, source), - m_palette(*this, "palette"), - m_io_term_conf(*this, "TERM_CONF"), - m_x_pos(0), - m_framecnt(0), - m_y_pos(0), - m_keyboard_cb(*this) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source) + , m_palette(*this, "palette") + , m_io_term_conf(*this, "TERM_CONF") + , m_x_pos(0) + , m_framecnt(0) + , m_y_pos(0) + , m_bell_timer(nullptr) + , m_beeper(*this, "beeper") + , m_keyboard_cb(*this) { } generic_terminal_device::generic_terminal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, GENERIC_TERMINAL, "Generic Terminal", tag, owner, clock, "generic_terminal", __FILE__), - m_palette(*this, "palette"), - m_io_term_conf(*this, "TERM_CONF"), - m_x_pos(0), - m_framecnt(0), - m_y_pos(0), - m_keyboard_cb(*this) + : generic_terminal_device(mconfig, GENERIC_TERMINAL, "Generic Terminal", tag, owner, clock, "generic_terminal", __FILE__) { } @@ -186,7 +182,7 @@ void generic_terminal_device::write_char(UINT8 data) void generic_terminal_device::clear() { - memset(m_buffer,0x20,TERMINAL_WIDTH*TERMINAL_HEIGHT); + std::fill(std::begin(m_buffer), std::end(m_buffer), 0x20); m_x_pos = 0; m_y_pos = 0; } @@ -196,44 +192,52 @@ void generic_terminal_device::term_write(UINT8 data) if (data > 0x1f) { // printable char - if (data!=0x7f) write_char(data); + if (data != 0x7f) write_char(data); } else { + const UINT16 options = m_io_term_conf->read(); switch(data) { - case 0x07 : // bell - break; - - case 0x08: if (m_x_pos) m_x_pos--; - break; - - case 0x09: m_x_pos = (m_x_pos & 0xf8) + 8; - if (m_x_pos >= TERMINAL_WIDTH) - m_x_pos = TERMINAL_WIDTH-1; - break; - - case 0x0a: m_y_pos++; - m_x_pos = 0; - if (m_y_pos >= TERMINAL_HEIGHT) - { - scroll_line(); - m_y_pos = TERMINAL_HEIGHT-1; - } - break; - - case 0x0b: if (m_y_pos) m_y_pos--; - break; + case 0x07: // bell + m_beeper->set_state(1); + m_bell_timer->reset(attotime::from_msec(250)); + break; + + case 0x08: // backspace + if (m_x_pos) m_x_pos--; + break; + + case 0x09: // horizontal tab + m_x_pos = (std::min<UINT8>)((m_x_pos & 0xf8) + 8, TERMINAL_WIDTH - 1); + break; + + case 0x0d: // carriage return + m_x_pos = 0; + if (!(options & 0x080)) break; + + case 0x0a: // linefeed + m_y_pos++; + if (m_y_pos >= TERMINAL_HEIGHT) + { + scroll_line(); + m_y_pos = TERMINAL_HEIGHT - 1; + } + if (options & 0x040) m_x_pos = 0; + break; - case 0x0c: clear(); - break; + case 0x0b: // vertical tab + if (m_y_pos) m_y_pos--; + break; - case 0x0d: m_x_pos = 0; - break; + case 0x0c: // form feed + clear(); + break; - case 0x1e: m_x_pos = 0; - m_y_pos = 0; - break; + case 0x1e: // record separator + m_x_pos = 0; + m_y_pos = 0; + break; } } } @@ -243,17 +247,17 @@ void generic_terminal_device::term_write(UINT8 data) ***************************************************************************/ UINT32 generic_terminal_device::update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - UINT8 options = m_io_term_conf->read(); + const UINT16 options = m_io_term_conf->read(); UINT16 cursor = m_y_pos * TERMINAL_WIDTH + m_x_pos; UINT8 y,ra,chr,gfx; UINT16 sy=0,ma=0,x; - switch (options & 0x30) + switch (options & 0x030) { - case 0x10: + case 0x010: m_palette->set_pen_color(1, rgb_t(0xf7, 0xaa, 0x00)); break; - case 0x20: + case 0x020: m_palette->set_pen_color(1, rgb_t::white); break; default: @@ -275,16 +279,16 @@ UINT32 generic_terminal_device::update(screen_device &device, bitmap_rgb32 &bitm chr = m_buffer[x]; gfx = terminal_font[(chr<<4) | ra ]; - if ((x == cursor) && (options & 1)) // at cursor position and want a cursor + if ((x == cursor) && (options & 0x001)) // at cursor position and want a cursor { if ((options & 2) || (ra == 9)) // block, or underline & at bottom line { - if ((options & 4) && (m_framecnt & 8)) // want blink & time to blink + if ((options & 0x004) && (m_framecnt & 8)) // want blink & time to blink { } else { - if (options & 8) + if (options & 0x008) gfx ^= 0xff; // invert else gfx |= 0xff; // overwrite @@ -303,15 +307,15 @@ UINT32 generic_terminal_device::update(screen_device &device, bitmap_rgb32 &bitm *p++ = (BIT( gfx, 0 ))?font_color:0; } } - ma+=TERMINAL_WIDTH; + ma += TERMINAL_WIDTH; } return 0; } WRITE8_MEMBER( generic_terminal_device::kbd_put ) { - if (data) - send_key(data); + if (m_io_term_conf->read() & 0x100) term_write(data); + send_key(data); } /*************************************************************************** @@ -330,6 +334,10 @@ static MACHINE_CONFIG_FRAGMENT( generic_terminal ) MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) MCFG_GENERIC_KEYBOARD_CB(WRITE8(generic_terminal_device, kbd_put)) + + MCFG_SPEAKER_STANDARD_MONO("bell") + MCFG_SOUND_ADD("beeper", BEEP, 2'000) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "bell", 0.50) MACHINE_CONFIG_END machine_config_constructor generic_terminal_device::device_mconfig_additions() const @@ -339,6 +347,7 @@ machine_config_constructor generic_terminal_device::device_mconfig_additions() c void generic_terminal_device::device_start() { + m_bell_timer = timer_alloc(BELL_TIMER_ID); m_keyboard_cb.resolve_safe(); save_item(NAME(m_buffer)); save_item(NAME(m_x_pos)); @@ -348,10 +357,21 @@ void generic_terminal_device::device_start() void generic_terminal_device::device_reset() { + m_beeper->set_state(0); clear(); m_framecnt = 0; } +void generic_terminal_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case BELL_TIMER_ID: + m_beeper->set_state(0); + break; + } +} + /* Char Dec Oct Hex | Char Dec Oct Hex | Char Dec Oct Hex | Char Dec Oct Hex ------------------------------------------------------------------------------------- @@ -391,22 +411,31 @@ Char Dec Oct Hex | Char Dec Oct Hex | Char Dec Oct Hex | Char Dec Oct */ INPUT_PORTS_START( generic_terminal ) PORT_START("TERM_CONF") - PORT_CONFNAME( 0x01, 0x01, "Cursor") - PORT_CONFSETTING( 0x00, DEF_STR(No)) - PORT_CONFSETTING( 0x01, DEF_STR(Yes)) - PORT_CONFNAME( 0x02, 0x02, "Type") - PORT_CONFSETTING( 0x00, "Underline") - PORT_CONFSETTING( 0x02, "Block") - PORT_CONFNAME( 0x04, 0x04, "Blinking") - PORT_CONFSETTING( 0x00, DEF_STR(No)) - PORT_CONFSETTING( 0x04, DEF_STR(Yes)) - PORT_CONFNAME( 0x08, 0x08, "Invert") - PORT_CONFSETTING( 0x00, DEF_STR(No)) - PORT_CONFSETTING( 0x08, DEF_STR(Yes)) - PORT_CONFNAME( 0x30, 0x00, "Color") - PORT_CONFSETTING( 0x00, "Green") - PORT_CONFSETTING( 0x10, "Amber") - PORT_CONFSETTING( 0x20, "White") + PORT_CONFNAME( 0x001, 0x001, "Cursor" ) + PORT_CONFSETTING( 0x000, DEF_STR(No) ) + PORT_CONFSETTING( 0x001, DEF_STR(Yes) ) + PORT_CONFNAME( 0x002, 0x002, "Type" ) + PORT_CONFSETTING( 0x000, "Underline" ) + PORT_CONFSETTING( 0x002, "Block" ) + PORT_CONFNAME( 0x004, 0x004, "Blinking" ) + PORT_CONFSETTING( 0x000, DEF_STR(No) ) + PORT_CONFSETTING( 0x004, DEF_STR(Yes) ) + PORT_CONFNAME( 0x008, 0x008, "Invert" ) + PORT_CONFSETTING( 0x000, DEF_STR(No) ) + PORT_CONFSETTING( 0x008, DEF_STR(Yes) ) + PORT_CONFNAME( 0x030, 0x000, "Color" ) + PORT_CONFSETTING( 0x000, "Green" ) + PORT_CONFSETTING( 0x010, "Amber" ) + PORT_CONFSETTING( 0x020, "White" ) + PORT_CONFNAME( 0x040, 0x000, "Auto CR on LF" ) + PORT_CONFSETTING( 0x000, DEF_STR(No) ) + PORT_CONFSETTING( 0x040, DEF_STR(Yes) ) + PORT_CONFNAME( 0x080, 0x000, "Auto LF on CR" ) + PORT_CONFSETTING( 0x000, DEF_STR(No) ) + PORT_CONFSETTING( 0x080, DEF_STR(Yes) ) + PORT_CONFNAME( 0x100, 0x000, "Local echo" ) + PORT_CONFSETTING( 0x000, DEF_STR(No) ) + PORT_CONFSETTING( 0x100, DEF_STR(Yes) ) INPUT_PORTS_END ioport_constructor generic_terminal_device::device_input_ports() const diff --git a/src/devices/machine/terminal.h b/src/devices/machine/terminal.h index 0f6901629af..5b8112c9823 100644 --- a/src/devices/machine/terminal.h +++ b/src/devices/machine/terminal.h @@ -1,9 +1,10 @@ // license:BSD-3-Clause // copyright-holders:Miodrag Milanovic -#ifndef __TERMINAL_H__ -#define __TERMINAL_H__ +#ifndef MAME_DEVICES_TERMINAL_H +#define MAME_DEVICES_TERMINAL_H #include "machine/keyboard.h" +#include "sound/beep.h" #define TERMINAL_SCREEN_TAG "terminal_screen" @@ -37,16 +38,22 @@ public: virtual ioport_constructor device_input_ports() const override; virtual machine_config_constructor device_mconfig_additions() const override; + protected: - optional_device<palette_device> m_palette; - required_ioport m_io_term_conf; + enum { BELL_TIMER_ID = 20'000 }; virtual void term_write(UINT8 data); virtual void device_start() override; virtual void device_reset() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; virtual void send_key(UINT8 code) { m_keyboard_cb((offs_t)0, code); } - UINT8 m_buffer[TERMINAL_WIDTH*50]; // make big enough for teleprinter + + optional_device<palette_device> m_palette; + required_ioport m_io_term_conf; + + UINT8 m_buffer[TERMINAL_WIDTH * 50]; // make big enough for teleprinter UINT8 m_x_pos; + private: void scroll_line(); void write_char(UINT8 data); @@ -55,9 +62,11 @@ private: UINT8 m_framecnt; UINT8 m_y_pos; + emu_timer *m_bell_timer; + required_device<beep_device> m_beeper; devcb_write8 m_keyboard_cb; }; extern const device_type GENERIC_TERMINAL; -#endif /* __TERMINAL_H__ */ +#endif /* MAME_DEVICES_TERMINAL_H */ diff --git a/src/devices/machine/z80scc.cpp b/src/devices/machine/z80scc.cpp index 5e1e7f984f9..04a197d0e1a 100644 --- a/src/devices/machine/z80scc.cpp +++ b/src/devices/machine/z80scc.cpp @@ -79,7 +79,7 @@ DONE (x) (p=partly) NMOS CMOS ESCC EMSCC // printf("TAG %lld %s%s Data:%d\n", machine().firstcpu->total_cycles(), __PRETTY_FUNCTION__, m_owner->tag(), data); #define VERBOSE 0 -#define LOGPRINT(x) do { if (VERBOSE) logerror x; } while (0) +#define LOGPRINT(x) do { if (VERBOSE) logerror x; } while (0) #define LOG(x) LOGPRINT(x) #define LOGR(x) #define LOGSETUP(x) LOGPRINT(x) @@ -1602,7 +1602,7 @@ void z80scc_channel::do_sccreg_wr4(UINT8 data) if (data == m_wr4) { logerror("- supressing reinit of Tx as write to wr4 is identical to previous value\n"); - } + } else { m_wr4 = data; @@ -1622,7 +1622,7 @@ void z80scc_channel::do_sccreg_wr5(UINT8 data) if (data == m_wr5) { logerror("- supressing reinit of Tx as write to wr5 is identical to previous value\n"); - } + } else { m_wr5 = data; @@ -1962,22 +1962,22 @@ void z80scc_channel::control_write(UINT8 data) /* TODO. Sort out 80X30 & other SCC variants limitations in register access */ switch (reg) { - case REG_WR0_COMMAND_REGPT: do_sccreg_wr0(data); break; - case REG_WR1_INT_DMA_ENABLE: do_sccreg_wr1(data); m_uart->check_interrupts(); break; - case REG_WR2_INT_VECTOR: do_sccreg_wr2(data); break; - case REG_WR3_RX_CONTROL: do_sccreg_wr3(data); break; - case REG_WR4_RX_TX_MODES: do_sccreg_wr4(data); break; - case REG_WR5_TX_CONTROL: do_sccreg_wr5(data); break; - case REG_WR6_SYNC_OR_SDLC_A: do_sccreg_wr6(data); break; - case REG_WR7_SYNC_OR_SDLC_F: do_sccreg_wr7(data); break; - case REG_WR8_TRANSMIT_DATA: do_sccreg_wr8(data); break; - case REG_WR9_MASTER_INT_CTRL: do_sccreg_wr9(data); break; - case REG_WR10_MSC_RX_TX_CTRL: do_sccreg_wr10(data); break; - case REG_WR11_CLOCK_MODES: do_sccreg_wr11(data); break; - case REG_WR12_LO_BAUD_GEN: do_sccreg_wr12(data); break; - case REG_WR13_HI_BAUD_GEN: do_sccreg_wr13(data); break; - case REG_WR14_MISC_CTRL: do_sccreg_wr14(data); break; - case REG_WR15_EXT_ST_INT_CTRL: do_sccreg_wr15(data); break; + case REG_WR0_COMMAND_REGPT: do_sccreg_wr0(data); break; + case REG_WR1_INT_DMA_ENABLE: do_sccreg_wr1(data); m_uart->check_interrupts(); break; + case REG_WR2_INT_VECTOR: do_sccreg_wr2(data); break; + case REG_WR3_RX_CONTROL: do_sccreg_wr3(data); break; + case REG_WR4_RX_TX_MODES: do_sccreg_wr4(data); break; + case REG_WR5_TX_CONTROL: do_sccreg_wr5(data); break; + case REG_WR6_SYNC_OR_SDLC_A: do_sccreg_wr6(data); break; + case REG_WR7_SYNC_OR_SDLC_F: do_sccreg_wr7(data); break; + case REG_WR8_TRANSMIT_DATA: do_sccreg_wr8(data); break; + case REG_WR9_MASTER_INT_CTRL: do_sccreg_wr9(data); break; + case REG_WR10_MSC_RX_TX_CTRL: do_sccreg_wr10(data); break; + case REG_WR11_CLOCK_MODES: do_sccreg_wr11(data); break; + case REG_WR12_LO_BAUD_GEN: do_sccreg_wr12(data); break; + case REG_WR13_HI_BAUD_GEN: do_sccreg_wr13(data); break; + case REG_WR14_MISC_CTRL: do_sccreg_wr14(data); break; + case REG_WR15_EXT_ST_INT_CTRL: do_sccreg_wr15(data); break; default: logerror("\"%s\": %c : Unsupported WRx register:%02x\n", m_owner->tag(), 'A' + m_index, reg); } @@ -2361,14 +2361,14 @@ WRITE_LINE_MEMBER( z80scc_channel::txc_w ) } //-------------------------------------------------------------------------------------------------------- -// safe_transmit_register_reset - wait for the transmitter shift register to be -// emptied before apply the new value of wr5 and/or wr4. In the case of a Tx FIFO +// safe_transmit_register_reset - wait for the transmitter shift register to be +// emptied before apply the new value of wr5 and/or wr4. In the case of a Tx FIFO // the change will occur before next character is started. From the specification: // // "The character length may be changed on the fly, but the desired length must be selected before the // character is loaded into the Transmit Shift register from the transmit data FIFO. The easiest way to // ensure this is to write to WR5 to change the character length before writing the data to the transmit -// buffer." +// buffer." // // Right now we only detect the problem and log an error //--------------------------------------------------------------------------------------------------------- @@ -2424,11 +2424,11 @@ void z80scc_channel::update_serial() if (m_brg_rate != 0 || m_wr14 & WR14_BRG_ENABLE) { - if (m_brg_rate == 1) + if (m_brg_rate == 1) { m_brg_rate = 0; // BRG beeing disabled } - else // or enabled + else // or enabled { m_brg_const = 2 + (m_wr13 << 8 | m_wr12); int rate = m_owner->clock() / (m_brg_const == 0 ? 1 : m_brg_const); diff --git a/src/devices/sound/qs1000.h b/src/devices/sound/qs1000.h index 6894164fb38..d94d964ed19 100644 --- a/src/devices/sound/qs1000.h +++ b/src/devices/sound/qs1000.h @@ -102,7 +102,7 @@ public: DECLARE_READ8_MEMBER( p3_r ); DECLARE_WRITE8_MEMBER( p3_w ); - + DECLARE_READ8_MEMBER( data_to_i8052 ); enum diff --git a/src/devices/sound/ym2151.cpp b/src/devices/sound/ym2151.cpp index 3f149267900..a753e6ede27 100644 --- a/src/devices/sound/ym2151.cpp +++ b/src/devices/sound/ym2151.cpp @@ -1103,7 +1103,7 @@ void ym2151_device::chan_calc(unsigned int chan) env = volume_calc(op+3); /* C2 */ if (env < ENV_QUIET) chanout[chan] += op_calc(op+3, env, c2); - // if(chan==3) printf("%d\n", chanout[chan]); + // if(chan==3) printf("%d\n", chanout[chan]); /* M1 */ op->mem_value = mem; diff --git a/src/devices/sound/ym2413.cpp b/src/devices/sound/ym2413.cpp index 78206bca856..5fd92f9946f 100644 --- a/src/devices/sound/ym2413.cpp +++ b/src/devices/sound/ym2413.cpp @@ -1679,6 +1679,6 @@ const device_type YM2413 = &device_creator<ym2413_device>; ym2413_device::ym2413_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, YM2413, "YM2413", tag, owner, clock, "ym2413", __FILE__), - device_sound_interface(mconfig, *this) + device_sound_interface(mconfig, *this) { } diff --git a/src/devices/sound/ym2413.h b/src/devices/sound/ym2413.h index 371066cdfa4..5a7164faec9 100644 --- a/src/devices/sound/ym2413.h +++ b/src/devices/sound/ym2413.h @@ -8,7 +8,7 @@ #include "emu.h" class ym2413_device : public device_t, - public device_sound_interface + public device_sound_interface { public: ym2413_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); diff --git a/src/devices/video/ef9365.cpp b/src/devices/video/ef9365.cpp index f2a69d053ab..d7277e82604 100644 --- a/src/devices/video/ef9365.cpp +++ b/src/devices/video/ef9365.cpp @@ -123,7 +123,7 @@ const char * commands_names[]= // devices const device_type EF9365 = &device_creator<ef9365_device>; - + ROM_START( ef9365 ) ROM_REGION( 0x1E0, "ef9365", 0 ) ROM_LOAD( "charset_ef9365.rom", 0x0000, 0x01E0, CRC(8d3053be) SHA1(0f9a64d217a0f7f04ee0720d49c5b680ad0ae359) ) diff --git a/src/devices/video/zeus2.cpp b/src/devices/video/zeus2.cpp index 655df3f3084..0f885af9b3e 100644 --- a/src/devices/video/zeus2.cpp +++ b/src/devices/video/zeus2.cpp @@ -967,7 +967,7 @@ void zeus2_device::zeus2_draw_model(UINT32 baseaddr, UINT16 count, int logit) if (logit) { //if ((cmd == 0x38) || (cmd == 0x2d)) - // log_render_info(); + // log_render_info(); int offs; logerror("\t"); for (offs = 0; offs < databufcount; offs++) @@ -1014,8 +1014,8 @@ void zeus2_device::zeus2_draw_model(UINT32 baseaddr, UINT16 count, int logit) default: //if (quadsize == 10) //{ - // logerror("Correcting quad size\n"); - // quadsize = 14; + // logerror("Correcting quad size\n"); + // quadsize = 14; //} if (logit) logerror("unknown model data\n"); @@ -1212,9 +1212,9 @@ void zeus2_renderer::zeus2_draw_quad(const UINT32 *databuffer, UINT32 texdata, i float y = vert[i].y; float z = vert[i].p[0]; //if (0) { - // x *= xScale; - // y *= yScale; - // z *= zScale; + // x *= xScale; + // y *= yScale; + // z *= zScale; //} vert[i].x = x * m_state->zeus_matrix[0][0] + y * m_state->zeus_matrix[0][1] + z * m_state->zeus_matrix[0][2]; diff --git a/src/devices/video/zeus2.h b/src/devices/video/zeus2.h index 135d900f86c..d90a7b33c07 100644 --- a/src/devices/video/zeus2.h +++ b/src/devices/video/zeus2.h @@ -227,7 +227,7 @@ public: // Convert 0xRRRRCCCC to frame buffer addresss //inline UINT32 frame_addr_from_expanded_addr(UINT32 addr) //{ - // return (((addr & 0x3ff0000) >> (16 - 9 + 1)) | (addr & 0x1ff)) << 1; + // return (((addr & 0x3ff0000) >> (16 - 9 + 1)) | (addr & 0x1ff)) << 1; //} // Convert Physical 0xRRRRCCCC to frame buffer addresss diff --git a/src/emu/attotime.h b/src/emu/attotime.h index fce0b928e88..e90a4911126 100644 --- a/src/emu/attotime.h +++ b/src/emu/attotime.h @@ -30,12 +30,11 @@ * full 64-bit value, there is headroom to make some operations simpler. */ /**************************************************************************/ +#ifndef MAME_EMU_ATTOTIME_H +#define MAME_EMU_ATTOTIME_H #pragma once -#ifndef __ATTOTIME_H__ -#define __ATTOTIME_H__ - #include <math.h> #undef min #undef max @@ -49,13 +48,13 @@ typedef INT64 attoseconds_t; typedef INT32 seconds_t; // core definitions -const attoseconds_t ATTOSECONDS_PER_SECOND_SQRT = 1000000000; +const attoseconds_t ATTOSECONDS_PER_SECOND_SQRT = 1'000'000'000; const attoseconds_t ATTOSECONDS_PER_SECOND = ATTOSECONDS_PER_SECOND_SQRT * ATTOSECONDS_PER_SECOND_SQRT; -const attoseconds_t ATTOSECONDS_PER_MILLISECOND = ATTOSECONDS_PER_SECOND / 1000; -const attoseconds_t ATTOSECONDS_PER_MICROSECOND = ATTOSECONDS_PER_SECOND / 1000000; -const attoseconds_t ATTOSECONDS_PER_NANOSECOND = ATTOSECONDS_PER_SECOND / 1000000000; +const attoseconds_t ATTOSECONDS_PER_MILLISECOND = ATTOSECONDS_PER_SECOND / 1'000; +const attoseconds_t ATTOSECONDS_PER_MICROSECOND = ATTOSECONDS_PER_SECOND / 1'000'000; +const attoseconds_t ATTOSECONDS_PER_NANOSECOND = ATTOSECONDS_PER_SECOND / 1'000'000'000; -const seconds_t ATTOTIME_MAX_SECONDS = 1000000000; +const seconds_t ATTOTIME_MAX_SECONDS = 1'000'000'000; @@ -64,18 +63,18 @@ const seconds_t ATTOTIME_MAX_SECONDS = 1000000000; //************************************************************************** // convert between a double and attoseconds -#define ATTOSECONDS_TO_DOUBLE(x) ((double)(x) * 1e-18) -#define DOUBLE_TO_ATTOSECONDS(x) ((attoseconds_t)((x) * 1e18)) +inline constexpr double ATTOSECONDS_TO_DOUBLE(attoseconds_t x) { return double(x) * 1e-18; } +inline constexpr attoseconds_t DOUBLE_TO_ATTOSECONDS(double x) { return attoseconds_t(x * 1e18); } // convert between hertz (as a double) and attoseconds -#define ATTOSECONDS_TO_HZ(x) ((double)ATTOSECONDS_PER_SECOND / (double)(x)) -#define HZ_TO_ATTOSECONDS(x) ((attoseconds_t)(ATTOSECONDS_PER_SECOND / (x))) +inline constexpr double ATTOSECONDS_TO_HZ(attoseconds_t x) { return double(ATTOSECONDS_PER_SECOND) / double(x); } +template <typename T> inline constexpr attoseconds_t HZ_TO_ATTOSECONDS(T &&x) { return attoseconds_t(ATTOSECONDS_PER_SECOND / x); } // macros for converting other seconds types to attoseconds -#define ATTOSECONDS_IN_SEC(x) ((attoseconds_t)(x) * ATTOSECONDS_PER_SECOND) -#define ATTOSECONDS_IN_MSEC(x) ((attoseconds_t)(x) * ATTOSECONDS_PER_MILLISECOND) -#define ATTOSECONDS_IN_USEC(x) ((attoseconds_t)(x) * ATTOSECONDS_PER_MICROSECOND) -#define ATTOSECONDS_IN_NSEC(x) ((attoseconds_t)(x) * ATTOSECONDS_PER_NANOSECOND) +template <typename T> inline constexpr attoseconds_t ATTOSECONDS_IN_SEC(T &&x) { return attoseconds_t(x) * ATTOSECONDS_PER_SECOND; } +template <typename T> inline constexpr attoseconds_t ATTOSECONDS_IN_MSEC(T &&x) { return attoseconds_t(x) * ATTOSECONDS_PER_MILLISECOND; } +template <typename T> inline constexpr attoseconds_t ATTOSECONDS_IN_USEC(T &&x) { return attoseconds_t(x) * ATTOSECONDS_PER_MICROSECOND; } +template <typename T> inline constexpr attoseconds_t ATTOSECONDS_IN_NSEC(T &&x) { return attoseconds_t(x) * ATTOSECONDS_PER_NANOSECOND; } @@ -88,18 +87,12 @@ class attotime { public: // construction/destruction - attotime() - : m_seconds(0), - m_attoseconds(0) { } + constexpr attotime() : m_seconds(0), m_attoseconds(0) { } /** Constructs with @p secs seconds and @p attos attoseconds. */ - attotime(seconds_t secs, attoseconds_t attos) - : m_seconds(secs), - m_attoseconds(attos) { } + constexpr attotime(seconds_t secs, attoseconds_t attos) : m_seconds(secs), m_attoseconds(attos) { } - attotime(const attotime& that) - : m_seconds(that.m_seconds), - m_attoseconds(that.m_attoseconds) { } + constexpr attotime(const attotime& that) : m_seconds(that.m_seconds), m_attoseconds(that.m_attoseconds) { } // assignment attotime& operator=(const attotime& that) @@ -110,32 +103,32 @@ public: } // queries - bool is_zero() const { return (m_seconds == 0 && m_attoseconds == 0); } + constexpr bool is_zero() const { return (m_seconds == 0 && m_attoseconds == 0); } /** Test if value is above @ref ATTOTIME_MAX_SECONDS (considered an overflow) */ - bool is_never() const { return (m_seconds >= ATTOTIME_MAX_SECONDS); } + constexpr bool is_never() const { return (m_seconds >= ATTOTIME_MAX_SECONDS); } // conversion to other forms - double as_double() const { return double(m_seconds) + ATTOSECONDS_TO_DOUBLE(m_attoseconds); } - attoseconds_t as_attoseconds() const; + constexpr double as_double() const { return double(m_seconds) + ATTOSECONDS_TO_DOUBLE(m_attoseconds); } + constexpr attoseconds_t as_attoseconds() const; UINT64 as_ticks(UINT32 frequency) const; /** Convert to string using at @p precision */ const char *as_string(int precision = 9) const; /** @return the attoseconds portion. */ - attoseconds_t attoseconds() const { return m_attoseconds; } + constexpr attoseconds_t attoseconds() const { return m_attoseconds; } /** @return the seconds portion. */ - seconds_t seconds() const { return m_seconds; } + constexpr seconds_t seconds() const { return m_seconds; } static attotime from_double(double _time); static attotime from_ticks(UINT64 ticks, UINT32 frequency); /** Create an attotime from a integer count of seconds @seconds */ - static attotime from_seconds(INT32 seconds) { return attotime(seconds, 0); } + static constexpr attotime from_seconds(INT32 seconds) { return attotime(seconds, 0); } /** Create an attotime from a integer count of milliseconds @msec */ - static attotime from_msec(INT64 msec) { return attotime(msec / 1000, (msec % 1000) * (ATTOSECONDS_PER_SECOND / 1000)); } + static constexpr attotime from_msec(INT64 msec) { return attotime(msec / 1000, (msec % 1000) * (ATTOSECONDS_PER_SECOND / 1000)); } /** Create an attotime from a integer count of microseconds @usec */ - static attotime from_usec(INT64 usec) { return attotime(usec / 1000000, (usec % 1000000) * (ATTOSECONDS_PER_SECOND / 1000000)); } + static constexpr attotime from_usec(INT64 usec) { return attotime(usec / 1000000, (usec % 1000000) * (ATTOSECONDS_PER_SECOND / 1000000)); } /** Create an attotime from a integer count of nanoseconds @nsec */ - static attotime from_nsec(INT64 nsec) { return attotime(nsec / 1000000000, (nsec % 1000000000) * (ATTOSECONDS_PER_SECOND / 1000000000)); } + static constexpr attotime from_nsec(INT64 nsec) { return attotime(nsec / 1000000000, (nsec % 1000000000) * (ATTOSECONDS_PER_SECOND / 1000000000)); } /** Create an attotime from at the given frequency @frequency */ static attotime from_hz(double frequency) { assert(frequency > 0); double d = 1 / frequency; return attotime(floor(d), modf(d, &d) * ATTOSECONDS_PER_SECOND); } @@ -277,32 +270,32 @@ inline attotime operator/(const attotime &left, UINT32 factor) /** handle comparisons between attotimes */ -inline bool operator==(const attotime &left, const attotime &right) +inline constexpr bool operator==(const attotime &left, const attotime &right) { return (left.m_seconds == right.m_seconds && left.m_attoseconds == right.m_attoseconds); } -inline bool operator!=(const attotime &left, const attotime &right) +inline constexpr bool operator!=(const attotime &left, const attotime &right) { return (left.m_seconds != right.m_seconds || left.m_attoseconds != right.m_attoseconds); } -inline bool operator<(const attotime &left, const attotime &right) +inline constexpr bool operator<(const attotime &left, const attotime &right) { return (left.m_seconds < right.m_seconds || (left.m_seconds == right.m_seconds && left.m_attoseconds < right.m_attoseconds)); } -inline bool operator<=(const attotime &left, const attotime &right) +inline constexpr bool operator<=(const attotime &left, const attotime &right) { return (left.m_seconds < right.m_seconds || (left.m_seconds == right.m_seconds && left.m_attoseconds <= right.m_attoseconds)); } -inline bool operator>(const attotime &left, const attotime &right) +inline constexpr bool operator>(const attotime &left, const attotime &right) { return (left.m_seconds > right.m_seconds || (left.m_seconds == right.m_seconds && left.m_attoseconds > right.m_attoseconds)); } -inline bool operator>=(const attotime &left, const attotime &right) +inline constexpr bool operator>=(const attotime &left, const attotime &right) { return (left.m_seconds > right.m_seconds || (left.m_seconds == right.m_seconds && left.m_attoseconds >= right.m_attoseconds)); } @@ -312,15 +305,9 @@ inline bool operator>=(const attotime &left, const attotime &right) // min - return the minimum of two attotimes //------------------------------------------------- -inline attotime min(const attotime &left, const attotime &right) +inline constexpr attotime min(const attotime &left, const attotime &right) { - if (left.m_seconds > right.m_seconds) - return right; - if (left.m_seconds < right.m_seconds) - return left; - if (left.m_attoseconds > right.m_attoseconds) - return right; - return left; + return (left.m_seconds > right.m_seconds) ? right : (left.m_seconds < right.m_seconds) ? left : (left.m_attoseconds > right.m_attoseconds) ? right : left; } @@ -328,35 +315,19 @@ inline attotime min(const attotime &left, const attotime &right) // max - return the maximum of two attotimes //------------------------------------------------- -inline attotime max(const attotime &left, const attotime &right) +inline constexpr attotime max(const attotime &left, const attotime &right) { - if (left.m_seconds > right.m_seconds) - return left; - if (left.m_seconds < right.m_seconds) - return right; - if (left.m_attoseconds > right.m_attoseconds) - return left; - return right; + return (left.m_seconds > right.m_seconds) ? left : (left.m_seconds < right.m_seconds) ? right : (left.m_attoseconds > right.m_attoseconds) ? left : right; } /** Convert to an attoseconds value, clamping to +/- 1 second */ -inline attoseconds_t attotime::as_attoseconds() const +inline constexpr attoseconds_t attotime::as_attoseconds() const { - // positive values between 0 and 1 second - if (m_seconds == 0) - return m_attoseconds; - - // negative values between -1 and 0 seconds - else if (m_seconds == -1) - return m_attoseconds - ATTOSECONDS_PER_SECOND; - - // out-of-range positive values - else if (m_seconds > 0) - return ATTOSECONDS_PER_SECOND; - - // out-of-range negative values - else - return -ATTOSECONDS_PER_SECOND; + return + (m_seconds == 0) ? m_attoseconds : // positive values between 0 and 1 second + (m_seconds == -1) ? (m_attoseconds - ATTOSECONDS_PER_SECOND) : // negative values between -1 and 0 seconds + (m_seconds > 0) ? ATTOSECONDS_PER_SECOND : // out-of-range positive values + -ATTOSECONDS_PER_SECOND; // out-of-range negative values } @@ -391,4 +362,4 @@ inline attotime attotime::from_double(double _time) } -#endif // __ATTOTIME_H__ +#endif // MAME_EMU_ATTOTIME_H diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h index aa2018201dd..66bbe48e1f2 100644 --- a/src/emu/debug/debugcpu.h +++ b/src/emu/debug/debugcpu.h @@ -350,7 +350,7 @@ private: FILE & m_file; // tracing file for this CPU std::string m_action; // action to perform during a trace offs_t m_history[TRACE_LOOPS]; // history of recent PCs - bool m_detect_loops; // whether or not we should detect loops + bool m_detect_loops; // whether or not we should detect loops int m_loops; // number of instructions in a loop int m_nextdex; // next index bool m_trace_over; // true if we're tracing over diff --git a/src/emu/debug/dvstate.cpp b/src/emu/debug/dvstate.cpp index 55dc0593a86..62d792cc9a7 100644 --- a/src/emu/debug/dvstate.cpp +++ b/src/emu/debug/dvstate.cpp @@ -285,7 +285,7 @@ void debug_view_state::view_update() } } } - + // fill the rest with blanks while (visible && (col < m_visible.x)) { diff --git a/src/emu/didisasm.h b/src/emu/didisasm.h index 474cc2b5079..d92c90acc3b 100644 --- a/src/emu/didisasm.h +++ b/src/emu/didisasm.h @@ -60,7 +60,6 @@ typedef device_delegate<offs_t (device_t &device, char *buffer, offs_t pc, const // class representing interface-specific live disasm class device_disasm_interface : public device_interface { - public: // construction/destruction device_disasm_interface(const machine_config &mconfig, device_t &device); diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp index 72f40e9f758..b4db591086a 100644 --- a/src/emu/diimage.cpp +++ b/src/emu/diimage.cpp @@ -56,7 +56,7 @@ const image_device_type_info device_image_interface::m_device_info_array[] = //------------------------------------------------- image_device_format::image_device_format(const std::string &name, const std::string &description, const std::string &extensions, const std::string &optspec) - : m_name(name), m_description(description), m_optspec(optspec) + : m_name(name), m_description(description), m_optspec(optspec) { std::regex comma_regex("\\,"); std::copy( @@ -96,8 +96,8 @@ device_image_interface::device_image_interface(const machine_config &mconfig, de m_init_phase(false), m_create_format(0), m_create_args(nullptr), - m_user_loadable(TRUE), - m_is_loading(FALSE) + m_user_loadable(true), + m_is_loading(false) { } @@ -180,40 +180,42 @@ void device_image_interface::device_compute_hash(util::hash_collection &hashes, } //------------------------------------------------- -// set_image_filename - specifies the filename of +// set_image_filename - specifies the filename of // an image //------------------------------------------------- -image_error_t device_image_interface::set_image_filename(const char *filename) +void device_image_interface::set_image_filename(const std::string &filename) { m_image_name = filename; util::zippath_parent(m_working_directory, filename); m_basename.assign(m_image_name); - int loc1 = m_image_name.find_last_of('\\'); - int loc2 = m_image_name.find_last_of('/'); - int loc3 = m_image_name.find_last_of(':'); - int loc = MAX(loc1, MAX(loc2, loc3)); - if (loc != -1) { - if (loc == loc3) + // find the last "path separator" + auto iter = std::find_if( + m_image_name.rbegin(), + m_image_name.rend(), + [](char c) { return (c == '\\') || (c == '/') || (c == ':'); }); + + if (iter != m_image_name.rend()) + { + if (*iter == ':') { // temp workaround for softlists now that m_image_name contains the part name too (e.g. list:gamename:cart) - m_basename = m_basename.substr(0, loc); + m_basename.assign(m_image_name.begin(), std::next(iter).base()); int tmploc = m_basename.find_last_of(':'); - m_basename = m_basename.substr(tmploc + 1, loc - tmploc); + m_basename = m_basename.substr(tmploc + 1); } else - m_basename = m_basename.substr(loc + 1); + m_basename.assign(iter.base(), m_image_name.end()); } m_basename_noext = m_basename; m_filetype = ""; - loc = m_basename_noext.find_last_of('.'); - if (loc != -1) { + auto loc = m_basename_noext.find_last_of('.'); + if (loc != std::string::npos) + { m_basename_noext = m_basename_noext.substr(0, loc); m_filetype = m_basename.substr(loc + 1); } - - return IMAGE_ERROR_SUCCESS; } /**************************************************************************** @@ -221,15 +223,15 @@ image_error_t device_image_interface::set_image_filename(const char *filename) ****************************************************************************/ //------------------------------------------------- -// device_get_named_creatable_format - +// device_get_named_creatable_format - // accesses a specific image format available for // image creation by name //------------------------------------------------- -const image_device_format *device_image_interface::device_get_named_creatable_format(const char *format_name) +const image_device_format *device_image_interface::device_get_named_creatable_format(const std::string &format_name) { for (auto &format : m_formatlist) - if (strcmp(format->name().c_str(), format_name) == 0) + if (format->name() == format_name) return format.get(); return nullptr; } @@ -240,8 +242,8 @@ const image_device_format *device_image_interface::device_get_named_creatable_fo ****************************************************************************/ //------------------------------------------------- -// image_clear_error - clear out any specified -// error +// image_clear_error - clear out any specified +// error //------------------------------------------------- void device_image_interface::clear_error() @@ -256,8 +258,8 @@ void device_image_interface::clear_error() //------------------------------------------------- -// error - returns the error text for an image -// error +// error - returns the error text for an image +// error //------------------------------------------------- static const char *const messages[] = @@ -280,7 +282,7 @@ const char *device_image_interface::error() //------------------------------------------------- -// seterror - specifies an error on an image +// seterror - specifies an error on an image //------------------------------------------------- void device_image_interface::seterror(image_error_t err, const char *message) @@ -296,8 +298,8 @@ void device_image_interface::seterror(image_error_t err, const char *message) //------------------------------------------------- -// message - used to display a message while -// loading +// message - used to display a message while +// loading //------------------------------------------------- void device_image_interface::message(const char *format, ...) @@ -322,9 +324,9 @@ void device_image_interface::message(const char *format, ...) ***************************************************************************/ //------------------------------------------------- -// try_change_working_directory - tries to change -// the working directory, but only if the directory -// actually exists +// try_change_working_directory - tries to change +// the working directory, but only if the directory +// actually exists //------------------------------------------------- bool device_image_interface::try_change_working_directory(const char *subdir) @@ -350,15 +352,15 @@ bool device_image_interface::try_change_working_directory(const char *subdir) // did we successfully identify the directory? if (success) - m_working_directory = util::zippath_combine(m_working_directory.c_str(), subdir); + m_working_directory = util::zippath_combine(m_working_directory, subdir); return success; } //------------------------------------------------- -// setup_working_directory - sets up the working -// directory according to a few defaults +// setup_working_directory - sets up the working +// directory according to a few defaults //------------------------------------------------- void device_image_interface::setup_working_directory() @@ -396,7 +398,7 @@ const char * device_image_interface::working_directory() //------------------------------------------------- -// get_software_region +// get_software_region //------------------------------------------------- UINT8 *device_image_interface::get_software_region(const char *tag) @@ -413,7 +415,7 @@ UINT8 *device_image_interface::get_software_region(const char *tag) //------------------------------------------------- -// image_get_software_region_length +// image_get_software_region_length //------------------------------------------------- UINT32 device_image_interface::get_software_region_length(const char *tag) @@ -428,7 +430,7 @@ UINT32 device_image_interface::get_software_region_length(const char *tag) //------------------------------------------------- -// image_get_feature +// image_get_feature //------------------------------------------------- const char *device_image_interface::get_feature(const char *feature_name) @@ -534,10 +536,10 @@ UINT32 device_image_interface::crc() //------------------------------------------------- -// battery_load - retrieves the battery -// backed RAM for an image. The file name is -// created from the machine driver name and the -// image name. +// battery_load - retrieves the battery +// backed RAM for an image. The file name is +// created from the machine driver name and the +// image name. //------------------------------------------------- void device_image_interface::battery_load(void *buffer, int length, int fill) @@ -550,7 +552,7 @@ void device_image_interface::battery_load(void *buffer, int length, int fill) /* try to open the battery file and read it in, if possible */ emu_file file(device().machine().options().nvram_directory(), OPEN_FLAG_READ); - filerr = file.open(fname.c_str()); + filerr = file.open(fname); if (filerr == osd_file::error::NONE) bytes_read = file.read(buffer, length); @@ -568,7 +570,7 @@ void device_image_interface::battery_load(void *buffer, int length, void *def_bu // try to open the battery file and read it in, if possible emu_file file(device().machine().options().nvram_directory(), OPEN_FLAG_READ); - filerr = file.open(fname.c_str()); + filerr = file.open(fname); if (filerr == osd_file::error::NONE) bytes_read = file.read(buffer, length); @@ -579,10 +581,10 @@ void device_image_interface::battery_load(void *buffer, int length, void *def_bu //------------------------------------------------- -// battery_save - stores the battery -// backed RAM for an image. The file name is -// created from the machine driver name and the -// image name. +// battery_save - stores the battery +// backed RAM for an image. The file name is +// created from the machine driver name and the +// image name. //------------------------------------------------- void device_image_interface::battery_save(const void *buffer, int length) @@ -592,7 +594,7 @@ void device_image_interface::battery_save(const void *buffer, int length) // try to open the battery file and write it out, if possible emu_file file(device().machine().options().nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - osd_file::error filerr = file.open(fname.c_str()); + osd_file::error filerr = file.open(fname); if (filerr == osd_file::error::NONE) file.write(buffer, length); } @@ -605,7 +607,7 @@ void device_image_interface::battery_save(const void *buffer, int length) bool device_image_interface::uses_file_extension(const char *file_extension) const { - bool result = FALSE; + bool result = false; if (file_extension[0] == '.') file_extension++; @@ -617,7 +619,7 @@ bool device_image_interface::uses_file_extension(const char *file_extension) con { if (!core_stricmp(ext, file_extension)) { - result = TRUE; + result = true; break; } ext = strtok (nullptr, ","); @@ -631,8 +633,8 @@ bool device_image_interface::uses_file_extension(const char *file_extension) con // *************************************************************************** //------------------------------------------------- -// is_loaded - quick check to determine whether an -// image is loaded +// is_loaded - quick check to determine whether an +// image is loaded //------------------------------------------------- bool device_image_interface::is_loaded() @@ -642,116 +644,88 @@ bool device_image_interface::is_loaded() //------------------------------------------------- -// load_image_by_path - loads an image with a -// specific path +// image_error_from_file_error - converts an image +// error to a file error //------------------------------------------------- -image_error_t device_image_interface::load_image_by_path(UINT32 open_flags, const char *path) +image_error_t device_image_interface::image_error_from_file_error(osd_file::error filerr) { - image_error_t err; - std::string revised_path; - - // attempt to read the file - auto const filerr = util::zippath_fopen(path, open_flags, m_file, revised_path); - - // did the open succeed? - switch(filerr) + switch (filerr) { - case osd_file::error::NONE: - // success! - m_readonly = (open_flags & OPEN_FLAG_WRITE) ? 0 : 1; - m_created = (open_flags & OPEN_FLAG_CREATE) ? 1 : 0; - err = IMAGE_ERROR_SUCCESS; - break; - - case osd_file::error::NOT_FOUND: - case osd_file::error::ACCESS_DENIED: - // file not found (or otherwise cannot open); continue - err = IMAGE_ERROR_FILENOTFOUND; - break; + case osd_file::error::NONE: + return IMAGE_ERROR_SUCCESS; + + case osd_file::error::NOT_FOUND: + case osd_file::error::ACCESS_DENIED: + // file not found (or otherwise cannot open) + return IMAGE_ERROR_FILENOTFOUND; + + case osd_file::error::OUT_OF_MEMORY: + // out of memory + return IMAGE_ERROR_OUTOFMEMORY; + + case osd_file::error::ALREADY_OPEN: + // this shouldn't happen + return IMAGE_ERROR_ALREADYOPEN; + + case osd_file::error::FAILURE: + case osd_file::error::TOO_MANY_FILES: + case osd_file::error::INVALID_DATA: + default: + // other errors + return IMAGE_ERROR_INTERNAL; + } +} - case osd_file::error::OUT_OF_MEMORY: - // out of memory - err = IMAGE_ERROR_OUTOFMEMORY; - break; - case osd_file::error::ALREADY_OPEN: - // this shouldn't happen - err = IMAGE_ERROR_ALREADYOPEN; - break; +//------------------------------------------------- +// load_image_by_path - loads an image with a +// specific path +//------------------------------------------------- - case osd_file::error::FAILURE: - case osd_file::error::TOO_MANY_FILES: - case osd_file::error::INVALID_DATA: - default: - // other errors - err = IMAGE_ERROR_INTERNAL; - break; - } +image_error_t device_image_interface::load_image_by_path(UINT32 open_flags, const std::string &path) +{ + std::string revised_path; - // if successful, set the file name - if (filerr == osd_file::error::NONE) - set_image_filename(revised_path.c_str()); + // attempt to read the file + auto const filerr = util::zippath_fopen(path, open_flags, m_file, revised_path); + if (filerr != osd_file::error::NONE) + return image_error_from_file_error(filerr); - return err; + m_readonly = (open_flags & OPEN_FLAG_WRITE) ? 0 : 1; + m_created = (open_flags & OPEN_FLAG_CREATE) ? 1 : 0; + set_image_filename(revised_path); + return IMAGE_ERROR_SUCCESS; } + +//------------------------------------------------- +// reopen_for_write +//------------------------------------------------- + int device_image_interface::reopen_for_write(const char *path) { m_file.reset(); - image_error_t err; std::string revised_path; // attempt to open the file for writing auto const filerr = util::zippath_fopen(path, OPEN_FLAG_READ|OPEN_FLAG_WRITE|OPEN_FLAG_CREATE, m_file, revised_path); + if (filerr != osd_file::error::NONE) + return image_error_from_file_error(filerr); - // did the open succeed? - switch(filerr) - { - case osd_file::error::NONE: - // success! - m_readonly = 0; - m_created = 1; - err = IMAGE_ERROR_SUCCESS; - break; - - case osd_file::error::NOT_FOUND: - case osd_file::error::ACCESS_DENIED: - // file not found (or otherwise cannot open); continue - err = IMAGE_ERROR_FILENOTFOUND; - break; - - case osd_file::error::OUT_OF_MEMORY: - // out of memory - err = IMAGE_ERROR_OUTOFMEMORY; - break; - - case osd_file::error::ALREADY_OPEN: - // this shouldn't happen - err = IMAGE_ERROR_ALREADYOPEN; - break; - - case osd_file::error::FAILURE: - case osd_file::error::TOO_MANY_FILES: - case osd_file::error::INVALID_DATA: - default: - // other errors - err = IMAGE_ERROR_INTERNAL; - break; - } - - // if successful, set the file name - if (filerr == osd_file::error::NONE) - set_image_filename(revised_path.c_str()); + // success! + m_readonly = 0; + m_created = 1; + set_image_filename(revised_path); - return err; + return IMAGE_ERROR_SUCCESS; } //------------------------------------------------- -// determine_open_plan - determines which open -// flags to use, and in what order +// determine_open_plan - determines which open +// flags to use, and in what order //------------------------------------------------- void device_image_interface::determine_open_plan(int is_create, UINT32 *open_plan) @@ -772,9 +746,9 @@ void device_image_interface::determine_open_plan(int is_create, UINT32 *open_pla //------------------------------------------------- -// dump_wrong_and_correct_checksums - dump an -// error message containing the wrong and the -// correct checksums for a given software item +// dump_wrong_and_correct_checksums - dump an +// error message containing the wrong and the +// correct checksums for a given software item //------------------------------------------------- static void dump_wrong_and_correct_checksums(const util::hash_collection &hashes, const util::hash_collection &acthashes) @@ -785,8 +759,8 @@ static void dump_wrong_and_correct_checksums(const util::hash_collection &hashes //------------------------------------------------- -// verify_length_and_hash - verify the length -// and hash signatures of a file +// verify_length_and_hash - verify the length +// and hash signatures of a file //------------------------------------------------- static int verify_length_and_hash(emu_file *file, const char *name, UINT32 explength, const util::hash_collection &hashes) @@ -826,14 +800,14 @@ static int verify_length_and_hash(emu_file *file, const char *name, UINT32 exple //------------------------------------------------- -// load_software - software image loading +// load_software - software image loading //------------------------------------------------- bool device_image_interface::load_software(software_list_device &swlist, const char *swname, const rom_entry *start) { std::string locationtag, breakstr("%"); const rom_entry *region; - bool retVal = FALSE; + bool retVal = false; int warningcount = 0; for (region = start; region != nullptr; region = rom_next_region(region)) { @@ -915,7 +889,7 @@ bool device_image_interface::load_software(software_list_device &swlist, const c if (filerr == osd_file::error::NONE) filerr = util::core_file::open_proxy(*m_mame_file, m_file); if (filerr == osd_file::error::NONE) - retVal = TRUE; + retVal = true; break; // load first item for start } @@ -931,18 +905,17 @@ bool device_image_interface::load_software(software_list_device &swlist, const c //------------------------------------------------- -// load_internal - core image loading +// load_internal - core image loading //------------------------------------------------- -bool device_image_interface::load_internal(const char *path, bool is_create, int create_format, util::option_resolution *create_args, bool just_load) +bool device_image_interface::load_internal(const std::string &path, bool is_create, int create_format, util::option_resolution *create_args, bool just_load) { UINT32 open_plan[4]; int i; - bool softload = FALSE; + bool softload = false; // if the path contains no period, we are using softlists, so we won't create an image - std::string pathstr(path); - bool filename_has_period = (pathstr.find_last_of('.') != -1) ? TRUE : FALSE; + bool filename_has_period = (path.find_last_of('.') != -1); // first unload the image unload(); @@ -951,20 +924,17 @@ bool device_image_interface::load_internal(const char *path, bool is_create, int clear_error(); // we are now loading - m_is_loading = TRUE; + m_is_loading = true; // record the filename - m_err = set_image_filename(path); - - if (m_err) - goto done; + set_image_filename(path); if (core_opens_image_file()) { // Check if there's a software list defined for this device and use that if we're not creating an image if (!filename_has_period && !just_load) { - softload = load_software_part(path, m_software_part_ptr); + softload = load_software_part(path.c_str(), m_software_part_ptr); if (softload) { m_software_info_ptr = &m_software_part_ptr->info(); @@ -974,7 +944,7 @@ bool device_image_interface::load_internal(const char *path, bool is_create, int // if we had launched from softlist with a specified part, e.g. "shortname:part" // we would have recorded the wrong name, so record it again based on software_info if (m_software_info_ptr && !m_full_software_name.empty()) - m_err = set_image_filename(m_full_software_name.c_str()); + set_image_filename(m_full_software_name); // check if image should be read-only const char *read_only = get_feature("read_only"); @@ -1025,7 +995,7 @@ bool device_image_interface::load_internal(const char *path, bool is_create, int m_create_format = create_format; m_create_args = create_args; - if (m_init_phase==FALSE) { + if (m_init_phase==false) { m_err = (image_error_t)finish_load(); if (m_err) goto done; @@ -1043,7 +1013,7 @@ done: if (device().machine().phase() == MACHINE_PHASE_RUNNING) device().popmessage("Error: Unable to %s image '%s': %s", is_create ? "create" : "load", path, error()); else - osd_printf_error("Error: Unable to %s image '%s': %s\n", is_create ? "create" : "load", path, error()); + osd_printf_error("Error: Unable to %s image '%s': %s\n", is_create ? "create" : "load", path.c_str(), error()); } clear(); } @@ -1058,7 +1028,7 @@ done: if (device().machine().phase() == MACHINE_PHASE_RUNNING) device().popmessage("Image '%s' was successfully %s.", path, is_create ? "created" : "loaded"); else - osd_printf_info("Image '%s' was successfully %s.\n", path, is_create ? "created" : "loaded"); + osd_printf_info("Image '%s' was successfully %s.\n", path.c_str(), is_create ? "created" : "loaded"); } } } @@ -1068,17 +1038,17 @@ done: //------------------------------------------------- -// load - load an image into MAME +// load - load an image into MAME //------------------------------------------------- bool device_image_interface::load(const char *path) { - return load_internal(path, FALSE, 0, nullptr, FALSE); + return load_internal(path, false, 0, nullptr, false); } //------------------------------------------------- -// open_image_file - opening plain image file +// open_image_file - opening plain image file //------------------------------------------------- bool device_image_interface::open_image_file(emu_options &options) @@ -1087,7 +1057,7 @@ bool device_image_interface::open_image_file(emu_options &options) if (*path != 0) { set_init_phase(); - if (load_internal(path, FALSE, 0, nullptr, TRUE)==IMAGE_INIT_PASS) + if (load_internal(path, false, 0, nullptr, true)==IMAGE_INIT_PASS) { if (software_entry()==nullptr) return true; } @@ -1097,8 +1067,8 @@ bool device_image_interface::open_image_file(emu_options &options) //------------------------------------------------- -// image_finish_load - special call - only use -// from core +// image_finish_load - special call - only use +// from core //------------------------------------------------- bool device_image_interface::finish_load() @@ -1129,16 +1099,16 @@ bool device_image_interface::finish_load() } } } - m_is_loading = FALSE; + m_is_loading = false; m_create_format = 0; m_create_args = nullptr; - m_init_phase = FALSE; + m_init_phase = false; return err; } //------------------------------------------------- -// create - create a image +// create - create a image //------------------------------------------------- bool device_image_interface::create(const char *path, const image_device_format *create_format, util::option_resolution *create_args) @@ -1153,13 +1123,13 @@ bool device_image_interface::create(const char *path, const image_device_format } cnt++; } - return load_internal(path, TRUE, format_index, create_args, FALSE); + return load_internal(path, true, format_index, create_args, false); } //------------------------------------------------- -// clear - clear all internal data pertaining -// to an image +// clear - clear all internal data pertaining +// to an image //------------------------------------------------- void device_image_interface::clear() @@ -1186,7 +1156,7 @@ void device_image_interface::clear() //------------------------------------------------- -// unload - main call to unload an image +// unload - main call to unload an image //------------------------------------------------- void device_image_interface::unload() @@ -1201,7 +1171,7 @@ void device_image_interface::unload() //------------------------------------------------- -// update_names - update brief and instance names +// update_names - update brief and instance names //------------------------------------------------- void device_image_interface::update_names(const device_type device_type, const char *inst, const char *brief) diff --git a/src/emu/diimage.h b/src/emu/diimage.h index 34d6532eedc..e89f003ebda 100644 --- a/src/emu/diimage.h +++ b/src/emu/diimage.h @@ -88,10 +88,10 @@ public: const std::string &optspec() const { return m_optspec; } private: - std::string m_name; - std::string m_description; - std::vector<std::string> m_extensions; - std::string m_optspec; + std::string m_name; + std::string m_description; + std::vector<std::string> m_extensions; + std::string m_optspec; }; @@ -166,7 +166,7 @@ public: virtual const option_guide *create_option_guide() const { return nullptr; } const image_device_format *device_get_indexed_creatable_format(int index) const { if (index < m_formatlist.size()) return m_formatlist.at(index).get(); else return nullptr; } - const image_device_format *device_get_named_creatable_format(const char *format_name); + const image_device_format *device_get_named_creatable_format(const std::string &format_name); const option_guide *device_get_creation_option_guide() const { return create_option_guide(); } const char *error(); @@ -251,13 +251,13 @@ public: protected: virtual const software_list_loader &get_software_list_loader() const { return false_software_list_loader::instance(); } - bool load_internal(const char *path, bool is_create, int create_format, util::option_resolution *create_args, bool just_load); + bool load_internal(const std::string &path, bool is_create, int create_format, util::option_resolution *create_args, bool just_load); void determine_open_plan(int is_create, UINT32 *open_plan); - image_error_t load_image_by_path(UINT32 open_flags, const char *path); + image_error_t load_image_by_path(UINT32 open_flags, const std::string &path); void clear(); bool is_loaded(); - image_error_t set_image_filename(const char *filename); + void set_image_filename(const std::string &filename); void clear_error(); @@ -280,11 +280,11 @@ protected: static const image_device_type_info *find_device_type(iodevice_t type); static const image_device_type_info m_device_info_array[]; - /* error related info */ + // error related info image_error_t m_err; std::string m_err_message; - /* variables that are only non-zero when an image is mounted */ + // variables that are only non-zero when an image is mounted util::core_file::ptr m_file; std::unique_ptr<emu_file> m_mame_file; std::string m_image_name; @@ -292,27 +292,27 @@ protected: std::string m_basename_noext; std::string m_filetype; - /* working directory; persists across mounts */ + // working directory; persists across mounts std::string m_working_directory; - /* Software information */ + // Software information std::string m_full_software_name; const software_info *m_software_info_ptr; const software_part *m_software_part_ptr; std::string m_software_list_name; - /* info read from the hash file/software list */ + // info read from the hash file/software list std::string m_longname; std::string m_manufacturer; std::string m_year; UINT32 m_supported; - /* flags */ + // flags bool m_readonly; bool m_created; bool m_init_phase; - /* special - used when creating */ + // special - used when creating int m_create_format; util::option_resolution *m_create_args; @@ -321,14 +321,17 @@ protected: std::string m_brief_instance_name; std::string m_instance_name; - /* creation info */ + // creation info formatlist_type m_formatlist; - /* in the case of arcade cabinet with fixed carts inserted, - we want to disable command line cart loading... */ + // in the case of arcade cabinet with fixed carts inserted, + // we want to disable command line cart loading... bool m_user_loadable; bool m_is_loading; + +private: + static image_error_t image_error_from_file_error(osd_file::error filerr); }; // iterator diff --git a/src/emu/dimemory.cpp b/src/emu/dimemory.cpp index 56543ae551a..0081062c38c 100644 --- a/src/emu/dimemory.cpp +++ b/src/emu/dimemory.cpp @@ -9,7 +9,6 @@ ***************************************************************************/ #include "emu.h" -#include "validity.h" //************************************************************************** diff --git a/src/emu/diserial.h b/src/emu/diserial.h index dbb9c3b8c55..12c2479234b 100644 --- a/src/emu/diserial.h +++ b/src/emu/diserial.h @@ -1,13 +1,13 @@ // license:BSD-3-Clause -// copyright-holders:Carl, Miodrag Milanovic +// copyright-holders:Carl, Miodrag Milanovic, Vas Crabb #pragma once #ifndef __EMU_H__ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __DISERIAL_H__ -#define __DISERIAL_H__ +#ifndef MAME_EMU_DISERIAL_H +#define MAME_EMU_DISERIAL_H // Windows headers are crap, let me count the ways #undef PARITY_NONE @@ -186,4 +186,85 @@ private: void rcv_edge(); }; -#endif /* __DISERIAL_H__ */ + +template <UINT32 FIFO_LENGTH> +class device_buffered_serial_interface : public device_serial_interface +{ +protected: + using device_serial_interface::device_serial_interface; + + virtual void tra_complete() override + { + assert(!m_empty || (m_head == m_tail)); + assert(m_head < ARRAY_LENGTH(m_fifo)); + assert(m_tail < ARRAY_LENGTH(m_fifo)); + + if (!m_empty) + { + transmit_register_setup(m_fifo[m_head]); + m_head = (m_head + 1U) % FIFO_LENGTH; + m_empty = (m_head == m_tail) ? 1U : 0U; + } + } + + virtual void rcv_complete() override + { + receive_register_extract(); + received_byte(get_received_char()); + } + + void clear_fifo() + { + m_head = m_tail = 0U; + m_empty = 1U; + } + + void transmit_byte(UINT8 byte) + { + assert(!m_empty || (m_head == m_tail)); + assert(m_head < ARRAY_LENGTH(m_fifo)); + assert(m_tail < ARRAY_LENGTH(m_fifo)); + + if (m_empty && is_transmit_register_empty()) + { + transmit_register_setup(byte); + } + else if (m_empty || (m_head != m_tail)) + { + m_fifo[m_tail] = byte; + m_tail = (m_tail + 1U) % FIFO_LENGTH; + m_empty = 0U; + } + else + { + device().logerror("FIFO overrun (byte = 0x%02x)", byte); + } + } + + bool fifo_full() const + { + return !m_empty && (m_head == m_tail); + } + + void register_save_state(save_manager &save, device_t *device) + { + device_serial_interface::register_save_state(save, device); + + char const *const module(device->name()); + char const *const tag(device->tag()); + + save.save_item(device, module, tag, 0, NAME(m_fifo)); + save.save_item(device, module, tag, 0, NAME(m_head)); + save.save_item(device, module, tag, 0, NAME(m_tail)); + save.save_item(device, module, tag, 0, NAME(m_empty)); + } + +private: + virtual void received_byte(UINT8 byte) = 0; + + UINT8 m_fifo[FIFO_LENGTH]; + UINT32 m_head = 0U, m_tail = 0U; + UINT8 m_empty = 1U; +}; + +#endif // MAME_EMU_DISERIAL_H diff --git a/src/emu/divtlb.cpp b/src/emu/divtlb.cpp index 01be30919cb..3f4266a2285 100644 --- a/src/emu/divtlb.cpp +++ b/src/emu/divtlb.cpp @@ -10,7 +10,6 @@ #include "emu.h" #include "divtlb.h" -#include "validity.h" diff --git a/src/emu/fileio.cpp b/src/emu/fileio.cpp index 923ea427b3f..2bf548bff6d 100644 --- a/src/emu/fileio.cpp +++ b/src/emu/fileio.cpp @@ -110,7 +110,7 @@ const osd::directory::entry *file_enumerator::next() return nullptr; // open the path - m_curdir = osd::directory::open(m_pathbuffer.c_str()); + m_curdir = osd::directory::open(m_pathbuffer); } // get the next entry from the current directory @@ -240,7 +240,7 @@ util::hash_collection &emu_file::hashes(const char *types) // open - open a file by searching paths //------------------------------------------------- -osd_file::error emu_file::open(const char *name) +osd_file::error emu_file::open(const std::string &name) { // remember the filename and CRC info m_filename = name; @@ -252,28 +252,25 @@ osd_file::error emu_file::open(const char *name) return open_next(); } -osd_file::error emu_file::open(const char *name1, const char *name2) +osd_file::error emu_file::open(const std::string &name1, const std::string &name2) { // concatenate the strings and do a standard open - std::string name = std::string(name1).append(name2); - return open(name.c_str()); + return open(name1 + name2); } -osd_file::error emu_file::open(const char *name1, const char *name2, const char *name3) +osd_file::error emu_file::open(const std::string &name1, const std::string &name2, const std::string &name3) { // concatenate the strings and do a standard open - std::string name = std::string(name1).append(name2).append(name3); - return open(name.c_str()); + return open(name1 + name2 + name3); } -osd_file::error emu_file::open(const char *name1, const char *name2, const char *name3, const char *name4) +osd_file::error emu_file::open(const std::string &name1, const std::string &name2, const std::string &name3, const std::string &name4) { // concatenate the strings and do a standard open - std::string name = std::string(name1).append(name2).append(name3).append(name4); - return open(name.c_str()); + return open(name1 + name2 + name3 + name4); } -osd_file::error emu_file::open(const char *name, UINT32 crc) +osd_file::error emu_file::open(const std::string &name, UINT32 crc) { // remember the filename and CRC info m_filename = name; @@ -285,25 +282,22 @@ osd_file::error emu_file::open(const char *name, UINT32 crc) return open_next(); } -osd_file::error emu_file::open(const char *name1, const char *name2, UINT32 crc) +osd_file::error emu_file::open(const std::string &name1, const std::string &name2, UINT32 crc) { // concatenate the strings and do a standard open - std::string name = std::string(name1).append(name2); - return open(name.c_str(), crc); + return open(name1 + name2, crc); } -osd_file::error emu_file::open(const char *name1, const char *name2, const char *name3, UINT32 crc) +osd_file::error emu_file::open(const std::string &name1, const std::string &name2, const std::string &name3, UINT32 crc) { // concatenate the strings and do a standard open - std::string name = std::string(name1).append(name2).append(name3); - return open(name.c_str(), crc); + return open(name1 + name2 + name3, crc); } -osd_file::error emu_file::open(const char *name1, const char *name2, const char *name3, const char *name4, UINT32 crc) +osd_file::error emu_file::open(const std::string &name1, const std::string &name2, const std::string &name3, const std::string &name4, UINT32 crc) { // concatenate the strings and do a standard open - std::string name = std::string(name1).append(name2).append(name3).append(name4); - return open(name.c_str(), crc); + return open(name1 + name2 + name3 + name4, crc); } diff --git a/src/emu/fileio.h b/src/emu/fileio.h index 7775854ec23..69479bc5a98 100644 --- a/src/emu/fileio.h +++ b/src/emu/fileio.h @@ -101,14 +101,14 @@ public: void set_restrict_to_mediapath(bool rtmp = true) { m_restrict_to_mediapath = rtmp; } // open/close - osd_file::error open(const char *name); - osd_file::error open(const char *name1, const char *name2); - osd_file::error open(const char *name1, const char *name2, const char *name3); - osd_file::error open(const char *name1, const char *name2, const char *name3, const char *name4); - osd_file::error open(const char *name, UINT32 crc); - osd_file::error open(const char *name1, const char *name2, UINT32 crc); - osd_file::error open(const char *name1, const char *name2, const char *name3, UINT32 crc); - osd_file::error open(const char *name1, const char *name2, const char *name3, const char *name4, UINT32 crc); + osd_file::error open(const std::string &name); + osd_file::error open(const std::string &name1, const std::string &name2); + osd_file::error open(const std::string &name1, const std::string &name2, const std::string &name3); + osd_file::error open(const std::string &name1, const std::string &name2, const std::string &name3, const std::string &name4); + osd_file::error open(const std::string &name, UINT32 crc); + osd_file::error open(const std::string &name1, const std::string &name2, UINT32 crc); + osd_file::error open(const std::string &name1, const std::string &name2, const std::string &name3, UINT32 crc); + osd_file::error open(const std::string &name1, const std::string &name2, const std::string &name3, const std::string &name4, UINT32 crc); osd_file::error open_next(); osd_file::error open_ram(const void *data, UINT32 length); void close(); diff --git a/src/emu/romload.cpp b/src/emu/romload.cpp index 7a4d420f205..3ab732770f4 100644 --- a/src/emu/romload.cpp +++ b/src/emu/romload.cpp @@ -1113,7 +1113,7 @@ chd_error rom_load_manager::open_disk_diff(emu_options &options, const rom_entry /* try to open the diff */ LOG(("Opening differencing image file: %s\n", fname.c_str())); emu_file diff_file(options.diff_directory(), OPEN_FLAG_READ | OPEN_FLAG_WRITE); - osd_file::error filerr = diff_file.open(fname.c_str()); + osd_file::error filerr = diff_file.open(fname); if (filerr == osd_file::error::NONE) { std::string fullpath(diff_file.fullpath()); @@ -1126,7 +1126,7 @@ chd_error rom_load_manager::open_disk_diff(emu_options &options, const rom_entry /* didn't work; try creating it instead */ LOG(("Creating differencing image: %s\n", fname.c_str())); diff_file.set_openflags(OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - filerr = diff_file.open(fname.c_str()); + filerr = diff_file.open(fname); if (filerr == osd_file::error::NONE) { std::string fullpath(diff_file.fullpath()); diff --git a/src/emu/softlist.h b/src/emu/softlist.h index 72a8381f929..98e858d96d5 100644 --- a/src/emu/softlist.h +++ b/src/emu/softlist.h @@ -184,12 +184,12 @@ public: private: // internal state - software_part * m_next; - software_info & m_info; - std::string m_name; - std::string m_interface; - std::list<feature_list_item> m_featurelist; - std::vector<rom_entry> m_romdata; + software_part * m_next; + software_info & m_info; + std::string m_name; + std::string m_interface; + std::list<feature_list_item> m_featurelist; + std::vector<rom_entry> m_romdata; }; @@ -300,7 +300,7 @@ protected: emu_file m_file; std::string m_description; std::string m_errors; - std::list<software_info> m_infolist; + std::list<software_info> m_infolist; const_string_pool m_stringpool; }; diff --git a/src/emu/validity.cpp b/src/emu/validity.cpp index f4c80a8f205..cfbad976d66 100644 --- a/src/emu/validity.cpp +++ b/src/emu/validity.cpp @@ -270,6 +270,10 @@ void validity_checker::validate_end() void validity_checker::validate_one(const game_driver &driver) { + // help verbose validation detect configuration-related crashes + if (m_print_verbose) + output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Validating driver %s (%s)...\n", driver.name, core_filename_extract_base(driver.source_file).c_str()); + // set the current driver m_current_driver = &driver; m_current_config = nullptr; @@ -303,7 +307,9 @@ void validity_checker::validate_one(const game_driver &driver) // if we had warnings or errors, output if (m_errors > start_errors || m_warnings > start_warnings || !m_verbose_text.empty()) { - output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Driver %s (file %s): %d errors, %d warnings\n", driver.name, core_filename_extract_base(driver.source_file).c_str(), m_errors - start_errors, m_warnings - start_warnings); + if (!m_print_verbose) + output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Driver %s (file %s): ", driver.name, core_filename_extract_base(driver.source_file).c_str()); + output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "%d errors, %d warnings\n", m_errors - start_errors, m_warnings - start_warnings); if (m_errors > start_errors) output_indented_errors(m_error_text, "Errors"); if (m_warnings > start_warnings) diff --git a/src/emu/validity.h b/src/emu/validity.h index a25a922e7b6..36b40df80c9 100644 --- a/src/emu/validity.h +++ b/src/emu/validity.h @@ -51,7 +51,7 @@ public: int region_length(const char *tag) { return m_region_map.find(tag)->second; } // generic registry of already-checked stuff - bool already_checked(const char *string) { return m_already_checked.insert(string).second; } + bool already_checked(const char *string) { return !m_already_checked.insert(string).second; } // osd_output interface diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp index 52af1b85bef..4bad1bb39c8 100644 --- a/src/frontend/mame/luaengine.cpp +++ b/src/frontend/mame/luaengine.cpp @@ -2006,7 +2006,8 @@ void lua_engine::menu_populate(std::string &menu, std::vector<menu_item> &menu_l { if(lua_istable(m_lua_state, -1)) { - menu_item item; + menu_list.emplace_back(); + menu_item &item = menu_list.back(); lua_rawgeti(m_lua_state, -1, 1); item.text = lua_tostring(m_lua_state, -1); lua_pop(m_lua_state, 1); @@ -2016,7 +2017,6 @@ void lua_engine::menu_populate(std::string &menu, std::vector<menu_item> &menu_l lua_rawgeti(m_lua_state, -1, 3); item.flags = lua_tostring(m_lua_state, -1); lua_pop(m_lua_state, 1); - menu_list.push_back(item); } lua_pop(m_lua_state, 1); } diff --git a/src/frontend/mame/luaengine.h b/src/frontend/mame/luaengine.h index 9413fce5f0b..4e18aefbfde 100644 --- a/src/frontend/mame/luaengine.h +++ b/src/frontend/mame/luaengine.h @@ -231,7 +231,7 @@ private: file(path.c_str(), openflags) {} int l_emu_file_read(lua_State *L); - osd_file::error open(const char *name) {return file.open(name);} + osd_file::error open(const std::string &name) {return file.open(name);} osd_file::error open_next() {return file.open_next();} int seek(INT64 offset, int whence) {return file.seek(offset, whence);} UINT64 size() {return file.size();} diff --git a/src/frontend/mame/ui/filesel.cpp b/src/frontend/mame/ui/filesel.cpp index 21a0d35c28f..3f26d3cf562 100644 --- a/src/frontend/mame/ui/filesel.cpp +++ b/src/frontend/mame/ui/filesel.cpp @@ -228,7 +228,7 @@ menu_file_selector::file_selector_entry *menu_file_selector::append_dirent_entry } // determine the full path - buffer = util::zippath_combine(m_current_directory.c_str(), dirent->name); + buffer = util::zippath_combine(m_current_directory, dirent->name); // create the file selector entry entry = &append_entry( @@ -296,10 +296,9 @@ void menu_file_selector::populate() const file_selector_entry *selected_entry = nullptr; int i; const char *volume_name; - const char *path = m_current_directory.c_str(); // open the directory - err = util::zippath_opendir(path, &directory); + err = util::zippath_opendir(m_current_directory, &directory); // clear out the menu entries m_entrylist.clear(); @@ -409,7 +408,7 @@ void menu_file_selector::handle() case SELECTOR_ENTRY_TYPE_DRIVE: case SELECTOR_ENTRY_TYPE_DIRECTORY: // drive/directory - first check the path - err = util::zippath_opendir(entry->fullpath.c_str(), nullptr); + err = util::zippath_opendir(entry->fullpath, nullptr); if (err != osd_file::error::NONE) { // this path is problematic; present the user with an error and bail diff --git a/src/frontend/mame/ui/floppycntrl.cpp b/src/frontend/mame/ui/floppycntrl.cpp index eeebd5981ef..1208f0b1181 100644 --- a/src/frontend/mame/ui/floppycntrl.cpp +++ b/src/frontend/mame/ui/floppycntrl.cpp @@ -87,7 +87,7 @@ void menu_control_floppy_image::hook_load(std::string filename, bool softlist) std::string tmp_path; util::core_file::ptr tmp_file; // attempt to open the file for writing but *without* create - filerr = util::zippath_fopen(filename.c_str(), OPEN_FLAG_READ | OPEN_FLAG_WRITE, tmp_file, tmp_path); + filerr = util::zippath_fopen(filename, OPEN_FLAG_READ | OPEN_FLAG_WRITE, tmp_file, tmp_path); if(filerr == osd_file::error::NONE) tmp_file.reset(); else @@ -131,7 +131,7 @@ void menu_control_floppy_image::handle() m_state = START_FILE; handle(); } else { - output_filename = util::zippath_combine(m_current_directory.c_str(), m_current_file.c_str()); + output_filename = util::zippath_combine(m_current_directory, m_current_file); output_format = format_array[m_submenu_result.i]; do_load_create(); stack_pop(); diff --git a/src/frontend/mame/ui/imgcntrl.cpp b/src/frontend/mame/ui/imgcntrl.cpp index ee93381d52a..08f10876d78 100644 --- a/src/frontend/mame/ui/imgcntrl.cpp +++ b/src/frontend/mame/ui/imgcntrl.cpp @@ -61,7 +61,7 @@ menu_control_device_image::menu_control_device_image(mame_ui_manager &mui, rende if (m_image.exists()) { m_current_file.assign(m_image.filename()); - util::zippath_parent(m_current_directory, m_current_file.c_str()); + util::zippath_parent(m_current_directory, m_current_file); } else { @@ -69,7 +69,7 @@ menu_control_device_image::menu_control_device_image(mame_ui_manager &mui, rende } // check to see if the path exists; if not clear it - if (util::zippath_opendir(m_current_directory.c_str(), nullptr) != osd_file::error::NONE) + if (util::zippath_opendir(m_current_directory, nullptr) != osd_file::error::NONE) m_current_directory.clear(); } } @@ -91,7 +91,7 @@ menu_control_device_image::~menu_control_device_image() void menu_control_device_image::test_create(bool &can_create, bool &need_confirm) { // assemble the full path - auto path = util::zippath_combine(m_current_directory.c_str(), m_current_file.c_str()); + auto path = util::zippath_combine(m_current_directory, m_current_file); // does a file or a directory exist at the path auto entry = osd_stat(path.c_str()); diff --git a/src/frontend/mame/ui/imgcntrl.h b/src/frontend/mame/ui/imgcntrl.h index 510d167ac14..e93d09ccc2e 100644 --- a/src/frontend/mame/ui/imgcntrl.h +++ b/src/frontend/mame/ui/imgcntrl.h @@ -46,11 +46,11 @@ protected: } m_submenu_result; // instance variables - made protected so they can be shared with floppycntrl.cpp - int m_state; - device_image_interface & m_image; - std::string m_current_directory; - std::string m_current_file; - bool m_create_ok; + int m_state; + device_image_interface & m_image; + std::string m_current_directory; + std::string m_current_file; + bool m_create_ok; // methods virtual void hook_load(std::string filename, bool softlist); @@ -58,11 +58,11 @@ protected: private: // instance variables - bool m_create_confirmed; - const software_info * m_swi; - const software_part * m_swp; - class software_list_device * m_sld; - std::string m_software_info_name; + bool m_create_confirmed; + const software_info * m_swi; + const software_part * m_swp; + class software_list_device * m_sld; + std::string m_software_info_name; // methods virtual void populate() override; diff --git a/src/frontend/mame/ui/selmenu.cpp b/src/frontend/mame/ui/selmenu.cpp index 64b4855c967..9a942e88e22 100644 --- a/src/frontend/mame/ui/selmenu.cpp +++ b/src/frontend/mame/ui/selmenu.cpp @@ -1551,13 +1551,13 @@ void menu_select_launch::arts_render(float origx1, float origy1, float origx2, f m_cache->set_snapx_driver(nullptr); if (ui_globals::default_image) - (software->startempty == 0) ? ui_globals::curimage_view = SNAPSHOT_VIEW : ui_globals::curimage_view = CABINETS_VIEW; + ui_globals::curimage_view = (software->startempty == 0) ? SNAPSHOT_VIEW : CABINETS_VIEW; // arts title and searchpath std::string const searchstr = arts_render_common(origx1, origy1, origx2, origy2); // loads the image if necessary - if (m_cache->snapx_software_is(software) || !snapx_valid() || ui_globals::switch_image) + if (!m_cache->snapx_software_is(software) || !snapx_valid() || ui_globals::switch_image) { emu_file snapfile(searchstr.c_str(), OPEN_FLAG_READ); bitmap_argb32 *tmp_bitmap; @@ -1630,7 +1630,7 @@ void menu_select_launch::arts_render(float origx1, float origy1, float origx2, f m_cache->set_snapx_software(nullptr); if (ui_globals::default_image) - ((driver->flags & MACHINE_TYPE_ARCADE) == 0) ? ui_globals::curimage_view = CABINETS_VIEW : ui_globals::curimage_view = SNAPSHOT_VIEW; + ui_globals::curimage_view = ((driver->flags & MACHINE_TYPE_ARCADE) == 0) ? CABINETS_VIEW : SNAPSHOT_VIEW; std::string const searchstr = arts_render_common(origx1, origy1, origx2, origy2); diff --git a/src/frontend/mame/ui/widgets.cpp b/src/frontend/mame/ui/widgets.cpp index 7a82310879e..956e251dba6 100644 --- a/src/frontend/mame/ui/widgets.cpp +++ b/src/frontend/mame/ui/widgets.cpp @@ -2,9 +2,9 @@ // copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods /********************************************************************* - ui/widgets.cpp + ui/widgets.cpp - Internal MAME widgets for the user interface. + Internal MAME widgets for the user interface. *********************************************************************/ @@ -15,7 +15,7 @@ namespace ui { /*************************************************************************** - WIDGETS + WIDGETS ***************************************************************************/ //------------------------------------------------- diff --git a/src/frontend/mame/ui/widgets.h b/src/frontend/mame/ui/widgets.h index a18c3a80cc9..45f1725d7ec 100644 --- a/src/frontend/mame/ui/widgets.h +++ b/src/frontend/mame/ui/widgets.h @@ -2,9 +2,9 @@ // copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods /*************************************************************************** - ui/widgets.h + ui/widgets.h - Internal MAME widgets for the user interface. + Internal MAME widgets for the user interface. ***************************************************************************/ diff --git a/src/lib/formats/acorn_dsk.cpp b/src/lib/formats/acorn_dsk.cpp index 5321cc00ea9..e8e0289ead1 100644 --- a/src/lib/formats/acorn_dsk.cpp +++ b/src/lib/formats/acorn_dsk.cpp @@ -506,7 +506,7 @@ int acorn_dos_format::find_size(io_generic *io, UINT32 form_factor) if (cat[0] == 0xfd) return i; break; } - + } } LOG_FORMATS("dos: no match\n"); diff --git a/src/lib/util/aviio.cpp b/src/lib/util/aviio.cpp index 93f5bac1a1c..08fa138a177 100644 --- a/src/lib/util/aviio.cpp +++ b/src/lib/util/aviio.cpp @@ -189,11 +189,11 @@ #define AVI_INDEX_2FIELD 0x01 - /** - * @def AVI_INTEGRAL_MULTIPLE - * - * @brief Ensures the integral multiple of the video dimension, because most video players are not capable to playback a video stream with a lower multiple. - */ + /** + * @def AVI_INTEGRAL_MULTIPLE + * + * @brief Ensures the integral multiple of the video dimension, because most video players are not capable to playback a video stream with a lower multiple. + */ #define AVI_INTEGRAL_MULTIPLE 4 diff --git a/src/lib/util/corefile.cpp b/src/lib/util/corefile.cpp index 7a34406cf02..8e52b942d2f 100644 --- a/src/lib/util/corefile.cpp +++ b/src/lib/util/corefile.cpp @@ -1302,7 +1302,7 @@ bool core_filename_ends_with(const std::string &filename, const std::string &ext // first if the extension is bigger than the name, we definitely don't match bool matches = namelen >= extlen; - + // work backwards checking for a match while (matches && extlen > 0 && namelen > 0) { diff --git a/src/lib/util/hash.cpp b/src/lib/util/hash.cpp index 6d7ac9319e3..9ba632240dc 100644 --- a/src/lib/util/hash.cpp +++ b/src/lib/util/hash.cpp @@ -279,6 +279,8 @@ std::string hash_collection::attribute_string() const bool hash_collection::from_internal_string(const char *string) { + assert(string != nullptr); + // start fresh reset(); diff --git a/src/lib/util/opresolv.cpp b/src/lib/util/opresolv.cpp index 7abe600cd65..baf66580d26 100644 --- a/src/lib/util/opresolv.cpp +++ b/src/lib/util/opresolv.cpp @@ -19,13 +19,12 @@ namespace util { - /*************************************************************************** - option_resolution + option_resolution ***************************************************************************/ // ------------------------------------------------- -// entry::int_value +// entry::int_value // ------------------------------------------------- int option_resolution::entry::int_value() const @@ -35,7 +34,7 @@ int option_resolution::entry::int_value() const // ------------------------------------------------- -// entry::set_int_value +// entry::set_int_value // ------------------------------------------------- void option_resolution::entry::set_int_value(int i) @@ -45,7 +44,7 @@ void option_resolution::entry::set_int_value(int i) // ------------------------------------------------- -// resolve_single_param +// resolve_single_param // ------------------------------------------------- option_resolution::error option_resolution::resolve_single_param(const char *specification, option_resolution::entry *param_value, @@ -181,7 +180,7 @@ option_resolution::error option_resolution::resolve_single_param(const char *spe // ------------------------------------------------- -// lookup_in_specification +// lookup_in_specification // ------------------------------------------------- const char *option_resolution::lookup_in_specification(const char *specification, const option_guide *option) @@ -193,7 +192,7 @@ const char *option_resolution::lookup_in_specification(const char *specification // ------------------------------------------------- -// ctor +// ctor // ------------------------------------------------- option_resolution::option_resolution(const option_guide *guide, const char *specification) @@ -204,14 +203,14 @@ option_resolution::option_resolution(const option_guide *guide, const char *spec assert(guide); - // first count the number of options specified in the guide + // first count the number of options specified in the guide option_count = count_options(guide, specification); // set up the entries list m_specification = specification; m_entries.resize(option_count); - // initialize each of the entries + // initialize each of the entries opt = 0; guide_entry = guide; while(guide_entry->option_type != OPTIONTYPE_END) @@ -239,7 +238,7 @@ option_resolution::option_resolution(const option_guide *guide, const char *spec // ------------------------------------------------- -// dtor +// dtor // ------------------------------------------------- option_resolution::~option_resolution() @@ -248,7 +247,7 @@ option_resolution::~option_resolution() // ------------------------------------------------- -// add_param +// add_param // ------------------------------------------------- option_resolution::error option_resolution::add_param(const char *param, const std::string &value) @@ -325,7 +324,7 @@ option_resolution::error option_resolution::add_param(const char *param, const s // ------------------------------------------------- -// finish +// finish // ------------------------------------------------- option_resolution::error option_resolution::finish() @@ -364,7 +363,7 @@ option_resolution::error option_resolution::finish() // ------------------------------------------------- -// lookup_entry +// lookup_entry // ------------------------------------------------- const option_resolution::entry *option_resolution::lookup_entry(int option_char) const @@ -389,7 +388,7 @@ const option_resolution::entry *option_resolution::lookup_entry(int option_char) // ------------------------------------------------- -// lookup_int +// lookup_int // ------------------------------------------------- int option_resolution::lookup_int(int option_char) const @@ -400,7 +399,7 @@ int option_resolution::lookup_int(int option_char) const // ------------------------------------------------- -// lookup_string +// lookup_string // ------------------------------------------------- const char *option_resolution::lookup_string(int option_char) const @@ -411,7 +410,7 @@ const char *option_resolution::lookup_string(int option_char) const // ------------------------------------------------- -// find_option +// find_option // ------------------------------------------------- const option_guide *option_resolution::find_option(int option_char) const @@ -422,7 +421,7 @@ const option_guide *option_resolution::find_option(int option_char) const // ------------------------------------------------- -// index_option +// index_option // ------------------------------------------------- const option_guide *option_resolution::index_option(int indx) const @@ -434,7 +433,7 @@ const option_guide *option_resolution::index_option(int indx) const // ------------------------------------------------- -// count_options +// count_options // ------------------------------------------------- size_t option_resolution::count_options(const option_guide *guide, const char *specification) @@ -463,7 +462,7 @@ size_t option_resolution::count_options(const option_guide *guide, const char *s // ------------------------------------------------- -// list_ranges +// list_ranges // ------------------------------------------------- option_resolution::error option_resolution::list_ranges(const char *specification, int option_char, range *range, size_t range_count) @@ -485,7 +484,7 @@ option_resolution::error option_resolution::list_ranges(const char *specificatio // ------------------------------------------------- -// get_default +// get_default // ------------------------------------------------- option_resolution::error option_resolution::get_default(const char *specification, int option_char, int *val) @@ -509,7 +508,7 @@ option_resolution::error option_resolution::get_default(const char *specificatio // ------------------------------------------------- -// list_ranges +// list_ranges // ------------------------------------------------- option_resolution::error option_resolution::is_valid_value(const char *specification, int option_char, int val) @@ -532,7 +531,7 @@ option_resolution::error option_resolution::is_valid_value(const char *specifica // ------------------------------------------------- -// contains +// contains // ------------------------------------------------- bool option_resolution::contains(const char *specification, int option_char) @@ -542,24 +541,24 @@ bool option_resolution::contains(const char *specification, int option_char) // ------------------------------------------------- -// error_string +// error_string // ------------------------------------------------- const char *option_resolution::error_string(option_resolution::error err) { switch (err) { - case error::SUCCESS: return "The operation completed successfully"; - case error::OUTOFMEMORY: return "Out of memory"; - case error::PARAMOUTOFRANGE: return "Parameter out of range"; - case error::PARAMNOTSPECIFIED: return "Parameter not specified"; - case error::PARAMNOTFOUND: return "Unknown parameter"; - case error::PARAMALREADYSPECIFIED: return "Parameter specified multiple times"; - case error::BADPARAM: return "Invalid parameter"; - case error::SYNTAX: return "Syntax error"; - case error::INTERNAL: return "Internal error"; + case error::SUCCESS: return "The operation completed successfully"; + case error::OUTOFMEMORY: return "Out of memory"; + case error::PARAMOUTOFRANGE: return "Parameter out of range"; + case error::PARAMNOTSPECIFIED: return "Parameter not specified"; + case error::PARAMNOTFOUND: return "Unknown parameter"; + case error::PARAMALREADYSPECIFIED: return "Parameter specified multiple times"; + case error::BADPARAM: return "Invalid parameter"; + case error::SYNTAX: return "Syntax error"; + case error::INTERNAL: return "Internal error"; } return nullptr; } -} // namespace util
\ No newline at end of file +} // namespace util diff --git a/src/lib/util/opresolv.h b/src/lib/util/opresolv.h index 5faf615b30b..097d6e303ac 100644 --- a/src/lib/util/opresolv.h +++ b/src/lib/util/opresolv.h @@ -86,7 +86,6 @@ struct option_guide #define OPTION_ENUM_END namespace util { - class option_resolution { public: diff --git a/src/lib/util/unicode.cpp b/src/lib/util/unicode.cpp index 0390576ae9a..0ddee038eee 100644 --- a/src/lib/util/unicode.cpp +++ b/src/lib/util/unicode.cpp @@ -100,7 +100,7 @@ int uchar_from_utf8(unicode_char *uchar, const char *utf8char, size_t count) { auxchar = utf8char[i]; - // all auxillary chars must be between 0x80-0xbf + // all auxillary chars must be between 0x80-0xbf if ((auxchar & 0xc0) != 0x80) return -1; diff --git a/src/lib/util/zippath.cpp b/src/lib/util/zippath.cpp index 1a13bfe7784..1eb2eba9274 100644 --- a/src/lib/util/zippath.cpp +++ b/src/lib/util/zippath.cpp @@ -98,11 +98,11 @@ int is_path_separator(char c) } // ------------------------------------------------- -// parse_parent_path - parses out the parent path +// parse_parent_path - parses out the parent path // ------------------------------------------------- /** - * @fn static void parse_parent_path(const char *path, int *beginpos, int *endpos) + * @fn static void parse_parent_path(const std::string &path, std::string::size_type *beginpos, std::string::size_type *endpos) * * @brief Parse parent path. * @@ -111,25 +111,25 @@ int is_path_separator(char c) * @param [in,out] endpos If non-null, the endpos. */ -static void parse_parent_path(const char *path, int *beginpos, int *endpos) +static void parse_parent_path(const std::string &path, std::string::size_type *beginpos, std::string::size_type *endpos) { - int length = strlen(path); - int pos; + std::string::size_type length = path.length(); + std::string::size_type pos; - /* skip over trailing path separators */ - pos = length - 1; - while((pos > 0) && is_path_separator(path[pos])) + // skip over trailing path separators + pos = length ? (length - 1) : std::string::npos; + while ((pos > 0) && (pos != std::string::npos) && is_path_separator(path[pos])) pos--; - /* return endpos */ + // return endpos if (endpos != nullptr) *endpos = pos; - /* now skip until we find a path separator */ - while((pos >= 0) && !is_path_separator(path[pos])) - pos--; + // now skip until we find a path separator + while ((pos != std::string::npos) && !is_path_separator(path[pos])) + pos = (pos > 0) ? pos - 1 : std::string::npos; - /* return beginpos */ + // return beginpos if (beginpos != nullptr) *beginpos = pos; } @@ -137,16 +137,16 @@ static void parse_parent_path(const char *path, int *beginpos, int *endpos) // ------------------------------------------------- -// zippath_parent - retrieves the parent directory +// zippath_parent - retrieves the parent directory // ------------------------------------------------- -std::string &zippath_parent(std::string &dst, const char *path) +std::string &zippath_parent(std::string &dst, const std::string &path) { - int pos; + std::string::size_type pos; parse_parent_path(path, &pos, nullptr); - if (pos >= 0) - dst.assign(path, pos + 1); + if (pos != std::string::npos) + dst = path.substr(0, pos + 1); else dst.clear(); return dst; @@ -155,10 +155,10 @@ std::string &zippath_parent(std::string &dst, const char *path) // ------------------------------------------------- -// zippath_parent - retrieves the parent directory +// zippath_parent - retrieves the parent directory // ------------------------------------------------- -std::string zippath_parent(const char *path) +std::string zippath_parent(const std::string &path) { std::string result; zippath_parent(result, path); @@ -168,12 +168,12 @@ std::string zippath_parent(const char *path) // ------------------------------------------------- -// zippath_parent_basename - retrieves the parent -// directory basename +// zippath_parent_basename - retrieves the parent +// directory basename // ------------------------------------------------- /** - * @fn std::string &zippath_parent_basename(std::string &dst, const char *path) + * @fn std::string &zippath_parent_basename(std::string &dst, const std::string &path) * * @brief Zippath parent basename. * @@ -183,22 +183,22 @@ std::string zippath_parent(const char *path) * @return A std::string& */ -std::string &zippath_parent_basename(std::string &dst, const char *path) +std::string &zippath_parent_basename(std::string &dst, const std::string &path) { - int beginpos, endpos; + std::string::size_type beginpos, endpos; parse_parent_path(path, &beginpos, &endpos); - dst.copy((char*)(path + beginpos + 1), endpos - beginpos); + dst.copy((char*)(path.c_str() + beginpos + 1), endpos - beginpos); return dst; } // ------------------------------------------------- -// zippath_parent_basename - retrieves the parent -// directory basename +// zippath_parent_basename - retrieves the parent +// directory basename // ------------------------------------------------- -std::string zippath_parent_basename(const char *path) +std::string zippath_parent_basename(const std::string &path) { std::string result; zippath_parent_basename(result, path); @@ -208,7 +208,7 @@ std::string zippath_parent_basename(const char *path) // ------------------------------------------------- -// zippath_combine - combines two paths +// zippath_combine - combines two paths // ------------------------------------------------- /** @@ -223,13 +223,13 @@ std::string zippath_parent_basename(const char *path) * @return A std::string& */ -std::string &zippath_combine(std::string &dst, const char *path1, const char *path2) +std::string &zippath_combine(std::string &dst, const std::string &path1, const std::string &path2) { - if (!strcmp(path2, ".")) + if (path2 == ".") { dst.assign(path1); } - else if (!strcmp(path2, "..")) + else if (path2 == "..") { dst = zippath_parent(path1); } @@ -237,7 +237,7 @@ std::string &zippath_combine(std::string &dst, const char *path1, const char *pa { dst.assign(path2); } - else if ((path1[0] != '\0') && !is_path_separator(path1[strlen(path1) - 1])) + else if (!path1.empty() && !is_path_separator(*path1.rbegin())) { dst.assign(path1).append(PATH_SEPARATOR).append(path2); } @@ -251,10 +251,10 @@ std::string &zippath_combine(std::string &dst, const char *path1, const char *pa // ------------------------------------------------- -// zippath_combine - combines two paths +// zippath_combine - combines two paths // ------------------------------------------------- -std::string zippath_combine(const char *path1, const char *path2) +std::string zippath_combine(const std::string &path1, const std::string &path2) { std::string result; zippath_combine(result, path1, path2); @@ -268,8 +268,8 @@ std::string zippath_combine(const char *path1, const char *path2) ***************************************************************************/ // ------------------------------------------------- -// file_error_from_zip_error - translates a -// osd_file::error to a zip_error +// file_error_from_zip_error - translates a +// osd_file::error to a zip_error // ------------------------------------------------- /** @@ -311,8 +311,8 @@ static osd_file::error file_error_from_zip_error(archive_file::error ziperr) // ------------------------------------------------- -// create_core_file_from_zip - creates a core_file -// from a zip file entry +// create_core_file_from_zip - creates a core_file +// from a zip file entry // ------------------------------------------------- /** @@ -359,11 +359,11 @@ done: // ------------------------------------------------- -// zippath_fopen - opens a zip path file +// zippath_fopen - opens a zip path file // ------------------------------------------------- /** - * @fn osd_file::error zippath_fopen(const char *filename, UINT32 openflags, util::core_file::ptr &file, std::string &revised_path) + * @fn osd_file::error zippath_fopen(const std::string &filename, UINT32 openflags, util::core_file::ptr &file, std::string &revised_path) * * @brief Zippath fopen. * @@ -375,7 +375,7 @@ done: * @return A osd_file::error. */ -osd_file::error zippath_fopen(const char *filename, UINT32 openflags, util::core_file::ptr &file, std::string &revised_path) +osd_file::error zippath_fopen(const std::string &filename, UINT32 openflags, util::core_file::ptr &file, std::string &revised_path) { osd_file::error filerr = osd_file::error::NOT_FOUND; archive_file::error ziperr; @@ -441,7 +441,7 @@ osd_file::error zippath_fopen(const char *filename, UINT32 openflags, util::core if (filerr != osd_file::error::NONE) { /* go up a directory */ - auto temp = zippath_parent(mainpath.c_str()); + auto temp = zippath_parent(mainpath); /* append to the sub path */ if (subpath.length() > 0) @@ -490,7 +490,7 @@ done: ***************************************************************************/ // ------------------------------------------------- -// is_root - tests to see if this path is the root +// is_root - tests to see if this path is the root // ------------------------------------------------- /** @@ -521,8 +521,8 @@ static int is_root(const char *path) // ------------------------------------------------- -// is_7z_file - tests to see if this file is a -// 7-zip file +// is_7z_file - tests to see if this file is a +// 7-zip file // ------------------------------------------------- /** @@ -543,8 +543,8 @@ static bool is_7z_file(std::string const &path) // ------------------------------------------------- -// is_zip_file - tests to see if this file is a -// ZIP file +// is_zip_file - tests to see if this file is a +// ZIP file // ------------------------------------------------- static bool is_zip_file(std::string const &path) @@ -556,8 +556,8 @@ static bool is_zip_file(std::string const &path) // ------------------------------------------------- -// is_zip_file_separator - returns whether this -// character is a path separator within a ZIP file +// is_zip_file_separator - returns whether this +// character is a path separator within a ZIP file // ------------------------------------------------- /** @@ -578,8 +578,8 @@ static bool is_zip_file_separator(char c) // ------------------------------------------------- -// is_zip_path_separator - returns whether this -// character is a path separator within a ZIP path +// is_zip_path_separator - returns whether this +// character is a path separator within a ZIP path // ------------------------------------------------- /** @@ -600,8 +600,8 @@ static bool is_zip_path_separator(char c) // ------------------------------------------------- -// next_path_char - lexes out the next path -// character, normalizing separators as '/' +// next_path_char - lexes out the next path +// character, normalizing separators as '/' // ------------------------------------------------- /** @@ -650,8 +650,8 @@ static char next_path_char(std::string const &s, std::string::size_type &pos) // ------------------------------------------------- -// zippath_find_sub_path - attempts to identify the -// type of a sub path in a zip file +// zippath_find_sub_path - attempts to identify the +// type of a sub path in a zip file // ------------------------------------------------- /** @@ -701,8 +701,8 @@ static int zippath_find_sub_path(archive_file &zipfile, std::string const &subpa // ------------------------------------------------- -// zippath_resolve - separates a ZIP path out into -// true path and ZIP entry components +// zippath_resolve - separates a ZIP path out into +// true path and ZIP entry components // ------------------------------------------------- /** @@ -753,7 +753,7 @@ static osd_file::error zippath_resolve(const char *path, osd::directory::entry:: // if we have not found the file or directory, go up current_entry_type = osd::directory::entry::entry_type::NONE; went_up = true; - apath = zippath_parent(apath.c_str()); + apath = zippath_parent(apath); } } while ((current_entry_type == osd::directory::entry::entry_type::NONE) && !is_root(apath.c_str())); @@ -793,11 +793,11 @@ static osd_file::error zippath_resolve(const char *path, osd::directory::entry:: // ------------------------------------------------- -// zippath_opendir - opens a directory +// zippath_opendir - opens a directory // ------------------------------------------------- /** - * @fn osd_file::error zippath_opendir(const char *path, zippath_directory **directory) + * @fn osd_file::error zippath_opendir(const std::string &path, zippath_directory **directory) * * @brief Zippath opendir. * @@ -807,7 +807,7 @@ static osd_file::error zippath_resolve(const char *path, osd::directory::entry:: * @return A osd_file::error. */ -osd_file::error zippath_opendir(const char *path, zippath_directory **directory) +osd_file::error zippath_opendir(const std::string &path, zippath_directory **directory) { osd_file::error err; @@ -824,7 +824,7 @@ osd_file::error zippath_opendir(const char *path, zippath_directory **directory) } /* resolve the path */ osd::directory::entry::entry_type entry_type; - err = zippath_resolve(path, entry_type, result->zipfile, result->zipprefix); + err = zippath_resolve(path.c_str(), entry_type, result->zipfile, result->zipprefix); if (err != osd_file::error::NONE) goto done; @@ -847,7 +847,7 @@ osd_file::error zippath_opendir(const char *path, zippath_directory **directory) } /* is this path the root? if so, pretend we've already returned the parent */ - if (is_root(path)) + if (is_root(path.c_str())) result->returned_parent = true; } @@ -864,7 +864,7 @@ done: // ------------------------------------------------- -// zippath_closedir - closes a directory +// zippath_closedir - closes a directory // ------------------------------------------------- /** @@ -890,9 +890,9 @@ void zippath_closedir(zippath_directory *directory) // ------------------------------------------------- -// get_relative_path - checks to see if a specified -// header is in the zippath_directory, and if so -// returns the relative path +// get_relative_path - checks to see if a specified +// header is in the zippath_directory, and if so +// returns the relative path // ------------------------------------------------- /** @@ -935,7 +935,7 @@ static const char *get_relative_path(zippath_directory const &directory) // ------------------------------------------------- -// zippath_readdir - reads a directory +// zippath_readdir - reads a directory // ------------------------------------------------- /** @@ -1048,8 +1048,8 @@ const osd::directory::entry *zippath_readdir(zippath_directory *directory) // ------------------------------------------------- -// zippath_is_zip - returns TRUE if this path is -// a ZIP path or FALSE if not +// zippath_is_zip - returns TRUE if this path is +// a ZIP path or FALSE if not // ------------------------------------------------- /** diff --git a/src/lib/util/zippath.h b/src/lib/util/zippath.h index d0b017f86eb..9c5b361b076 100644 --- a/src/lib/util/zippath.h +++ b/src/lib/util/zippath.h @@ -34,28 +34,28 @@ class zippath_directory; // ----- path operations ----- // retrieves the parent directory -std::string &zippath_parent(std::string &dst, const char *path); -std::string zippath_parent(const char *path); +std::string &zippath_parent(std::string &dst, const std::string &path); +std::string zippath_parent(const std::string &path); // retrieves the parent directory basename -std::string &zippath_parent_basename(std::string &dst, const char *path); -std::string zippath_parent_basename(const char *path); +std::string &zippath_parent_basename(std::string &dst, const std::string &path); +std::string zippath_parent_basename(const std::string &path); // combines two paths -std::string &zippath_combine(std::string &dst, const char *path1, const char *path2); -std::string zippath_combine(const char *path1, const char *path2); +std::string &zippath_combine(std::string &dst, const std::string &path1, const std::string &path2); +std::string zippath_combine(const std::string &path1, const std::string &path2); // ----- file operations ----- // opens a zip path file -osd_file::error zippath_fopen(const char *filename, UINT32 openflags, util::core_file::ptr &file, std::string &revised_path); +osd_file::error zippath_fopen(const std::string &filename, UINT32 openflags, util::core_file::ptr &file, std::string &revised_path); // ----- directory operations ----- */ // opens a directory -osd_file::error zippath_opendir(const char *path, zippath_directory **directory); +osd_file::error zippath_opendir(const std::string &path, zippath_directory **directory); // closes a directory void zippath_closedir(zippath_directory *directory); diff --git a/src/mame/drivers/alto2.cpp b/src/mame/drivers/alto2.cpp index a7007273401..77ac8f9ca66 100644 --- a/src/mame/drivers/alto2.cpp +++ b/src/mame/drivers/alto2.cpp @@ -7,6 +7,7 @@ #include "emu.h" #include "rendlay.h" +#include "sound/speaker.h" #include "cpu/alto2/alto2cpu.h" #include "machine/diablo_hd.h" @@ -16,6 +17,7 @@ public: alto2_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_speaker(*this, "speaker"), m_io_row0(*this, "ROW0"), m_io_row1(*this, "ROW1"), m_io_row2(*this, "ROW2"), @@ -32,6 +34,7 @@ public: protected: required_device<cpu_device> m_maincpu; + required_device<speaker_sound_device> m_speaker; required_ioport m_io_row0; required_ioport m_io_row1; required_ioport m_io_row2; @@ -155,6 +158,9 @@ static INPUT_PORTS_START( alto2 ) PORT_START("mousey") // Mouse - Y AXIS PORT_BIT( 0xffff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_CHANGED_MEMBER( ":maincpu", alto2_cpu_device, mouse_motion_y, nullptr ) + PORT_START("utilout") // Speaker connected to UTILOUT + PORT_BIT( 0xff, 0x00, IPT_PORT ) PORT_WRITE_LINE_DEVICE_MEMBER(":speaker", speaker_sound_device, level_w) + PORT_START("CONFIG") /* Memory switch on AIM board */ PORT_CONFNAME( 0x01, 0x01, "Memory switch") PORT_CONFSETTING( 0x00, "on") @@ -284,6 +290,11 @@ static MACHINE_CONFIG_START( alto2, alto2_state ) MCFG_PALETTE_ADD_MONOCHROME("palette") + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + MCFG_DIABLO_DRIVES_ADD() MACHINE_CONFIG_END @@ -295,9 +306,10 @@ DRIVER_INIT_MEMBER( alto2_state, alto2 ) alto2_cpu_device* cpu = downcast<alto2_cpu_device *>(m_maincpu.target()); cpu->set_diablo(0, downcast<diablo_hd_device *>(machine().device(DIABLO_HD_0))); cpu->set_diablo(1, downcast<diablo_hd_device *>(machine().device(DIABLO_HD_1))); + cpu->set_speaker(m_speaker); } /* Game Drivers */ // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1977, alto2, 0, 0, alto2, alto2, alto2_state, alto2, "Xerox", "Alto-II", MACHINE_NO_SOUND ) +COMP( 1977, alto2, 0, 0, alto2, alto2, alto2_state, alto2, "Xerox", "Alto-II", 0 ) diff --git a/src/mame/drivers/altos5.cpp b/src/mame/drivers/altos5.cpp index 51542eaa43e..4fa1f75f2d0 100644 --- a/src/mame/drivers/altos5.cpp +++ b/src/mame/drivers/altos5.cpp @@ -4,13 +4,8 @@ Altos 5-15 - Boots, terminal works, memory banking works. - - Error when reading floppy disk (bdos error) - ToDo: - - Get floppy to read the disk (only ones found are .TD0 format) - - Further work once the floppy is fixed + - When running MP/M, dir command crashes the system ****************************************************************************/ @@ -22,23 +17,24 @@ #include "machine/z80dart.h" #include "machine/z80dma.h" #include "machine/wd_fdc.h" +#include "machine/clock.h" #include "softlist.h" class altos5_state : public driver_device { public: altos5_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_pio0(*this, "z80pio_0"), - m_pio1(*this, "z80pio_1"), - m_dart(*this, "z80dart"), - m_sio (*this, "z80sio"), - m_dma (*this, "z80dma"), - m_ctc (*this, "z80ctc"), - m_fdc (*this, "fdc"), - m_floppy0(*this, "fdc:0"), - m_floppy1(*this, "fdc:1") + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_pio0(*this, "pio0") + , m_pio1(*this, "pio1") + , m_dart(*this, "dart") + , m_sio (*this, "sio") + , m_dma (*this, "dma") + , m_ctc (*this, "ctc") + , m_fdc (*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") { } DECLARE_READ8_MEMBER(memory_read_byte); @@ -51,10 +47,11 @@ public: DECLARE_WRITE8_MEMBER(port09_w); DECLARE_WRITE8_MEMBER(port14_w); DECLARE_DRIVER_INIT(altos5); - TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); DECLARE_WRITE_LINE_MEMBER(ctc_z1_w); DECLARE_WRITE_LINE_MEMBER(busreq_w); - DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w ); + DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w); + DECLARE_WRITE_LINE_MEMBER(clock_w); + private: UINT8 m_port08; UINT8 m_port09; @@ -99,15 +96,15 @@ ADDRESS_MAP_END static ADDRESS_MAP_START(altos5_io, AS_IO, 8, altos5_state) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("z80dma", z80dma_device, read, write) + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("dma", z80dma_device, read, write) AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("fdc", fd1797_t, read, write) - AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("z80pio_0", z80pio_device, read, write) - AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("z80ctc", z80ctc_device, read, write) - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("z80pio_1", z80pio_device, read, write) + AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("pio0", z80pio_device, read, write) + AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("ctc", z80ctc_device, read, write) + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("pio1", z80pio_device, read, write) AM_RANGE(0x14, 0x17) AM_WRITE(port14_w) - AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("z80dart", z80dart_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("dart", z80dart_device, ba_cd_r, ba_cd_w) //AM_RANGE(0x20, 0x23) // Hard drive - AM_RANGE(0x2c, 0x2f) AM_DEVREADWRITE("z80sio", z80sio0_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x2c, 0x2f) AM_DEVREADWRITE("sio", z80sio0_device, ba_cd_r, ba_cd_w) ADDRESS_MAP_END /* Input ports */ @@ -137,9 +134,9 @@ void altos5_state::setup_banks(UINT8 source) // WPRT | template | dma bank / cpu bank if (source == 1) // use DMA banks only if BUSACK is asserted - offs = ((~m_port09 & 0x20) << 3) | ((m_port09 & 0x06) << 5) | ((m_port09 & 0xc0) >> 2); + offs = ((BITSWAP8(m_port09, 0, 0, 0, 5, 1, 2, 7, 6) << 4) & 0x1f0) ^ 0x100; else - offs = ((~m_port09 & 0x20) << 3) | ((m_port09 & 0x06) << 5) | ((m_port09 & 0x18) << 1); + offs = ((BITSWAP8(m_port09, 0, 0, 0, 5, 1, 2, 4, 3) << 4) & 0x1f0) ^ 0x100; temp = offs; if ((source == 2) || (temp != m_curr_bank)) @@ -190,17 +187,18 @@ void altos5_state::machine_reset() m_port09 = 0; m_ipl = 1; setup_banks(2); + m_floppy = nullptr; m_maincpu->reset(); } static const z80_daisy_config daisy_chain_intf[] = { - { "z80dma" }, - { "z80pio_0" }, - { "z80pio_1" }, - { "z80ctc" }, - { "z80dart" }, - { "z80sio" }, + { "dma" }, + { "pio0" }, + { "pio1" }, + { "ctc" }, + { "dart" }, + { "sio" }, { nullptr } }; @@ -240,22 +238,16 @@ WRITE_LINE_MEMBER( altos5_state::busreq_w ) { // since our Z80 has no support for BUSACK, we assume it is granted immediately m_maincpu->set_input_line(Z80_INPUT_LINE_BUSRQ, state); - m_maincpu->set_input_line(INPUT_LINE_HALT, state); // do we need this? m_dma->bai_w(state); // tell dma that bus has been granted setup_banks(state); // adjust banking for dma or cpu } // baud rate generator and RTC. All inputs are 2MHz. -TIMER_DEVICE_CALLBACK_MEMBER(altos5_state::ctc_tick) +WRITE_LINE_MEMBER( altos5_state::clock_w ) { - m_ctc->trg0(1); - m_ctc->trg0(0); - m_ctc->trg1(1); - m_ctc->trg1(0); - m_ctc->trg2(1); - m_ctc->trg2(0); - m_ctc->trg3(1); - m_ctc->trg3(0); + m_ctc->trg0(state); + m_ctc->trg1(state); + m_ctc->trg2(state); } WRITE_LINE_MEMBER( altos5_state::ctc_z1_w ) @@ -286,7 +278,7 @@ d0: HD IRQ */ READ8_MEMBER( altos5_state::port09_r ) { - return m_port09 | 0x01; + return m_port09 & 0xfe; } /* @@ -383,8 +375,11 @@ static MACHINE_CONFIG_START( altos5, altos5_state ) MCFG_CPU_IO_MAP(altos5_io) MCFG_Z80_DAISY_CHAIN(daisy_chain_intf) + MCFG_DEVICE_ADD("ctc_clock", CLOCK, XTAL_8MHz / 4) // 2MHz + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(altos5_state, clock_w)) + /* devices */ - MCFG_DEVICE_ADD("z80dma", Z80DMA, XTAL_8MHz / 2) + MCFG_DEVICE_ADD("dma", Z80DMA, XTAL_8MHz / 2) MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(altos5_state, busreq_w)) MCFG_Z80DMA_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) // BAO, not used @@ -393,22 +388,22 @@ static MACHINE_CONFIG_START( altos5, altos5_state ) MCFG_Z80DMA_IN_IORQ_CB(READ8(altos5_state, io_read_byte)) MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(altos5_state, io_write_byte)) - MCFG_DEVICE_ADD("z80pio_0", Z80PIO, XTAL_8MHz / 2) + MCFG_DEVICE_ADD("pio0", Z80PIO, XTAL_8MHz / 2) MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) MCFG_Z80PIO_IN_PA_CB(READ8(altos5_state, port08_r)) MCFG_Z80PIO_OUT_PA_CB(WRITE8(altos5_state, port08_w)) MCFG_Z80PIO_IN_PB_CB(READ8(altos5_state, port09_r)) MCFG_Z80PIO_OUT_PB_CB(WRITE8(altos5_state, port09_w)) - MCFG_DEVICE_ADD("z80pio_1", Z80PIO, XTAL_8MHz / 2) + MCFG_DEVICE_ADD("pio1", Z80PIO, XTAL_8MHz / 2) MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80DART_ADD("z80dart", XTAL_8MHz / 2, 0, 0, 0, 0 ) + MCFG_Z80DART_ADD("dart", XTAL_8MHz / 2, 0, 0, 0, 0 ) // Channel A - console #3 // Channel B - printer MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80SIO0_ADD("z80sio", XTAL_8MHz / 2, 0, 0, 0, 0 ) + MCFG_Z80SIO0_ADD("sio", XTAL_8MHz / 2, 0, 0, 0, 0 ) // Channel A - console #2 // WRDY connects to (altos5_state, fdc_intrq_w) // Channel B - console #1 @@ -417,22 +412,21 @@ static MACHINE_CONFIG_START( altos5, altos5_state ) MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts)) MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_8MHz / 2) + MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL_8MHz / 2) MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("z80sio", z80dart_device, rxtxcb_w)) // SIO Ch B + MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("sio", z80dart_device, rxtxcb_w)) // SIO Ch B MCFG_Z80CTC_ZC1_CB(WRITELINE(altos5_state, ctc_z1_w)) // Z80DART Ch A, SIO Ch A - MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("z80dart", z80dart_device, rxtxcb_w)) // Z80DART Ch B + MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("dart", z80dart_device, rxtxcb_w)) // Z80DART Ch B MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("z80sio", z80dart_device, rxb_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("z80sio", z80dart_device, dcdb_w)) - MCFG_RS232_RI_HANDLER(DEVWRITELINE("z80sio", z80dart_device, rib_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("z80sio", z80dart_device, ctsb_w)) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("sio", z80dart_device, rxb_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("sio", z80dart_device, dcdb_w)) + MCFG_RS232_RI_HANDLER(DEVWRITELINE("sio", z80dart_device, rib_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("sio", z80dart_device, ctsb_w)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc_tick", altos5_state, ctc_tick, attotime::from_hz(XTAL_8MHz / 4)) MCFG_FD1797_ADD("fdc", XTAL_8MHz / 8) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(altos5_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("z80dma", z80dma_device, rdy_w)) + MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w)) MCFG_FLOPPY_DRIVE_ADD("fdc:0", altos5_floppies, "525qd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_SOUND(true) MCFG_FLOPPY_DRIVE_ADD("fdc:1", altos5_floppies, "525qd", floppy_image_device::default_floppy_formats) @@ -454,4 +448,4 @@ ROM_END /* Driver */ /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP(1982, altos5, 0, 0, altos5, altos5, altos5_state, altos5, "Altos", "Altos 5-15", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) +COMP(1982, altos5, 0, 0, altos5, altos5, altos5_state, altos5, "Altos", "Altos 5-15", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/ampro.cpp b/src/mame/drivers/ampro.cpp index f111312c3f1..858bfff9115 100644 --- a/src/mame/drivers/ampro.cpp +++ b/src/mame/drivers/ampro.cpp @@ -27,6 +27,7 @@ ToDo: #include "machine/z80ctc.h" #include "machine/z80dart.h" #include "machine/wd_fdc.h" +#include "machine/clock.h" #include "softlist.h" class ampro_state : public driver_device @@ -35,8 +36,8 @@ public: ampro_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") - , m_dart(*this, "z80dart") - , m_ctc (*this, "z80ctc") + , m_dart(*this, "dart") + , m_ctc (*this, "ctc") , m_fdc (*this, "fdc") , m_floppy0(*this, "fdc:0") { } @@ -48,6 +49,8 @@ public: DECLARE_WRITE8_MEMBER(port00_w); DECLARE_READ8_MEMBER(io_r); DECLARE_WRITE8_MEMBER(io_w); + DECLARE_WRITE_LINE_MEMBER(clock_w); + private: required_device<cpu_device> m_maincpu; required_device<z80dart_device> m_dart; @@ -112,18 +115,16 @@ ADDRESS_MAP_END static const z80_daisy_config daisy_chain_intf[] = { - { "z80ctc" }, - { "z80dart" }, + { "ctc" }, + { "dart" }, { nullptr } }; // Baud rate generator. All inputs are 2MHz. -TIMER_DEVICE_CALLBACK_MEMBER( ampro_state::ctc_tick ) +WRITE_LINE_MEMBER( ampro_state::clock_w ) { - m_ctc->trg0(1); - m_ctc->trg0(0); - m_ctc->trg1(1); - m_ctc->trg1(0); + m_ctc->trg0(state); + m_ctc->trg1(state); } WRITE_LINE_MEMBER( ampro_state::ctc_z0_w ) @@ -163,22 +164,24 @@ static MACHINE_CONFIG_START( ampro, ampro_state ) MCFG_Z80_DAISY_CHAIN(daisy_chain_intf) MCFG_MACHINE_RESET_OVERRIDE(ampro_state, ampro) + MCFG_DEVICE_ADD("ctc_clock", CLOCK, XTAL_16MHz / 8) // 2MHz + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(ampro_state, clock_w)) + /* Devices */ - MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_16MHz / 4) + MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL_16MHz / 4) MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) MCFG_Z80CTC_ZC0_CB(WRITELINE(ampro_state, ctc_z0_w)) // Z80DART Ch A, SIO Ch A - MCFG_Z80CTC_ZC1_CB(DEVWRITELINE("z80dart", z80dart_device, rxtxcb_w)) // SIO Ch B + MCFG_Z80CTC_ZC1_CB(DEVWRITELINE("dart", z80dart_device, rxtxcb_w)) // SIO Ch B - MCFG_Z80DART_ADD("z80dart", XTAL_16MHz / 4, 0, 0, 0, 0 ) + MCFG_Z80DART_ADD("dart", XTAL_16MHz / 4, 0, 0, 0, 0 ) MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd)) MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts)) MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("z80dart", z80dart_device, rxa_w)) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("dart", z80dart_device, rxa_w)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc_tick", ampro_state, ctc_tick, attotime::from_hz(XTAL_16MHz / 8)) MCFG_WD1772_ADD("fdc", XTAL_16MHz / 2) MCFG_FLOPPY_DRIVE_ADD("fdc:0", ampro_floppies, "525dd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_SOUND(true) @@ -199,4 +202,4 @@ ROM_END /* Driver */ /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1980, ampro, 0, 0, ampro, ampro, ampro_state, ampro, "Ampro", "Little Z80 Board", MACHINE_NO_SOUND_HW) +COMP( 1980, ampro, 0, 0, ampro, ampro, ampro_state, ampro, "Ampro", "Little Z80 Board", 0 ) diff --git a/src/mame/drivers/amstrad.cpp b/src/mame/drivers/amstrad.cpp index d6e45da8c0d..4bebdba0132 100644 --- a/src/mame/drivers/amstrad.cpp +++ b/src/mame/drivers/amstrad.cpp @@ -626,7 +626,9 @@ static INPUT_PORTS_START( gx4000 ) PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("kbrow.3") - PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x07, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_START ) PORT_NAME(DEF_STR(Pause)) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("kbrow.4") PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) @@ -726,7 +728,7 @@ static INPUT_PORTS_START( aleste ) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5 F10") PORT_CODE(KEYCODE_F5) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("HELP") PORT_CODE(KEYCODE_PGDN) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Funny looking Russian symbol") PORT_CODE(KEYCODE_END) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xD0\xAA _") PORT_CODE(KEYCODE_HOME) PORT_INCLUDE(crtc_links) PORT_INCLUDE(amx_mouse) @@ -1283,14 +1285,14 @@ ROM_END * *************************************/ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, cpc464, 0, 0, cpc464, cpc464, driver_device, 0, "Amstrad plc", "Amstrad CPC464", 0 ) -COMP( 1985, cpc664, cpc464, 0, cpc664, cpc664, driver_device, 0, "Amstrad plc", "Amstrad CPC664", 0 ) -COMP( 1985, cpc6128, cpc464, 0, cpc6128, cpc6128, driver_device, 0, "Amstrad plc", "Amstrad CPC6128", 0 ) -COMP( 1985, cpc6128f, cpc464, 0, cpc6128, cpc6128f, driver_device, 0, "Amstrad plc", "Amstrad CPC6128 (France, AZERTY Keyboard)", 0 ) -COMP( 1985, cpc6128s, cpc464, 0, cpc6128, cpc6128s, driver_device, 0, "Amstrad plc", "Amstrad CPC6128 (Sweden/Finland)", 0 ) -COMP( 1990, cpc464p, 0, 0, cpcplus, plus, driver_device, 0, "Amstrad plc", "Amstrad CPC464+", 0 ) -COMP( 1990, cpc6128p, 0, 0, cpcplus, plus, driver_device, 0, "Amstrad plc", "Amstrad CPC6128+", 0 ) -CONS( 1990, gx4000, 0, 0, gx4000, gx4000, driver_device, 0, "Amstrad plc", "Amstrad GX4000", 0 ) -COMP( 1989, kccomp, cpc464, 0, kccomp, kccomp, driver_device, 0, "VEB Mikroelektronik", "KC Compact", 0 ) -COMP( 1993, al520ex, cpc464, 0, aleste, aleste, driver_device, 0, "Patisonic", "Aleste 520EX", MACHINE_IMPERFECT_SOUND ) +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, cpc464, 0, 0, cpc464, cpc464, driver_device, 0, "Amstrad plc", "Amstrad CPC464", 0 ) +COMP( 1985, cpc664, cpc464, 0, cpc664, cpc664, driver_device, 0, "Amstrad plc", "Amstrad CPC664", 0 ) +COMP( 1985, cpc6128, cpc464, 0, cpc6128, cpc6128, driver_device, 0, "Amstrad plc", "Amstrad CPC6128", 0 ) +COMP( 1985, cpc6128f, cpc464, 0, cpc6128, cpc6128f, driver_device, 0, "Amstrad plc", "Amstrad CPC6128 (France, AZERTY Keyboard)", 0 ) +COMP( 1985, cpc6128s, cpc464, 0, cpc6128, cpc6128s, driver_device, 0, "Amstrad plc", "Amstrad CPC6128 (Sweden/Finland)", 0 ) +COMP( 1990, cpc464p, 0, 0, cpcplus, plus, driver_device, 0, "Amstrad plc", "Amstrad CPC464+", 0 ) +COMP( 1990, cpc6128p, 0, 0, cpcplus, plus, driver_device, 0, "Amstrad plc", "Amstrad CPC6128+", 0 ) +CONS( 1990, gx4000, 0, 0, gx4000, gx4000, driver_device, 0, "Amstrad plc", "Amstrad GX4000", 0 ) +COMP( 1989, kccomp, cpc464, 0, kccomp, kccomp, driver_device, 0, "VEB Mikroelektronik", "KC Compact", 0 ) +COMP( 1993, al520ex, cpc464, 0, aleste, aleste, driver_device, 0, "Patisonic", "Aleste 520EX", MACHINE_IMPERFECT_SOUND ) diff --git a/src/mame/drivers/apricot.cpp b/src/mame/drivers/apricot.cpp index 6425fcde01e..892efe2da11 100644 --- a/src/mame/drivers/apricot.cpp +++ b/src/mame/drivers/apricot.cpp @@ -19,12 +19,12 @@ #include "machine/wd_fdc.h" #include "video/mc6845.h" #include "sound/sn76496.h" -#include "machine/apricotkb_hle.h" #include "imagedev/flopdrv.h" #include "formats/apridisk.h" #include "bus/centronics/ctronics.h" #include "bus/rs232/rs232.h" -#include "bus/apricot/expansion.h" +#include "bus/apricot/expansion/expansion.h" +#include "bus/apricot/keyboard/keyboard.h" //************************************************************************** @@ -434,7 +434,7 @@ static MACHINE_CONFIG_START( apricot, apricot_state ) MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts)) MCFG_Z80DART_OUT_WRDYA_CB(DEVWRITELINE("ic71", i8089_device, drq2_w)) - MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE("keyboard", apricot_keyboard_hle_device, rxd_w)) + MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE("kbd", apricot_keyboard_bus_device, out_w)) MCFG_Z80DART_OUT_DTRB_CB(WRITELINE(apricot_state, data_selector_dtr_w)) MCFG_Z80DART_OUT_RTSB_CB(WRITELINE(apricot_state, data_selector_rts_w)) MCFG_Z80DART_OUT_INT_CB(DEVWRITELINE("ic31", pic8259_device, ir5_w)) @@ -448,9 +448,9 @@ static MACHINE_CONFIG_START( apricot, apricot_state ) MCFG_RS232_DSR_HANDLER(DEVWRITELINE("ic15", z80sio0_device, synca_w)) MCFG_RS232_CTS_HANDLER(DEVWRITELINE("ic15", z80sio0_device, ctsa_w)) - // keyboard (hle) - MCFG_APRICOT_KEYBOARD_ADD("keyboard") - MCFG_APRICOT_KEYBOARD_TXD_HANDLER(DEVWRITELINE("ic15", z80sio0_device, rxb_w)) + // keyboard + MCFG_APRICOT_KEYBOARD_INTERFACE_ADD("kbd", "hle") + MCFG_APRICOT_KEYBOARD_IN_HANDLER(DEVWRITELINE("ic15", z80sio0_device, rxb_w)) // centronics printer MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") diff --git a/src/mame/drivers/aussiebyte.cpp b/src/mame/drivers/aussiebyte.cpp index 1fdf1cd1fcb..efbca5f0931 100644 --- a/src/mame/drivers/aussiebyte.cpp +++ b/src/mame/drivers/aussiebyte.cpp @@ -341,14 +341,11 @@ static const z80_daisy_config daisy_chain_intf[] = ************************************************************/ // baud rate generator. All inputs are 1.2288MHz. -TIMER_DEVICE_CALLBACK_MEMBER( aussiebyte_state::ctc_tick ) +WRITE_LINE_MEMBER( aussiebyte_state::clock_w ) { - m_ctc->trg0(1); - m_ctc->trg0(0); - m_ctc->trg1(1); - m_ctc->trg1(0); - m_ctc->trg2(1); - m_ctc->trg2(0); + m_ctc->trg0(state); + m_ctc->trg1(state); + m_ctc->trg2(state); } WRITE_LINE_MEMBER( aussiebyte_state::ctc_z0_w ) @@ -475,6 +472,9 @@ static MACHINE_CONFIG_START( aussiebyte, aussiebyte_state ) MCFG_DEVICE_ADD("cent_data_in", INPUT_BUFFER, 0) MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + MCFG_DEVICE_ADD("ctc_clock", CLOCK, XTAL_4_9152MHz / 4) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(aussiebyte_state, clock_w)) + MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL_16MHz / 4) MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) MCFG_Z80CTC_ZC0_CB(WRITELINE(aussiebyte_state, ctc_z0_w)) // SIO1 Ch A @@ -532,7 +532,6 @@ static MACHINE_CONFIG_START( aussiebyte, aussiebyte_state ) MCFG_MC6845_ADDR_CHANGED_CB(aussiebyte_state, crtc_update_addr) MCFG_MSM5832_ADD("rtc", XTAL_32_768kHz) - MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc_tick", aussiebyte_state, ctc_tick, attotime::from_hz(XTAL_4_9152MHz / 4)) MACHINE_CONFIG_END diff --git a/src/mame/drivers/bfm_sc4.cpp b/src/mame/drivers/bfm_sc4.cpp index 309c3f905d6..df5852c9410 100644 --- a/src/mame/drivers/bfm_sc4.cpp +++ b/src/mame/drivers/bfm_sc4.cpp @@ -326,7 +326,7 @@ WRITE8_MEMBER(bfm_sc45_state::mux_output2_w) UINT16 short_data; UINT8 byte_data_first_segment; UINT8 byte_data_second_segment; - for (int digit = 0; digit < 32; digit += 2) + for (int digit = 0; digit < 32; digit += 2) { short_data = (m_segment_34_cache[digit + 1] << 8) | m_segment_34_cache[digit]; byte_data_first_segment = (short_data >> 1) & 15; diff --git a/src/mame/drivers/bigbord2.cpp b/src/mame/drivers/bigbord2.cpp index 88af1c08601..8c938c3500d 100644 --- a/src/mame/drivers/bigbord2.cpp +++ b/src/mame/drivers/bigbord2.cpp @@ -2,16 +2,16 @@ // copyright-holders:Robbbert /*************************************************************************** - Big Board 2 +Ferguson / Digital Research Computers Big Board II - 12/05/2009 Skeleton driver. +2009-05-12 Skeleton driver. - This is very much under construction. +This is very much under construction. - Despite the name, this is not like the xerox or bigboard at all. +Despite the name, this is not like the xerox or bigboard at all. - It is compatible only if the software uses the same published - calls to the bios. Everything else is different. +It is compatible only if the software uses the same published +calls to the bios. Everything else is different. 80 = sio ce 84 = ctca ce @@ -29,14 +29,6 @@ dc = 6845 ce Difficulties encountered: -CTCA controls a pair of vectored interrupts. -One is triggered by a keypress, the other by a vsync pulse.. -Once a key is pressed, CTCA continually issues a keyboard interrupt, -causing a complete freeze. Therefore CTCA has been isolated, and the -2 interrupts are triggered by a hack. It isn't a very good hack, -because the system crashes after a while. However it will allow -testing and development to continue. - The FDC has a INTRQ pin, the diagram says it goes to page 6, but it just vanishes instead. @@ -54,12 +46,10 @@ The switching from port C8 is emulated. ToDo: - Finish floppy disk support (i have no boot disk) -- Finish the DMA switch in portcc_w. -- Fix the above problems with the CTC. -- Finish connecting up the SIO, when it becomes usable. -- Connect up the SASI, Centronics and other interfaces on ports D8-DB. -- Connect up the programming port C0-C3. -- Connect up the numerous board jumpers. +- (optional) Connect SIO to RS232. +- (optional) Connect up the SASI, Centronics and other interfaces on ports D8-DB. +- (optional) Connect up the programming port C0-C3. +- (optional) Connect up the numerous board jumpers. - Need software Monitor commands: @@ -84,63 +74,67 @@ X - change banks #include "cpu/z80/z80.h" #include "cpu/z80/z80daisy.h" #include "machine/z80ctc.h" -#include "machine/z80dart.h" +#include "machine/z80sio.h" #include "machine/z80dma.h" #include "video/mc6845.h" #include "machine/keyboard.h" #include "sound/beep.h" #include "machine/wd_fdc.h" +#include "machine/clock.h" -#define SCREEN_TAG "screen" -#define KEYBOARD_TAG "keyboard" -#define Z80_TAG "u39" -#define Z80SIO_TAG "u16" -#define Z80CTCA_TAG "u37" -#define Z80CTCB_TAG "u21" -#define Z80DMA_TAG "u62" class bigbord2_state : public driver_device { public: bigbord2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_6845(*this, "crtc"), - m_ctca(*this, Z80CTCA_TAG), - m_ctcb(*this, Z80CTCB_TAG), - m_dma(*this, Z80DMA_TAG), - m_fdc(*this, "fdc"), - m_floppy0(*this, "fdc:0"), - m_floppy1(*this, "fdc:1"), - m_beeper(*this, "beeper"), - m_dsw(*this, "DSW"), - m_bankr(*this, "bankr"), - m_bankv(*this, "bankv"), - m_banka(*this, "banka"), - m_palette(*this, "palette") + : driver_device(mconfig, type, tag) + , m_palette(*this, "palette") + , m_maincpu(*this, "maincpu") + , m_ctc1(*this, "ctc1") + , m_ctc2(*this, "ctc2") + , m_sio(*this, "sio") + , m_dma(*this, "dma") + , m_fdc(*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") + , m_beeper(*this, "beeper") + , m_dsw(*this, "DSW") + , m_bankr(*this, "bankr") + , m_bankv(*this, "bankv") + , m_banka(*this, "banka") { } + DECLARE_WRITE8_MEMBER(portc0_w ); DECLARE_WRITE8_MEMBER(portc8_w ); DECLARE_WRITE8_MEMBER(portcc_w ); DECLARE_READ8_MEMBER(portc4_r); DECLARE_READ8_MEMBER(portd0_r); - DECLARE_WRITE8_MEMBER(bigbord2_kbd_put); - DECLARE_WRITE_LINE_MEMBER(frame); + DECLARE_WRITE8_MEMBER(kbd_put); + DECLARE_WRITE_LINE_MEMBER(clock_w); + DECLARE_WRITE_LINE_MEMBER(busreq_w); + DECLARE_WRITE_LINE_MEMBER(ctc_z1_w); + DECLARE_WRITE_LINE_MEMBER(sio_wrdya_w); + DECLARE_WRITE_LINE_MEMBER(sio_wrdyb_w); + DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); DECLARE_DRIVER_INIT(bigbord2); - TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); DECLARE_READ8_MEMBER(memory_read_byte); DECLARE_WRITE8_MEMBER(memory_write_byte); DECLARE_READ8_MEMBER(io_read_byte); DECLARE_WRITE8_MEMBER(io_write_byte); MC6845_UPDATE_ROW(crtc_update_row); + required_device<palette_device> m_palette; + +private: + UINT8 crt8002(UINT8 ac_ra, UINT8 ac_chr, UINT8 ac_attr, UINT16 ac_cnt, bool ac_curs); UINT8 *m_p_chargen; /* character ROM */ UINT8 *m_p_videoram; /* Video RAM */ UINT8 *m_p_attribram; /* Attribute RAM */ -private: UINT8 m_term_data; UINT8 m_term_status; - int m_c8[8]; + UINT16 m_cnt; + bool m_c8[8]; + bool m_cc[8]; floppy_image_device *m_floppy; virtual void machine_start() override; virtual void machine_reset() override; @@ -148,9 +142,9 @@ private: address_space *m_mem; address_space *m_io; required_device<cpu_device> m_maincpu; - required_device<mc6845_device> m_6845; - required_device<z80ctc_device> m_ctca; - required_device<z80ctc_device> m_ctcb; + required_device<z80ctc_device> m_ctc1; + required_device<z80ctc_device> m_ctc2; + required_device<z80sio_device> m_sio; required_device<z80dma_device> m_dma; required_device<mb8877_t> m_fdc; required_device<floppy_connector> m_floppy0; @@ -160,10 +154,13 @@ private: required_memory_bank m_bankr; required_memory_bank m_bankv; required_memory_bank m_banka; -public: - required_device<palette_device> m_palette; }; +// Eprom programming port +WRITE8_MEMBER( bigbord2_state::portc0_w ) +{ +} + /* Status port 0 = RXDA 1 = RXDB @@ -190,49 +187,59 @@ READ8_MEMBER( bigbord2_state::portd0_r ) return ret; } -WRITE8_MEMBER( bigbord2_state::bigbord2_kbd_put ) +WRITE8_MEMBER( bigbord2_state::kbd_put ) { if (data) { m_term_data = data; m_term_status = 8; - m_ctca->trg0(0); - m_ctca->trg0(1); - if (m_mem->read_byte(0xf13d) == 0x4d) - { - // simulate interrupt by saving current pc on - // the stack and jumping to interrupt handler. - UINT16 spreg = m_maincpu->state_int(Z80_SP); - UINT16 pcreg = m_maincpu->state_int(Z80_PC); - spreg--; - m_mem->write_byte(spreg, pcreg >> 8); - spreg--; - m_mem->write_byte(spreg, pcreg); - m_maincpu->set_state_int(Z80_SP, spreg); - m_maincpu->set_state_int(Z80_PC, 0xF120); - } + m_ctc1->trg0(0); + m_ctc1->trg0(1); } } +WRITE_LINE_MEMBER( bigbord2_state::sio_wrdya_w ) +{ + m_cc[0] = state; +} + +WRITE_LINE_MEMBER( bigbord2_state::sio_wrdyb_w ) +{ + m_cc[1] = state; +} + +WRITE_LINE_MEMBER( bigbord2_state::fdc_drq_w ) +{ + m_cc[2] = state; +} + + /* Z80 DMA */ -READ8_MEMBER(bigbord2_state::memory_read_byte) +WRITE_LINE_MEMBER( bigbord2_state::busreq_w ) +{ +// since our Z80 has no support for BUSACK, we assume it is granted immediately + m_maincpu->set_input_line(Z80_INPUT_LINE_BUSRQ, state); + m_dma->bai_w(state); // tell dma that bus has been granted +} + +READ8_MEMBER( bigbord2_state::memory_read_byte ) { return m_mem->read_byte(offset); } -WRITE8_MEMBER(bigbord2_state::memory_write_byte) +WRITE8_MEMBER( bigbord2_state::memory_write_byte ) { m_mem->write_byte(offset, data); } -READ8_MEMBER(bigbord2_state::io_read_byte) +READ8_MEMBER( bigbord2_state::io_read_byte ) { return m_io->read_byte(offset); } -WRITE8_MEMBER(bigbord2_state::io_write_byte) +WRITE8_MEMBER( bigbord2_state::io_write_byte ) { m_io->write_byte(offset, data); } @@ -296,7 +303,7 @@ WRITE8_MEMBER( bigbord2_state::portc8_w ) // motor on if (m_floppy) { - m_floppy->mon_w(~m_c8[6]); + m_floppy->mon_w(m_c8[6]? 0 : 1); } break; case 7: @@ -338,11 +345,7 @@ WRITE8_MEMBER( bigbord2_state::portcc_w ) m_fdc->set_floppy(m_floppy); - bool dma_rdy = 0; - if ((data & 7) == 2) - dma_rdy = m_fdc->drq_r(); - - m_dma->rdy_w(dma_rdy); + m_dma->rdy_w(m_cc[data & 7]); } @@ -360,18 +363,19 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( bigbord2_io, AS_IO, 8, bigbord2_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x80, 0x83) AM_DEVREADWRITE(Z80SIO_TAG, z80sio0_device, ba_cd_r, ba_cd_w) - //AM_RANGE(0x84, 0x87) AM_DEVREADWRITE(Z80CTCA_TAG, z80ctc_device, read, write) //has issues - AM_RANGE(0x88, 0x8b) AM_DEVREADWRITE(Z80CTCB_TAG, z80ctc_device, read, write) - AM_RANGE(0x8C, 0x8F) AM_DEVREADWRITE(Z80DMA_TAG, z80dma_device, read, write) - //AM_RANGE(0xC0, 0xC3) eprom programming port - AM_RANGE(0xC4, 0xC7) AM_READ(portc4_r) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("sio", z80sio_device, ba_cd_r, ba_cd_w) // u16 + AM_RANGE(0x84, 0x87) AM_DEVREADWRITE("ctc1", z80ctc_device, read, write) // u37 has issues + AM_RANGE(0x88, 0x8b) AM_DEVREADWRITE("ctc2", z80ctc_device, read, write) // u21 + AM_RANGE(0x8C, 0x8F) AM_DEVREADWRITE("dma", z80dma_device, read, write) // u62 + AM_RANGE(0xC0, 0xC3) AM_WRITE(portc0_w) // eprom programming port + AM_RANGE(0xC4, 0xC7) AM_READ (portc4_r) AM_RANGE(0xC8, 0xCB) AM_WRITE(portc8_w) AM_RANGE(0xCC, 0xCF) AM_WRITE(portcc_w) - AM_RANGE(0xD0, 0xD3) AM_READ(portd0_r) - AM_RANGE(0xD4, 0xD7) AM_DEVREADWRITE("fdc", mb8877_t, read, write) + AM_RANGE(0xD0, 0xD3) AM_READ (portd0_r) + AM_RANGE(0xD4, 0xD7) AM_DEVREADWRITE("fdc", mb8877_t, read, write) // u10 //AM_RANGE(0xD8, 0xDB) AM_READWRITE(portd8_r, portd8_w) // various external data ports; DB = centronics printer - AM_RANGE(0xDC, 0xDC) AM_MIRROR(2) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) + AM_RANGE(0xDC, 0xDC) AM_MIRROR(2) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) // u30 AM_RANGE(0xDD, 0xDD) AM_MIRROR(2) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) ADDRESS_MAP_END @@ -398,51 +402,37 @@ INPUT_PORTS_END /* Z80 CTC */ -TIMER_DEVICE_CALLBACK_MEMBER(bigbord2_state::ctc_tick) +WRITE_LINE_MEMBER( bigbord2_state::clock_w ) { - m_ctcb->trg0(1); - m_ctcb->trg1(1); - m_ctcb->trg0(0); - m_ctcb->trg1(0); + m_ctc2->trg0(state); + m_ctc2->trg1(state); + if (m_floppy) + m_ctc1->trg1(m_floppy->idx_r()); } -WRITE_LINE_MEMBER( bigbord2_state::frame ) +// there's a multitude of optional jumpers in this area, but this will do +WRITE_LINE_MEMBER( bigbord2_state::ctc_z1_w ) { - static UINT8 framecnt; - framecnt++; - - if ((m_mem->read_byte(0xf13d) == 0x4d) & (framecnt > 3)) - { - framecnt = 0; - // simulate interrupt by saving current pc on - // the stack and jumping to interrupt handler. - UINT16 spreg = m_maincpu->state_int(Z80_SP); - UINT16 pcreg = m_maincpu->state_int(Z80_PC); - spreg--; - m_mem->write_byte(spreg, pcreg >> 8); - spreg--; - m_mem->write_byte(spreg, pcreg); - m_maincpu->set_state_int(Z80_SP, spreg); - m_maincpu->set_state_int(Z80_PC, 0xF18E); - } + m_sio->rxca_w(state); + m_sio->txca_w(state); } - /* Z80 Daisy Chain */ -static const z80_daisy_config bigbord2_daisy_chain[] = +static const z80_daisy_config daisy_chain[] = { - { Z80DMA_TAG }, - { Z80CTCA_TAG }, - { Z80CTCB_TAG }, - { Z80SIO_TAG }, + { "dma" }, + { "ctc1" }, + { "ctc2" }, + { "sio" }, { nullptr } }; /* WD1793 Interface */ static SLOT_INTERFACE_START( bigbord2_floppies ) - SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) + SLOT_INTERFACE( "drive0", FLOPPY_8_DSDD ) + SLOT_INTERFACE( "drive1", FLOPPY_8_DSDD ) SLOT_INTERFACE_END @@ -452,8 +442,8 @@ void bigbord2_state::video_start() { /* find memory regions */ m_p_chargen = memregion("chargen")->base(); - m_p_videoram = memregion(Z80_TAG)->base()+0x6000; - m_p_attribram = memregion(Z80_TAG)->base()+0x7000; + m_p_videoram = memregion("maincpu")->base()+0x6000; + m_p_attribram = memregion("maincpu")->base()+0x7000; } @@ -463,13 +453,18 @@ void bigbord2_state::machine_start() { /* register for state saving */ save_item(NAME(m_term_data)); + m_floppy = nullptr; } void bigbord2_state::machine_reset() { UINT8 i; for (i = 0; i < 8; i++) + { m_c8[i] = 0; + m_cc[i] = 1; + } + m_cc[2] = 0; m_beeper->set_state(0); m_bankr->set_entry(0); m_bankv->set_entry(0); @@ -480,7 +475,7 @@ DRIVER_INIT_MEMBER(bigbord2_state,bigbord2) { m_mem = &m_maincpu->space(AS_PROGRAM); m_io = &m_maincpu->space(AS_IO); - UINT8 *RAM = memregion(Z80_TAG)->base(); + UINT8 *RAM = memregion("maincpu")->base(); m_bankr->configure_entries(0, 2, &RAM[0x0000], 0x10000); m_bankv->configure_entries(0, 2, &RAM[0x6000], 0x10000); m_banka->configure_entries(0, 2, &RAM[0x7000], 0x10000); @@ -490,39 +485,93 @@ DRIVER_INIT_MEMBER(bigbord2_state,bigbord2) /* Screen */ /* F4 Character Displayer */ -static const gfx_layout bigbord2_charlayout = +static const gfx_layout crt8002_charlayout = { - 8, 16, /* 8 x 8 characters */ - 256, /* 256 characters */ + 8, 12, /* 7 x 11 characters */ + 128, /* 128 characters */ 1, /* 1 bits per pixel */ { 0 }, /* no bitplanes */ /* x offsets */ { 0, 1, 2, 3, 4, 5, 6, 7 }, /* y offsets */ - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 8*16 /* every char takes 8 bytes */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8 }, + 8*16 /* every char takes 16 bytes */ }; -static GFXDECODE_START( bigbord2 ) - GFXDECODE_ENTRY( "chargen", 0x0000, bigbord2_charlayout, 0, 1 ) +static GFXDECODE_START( crt8002 ) + GFXDECODE_ENTRY( "chargen", 0x0000, crt8002_charlayout, 0, 1 ) GFXDECODE_END +UINT8 bigbord2_state::crt8002(UINT8 ac_ra, UINT8 ac_chr, UINT8 ac_attr, UINT16 ac_cnt, bool ac_curs) +{ + UINT8 gfx = 0; + switch (ac_attr & 3) + { + case 0: // lores gfx + switch (ac_ra) + { + case 0: + case 1: + case 2: + gfx = (BIT(ac_chr, 7) ? 0xf8 : 0) | (BIT(ac_chr, 3) ? 7 : 0); + break; + case 3: + case 4: + case 5: + gfx = (BIT(ac_chr, 6) ? 0xf8 : 0) | (BIT(ac_chr, 2) ? 7 : 0); + break; + case 6: + case 7: + case 8: + gfx = (BIT(ac_chr, 5) ? 0xf8 : 0) | (BIT(ac_chr, 1) ? 7 : 0); + break; + default: + gfx = (BIT(ac_chr, 4) ? 0xf8 : 0) | (BIT(ac_chr, 0) ? 7 : 0); + break; + } + break; + case 1: // external mode + gfx = BITSWAP8(ac_chr, 0,1,2,3,4,5,6,7); + break; + case 2: // thin gfx + break; + case 3: // alpha + gfx = m_p_chargen[((ac_chr & 0x7f)<<4) | ac_ra]; + break; + } + + if (BIT(ac_attr, 3) & (ac_ra == 11)) // underline + gfx = 0xff; + if (BIT(ac_attr, 2) & ((ac_ra == 5) | (ac_ra == 6))) // strike-through + gfx = 0xff; + if (BIT(ac_attr, 6) & BIT(ac_cnt, 13)) // flash + gfx = 0; + if BIT(ac_attr, 5) // blank + gfx = 0; + if (ac_curs && BIT(ac_cnt, 14)) // cursor + gfx ^= 0xff; + if BIT(ac_attr, 4) // reverse video + gfx ^= 0xff; + return gfx; +} + MC6845_UPDATE_ROW( bigbord2_state::crtc_update_row ) { const rgb_t *palette = m_palette->palette()->entry_list_raw(); - UINT8 chr,gfx,inv; + UINT8 chr,gfx,attr; UINT16 mem,x; UINT32 *p = &bitmap.pix32(y); + ra &= 15; + m_cnt++; for (x = 0; x < x_count; x++) { - inv=0; mem = (ma + x) & 0x7ff; - if (BIT(m_p_attribram[mem], 7)) inv^=0xff; + attr = m_p_attribram[mem]; chr = m_p_videoram[mem]; - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra ] ^ inv; + /* process attributes */ + gfx = crt8002(ra, chr, attr, m_cnt, (x==cursor_x)); /* Display a scanline of a character */ *p++ = palette[BIT( gfx, 7 )]; @@ -542,60 +591,66 @@ MC6845_UPDATE_ROW( bigbord2_state::crtc_update_row ) static MACHINE_CONFIG_START( bigbord2, bigbord2_state ) /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, MAIN_CLOCK) + MCFG_CPU_ADD("maincpu", Z80, MAIN_CLOCK) MCFG_CPU_PROGRAM_MAP(bigbord2_mem) MCFG_CPU_IO_MAP(bigbord2_io) - MCFG_Z80_DAISY_CHAIN(bigbord2_daisy_chain) + MCFG_Z80_DAISY_CHAIN(daisy_chain) /* video hardware */ - MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) + MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(XTAL_10_69425MHz, 700, 0, 560, 260, 0, 240) MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", bigbord2) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", crt8002) MCFG_PALETTE_ADD_MONOCHROME("palette") - /* keyboard */ - MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", bigbord2_state, ctc_tick, attotime::from_hz(MAIN_CLOCK)) + MCFG_DEVICE_ADD("ctc_clock", CLOCK, MAIN_CLOCK) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(bigbord2_state, clock_w)) /* devices */ - MCFG_DEVICE_ADD(Z80DMA_TAG, Z80DMA, MAIN_CLOCK) - MCFG_Z80DMA_OUT_BUSREQ_CB(INPUTLINE(Z80_TAG, INPUT_LINE_HALT)) - MCFG_Z80DMA_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) + MCFG_DEVICE_ADD("dma", Z80DMA, MAIN_CLOCK) + MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(bigbord2_state, busreq_w)) + MCFG_Z80DMA_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) MCFG_Z80DMA_IN_MREQ_CB(READ8(bigbord2_state, memory_read_byte)) MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(bigbord2_state, memory_write_byte)) MCFG_Z80DMA_IN_IORQ_CB(READ8(bigbord2_state, io_read_byte)) MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(bigbord2_state, io_write_byte)) - MCFG_Z80SIO0_ADD(Z80SIO_TAG, MAIN_CLOCK, 0, 0, 0, 0) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD(Z80CTCA_TAG, Z80CTC, MAIN_CLOCK) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - // other inputs of ctca: - // trg0 = KBDSTB; trg1 = index pulse from fdc; trg2 = synca output from sio - - MCFG_DEVICE_ADD(Z80CTCB_TAG, Z80CTC, MAIN_CLOCK / 6) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - // ZC0 = SIO channel B clock, ZC1 = SIO channel A clock - MCFG_Z80CTC_ZC2_CB(DEVWRITELINE(Z80CTCB_TAG, z80ctc_device, trg3)) - - MCFG_MB8877_ADD("fdc", XTAL_16MHz / 16) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", bigbord2_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", bigbord2_floppies, "525dd", floppy_image_device::default_floppy_formats) - - MCFG_MC6845_ADD("crtc", MC6845, SCREEN_TAG, XTAL_16MHz / 8) + MCFG_Z80SIO_ADD("sio", MAIN_CLOCK, 0, 0, 0, 0) + MCFG_Z80SIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80SIO_OUT_SYNCA_CB(DEVWRITELINE("ctc1", z80ctc_device, trg2)) + MCFG_Z80SIO_OUT_WRDYA_CB(WRITELINE(bigbord2_state, sio_wrdya_w)) + MCFG_Z80SIO_OUT_WRDYB_CB(WRITELINE(bigbord2_state, sio_wrdyb_w)) + + MCFG_DEVICE_ADD("ctc1", Z80CTC, MAIN_CLOCK) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + + MCFG_DEVICE_ADD("ctc2", Z80CTC, MAIN_CLOCK) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("sio", z80sio_device, rxtxcb_w)) // to SIO Ch B + MCFG_Z80CTC_ZC1_CB(WRITELINE(bigbord2_state, ctc_z1_w)) // to SIO Ch A + MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("ctc2", z80ctc_device, trg3)) + + MCFG_MB8877_ADD("fdc", XTAL_16MHz / 8) // 2MHz for 8 inch, or 1MHz otherwise (jumper-selectable) + //MCFG_WD_FDC_INTRQ_CALLBACK(INPUTLINE("maincpu", ??)) // info missing from schematic + MCFG_FLOPPY_DRIVE_ADD("fdc:0", bigbord2_floppies, "drive0", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", bigbord2_floppies, "drive1", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + + MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_16MHz / 8) MCFG_MC6845_SHOW_BORDER_AREA(false) MCFG_MC6845_CHAR_WIDTH(8) MCFG_MC6845_UPDATE_ROW_CB(bigbord2_state, crtc_update_row) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(bigbord2_state, frame)) + MCFG_MC6845_OUT_VSYNC_CB(DEVWRITELINE("ctc1", z80ctc_device, trg3)) - MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) - MCFG_GENERIC_KEYBOARD_CB(WRITE8(bigbord2_state, bigbord2_kbd_put)) + /* keyboard */ + MCFG_DEVICE_ADD("keyboard", GENERIC_KEYBOARD, 0) + MCFG_GENERIC_KEYBOARD_CB(WRITE8(bigbord2_state, kbd_put)) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("beeper", BEEP, 950) // actual frequency is unknown - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END @@ -603,12 +658,11 @@ MACHINE_CONFIG_END ROM_START( bigbord2 ) - ROM_REGION( 0x18000, Z80_TAG, 0 ) + ROM_REGION( 0x18000, "maincpu", 0 ) ROM_LOAD( "bigbrdii.bin", 0x0000, 0x1000, CRC(c588189e) SHA1(4133903171ee8b9fcf12cc72de843af782b4a645) ) - // internal to 8002 chip (undumped) we will use one from 'vta2000' for now - ROM_REGION( 0x2000, "chargen", ROMREGION_INVERT ) - ROM_LOAD( "bdp-15_14.rom", 0x0000, 0x2000, BAD_DUMP CRC(a1dc4f8e) SHA1(873fd211f44713b713d73163de2d8b5db83d2143) ) + ROM_REGION( 0x800, "chargen", 0 ) + ROM_LOAD( "8002.bin", 0x0000, 0x0800, CRC(fdd6eb13) SHA1(a094d416e66bdab916e72238112a6265a75ca690) ) ROM_END /* System Drivers */ diff --git a/src/mame/drivers/centiped.cpp b/src/mame/drivers/centiped.cpp index c77e526945e..f34a7c182ae 100644 --- a/src/mame/drivers/centiped.cpp +++ b/src/mame/drivers/centiped.cpp @@ -417,11 +417,9 @@ each direction to assign the boundries. #include "emu.h" #include "cpu/m6502/m6502.h" #include "cpu/s2650/s2650.h" -#include "machine/eepromser.h" #include "machine/watchdog.h" #include "machine/atari_vg.h" #include "includes/centiped.h" -#include "sound/ay8910.h" #include "sound/sn76496.h" #include "sound/pokey.h" @@ -690,8 +688,8 @@ static ADDRESS_MAP_START( centipdb_map, AS_PROGRAM, 8, centiped_state ) AM_RANGE(0x0c01, 0x0c01) AM_MIRROR(0x4000) AM_READ_PORT("IN1") AM_RANGE(0x0c02, 0x0c02) AM_MIRROR(0x4000) AM_READ(centiped_IN2_r) AM_RANGE(0x0c03, 0x0c03) AM_MIRROR(0x4000) AM_READ_PORT("IN3") - AM_RANGE(0x1000, 0x1001) AM_MIRROR(0x4000) AM_DEVWRITE("pokey", ay8910_device, data_address_w) - AM_RANGE(0x1001, 0x1001) AM_MIRROR(0x4000) AM_DEVREAD("pokey", ay8910_device, data_r) + AM_RANGE(0x1000, 0x1001) AM_MIRROR(0x4000) AM_DEVWRITE("aysnd", ay8910_device, data_address_w) + AM_RANGE(0x1001, 0x1001) AM_MIRROR(0x4000) AM_DEVREAD("aysnd", ay8910_device, data_r) AM_RANGE(0x1400, 0x140f) AM_MIRROR(0x4000) AM_WRITE(centiped_paletteram_w) AM_SHARE("paletteram") AM_RANGE(0x1600, 0x163f) AM_MIRROR(0x4000) AM_DEVWRITE("earom", atari_vg_earom_device, write) AM_RANGE(0x1680, 0x1680) AM_MIRROR(0x4000) AM_DEVWRITE("earom", atari_vg_earom_device, ctrl_w) @@ -708,8 +706,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( magworm_map, AS_PROGRAM, 8, centiped_state ) AM_IMPORT_FROM(centiped_base_map) - AM_RANGE(0x1001, 0x1001) AM_DEVWRITE("pokey", ay8910_device, address_w) - AM_RANGE(0x1003, 0x1003) AM_DEVREADWRITE("pokey", ay8910_device, data_r, data_w) + AM_RANGE(0x1001, 0x1001) AM_DEVWRITE("aysnd", ay8910_device, address_w) + AM_RANGE(0x1003, 0x1003) AM_DEVREADWRITE("aysnd", ay8910_device, data_r, data_w) ADDRESS_MAP_END @@ -721,16 +719,14 @@ ADDRESS_MAP_END WRITE8_MEMBER(centiped_state::caterplr_AY8910_w) { - ay8910_device *ay8910 = machine().device<ay8910_device>("pokey"); - ay8910->address_w(space, 0, offset); - ay8910->data_w(space, 0, data); + m_aysnd->address_w(space, 0, offset); + m_aysnd->data_w(space, 0, data); } READ8_MEMBER(centiped_state::caterplr_AY8910_r) { - ay8910_device *ay8910 = machine().device<ay8910_device>("pokey"); - ay8910->address_w(space, 0, offset); - return ay8910->data_r(space, 0); + m_aysnd->address_w(space, 0, offset); + return m_aysnd->data_r(space, 0); } @@ -1734,20 +1730,22 @@ static MACHINE_CONFIG_DERIVED( caterplr, centiped_base ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey", AY8910, 12096000/8) + MCFG_SOUND_ADD("aysnd", AY8910, 12096000/8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( centipdb, centiped ) +static MACHINE_CONFIG_DERIVED( centipdb, centiped_base ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(centipdb_map) /* sound hardware */ - MCFG_SOUND_REPLACE("pokey", AY8910, 12096000/8) + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD("aysnd", AY8910, 12096000/8) MCFG_AY8910_PORT_A_READ_CB(READ8(centiped_state, caterplr_unknown_r)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0) MACHINE_CONFIG_END @@ -1763,8 +1761,7 @@ static MACHINE_CONFIG_DERIVED( magworm, centiped_base ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("pokey", AY8910, 12096000/8) - MCFG_AY8910_PORT_A_READ_CB(READ8(centiped_state, caterplr_unknown_r)) + MCFG_SOUND_ADD("aysnd", AY8910, 12096000/8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0) MACHINE_CONFIG_END diff --git a/src/mame/drivers/chihiro.cpp b/src/mame/drivers/chihiro.cpp index 054aa568a76..37df775313c 100644 --- a/src/mame/drivers/chihiro.cpp +++ b/src/mame/drivers/chihiro.cpp @@ -57,16 +57,16 @@ Games on this system include.... |*| 2009 | Firmware Update For Compact Flash Box (Rev A) | Sega | GDROM | GDX-0024A | 317-0567-EXP | |*| 2004 | Quest Of D Ver.1.01C | Sega | CDROM | CDV-10005C | | |*| 2005 | Sangokushi Taisen Ver.1.002 | Sega | DVDROM | CDV-10009D | | -| | 2005 | Mobile Suit Gundam 0079 Card Builder | Banpresto | DVDROM | CDV-10010 | | +|*| 2005 | Mobile Suit Gundam 0079 Card Builder | Banpresto | DVDROM | CDV-10010 | 317-0415-JPN | |*| 2006 | Sangokushi Taisen 2 Ver.2.007 | Sega | DVDROM | CDV-10019A | | |*| 2005 | Sangokushi Taisen | Sega | DVDROM | CDV-10022 | | |*| 2006 | Sangokushi Taisen 2 Firmware Update | Sega | DVDROM | CDV-10023 | | -| | 2006 | Mobile Suit Gundam 0079 Card Builder Ver.2.02 | Banpresto | DVDROM | CDV-10024B | | +|*| 2006 | Mobile Suit Gundam 0079 Card Builder Ver.2.02 | Banpresto | DVDROM | CDV-10024B | 317-0415-JPN | |*| 2006 | Sangokushi Taisen 2 | Sega | DVDROM | CDV-10029 | | -|*| 2007 | Mobile Suit Gundam 0083 Card Builder | Banpresto | DVDROM | CDV-10030 | | +|*| 2007 | Mobile Suit Gundam 0083 Card Builder | Banpresto | DVDROM | CDV-10030 | 317-0484-JPN | |*| 2008 | Sangokushi Taisen 3 | Sega | DVDROM | CDV-10036 | | |*| 2008 | Sangokushi Taisen 3 Ver.J | Sega | DVDROM | CDV-10036J | | -| | 2007 | Mobile Suit Gundam 0083 Card Builder Ver.2.10 | Bandai Namco - Banpresto | DVDROM | CDV-10037B | | +|*| 2008 | Mobile Suit Gundam 0083 Card Builder Ver.2.10 | Bandai Namco - Banpresto | DVDROM | CDV-10037B | 317-0484-JPN | |*| 2008 | Sangokushi Taisen 3 War Begins Ver.3.59 | Sega | DVDROM | CDV-10041 | | |*| 2008 | Sangokushi Taisen 3 War Begins | Sega | DVDROM | CDV-10042 | | +-+----------+----------------------------------------------------+--------------------------+--------+------------+--------------+ @@ -720,7 +720,7 @@ static const struct { } hacks[3] = { { "chihiro", false, { { 0x6a79f/*3f79f*/, 0x01 }, { 0x6a7a0/*3f7a0*/, 0x00 }, { 0x6b575/*40575*/, 0x00 }, { 0x6b576/*40576*/, 0x00 }, { 0x6b5af/*405af*/, 0x75 }, { 0x6b78a/*4078a*/, 0x75 }, { 0x6b7ca/*407ca*/, 0x00 }, { 0x6b7b8/*407b8*/, 0x00 }, { 0x8f5b2, 0x75 }, { 0x79a9e/*2ea9e*/, 0x74 }, { 0x79b80/*2eb80*/, 0xeb }, { 0x79b97/*2eb97*/, 0x74 }, { 0, 0 } } }, { "outr2", true, { { 0x12e4cf, 0x01 }, { 0x12e4d0, 0x00 }, { 0x4793e, 0x01 }, { 0x4793f, 0x00 }, { 0x47aa3, 0x01 }, { 0x47aa4, 0x00 }, { 0x14f2b6, 0x84 }, { 0x14f2d1, 0x75 }, { 0x8732f, 0x7d }, { 0x87384, 0x7d }, { 0x87388, 0xeb }, { 0, 0 } } }, { "crtaxihr", false, { { 0x14ada5/*11fda5*/, 0x90 },{ 0x14ada6/*11fda6*/, 0x90 }, { 0, 0 } } }, - }; + }; void chihiro_state::hack_usb() { @@ -899,7 +899,7 @@ int ohci_hlean2131qc_device::handle_nonstandard_request(int endpoint, USBSetupPa // setup->wIndex = number of bytes to write // data will be transferred from the host using endpoint 2 (OUT) endpoints[endpoint].buffer[0] = 0; - } + } else if (setup->bRequest == 0x1f) { // this command is used to write data to external memory (with respect to the internal 8051 cpu) @@ -907,7 +907,7 @@ int ohci_hlean2131qc_device::handle_nonstandard_request(int endpoint, USBSetupPa // setup->wIndex = number of bytes to write // data will be transferred from the host using endpoint 3 (OUT) endpoints[endpoint].buffer[0] = 0; - } + } else if (setup->bRequest == 0x20) { // this command is used to send a set of jvs packets, each to a different node @@ -942,7 +942,7 @@ int ohci_hlean2131qc_device::handle_nonstandard_request(int endpoint, USBSetupPa } else if (setup->bRequest == 0x30) { - // this command first disables external interrupt 0 if the lower 8 bits of setup->wValue are 0 + // this command first disables external interrupt 0 if the lower 8 bits of setup->wValue are 0 // or enables it if those bits, seen as a signed 8 bit value, represent a number greater than 0 // then it will return in byte 4 of the data stage the value 0 if external interrupt 0 has been disabled or value 1 if it has been enabled // and in byte 5 the value of an 8 bit counter that is incremented at every external interrupt 0 @@ -1960,6 +1960,78 @@ ROM_START( ccfboxa ) ROM_LOAD("317-0567-exp.pic", 0x00, 0x4000, CRC(cd1d2b2d) SHA1(78203ee0339f76eb76da08d7de43e7e44e4b7d32) ) ROM_END +/* CDV-1xxxx (Sega network DVD-ROM games) */ + +ROM_START( questofd ) + CHIHIRO_BIOS + + DISK_REGION( "gdrom" ) + DISK_IMAGE_READONLY( "cdv-10005c", 0, SHA1(b30238cf8697fb7313fedbe75b70641e9418090f) ) + + ROM_REGION( 0x4000, "pic", ROMREGION_ERASEFF) + //PIC16C621A brute-forced key, label is unknown + ROM_LOAD("317-xxxx-xxx.pic", 0x00, 0x4000, CRC(c6914d97) SHA1(e86897efcca86f303117d1ead6ede53ac410add8) ) +ROM_END + +ROM_START( gundcb79 ) + CHIHIRO_BIOS + + DISK_REGION( "gdrom" ) + DISK_IMAGE_READONLY( "cdv-10010", 0, SHA1(88b97408315515909e79d101b37f580fd1f079ce) ) + + ROM_REGION( 0x4000, "pic", ROMREGION_ERASEFF) + //PIC16C621A (317-0415-JPN) + //(sticker 253-5508-0415J) + ROM_LOAD("317-0415-jpn.pic", 0x00, 0x4000, CRC(e5490747) SHA1(91de42a562a265e4cfa1788e40985a5b9055a10a) ) +ROM_END + +ROM_START( gundcb79a ) + CHIHIRO_BIOS + + DISK_REGION( "gdrom" ) + DISK_IMAGE_READONLY( "cdv-10024b", 0, SHA1(acc344d7583df191e7c60ff968dedcfe12600018) ) + + ROM_REGION( 0x4000, "pic", ROMREGION_ERASEFF) + //PIC16C621A (317-0415-JPN) + //(sticker 253-5508-0415J) + ROM_LOAD("317-0415-jpn.pic", 0x00, 0x4000, CRC(e5490747) SHA1(91de42a562a265e4cfa1788e40985a5b9055a10a) ) +ROM_END + +ROM_START( gundcb83 ) + CHIHIRO_BIOS + + DISK_REGION( "gdrom" ) + DISK_IMAGE_READONLY( "cdv-10030", 0, SHA1(fc4afdd465e397a12a58714ed9c7a35863580869) ) + + ROM_REGION( 0x4000, "pic", ROMREGION_ERASEFF) + //PIC16C621A (317-0484-JPN) + //(sticker 253-5508-0484J) + ROM_LOAD("317-0484-jpn.pic", 0x00, 0x4000, CRC(308995bb) SHA1(9459ca99bfb5c3cf227821739e7008ae9bd6e710) ) +ROM_END + +ROM_START( gundcb83a ) + CHIHIRO_BIOS + + DISK_REGION( "gdrom" ) + DISK_IMAGE_READONLY( "cdv-10031", 0, SHA1(ab165b0c8753c1ab5d9cce82af7ed720a2f83c45) ) + + ROM_REGION( 0x4000, "pic", ROMREGION_ERASEFF) + //PIC16C621A (317-0484-JPN) + //(sticker 253-5508-0484J) + ROM_LOAD("317-0484-jpn.pic", 0x00, 0x4000, CRC(308995bb) SHA1(9459ca99bfb5c3cf227821739e7008ae9bd6e710) ) +ROM_END + +ROM_START( gundcb83b ) + CHIHIRO_BIOS + + DISK_REGION( "gdrom" ) + DISK_IMAGE_READONLY( "cdv-10037b", 0, SHA1(f25cb967127d06bef24c64c731c087fc44c1face) ) + + ROM_REGION( 0x4000, "pic", ROMREGION_ERASEFF) + //PIC16C621A (317-0484-JPN) + //(sticker 253-5508-0484J) + ROM_LOAD("317-0484-jpn.pic", 0x00, 0x4000, CRC(308995bb) SHA1(9459ca99bfb5c3cf227821739e7008ae9bd6e710) ) +ROM_END /* Main board */ /*Chihiro*/ GAME( 2002, chihiro, 0, chihiro_base, chihiro, driver_device, 0, ROT0, "Sega", "Chihiro Bios", MACHINE_NO_SOUND|MACHINE_NOT_WORKING|MACHINE_IS_BIOS_ROOT ) @@ -2017,3 +2089,11 @@ ROM_END // 0023 // 0024 GAME( 2009, ccfboxo, ccfboxa, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Chihiro Firmware Update For Compact Flash Box (GDX-0024)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING ) /* 0024A */ GAME( 2009, ccfboxa, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Chihiro Firmware Update For Compact Flash Box (4.01) (GDX-0024A)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING ) + +/* CDV-1xxxx (Sega network DVD-ROM games) */ +/* 0005C */ GAME( 2004, questofd, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Sega", "Quest of D (CDV-10005C)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING ) +/* 0010 */ GAME( 2005, gundcb79, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Banpresto", "Mobile Suit Gundam 0079 Card Builder (CDV-10010)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING ) +/* 0024B */ GAME( 2006, gundcb79a,gundcb79, chihirogd, chihiro, driver_device, 0, ROT0, "Banpresto", "Mobile Suit Gundam 0079 Card Builder Ver.2.02 (CDV-10024B)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING ) +/* 0030 */ GAME( 2007, gundcb83, chihiro, chihirogd, chihiro, driver_device, 0, ROT0, "Banpresto", "Mobile Suit Gundam 0083 Card Builder (CDV-10030)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING ) +/* 0031 */ GAME( 2007, gundcb83a,gundcb83, chihirogd, chihiro, driver_device, 0, ROT0, "Banpresto", "Mobile Suit Gundam 0083 Card Builder Check Disk (CDV-10031)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING ) +/* 0037B */ GAME( 2008, gundcb83b,gundcb83, chihirogd, chihiro, driver_device, 0, ROT0, "Banpresto", "Mobile Suit Gundam 0083 Card Builder Ver.2.10 (CDV-10037B)", MACHINE_NO_SOUND|MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/ddenlovr.cpp b/src/mame/drivers/ddenlovr.cpp index adc86a9e39a..ec87b4ac442 100644 --- a/src/mame/drivers/ddenlovr.cpp +++ b/src/mame/drivers/ddenlovr.cpp @@ -8198,12 +8198,12 @@ static INPUT_PORTS_START( mjflove ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL ) PORT_PLAYER(2) // "s" PORT_START("DSW2") /* IN12 - DSW2 */ - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2") + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2") PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) ) PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) - PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4,5") + PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4,5") PORT_DIPSETTING( 0x18, "1" ) PORT_DIPSETTING( 0x14, "2" ) PORT_DIPSETTING( 0x10, "3" ) @@ -8212,17 +8212,17 @@ static INPUT_PORTS_START( mjflove ) PORT_DIPSETTING( 0x08, "6" ) PORT_DIPSETTING( 0x04, "7" ) PORT_DIPSETTING( 0x00, "8" ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:6") + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:6") PORT_DIPSETTING( 0x20, DEF_STR( On ) ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:7") + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW1:8") + PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW1:8") /* - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Test ) ) PORT_DIPLOCATION("SW1:8") - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) )*/ + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Test ) ) PORT_DIPLOCATION("SW1:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) )*/ PORT_START("DSW1") /* IN11 - DSW1 */ PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW2:1" ) diff --git a/src/mame/drivers/dmax8000.cpp b/src/mame/drivers/dmax8000.cpp index 66a107f7305..797200876db 100644 --- a/src/mame/drivers/dmax8000.cpp +++ b/src/mame/drivers/dmax8000.cpp @@ -13,9 +13,12 @@ There were a bunch of optional extras such as 256kB RAM, numeric coprocessor, RT ToDo: -- Everything... there are partial schematics, but there's still a lot of guesswork. - +- Parallel port +- Centronics port +- AUX serial port +- FDC/FDD/HD setup - no schematics available of this section, so guessing... +What there is of the schematic shows no sign of a daisy chain or associated interrupts. ****************************************************************************************************************/ @@ -27,7 +30,9 @@ ToDo: #include "machine/z80pio.h" #include "machine/z80dart.h" #include "machine/z80ctc.h" -#include "machine/terminal.h" +#include "machine/mm58274c.h" +#include "bus/rs232/rs232.h" +#include "machine/clock.h" @@ -37,43 +42,66 @@ public: dmax8000_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") - , m_terminal(*this, "terminal") + , m_dart1(*this, "dart1") + , m_dart2(*this, "dart2") + , m_ctc (*this, "ctc") , m_fdc(*this, "fdc") + , m_floppy0(*this, "fdc:0") { } DECLARE_DRIVER_INIT(dmax8000); DECLARE_MACHINE_RESET(dmax8000); - DECLARE_READ8_MEMBER(port80_r); - DECLARE_READ8_MEMBER(port81_r); + DECLARE_WRITE8_MEMBER(port0c_w); + DECLARE_WRITE8_MEMBER(port0d_w); + DECLARE_WRITE8_MEMBER(port14_w); DECLARE_WRITE8_MEMBER(port40_w); - DECLARE_WRITE8_MEMBER(kbd_put); DECLARE_WRITE_LINE_MEMBER(ctc_z0_w); - DECLARE_WRITE_LINE_MEMBER(ctc_z1_w); - DECLARE_WRITE_LINE_MEMBER(ctc_z2_w); + DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); + DECLARE_WRITE_LINE_MEMBER(clock_w); + private: - UINT8 m_term_data; required_device<cpu_device> m_maincpu; - required_device<generic_terminal_device> m_terminal; + required_device<z80dart_device> m_dart1; + required_device<z80dart_device> m_dart2; + required_device<z80ctc_device> m_ctc; required_device<fd1793_t> m_fdc; + required_device<floppy_connector> m_floppy0; }; -WRITE8_MEMBER( dmax8000_state::port40_w ) +WRITE_LINE_MEMBER( dmax8000_state::fdc_drq_w ) { - membank("bankr0")->set_entry(BIT(data, 0)); + if (state) printf("DRQ "); +} + +WRITE8_MEMBER( dmax8000_state::port0c_w ) +{ + printf("Port0c=%X\n", data); + m_fdc->dden_w(BIT(data, 6)); + floppy_image_device *floppy = nullptr; + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + m_fdc->set_floppy(floppy); + if (floppy) + { + floppy->mon_w(0); + floppy->ss_w(0); // no idea + } +} + +WRITE8_MEMBER( dmax8000_state::port0d_w ) +{ + printf("Port0d=%X\n", data); } -READ8_MEMBER( dmax8000_state::port80_r ) +WRITE8_MEMBER( dmax8000_state::port14_w ) { - UINT8 ret = m_term_data; - m_term_data = 0; - return ret; + printf("Port14=%X\n", data); } -READ8_MEMBER( dmax8000_state::port81_r ) +WRITE8_MEMBER( dmax8000_state::port40_w ) { - return (m_term_data) ? 13 : 12; + membank("bankr0")->set_entry(BIT(data, 0)); } static ADDRESS_MAP_START(dmax8000_mem, AS_PROGRAM, 8, dmax8000_state) @@ -85,58 +113,29 @@ static ADDRESS_MAP_START(dmax8000_io, AS_IO, 8, dmax8000_state) ADDRESS_MAP_GLOBAL_MASK(0xff) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("fdc", fd1793_t, read, write) - //AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("dart1", z80dart_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("dart1", z80dart_device, ba_cd_r, ba_cd_w) AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ctc", z80ctc_device, read, write) - AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("pio1", z80pio_device, read, write) - AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("pio2", z80pio_device, read, write) - //AM_RANGE(0x14, 0x17) AM_WRITE(port14_r) - //AM_RANGE(0x18, 0x19) AM_MIRROR(2) AM_DEVREADWRITE("am9512", am9512_device, read, write) // optional numeric coprocessor + AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("pio1", z80pio_device, read, write) // fdd controls + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("pio2", z80pio_device, read, write) // centronics & parallel ports + AM_RANGE(0x14, 0x17) AM_WRITE(port14_w) // control lines for the centronics & parallel ports + //AM_RANGE(0x18, 0x19) AM_MIRROR(2) AM_DEVREADWRITE("am9511", am9512_device, read, write) // optional numeric coprocessor //AM_RANGE(0x1c, 0x1d) AM_MIRROR(2) // optional hard disk controller (1C=status, 1D=data) AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("dart2", z80dart_device, ba_cd_r, ba_cd_w) AM_RANGE(0x40, 0x40) AM_WRITE(port40_w) // memory bank control //AM_RANGE(0x60, 0x67) // optional IEEE488 GPIB - //AM_RANGE(0x70, 0x7f) AM_DEVREADWRITE("rtc", mm58274c_device, read, write) // optional RTC - AM_RANGE(0x04, 0x04) AM_READ(port80_r) AM_DEVWRITE("terminal", generic_terminal_device, write) - AM_RANGE(0x05, 0x05) AM_READ(port81_r) + AM_RANGE(0x70, 0x7f) AM_DEVREADWRITE("rtc", mm58274c_device, read, write) // optional RTC ADDRESS_MAP_END /* Input ports */ static INPUT_PORTS_START( dmax8000 ) INPUT_PORTS_END -/* Z80 Daisy Chain */ - -// order unknown -static const z80_daisy_config daisy_chain[] = -{ - { "pio1" }, - { "pio2" }, - { "dart1" }, - { "dart2" }, - { "ctc" }, - { nullptr } -}; - -/* Z80-CTC Interface */ - -WRITE_LINE_MEMBER( dmax8000_state::ctc_z0_w ) -{ -// guess this generates clock for z80dart -} - -WRITE_LINE_MEMBER( dmax8000_state::ctc_z1_w ) -{ -} - -WRITE_LINE_MEMBER( dmax8000_state::ctc_z2_w ) -{ -} - -/* after the first 4 bytes have been read from ROM, switch the ram back in */ MACHINE_RESET_MEMBER( dmax8000_state, dmax8000 ) { membank("bankr0")->set_entry(0); // point at rom membank("bankw0")->set_entry(0); // always write to ram + m_maincpu->reset(); + m_maincpu->set_input_line_vector(0, 0xee); // fdc vector } DRIVER_INIT_MEMBER( dmax8000_state, dmax8000 ) @@ -148,56 +147,69 @@ DRIVER_INIT_MEMBER( dmax8000_state, dmax8000 ) membank("bankw0")->configure_entry(0, &main[0x0000]); } -static SLOT_INTERFACE_START( floppies ) - SLOT_INTERFACE( "drive0", FLOPPY_8_DSDD ) -SLOT_INTERFACE_END +// Baud rate generator. All inputs are 2MHz. +WRITE_LINE_MEMBER( dmax8000_state::clock_w ) +{ + m_ctc->trg0(state); + m_ctc->trg1(state); + m_ctc->trg2(state); +} -WRITE8_MEMBER( dmax8000_state::kbd_put ) +WRITE_LINE_MEMBER( dmax8000_state::ctc_z0_w ) { - m_term_data = data; + m_dart1->rxca_w(state); + m_dart1->txca_w(state); + m_dart2->rxca_w(state); + m_dart2->txca_w(state); } +static SLOT_INTERFACE_START( floppies ) + SLOT_INTERFACE( "drive0", FLOPPY_8_DSDD ) +SLOT_INTERFACE_END + static MACHINE_CONFIG_START( dmax8000, dmax8000_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz ) // no idea what crystal is used, but 4MHz clock is confirmed MCFG_CPU_PROGRAM_MAP(dmax8000_mem) MCFG_CPU_IO_MAP(dmax8000_io) - MCFG_Z80_DAISY_CHAIN(daisy_chain) MCFG_MACHINE_RESET_OVERRIDE(dmax8000_state, dmax8000) - MCFG_DEVICE_ADD("terminal", GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(dmax8000_state, kbd_put)) + MCFG_DEVICE_ADD("ctc_clock", CLOCK, XTAL_4MHz / 2) // 2MHz + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(dmax8000_state, clock_w)) MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL_4MHz) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) MCFG_Z80CTC_ZC0_CB(WRITELINE(dmax8000_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(dmax8000_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(dmax8000_state, ctc_z2_w)) - - MCFG_Z80DART_ADD("dart1", XTAL_4MHz, 0, 0, 0, 0 ) - //MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd)) - //MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) - //MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - //MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") - //MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart", z80dart_device, write_rxd)) - //MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart", z80dart_device, write_dsr)) - //MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart", z80dart_device, write_cts)) - //MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", dmax8000 ) - - MCFG_Z80DART_ADD("dart2", XTAL_4MHz, 0, 0, 0, 0 ) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC1_CB(DEVWRITELINE("dart2", z80dart_device, rxtxcb_w)) + MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("dart1", z80dart_device, rxtxcb_w)) + + MCFG_Z80DART_ADD("dart1", XTAL_4MHz, 0, 0, 0, 0 ) // A = terminal; B = aux + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("dart1", z80dart_device, rxa_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("dart1", z80dart_device, dcda_w)) + MCFG_RS232_RI_HANDLER(DEVWRITELINE("dart1", z80dart_device, ria_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("dart1", z80dart_device, ctsa_w)) + + MCFG_Z80DART_ADD("dart2", XTAL_4MHz, 0, 0, 0, 0 ) // RS232 ports MCFG_DEVICE_ADD("pio1", Z80PIO, XTAL_4MHz) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(dmax8000_state, port0c_w)) + MCFG_Z80PIO_OUT_PB_CB(WRITE8(dmax8000_state, port0d_w)) + MCFG_DEVICE_ADD("pio2", Z80PIO, XTAL_4MHz) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_FD1793_ADD("fdc", XTAL_2MHz) - //MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(dmax8000_state, fdc_intrq_w)) - //MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(dmax8000_state, fdc_drq_w)) + MCFG_FD1793_ADD("fdc", XTAL_2MHz) // no idea + MCFG_WD_FDC_INTRQ_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(dmax8000_state, fdc_drq_w)) MCFG_FLOPPY_DRIVE_ADD("fdc:0", floppies, "drive0", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_SOUND(true) + + MCFG_DEVICE_ADD("rtc", MM58274C, 0) // MM58174 + // this is all guess + MCFG_MM58274C_MODE24(0) // 12 hour + MCFG_MM58274C_DAY1(1) // monday MACHINE_CONFIG_END @@ -211,4 +223,4 @@ ROM_END /* Driver */ /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1981, dmax8000, 0, 0, dmax8000, dmax8000, dmax8000_state, dmax8000, "Datamax", "Datamax 8000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) +COMP( 1981, dmax8000, 0, 0, dmax8000, dmax8000, dmax8000_state, dmax8000, "Datamax", "Datamax 8000", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/dmndrby.cpp b/src/mame/drivers/dmndrby.cpp index c95e8c04c87..aab882b7f77 100644 --- a/src/mame/drivers/dmndrby.cpp +++ b/src/mame/drivers/dmndrby.cpp @@ -354,6 +354,8 @@ TILE_GET_INFO_MEMBER(dmndrby_state::get_dmndrby_tile_info) void dmndrby_state::video_start() { + m_bg = 0; + m_racetrack_tilemap_rom = memregion("user1")->base(); m_racetrack_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dmndrby_state::get_dmndrby_tile_info),this),TILEMAP_SCAN_ROWS,16,16, 16, 512); m_racetrack_tilemap->mark_all_dirty(); diff --git a/src/mame/drivers/dynax.cpp b/src/mame/drivers/dynax.cpp index 02036eb868a..f183ebdd0cd 100644 --- a/src/mame/drivers/dynax.cpp +++ b/src/mame/drivers/dynax.cpp @@ -2612,33 +2612,33 @@ INPUT_PORTS_END static INPUT_PORTS_START( mjdialq2 ) PORT_START("DSW0") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2") + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2") PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x04, 0x00, "PINFU with TSUMO" ) PORT_DIPLOCATION("SW1:3") + PORT_DIPNAME( 0x04, 0x00, "PINFU with TSUMO" ) PORT_DIPLOCATION("SW1:3") PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x38, 0x20, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:4,5,6") - PORT_DIPSETTING( 0x38, "1 (Easy)" ) - PORT_DIPSETTING( 0x30, "2" ) - PORT_DIPSETTING( 0x28, "3" ) - PORT_DIPSETTING( 0x20, "4" ) - PORT_DIPSETTING( 0x18, "5" ) - PORT_DIPSETTING( 0x10, "6" ) - PORT_DIPSETTING( 0x08, "7" ) - PORT_DIPSETTING( 0x00, "8 (Hard)" ) - - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7") + PORT_DIPNAME( 0x38, 0x20, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:4,5,6") + PORT_DIPSETTING( 0x38, "1 (Easy)" ) + PORT_DIPSETTING( 0x30, "2" ) + PORT_DIPSETTING( 0x28, "3" ) + PORT_DIPSETTING( 0x20, "4" ) + PORT_DIPSETTING( 0x18, "5" ) + PORT_DIPSETTING( 0x10, "6" ) + PORT_DIPSETTING( 0x08, "7" ) + PORT_DIPSETTING( 0x00, "8 (Hard)" ) + + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8") + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("DSW1") - PORT_DIPNAME( 0x07, 0x07, "Time Setting" ) PORT_DIPLOCATION("SW2:1,2,3") + PORT_DIPNAME( 0x07, 0x07, "Time Setting" ) PORT_DIPLOCATION("SW2:1,2,3") PORT_DIPSETTING( 0x07, "08:30" ) PORT_DIPSETTING( 0x06, "09:00" ) PORT_DIPSETTING( 0x05, "09:30" ) @@ -2647,19 +2647,19 @@ static INPUT_PORTS_START( mjdialq2 ) PORT_DIPSETTING( 0x02, "11:00" ) PORT_DIPSETTING( 0x01, "11:30" ) PORT_DIPSETTING( 0x00, "12:00" ) - PORT_DIPNAME( 0x08, 0x00, "Time Service" ) PORT_DIPLOCATION("SW2:4") // "secret moves" happen at certain time stamps + PORT_DIPNAME( 0x08, 0x00, "Time Service" ) PORT_DIPLOCATION("SW2:4") // "secret moves" happen at certain time stamps PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "TEL Display" ) PORT_DIPLOCATION("SW2:5") + PORT_DIPNAME( 0x10, 0x10, "TEL Display" ) PORT_DIPLOCATION("SW2:5") PORT_DIPSETTING( 0x10, DEF_STR( On ) ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x20, 0x20, "GAL mode" ) PORT_DIPLOCATION("SW2:6") // unknown what this does + PORT_DIPNAME( 0x20, 0x20, "GAL mode" ) PORT_DIPLOCATION("SW2:6") // unknown what this does PORT_DIPSETTING( 0x20, "1" ) PORT_DIPSETTING( 0x00, "2" ) - PORT_DIPNAME( 0x40, 0x40, "Select Special Item" ) PORT_DIPLOCATION("SW2:7")/* Allows to select which one of the nine special items you want. */ + PORT_DIPNAME( 0x40, 0x40, "Select Special Item" ) PORT_DIPLOCATION("SW2:7")/* Allows to select which one of the nine special items you want. */ PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "Debug" ) PORT_DIPLOCATION("SW2:8") + PORT_DIPNAME( 0x80, 0x80, "Debug" ) PORT_DIPLOCATION("SW2:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) @@ -6381,24 +6381,24 @@ ROM_END /* Intergirl by Barko -1x GM68A45S uj11 CRT Controller (CRTC) -1x Z8400ADSD-Z80ACPU ug8 8-bit Microprocessor - main -1x GL324 u14 Quad Operational Amplifier - sound -1x YM2203C uj5 FM Operator Type-N (OPM) - sound -1x YM3014B u13 D/A Converter (DAC) - sound -1x oscillator 22.1184MHz xt1 +1x GM68A45S uj11 CRT Controller (CRTC) +1x Z8400ADSD-Z80ACPU ug8 8-bit Microprocessor - main +1x GL324 u14 Quad Operational Amplifier - sound +1x YM2203C uj5 FM Operator Type-N (OPM) - sound +1x YM3014B u13 D/A Converter (DAC) - sound +1x oscillator 22.1184MHz xt1 ROMs -2x TMS27C512 1,2 dumped -3x TMS27C020 3,4,5 dumped +2x TMS27C512 1,2 dumped +3x TMS27C020 3,4,5 dumped RAMs -1x GM76C88AL-15 ug1 -6x KM424C64P-10 uf13,uf13a,uf14,uf15,uf16,uf17 +1x GM76C88AL-15 ug1 +6x KM424C64P-10 uf13,uf13a,uf14,uf15,uf16,uf17 PLDs -1x PAL16L8ACN ug6 read protected -1x CY7C381-0JC read protected +1x PAL16L8ACN ug6 read protected +1x CY7C381-0JC read protected */ ROM_START( intrgirl ) @@ -6415,7 +6415,7 @@ ROM_START( intrgirl ) ROM_LOAD( "n82s147n.uk15", 0x000, 0x200, NO_DUMP ) ROM_LOAD( "n82s147n.uk16", 0x200, 0x200, NO_DUMP ) - ROM_REGION( 0x104, "pals", ROMREGION_ERASE00 ) + ROM_REGION( 0x104, "pals", ROMREGION_ERASE00 ) ROM_LOAD( "pal16l8acn.ug6", 0x000, 0x104, NO_DUMP ) //read protected ROM_END diff --git a/src/mame/drivers/epos.cpp b/src/mame/drivers/epos.cpp index 538799158f1..2afbd439cdd 100644 --- a/src/mame/drivers/epos.cpp +++ b/src/mame/drivers/epos.cpp @@ -27,10 +27,10 @@ between the two palettes. This effect is not emulated, but since both halfs of the palette are identical, this is not an issue. See $039c. The other games have a different color test, not using the busy loop. - - - Find out how Beastie Feastie's 2nd player inputs work. - - - Fix flip screen support for The Dealer and Beastie Feastie. + + - Find out how Beastie Feastie's 2nd player inputs work. + + - Fix flip screen support for The Dealer and Beastie Feastie. ***************************************************************************/ @@ -355,7 +355,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( beastf ) PORT_INCLUDE(dealer) - + PORT_MODIFY("INPUTS") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY diff --git a/src/mame/drivers/esh.cpp b/src/mame/drivers/esh.cpp index b3bcfd51cd9..588782f3394 100644 --- a/src/mame/drivers/esh.cpp +++ b/src/mame/drivers/esh.cpp @@ -150,8 +150,8 @@ WRITE8_MEMBER(esh_state::misc_write) { /* Bit 0 unknown */ -// if (data & 0x02) -// logerror("BEEP!\n"); +// if (data & 0x02) +// logerror("BEEP!\n"); m_beep->set_state(BIT(data, 1)); // polarity unknown /* Bit 2 unknown */ m_ld_video_visible = bool(!((data & 0x08) >> 3)); diff --git a/src/mame/drivers/esq5505.cpp b/src/mame/drivers/esq5505.cpp index db14c6b1a2a..ddc666aa085 100644 --- a/src/mame/drivers/esq5505.cpp +++ b/src/mame/drivers/esq5505.cpp @@ -273,6 +273,9 @@ void esq5505_state::machine_start() // tell the pump about the OTIS & ESP chips m_pump->set_otis(m_otis); m_pump->set_esp(m_esp); + + m_rom = (UINT16 *)(void *)memregion("osrom")->base(); + m_ram = (UINT16 *)(void *)memshare("osram")->ptr(); } void esq5505_state::machine_reset() @@ -280,9 +283,6 @@ void esq5505_state::machine_reset() floppy_connector *con = machine().device<floppy_connector>("wd1772:0"); floppy_image_device *floppy = con ? con->get_device() : nullptr; - m_rom = (UINT16 *)(void *)memregion("osrom")->base(); - m_ram = (UINT16 *)(void *)memshare("osram")->ptr(); - // Default analog values: m_analog_values[0] = 0x7fff; // pitch mod: start in the center m_analog_values[1] = 0x0000; // patch select: nothing pressed. diff --git a/src/mame/drivers/expro02.cpp b/src/mame/drivers/expro02.cpp index b1bbf6448fc..cf39a1db0a7 100644 --- a/src/mame/drivers/expro02.cpp +++ b/src/mame/drivers/expro02.cpp @@ -228,7 +228,7 @@ public: m_kaneko_spr(*this, "kan_spr"), m_spriteram(*this, "spriteram") { } - + required_device<cpu_device> m_maincpu; required_device<palette_device> m_palette; required_device<screen_device> m_screen; diff --git a/src/mame/drivers/fccpu30.cpp b/src/mame/drivers/fccpu30.cpp index cfef6508309..3687f4f81a0 100644 --- a/src/mame/drivers/fccpu30.cpp +++ b/src/mame/drivers/fccpu30.cpp @@ -352,11 +352,11 @@ READ8_MEMBER (fccpu30_state::rotary_rd){ */ READ8_MEMBER (fccpu30_state::board_mem_id_rd){ LOG(("%s\n", FUNCNAME)); - // return 0x6A; // CPU-30 R4 with 4Mb of shared RAM. TODO: make this configurable from commandline or artwork - // return 0x57; // blankt 53 56 - // return 0x36; // CPU-26 1Mb 36 MHz - // return 0x35; // CPU-26 1Mb 36 MHz - return 0x36; // CPU-26 1Mb 36 MHz + // return 0x6A; // CPU-30 R4 with 4Mb of shared RAM. TODO: make this configurable from commandline or artwork + // return 0x57; // blankt 53 56 + // return 0x36; // CPU-26 1Mb 36 MHz + // return 0x35; // CPU-26 1Mb 36 MHz + return 0x36; // CPU-26 1Mb 36 MHz } #if 0 @@ -415,7 +415,7 @@ MACHINE_CONFIG_END ROM_START (fccpu30) ROM_REGION32_BE(0x900000, "roms", 0) -// Boots with Board ID set to: 0x36 +// Boots with Board ID set to: 0x36 ROM_LOAD16_BYTE("CPU33LO.BIN", 0x000001, 0x40000, CRC (49895fdf) SHA1 (733abd144c95225a2faf920490e31df2a27f8e03)) ROM_LOAD16_BYTE("CPU33UP.BIN", 0x000000, 0x40000, CRC (cfe75e94) SHA1 (d40e0635a48607be25f7c58c74b53b7e58fe735d)) @@ -425,9 +425,9 @@ ROM_START (fccpu30) ROM_LOAD32_BYTE("CPU30LO.BIN", 0x000002, 0x20000, CRC (fefa88ed) SHA1 (71a9ad807c0c2da5c6f6a6dc68c73ad8b52f3ea9)) ROM_LOAD32_BYTE("CPU30UP.BIN", 0x000001, 0x20000, CRC (dfed1f68) SHA1 (71478a77d5ab5da0fabcd78e69537919b560e3b8)) ROM_LOAD32_BYTE("CPU30UU.BIN", 0x000000, 0x20000, CRC (66e95cc2) SHA1 (acdb468a3a5974295b81271d617de7f101098891)) -#endif +#endif -// Same binary for many boards, attempts to detect CPU speed etc, currently failing detection but boots system roms anyway +// Same binary for many boards, attempts to detect CPU speed etc, currently failing detection but boots system roms anyway ROM_LOAD ("PGA-002.bin", 0x800000, 0x10000, CRC(faa38972) SHA1(651dfc2f9a865fc6adf49dad90f9e705f2889919) ) ROM_END diff --git a/src/mame/drivers/fcisio.cpp b/src/mame/drivers/fcisio.cpp index 4e33d41c8a8..6b068f4c9e7 100644 --- a/src/mame/drivers/fcisio.cpp +++ b/src/mame/drivers/fcisio.cpp @@ -118,7 +118,7 @@ static ADDRESS_MAP_START (fcisio1_mem, AS_PROGRAM, 16, fcisio1_state) AM_RANGE (0xe60000, 0xe601ff) AM_DEVREADWRITE8("duscc3", duscc68562_device, read, write, 0x00ff) AM_RANGE (0xe80000, 0xe80dff) AM_DEVREADWRITE8("pit", pit68230_device, read, write, 0x00ff) AM_RANGE (0xf00000, 0xf7ffff) AM_ROM /* System EPROM Area 32Kb DEBUGGER supplied */ -// AM_RANGE (0xc40000, 0xc800ff) AM_READWRITE8 (not_implemented_r, not_implemented_w, 0xffff) /* Dummy mapping af address area to display message */ +// AM_RANGE (0xc40000, 0xc800ff) AM_READWRITE8 (not_implemented_r, not_implemented_w, 0xffff) /* Dummy mapping af address area to display message */ ADDRESS_MAP_END /* Start it up */ @@ -155,14 +155,14 @@ WRITE8_MEMBER (fcisio1_state::not_implemented_w){ // TODO: Get a manual to understand the config options for real READ8_MEMBER (fcisio1_state::config_rd){ - UINT8 ret = 0; + UINT8 ret = 0; LOG(("%s\n", FUNCNAME)); // Port B bit #7, 0x80 Self test bit, choose either of these two lines ret &= ~0x80; // 0 = selftest - // ret |= 0x80; // 1 = no selftest + // ret |= 0x80; // 1 = no selftest - return ret; + return ret; } /* Input ports */ @@ -211,7 +211,7 @@ ROM_START (fcisio1) /* ISIO ROM:s v2.1 information * PIT setup sequence * 00 -> REG_PGCR - * 18 -> REG_PSRR + * 18 -> REG_PSRR * 0f -> Reg PADDR * 0f -> REG_PBDDR * fa -> REG_PACR @@ -225,7 +225,7 @@ ROM_START (fcisio1) * 40 -> Reg PIVR * 00 -> REG_TCR - timer disabled, all C pins, use preload, CLK and prescaler are used * a0 -> REG_TCR - timer disabled, The dual-function pin PC3/TOUT carries the TOUTfunction and is used as a timer interrupt request - * output. The timer interrupt is enabled ; thus, the pin is low when the timer ZDS status bit is one. The dual-function + * output. The timer interrupt is enabled ; thus, the pin is low when the timer ZDS status bit is one. The dual-function * pin PC7/TIACK carries the TIACK function and is used as a timer interrupt acknowledge input. * 00 -> Reg 0x12 * 00 -> REG_CPRH @@ -263,39 +263,39 @@ ROM_START (fcisio1) * 00 -> REG_PCDR * ------- repeated 16 times ------------------- * a1 -> REG_TCR - timer enabled, The dual-function pin PC3/TOUT carries the TOUTfunction and is used as a timer interrupt request - * output. The timer interrupt is enabled ; thus, the pin is low when the timer ZDS status bit is one. The dual-function + * output. The timer interrupt is enabled ; thus, the pin is low when the timer ZDS status bit is one. The dual-function * pin PC7/TIACK carries the TIACK function and is used as a timer interrupt acknowledge input. * ?? <- Reg 0x0c * --------------------------------------------- * * DUSCC0 channel A setup sequence - * 0f 00 -> REG_CCR - Reset Tx - * 0f 40 -> REG_CCR - Reset Rx - * 00 07 -> REG_CMR1 - Async mode - * 01 38 -> REG_CMR2 - Normal polled or interrupt mode, no DMA - * 02 00 -> REG_S1R - SYN1, Secondary Address 1 Register, 0 = no sync - * 03 00 -> REG_S2R - SYN2, only used in COP dual Sync mode but alao 0 = no sync + * 0f 00 -> REG_CCR - Reset Tx + * 0f 40 -> REG_CCR - Reset Rx + * 00 07 -> REG_CMR1 - Async mode + * 01 38 -> REG_CMR2 - Normal polled or interrupt mode, no DMA + * 02 00 -> REG_S1R - SYN1, Secondary Address 1 Register, 0 = no sync + * 03 00 -> REG_S2R - SYN2, only used in COP dual Sync mode but alao 0 = no sync * 04 7F -> REG_TPR - Tx 8 bits, CTS and RTS, 1 STOP bit * 05 3d -> REG_TTR - Tx BRG 9600 (assuming a 14.7456 crystal) * 06 1b -> REG_RPR - Rx RTS, 8 bits, no DCD, no parity * 07 2d -> REG_RTR - Rx BRG 9600 (assuming a 14.7456 crystal) - * 0b e1 -> REG_OMR - RTS high, OUT1 = OUT2 = high, RxRdy asserted for each character, - * TxRdy asserted on threshold, Same Tx Residual Character Length as for REG_TPR - * 0a 00 -> REG_CTCR - Counter/Timer control register 00 = Zero Det Int: disabled, Zero Det Control: preset, - * Output Control: square, Prescaler: 1, Clock Source: RTxC pin - * 09 00 -> REG_CTPRL - Counter/Timer Prescaler Register Low = 0 - * 08 00 -> REG_CTPRH - Counter/Timer Prescaler Register High = 0 - * 0f 00 -> REG_CCR - Reset Tx - * 0f 02 -> REG_CCR - Enable Tx - * 0f 40 -> REG_CCR - Reset Rx - * 0f 42 -> REG_CCR - Enable Rx - * 0f 02 -> REG_CCR - Enable Tx - * 0f 42 -> REG_CCR - Enable Rx + * 0b e1 -> REG_OMR - RTS high, OUT1 = OUT2 = high, RxRdy asserted for each character, + * TxRdy asserted on threshold, Same Tx Residual Character Length as for REG_TPR + * 0a 00 -> REG_CTCR - Counter/Timer control register 00 = Zero Det Int: disabled, Zero Det Control: preset, + * Output Control: square, Prescaler: 1, Clock Source: RTxC pin + * 09 00 -> REG_CTPRL - Counter/Timer Prescaler Register Low = 0 + * 08 00 -> REG_CTPRH - Counter/Timer Prescaler Register High = 0 + * 0f 00 -> REG_CCR - Reset Tx + * 0f 02 -> REG_CCR - Enable Tx + * 0f 40 -> REG_CCR - Reset Rx + * 0f 42 -> REG_CCR - Enable Rx + * 0f 02 -> REG_CCR - Enable Tx + * 0f 42 -> REG_CCR - Enable Rx * 0e 27 -> REG_PCR - TRxC = RxCLK 1x, RTxC is input, RTS, GPO2, crystal oscillator connected to X2 - * 1c 10 -> REG_IER - Interrupt Enable Register: RxRdy generates interrupt + * 1c 10 -> REG_IER - Interrupt Enable Register: RxRdy generates interrupt * ... chan B setup with same data.... * ---- DUSCC0 to DUSCC3, setup with same data except at the end of each setup: - * 1e 1c -> DUSCC0 REG_IVR - + * 1e 1c -> DUSCC0 REG_IVR - * 1e 1b -> DUSCC1 REG_IVR * 1e 1a -> DUSCC2 REG_IVR * 1e 19 -> DUSCC3 REG_IVR diff --git a/src/mame/drivers/fromance.cpp b/src/mame/drivers/fromance.cpp index c9729606561..33a5cb017ce 100644 --- a/src/mame/drivers/fromance.cpp +++ b/src/mame/drivers/fromance.cpp @@ -722,49 +722,49 @@ static INPUT_PORTS_START( daiyogen ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("DSW1") - PORT_DIPNAME( 0x01, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW1:!1") + PORT_DIPNAME( 0x01, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW1:!1") PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPNAME( 0x06, 0x00, "Player Initial Score" ) PORT_DIPLOCATION("SW1:!2,!3") + PORT_DIPNAME( 0x06, 0x00, "Player Initial Score" ) PORT_DIPLOCATION("SW1:!2,!3") PORT_DIPSETTING( 0x00, "1,000" ) - PORT_DIPSETTING( 0x04, "1,500" ) + PORT_DIPSETTING( 0x04, "1,500" ) PORT_DIPSETTING( 0x02, "2,000" ) PORT_DIPSETTING( 0x06, "3,000" ) - PORT_DIPNAME( 0x18, 0x00, "Computer Difficulty" ) PORT_DIPLOCATION("SW1:!4,!5") + PORT_DIPNAME( 0x18, 0x00, "Computer Difficulty" ) PORT_DIPLOCATION("SW1:!4,!5") PORT_DIPSETTING( 0x10, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x00, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x08, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x18, DEF_STR( Very_Hard ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:!6") + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:!6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW1:!7" ) - PORT_DIPNAME( 0x80, 0x00, "YAKUMAN STOP" ) PORT_DIPLOCATION("SW1:!8") // not sure what this is supposed to mean + PORT_DIPNAME( 0x80, 0x00, "YAKUMAN STOP" ) PORT_DIPLOCATION("SW1:!8") // not sure what this is supposed to mean PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x80, DEF_STR( On ) ) PORT_START("DSW2") - PORT_DIPNAME( 0x07, 0x00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:!1,!2,!3") + PORT_DIPNAME( 0x07, 0x00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:!1,!2,!3") PORT_DIPSETTING( 0x00, "1" ) - PORT_DIPSETTING( 0x04, "2" ) + PORT_DIPSETTING( 0x04, "2" ) PORT_DIPSETTING( 0x02, "3" ) - PORT_DIPSETTING( 0x06, "4" ) - PORT_DIPSETTING( 0x01, "5" ) + PORT_DIPSETTING( 0x06, "4" ) + PORT_DIPSETTING( 0x01, "5" ) PORT_DIPSETTING( 0x05, "6" ) - PORT_DIPSETTING( 0x03, "7" ) + PORT_DIPSETTING( 0x03, "7" ) PORT_DIPSETTING( 0x07, "8" ) - PORT_DIPNAME( 0x18, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:!4,!5") + PORT_DIPNAME( 0x18, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:!4,!5") PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x10, DEF_STR( 1C_2C ) ) PORT_DIPSETTING( 0x08, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x18, DEF_STR( 3C_1C ) ) - PORT_DIPNAME( 0x20, 0x00, "Ignore FURITEN" ) PORT_DIPLOCATION("SW2:!6") + PORT_DIPNAME( 0x20, 0x00, "Ignore FURITEN" ) PORT_DIPLOCATION("SW2:!6") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x00, "PINFU with TSUMO" ) PORT_DIPLOCATION("SW2:!7") + PORT_DIPNAME( 0x40, 0x00, "PINFU with TSUMO" ) PORT_DIPLOCATION("SW2:!7") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x40, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x00, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:!8") + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:!8") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x80, DEF_STR( On ) ) @@ -793,50 +793,50 @@ static INPUT_PORTS_START( mjnatsu ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) // COIN1 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("DSW2") - PORT_DIPNAME( 0x07, 0x00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:!1,!2,!3") - PORT_DIPSETTING( 0x00, "1" ) - PORT_DIPSETTING( 0x04, "2" ) - PORT_DIPSETTING( 0x02, "3" ) - PORT_DIPSETTING( 0x06, "4" ) - PORT_DIPSETTING( 0x01, "5" ) - PORT_DIPSETTING( 0x05, "6" ) - PORT_DIPSETTING( 0x03, "7" ) - PORT_DIPSETTING( 0x07, "8" ) - PORT_DIPNAME( 0x18, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:!4,!5") - PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x10, DEF_STR( 1C_2C ) ) - PORT_DIPSETTING( 0x08, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x18, DEF_STR( 3C_1C ) ) - PORT_DIPNAME( 0x20, 0x00, "Ignore FURITEN" ) PORT_DIPLOCATION("SW1:!6") - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x00, "PINFU with TSUMO" ) PORT_DIPLOCATION("SW1:!7") - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x40, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x00, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:!8") - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - - PORT_START("DSW1") - PORT_DIPNAME( 0x01, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:!1") - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPNAME( 0x06, 0x00, "Player Initial Score" ) PORT_DIPLOCATION("SW2:!2,!3") - PORT_DIPSETTING( 0x00, "1,000" ) - PORT_DIPSETTING( 0x04, "2,000" ) - PORT_DIPSETTING( 0x02, "3,000" ) - PORT_DIPSETTING( 0x06, "5,000" ) - PORT_DIPNAME( 0x08, 0x00, "Start GOLD" ) PORT_DIPLOCATION("SW2:!4") - PORT_DIPSETTING( 0x00, "1,000" ) - PORT_DIPSETTING( 0x08, "6,000" ) - PORT_DIPNAME( 0x10, 0x00, "Item Shop Voice" ) PORT_DIPLOCATION("SW2:!5") - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x00, "Stop Button (N)" ) PORT_DIPLOCATION("SW2:!6") - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPUNUSED_DIPLOC( 0x40, 0x00, "SW2:!7" ) + PORT_START("DSW2") + PORT_DIPNAME( 0x07, 0x00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:!1,!2,!3") + PORT_DIPSETTING( 0x00, "1" ) + PORT_DIPSETTING( 0x04, "2" ) + PORT_DIPSETTING( 0x02, "3" ) + PORT_DIPSETTING( 0x06, "4" ) + PORT_DIPSETTING( 0x01, "5" ) + PORT_DIPSETTING( 0x05, "6" ) + PORT_DIPSETTING( 0x03, "7" ) + PORT_DIPSETTING( 0x07, "8" ) + PORT_DIPNAME( 0x18, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:!4,!5") + PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x10, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x08, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x18, DEF_STR( 3C_1C ) ) + PORT_DIPNAME( 0x20, 0x00, "Ignore FURITEN" ) PORT_DIPLOCATION("SW1:!6") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x00, "PINFU with TSUMO" ) PORT_DIPLOCATION("SW1:!7") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:!8") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) + + PORT_START("DSW1") + PORT_DIPNAME( 0x01, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:!1") + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPNAME( 0x06, 0x00, "Player Initial Score" ) PORT_DIPLOCATION("SW2:!2,!3") + PORT_DIPSETTING( 0x00, "1,000" ) + PORT_DIPSETTING( 0x04, "2,000" ) + PORT_DIPSETTING( 0x02, "3,000" ) + PORT_DIPSETTING( 0x06, "5,000" ) + PORT_DIPNAME( 0x08, 0x00, "Start GOLD" ) PORT_DIPLOCATION("SW2:!4") + PORT_DIPSETTING( 0x00, "1,000" ) + PORT_DIPSETTING( 0x08, "6,000" ) + PORT_DIPNAME( 0x10, 0x00, "Item Shop Voice" ) PORT_DIPLOCATION("SW2:!5") + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, "Stop Button (N)" ) PORT_DIPLOCATION("SW2:!6") + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPUNUSED_DIPLOC( 0x40, 0x00, "SW2:!7" ) PORT_DIPUNUSED_DIPLOC( 0x80, 0x00, "SW2:!8" ) PORT_INCLUDE( mahjong_panel ) diff --git a/src/mame/drivers/galaxian.cpp b/src/mame/drivers/galaxian.cpp index dc6807fc286..816b2206e66 100644 --- a/src/mame/drivers/galaxian.cpp +++ b/src/mame/drivers/galaxian.cpp @@ -5862,11 +5862,11 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( turpins, turtles ) // the ROMs came from a blister, so there aren't PCB infos available. Chip types and clocks are guessed. - + /* alternate memory map */ MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(turpins_map) - + MCFG_CPU_MODIFY("audiocpu") MCFG_CPU_PROGRAM_MAP(turpins_sound_map) MACHINE_CONFIG_END diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index b3d2011f7c8..01636756c80 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -14680,7 +14680,7 @@ ROM_END The taiwanese hardware needs better decoded reels graphics ROMs, The chars/text graphics are properly decodes, but texts strings look bad in the game. - + *******************************************************************************************/ /* @@ -15567,8 +15567,8 @@ DRIVER_INIT_MEMBER(wingco_state, flaming7) /* Patch to bypass the iButton electronic serial number check. 5D79: jumps to $5D83 for the demo game. - just patched to jump to $5D80 (jmp $6115) - where the check is succesfull. + just patched to jump to $5D80 (jmp $6115) + where the check is succesfull. */ UINT8 *ROM = memregion("maincpu")->base(); ROM[0x5d7a] = 0x05; @@ -15586,8 +15586,8 @@ DRIVER_INIT_MEMBER(wingco_state, flam7_tw) /* Patch to bypass the iButton electronic serial number check. 60B2: After last compare, code jumps to $60BC for the demo game. - Just patched to jump to $60B9 (jmp $644E) where the check - is succesfull. + Just patched to jump to $60B9 (jmp $644E) where the check + is succesfull. */ UINT8 *ROM = memregion("maincpu")->base(); ROM[0x60b3] = 0x05; diff --git a/src/mame/drivers/hk68v10.cpp b/src/mame/drivers/hk68v10.cpp index cab10d05ac0..0020375ea63 100644 --- a/src/mame/drivers/hk68v10.cpp +++ b/src/mame/drivers/hk68v10.cpp @@ -370,15 +370,15 @@ ROM_LOAD16_BYTE ("hk68kv10U12.bin", 0xFC0000, 0x2000, CRC (f2d688e9) SHA1 (e6869 * :scc B Reg 05 <- ea Setting up the transmitter, Transmitter Enable 1, Transmitter Bits/Character 8, Send Break 0, RTS=1, DTR=1 * :scc B Reg 03 <- e1 Setting up the receiver, Receiver Enable 1, Auto Enables 1, Receiver Bits/Character 8 * :scc B Reg 09 <- 00 Master Interrupt Control - No reset 02 A&B: RTS=1 DTR=1 INT=0 Vector generated - * :scc B Reg 01 <- 00 Ext INT:0 Tx INT:0 Parity SC:0 Wait/Ready Enable:0 as Wait on Transmit, Rx INT:0 + * :scc B Reg 01 <- 00 Ext INT:0 Tx INT:0 Parity SC:0 Wait/Ready Enable:0 as Wait on Transmit, Rx INT:0 * :scc B Reg 0b <- 56 Clock Mode Control 55 Clock type TTL level on RTxC pin, RCV CLK=BRG, TRA CLK=BRG, TRxC pin is Output, TRxC CLK=BRG - not_implemented * :scc B Reg 0c <- 0b Low byte of Time Constant for Baudrate generator -> 38400 baud * :scc B Reg 0d <- 00 High byte of Time Constant for Baudrate generator * :scc B Reg 0e <- 03 Misc Control Bits DPLL NULL Command, BRG enabled SRC=PCLK, BRG SRC bps=307200=PCLK 4915200/16, BRG OUT 9600=307200/16(32) - * Repeated for :scc A + * Repeated for :scc A * :scc B Reg 0c <- 0e Low byte of Time Constant for Baudrate generator -> 9600 baud * :scc B Reg 0d <- 00 High byte of Time Constant for Baudrate generator - * Repeated for :scc A + * Repeated for :scc A */ ROM_END diff --git a/src/mame/drivers/hnayayoi.cpp b/src/mame/drivers/hnayayoi.cpp index ad8fc057afc..3afc8c0def9 100644 --- a/src/mame/drivers/hnayayoi.cpp +++ b/src/mame/drivers/hnayayoi.cpp @@ -424,7 +424,7 @@ static INPUT_PORTS_START( untoucha ) PORT_DIPNAME( 0x40, 0x40, "Speech" ) PORT_DIPLOCATION("SW2:2") PORT_DIPSETTING( 0x40, DEF_STR( On ) ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x20, 0x20, "Unknown (Aumit?)" ) PORT_DIPLOCATION("SW2:3") + PORT_DIPNAME( 0x20, 0x20, "Unknown (Aumit?)" ) PORT_DIPLOCATION("SW2:3") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) /* DIPSW sheet says 'AUMIT CUT WHEN ON' */ PORT_DIPSETTING( 0x00, DEF_STR( On ) ) /* Maybe it is Audit, but where/what? */ PORT_DIPNAME( 0x10, 0x10, "Auto Hold" ) PORT_DIPLOCATION("SW2:4") diff --git a/src/mame/drivers/homedata.cpp b/src/mame/drivers/homedata.cpp index f5d2a6181b1..b19ab6dd652 100644 --- a/src/mame/drivers/homedata.cpp +++ b/src/mame/drivers/homedata.cpp @@ -639,19 +639,19 @@ ADDRESS_MAP_END static INPUT_PORTS_START( mjhokite ) PORT_START("DSW1") - PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:8") + PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:8") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW1:7" ) - PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:6,5") + PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW1:7" ) + PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:6,5") PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) PORT_DIPSETTING( 0x04, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x10, 0x10, "Initial Score" ) PORT_DIPLOCATION("SW1:4") + PORT_DIPNAME( 0x10, 0x10, "Initial Score" ) PORT_DIPLOCATION("SW1:4") PORT_DIPSETTING( 0x10, "1000" ) PORT_DIPSETTING( 0x00, "2000" ) - PORT_DIPNAME( 0xe0, 0x80, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,2,1") + PORT_DIPNAME( 0xe0, 0x80, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,2,1") PORT_DIPSETTING( 0xe0, "1 (easiest)" ) PORT_DIPSETTING( 0xc0, "2" ) PORT_DIPSETTING( 0xa0, "3" ) @@ -662,18 +662,18 @@ static INPUT_PORTS_START( mjhokite ) PORT_DIPSETTING( 0x00, "8 (hardest)" ) PORT_START("DSW2") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8") + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, "Girl Voice" ) PORT_DIPLOCATION("SW2:7") + PORT_DIPNAME( 0x02, 0x00, "Girl Voice" ) PORT_DIPLOCATION("SW2:7") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "SW2:6" ) - PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW2:5" ) + PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW2:5" ) PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW2:4" ) - PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW2:3" ) + PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW2:3" ) PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW2:2" ) - PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW2:1" ) + PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW2:1" ) PORT_START("IN0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) @@ -913,30 +913,30 @@ INPUT_PORTS_END static INPUT_PORTS_START( pteacher ) PORT_START("DSW") /* dip switches (handled by pteacher_keyboard_r) */ - PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:1") + PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:1") PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0002, 0x0000, "In-Game BGM") PORT_DIPLOCATION("SW1:2") + PORT_DIPNAME( 0x0002, 0x0000, "In-Game BGM") PORT_DIPLOCATION("SW1:2") PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:3,4") - PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) - PORT_DIPSETTING( 0x0004, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x000c, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x0008, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x0010, 0x0010, "Female Voices" ) PORT_DIPLOCATION("SW1:5") - PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0010, DEF_STR( On ) ) - PORT_DIPUNKNOWN_DIPLOC( 0x0020, 0x0020, "SW1:6" ) - PORT_DIPUNKNOWN_DIPLOC( 0x0040, 0x0040, "SW1:7" ) - PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8") - PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - - PORT_SERVICE_DIPLOC(0x0100, IP_ACTIVE_LOW, "SW2:1" ) - PORT_DIPUNKNOWN_DIPLOC( 0x0200, 0x0200, "SW2:2" ) - PORT_DIPUNKNOWN_DIPLOC( 0x0400, 0x0400, "SW2:3" ) - PORT_DIPUNKNOWN_DIPLOC( 0x0800, 0x0800, "SW2:4" ) + PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:3,4") + PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x0004, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x000c, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x0008, DEF_STR( 1C_2C ) ) + PORT_DIPNAME( 0x0010, 0x0010, "Female Voices" ) PORT_DIPLOCATION("SW1:5") + PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0010, DEF_STR( On ) ) + PORT_DIPUNKNOWN_DIPLOC( 0x0020, 0x0020, "SW1:6" ) + PORT_DIPUNKNOWN_DIPLOC( 0x0040, 0x0040, "SW1:7" ) + PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8") + PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + + PORT_SERVICE_DIPLOC(0x0100, IP_ACTIVE_LOW, "SW2:1" ) + PORT_DIPUNKNOWN_DIPLOC( 0x0200, 0x0200, "SW2:2" ) + PORT_DIPUNKNOWN_DIPLOC( 0x0400, 0x0400, "SW2:3" ) + PORT_DIPUNKNOWN_DIPLOC( 0x0800, 0x0800, "SW2:4" ) PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("COIN") @@ -950,8 +950,8 @@ INPUT_PORTS_END static INPUT_PORTS_START( mjjoship ) PORT_INCLUDE( pteacher ) - // Manual wrong for this game - it's an incomplete version of the - // pteacher set, with no service mode and start score instead of + // Manual wrong for this game - it's an incomplete version of the + // pteacher set, with no service mode and start score instead of // girl voices. Coins stated in manual in same place but do nothing PORT_MODIFY("DSW") diff --git a/src/mame/drivers/ibmpcjr.cpp b/src/mame/drivers/ibmpcjr.cpp index 6d3859f7183..878b6ff29dd 100644 --- a/src/mame/drivers/ibmpcjr.cpp +++ b/src/mame/drivers/ibmpcjr.cpp @@ -613,7 +613,7 @@ static MACHINE_CONFIG_START( ibmpcjr, pcjr_state) /* video hardware */ MCFG_PCVIDEO_PCJR_ADD("pcvideo_pcjr") MCFG_VIDEO_SET_SCREEN("pcvideo_pcjr:screen") - + MCFG_GFXDECODE_ADD("gfxdecode", "pcvideo_pcjr:palette", pcjr) /* sound hardware */ diff --git a/src/mame/drivers/itech32.cpp b/src/mame/drivers/itech32.cpp index af9304a915d..1b0ef8b6137 100644 --- a/src/mame/drivers/itech32.cpp +++ b/src/mame/drivers/itech32.cpp @@ -443,7 +443,7 @@ WRITE16_MEMBER(itech32_state::int1_ack_w) void itech32_state::machine_start() { membank("soundbank")->configure_entries(0, 256, memregion("soundcpu")->base() + 0x10000, 0x4000); - + save_item(NAME(m_vint_state)); save_item(NAME(m_xint_state)); save_item(NAME(m_qint_state)); diff --git a/src/mame/drivers/konamigx.cpp b/src/mame/drivers/konamigx.cpp index f877f6a99c5..29ba3d5cc69 100644 --- a/src/mame/drivers/konamigx.cpp +++ b/src/mame/drivers/konamigx.cpp @@ -961,7 +961,7 @@ WRITE32_MEMBER(konamigx_state::type4_prot_w) } else { - printf("GXT4: unknown protection command %x (PC=%x)\n", m_last_prot_op, space.device().safe_pc()); + //printf("GXT4: unknown protection command %x (PC=%x)\n", m_last_prot_op, space.device().safe_pc()); } if (m_gx_wrport1_1 & 0x10) diff --git a/src/mame/drivers/konin.cpp b/src/mame/drivers/konin.cpp index f3a3377d86d..db194aa5e59 100644 --- a/src/mame/drivers/konin.cpp +++ b/src/mame/drivers/konin.cpp @@ -57,7 +57,7 @@ public: , m_uart(*this, "uart") { } - WRITE_LINE_MEMBER(clock_w); + DECLARE_WRITE_LINE_MEMBER(clock_w); private: virtual void machine_reset() override; @@ -96,7 +96,7 @@ void konin_state::machine_reset() { } -DECLARE_WRITE_LINE_MEMBER( konin_state::clock_w ) +WRITE_LINE_MEMBER( konin_state::clock_w ) { m_uart->write_txc(state); m_uart->write_rxc(state); diff --git a/src/mame/drivers/legionna.cpp b/src/mame/drivers/legionna.cpp index 87d29f816e9..08c4480e40b 100644 --- a/src/mame/drivers/legionna.cpp +++ b/src/mame/drivers/legionna.cpp @@ -904,13 +904,13 @@ static INPUT_PORTS_START( cupsoc ) // TODO: dip-conditional with coin slots // SEIBU_COIN_INPUTS override PORT_START("COIN") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_START("SYSTEM") @@ -931,7 +931,7 @@ static INPUT_PORTS_START( cupsoc ) PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) diff --git a/src/mame/drivers/naomi.cpp b/src/mame/drivers/naomi.cpp index 2e14c2a5269..400d9578067 100644 --- a/src/mame/drivers/naomi.cpp +++ b/src/mame/drivers/naomi.cpp @@ -2996,9 +2996,17 @@ Probably at some stage of development NAOMI was planned as non-JVS system as wel // DIMM firmwares: // FPR-23489C - 1.02 not VxWorks based, no network, can not be software updated to 2.xx+ // Net-DIMM firmwares: -// FPR23718 - 2.03 VxWorks based, introduced ALL.net features, can be updated up to 4.01 -// FPR23905 - 3.03 VxWorks based, added network boot support, supports Triforce and Chihiro, can be updated up to 4.01 -// update only - 4.01 VxWorks based, supports Compact Flash GD-ROM-replacement +// all VxWorkx based, can be updated up to 4.0x, actually 1MB in size, must have CRC32 FFFFFFFF, 1st MB of flash ROM contain stock version, 2nd MB have some updated version +// ? - 2.03 factory only, introduced ALL.net features, so far was seen only as stock firmware in 1st half of flash ROM, factory updated to some newer ver in 2nd ROM half +// FPR23718 - 2.06 factory only, most common version of NAOMI Net-DIMMs, have stock 2.03, IC label need verification +// ? 2.13 factory or update (NAOMI VF4) +// ? 2.17 factory or update (NAOMI VF4 Evolution) +// ? - 3.01 added network boot support, supports Triforce and Chihiro +// FPR23905 - 3.03 factory or update (NAOMI WCCF) +// ? 3.12 factory only +// ? 3.17 latest known 3.xx version, factory or update (NAOMI VF4 Final Tuned or statndalone disks for Chihiro and Triforce) +// update only - 4.01 supports Compact Flash GD-ROM-replacement +// "4.02" hack of 4.01 with CF card vendor check disabled #define NAOMIGD_BIOS \ ROM_REGION( 0x200000, "maincpu", 0) \ ROM_SYSTEM_BIOS( 0, "bios0", "epr-21576e (Japan)" ) \ @@ -3023,8 +3031,13 @@ Probably at some stage of development NAOMI was planned as non-JVS system as wel ROM_LOAD("315-6301.ic11", 0x000000, 0x01ff01, NO_DUMP ) \ ROM_LOAD("315-6334.ic11", 0x000000, 0x01ff01, CRC(534c342d) SHA1(3e879f432c82305487922ab28c07107cf0f3c5cf) ) \ ROM_LOAD16_WORD_SWAP( "fpr-23489c.ic14", 0x000000, 0x200000, CRC(bc38bea1) SHA1(b36fcc6902f397d9749e9d02de1bbb7a5e29d468) ) \ - ROM_LOAD16_WORD_SWAP( "fpr23718.ic36", 0x000000, 0x200000, CRC(a738ea1c) SHA1(6f55f1ae0606816a4eca6645ed36eb7f9c7ad9cf) ) \ - ROM_LOAD16_WORD_SWAP( "fpr23905.ic36", 0x000000, 0x200000, CRC(ffffffff) SHA1(acade4362807c7571b1c2a48ed6067e4bddd404b) ) + ROM_LOAD16_WORD_SWAP( "203_203.bin", 0x000000, 0x200000, CRC(a738ea1c) SHA1(6f55f1ae0606816a4eca6645ed36eb7f9c7ad9cf) ) \ + ROM_LOAD16_WORD_SWAP( "fpr23718.ic36", 0x000000, 0x200000, CRC(a738ea1c) SHA1(b7b5a55a6a4cf0aa2df1b3dff62ff67f864c55e8) ) \ + ROM_LOAD16_WORD_SWAP( "213_203.bin", 0x000000, 0x200000, CRC(a738ea1c) SHA1(17131f318632610b87bc095156ffad4597fed4ca) ) \ + ROM_LOAD16_WORD_SWAP( "217_203.bin", 0x000000, 0x200000, CRC(a738ea1c) SHA1(e5a229ae7ed48b2955cad63529fd938c6db555e5) ) \ + ROM_LOAD16_WORD_SWAP( "fpr23905.ic36", 0x000000, 0x200000, CRC(ffffffff) SHA1(acade4362807c7571b1c2a48ed6067e4bddd404b) ) \ + ROM_LOAD16_WORD_SWAP( "317_312.bin", 0x000000, 0x200000, CRC(a738ea1c) SHA1(31d698cd659446ee09a2eeedec6e4bc6a19d05e8) ) \ + ROM_LOAD16_WORD_SWAP( "401_203.bin", 0x000000, 0x200000, CRC(a738ea1c) SHA1(edb52597108462bcea8eb2a47c19e51e5fb60638) ) /* NAOMI2 BIOS: diff --git a/src/mame/drivers/nbmj8688.cpp b/src/mame/drivers/nbmj8688.cpp index 455f67c5dbf..314a62da37f 100644 --- a/src/mame/drivers/nbmj8688.cpp +++ b/src/mame/drivers/nbmj8688.cpp @@ -2210,7 +2210,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( ojousan ) PORT_START("DSWA") - PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWA:1,2,3") + PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWA:1,2,3") PORT_DIPSETTING( 0x07, "1 (Easy)" ) PORT_DIPSETTING( 0x06, "2" ) PORT_DIPSETTING( 0x05, "3" ) @@ -2219,10 +2219,10 @@ static INPUT_PORTS_START( ojousan ) PORT_DIPSETTING( 0x02, "6" ) PORT_DIPSETTING( 0x01, "7" ) PORT_DIPSETTING( 0x00, "8 (Hard)" ) - PORT_DIPNAME( 0x08, 0x00, "RENCHAN after TENPAIed RYUKYOKU" ) PORT_DIPLOCATION("SWA:4") + PORT_DIPNAME( 0x08, 0x00, "RENCHAN after TENPAIed RYUKYOKU" ) PORT_DIPLOCATION("SWA:4") PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "Character Display Test" ) PORT_DIPLOCATION("SWA:5") + PORT_DIPNAME( 0x10, 0x10, "Character Display Test" ) PORT_DIPLOCATION("SWA:5") PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SWA:6" ) @@ -3029,7 +3029,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( swinggal, ojousan ) - MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(secolove_map) MCFG_CPU_IO_MAP(iemoto_io_map) MACHINE_CONFIG_END @@ -3560,23 +3560,23 @@ ROM_START( ojousanm ) ROM_END ROM_START( swinggal ) - ROM_REGION( 0x10000, "maincpu", 0 ) /* program */ - ROM_LOAD( "1.4G", 0x00000, 0x08000, CRC(e0e94bb9) SHA1(f514993614376c2175e906eab2776567e0c32f67) ) - ROM_LOAD( "2.3G", 0x08000, 0x08000, CRC(577d786e) SHA1(e47e78d8607be0e41c2b220eb367f67e5e19c481) ) - - ROM_REGION( 0x30000, "voice", 0 ) /* voice */ - ROM_LOAD( "3I", 0x00000, 0x10000, CRC(b15ac0c4) SHA1(88c7a0be533465fc9c6833e52bcb1729c2307d06) ) - ROM_LOAD( "2I", 0x10000, 0x10000, CRC(ff44d460) SHA1(cd070b6b48cfafa67e9fe778a2a31e623caa3ddd) ) - ROM_LOAD( "1I", 0x20000, 0x10000, CRC(05294295) SHA1(bb2114dccc94545664c10a9e32ebd87eed59865c) ) - - ROM_REGION( 0x1c0000, "gfx1", 0 ) /* gfx */ - /* 000000-0fffff empty */ - ROM_LOAD( "3.5A", 0x100000, 0x20000, CRC(c1f49332) SHA1(35e4db593ab54b0ab6734a377cc2ed1c8670314c) ) - ROM_LOAD( "4.6A", 0x120000, 0x20000, CRC(f9bac001) SHA1(3aa707c75c27b968303bb8bc007e5da872a807f5) ) - ROM_LOAD( "5.7A", 0x140000, 0x20000, CRC(d9ec3418) SHA1(0d29d800a821b6806dc6b9d5a7aaa0939346ddc4) ) - ROM_LOAD( "6.8A", 0x160000, 0x20000, CRC(5a966741) SHA1(c122ada315f09b0851947e9efd67e0a11663cf66) ) - ROM_LOAD( "7.9A", 0x180000, 0x20000, CRC(93abe5c5) SHA1(d71da2ded70726af0aa1ee751fbab758326447ab) ) - ROM_LOAD( "8.10A", 0x1a0000, 0x20000, CRC(010d353d) SHA1(5ea7fd6f26f6ad484bb6e07e66e8c25d178ac037) ) + ROM_REGION( 0x10000, "maincpu", 0 ) /* program */ + ROM_LOAD( "1.4G", 0x00000, 0x08000, CRC(e0e94bb9) SHA1(f514993614376c2175e906eab2776567e0c32f67) ) + ROM_LOAD( "2.3G", 0x08000, 0x08000, CRC(577d786e) SHA1(e47e78d8607be0e41c2b220eb367f67e5e19c481) ) + + ROM_REGION( 0x30000, "voice", 0 ) /* voice */ + ROM_LOAD( "3I", 0x00000, 0x10000, CRC(b15ac0c4) SHA1(88c7a0be533465fc9c6833e52bcb1729c2307d06) ) + ROM_LOAD( "2I", 0x10000, 0x10000, CRC(ff44d460) SHA1(cd070b6b48cfafa67e9fe778a2a31e623caa3ddd) ) + ROM_LOAD( "1I", 0x20000, 0x10000, CRC(05294295) SHA1(bb2114dccc94545664c10a9e32ebd87eed59865c) ) + + ROM_REGION( 0x1c0000, "gfx1", 0 ) /* gfx */ + /* 000000-0fffff empty */ + ROM_LOAD( "3.5A", 0x100000, 0x20000, CRC(c1f49332) SHA1(35e4db593ab54b0ab6734a377cc2ed1c8670314c) ) + ROM_LOAD( "4.6A", 0x120000, 0x20000, CRC(f9bac001) SHA1(3aa707c75c27b968303bb8bc007e5da872a807f5) ) + ROM_LOAD( "5.7A", 0x140000, 0x20000, CRC(d9ec3418) SHA1(0d29d800a821b6806dc6b9d5a7aaa0939346ddc4) ) + ROM_LOAD( "6.8A", 0x160000, 0x20000, CRC(5a966741) SHA1(c122ada315f09b0851947e9efd67e0a11663cf66) ) + ROM_LOAD( "7.9A", 0x180000, 0x20000, CRC(93abe5c5) SHA1(d71da2ded70726af0aa1ee751fbab758326447ab) ) + ROM_LOAD( "8.10A", 0x1a0000, 0x20000, CRC(010d353d) SHA1(5ea7fd6f26f6ad484bb6e07e66e8c25d178ac037) ) ROM_END ROM_START( bijokkog ) @@ -4060,7 +4060,7 @@ GAME( 1987, iemotom, iemoto, iemotom, iemotom, driver_device, 0, GAME( 1987, ryuuha, iemoto, ryuuha, ryuuha, driver_device, 0, ROT0, "Central Denshi", "Ryuuha [BET] (Japan 871027)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, ojousan, 0, ojousan, ojousan, driver_device, 0, ROT0, "Nichibutsu", "Ojousan (Japan 871204)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, ojousanm, ojousan, ojousanm, ojousanm, driver_device, 0, ROT0, "Nichibutsu", "Ojousan [BET] (Japan 870108)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, swinggal, 0, swinggal, ryuuha, driver_device, 0, ROT0, "Digital Denshi", "Swing Gal [BET] (Japan 871221)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, swinggal, 0, swinggal, ryuuha, driver_device, 0, ROT0, "Digital Denshi", "Swing Gal [BET] (Japan 871221)", MACHINE_SUPPORTS_SAVE ) GAME( 1988, korinai, 0, korinai, korinai, driver_device, 0, ROT0, "Nichibutsu", "Mahjong-zukino Korinai Menmen (Japan 880425)", MACHINE_SUPPORTS_SAVE ) GAME( 1988, korinaim, korinai, korinaim, korinaim, driver_device, 0, ROT0, "Nichibutsu", "Mahjong-zukino Korinai Menmen [BET] (Japan 880920)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/nbmj8891.cpp b/src/mame/drivers/nbmj8891.cpp index 0ef8e6879e3..25c4fdbb1bd 100644 --- a/src/mame/drivers/nbmj8891.cpp +++ b/src/mame/drivers/nbmj8891.cpp @@ -767,7 +767,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( msjiken ) PORT_START("DSWA") - PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:1,2,3") + PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:1,2,3") PORT_DIPSETTING( 0x07, "1 (Easy)" ) PORT_DIPSETTING( 0x06, "2" ) PORT_DIPSETTING( 0x05, "3" ) @@ -776,19 +776,19 @@ static INPUT_PORTS_START( msjiken ) PORT_DIPSETTING( 0x02, "6" ) PORT_DIPSETTING( 0x01, "7" ) PORT_DIPSETTING( 0x00, "8 (Hard)" ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:4") + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:4") PORT_DIPSETTING( 0x08, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:5") + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:5") PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:6") + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x00, "Game Sounds" ) PORT_DIPLOCATION("SW1:7") + PORT_DIPNAME( 0x40, 0x00, "Game Sounds" ) PORT_DIPLOCATION("SW1:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "Control Type" ) PORT_DIPLOCATION("SW1:8") + PORT_DIPNAME( 0x80, 0x80, "Control Type" ) PORT_DIPLOCATION("SW1:8") PORT_DIPSETTING( 0x80, "ROYAL" ) PORT_DIPSETTING( 0x00, "JAMMA" ) @@ -1161,7 +1161,7 @@ static INPUT_PORTS_START( mjfocus ) // I don't have manual for this game. PORT_START("DSWA") - PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWA:1,2,3") + PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWA:1,2,3") PORT_DIPSETTING( 0x07, "1 (Easy)" ) PORT_DIPSETTING( 0x06, "2" ) PORT_DIPSETTING( 0x05, "3" ) @@ -1170,13 +1170,13 @@ static INPUT_PORTS_START( mjfocus ) PORT_DIPSETTING( 0x02, "6" ) PORT_DIPSETTING( 0x01, "7" ) PORT_DIPSETTING( 0x00, "8 (Hard)" ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SWA:4") + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SWA:4") PORT_DIPSETTING( 0x08, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x10, 0x10, "Character Display Test" ) PORT_DIPLOCATION("SWA:5") + PORT_DIPNAME( 0x10, 0x10, "Character Display Test" ) PORT_DIPLOCATION("SWA:5") PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SWA:6") + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SWA:6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SWA:7" ) @@ -1738,27 +1738,27 @@ INPUT_PORTS_END static INPUT_PORTS_START( mladyhtr ) PORT_START("DSWA") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWA:1,2") + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWA:1,2") PORT_DIPSETTING( 0x03, "1" ) PORT_DIPSETTING( 0x02, "2" ) PORT_DIPSETTING( 0x01, "3" ) PORT_DIPSETTING( 0x00, "4" ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SWA:3") + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SWA:3") PORT_DIPSETTING( 0x04, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SWA:4") + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SWA:4") PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWA:5") + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWA:5") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, "Game Sounds" ) PORT_DIPLOCATION("SWA:6") + PORT_DIPNAME( 0x20, 0x20, "Game Sounds" ) PORT_DIPLOCATION("SWA:6") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, "Game Mode" ) PORT_DIPLOCATION("SWA:7") + PORT_DIPNAME( 0x40, 0x40, "Game Mode" ) PORT_DIPLOCATION("SWA:7") PORT_DIPSETTING( 0x40, "Beginner" ) PORT_DIPSETTING( 0x00, "Expert" ) - PORT_DIPNAME( 0x80, 0x80, "Graphic ROM Test" ) PORT_DIPLOCATION("SWA:8") + PORT_DIPNAME( 0x80, 0x80, "Graphic ROM Test" ) PORT_DIPLOCATION("SWA:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) diff --git a/src/mame/drivers/nbmj8991.cpp b/src/mame/drivers/nbmj8991.cpp index 24a49727239..50900d54b80 100644 --- a/src/mame/drivers/nbmj8991.cpp +++ b/src/mame/drivers/nbmj8991.cpp @@ -300,27 +300,27 @@ INPUT_PORTS_END static INPUT_PORTS_START( triplew1 ) PORT_START("DSWA") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWA:1,2") + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWA:1,2") PORT_DIPSETTING( 0x03, "1 (Easy)" ) PORT_DIPSETTING( 0x02, "2" ) PORT_DIPSETTING( 0x01, "3" ) PORT_DIPSETTING( 0x00, "4 (Hard)" ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SWA:3") + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SWA:3") PORT_DIPSETTING( 0x04, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWA:4") + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWA:4") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "Game Sounds" ) PORT_DIPLOCATION("SWA:5") + PORT_DIPNAME( 0x10, 0x10, "Game Sounds" ) PORT_DIPLOCATION("SWA:5") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SWA:6") + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SWA:6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, "Character Display Test" ) PORT_DIPLOCATION("SWA:7") + PORT_DIPNAME( 0x40, 0x40, "Character Display Test" ) PORT_DIPLOCATION("SWA:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "Graphic ROM Test" ) PORT_DIPLOCATION("SWA:8") + PORT_DIPNAME( 0x80, 0x80, "Graphic ROM Test" ) PORT_DIPLOCATION("SWA:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) @@ -669,7 +669,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( galkoku ) PORT_START("DSWA") - PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWA:1,2,3") + PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWA:1,2,3") PORT_DIPSETTING( 0x07, "1 (Easy)" ) PORT_DIPSETTING( 0x06, "2" ) PORT_DIPSETTING( 0x05, "3" ) @@ -678,19 +678,19 @@ static INPUT_PORTS_START( galkoku ) PORT_DIPSETTING( 0x02, "6" ) PORT_DIPSETTING( 0x01, "7" ) PORT_DIPSETTING( 0x00, "8 (Hard)" ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SWA:4") + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SWA:4") PORT_DIPSETTING( 0x08, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x10, 0x10, "Character Display Test" ) PORT_DIPLOCATION("SWA:5") + PORT_DIPNAME( 0x10, 0x10, "Character Display Test" ) PORT_DIPLOCATION("SWA:5") PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SWA:6") + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SWA:6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPLOCATION("SWA:7") + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPLOCATION("SWA:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPLOCATION("SWA:8") + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPLOCATION("SWA:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) diff --git a/src/mame/drivers/nbmj9195.cpp b/src/mame/drivers/nbmj9195.cpp index 06eddd16b8c..c0874236844 100644 --- a/src/mame/drivers/nbmj9195.cpp +++ b/src/mame/drivers/nbmj9195.cpp @@ -817,53 +817,53 @@ static INPUT_PORTS_START( patimono ) // Interesting note - manual states switch A:8 is always off/unused PORT_START("DSWA") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("DSWA:1,2") - PORT_DIPSETTING( 0x03, "1" ) - PORT_DIPSETTING( 0x02, "2" ) - PORT_DIPSETTING( 0x01, "3" ) - PORT_DIPSETTING( 0x00, "4" ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DSWA:3") + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("DSWA:1,2") + PORT_DIPSETTING( 0x03, "1" ) + PORT_DIPSETTING( 0x02, "2" ) + PORT_DIPSETTING( 0x01, "3" ) + PORT_DIPSETTING( 0x00, "4" ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DSWA:3") PORT_DIPSETTING( 0x04, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("DSWA:4") + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("DSWA:4") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "Music" ) PORT_DIPLOCATION("DSWA:5") + PORT_DIPNAME( 0x10, 0x10, "Music" ) PORT_DIPLOCATION("DSWA:5") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("DSWA:6") + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("DSWA:6") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, "Character Display Test" ) PORT_DIPLOCATION("DSWA:7") + PORT_DIPNAME( 0x40, 0x40, "Character Display Test" ) PORT_DIPLOCATION("DSWA:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "Graphic ROM Test" ) PORT_DIPLOCATION("DSWA:8") + PORT_DIPNAME( 0x80, 0x80, "Graphic ROM Test" ) PORT_DIPLOCATION("DSWA:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("DSWB") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:1") + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:1") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:2") + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:3") + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:3") PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:4") + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:4") PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:5") + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:5") PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:6") + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:7") + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:8") + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) diff --git a/src/mame/drivers/ohmygod.cpp b/src/mame/drivers/ohmygod.cpp index a77393d241a..19432ad7651 100644 --- a/src/mame/drivers/ohmygod.cpp +++ b/src/mame/drivers/ohmygod.cpp @@ -300,7 +300,7 @@ GFXDECODE_END void ohmygod_state::machine_start() { membank("okibank")->configure_entries(0, 16, memregion("oki")->base(), 0x20000); - + save_item(NAME(m_spritebank)); save_item(NAME(m_scrollx)); save_item(NAME(m_scrolly)); diff --git a/src/mame/drivers/poisk1.cpp b/src/mame/drivers/poisk1.cpp index 85f3c024706..8e7408060f1 100644 --- a/src/mame/drivers/poisk1.cpp +++ b/src/mame/drivers/poisk1.cpp @@ -644,7 +644,7 @@ static MACHINE_CONFIG_START( poisk1, p1_state ) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) MCFG_SOFTWARE_LIST_ADD("flop_list","poisk1_flop") -// MCFG_SOFTWARE_LIST_ADD("cass_list","poisk1_cass") +// MCFG_SOFTWARE_LIST_ADD("cass_list","poisk1_cass") MCFG_SPEAKER_STANDARD_MONO( "mono" ) MCFG_SOUND_ADD( "speaker", SPEAKER_SOUND, 0 ) diff --git a/src/mame/drivers/rainbow.cpp b/src/mame/drivers/rainbow.cpp index c9bbafeea8b..de3c7e9ea08 100644 --- a/src/mame/drivers/rainbow.cpp +++ b/src/mame/drivers/rainbow.cpp @@ -36,11 +36,11 @@ NVRAM files from -A and -B machines are not interchangeable. If problems arise, CPM 2.1 / DOS2.11 / DOS 3.x and UCSD systems (fort_sys, pas_sys) + diag disks boot. It is possible to boot DOS 3.10 from floppy A: and later use a hard disk attached to E:. -NB.: a single hard disk (5 - 67 MB, 512 byte sectors) may be attached before startup. It should remain there +NB.: a single hard disk (5 - 67 MB, 512 byte sectors) may be attached before startup. It should remain there until shutdown. "Hot swapping" wasn't possible on the original system (our GUI just doesn't forbid it). To create a RD50/ST506 compatible image (153 cylinders, 4 heads, 16 sectors, standard 512 byte sectors) enter ->chdman64 createhd - c none - chs 153, 4, 16 - ss 512 - o RD50_ST506.chd +>chdman64 createhd - c none - chs 153, 4, 16 - ss 512 - o RD50_ST506.chd NOTE: use -c none parameter for no compression. No more than 8 heads or 1024 cylinders. Some BUGS remain: BIOS autoboot doesnt work at all. It is not possible to boot from a properly formatted @@ -58,7 +58,7 @@ CURRENTY UNEMULATED (b1) LOOPBACK circuit not emulated, NMI from RAM card also unemulated (NMI vector 02). The former is used in startup tests, the latter seems less relevant (must use menu self test "S" - or memory diagnostic test. TODO: mem.test causes a CPU crash when reaching higher RAM regions. + or memory diagnostic test. TODO: mem.test causes a CPU crash when reaching higher RAM regions. (b2) system interaction tests HALT Z80 CPU at location $0211 (forever). Boot the RX50 diag.disk to see what happens (key 3 - individual tests, then 12 - system interaction). Uses LOOPBACK too? @@ -84,7 +84,7 @@ SH10 BDL REQ (L) -> Pin 1 (A0) BUNDLE OPTION wishes to use shared memory HARDWARE UPGRADES WORTH EMULATING (should be implemented as SLOT DEVICES): * Color graphics option (uses NEC upd7220 GDC). REFERENCE: Programmer's Reference: AA-AE36A-TV. -Either 240 X 380 x 16 or 240 x 800 x 4 colors (out of 4096). 8 x 64 K video RAM. +Either 240 X 380 x 16 or 240 x 800 x 4 colors (out of 4096). 8 x 64 K video RAM. On a 100-A, pallette limited to 4 shades (LSB 2 bits; applies to medium resolution mode 240 X 380 pixels only). Graphics output independent from monochrome output. Single and dual monitor configurations possible. @@ -242,10 +242,10 @@ W17 pulls J1 serial port pin 1 to GND when set (chassis to logical GND). #define RTC_BASE 0xFC000 // Do not pretend to emulate newer RAM board; stick with the old one: -// (only affects presence bit in 'system_parameter_r') +// (only affects presence bit in 'system_parameter_r') #define OLD_RAM_BOARD_PRESENT -#ifdef ASSUME_MODEL_A_HARDWARE +#ifdef ASSUME_MODEL_A_HARDWARE // Define standard and maximum RAM sizes (A model): #define MOTHERBOARD_RAM 0x0ffff // 64 K base RAM (100-A) #define END_OF_RAM 0xcffff // Very last byte (theretical; on 100-A) DO NOT CHANGE. @@ -268,8 +268,8 @@ W17 pulls J1 serial port pin 1 to GND when set (chassis to logical GND). // DEC says that MHFU is also re-enabled 'automatically after STI' (when under BIOS control?) // Schematics show "VERT FREQ INT" (= DC012 output, pin 2) and MHFU ENBL L are evaluated, -// as well as the power good signal from the PSU (AC_OK). MS_TO_POWER_GOOD is a guess: -#define MS_TO_POWER_GOOD 350 +// as well as the power good signal from the PSU (AC_OK). MS_TO_POWER_GOOD is a guess: +#define MS_TO_POWER_GOOD 350 // Reset duration of 108 ms from documentation - #define RESET_DURATION_MS 108 @@ -290,13 +290,13 @@ W17 pulls J1 serial port pin 1 to GND when set (chassis to logical GND). #include "machine/wd_fdc.h" #include "formats/rx50_dsk.h" -#include "formats/pc_dsk.h" // PC Formats +#include "formats/pc_dsk.h" // PC Formats #include "imagedev/flopdrv.h" #include "imagedev/harddriv.h" #include "machine/wd2010.h" -#include "machine/z80dart.h" +#include "machine/z80dart.h" #include "bus/rs232/rs232.h" #include "imagedev/bitbngr.h" #include "machine/com8116.h" @@ -422,7 +422,7 @@ public: DECLARE_WRITE8_MEMBER(printer_bitrate_w); DECLARE_WRITE_LINE_MEMBER( com8116_a_fr_w ); DECLARE_WRITE_LINE_MEMBER( com8116_a_ft_w ); - + UINT32 screen_update_rainbow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vblank_irq); IRQ_CALLBACK_MEMBER(irq_callback); @@ -485,7 +485,7 @@ private: void lower_8088_irq(int ref); void update_mpsc_irq(); - int m_mpsc_irq; + int m_mpsc_irq; void update_8088_irqs(); void update_bundle_irq(); // RD51 or COMM.OPTION! @@ -552,7 +552,7 @@ FLOPPY_FORMATS_END static SLOT_INTERFACE_START(rainbow_floppies) SLOT_INTERFACE("525qd0", FLOPPY_525_QD) // QD means 80 tracks with DD data rate (single or double sided). SLOT_INTERFACE("525qd1", FLOPPY_525_QD) -SLOT_INTERFACE("525dd", FLOPPY_525_DD) // mimic a 5.25" PC (40 track) drive. Requires IDrive5.SYS. +SLOT_INTERFACE("525dd", FLOPPY_525_DD) // mimic a 5.25" PC (40 track) drive. Requires IDrive5.SYS. SLOT_INTERFACE("35dd", FLOPPY_35_DD) // mimic 3.5" PC drive (720K, double density). Use Impdrv3.SYS. SLOT_INTERFACE_END @@ -560,8 +560,8 @@ void rainbow_state::machine_start() { m_POWER_GOOD = false; // Simulate AC_OK signal from power supply. cmd_timer = timer_alloc(0); - cmd_timer->adjust(attotime::from_msec(MS_TO_POWER_GOOD)); - + cmd_timer->adjust(attotime::from_msec(MS_TO_POWER_GOOD)); + MOTOR_DISABLE_counter = 2; // soon resets drv.LEDs m_SCREEN_BLANK = false; @@ -585,7 +585,7 @@ void rainbow_state::machine_start() rom[0xf4000 + 0x0303] = 0x00; // disable CRC check rom[0xf4000 + 0x135e] = 0x00; // FLOPPY / RX-50 WORKAROUND: in case of Z80 RESPONSE FAILURE ($80 bit set in AL), do not block floppy access. - rom[0xf4000 + 0x198F] = 0xeb; // cond.JMP to uncond.JMP (disables error message 60...) + rom[0xf4000 + 0x198F] = 0xeb; // cond.JMP to uncond.JMP (disables error message 60...) } #endif } @@ -719,7 +719,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START(rainbowz80_io, AS_IO, 8, rainbow_state) ADDRESS_MAP_UNMAP_HIGH -ADDRESS_MAP_GLOBAL_MASK(0xff) +ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x00) AM_READWRITE(z80_latch_r, z80_latch_w) AM_RANGE(0x20, 0x20) AM_READWRITE(z80_generalstat_r, z80_diskdiag_read_w) // read to port 0x20 used by MS-DOS 2.x diskette loader. AM_RANGE(0x21, 0x21) AM_READWRITE(z80_generalstat_r, z80_diskdiag_write_w) @@ -836,31 +836,31 @@ void rainbow_state::machine_reset() printf("\nWARNING: 896 K is not a valid memory configuration on Rainbow 100 A!\n"); } -// check = (unmap_start >> 16)-1; // guess. -// NVRAM_LOCATION = nv[0xed084]; // location not verified yet. DMT RAM check tests offset $84 ! +// check = (unmap_start >> 16)-1; // guess. +// NVRAM_LOCATION = nv[0xed084]; // location not verified yet. DMT RAM check tests offset $84 ! #else printf("\n*** RAINBOW B MODEL ASSUMED (128 - 896 K RAM)\n"); if (unmap_start < 0x20000) { - unmap_start = 0x20000; // 128 K minimum + unmap_start = 0x20000; // 128 K minimum printf("\nWARNING: 64 K is not a valid memory size on Rainbow 100-B!\n"); } check = (unmap_start >> 16) - 2; - NVRAM_LOCATION = nv[0xed0db]; + NVRAM_LOCATION = nv[0xed0db]; #endif if (check != NVRAM_LOCATION) printf("\nNOTE: RAM configuration does not match NVRAM.\nUNMAP_START = %05x NVRAM VALUE = %02x SHOULD BE: %02x\n", unmap_start, NVRAM_LOCATION, check); if(END_OF_RAM > unmap_start) program.unmap_readwrite(unmap_start, END_OF_RAM); - - m_crtc->MHFU(MHFU_RESET_and_DISABLE); + + m_crtc->MHFU(MHFU_RESET_and_DISABLE); #ifdef RTC_ENABLED // *********************************** / DS1315 'PHANTOM CLOCK' IMPLEMENTATION FOR 'DEC-100-B' *************************************** // No address space needed ( -> IRQs must be disabled to block ROM accesses during reads ). - program.install_read_handler(RTC_BASE, RTC_BASE + 0x2104, read8_delegate(FUNC(rainbow_state::rtc_r), this)); + program.install_read_handler(RTC_BASE, RTC_BASE + 0x2104, read8_delegate(FUNC(rainbow_state::rtc_r), this)); // *********************************** / DS1315 'PHANTOM CLOCK' IMPLEMENTATION FOR 'DEC-100-B' *************************************** #endif @@ -908,7 +908,7 @@ void rainbow_state::machine_reset() m_z80->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); m_z80_halted = true; - m_zflip = true; // ZRESET high on startup + m_zflip = true; // ZRESET high on startup m_diagnostic = 0; // DIAGNOSTIC_R/W registers (shouldn't it be 1?) INTZ80 = false; @@ -1022,7 +1022,7 @@ void rainbow_state::update_mpsc_irq() else raise_8088_irq(IRQ_COMM_PTR_INTR_L); - m_mpsc->m1_r(); // interrupt acknowledge + m_mpsc->m1_r(); // interrupt acknowledge } WRITE_LINE_MEMBER(rainbow_state::mpsc_irq) @@ -1031,18 +1031,18 @@ WRITE_LINE_MEMBER(rainbow_state::mpsc_irq) update_mpsc_irq(); } -// PORT 0x0e : Printer bit rates +// PORT 0x0e : Printer bit rates WRITE8_MEMBER(rainbow_state::printer_bitrate_w) -{ +{ printf("\nPRINTER bitrate = %02x HEX\n",data & 7); // "bit 3 controls the communications port clock (RxC,TxC). External clock when 1, internal when 0" - printf(" - CLOCK BIT: %02x", data & 8); + printf(" - CLOCK BIT: %02x", data & 8); } // PORT 0x06 : Communication bit rates (see page 21 of PC 100 SPEC) WRITE8_MEMBER(rainbow_state::comm_bitrate_w) -{ +{ m_dbrg->str_w(data & 0x0f); // PDF is wrong, low nibble is RECEIVE clock (verified in SETUP). printf("\nRECEIVE bitrate = %02x HEX\n",data & 0x0f); @@ -1126,9 +1126,9 @@ WRITE8_MEMBER(rainbow_state::share_z80_w) // DRIVERS: (a) DOS and CP/M binaries plus source from DEC employee (rbclik); Reads & displays times. Y2K READY! // (b) Suitable Solutions ClikClok distribution disk; Uses $FE000 and up. 2 digit year. Needed to set time & date. -// -// TODO: obtain hardware / check address decoders. -// RTC accesses here were derived from Vincent Esser's published source. +// +// TODO: obtain hardware / check address decoders. +// RTC accesses here were derived from Vincent Esser's published source. READ8_MEMBER(rainbow_state::rtc_r) { if((m_inp11->read() == 0x01)) // if enabled... @@ -1136,34 +1136,34 @@ READ8_MEMBER(rainbow_state::rtc_r) switch (offset) { // Transfer data to DS1315 (data = offset): - case 0x0000: // RTC_WRITE_DATA_0 0xFC000 + case 0x0000: // RTC_WRITE_DATA_0 0xFC000 case 0x2000: // RTC_WRITE_DATA_0 0xFE000 (MIRROR) - case 0x0001: // RTC_WRITE_DATA_1 0xFC001 + case 0x0001: // RTC_WRITE_DATA_1 0xFC001 case 0x2001: // RTC_WRITE_DATA_1 0xFE001 (MIRROR) - m_rtc->write_data(space, offset & 0x01); + m_rtc->write_data(space, offset & 0x01); break; // Read actual time/date from ClikClok: case 0x0004: // 0xFC004 case 0x2004: // 0xFE004 (MIRROR) - if (m_rtc->chip_enable()) - return (m_rtc->read_data(space, 0) & 0x01); + if (m_rtc->chip_enable()) + return (m_rtc->read_data(space, 0) & 0x01); - // (RTC ACTIVATION) READ MAGIC PATTERN 0 - case 0x0100: // 0xFC100 + // (RTC ACTIVATION) READ MAGIC PATTERN 0 + case 0x0100: // 0xFC100 case 0x2100: // 0xFE100 (MIRROR) - m_rtc->read_0(space, 0); + m_rtc->read_0(space, 0); break; - // (RTC ACTIVATION) READ MAGIC PATTERN 1 - case 0x0101: // 0xFC101 + // (RTC ACTIVATION) READ MAGIC PATTERN 1 + case 0x0101: // 0xFC101 case 0x2101: // 0xFE101 (MIRROR) - m_rtc->read_1(space, 0); + m_rtc->read_1(space, 0); break; // RESET - case 0x0104: // 0xFC104 + case 0x0104: // 0xFC104 case 0x2104: // 0xFE104 (MIRROR) m_rtc->chip_reset(); break; @@ -1171,7 +1171,7 @@ READ8_MEMBER(rainbow_state::rtc_r) } UINT8 *rom = memregion("maincpu")->base(); - return rom[RTC_BASE + offset]; // Return ROM to prevent crashes + return rom[RTC_BASE + offset]; // Return ROM to prevent crashes } // ------------------------/ ClikClok (for model B; DS1315) --------------------------------- @@ -1185,8 +1185,8 @@ static const int SECTOR_SIZES[4] = { 256, 512, 1024, 128 }; void rainbow_state::hdc_reset() { -// logerror(">> HARD DISC CONTROLLER RESET <<\n"); - m_hdc->reset(); +// logerror(">> HARD DISC CONTROLLER RESET <<\n"); + m_hdc->reset(); m_bdl_irq = 0; update_bundle_irq(); // reset INTRQ @@ -1260,7 +1260,7 @@ static UINT32 get_and_print_lbasector(device_t *device, hard_disk_info *info, UI lbasector *= info->sectors; // LBA : ( x 16 ) lbasector += (sector_number - 1); // + (sector number - 1) -// device->logerror(" CYLINDER %u - HEAD %u - SECTOR NUMBER %u (LBA-SECTOR %u) ", cylinder, head, sector_number, lbasector); +// device->logerror(" CYLINDER %u - HEAD %u - SECTOR NUMBER %u (LBA-SECTOR %u) ", cylinder, head, sector_number, lbasector); return lbasector; } @@ -1279,7 +1279,7 @@ WRITE_LINE_MEMBER(rainbow_state::hdc_read_sector) { read_status = 2; -// logerror("\nTRYING TO READ"); +// logerror("\nTRYING TO READ"); output().set_value("led1", 0); int hi = (m_hdc->read(generic_space(), 0x05)) & 0x07; @@ -1310,7 +1310,7 @@ WRITE_LINE_MEMBER(rainbow_state::hdc_read_sector) if (hard_disk_read(local_hard_disk, lbasector, m_hdc_buffer)) // accepts LBA sector (UINT32) ! { read_status = 0; -// logerror("...success!\n"); +// logerror("...success!\n"); } } } @@ -1401,7 +1401,7 @@ int rainbow_state::do_write_sector() if ((info = hard_disk_get_info(local_hard_disk))) { feedback = 10; -// logerror("\n* TRYING TO WRITE * "); +// logerror("\n* TRYING TO WRITE * "); output().set_value("led1", 1); // OFF UINT8 SDH = (m_hdc->read(generic_space(), 0x06)); @@ -1483,7 +1483,7 @@ READ8_MEMBER(rainbow_state::hd_status_68_r) int my_offset = 0x07; int stat = m_hdc->read(space, my_offset); -// logerror("(x68) WD1010 register %04x (STATUS) read, result : %04x\n", my_offset, stat); +// logerror("(x68) WD1010 register %04x (STATUS) read, result : %04x\n", my_offset, stat); // NOTE: SEEK COMPLETE IS CURRENTLY HARD WIRED / NOT FULLY EMULATED - // Bit 4 : SEEK COMPLETE: This status bit indicates that the disk drive positioned the R/W heads over the desired track on the disk surface. @@ -1546,7 +1546,7 @@ WRITE8_MEMBER(rainbow_state::hd_status_68_w) // 1 : see @ 088D after 'READ_SECTOR_OK' if (data & 0x01) { -// logerror(">> HARD DISC * SET BUFFER READY * <<\n"); +// logerror(">> HARD DISC * SET BUFFER READY * <<\n"); output().set_value("led1", 0); // 1 = OFF (One of the CPU LEDs as DRIVE LED) = HARD DISK ACTIVITY = MOTOR_DISABLE_counter = 20; @@ -1585,7 +1585,7 @@ positioned over cylinder 0 (the data track furthest away from the spindle). READ8_MEMBER(rainbow_state::hd_status_69_r) { int HS = m_hdc->read(space, 0x06) & (1 + 2 + 4); // SDH bits 0-2 = HEAD # -// logerror("(x69 READ) %i = HEAD SELECT WD1010\n", HS); +// logerror("(x69 READ) %i = HEAD SELECT WD1010\n", HS); UINT8 data = (HS << 1); @@ -1594,7 +1594,7 @@ READ8_MEMBER(rainbow_state::hd_status_69_r) int DRV = ((m_hdc->read(space, 0x06) >> 3) & 0x01); // 0x03 gives error R6 with DIAG.DISK if (DRV == 0) { -// logerror("(x69 READ) %i = _DRIVE # 0_ SELECT! \n", DRV); +// logerror("(x69 READ) %i = _DRIVE # 0_ SELECT! \n", DRV); data |= 1; } @@ -1607,7 +1607,7 @@ READ8_MEMBER(rainbow_state::hd_status_69_r) if (m_hdc_drive_ready) data |= 64; - m_hdc_track0 = false; // Fake TRACK 0 signal (normally FROM DRIVE) + m_hdc_track0 = false; // Fake TRACK 0 signal (normally FROM DRIVE) int stat1 = m_hdc->read(space, 0x04); // CYL LO int stat2 = m_hdc->read(space, 0x05); // CYL HI @@ -1617,7 +1617,7 @@ READ8_MEMBER(rainbow_state::hd_status_69_r) if (m_hdc_track0) { data |= 128; -// logerror("(x69 READ) TRACK 00 detected\n"); +// logerror("(x69 READ) TRACK 00 detected\n"); } return data; @@ -1672,7 +1672,7 @@ WRITE_LINE_MEMBER(rainbow_state::hdc_bdrq) { static int old_state; -// logerror("BDRQ - BUFFER DATA REQUEST OBTAINED: %u\n", state); +// logerror("BDRQ - BUFFER DATA REQUEST OBTAINED: %u\n", state); if ((state == 1) && (old_state == 0)) { hdc_buffer_counter_reset(); @@ -1725,35 +1725,35 @@ READ8_MEMBER(rainbow_state::system_parameter_r) return (((m_inp5->read() == 1) ? 0 : 1) | ((m_inp6->read() == 1) ? 0 : 2) | ((m_inp7->read() == 1) ? 0 : 4) | -#ifdef OLD_RAM_BOARD_PRESENT - ((m_inp8->read() > MOTHERBOARD_RAM) ? 0 : 8) | +#ifdef OLD_RAM_BOARD_PRESENT + ((m_inp8->read() > MOTHERBOARD_RAM) ? 0 : 8) | #else 8 | #endif - 16 | 32 | 64 | 128 // to be verified. + 16 | 32 | 64 | 128 // to be verified. ); } -// [02] COMMUNICATIONS STATUS REGISTER - PAGE 154 (**** READ **** ) -// Used to read status of SERIAL port, IRQ line of each CPU, and MHFU logic enable signal. +// [02] COMMUNICATIONS STATUS REGISTER - PAGE 154 (**** READ **** ) +// Used to read status of SERIAL port, IRQ line of each CPU, and MHFU logic enable signal. // ******* TODO: 5 status bits * MISSING * ******************************************************** // 0 COMM RI (reflects status of RI line at COMM port) // 1 COMM SI / SCF(reflects status of speed indicator line or -// the secondary receive line signal detect at COMM port) +// the secondary receive line signal detect at COMM port) // 2 COMM DSR (reflects status of DSR at COMM) // 3 COMM CTS (reflects status of CTS at COMM) // 4 COMM RLSD (receive line signal detect at COMM) READ8_MEMBER(rainbow_state::comm_control_r) { - bool is_mhfu_enabled = false; - if (m_POWER_GOOD) - is_mhfu_enabled = m_crtc->MHFU(MHFU_IS_ENABLED); - - return ( - (is_mhfu_enabled ? 0x00 : 0x20) | // (L) status of MHFU flag => bit pos.5 - ((INT88) ? 0x00 : 0x40) | // (L) - ((INTZ80) ? 0x00 : 0x80) // (L) + bool is_mhfu_enabled = false; + if (m_POWER_GOOD) + is_mhfu_enabled = m_crtc->MHFU(MHFU_IS_ENABLED); + + return ( + (is_mhfu_enabled ? 0x00 : 0x20) | // (L) status of MHFU flag => bit pos.5 + ((INT88) ? 0x00 : 0x40) | // (L) + ((INTZ80) ? 0x00 : 0x80) // (L) ); } @@ -1763,7 +1763,7 @@ READ8_MEMBER(rainbow_state::comm_control_r) // 0 COMM SPD SEL H (controls speed select line of COMM port) // 1 COMM SRTS H (controls secondary request to send line of COMM) // 2 COMM DTR L (controls terminal ready line of COMM) -// 3 COMM RTS (controls request to send line of COMM) +// 3 COMM RTS (controls request to send line of COMM) WRITE8_MEMBER(rainbow_state::comm_control_w) { printf("%02x to COMM.CONTROL REGISTER ", data); @@ -1894,7 +1894,7 @@ READ8_MEMBER(rainbow_state::z80_generalstat_r) if (!m_floppy->ready_r()) // weird (see wd_fdc) fdc_ready = 1; - if ((fdc_ready) && (m_floppy->wpt_r() != 1) && m_POWER_GOOD) + if ((fdc_ready) && (m_floppy->wpt_r() != 1) && m_POWER_GOOD) fdc_write_gate = 1; // * FAKE * WRITE GATE ! // "valid only when drive is selected" ! @@ -1922,7 +1922,7 @@ READ8_MEMBER(rainbow_state::z80_generalstat_r) READ8_MEMBER(rainbow_state::z80_diskstatus_r) { int track = 0; - int data = m_z80_diskcontrol & (255 - 0x80 - 0x40 - 0x20 - 4); + int data = m_z80_diskcontrol & (255 - 0x80 - 0x40 - 0x20 - 4); // D7: DRQ: reflects status of DATA REQUEST signal from FDC. // '1' indicates that FDC has read data OR requires new write data. @@ -1938,7 +1938,7 @@ READ8_MEMBER(rainbow_state::z80_diskstatus_r) // D5: SIDE 0 * HIGH ACTIVE *: status of side select signal at J2 + J3 of RX50 controller. // For 1 sided drives, this bit will always read low (0). if (m_floppy) - data |= m_floppy->ss_r() ? 0x20 : 0x00; + data |= m_floppy->ss_r() ? 0x20 : 0x00; // *LOW ACTIVE * // D4: MOTOR 1 ON L: 0 = indicates MOTOR 1 ON bit is set in drive control reg. @@ -1955,7 +1955,7 @@ READ8_MEMBER(rainbow_state::z80_diskstatus_r) // D2: TG43 * LOW ACTIVE * : 0 = INDICATES TRACK > 43 SIGNAL FROM FDC TO DISK DRIVE. // (asserted when writing data to tracks 44 through 79) - data |= (track > 43) ? 0x00 : 0x04; // ! LOW ACTIVE ! + data |= (track > 43) ? 0x00 : 0x04; // ! LOW ACTIVE ! // D1: DS1 H: reflect status of bits 0 and 1 from disk.control reg. // D0: DS0 H: " @@ -2090,14 +2090,14 @@ READ8_MEMBER(rainbow_state::read_video_ram_r) // CPU acknowledge of VBL IRQ resets counter IRQ_CALLBACK_MEMBER(rainbow_state::irq_callback) -{ - int intnum = -1; +{ + int intnum = -1; for (int i = IRQ_8088_VBL; i >= 0; i--) { if (m_irq_mask & (1 << i)) { - if (i == IRQ_8088_VBL) // If VBL IRQ acknowledged... - m_crtc->MHFU(MHFU_RESET); // ...reset counter (also: DC012_W) + if (i == IRQ_8088_VBL) // If VBL IRQ acknowledged... + m_crtc->MHFU(MHFU_RESET); // ...reset counter (also: DC012_W) intnum = vectors[i] | m_irq_high; break; @@ -2111,7 +2111,7 @@ INTERRUPT_GEN_MEMBER(rainbow_state::vblank_irq) raise_8088_irq(IRQ_8088_VBL); m_crtc->notify_vblank(true); - if (m_POWER_GOOD && m_crtc->MHFU(MHFU_IS_ENABLED)) // If enabled... + if (m_POWER_GOOD && m_crtc->MHFU(MHFU_IS_ENABLED)) // If enabled... { if (m_crtc->MHFU(MHFU_VALUE) > 7) // + more than (7 * 16.666) msecs gone (108 ms would be by the book) { @@ -2130,7 +2130,7 @@ WRITE_LINE_MEMBER(rainbow_state::clear_video_interrupt) m_crtc->notify_vblank(false); } -// Reflects bits from 'diagnostic_w' (1:1), except test jumpers +// Reflects bits from 'diagnostic_w' (1:1), except test jumpers READ8_MEMBER(rainbow_state::diagnostic_r) // 8088 (port 0A READ). Fig.4-29 + table 4-15 { return ((m_diagnostic & (0xf1)) | @@ -2144,7 +2144,7 @@ WRITE8_MEMBER(rainbow_state::diagnostic_w) // 8088 (port 0A WRITTEN). Fig.4-28 + { // printf("%02x to diag port (PC=%x)\n", data, space.device().safe_pc()); m_SCREEN_BLANK = (data & 2) ? false : true; - + // ZRESET from 8088 to Z80 - - HIGH at powerup! if (!(data & 1)) { @@ -2173,15 +2173,15 @@ WRITE8_MEMBER(rainbow_state::diagnostic_w) // 8088 (port 0A WRITTEN). Fig.4-28 + m_fdc->reset(); // See formatter description p.197 or 5-13 } - if (data & 0x04) // GRF_VID_SEL + if (data & 0x04) // GRF_VID_SEL printf("\n*** UNEMULATED GRAPHICS [on GRAPHICS OPTION]. (bit 2 in diagnostic_w) = %i (0 = system module; else graphics option) ",data & 4); // BIT 3: PARITY TEST (1 = enables parity test on memory option board). - // FIXME: parity test = NMI? When should NMI fire? Whole bank tested? + // FIXME: parity test = NMI? When should NMI fire? Whole bank tested? if (data & 0x08) printf("\n*** UNEMULATED PARITY TEST [on RAM EXTENSION] - (bit 3 in diagnostic_w) "); - // m_i8088->set_input_line_and_vector(INPUT_LINE_NMI, ASSERT_LINE, 0x02); - + // m_i8088->set_input_line_and_vector(INPUT_LINE_NMI, ASSERT_LINE, 0x02); + // MISSING BITS (* not vital for normal operation, see diag.disk) - // * BIT 4: DIAG LOOPBACK (0 at power-up; 1 directs RX50 and DC12 output to printer port) // * BIT 5: PORT LOOPBACK (1 enables loopback for COMM, PRINTER, KEYBOARD ports) @@ -2277,7 +2277,7 @@ WRITE_LINE_MEMBER(rainbow_state::write_keyboard_clock) TIMER_DEVICE_CALLBACK_MEMBER(rainbow_state::motor_tick) { if (m_POWER_GOOD) - m_crtc->MHFU(MHFU_COUNT); // // Increment IF ENABLED and POWER_GOOD, return count + m_crtc->MHFU(MHFU_COUNT); // // Increment IF ENABLED and POWER_GOOD, return count m_hdc_index_latch = true; // HDC drive index signal (not working ?) @@ -2298,7 +2298,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(rainbow_state::motor_tick) // on 100-B, DTR from the keyboard 8051 controls bit 7 of IRQ vectors WRITE_LINE_MEMBER(rainbow_state::irq_hi_w) { -#ifdef ASSUME_MODEL_A_HARDWARE +#ifdef ASSUME_MODEL_A_HARDWARE m_irq_high = 0; #else m_irq_high = (state == ASSERT_LINE) ? 0x80 : 0; @@ -2316,7 +2316,7 @@ static const gfx_layout rainbow_charlayout = { 0, 1, 2, 3, 4, 5, 6, 7 }, /* y offsets */ { 15 * 8, 0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8, 8 * 8 }, - 8 * 16 /* every char takes 16 bytes */ + 8 * 16 /* every char takes 16 bytes */ }; static GFXDECODE_START(rainbow) @@ -2386,28 +2386,28 @@ MCFG_HARDDISK_ADD("harddisk1") MCFG_DS1315_ADD("rtc") // DS1315 (ClikClok for DEC-100 B) * OPTIONAL * -MCFG_DEVICE_ADD("com8116", COM8116, XTAL_5_0688MHz) // Baud rate generator +MCFG_DEVICE_ADD("com8116", COM8116, XTAL_5_0688MHz) // Baud rate generator MCFG_COM8116_FR_HANDLER(WRITELINE(rainbow_state, com8116_a_fr_w)) MCFG_COM8116_FT_HANDLER(WRITELINE(rainbow_state, com8116_a_ft_w)) -MCFG_UPD7201_ADD("upd7201", XTAL_2_5MHz, 0, 0, 0, 0) // 2.5 Mhz from schematics +MCFG_UPD7201_ADD("upd7201", XTAL_2_5MHz, 0, 0, 0, 0) // 2.5 Mhz from schematics MCFG_Z80DART_OUT_INT_CB(WRITELINE(rainbow_state, mpsc_irq)) -MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232_a", rs232_port_device, write_txd)) -MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232_a", rs232_port_device, write_dtr)) +MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232_a", rs232_port_device, write_txd)) +MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232_a", rs232_port_device, write_dtr)) MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232_a", rs232_port_device, write_rts)) -MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE("rs232_b", rs232_port_device, write_txd)) -MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE("rs232_b", rs232_port_device, write_dtr)) +MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE("rs232_b", rs232_port_device, write_txd)) +MCFG_Z80DART_OUT_DTRB_CB(DEVWRITELINE("rs232_b", rs232_port_device, write_dtr)) MCFG_Z80DART_OUT_RTSB_CB(DEVWRITELINE("rs232_b", rs232_port_device, write_rts)) MCFG_RS232_PORT_ADD("rs232_a", default_rs232_devices, nullptr) -MCFG_RS232_RXD_HANDLER(DEVWRITELINE("upd7201", upd7201_device, rxa_w)) -MCFG_RS232_CTS_HANDLER(DEVWRITELINE("upd7201", upd7201_device, ctsa_w)) -MCFG_RS232_DCD_HANDLER(DEVWRITELINE("upd7201", upd7201_device, dcda_w)) +MCFG_RS232_RXD_HANDLER(DEVWRITELINE("upd7201", upd7201_device, rxa_w)) +MCFG_RS232_CTS_HANDLER(DEVWRITELINE("upd7201", upd7201_device, ctsa_w)) +MCFG_RS232_DCD_HANDLER(DEVWRITELINE("upd7201", upd7201_device, dcda_w)) MCFG_RS232_PORT_ADD("rs232_b", default_rs232_devices, nullptr) -MCFG_RS232_RXD_HANDLER(DEVWRITELINE("upd7201", upd7201_device, rxb_w)) +MCFG_RS232_RXD_HANDLER(DEVWRITELINE("upd7201", upd7201_device, rxb_w)) MCFG_RS232_CTS_HANDLER(DEVWRITELINE("upd7201", upd7201_device, ctsb_w)) MCFG_RS232_DCD_HANDLER(DEVWRITELINE("upd7201", upd7201_device, dcdb_w)) diff --git a/src/mame/drivers/seibuspi.cpp b/src/mame/drivers/seibuspi.cpp index fac077ac3f9..262e549c51b 100644 --- a/src/mame/drivers/seibuspi.cpp +++ b/src/mame/drivers/seibuspi.cpp @@ -947,12 +947,12 @@ READ32_MEMBER(seibuspi_state::ejsakura_keyboard_r) { // coins/eeprom data UINT32 ret = m_special->read(); - + // multiplexed inputs for (int i = 0; i < 5; i++) if (m_ejsakura_input_port >> i & 1) ret &= m_key[i]->read(); - + return ret; } diff --git a/src/mame/drivers/seicupbl.cpp b/src/mame/drivers/seicupbl.cpp index 32d5bb4ebbe..27ed8f82f4e 100644 --- a/src/mame/drivers/seicupbl.cpp +++ b/src/mame/drivers/seicupbl.cpp @@ -2,15 +2,15 @@ // copyright-holders:Angelo Salese /*************************************************************************** - Seibu Cup Soccer bootlegs - - Splitted since it definitely doesn't use neither real COP nor CRTC - - - TODO: - - tilemap chip drawings might be merged between this and other - Seibu implementations. - + Seibu Cup Soccer bootlegs + + Splitted since it definitely doesn't use neither real COP nor CRTC + + + TODO: + - tilemap chip drawings might be merged between this and other + Seibu implementations. + ***************************************************************************/ @@ -55,9 +55,9 @@ public: required_device<generic_latch_8_device> m_soundlatch; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; - + tilemap_t *m_sc_layer[4]; - + // screen updates UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_WRITE8_MEMBER(okim_rombank_w); @@ -70,14 +70,14 @@ public: TILE_GET_INFO_MEMBER(get_sc1_tileinfo); TILE_GET_INFO_MEMBER(get_sc2_tileinfo); TILE_GET_INFO_MEMBER(get_sc3_tileinfo); - + protected: // driver_device overrides virtual void machine_start() override; virtual void machine_reset() override; virtual void video_start() override; - + private: void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect); }; @@ -281,7 +281,7 @@ UINT32 seicupbl_state::screen_update( screen_device &screen, bitmap_ind16 &bitma m_sc_layer[i]->set_scrollx(0, m_vregs[i*2+0] - 0x1f0); m_sc_layer[i]->set_scrolly(0, m_vregs[i*2+1]); } - + /*if (!(m_layer_disable&0x0001)) */m_sc_layer[0]->draw(screen, bitmap, cliprect, 0, 0); /*if (!(m_layer_disable&0x0002)) */m_sc_layer[1]->draw(screen, bitmap, cliprect, 0, 1); /*if (!(m_layer_disable&0x0004)) */m_sc_layer[2]->draw(screen, bitmap, cliprect, 0, 2); @@ -323,7 +323,7 @@ WRITE16_MEMBER(seicupbl_state::vram_sc3_w) } static ADDRESS_MAP_START( cupsocbl_mem, AS_PROGRAM, 16, seicupbl_state ) -// AM_IMPORT_FROM( legionna_cop_mem ) +// AM_IMPORT_FROM( legionna_cop_mem ) AM_RANGE(0x000000, 0x0fffff) AM_ROM AM_RANGE(0x100400, 0x1005ff) AM_DEVREADWRITE("seibucop_boot", seibu_cop_bootleg_device, copdxbl_0_r,copdxbl_0_w) AM_SHARE("cop_mcu_ram") AM_RANGE(0x100660, 0x10066f) AM_RAM AM_SHARE("vregs") @@ -570,7 +570,7 @@ static MACHINE_CONFIG_START( cupsocbl, seicupbl_state ) MCFG_PALETTE_ADD_INIT_BLACK("palette", 128*16) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) -// MCFG_VIDEO_START_OVERRIDE(seicupbl_state,cupsoc) +// MCFG_VIDEO_START_OVERRIDE(seicupbl_state,cupsoc) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/sliver.cpp b/src/mame/drivers/sliver.cpp index 5faa1adb0f4..0762736ac24 100644 --- a/src/mame/drivers/sliver.cpp +++ b/src/mame/drivers/sliver.cpp @@ -138,7 +138,7 @@ public: void sliver_state::machine_start() { membank("okibank")->configure_entries(0, 4, memregion("oki")->base() + 0x20000, 0x20000); - + save_item(NAME(m_io_offset)); save_item(NAME(m_io_reg)); save_item(NAME(m_fifo)); @@ -401,7 +401,7 @@ void sliver_state::video_start() save_item(NAME(m_jpeg2)); save_item(NAME(m_jpeg_x)); save_item(NAME(m_jpeg_y)); - + machine().save().register_postload(save_prepost_delegate(FUNC(sliver_state::postload), this)); } diff --git a/src/mame/drivers/sm7238.cpp b/src/mame/drivers/sm7238.cpp index 8d29c6baa3e..912a521d3ea 100644 --- a/src/mame/drivers/sm7238.cpp +++ b/src/mame/drivers/sm7238.cpp @@ -2,19 +2,19 @@ // copyright-holders:Sergey Svishchev /*************************************************************************** - SM 7238 (aka T3300) color/mono text terminal, compatible with DEC VT 240. - Graphics option adds Tek 401x and DEC ReGIS support on a 512x250 bitmap. + SM 7238 (aka T3300) color/mono text terminal, compatible with DEC VT 240. + Graphics option adds Tek 401x and DEC ReGIS support on a 512x250 bitmap. - Technical manual and schematics: http://doc.pdp-11.org.ru/Terminals/CM7238/ + Technical manual and schematics: http://doc.pdp-11.org.ru/Terminals/CM7238/ To do: - - handle more text_control_w bits - - more character attributes incl. double width and height, color - - 80/132 columns switching on the fly, reverse video + - handle more text_control_w bits + - more character attributes incl. double width and height, color + - 80/132 columns switching on the fly, reverse video - smooth scroll - - graphics option - - run vblank from timer output? - - document hardware and ROM variants, verify if pixel stretching is done + - graphics option + - run vblank from timer output? + - document hardware and ROM variants, verify if pixel stretching is done ****************************************************************************/ @@ -29,7 +29,7 @@ #include "machine/km035.h" #include "machine/nvram.h" -#define KSM_COLUMNS 80 // or 132 +#define KSM_COLUMNS 80 // or 132 #define KSM_TOTAL_HORZ KSM_COLUMNS*10 #define KSM_DISP_HORZ KSM_COLUMNS*8 @@ -133,7 +133,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sm7238_io, AS_IO, 8, sm7238_state ) ADDRESS_MAP_UNMAP_HIGH -// AM_RANGE (0x40, 0x4f) AM_RAM // LUT +// AM_RANGE (0x40, 0x4f) AM_RAM // LUT AM_RANGE (0xa0, 0xa0) AM_DEVREADWRITE("i8251line", i8251_device, data_r, data_w) AM_RANGE (0xa1, 0xa1) AM_DEVREADWRITE("i8251line", i8251_device, status_r, control_w) AM_RANGE (0xa4, 0xa4) AM_DEVREADWRITE("i8251kbd", i8251_device, data_r, data_w) @@ -177,7 +177,7 @@ WRITE8_MEMBER(sm7238_state::text_control_w) if (BIT((data ^ m_video.control), 0)) { m_video.stride = BIT(data, 0) ? 80 : 132; -// recompute_parameters(); +// recompute_parameters(); } m_video.control = data; @@ -295,7 +295,7 @@ void sm7238_state::recompute_parameters() int horiz_pix_total = m_video.stride * 8; visarea.set(0, horiz_pix_total - 1, 0, KSM_DISP_VERT - 1); - machine().first_screen()->configure(horiz_pix_total, KSM_DISP_VERT, visarea, + machine().first_screen()->configure(horiz_pix_total, KSM_DISP_VERT, visarea, HZ_TO_ATTOSECONDS((m_video.stride == 80) ? 60 : 57.1 )); } diff --git a/src/mame/drivers/sms.cpp b/src/mame/drivers/sms.cpp index 937b714c4dd..1e930dc1bb2 100644 --- a/src/mame/drivers/sms.cpp +++ b/src/mame/drivers/sms.cpp @@ -377,7 +377,7 @@ ADDRESS_MAP_END static INPUT_PORTS_START( sms ) PORT_START("PAUSE") PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME(DEF_STR(Pause)) PORT_CODE(KEYCODE_1) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START ) PORT_NAME(DEF_STR(Pause)) INPUT_PORTS_END static INPUT_PORTS_START( sg1000m3 ) diff --git a/src/mame/drivers/sun4.cpp b/src/mame/drivers/sun4.cpp index ecb44cc56f7..2fe04e67b6e 100644 --- a/src/mame/drivers/sun4.cpp +++ b/src/mame/drivers/sun4.cpp @@ -383,28 +383,28 @@ 20/06/2016 Much less skeletony. // sun4: 16 contexts, 4096 segments, each PMEG is 32 PTEs, each PTE is 8K - // VA lower 13 bits in page, next 5 bits select PTE in PMEG, next 12 bits select PMEG, top 2 must be 00 or 11. + // VA lower 13 bits in page, next 5 bits select PTE in PMEG, next 12 bits select PMEG, top 2 must be 00 or 11. 4/60 ROM notes: ffe809fc: call to print "Sizing Memory" to the UART - ffe80a70: call to "Setting up RAM for monitor" that goes wrong - ffe80210: testing memory - ffe80274: loop that goes wobbly and fails - ffe80dc4: switch off boot mode, MMU maps ROM to copy in RAM from here on - ffe82000: start of FORTH (?) interpreter once decompressed + ffe80a70: call to "Setting up RAM for monitor" that goes wrong + ffe80210: testing memory + ffe80274: loop that goes wobbly and fails + ffe80dc4: switch off boot mode, MMU maps ROM to copy in RAM from here on + ffe82000: start of FORTH (?) interpreter once decompressed text in decompressed area claims to be FORTH-83 FCode, but the opcodes do not match the documented OpenFirmware FCode ones at all. - 4/3xx ROM notes: - sun4: CPU LEDs to 00 (PC=ffe92398) => ........ - sun4: CPU LEDs to 01 (PC=ffe92450) => *....... - sun4: CPU LEDs to 02 (PC=ffe9246c) => .*...... - sun4: CPU LEDs to 03 (PC=ffe9aa54) => **...... - sun4: CPU LEDs to 04 (PC=ffe9aa54) => ..*..... - sun4: CPU LEDs to 05 (PC=ffe9aa54) => *.*..... - sun4: CPU LEDs to 06 (PC=ffe9aa54) => .**..... - sun4: CPU LEDs to 07 (PC=ffe9aa54) => ***..... + 4/3xx ROM notes: + sun4: CPU LEDs to 00 (PC=ffe92398) => ........ + sun4: CPU LEDs to 01 (PC=ffe92450) => *....... + sun4: CPU LEDs to 02 (PC=ffe9246c) => .*...... + sun4: CPU LEDs to 03 (PC=ffe9aa54) => **...... + sun4: CPU LEDs to 04 (PC=ffe9aa54) => ..*..... + sun4: CPU LEDs to 05 (PC=ffe9aa54) => *.*..... + sun4: CPU LEDs to 06 (PC=ffe9aa54) => .**..... + sun4: CPU LEDs to 07 (PC=ffe9aa54) => ***..... ****************************************************************************/ @@ -431,7 +431,7 @@ #include "debug/debugcmd.h" #include "debugger.h" -#define SUN4_LOG_FCODES (0) +#define SUN4_LOG_FCODES (0) #define TIMEKEEPER_TAG "timekpr" #define SCC1_TAG "scc1" @@ -439,56 +439,56 @@ #define KEYBOARD_TAG "keyboard" #define RS232A_TAG "rs232a" #define RS232B_TAG "rs232b" -#define FDC_TAG "fdc" +#define FDC_TAG "fdc" -#define ENA_NOTBOOT (0x80) -#define ENA_SDVMA (0x20) -#define ENA_CACHE (0x10) -#define ENA_RESET (0x04) -#define ENA_DIAG (0x01) +#define ENA_NOTBOOT (0x80) +#define ENA_SDVMA (0x20) +#define ENA_CACHE (0x10) +#define ENA_RESET (0x04) +#define ENA_DIAG (0x01) // page table entry constants -#define PM_VALID (0x80000000) // page is valid -#define PM_WRITEMASK (0x40000000) // writable? -#define PM_SYSMASK (0x20000000) // system use only? -#define PM_CACHE (0x10000000) // cachable? -#define PM_TYPEMASK (0x0c000000) // type mask -#define PM_ACCESSED (0x02000000) // accessed flag -#define PM_MODIFIED (0x01000000) // modified flag +#define PM_VALID (0x80000000) // page is valid +#define PM_WRITEMASK (0x40000000) // writable? +#define PM_SYSMASK (0x20000000) // system use only? +#define PM_CACHE (0x10000000) // cachable? +#define PM_TYPEMASK (0x0c000000) // type mask +#define PM_ACCESSED (0x02000000) // accessed flag +#define PM_MODIFIED (0x01000000) // modified flag -#define PAGE_SIZE (0x00000400) +#define PAGE_SIZE (0x00000400) // DMA controller constants -#define DMA_DEV_ID (0x80000000) -#define DMA_L (0x00008000) // use ILACC -#define DMA_TC (0x00004000) // terminal count -#define DMA_EN_CNT (0x00002000) // enable count -#define DMA_BYTE_ADDR (0x00001800) // next byte number to be accessed -#define DMA_BYTE_ADDR_SHIFT (11) -#define DMA_REQ_PEND (0x00000400) // request pending -#define DMA_EN_DMA (0x00000200) // enable DMA -#define DMA_WRITE (0x00000100) // DMA device->mem if 1, otherwise mem->device -#define DMA_RESET (0x00000080) // DMA hardware reset -#define DMA_DRAIN (0x00000040) // force remaining pack bytes to memory -#define DMA_FLUSH (0x00000020) // force PACK_CNT and ERR_PEND to 0 -#define DMA_INT_EN (0x00000010) // interrupt enable -#define DMA_PACK_CNT (0x0000000c) // number of bytes in pack register -#define DMA_PACK_CNT_SHIFT (2) -#define DMA_ERR_PEND (0x00000002) // error pending, set when memory exception occurs -#define DMA_INT_PEND (0x00000001) // interrupt pending, set when TC=1 -#define DMA_READ_ONLY (DMA_TC | DMA_BYTE_ADDR | DMA_REQ_PEND | DMA_PACK_CNT | DMA_ERR_PEND | DMA_INT_PEND) -#define DMA_WRITE_ONLY (DMA_FLUSH) -#define DMA_READ_WRITE (DMA_EN_CNT | DMA_EN_DMA | DMA_WRITE | DMA_RESET | DMA_INT_EN) -#define DMA_CTRL (0) -#define DMA_ADDR (1) -#define DMA_BYTE_COUNT (2) -#define DMA_XTAL (XTAL_25MHz) +#define DMA_DEV_ID (0x80000000) +#define DMA_L (0x00008000) // use ILACC +#define DMA_TC (0x00004000) // terminal count +#define DMA_EN_CNT (0x00002000) // enable count +#define DMA_BYTE_ADDR (0x00001800) // next byte number to be accessed +#define DMA_BYTE_ADDR_SHIFT (11) +#define DMA_REQ_PEND (0x00000400) // request pending +#define DMA_EN_DMA (0x00000200) // enable DMA +#define DMA_WRITE (0x00000100) // DMA device->mem if 1, otherwise mem->device +#define DMA_RESET (0x00000080) // DMA hardware reset +#define DMA_DRAIN (0x00000040) // force remaining pack bytes to memory +#define DMA_FLUSH (0x00000020) // force PACK_CNT and ERR_PEND to 0 +#define DMA_INT_EN (0x00000010) // interrupt enable +#define DMA_PACK_CNT (0x0000000c) // number of bytes in pack register +#define DMA_PACK_CNT_SHIFT (2) +#define DMA_ERR_PEND (0x00000002) // error pending, set when memory exception occurs +#define DMA_INT_PEND (0x00000001) // interrupt pending, set when TC=1 +#define DMA_READ_ONLY (DMA_TC | DMA_BYTE_ADDR | DMA_REQ_PEND | DMA_PACK_CNT | DMA_ERR_PEND | DMA_INT_PEND) +#define DMA_WRITE_ONLY (DMA_FLUSH) +#define DMA_READ_WRITE (DMA_EN_CNT | DMA_EN_DMA | DMA_WRITE | DMA_RESET | DMA_INT_EN) +#define DMA_CTRL (0) +#define DMA_ADDR (1) +#define DMA_BYTE_COUNT (2) +#define DMA_XTAL (XTAL_25MHz) namespace { const sparc_disassembler::asi_desc_map::value_type sun4_asi_desc[] = { - { 0x10, { nullptr, "Flush I-Cache (Segment)" } }, - { 0x11, { nullptr, "Flush I-Cache (Page)" } }, + { 0x10, { nullptr, "Flush I-Cache (Segment)" } }, + { 0x11, { nullptr, "Flush I-Cache (Page)" } }, { 0x02, { nullptr, "System Space" } }, { 0x12, { nullptr, "Flush I-Cache (Context)" } }, { 0x03, { nullptr, "Segment Map" } }, { 0x13, { nullptr, "Flush I-Cache (User)" } }, { 0x04, { nullptr, "Page Map" } }, { 0x14, { nullptr, "Flush D-Cache (Segment)" } }, @@ -621,9 +621,9 @@ private: UINT32 m_cachetags[0x4000]; UINT32 m_cachedata[0x4000]; UINT32 m_ram_size, m_ram_size_words; - UINT8 m_ctx_mask; // SS2 is sun4c but has 16 contexts; most have 8 - UINT8 m_pmeg_mask; // SS2 is sun4c but has 16384 PTEs; most have 8192 - UINT8 m_irq_reg; // IRQ control + UINT8 m_ctx_mask; // SS2 is sun4c but has 16 contexts; most have 8 + UINT8 m_pmeg_mask; // SS2 is sun4c but has 16384 PTEs; most have 8192 + UINT8 m_irq_reg; // IRQ control UINT8 m_scc1_int, m_scc2_int; UINT8 m_diag; int m_arch; @@ -694,7 +694,7 @@ UINT32 sun4_state::read_insn_data_4c(UINT8 asi, address_space &space, UINT32 off switch ((m_pagemap[entry] >> 26) & 3) { - case 0: // type 0 space + case 0: // type 0 space return m_type0space->read32(space, tmp, mem_mask); case 1: // type 1 space @@ -717,7 +717,7 @@ UINT32 sun4_state::read_insn_data_4c(UINT8 asi, address_space &space, UINT32 off { printf("sun4c: INVALID PTE entry %d %08x accessed! vaddr=%x PC=%x\n", entry, m_pagemap[entry], offset <<2, m_maincpu->pc()); //m_maincpu->trap(SPARC_DATA_ACCESS_EXCEPTION); - //m_buserr[0] = 0x88; // read, invalid PTE + //m_buserr[0] = 0x88; // read, invalid PTE //m_buserr[1] = offset<<2; } return 0; @@ -735,7 +735,7 @@ void sun4_state::write_insn_data_4c(UINT8 asi, address_space &space, UINT32 offs if ((!(m_pagemap[entry] & PM_WRITEMASK)) || ((m_pagemap[entry] & PM_SYSMASK) && !(asi & 1))) { printf("sun4c: write protect MMU error (PC=%x)\n", m_maincpu->pc()); - m_buserr[0] = 0x8040; // write, protection error + m_buserr[0] = 0x8040; // write, protection error m_buserr[1] = offset<<2; m_maincpu->set_input_line(SPARC_MAE, ASSERT_LINE); return; @@ -750,7 +750,7 @@ void sun4_state::write_insn_data_4c(UINT8 asi, address_space &space, UINT32 offs switch ((m_pagemap[entry] >> 26) & 3) { - case 0: // type 0 + case 0: // type 0 m_type0space->write32(space, tmp, data, mem_mask); return; @@ -767,7 +767,7 @@ void sun4_state::write_insn_data_4c(UINT8 asi, address_space &space, UINT32 offs { printf("sun4c: INVALID PTE entry %d %08x accessed! vaddr=%x PC=%x\n", entry, m_pagemap[entry], offset <<2, m_maincpu->pc()); //m_maincpu->trap(SPARC_DATA_ACCESS_EXCEPTION); - //m_buserr[0] = 0x8; // invalid PTE + //m_buserr[0] = 0x8; // invalid PTE //m_buserr[1] = offset<<2; } } @@ -790,7 +790,7 @@ READ32_MEMBER( sun4_state::sun4c_mmu_r ) switch (asi) { - case 2: // system space + case 2: // system space switch (offset >> 26) { case 3: // context reg @@ -804,7 +804,7 @@ READ32_MEMBER( sun4_state::sun4c_mmu_r ) printf("sun4c: read buserror, PC=%x (mask %08x)\n", m_maincpu->pc(), mem_mask); m_maincpu->set_input_line(SPARC_MAE, CLEAR_LINE); retval = m_buserr[offset & 0xf]; - m_buserr[offset & 0xf] = 0; // clear on reading + m_buserr[offset & 0xf] = 0; // clear on reading return retval; case 8: // (d-)cache tags @@ -815,7 +815,7 @@ READ32_MEMBER( sun4_state::sun4c_mmu_r ) //logerror("sun4c: read dcache data @ %x, PC = %x\n", offset, m_maincpu->pc()); return m_cachedata[offset&0x3fff]; - case 0xf: // UART bypass + case 0xf: // UART bypass //printf("read UART bypass @ %x mask %08x\n", offset<<2, mem_mask); switch (offset & 3) { @@ -830,7 +830,7 @@ READ32_MEMBER( sun4_state::sun4c_mmu_r ) return 0; } break; - case 3: // segment map + case 3: // segment map //printf("sun4: read segment map @ %x (ctx %d entry %d, mem_mask %08x, PC=%x)\n", offset << 2, m_context & m_ctx_mask, (offset>>16) & 0xfff, mem_mask, m_maincpu->pc()); if (mem_mask == 0xffff0000) { @@ -842,7 +842,7 @@ READ32_MEMBER( sun4_state::sun4c_mmu_r ) } else { - // printf("sun4: read segment map w/unk mask %08x\n", mem_mask); + // printf("sun4: read segment map w/unk mask %08x\n", mem_mask); } return 0x0; @@ -918,7 +918,7 @@ WRITE32_MEMBER( sun4_state::sun4c_mmu_w ) m_cachedata[offset&0x3fff] = data; return; - case 0xf: // UART bypass + case 0xf: // UART bypass //printf("%08x to UART bypass @ %x, mask %08x\n", data, offset<<2, mem_mask); switch (offset & 3) { @@ -942,16 +942,16 @@ WRITE32_MEMBER( sun4_state::sun4c_mmu_w ) else logerror("sun4c: writing segment map with unknown mask %08x, PC=%x\n", mem_mask, m_maincpu->pc()); //printf("sun4: %08x to segment map @ %x (ctx %d entry %d, mem_mask %08x, PC=%x)\n", segdata, offset << 2, m_context, (offset>>16) & 0xfff, mem_mask, m_maincpu->pc()); - m_segmap[m_context & m_ctx_mask][(offset>>16) & 0xfff] = segdata; // only 7 bits of the segment are necessary + m_segmap[m_context & m_ctx_mask][(offset>>16) & 0xfff] = segdata; // only 7 bits of the segment are necessary } return; case 4: // page map - page = (m_segmap[m_context & m_ctx_mask][(offset >> 16) & 0xfff] & m_pmeg_mask) << 6; // get the PMEG - page += (offset >> 10) & 0x3f; // add the offset + page = (m_segmap[m_context & m_ctx_mask][(offset >> 16) & 0xfff] & m_pmeg_mask) << 6; // get the PMEG + page += (offset >> 10) & 0x3f; // add the offset //printf("sun4: %08x to page map @ %x (entry %d, mem_mask %08x, PC=%x)\n", data, offset << 2, page, mem_mask, m_maincpu->pc()); COMBINE_DATA(&m_pagemap[page]); - m_pagemap[page] &= 0xff00ffff; // these 8 bits are cleared when written and tested as such + m_pagemap[page] &= 0xff00ffff; // these 8 bits are cleared when written and tested as such return; case 8: @@ -985,7 +985,7 @@ UINT32 sun4_state::read_insn_data(UINT8 asi, address_space &space, UINT32 offset switch ((m_pagemap[entry] >> 26) & 3) { - case 0: // type 0 space + case 0: // type 0 space return m_type0space->read32(space, tmp, mem_mask); case 1: // type 1 space @@ -1008,7 +1008,7 @@ UINT32 sun4_state::read_insn_data(UINT8 asi, address_space &space, UINT32 offset { printf("sun4: INVALID PTE entry %d %08x accessed! vaddr=%x PC=%x\n", entry, m_pagemap[entry], offset <<2, m_maincpu->pc()); //m_maincpu->trap(SPARC_DATA_ACCESS_EXCEPTION); - //m_buserr[0] = 0x88; // read, invalid PTE + //m_buserr[0] = 0x88; // read, invalid PTE //m_buserr[1] = offset<<2; } return 0; @@ -1032,7 +1032,7 @@ void sun4_state::write_insn_data(UINT8 asi, address_space &space, UINT32 offset, switch ((m_pagemap[entry] >> 26) & 3) { - case 0: // type 0 + case 0: // type 0 m_type0space->write32(space, tmp, data, mem_mask); return; @@ -1050,7 +1050,7 @@ void sun4_state::write_insn_data(UINT8 asi, address_space &space, UINT32 offset, { printf("sun4: INVALID PTE entry %d %08x accessed! vaddr=%x PC=%x\n", entry, m_pagemap[entry], offset <<2, m_maincpu->pc()); //m_maincpu->trap(SPARC_DATA_ACCESS_EXCEPTION); - //m_buserr[0] = 0x8; // invalid PTE + //m_buserr[0] = 0x8; // invalid PTE //m_buserr[1] = offset<<2; } } @@ -1071,7 +1071,7 @@ READ32_MEMBER( sun4_state::sun4_mmu_r ) switch (asi) { - case 2: // system space + case 2: // system space switch (offset >> 26) { case 3: // context reg @@ -1093,7 +1093,7 @@ READ32_MEMBER( sun4_state::sun4_mmu_r ) logerror("sun4: read dcache data @ %x, PC = %x\n", offset, m_maincpu->pc()); return 0xffffffff; - case 0xf: // UART bypass + case 0xf: // UART bypass //printf("read UART bypass @ %x mask %08x (PC=%x)\n", offset<<2, mem_mask, m_maincpu->pc()); switch (offset & 3) { @@ -1108,7 +1108,7 @@ READ32_MEMBER( sun4_state::sun4_mmu_r ) return 0; } break; - case 3: // segment map + case 3: // segment map //printf("sun4: read segment map @ %x (ctx %d entry %d, mem_mask %08x, PC=%x)\n", offset << 2, m_context & m_ctx_mask, (offset>>16) & 0xfff, mem_mask, m_maincpu->pc()); if (mem_mask == 0xffff0000) { @@ -1120,7 +1120,7 @@ READ32_MEMBER( sun4_state::sun4_mmu_r ) } else { - // printf("sun4: read segment map w/unk mask %08x\n", mem_mask); + // printf("sun4: read segment map w/unk mask %08x\n", mem_mask); } return 0x0; @@ -1130,7 +1130,7 @@ READ32_MEMBER( sun4_state::sun4_mmu_r ) //printf("sun4: read page map @ %x (entry %d, seg %d, PMEG %d, mem_mask %08x, PC=%x)\n", offset << 2, page, (offset >> 16) & 0xfff, m_segmap[m_context & m_ctx_mask][(offset >> 16) & 0xfff] & m_pmeg_mask, mem_mask, m_maincpu->pc()); return m_pagemap[page]; - case 6: // region map used in 4/4xx, I don't know anything about this + case 6: // region map used in 4/4xx, I don't know anything about this return 0; case 8: @@ -1183,7 +1183,7 @@ WRITE32_MEMBER( sun4_state::sun4_mmu_w ) } return; - case 7: // diag reg + case 7: // diag reg m_diag = data >> 24; #if 1 printf("sun4: CPU LEDs to %02x (PC=%x) => ", ((data>>24) & 0xff) ^ 0xff, m_maincpu->pc()); @@ -1211,7 +1211,7 @@ WRITE32_MEMBER( sun4_state::sun4_mmu_w ) logerror("sun4: %08x to cache data @ %x, PC = %x\n", data, offset, m_maincpu->pc()); return; - case 0xf: // UART bypass + case 0xf: // UART bypass //printf("%08x to UART bypass @ %x, mask %08x\n", data, offset<<2, mem_mask); switch (offset & 3) { @@ -1240,11 +1240,11 @@ WRITE32_MEMBER( sun4_state::sun4_mmu_w ) return; case 4: // page map - page = (m_segmap[m_context][(offset >> 16) & 0xfff]) << 5; // get the PMEG - page += (offset >> 11) & 0x1f; // add the offset + page = (m_segmap[m_context][(offset >> 16) & 0xfff]) << 5; // get the PMEG + page += (offset >> 11) & 0x1f; // add the offset //printf("sun4: %08x to page map @ %x (entry %d, mem_mask %08x, PC=%x)\n", data, offset << 2, page, mem_mask, m_maincpu->pc()); COMBINE_DATA(&m_pagemap[page]); - m_pagemap[page] &= 0xff07ffff; // these bits are cleared when written and tested as such + m_pagemap[page] &= 0xff07ffff; // these bits are cleared when written and tested as such return; case 6: // region map, used in 4/4xx @@ -1464,10 +1464,10 @@ static ADDRESS_MAP_START(type1space_map, AS_PROGRAM, 32, sun4_state) AM_RANGE(0x05000000, 0x05000003) AM_READWRITE8(irq_r, irq_w, 0xffffffff) AM_RANGE(0x06000000, 0x0607ffff) AM_ROM AM_REGION("user1", 0) AM_RANGE(0x07200000, 0x07200003) AM_READWRITE8(fdc_r, fdc_w, 0xffffffff) - AM_RANGE(0x08000000, 0x08000003) AM_READ(ss1_sl0_id) // slot 0 contains SCSI/DMA/Ethernet + AM_RANGE(0x08000000, 0x08000003) AM_READ(ss1_sl0_id) // slot 0 contains SCSI/DMA/Ethernet AM_RANGE(0x08400000, 0x0840000f) AM_READWRITE(dma_r, dma_w) AM_RANGE(0x08800000, 0x0880001f) AM_DEVICE8("scsibus:7:ncr5390", ncr5390_device, map, 0xff0000) - AM_RANGE(0x0e000000, 0x0e000003) AM_READ(ss1_sl3_id) // slot 3 contains video board + AM_RANGE(0x0e000000, 0x0e000003) AM_READ(ss1_sl3_id) // slot 3 contains video board AM_RANGE(0x0e800000, 0x0e8fffff) AM_RAM AM_SHARE("bw2_vram") ADDRESS_MAP_END @@ -2350,7 +2350,7 @@ COMP( 1991, sun4_50, sun4_300,0, sun4c, sun4, sun4_state, ss2, COMP( 199?, sun4_20, sun4_300,0, sun4c, sun4, sun4_state, sun4c, "Sun Microsystems", "SPARCstation SLC (Sun 4/20)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) COMP( 1989, sun4_60, sun4_300,0, sun4c, sun4, sun4_state, sun4c, "Sun Microsystems", "SPARCstation 1 (Sun 4/60)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) COMP( 1990, sun4_65, sun4_300,0, sun4c, sun4, sun4_state, sun4c, "Sun Microsystems", "SPARCstation 1+ (Sun 4/65)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1990, sun4_75, sun4_300,0, sun4c, sun4, sun4_state, ss2, "Sun Microsystems", "SPARCstation 2 (Sun 4/75)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1990, sun4_75, sun4_300,0, sun4c, sun4, sun4_state, ss2, "Sun Microsystems", "SPARCstation 2 (Sun 4/75)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // sun4m (using the SPARC "reference MMU", probably will go to a separate driver) COMP( 1992, sun_s10, sun4_300,0, sun4c, sun4, sun4_state, sun4c, "Sun Microsystems", "SPARCstation 10 (Sun S10)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/tiamc1.cpp b/src/mame/drivers/tiamc1.cpp index 77449e61fc1..2af637a0f19 100644 --- a/src/mame/drivers/tiamc1.cpp +++ b/src/mame/drivers/tiamc1.cpp @@ -12,8 +12,8 @@ * Konek-Gorbunok (Little Humpbacked Horse) * Snezhnaja Koroleva (Snow Queen) * S.O.S. - * Gorodki - * Kot-Rybolov + * Gorodki + * Kot-Rybolov Other games known to exist on this hardware (interchangeable by the ROM swap): * Avtogonki @@ -21,8 +21,8 @@ * Kotigoroshko * Ostrov Drakona * Ostrov Sokrovisch - * Perehvatchik - * Zvezdnyj Rycar' + * Perekhvatchik + * Zvezdnyi Rytsar' *************************************************************** @@ -113,8 +113,7 @@ - Use machine/pit8253.c in sound - Check sprites priorities on the real hardware - Check vertical background scrolling on the real hardware - - What charset control is used for? - - Kot Rybolov viewable area size likely controlled by pit8253 timers 0 and 1, used in test mode only + - Kot Rybolov viewable area size likely controlled by pit8253 timers 0 and 1, used in test mode only */ @@ -168,7 +167,7 @@ static ADDRESS_MAP_START( tiamc1_io_map, AS_IO, 8, tiamc1_state ) AM_RANGE(0xbc, 0xbc) AM_WRITE(tiamc1_bg_vshift_w)/* background V scroll */ AM_RANGE(0xbd, 0xbd) AM_WRITE(tiamc1_bg_hshift_w)/* background H scroll */ AM_RANGE(0xbe, 0xbe) AM_WRITE(tiamc1_bankswitch_w) /* VRAM selector */ - AM_RANGE(0xbf, 0xbf) AM_WRITENOP /* charset control */ + AM_RANGE(0xbf, 0xbf) AM_WRITE(tiamc1_bg_bplctrl_w) /* charset control */ AM_RANGE(0xc0, 0xc3) AM_DEVWRITE("2x8253", tiamc1_sound_device, tiamc1_timer0_w) /* timer 0 */ AM_RANGE(0xd0, 0xd3) AM_DEVREADWRITE("kr580vv55a", i8255_device, read, write) /* input ports + coin counters & lockout */ AM_RANGE(0xd4, 0xd7) AM_DEVWRITE("2x8253", tiamc1_sound_device, tiamc1_timer1_w) /* timer 1 */ @@ -177,14 +176,14 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( kotrybolov_io_map, AS_IO, 8, tiamc1_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x0f) AM_WRITE(tiamc1_sprite_y_w) // sprites Y - AM_RANGE(0x10, 0x1f) AM_WRITE(tiamc1_sprite_x_w) // sprites X - AM_RANGE(0x20, 0x2f) AM_WRITE(tiamc1_sprite_n_w) // sprites # - AM_RANGE(0x30, 0x3f) AM_WRITE(tiamc1_sprite_a_w) // sprites attributes - AM_RANGE(0xe0, 0xef) AM_WRITE(tiamc1_palette_w) // color ram - AM_RANGE(0xf0, 0xf0) AM_WRITE(tiamc1_bg_vshift_w) // background V scroll - AM_RANGE(0xf4, 0xf4) AM_WRITE(tiamc1_bg_hshift_w) // background H scroll - AM_RANGE(0xf8, 0xf8) AM_WRITE(kot_bankswitch_w) // character rom offset + AM_RANGE(0x00, 0x0f) AM_WRITE(tiamc1_sprite_y_w) // sprites Y + AM_RANGE(0x10, 0x1f) AM_WRITE(tiamc1_sprite_x_w) // sprites X + AM_RANGE(0x20, 0x2f) AM_WRITE(tiamc1_sprite_n_w) // sprites # + AM_RANGE(0x30, 0x3f) AM_WRITE(tiamc1_sprite_a_w) // sprites attributes + AM_RANGE(0xe0, 0xef) AM_WRITE(tiamc1_palette_w) // color ram + AM_RANGE(0xf0, 0xf0) AM_WRITE(tiamc1_bg_vshift_w) // background V scroll + AM_RANGE(0xf4, 0xf4) AM_WRITE(tiamc1_bg_hshift_w) // background H scroll + AM_RANGE(0xf8, 0xf8) AM_WRITE(kot_bankswitch_w) // character rom offset AM_RANGE(0xc0, 0xc3) AM_DEVREADWRITE("pit8253", pit8253_device, read, write) AM_RANGE(0xd0, 0xd3) AM_DEVREADWRITE("kr580vv55a", i8255_device, read, write) /* input ports + coin counters & lockout */ ADDRESS_MAP_END @@ -236,8 +235,8 @@ static INPUT_PORTS_START( gorodki ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* OUT:game counter */ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* RAZR ??? */ PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN1 ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) // right button - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) // left button + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) // right button + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) // left button PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") INPUT_PORTS_END @@ -269,7 +268,7 @@ static INPUT_PORTS_START( kot ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* RAZR ??? */ PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) // Punch / Right - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) // Kick / Left + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) // Kick / Left PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") INPUT_PORTS_END @@ -332,12 +331,12 @@ static MACHINE_CONFIG_START( tiamc1, tiamc1_state ) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 336, 0, 256, 312, 0, 256) // pixel clock and htotal comes from docs/schematics, the rest is guess (determined by undumped PROM) + MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 336, 0, 256, 312, 0, 256) // pixel clock and htotal comes from docs/schematics, the rest is guess (determined by undumped PROM) MCFG_SCREEN_UPDATE_DRIVER(tiamc1_state, screen_update_tiamc1) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", tiamc1) - MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_ADD("palette", 32) MCFG_PALETTE_INIT_OWNER(tiamc1_state, tiamc1) /* sound hardware */ @@ -364,7 +363,7 @@ static MACHINE_CONFIG_DERIVED(kot, tiamc1) MCFG_DEVICE_ADD("pit8253", PIT8253, 0) MCFG_PIT8253_CLK0(PIXEL_CLOCK / 4) - MCFG_PIT8253_CLK2(SND_CLOCK) // guess + MCFG_PIT8253_CLK2(SND_CLOCK) // guess MCFG_PIT8253_OUT2_HANDLER(WRITELINE(tiamc1_state, pit8253_2_w)) MACHINE_CONFIG_END @@ -526,13 +525,13 @@ ROM_START( kot ) ROM_LOAD( "856.8", 0x04000, 0x2000, CRC(9180c98f) SHA1(4085180b9e9772e965c487e7b02d88fcae973e87) ) ROM_REGION( 0x8000, "gfx1", 0 ) - ROM_LOAD( "850.5", 0x00000, 0x2000, CRC(5dc3a102) SHA1(e97d219f7004291438b991435b7fe5d5be01d468) ) // sprite gfx + ROM_LOAD( "850.5", 0x00000, 0x2000, CRC(5dc3a102) SHA1(e97d219f7004291438b991435b7fe5d5be01d468) ) // sprite gfx ROM_LOAD( "851.6", 0x02000, 0x2000, CRC(7db239a0) SHA1(af5772afff9009f63e2ab95c1cb00e047f3ed7e4) ) ROM_LOAD( "852.7", 0x04000, 0x2000, CRC(c7700f88) SHA1(1a20cc60b083259070e4f1687b09a31fc763d47e) ) ROM_LOAD( "853.8", 0x06000, 0x2000, CRC(b94bf1af) SHA1(da403c51fd78f99b82304c67f2197078f4ea0bf5) ) ROM_REGION( 0x8000, "gfx2", 0 ) - ROM_LOAD( "846.1", 0x00000, 0x2000, CRC(42447f4a) SHA1(bd35f2f5e468f9191680bf2c1800e09bb9ae1691) ) // tile gfx + ROM_LOAD( "846.1", 0x00000, 0x2000, CRC(42447f4a) SHA1(bd35f2f5e468f9191680bf2c1800e09bb9ae1691) ) // tile gfx ROM_LOAD( "847.2", 0x02000, 0x2000, CRC(99ada5e8) SHA1(9425a515105ec9e9989aae736645b270e39420be) ) ROM_LOAD( "848.3", 0x04000, 0x2000, CRC(a124cff4) SHA1(d1d8e6f725a6f30058d52cdbe80b598149cd6052) ) ROM_LOAD( "849.4", 0x06000, 0x2000, CRC(5d27fda6) SHA1(f1afb39c7422caaa5eff53388f1b7241dd7c1cd7) ) diff --git a/src/mame/drivers/tim100.cpp b/src/mame/drivers/tim100.cpp index 02d7de0fa61..26900fef369 100644 --- a/src/mame/drivers/tim100.cpp +++ b/src/mame/drivers/tim100.cpp @@ -36,9 +36,9 @@ public: , m_uart18(*this, "uart_u18") { } - WRITE_LINE_MEMBER(drq_w); - WRITE_LINE_MEMBER(irq_w); - WRITE_LINE_MEMBER(clock_w); + DECLARE_WRITE_LINE_MEMBER(drq_w); + DECLARE_WRITE_LINE_MEMBER(irq_w); + DECLARE_WRITE_LINE_MEMBER(clock_w); I8275_DRAW_CHARACTER_MEMBER( crtc_display_pixels ); private: @@ -158,7 +158,7 @@ WRITE_LINE_MEMBER( tim100_state::irq_w ) m_maincpu->set_input_line(I8085_RST65_LINE, CLEAR_LINE); } -DECLARE_WRITE_LINE_MEMBER( tim100_state::clock_w ) +WRITE_LINE_MEMBER( tim100_state::clock_w ) { m_uart17->write_txc(state); m_uart17->write_rxc(state); diff --git a/src/mame/drivers/tv950.cpp b/src/mame/drivers/tv950.cpp index 7fe87623194..a84031817ba 100644 --- a/src/mame/drivers/tv950.cpp +++ b/src/mame/drivers/tv950.cpp @@ -1,20 +1,55 @@ // license:BSD-3-Clause -// copyright-holders:Robbbert +// copyright-holders:R. Belmont, Robbbert /*************************************************************************** 2013-09-10 Skeleton driver for Televideo TV950 + 2016-07-30 Preliminary not-so-skeleton driver TODO: - - Everything - this is just a skeleton - - Seems there should be a few more roms. - - + - Keyboard + - CRTC reset and drawing + + Hardware: + 6502 CPU + 6545 CRTC + 6522 VIA, wired to count HSYNCs and to enable the 6502 to pull RESET on the CRTC + 3x 6551 ACIA 1 for the keyboard, 1 for the modem port, 1 for the printer port + + VIA hookup (see schematics): + PA3 = beep? + PA5 = inverse video + PA6 = IRQ in + PA7 = force blank + PB6 = Hblank in + CA1 = reset CRTC in + CA2 = reset CRTC out + CB2 = blink timer + + IRQ = ACIAs (all 3 ORed together) + NMI = 6522 VIA's IRQ line + + http://www.bitsavers.org/pdf/televideo/950/Model_950_Terminal_Theory_of_Operation_26Jan1981.pdf + http://www.bitsavers.org/pdf/televideo/950/2002100_Model_950_Maintenance_Manual_Nov1983.pdf + http://www.bitsavers.org/pdf/televideo/950/B300002-001_Model_950_Operators_Manual_Feb81.pdf + ****************************************************************************/ #include "emu.h" #include "cpu/m6502/m6502.h" +#include "video/mc6845.h" +#include "machine/6522via.h" +#include "machine/mos6551.h" +#include "bus/rs232/rs232.h" +#define ACIA1_TAG "acia1" +#define ACIA2_TAG "acia2" +#define ACIA3_TAG "acia3" +#define CRTC_TAG "crtc" +#define VIA_TAG "via" +#define RS232A_TAG "rs232a" +#define RS232B_TAG "rs232b" + +#define MASTER_CLOCK (23814000) class tv950_state : public driver_device { @@ -22,20 +57,39 @@ public: tv950_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") + , m_via(*this, VIA_TAG) + , m_crtc(*this, CRTC_TAG) + , m_vram(*this, "vram") { } + MC6845_UPDATE_ROW(crtc_update_row); + MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update_addr); + + DECLARE_WRITE8_MEMBER(row_addr_w); + DECLARE_WRITE_LINE_MEMBER(via_crtc_reset_w); + private: virtual void machine_reset() override; - required_device<cpu_device> m_maincpu; + required_device<m6502_device> m_maincpu; + required_device<via6522_device> m_via; + required_device<r6545_1_device> m_crtc; + required_shared_ptr<UINT8> m_vram; + + int m_row_addr; }; static ADDRESS_MAP_START(tv950_mem, AS_PROGRAM, 8, tv950_state) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0xefff) AM_RAM - AM_RANGE(0xf000, 0xffff) AM_ROM -ADDRESS_MAP_END - -static ADDRESS_MAP_START(tv950_io, AS_IO, 8, tv950_state) + AM_RANGE(0x0000, 0x07ff) AM_RAM + AM_RANGE(0x2000, 0x3fff) AM_RAM AM_SHARE("vram") // VRAM + AM_RANGE(0x8000, 0x8100) AM_DEVREADWRITE(CRTC_TAG, r6545_1_device, status_r, address_w) + AM_RANGE(0x8001, 0x8101) AM_DEVREADWRITE(CRTC_TAG, r6545_1_device, register_r, register_w) + AM_RANGE(0x9000, 0x9000) AM_WRITE(row_addr_w) + AM_RANGE(0x9300, 0x9303) AM_DEVREADWRITE(ACIA1_TAG, mos6551_device, read, write) + AM_RANGE(0x9500, 0x9503) AM_DEVREADWRITE(ACIA2_TAG, mos6551_device, read, write) + AM_RANGE(0x9900, 0x9903) AM_DEVREADWRITE(ACIA3_TAG, mos6551_device, read, write) + AM_RANGE(0xb100, 0xb10f) AM_DEVREADWRITE(VIA_TAG, via6522_device, read, write) + AM_RANGE(0xe000, 0xffff) AM_ROM AM_REGION("maincpu", 0) ADDRESS_MAP_END @@ -48,23 +102,75 @@ void tv950_state::machine_reset() { } +WRITE_LINE_MEMBER(tv950_state::via_crtc_reset_w) +{ + //printf("via_crtc_reset_w: %d\n", state); + m_via->write_ca1(state); + + if (!state) + { + //m_crtc->device_reset(); + } +} + +WRITE8_MEMBER(tv950_state::row_addr_w) +{ + m_row_addr = data; +} + +MC6845_ON_UPDATE_ADDR_CHANGED( tv950_state::crtc_update_addr ) +{ +} + +MC6845_UPDATE_ROW( tv950_state::crtc_update_row ) +{ +} + static MACHINE_CONFIG_START( tv950, tv950_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, XTAL_2MHz) + MCFG_CPU_ADD("maincpu", M6502, MASTER_CLOCK/14) MCFG_CPU_PROGRAM_MAP(tv950_mem) - MCFG_CPU_IO_MAP(tv950_io) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK, 882, 0, 720, 370, 0, 350 ) // not real values + MCFG_SCREEN_UPDATE_DEVICE( CRTC_TAG, r6545_1_device, screen_update ) + + // there are many 6845 CRTC submodels, the Theory of Operation manual references the Rockwell R6545-1 specificially. + MCFG_MC6845_ADD(CRTC_TAG, R6545_1, "screen", MASTER_CLOCK/14) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(tv950_state, crtc_update_row) + MCFG_MC6845_ADDR_CHANGED_CB(tv950_state, crtc_update_addr) + MCFG_MC6845_OUT_HSYNC_CB(DEVWRITELINE(VIA_TAG, via6522_device, write_pb6)) + + MCFG_DEVICE_ADD(VIA_TAG, VIA6522, MASTER_CLOCK/14) + MCFG_VIA6522_IRQ_HANDLER(INPUTLINE("maincpu", M6502_NMI_LINE)) + MCFG_VIA6522_CA2_HANDLER(WRITELINE(tv950_state, via_crtc_reset_w)) + + MCFG_DEVICE_ADD(ACIA1_TAG, MOS6551, 0) + MCFG_MOS6551_XTAL(MASTER_CLOCK/13) + + MCFG_DEVICE_ADD(ACIA2_TAG, MOS6551, 0) + MCFG_MOS6551_XTAL(MASTER_CLOCK/13) + + MCFG_DEVICE_ADD(ACIA3_TAG, MOS6551, 0) + MCFG_MOS6551_XTAL(MASTER_CLOCK/13) MACHINE_CONFIG_END /* ROM definition */ ROM_START( tv950 ) - ROM_REGION(0x10000, "maincpu", 0) - ROM_SYSTEM_BIOS( 0, "8000043", "8000043") - ROMX_LOAD( "tv-043h.rom", 0xf000, 0x1000, CRC(89b826be) SHA1(fd5575be04317682d0c9062702b5932b46f89926), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 1, "8000044", "8000044") - ROMX_LOAD( "tv-044h.rom", 0xf000, 0x1000, CRC(24b0383d) SHA1(71cabb7f3da8652a36afdf3d505ab8a41651e801), ROM_BIOS(2) ) + ROM_REGION(0x2000, "maincpu", 0) + ROM_LOAD( "180000-001a_a41_eb17.bin", 0x001000, 0x001000, CRC(b7187cc5) SHA1(41cc8fd51661314e03ee7e00cc1e206e9a694d92) ) + ROM_LOAD( "180000-007a_a42_67d3.bin", 0x000000, 0x001000, CRC(3ef2e6fb) SHA1(21ccfd2b50c37b715eed67671b82faa4d75fc6bb) ) + + ROM_REGION(0x2000, "graphics", 0) + ROM_LOAD16_BYTE( "180000-002a_a33_9294.bin", 0x000001, 0x001000, CRC(eaf4f346) SHA1(b4c531626846f3f055ddc086ac24fdb1b34f3f8e) ) + ROM_LOAD16_BYTE( "180000-003a_a32_7ebf.bin", 0x000000, 0x001000, CRC(783ca0b6) SHA1(1cec9a9a56ef5795809f7ca7cd2e3f61b27e698d) ) + + ROM_REGION(0x1000, "kbd", 0) + ROM_LOAD( "950kbd_8748_pn52080723-02.bin", 0x000000, 0x000400, CRC(11c8f22c) SHA1(99e73e9c74b10055733e89b92adbc5bf7f4ff338) ) ROM_END /* Driver */ - /* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ -COMP( 198?, tv950, 0, 0, tv950, tv950, driver_device, 0, "Televideo", "TV950", MACHINE_IS_SKELETON ) +COMP( 1981, tv950, 0, 0, tv950, tv950, driver_device, 0, "TeleVideo", "TV950", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/tv990.cpp b/src/mame/drivers/tv990.cpp index 544765f2086..124e05d86a2 100644 --- a/src/mame/drivers/tv990.cpp +++ b/src/mame/drivers/tv990.cpp @@ -34,6 +34,7 @@ #include "machine/ins8250.h" #include "machine/8042kbdc.h" #include "bus/rs232/rs232.h" +#include "machine/pc_lpt.h" #include "machine/nvram.h" #include "sound/beep.h" @@ -41,6 +42,7 @@ #define UART1_TAG "ns16450_1" #define RS232A_TAG "rs232a" #define RS232B_TAG "rs232b" +#define LPT_TAG "lpt" class tv990_state : public driver_device { @@ -71,6 +73,7 @@ public: virtual void machine_reset() override; virtual void machine_start() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void device_post_load() override; UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); @@ -79,8 +82,9 @@ public: DECLARE_READ8_MEMBER(kbdc_r); DECLARE_WRITE8_MEMBER(kbdc_w); - WRITE_LINE_MEMBER(uart0_irq); - WRITE_LINE_MEMBER(uart1_irq); + DECLARE_WRITE_LINE_MEMBER(uart0_irq); + DECLARE_WRITE_LINE_MEMBER(uart1_irq); + DECLARE_WRITE_LINE_MEMBER(lpt_irq); INTERRUPT_GEN_MEMBER(vblank); DECLARE_INPUT_CHANGED_MEMBER(color); @@ -124,6 +128,11 @@ WRITE_LINE_MEMBER(tv990_state::uart1_irq) m_maincpu->set_input_line(M68K_IRQ_4, state); } +WRITE_LINE_MEMBER(tv990_state::lpt_irq) +{ + m_maincpu->set_input_line(M68K_IRQ_3, state); +} + READ16_MEMBER(tv990_state::tvi1111_r) { if (offset == (0x32/2)) @@ -300,6 +309,7 @@ static ADDRESS_MAP_START(tv990_mem, AS_PROGRAM, 16, tv990_state) AM_RANGE(0x090000, 0x0900ff) AM_READWRITE(tvi1111_r, tvi1111_w) AM_RANGE(0x0a0000, 0x0a000f) AM_DEVREADWRITE8(UART0_TAG, ns16450_device, ins8250_r, ins8250_w, 0x00ff) AM_RANGE(0x0a0010, 0x0a001f) AM_DEVREADWRITE8(UART1_TAG, ns16450_device, ins8250_r, ins8250_w, 0x00ff) + AM_RANGE(0x0a0028, 0x0a002d) AM_DEVREADWRITE8(LPT_TAG, pc_lpt_device, read, write, 0x00ff) AM_RANGE(0x0b0000, 0x0b0003) AM_READWRITE8(kbdc_r, kbdc_w, 0x00ff) AM_RANGE(0x0c0000, 0x0c7fff) AM_RAM AM_SHARE("nvram")// work RAM ADDRESS_MAP_END @@ -346,6 +356,11 @@ void tv990_state::machine_reset() m_height = 50; } +void tv990_state::device_post_load() +{ + m_screen->set_visible_area(0, m_width * 16 - 1, 0, m_height * m_rowh - 1); +} + static MACHINE_CONFIG_START( tv990, tv990_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, 14967500) // verified (59.86992/4) @@ -370,6 +385,9 @@ static MACHINE_CONFIG_START( tv990, tv990_state ) MCFG_INS8250_OUT_RTS_CB(DEVWRITELINE(RS232B_TAG, rs232_port_device, write_rts)) MCFG_INS8250_OUT_TX_CB(DEVWRITELINE(RS232B_TAG, rs232_port_device, write_txd)) MCFG_INS8250_OUT_INT_CB(WRITELINE(tv990_state, uart1_irq)) + + MCFG_DEVICE_ADD(LPT_TAG, PC_LPT, 0) + MCFG_PC_LPT_IRQ_HANDLER(WRITELINE(tv990_state, lpt_irq)) MCFG_RS232_PORT_ADD(RS232A_TAG, default_rs232_devices, nullptr) MCFG_RS232_RXD_HANDLER(DEVWRITELINE(UART0_TAG, ns16450_device, rx_w)) @@ -406,5 +424,5 @@ ROM_START( tv995 ) ROM_END /* Driver */ -COMP( 1992, tv990, 0, 0, tv990, tv990, driver_device, 0, "TeleVideo", "TeleVideo 990", 0) -COMP( 1994, tv995, 0, 0, tv990, tv990, driver_device, 0, "TeleVideo", "TeleVideo 995-65", 0) +COMP( 1992, tv990, 0, 0, tv990, tv990, driver_device, 0, "TeleVideo", "TeleVideo 990", MACHINE_SUPPORTS_SAVE) +COMP( 1994, tv995, 0, 0, tv990, tv990, driver_device, 0, "TeleVideo", "TeleVideo 995-65", MACHINE_SUPPORTS_SAVE) diff --git a/src/mame/drivers/xbox.cpp b/src/mame/drivers/xbox.cpp index fb49f4538cc..0dd75172d63 100644 --- a/src/mame/drivers/xbox.cpp +++ b/src/mame/drivers/xbox.cpp @@ -198,7 +198,10 @@ ROM_START( xbox ) ROM_REGION( 0x100000, "bios", 0) ROM_LOAD( "4134_1024k.bin", 0x000000, 0x100000, CRC(49d8055a) SHA1(d46cef771a63dc8024fe36d7ab5b959087ac999f) ) + ROM_COPY( "mcpx", 1, 0x3fe00, 0x1ff) ROM_COPY( "mcpx", 1, 0x7fe00, 0x1ff) + ROM_COPY( "mcpx", 1, 0xbfe00, 0x1ff) + ROM_COPY( "mcpx", 1, 0xffe00, 0x1ff) ROM_REGION( 0x1000000, "tbp", 0 ) // To Be Processed, of course diff --git a/src/mame/includes/aussiebyte.h b/src/mame/includes/aussiebyte.h index 0f798e1a99f..d410d4502c7 100644 --- a/src/mame/includes/aussiebyte.h +++ b/src/mame/includes/aussiebyte.h @@ -20,6 +20,7 @@ #include "bus/rs232/rs232.h" #include "machine/wd_fdc.h" #include "machine/msm5832.h" +#include "machine/clock.h" /*********************************************************** @@ -78,9 +79,9 @@ public: DECLARE_WRITE_LINE_MEMBER(sio1_rdyb_w); DECLARE_WRITE_LINE_MEMBER(sio2_rdya_w); DECLARE_WRITE_LINE_MEMBER(sio2_rdyb_w); + DECLARE_WRITE_LINE_MEMBER(clock_w); DECLARE_MACHINE_RESET(aussiebyte); DECLARE_DRIVER_INIT(aussiebyte); - TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); DECLARE_WRITE_LINE_MEMBER(ctc_z0_w); DECLARE_WRITE_LINE_MEMBER(ctc_z1_w); DECLARE_WRITE_LINE_MEMBER(ctc_z2_w); diff --git a/src/mame/includes/bfm_sc4.h b/src/mame/includes/bfm_sc4.h index 909325ea1ed..def6c17254a 100644 --- a/src/mame/includes/bfm_sc4.h +++ b/src/mame/includes/bfm_sc4.h @@ -59,19 +59,19 @@ #define SC45_BUTTON_MATRIX_20_0 IPT_SERVICE1 // green / test -static const UINT8 SEGMENT_34_ENCODING_LOOKUP[16] = +static const UINT8 SEGMENT_34_ENCODING_LOOKUP[16] = { - 63, // 0 - 6, // 1 - 91, // 2 - 79, // 3 + 63, // 0 + 6, // 1 + 91, // 2 + 79, // 3 102,// 4 109,// 5 125,// 6 - 7, // 7 + 7, // 7 127,// 8 103,// 9 - 0, // 10 + 0, // 10 121,// 11 121,// 12 121,// 13 diff --git a/src/mame/includes/centiped.h b/src/mame/includes/centiped.h index 74eb06ad0c6..325b5fb0f6b 100644 --- a/src/mame/includes/centiped.h +++ b/src/mame/includes/centiped.h @@ -7,6 +7,7 @@ *************************************************************************/ #include "machine/eepromser.h" +#include "sound/ay8910.h" class centiped_state : public driver_device { @@ -22,7 +23,8 @@ public: m_eeprom(*this, "eeprom"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_aysnd(*this, "aysnd") { } optional_shared_ptr<UINT8> m_rambase; required_shared_ptr<UINT8> m_videoram; @@ -30,6 +32,13 @@ public: optional_shared_ptr<UINT8> m_paletteram; optional_shared_ptr<UINT8> m_bullsdrt_tiles_bankram; + required_device<cpu_device> m_maincpu; + optional_device<eeprom_serial_93cxx_device> m_eeprom; + required_device<gfxdecode_device> m_gfxdecode; + required_device<screen_device> m_screen; + required_device<palette_device> m_palette; + optional_device<ay8910_device> m_aysnd; + UINT8 m_oldpos[4]; UINT8 m_sign[4]; UINT8 m_dsw_select; @@ -94,9 +103,4 @@ public: void init_common(); void milliped_set_color(offs_t offset, UINT8 data); inline int read_trackball(int idx, int switch_port); - required_device<cpu_device> m_maincpu; - optional_device<eeprom_serial_93cxx_device> m_eeprom; - required_device<gfxdecode_device> m_gfxdecode; - required_device<screen_device> m_screen; - required_device<palette_device> m_palette; }; diff --git a/src/mame/includes/legionna.h b/src/mame/includes/legionna.h index 78c95cc17c8..068571f2a72 100644 --- a/src/mame/includes/legionna.h +++ b/src/mame/includes/legionna.h @@ -96,4 +96,3 @@ public: required_device<palette_device> m_palette; optional_device<raiden2cop_device> m_raiden2cop; }; - diff --git a/src/mame/includes/megadriv.h b/src/mame/includes/megadriv.h index 702be472e7a..e436c697476 100644 --- a/src/mame/includes/megadriv.h +++ b/src/mame/includes/megadriv.h @@ -53,7 +53,8 @@ public: m_ymsnd(*this,"ymsnd"), m_vdp(*this,"gen_vdp"), m_snsnd(*this, "snsnd"), - m_megadrive_ram(*this,"megadrive_ram") + m_megadrive_ram(*this,"megadrive_ram"), + m_io_reset(*this, "RESET") { } required_device<m68000_base_device> m_maincpu; optional_device<cpu_device> m_z80snd; @@ -63,7 +64,7 @@ public: optional_shared_ptr<UINT16> m_megadrive_ram; - ioport_port *m_io_reset; + optional_ioport m_io_reset; ioport_port *m_io_pad_3b[4]; ioport_port *m_io_pad_6b[4]; diff --git a/src/mame/includes/tiamc1.h b/src/mame/includes/tiamc1.h index 2766b994339..513f7c1df5f 100644 --- a/src/mame/includes/tiamc1.h +++ b/src/mame/includes/tiamc1.h @@ -22,9 +22,11 @@ public: UINT8 *m_spriteram_y; UINT8 *m_spriteram_a; UINT8 *m_spriteram_n; + UINT8 *m_paletteram; UINT8 m_layers_ctrl; UINT8 m_bg_vshift; UINT8 m_bg_hshift; + UINT8 m_bg_bplctrl; tilemap_t *m_bg_tilemap1; tilemap_t *m_bg_tilemap2; std::unique_ptr<rgb_t[]> m_palette_ptr; @@ -37,6 +39,7 @@ public: DECLARE_WRITE8_MEMBER(tiamc1_sprite_n_w); DECLARE_WRITE8_MEMBER(tiamc1_bg_vshift_w); DECLARE_WRITE8_MEMBER(tiamc1_bg_hshift_w); + DECLARE_WRITE8_MEMBER(tiamc1_bg_bplctrl_w); DECLARE_WRITE8_MEMBER(tiamc1_palette_w); DECLARE_WRITE8_MEMBER(kot_bankswitch_w); DECLARE_WRITE8_MEMBER(kot_videoram_w); @@ -56,6 +59,7 @@ public: required_device<palette_device> m_palette; private: optional_device<speaker_sound_device> m_speaker; + void update_bg_palette(); }; diff --git a/src/mame/includes/vendetta.h b/src/mame/includes/vendetta.h index 497db3c2886..b68c15c214b 100644 --- a/src/mame/includes/vendetta.h +++ b/src/mame/includes/vendetta.h @@ -34,7 +34,7 @@ public: m_videobank0(*this, "videobank0"), m_videobank1(*this, "videobank1") { } - + /* video-related */ int m_layer_colorbase[3]; int m_sprite_colorbase; diff --git a/src/mame/machine/apollo.cpp b/src/mame/machine/apollo.cpp index 7f3c505b050..e28dc6e9c23 100644 --- a/src/mame/machine/apollo.cpp +++ b/src/mame/machine/apollo.cpp @@ -1220,6 +1220,9 @@ MACHINE_START_MEMBER(apollo_state,apollo) // fake mc146818 interrupts (DN3000 only) m_dn3000_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apollo_state::apollo_rtc_timer),this)); } + + m_dma_channel = -1; + m_cur_eop = false; } MACHINE_RESET_MEMBER(apollo_state,apollo) @@ -1227,9 +1230,6 @@ MACHINE_RESET_MEMBER(apollo_state,apollo) address_space &space = m_maincpu->space(AS_PROGRAM); UINT8 year = apollo_rtc_r(space, 9); - m_dma_channel = -1; - m_cur_eop = false; - MLOG1(("machine_reset_apollo")); // set configuration diff --git a/src/mame/machine/apricotkb_hle.cpp b/src/mame/machine/apricotkb_hle.cpp deleted file mode 100644 index 7bf5531454c..00000000000 --- a/src/mame/machine/apricotkb_hle.cpp +++ /dev/null @@ -1,286 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best -/*************************************************************************** - - ACT Apricot Keyboard (HLE) - - Keyboard to System: - - 01-60: Key make codes - - 70-7f: Mouse codes - - 80: RAM test failed - - 81-e0: Key break codes - - e9: ROM test failed - - ea: X-on (keyboard ready to receive) - - eb: X-off (keyboard buffer full) - - ec: Reset request - - ed: Time prefix - - ee: Date prefix - - ef: Mouse header - - f0-f9: BCD data - - fa: Invalid clock data - - fb: Acknowledge firmware version/reset - - System to keyboard: - - 01-7f: Character codes for MicroScreen - - 80-cf: Cursor address - - d0: Clear screen - - d1: Cursor left - - d2: Cursor right - - d3: Cursor on - - d4: Cursor off - - d5: Display on - - d6: Display off - - e0: Query - - e1: Time and date request - - e2: Display time/data on MicroScreen - - e3: Set LED prefix - - e4: Set time and date - - e5: Mouse enable - - e6: Mouse disable - - e7: Execute processor diagnostics - - e8: Keyboard reset - - f0-f9: BCD data - - fa: Invalid clock data - -***************************************************************************/ - -#include "apricotkb_hle.h" - - -//************************************************************************** -// CONSTANTS / MACROS -//************************************************************************** - -#define APRICOT_KEY(_key, _index) \ - PORT_BIT(1 << _key, IP_ACTIVE_HIGH, IPT_KEYBOARD) \ - PORT_CHANGED_MEMBER(DEVICE_SELF, apricot_keyboard_hle_device, key_callback, (void *) _index) - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -const device_type APRICOT_KEYBOARD_HLE = &device_creator<apricot_keyboard_hle_device>; - - -//------------------------------------------------- -// input_ports - device-specific input ports -//------------------------------------------------- - -static INPUT_PORTS_START( keyboard ) - PORT_START("keyboard_0") - PORT_BIT(1 << 0, IP_ACTIVE_HIGH, IPT_UNUSED) - APRICOT_KEY( 1, nullptr) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_NAME("Help") - APRICOT_KEY( 2, nullptr) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) PORT_NAME("Undo") - APRICOT_KEY( 3, nullptr) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) PORT_NAME("Repeat") - APRICOT_KEY( 4, nullptr) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_NAME("Calc") - APRICOT_KEY( 5, nullptr) PORT_CODE(KEYCODE_PRTSCR) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) PORT_NAME("Print") - APRICOT_KEY( 6, nullptr) PORT_CODE(KEYCODE_CANCEL) PORT_CHAR(UCHAR_MAMEKEY(CANCEL)) PORT_NAME("Intr") - APRICOT_KEY( 7, nullptr) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) PORT_NAME("Menu") - APRICOT_KEY( 8, nullptr) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) PORT_NAME("Finish") - APRICOT_KEY( 9, nullptr) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_NAME("Function 1") - APRICOT_KEY(10, nullptr) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_NAME("Function 2") - APRICOT_KEY(11, nullptr) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_NAME("Function 3") - APRICOT_KEY(12, nullptr) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_NAME("Function 4") - APRICOT_KEY(13, nullptr) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_NAME("Function 5") - APRICOT_KEY(14, nullptr) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) PORT_NAME("Function 6") - APRICOT_KEY(15, nullptr) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('^') - APRICOT_KEY(16, nullptr) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - APRICOT_KEY(17, nullptr) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - APRICOT_KEY(18, nullptr) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - APRICOT_KEY(19, nullptr) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR(0xa3) // pound - APRICOT_KEY(20, nullptr) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - APRICOT_KEY(21, nullptr) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('$') - APRICOT_KEY(22, nullptr) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') - APRICOT_KEY(23, nullptr) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - APRICOT_KEY(24, nullptr) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - APRICOT_KEY(25, nullptr) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - APRICOT_KEY(26, nullptr) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - APRICOT_KEY(27, nullptr) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - APRICOT_KEY(28, nullptr) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(9) - PORT_BIT(1 << 29, IP_ACTIVE_HIGH, IPT_UNUSED) // actually a dedicated % key - APRICOT_KEY(30, nullptr) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - APRICOT_KEY(31, nullptr) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) - - PORT_START("keyboard_1") - APRICOT_KEY( 0, 1) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) - APRICOT_KEY( 1, 1) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - APRICOT_KEY( 2, 1) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - APRICOT_KEY( 3, 1) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - APRICOT_KEY( 4, 1) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - APRICOT_KEY( 5, 1) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - APRICOT_KEY( 6, 1) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - APRICOT_KEY( 7, 1) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - APRICOT_KEY( 8, 1) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - APRICOT_KEY( 9, 1) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - APRICOT_KEY(10, 1) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - APRICOT_KEY(11, 1) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - APRICOT_KEY(12, 1) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - APRICOT_KEY(13, 1) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - APRICOT_KEY(14, 1) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - APRICOT_KEY(15, 1) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - APRICOT_KEY(16, 1) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_NAME("Clear") - APRICOT_KEY(17, 1) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - APRICOT_KEY(18, 1) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - APRICOT_KEY(19, 1) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - APRICOT_KEY(20, 1) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - APRICOT_KEY(21, 1) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - APRICOT_KEY(22, 1) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - APRICOT_KEY(23, 1) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - APRICOT_KEY(24, 1) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - APRICOT_KEY(25, 1) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - APRICOT_KEY(26, 1) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - APRICOT_KEY(27, 1) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - APRICOT_KEY(28, 1) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - APRICOT_KEY(29, 1) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - APRICOT_KEY(30, 1) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - APRICOT_KEY(31, 1) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') - - PORT_START("keyboard_2") - APRICOT_KEY( 0, 2) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - APRICOT_KEY( 1, 2) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - APRICOT_KEY( 2, 2) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - APRICOT_KEY( 3, 2) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - APRICOT_KEY( 4, 2) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - APRICOT_KEY( 5, 2) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - APRICOT_KEY( 6, 2) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - APRICOT_KEY( 7, 2) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - APRICOT_KEY( 8, 2) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - APRICOT_KEY( 9, 2) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - APRICOT_KEY(10, 2) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - APRICOT_KEY(11, 2) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - APRICOT_KEY(12, 2) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - APRICOT_KEY(13, 2) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - APRICOT_KEY(14, 2) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - APRICOT_KEY(15, 2) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - APRICOT_KEY(16, 2) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - APRICOT_KEY(17, 2) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - APRICOT_KEY(18, 2) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - APRICOT_KEY(19, 2) PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) - APRICOT_KEY(20, 2) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - APRICOT_KEY(21, 2) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - APRICOT_KEY(22, 2) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - APRICOT_KEY(23, 2) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - APRICOT_KEY(24, 2) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - APRICOT_KEY(25, 2) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - APRICOT_KEY(26, 2) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(PAUSE)) PORT_NAME("Stop") - APRICOT_KEY(27, 2) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - APRICOT_KEY(28, 2) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - APRICOT_KEY(29, 2) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - APRICOT_KEY(30, 2) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - APRICOT_KEY(31, 2) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - - PORT_START("keyboard_3") - APRICOT_KEY( 0, 3) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) -INPUT_PORTS_END - -ioport_constructor apricot_keyboard_hle_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( keyboard ); -} - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// apricot_keyboard_hle_device - constructor -//------------------------------------------------- - -apricot_keyboard_hle_device::apricot_keyboard_hle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, APRICOT_KEYBOARD_HLE, "Apricot Keyboard (HLE)", tag, owner, clock, "apricotkb_hle", __FILE__), - device_serial_interface(mconfig, *this), - m_txd_handler(*this), - m_rxd(1), - m_data_in(0), - m_data_out(0) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void apricot_keyboard_hle_device::device_start() -{ - // resolve callbacks - m_txd_handler.resolve_safe(); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void apricot_keyboard_hle_device::device_reset() -{ - receive_register_reset(); - transmit_register_reset(); - - set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1); - set_rcv_rate(7800); - set_tra_rate(7800); -} - -//------------------------------------------------- -// device_timer - device-specific timer -//------------------------------------------------- - -void apricot_keyboard_hle_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - device_serial_interface::device_timer(timer, id, param, ptr); -} - -void apricot_keyboard_hle_device::tra_callback() -{ - m_txd_handler(transmit_register_get_data_bit()); -} - -void apricot_keyboard_hle_device::tra_complete() -{ - if (m_data_out != 0) - { - transmit_register_setup(m_data_out); - m_data_out = 0; - } -} - -void apricot_keyboard_hle_device::rcv_callback() -{ - receive_register_update_bit(m_rxd); -} - -void apricot_keyboard_hle_device::rcv_complete() -{ - receive_register_extract(); - m_data_in = get_received_char(); - - // reset command? send keyboard ready (likely needs a delay, just disable for now) -// if (m_data_in == 0xe8) -// transmit_register_setup(0xfb); -} - -WRITE_LINE_MEMBER( apricot_keyboard_hle_device::rxd_w ) -{ - m_rxd = state; - device_serial_interface::rx_w(m_rxd); -} - -INPUT_CHANGED_MEMBER( apricot_keyboard_hle_device::key_callback ) -{ - UINT32 oldvalue = oldval * field.mask(), newvalue = newval * field.mask(); - UINT32 delta = oldvalue ^ newvalue; - - for (int i = 0; i < 32; i++) - { - if (delta & (1 << i)) - { - UINT8 down = (newvalue & (1 << i)) ? 0x00 : 0x80; - UINT8 scancode = (FPTR) param * 32 + i; - scancode |= down; - transmit_register_setup(scancode); - break; - } - } - -} diff --git a/src/mame/machine/archimds.cpp b/src/mame/machine/archimds.cpp index f451db8993e..b22ef889e37 100644 --- a/src/mame/machine/archimds.cpp +++ b/src/mame/machine/archimds.cpp @@ -71,7 +71,7 @@ void archimedes_state::archimedes_request_fiq(int mask) m_ioc_regs[FIQ_STATUS] |= mask; //printf("STATUS:%02x IRQ:%02x MASK:%02x\n",m_ioc_regs[FIQ_STATUS],mask,m_ioc_regs[FIQ_MASK]); - + if (m_ioc_regs[FIQ_STATUS] & m_ioc_regs[FIQ_MASK]) { generic_pulse_irq_line(m_maincpu, ARM_FIRQ_LINE, 1); diff --git a/src/mame/machine/m20_kbd.cpp b/src/mame/machine/m20_kbd.cpp index ecccffae775..702985294ed 100644 --- a/src/mame/machine/m20_kbd.cpp +++ b/src/mame/machine/m20_kbd.cpp @@ -1,225 +1,237 @@ // license:BSD-3-Clause -// copyright-holders:Carl -// TODO: dump 8048 mcu +// copyright-holders:Carl,Vas Crabb #include "machine/m20_kbd.h" -m20_keyboard_device::m20_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) : - serial_keyboard_device(mconfig, M20_KEYBOARD, "M20 Keyboard", tag, owner, 0, "m20_keyboard", __FILE__) +#include "machine/keyboard.ipp" + + +namespace { +/* + TODO: dump 8048 mcu + + There seem to be a lot of guesses in this code - actual scan rate, + FIFO length, command processing, etc. don't seem to be evidence- + based. The modifier handling seems very odd as it has aliasing and + overflow all over the place. + + Layout is selected with a set of four jumpers on the keyboard MCU. + We need to bring these out to DIP switches, work out which command + is the layout request, and respond appropriately. + + Available layouts: + Italian + German + French + British + USA ASCII + Spanish + Portuguese + Swedish - Finnish + Danish + Katakana + Yugoslavian + Norwegian + Greek + Swiss - French + Swiss - German + + The keyboard MCU drives a buzzer. We should work out what the bell + on/off commands are and emulate it. + + There are apparently no break codes. + The scancodes are arranged to read in alphabetical order with the QWERTY layout. + Modifiers apparently modify the make codes. + We are using a matrix here that corresponds to the logical scan codes - the physical matrix apparently doesn't match this. + + 00 1c 1d 1e 1f 20 21 22 23 24 25 26 27 c3 cd ce cf d0 + ?? 12 18 06 13 15 1a 16 0a 10 11 28 29 c2 ca cb cc d1 + ?? 02 14 05 07 08 09 0b 0c 0d 2a 2b 2c c1 c7 c8 c9 d2 + ?? 01 1b 19 04 17 03 0f 0e 2d 2e 2f ?? c4 c5 c6 d3 + c0 + + Ths is the 72-key version of the keyboard. + The katakana kayout has 75 keys, but we don't have a diagram for it. + ?? are modifiers, which are read directly, not through the 8x9 scan matrix. +*/ +// Italian layout (QZERTY typewriter) +static INPUT_PORTS_START( m20_keyboard ) + PORT_START("LINE0") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_CHAR('<') PORT_CHAR('>') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + + PORT_START("LINE1") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR(',') PORT_CHAR('?') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + + PORT_START("LINE2") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + + PORT_START("LINE3") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR(0x00e0U) PORT_CHAR('0') // a grave + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR(0x00a3U) PORT_CHAR('1') // pound + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR(0x00e9U) PORT_CHAR('2') // e acute + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('"') PORT_CHAR('3') + + PORT_START("LINE4") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('\'') PORT_CHAR('4') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('(') PORT_CHAR('5') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('_') PORT_CHAR('6') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR(0x00e8U) PORT_CHAR('7') // e grave + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('^') PORT_CHAR('8') + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR(0x00e7U) PORT_CHAR('9') // c cedilla + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(')') PORT_CHAR(0x00b0U) // degree + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('+') + + PORT_START("LINE5") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00ecU) PORT_CHAR('=') // i grave + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('$') PORT_CHAR('&') + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00f9U) PORT_CHAR('%') // u grave + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('*') PORT_CHAR(0x00a7U) // section + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(';') PORT_CHAR('.') + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR(':') PORT_CHAR('/') + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR(0x00f2U) PORT_CHAR('!') // o grave + + PORT_START("LINE6") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x000dU) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S1") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S2") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 00") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + + PORT_START("LINE7") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + + PORT_START("LINE8") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + PORT_BIT(0xf0,IP_ACTIVE_HIGH,IPT_UNUSED) + + PORT_START("MODIFIERS") + PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("COMMAND") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L SHIFT") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0xf0,IP_ACTIVE_HIGH,IPT_UNUSED) +INPUT_PORTS_END +} // anonymous namespace + + +m20_keyboard_device::m20_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) + : buffered_rs232_device(mconfig, M20_KEYBOARD, "M20 Keyboard", tag, owner, 0, "m20_keyboard", __FILE__) + , device_matrix_keyboard_interface(mconfig, *this, "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", "LINE8") + , m_modifiers(*this, "MODIFIERS") { } -void m20_keyboard_device::write(UINT8 data) + +ioport_constructor m20_keyboard_device::device_input_ports() const { - switch(data) - { - case 0x03: - send_key(2); - break; - case 0x80: - send_key(0x80); - break; - } - return; + return INPUT_PORTS_NAME(m20_keyboard); } -UINT8 m20_keyboard_device::keyboard_handler(UINT8 last_code, UINT8 *scan_line) + +void m20_keyboard_device::device_reset() { - int i = *scan_line, j; - UINT8 code = 0, state = m_state[i]; - - if (i == 0) code = m_io_kbd0->read(); - else - if (i == 1) code = m_io_kbd1->read(); - else - if (i == 2) code = m_io_kbd2->read(); - else - if (i == 3) code = m_io_kbd3->read(); - else - if (i == 4) code = m_io_kbd4->read(); - else - if (i == 5) code = m_io_kbd5->read(); - else - if (i == 6) code = m_io_kbd6->read(); - else - if (i == 7) code = m_io_kbd7->read(); - else - if (i == 8) code = m_io_kbd8->read(); - - *scan_line = (*scan_line + 1) % 9; - - if(m_state[i] == code) - return 0; - - m_state[i] = code; - code = (state ^ code) & code; - - if(!code) - return 0; - - for(j = 0; j < 8; j++) - if((code >> j) == 1) - break; - - if(i >= 6) - code = 0xc0 + ((i - 6) << 3) + j; - else - code = (i << 3) + j; - - state = m_io_kbd9->read(); - if(state && (i <= 8)) - { - switch(state) - { - case 1: - code += 0x90; - break; - case 2: - code += 0x60; - break; - case 4: - case 8: - code += 0x30; - break; - } - } + buffered_rs232_device::device_reset(); + + reset_key_state(); + clear_fifo(); - return code; + set_data_frame(1, 8, PARITY_NONE, STOP_BITS_2); + set_rate(1'200); + receive_register_reset(); + transmit_register_reset(); + + output_dcd(0); + output_dsr(0); + output_cts(0); + output_rxd(1); + + start_processing(attotime::from_hz(1'200)); } -// Italian layout -static INPUT_PORTS_START( m20_keyboard ) - PORT_START("TERM_LINE0") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("<") PORT_CODE(KEYCODE_LALT) PORT_CHAR('<') PORT_CHAR('>') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - - PORT_START("TERM_LINE1") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('?') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - - PORT_START("TERM_LINE2") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - - PORT_START("TERM_LINE3") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc3\xa0 0") PORT_CODE(KEYCODE_0) PORT_CHAR(0x85) PORT_CHAR('0') // a_GRAVE - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc2\xa3 1") PORT_CODE(KEYCODE_1) PORT_CHAR(0x9c) PORT_CHAR('1') // POUND - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(e_ACUTE " 2") PORT_CODE(KEYCODE_2) PORT_CHAR(0x82) PORT_CHAR('2') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\" 3") PORT_CODE(KEYCODE_3) PORT_CHAR('"') PORT_CHAR('3') - - PORT_START("TERM_LINE4") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("' 4") PORT_CODE(KEYCODE_4) PORT_CHAR('\'') PORT_CHAR('4') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("( 5") PORT_CODE(KEYCODE_5) PORT_CHAR('(') PORT_CHAR('5') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_ 6") PORT_CODE(KEYCODE_6) PORT_CHAR('_') PORT_CHAR('6') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc3\xa8 7") PORT_CODE(KEYCODE_7) PORT_CHAR(0x8a) PORT_CHAR('7') // e_GRAVE - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^ 8") PORT_CODE(KEYCODE_8) PORT_CHAR('^') PORT_CHAR('8') - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc3\xa7 9") PORT_CODE(KEYCODE_9) PORT_CHAR(0x87) PORT_CHAR('9') // c_CEDILLA - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(") \xc2\xb0") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(')') PORT_CHAR(0xa7) // DEGREE - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- +") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('+') - - PORT_START("TERM_LINE5") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc3\xac =") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x8d) PORT_CHAR('=') // i_GRAVE - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("$ &") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('$') PORT_CHAR('&') - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc3\xb9 %") PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x8a) PORT_CHAR('%') // u_GRAVE - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("* \xc2\xa7") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('*') PORT_CHAR(0xf5) // SECTION - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("; .") PORT_CODE(KEYCODE_STOP) PORT_CHAR(';') PORT_CHAR('.') - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(": /") PORT_CODE(KEYCODE_SLASH) PORT_CHAR(':') PORT_CHAR('/') - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc3\xb2") PORT_CODE(KEYCODE_RALT) PORT_CHAR(0x95) - - PORT_START("TERM_LINE6") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S1") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S2") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Keypad 00") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) - - PORT_START("TERM_LINE7") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) - PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) - PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) - PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) - PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) - - PORT_START("TERM_LINE8") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) - - PORT_START("TERM_LINE9") - PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("COMMAND") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) - - PORT_START("TERM_LINEC") - - PORT_START("RS232_TXBAUD") - PORT_CONFNAME(0xff, RS232_BAUD_1200, "TX Baud") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_BAUD_1200, "1200") - - PORT_START("RS232_STARTBITS") - PORT_CONFNAME(0xff, RS232_STARTBITS_1, "Start Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_STARTBITS_1, "1") - - PORT_START("RS232_DATABITS") - PORT_CONFNAME(0xff, RS232_DATABITS_8, "Data Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_DATABITS_8, "8") - - PORT_START("RS232_PARITY") - PORT_CONFNAME(0xff, RS232_PARITY_NONE, "Parity") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_PARITY_NONE, "None") - - PORT_START("RS232_STOPBITS") - PORT_CONFNAME(0xff, RS232_STOPBITS_2, "Stop Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_STOPBITS_2, "2") -INPUT_PORTS_END -ioport_constructor m20_keyboard_device::device_input_ports() const +void m20_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - return INPUT_PORTS_NAME(m20_keyboard); + device_matrix_keyboard_interface::device_timer(timer, id, param, ptr); + buffered_rs232_device::device_timer(timer, id, param, ptr); } -void m20_keyboard_device::device_start() + +void m20_keyboard_device::key_make(UINT8 row, UINT8 column) { - serial_keyboard_device::device_start(); - memset(m_state, '\0', sizeof(m_state)); - set_rcv_rate(1200); + UINT8 const row_code(((row < 6U) ? row : (0x18U | (row - 6U))) << 3); + UINT8 const modifiers(m_modifiers->read()); + UINT8 mod_code(0U); + switch (modifiers) + { + case 0x01U: // COMMAND + mod_code = 0x90; + break; + case 0x02U: // CTRL + mod_code = 0x60; + break; + case 0x04U: // RSHIFT + case 0x08U: // LSHIFT + case 0x0cU: // LSHIFT|RSHIFT + mod_code = 0x30; + break; + } + transmit_byte((row_code | column) + mod_code); } -void m20_keyboard_device::rcv_complete() + +void m20_keyboard_device::received_byte(UINT8 byte) { - receive_register_extract(); - write(get_received_char()); + switch (byte) + { + case 0x03U: + transmit_byte(0x02U); + break; + case 0x80U: + transmit_byte(0x80U); + break; + default: + logerror("received unknown command %02x", byte); + } } + const device_type M20_KEYBOARD = &device_creator<m20_keyboard_device>; diff --git a/src/mame/machine/m20_kbd.h b/src/mame/machine/m20_kbd.h index 3cade9c11e4..dfbd6d71a62 100644 --- a/src/mame/machine/m20_kbd.h +++ b/src/mame/machine/m20_kbd.h @@ -1,26 +1,28 @@ // license:BSD-3-Clause -// copyright-holders:Carl -#ifndef M20KBD_H_ -#define M20KBD_H_ +// copyright-holders:Carl,Vas Crabb +#ifndef MAME_MACHINE_M20KBD_H +#define MAME_MACHINE_M20KBD_H -#include "bus/rs232/keyboard.h" +#include "bus/rs232/rs232.h" +#include "machine/keyboard.h" -class m20_keyboard_device : public serial_keyboard_device +class m20_keyboard_device : public buffered_rs232_device<16U>, protected device_matrix_keyboard_interface<9U> { public: m20_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual ioport_constructor device_input_ports() const override; protected: - virtual void device_start() override; - virtual void rcv_complete() override; + virtual void device_reset() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void key_make(UINT8 row, UINT8 column) override; private: - void write(UINT8 data); - virtual UINT8 keyboard_handler(UINT8 last_code, UINT8 *scan_line) override; - UINT8 m_state[16]; + virtual void received_byte(UINT8 byte) override; + + required_ioport m_modifiers; }; extern const device_type M20_KEYBOARD; -#endif /* M20KBD_H_ */ +#endif // MAME_MACHINE_M20KBD_H diff --git a/src/mame/machine/megadriv.cpp b/src/mame/machine/megadriv.cpp index f52ef84af32..2c0707d5587 100644 --- a/src/mame/machine/megadriv.cpp +++ b/src/mame/machine/megadriv.cpp @@ -788,7 +788,6 @@ VIDEO_START_MEMBER(md_base_state,megadriv) MACHINE_START_MEMBER(md_base_state,megadriv) { - m_io_reset = ioport("RESET"); m_io_pad_3b[0] = ioport("PAD1"); m_io_pad_3b[1] = ioport("PAD2"); m_io_pad_3b[2] = ioport("IN0"); diff --git a/src/mame/machine/ngen_kb.cpp b/src/mame/machine/ngen_kb.cpp index 4c901ea5d41..960cc97f3c7 100644 --- a/src/mame/machine/ngen_kb.cpp +++ b/src/mame/machine/ngen_kb.cpp @@ -1,12 +1,19 @@ // license:BSD-3-Clause // copyright-holders:Barry Rodewald // Convergent NGEN keyboard device +/* + TODO: represent the real layout/scancodes for this keyboard. The + current HLE just sends ASCII and hopes, with an additional 0xc0 + "last key up" code. We're also inheriting typematic behaviour from + the serial keyboard which may not be desirable. +*/ #include "ngen_kb.h" -ngen_keyboard_device::ngen_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) : - serial_keyboard_device(mconfig, NGEN_KEYBOARD, "NGEN Keyboard", tag, owner, 0, "ngen_keyboard", __FILE__), - m_keys_down(false) +ngen_keyboard_device::ngen_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) + : serial_keyboard_device(mconfig, NGEN_KEYBOARD, "NGEN Keyboard", tag, owner, 0, "ngen_keyboard", __FILE__) + , m_keys_down(0U) + , m_last_reset(0U) { } @@ -21,164 +28,12 @@ void ngen_keyboard_device::write(UINT8 data) logerror("KB: received character %02x\n",data); switch(data) { - case 0x92: // reset(?) - m_last_reset = true; - break; + case 0x92U: // reset(?) + m_last_reset = 0x01U; + break; } } -UINT8 ngen_keyboard_device::row_number(UINT8 code) -{ - if BIT(code,0) return 0; - if BIT(code,1) return 1; - if BIT(code,2) return 2; - if BIT(code,3) return 3; - if BIT(code,4) return 4; - if BIT(code,5) return 5; - if BIT(code,6) return 6; - if BIT(code,7) return 7; - return 0; -} - -UINT8 ngen_keyboard_device::keyboard_handler(UINT8 last_code, UINT8 *scan_line) -{ - int i; - UINT8 code = 0; - UINT8 key_code = 0; - UINT8 retVal = 0x00; - UINT8 shift = BIT(m_io_kbdc->read(), 1); - UINT8 caps = BIT(m_io_kbdc->read(), 2); - UINT8 ctrl = BIT(m_io_kbdc->read(), 0); - i = *scan_line; - { - if (i == 0) code = m_io_kbd0->read(); - else - if (i == 1) code = m_io_kbd1->read(); - else - if (i == 2) code = m_io_kbd2->read(); - else - if (i == 3) code = m_io_kbd3->read(); - else - if (i == 4) code = m_io_kbd4->read(); - else - if (i == 5) code = m_io_kbd5->read(); - else - if (i == 6) code = m_io_kbd6->read(); - else - if (i == 7) code = m_io_kbd7->read(); - else - if (i == 8) code = m_io_kbd8->read(); - else - if (i == 9) code = m_io_kbd9->read(); - - if (code != 0) - { - if (i==0 && shift==0) { - key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs - } - if (i==0 && shift==1) { - key_code = 0x20 + row_number(code) + 8*i; // for shifted numbers - } - if (i==1 && shift==0) { - if (row_number(code) < 4) { - key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs - } else { - key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs - } - } - if (i==1 && shift==1) { - if (row_number(code) < 4) { - key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs - } else { - key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs - } - } - if (i>=2 && i<=4 && (shift ^ caps)==0 && ctrl==0) { - key_code = 0x60 + row_number(code) + (i-2)*8; // for small letters - } - if (i>=2 && i<=4 && (shift ^ caps)==1 && ctrl==0) { - key_code = 0x40 + row_number(code) + (i-2)*8; // for big letters - } - if (i>=2 && i<=5 && ctrl==1) { - key_code = 0x00 + row_number(code) + (i-2)*8; // for CTRL + letters - } - if (i==5 && shift==1 && ctrl==0) { - if (row_number(code)<7) { - if (row_number(code)<3) { - key_code = (caps ? 0x60 : 0x40) + row_number(code) + (i-2)*8; // for big letters - } else { - key_code = 0x60 + row_number(code) + (i-2)*8; // for upper symbols letters - } - } else { - key_code = 0x40 + row_number(code) + (i-2)*8; // for DEL it is switched - } - } - if (i==5 && shift==0 && ctrl==0) { - if (row_number(code)<7) { - if (row_number(code)<3) { - key_code = (caps ? 0x40 : 0x60) + row_number(code) + (i-2)*8; // for small letters - } else { - key_code = 0x40 + row_number(code) + (i-2)*8; // for lower symbols letters - } - } else { - key_code = 0x60 + row_number(code) + (i-2)*8; // for DEL it is switched - } - } - - if (i==6) { - switch(row_number(code)) - { -/* case 0: key_code = 0x11; break; - case 1: key_code = 0x12; break; - case 2: key_code = 0x13; break; - case 3: key_code = 0x14; break;*/ - case 4: key_code = 0x20; break; // Space - case 5: key_code = 0x0A; break; // LineFeed - case 6: key_code = 0x09; break; // TAB - case 7: key_code = 0x0D; break; // Enter - } - } - if (i==7) - { - switch(row_number(code)) - { - case 0: key_code = 0x1B; break; // Escape - case 1: key_code = 0x08; break; // Backspace - } - } - else - if (i==8) - { - key_code = row_number(code)+0x81; - if (ctrl) key_code+=0x10; - if (shift) key_code+=0x20; - } - else - if (i==9) - { - key_code = row_number(code)+0x89; - if (ctrl) key_code+=0x10; - if (shift) key_code+=0x20; - } - m_keys_down = true; - m_last_reset = false; - retVal = key_code; - } - else - { - *scan_line += 1; - if (*scan_line==10) - *scan_line = 0; - if(m_keys_down) - { - retVal = 0xc0; - m_keys_down = false; - } - } - } - return retVal; -} - static INPUT_PORTS_START( ngen_keyboard ) PORT_INCLUDE(generic_keyboard) @@ -212,14 +67,19 @@ ioport_constructor ngen_keyboard_device::device_input_ports() const void ngen_keyboard_device::device_start() { serial_keyboard_device::device_start(); + + save_item(NAME(m_keys_down)); + save_item(NAME(m_last_reset)); + set_rcv_rate(19200); } void ngen_keyboard_device::device_reset() { serial_keyboard_device::device_reset(); - m_keys_down = false; - m_last_reset = true; + + m_keys_down = UINT8(~0U); + m_last_reset = 0U; } void ngen_keyboard_device::rcv_complete() @@ -228,4 +88,21 @@ void ngen_keyboard_device::rcv_complete() write(get_received_char()); } +void ngen_keyboard_device::key_make(UINT8 row, UINT8 column) +{ + serial_keyboard_device::key_make(row, column); + m_keys_down = UINT8((row << 4) | column); + m_last_reset = 0U; +} + +void ngen_keyboard_device::key_break(UINT8 row, UINT8 column) +{ + serial_keyboard_device::key_break(row, column); + if (m_keys_down == UINT8((row << 4) | column)) + { + m_keys_down = UINT8(~0U); + send_key(0xc0U); + } +} + const device_type NGEN_KEYBOARD = &device_creator<ngen_keyboard_device>; diff --git a/src/mame/machine/ngen_kb.h b/src/mame/machine/ngen_kb.h index 1270077bf99..5b181cd0db6 100644 --- a/src/mame/machine/ngen_kb.h +++ b/src/mame/machine/ngen_kb.h @@ -2,8 +2,8 @@ // copyright-holders:Barry Rodewald // Convergent NGEN keyboard -#ifndef NGEN_KB_H_ -#define NGEN_KB_H_ +#ifndef MAME_MACHINE_NGEN_KB_H +#define MAME_MACHINE_NGEN_KB_H #include "bus/rs232/keyboard.h" @@ -12,22 +12,21 @@ class ngen_keyboard_device : public serial_keyboard_device public: ngen_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual ioport_constructor device_input_ports() const override; - virtual DECLARE_WRITE_LINE_MEMBER( input_txd ) override { device_serial_interface::rx_w(state); } protected: virtual void device_start() override; virtual void device_reset() override; virtual void rcv_complete() override; + virtual void key_make(UINT8 row, UINT8 column) override; + virtual void key_break(UINT8 row, UINT8 column) override; private: - virtual UINT8 keyboard_handler(UINT8 last_code, UINT8 *scan_line) override; - UINT8 row_number(UINT8 code); void write(UINT8 data); - bool m_keys_down; - bool m_last_reset; + UINT8 m_keys_down; + UINT8 m_last_reset; }; extern const device_type NGEN_KEYBOARD; -#endif /* NGENKB_H_ */ +#endif // MAME_MACHINE_NGEN_KB_H diff --git a/src/mame/machine/opwolf.cpp b/src/mame/machine/opwolf.cpp index 9bb86e05f0c..5f738556857 100644 --- a/src/mame/machine/opwolf.cpp +++ b/src/mame/machine/opwolf.cpp @@ -95,11 +95,11 @@ Bootleg doesn't support service switch If you die after round 6 then the bootleg fails to reset the difficulty for the next game. - The bootleg does not contain data for the 3 mini-levels ('Enemy has located you'), - instead it prevents them running by writing 0 to location 70 in the shared memory. - The bootleg does not play the special powder magazine (level 4) animation. - The bootleg does not vertically scroll the screen when all men killed in level 5 - The bootleg does not update the enemy spawn tables at various points. + The bootleg does not contain data for the 3 mini-levels ('Enemy has located you'), + instead it prevents them running by writing 0 to location 70 in the shared memory. + The bootleg does not play the special powder magazine (level 4) animation. + The bootleg does not vertically scroll the screen when all men killed in level 5 + The bootleg does not update the enemy spawn tables at various points. Notes by bmcphail@vcmame.net @@ -645,11 +645,11 @@ WRITE16_MEMBER(opwolf_state::opwolf_cchip_data_w) { //int logValue=1; //if (offset==0x1c && offset==0x1d && offset==0x1e && offset==0x1f && offset==0x20) // Enemies, tanks, choppers, boats - // logValue=0; + // logValue=0; //if (offset==0x50 && offset==0x51 && offset==0x52 && offset==0x53) // Coins - // logValue=0; + // logValue=0; //if (logValue) - // logerror("%08x: opwolf 68K writes c-chip %02x at %04x/%04x (bank %04x)\n", space.device().safe_pc(), data & 0xff, offset*2, offset, m_current_bank); + // logerror("%08x: opwolf 68K writes c-chip %02x at %04x/%04x (bank %04x)\n", space.device().safe_pc(), data & 0xff, offset*2, offset, m_current_bank); m_cchip_ram[(m_current_bank * 0x400) + offset] = data & 0xff; @@ -756,13 +756,13 @@ READ16_MEMBER(opwolf_state::opwolf_cchip_data_r) //int logValue=1; //if (offset==0x1c || offset==0x1d || offset==0x1e || offset==0x1f || offset==0x20) // Enemies, tanks, choppers, boats - // logValue=0; + // logValue=0; //if (offset==0x50 || offset==0x51 || offset==0x52 || offset==0x53) // Coins - // logValue=0; + // logValue=0; //if (space.device().safe_pc()==0xc18 && space.device().safe_pc()!=0xc2e && space.device().safe_pc()!=0xc9e) - // logValue=0; + // logValue=0; //if (logValue) - // logerror("%08x: opwolf 68K reads c-chip at %04x/%04x (bank %04x)\n", space.device().safe_pc(), offset*2, offset, m_current_bank); + // logerror("%08x: opwolf 68K reads c-chip at %04x/%04x (bank %04x)\n", space.device().safe_pc(), offset*2, offset, m_current_bank); return m_cchip_ram[(m_current_bank * 0x400) + offset]; } @@ -782,7 +782,7 @@ TIMER_CALLBACK_MEMBER(opwolf_state::cchip_timer) // Dev Cheat - kill all enemeies //if ((ioport("IN1")->read()&0x10)!=0x10) //{ - // m_cchip_ram[0x1c] = m_cchip_ram[0x1d] = m_cchip_ram[0x1e] = m_cchip_ram[0x1f] = m_cchip_ram[0x20] = 0; + // m_cchip_ram[0x1c] = m_cchip_ram[0x1d] = m_cchip_ram[0x1e] = m_cchip_ram[0x1f] = m_cchip_ram[0x20] = 0; //} // Coin slots @@ -888,7 +888,7 @@ TIMER_CALLBACK_MEMBER(opwolf_state::cchip_timer) // When level 4 (powder magazine) is complete the c-chip triggers an explosion animation. if (m_triggeredLevel4==0 && m_cchip_ram[0x5f]==0) // Don't write unless 68K is ready (0 at 0x5f)) - { + { m_cchip_ram[0x5f]=10; m_triggeredLevel4=1; } diff --git a/src/mame/machine/qx10kbd.cpp b/src/mame/machine/qx10kbd.cpp index 1a4c7364c06..e1eb21574d2 100644 --- a/src/mame/machine/qx10kbd.cpp +++ b/src/mame/machine/qx10kbd.cpp @@ -1,105 +1,82 @@ // license:BSD-3-Clause // copyright-holders:Carl -// TODO: dump 8049 mcu; key repeat +// TODO: dump 8049 mcu; key repeat; LEDs #include "machine/qx10kbd.h" -qx10_keyboard_device::qx10_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) : - serial_keyboard_device(mconfig, QX10_KEYBOARD, "QX10 Keyboard", tag, owner, 0, "qx10_keyboard", __FILE__), - m_io_kbd8(*this, "TERM_LINE8"), - m_io_kbd9(*this, "TERM_LINE9"), - m_io_kbda(*this, "TERM_LINEA"), - m_io_kbdb(*this, "TERM_LINEB"), - m_io_kbdd(*this, "TERM_LINED"), - m_io_kbde(*this, "TERM_LINEE"), - m_io_kbdf(*this, "TERM_LINEF") +#include "machine/keyboard.ipp" + + +qx10_keyboard_device::qx10_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) + : buffered_rs232_device(mconfig, QX10_KEYBOARD, "QX10 Keyboard", tag, owner, 0, "qx10_keyboard", __FILE__) + , device_matrix_keyboard_interface(mconfig, *this, "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", "LINE8", "LINE9", "LINEA", "LINEB", "LINEC", "LINED", "LINEE", "LINEF") { } -void qx10_keyboard_device::write(UINT8 data) + +void qx10_keyboard_device::device_reset() { - switch(data & 0xe0) - { - default: - break; - case 0x00: // set repeat start - break; - case 0x20: // set repeat interval - break; - case 0x40: // set LED - break; - case 0x60: // get LED - send_key(0); - break; - case 0x80: // get SW - break; - case 0xa0: // set repeat - break; - case 0xc0: // enable keyboard - break; - case 0xe0: - if(!(data & 1)) - send_key(0); - break; - } - return; + buffered_rs232_device::device_reset(); + + reset_key_state(); + clear_fifo(); + + set_data_frame(1, 8, PARITY_EVEN, STOP_BITS_1); + set_rate(1'200); + receive_register_reset(); + transmit_register_reset(); + + output_dcd(0); + output_dsr(0); + output_cts(0); + output_rxd(1); + + start_processing(attotime::from_hz(2'400)); +} + + +void qx10_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + device_matrix_keyboard_interface::device_timer(timer, id, param, ptr); + buffered_rs232_device::device_timer(timer, id, param, ptr); } -UINT8 qx10_keyboard_device::keyboard_handler(UINT8 last_code, UINT8 *scan_line) + +void qx10_keyboard_device::key_make(UINT8 row, UINT8 column) { - int i = *scan_line, j; - UINT8 code = 0; - - if (i == 0) code = m_io_kbd0->read(); - else - if (i == 1) code = m_io_kbd1->read(); - else - if (i == 2) code = m_io_kbd2->read(); - else - if (i == 3) code = m_io_kbd3->read(); - else - if (i == 4) code = m_io_kbd4->read(); - else - if (i == 5) code = m_io_kbd5->read(); - else - if (i == 6) code = m_io_kbd6->read(); - else - if (i == 7) code = m_io_kbd7->read(); - else - if (i == 8) code = m_io_kbd8->read(); - else - if (i == 9) code = m_io_kbd9->read(); - else - if (i == 10) code = m_io_kbda->read(); - else - if (i == 11) code = m_io_kbdb->read(); - else - if (i == 12) code = m_io_kbdc->read(); - else - if (i == 13) code = m_io_kbdd->read(); - else - if (i == 14) code = m_io_kbde->read(); - else - if (i == 15) code = m_io_kbdf->read(); - - *scan_line = (*scan_line + 1) % 16; - - if(m_state[i] == code) - return 0; - - m_state[i] = code; - - if(!code) - return 0; - - for(j = 0; j < 8; j++) - if((code >> j) == 1) break; - - return (j << 4) + i; + transmit_byte((column << 4) | row); } + +void qx10_keyboard_device::received_byte(UINT8 data) +{ + switch (data & 0xe0) + { + case 0x00: // set repeat start + break; + case 0x20: // set repeat interval + break; + case 0x40: // set LED + break; + case 0x60: // get LED + transmit_byte(0); + break; + case 0x80: // get SW + break; + case 0xa0: // set repeat + break; + case 0xc0: // enable keyboard + break; + case 0xe0: + if (!(data & 1)) + transmit_byte(0); + break; + } +} + + static INPUT_PORTS_START( qx10_keyboard ) - PORT_START("TERM_LINE0") + PORT_START("LINE0") PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_UNUSED) PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_UNUSED) PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RSHIFT") @@ -109,7 +86,7 @@ static INPUT_PORTS_START( qx10_keyboard ) PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("GRPH SHIFT") PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("LCTRL") PORT_CODE(KEYCODE_LCONTROL) - PORT_START("TERM_LINE1") + PORT_START("LINE1") PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F4/UNDO") PORT_CODE(KEYCODE_F4) PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_UNUSED) PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_UNUSED) @@ -119,7 +96,7 @@ static INPUT_PORTS_START( qx10_keyboard ) PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F3/COPY DISK") PORT_CODE(KEYCODE_F3) - PORT_START("TERM_LINE2") + PORT_START("LINE2") PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F5/(H1)") PORT_CODE(KEYCODE_F5) PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_UNUSED) PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_UNUSED) @@ -129,7 +106,7 @@ static INPUT_PORTS_START( qx10_keyboard ) PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F2/HELP") PORT_CODE(KEYCODE_F2) - PORT_START("TERM_LINE3") + PORT_START("LINE3") PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F6/STORE") PORT_CODE(KEYCODE_F6) PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_UNUSED) PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_UNUSED) @@ -139,7 +116,7 @@ static INPUT_PORTS_START( qx10_keyboard ) PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F1/STOP") PORT_CODE(KEYCODE_F1) - PORT_START("TERM_LINE4") + PORT_START("LINE4") PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F7/RETRIEVE") PORT_CODE(KEYCODE_F7) PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_UNUSED) PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_UNUSED) @@ -149,7 +126,7 @@ static INPUT_PORTS_START( qx10_keyboard ) PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("MAR SEL") - PORT_START("TERM_LINE5") + PORT_START("LINE5") PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F8/PRINT") PORT_CODE(KEYCODE_F8) PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ENTER (PAD)") PORT_CODE(KEYCODE_ENTER_PAD) PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3 (PAD)") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') @@ -159,7 +136,7 @@ static INPUT_PORTS_START( qx10_keyboard ) PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC/^") PORT_CODE(KEYCODE_ESC) - PORT_START("TERM_LINE6") + PORT_START("LINE6") PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F9/INDEX") PORT_CODE(KEYCODE_F9) PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". (PAD)") PORT_CODE(KEYCODE_DEL_PAD) PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2 (PAD)") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') @@ -169,7 +146,7 @@ static INPUT_PORTS_START( qx10_keyboard ) PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_START("TERM_LINE7") + PORT_START("LINE7") PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F10/MAIL") PORT_CODE(KEYCODE_F10) PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0 (PAD)") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1 (PAD)") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') @@ -179,7 +156,7 @@ static INPUT_PORTS_START( qx10_keyboard ) PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) - PORT_START("TERM_LINE8") + PORT_START("LINE8") PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(H2)") PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("= (PAD)") PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("+ (PAD)") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') @@ -189,7 +166,7 @@ static INPUT_PORTS_START( qx10_keyboard ) PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("TAB SET") - PORT_START("TERM_LINE9") + PORT_START("LINE9") PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BREAK/MENU") PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6 (PAD)") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9 (PAD)") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') @@ -199,7 +176,7 @@ static INPUT_PORTS_START( qx10_keyboard ) PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_START("TERM_LINEA") + PORT_START("LINEA") PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PAUSE/CALC") PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5 (PAD)") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8 (PAD)") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') @@ -209,7 +186,7 @@ static INPUT_PORTS_START( qx10_keyboard ) PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_START("TERM_LINEB") + PORT_START("LINEB") PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SCRN DUMP/SCHED") PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4 (PAD)") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7 (PAD)") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') @@ -219,7 +196,7 @@ static INPUT_PORTS_START( qx10_keyboard ) PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("=") PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_START("TERM_LINEC") + PORT_START("LINEC") PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HELP/DRAW") PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(H5)") PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- (PAD)") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('-') @@ -229,7 +206,7 @@ static INPUT_PORTS_START( qx10_keyboard ) PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_START("TERM_LINED") + PORT_START("LINED") PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("(H3)") PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("MF4/(H4)") PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("* (PAD)") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') @@ -239,7 +216,7 @@ static INPUT_PORTS_START( qx10_keyboard ) PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_START("TERM_LINEE") + PORT_START("LINEE") PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BOLD") PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("MF3/STYLE") PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ (PAD)") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('/') @@ -249,7 +226,7 @@ static INPUT_PORTS_START( qx10_keyboard ) PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D-7") PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_START("TERM_LINEF") + PORT_START("LINEF") PORT_BIT(0x01,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("MF1/ITALIC") PORT_BIT(0x02,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("MF2/SIZE") PORT_BIT(0x04,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("`/DEC TAB") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') @@ -258,26 +235,6 @@ static INPUT_PORTS_START( qx10_keyboard ) PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL/WORD") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_BIT(0x40,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CLS/LINE") PORT_BIT(0x80,IP_ACTIVE_HIGH,IPT_UNUSED) - - PORT_START("RS232_TXBAUD") - PORT_CONFNAME(0xff, RS232_BAUD_1200, "TX Baud") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_BAUD_1200, "1200") - - PORT_START("RS232_STARTBITS") - PORT_CONFNAME(0xff, RS232_STARTBITS_1, "Start Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_STARTBITS_1, "1") - - PORT_START("RS232_DATABITS") - PORT_CONFNAME(0xff, RS232_DATABITS_8, "Data Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_DATABITS_8, "8") - - PORT_START("RS232_PARITY") - PORT_CONFNAME(0xff, RS232_PARITY_EVEN, "Parity") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_PARITY_EVEN, "Even") - - PORT_START("RS232_STOPBITS") - PORT_CONFNAME(0xff, RS232_STOPBITS_1, "Stop Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_STOPBITS_1, "1") INPUT_PORTS_END ioport_constructor qx10_keyboard_device::device_input_ports() const @@ -285,17 +242,5 @@ ioport_constructor qx10_keyboard_device::device_input_ports() const return INPUT_PORTS_NAME(qx10_keyboard); } -void qx10_keyboard_device::device_start() -{ - serial_keyboard_device::device_start(); - memset(m_state, '\0', sizeof(m_state)); - set_rcv_rate(1200); -} - -void qx10_keyboard_device::rcv_complete() -{ - receive_register_extract(); - write(get_received_char()); -} const device_type QX10_KEYBOARD = &device_creator<qx10_keyboard_device>; diff --git a/src/mame/machine/qx10kbd.h b/src/mame/machine/qx10kbd.h index 4adb6ebb9a4..f77b1b06c31 100644 --- a/src/mame/machine/qx10kbd.h +++ b/src/mame/machine/qx10kbd.h @@ -1,35 +1,25 @@ // license:BSD-3-Clause // copyright-holders:Carl -#ifndef QX10KBD_H_ -#define QX10KBD_H_ +#ifndef MAME_MACHINE_QX10KBD_H +#define MAME_MACHINE_QX10KBD_H #include "bus/rs232/keyboard.h" -class qx10_keyboard_device : public serial_keyboard_device +class qx10_keyboard_device : public buffered_rs232_device<16U>, protected device_matrix_keyboard_interface<16U> { public: qx10_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual ioport_constructor device_input_ports() const override; protected: - virtual void device_start() override; - virtual void rcv_complete() override; + virtual void device_reset() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void key_make(UINT8 row, UINT8 column) override; private: - virtual UINT8 keyboard_handler(UINT8 last_code, UINT8 *scan_line) override; - void write(UINT8 data); - - required_ioport m_io_kbd8; - required_ioport m_io_kbd9; - required_ioport m_io_kbda; - required_ioport m_io_kbdb; - required_ioport m_io_kbdd; - required_ioport m_io_kbde; - required_ioport m_io_kbdf; - - UINT8 m_state[16]; + virtual void received_byte(UINT8 data) override; }; extern const device_type QX10_KEYBOARD; -#endif /* QX10KBD_H_ */ +#endif // MAME_MACHINE_QX10KBD_H diff --git a/src/mame/machine/rmnkbd.cpp b/src/mame/machine/rmnkbd.cpp index 30987c6701e..71d73fe3a7d 100644 --- a/src/mame/machine/rmnkbd.cpp +++ b/src/mame/machine/rmnkbd.cpp @@ -1,209 +1,179 @@ // license:BSD-3-Clause -// copyright-holders:Carl +// copyright-holders:Carl,Vas Crabb #include "machine/rmnkbd.h" -rmnimbus_keyboard_device::rmnimbus_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) : - serial_keyboard_device(mconfig, RMNIMBUS_KEYBOARD, "RM Nimbus Keyboard", tag, owner, 0, "rmnimbus_keyboard", __FILE__), - m_io_kbd8(*this, "TERM_LINE8"), - m_io_kbd9(*this, "TERM_LINE9"), - m_io_kbda(*this, "TERM_LINEA") -{ -} +#include "machine/keyboard.ipp" + + +namespace { +INPUT_PORTS_START( rmnimbus_keyboard ) + PORT_START("LINE0") // Key row 0 scancodes 00..07 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x001bU) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0x00a3U) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + + PORT_START("LINE1") // Key row 1 scancodes 08..0F + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(0x0008U) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(0x0009U) + + PORT_START("LINE2") // Key row 2 scancodes 10..17 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + + PORT_START("LINE3") // Key row 3 scancodes 18..1F + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0D) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) // Either control + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + + PORT_START("LINE4") // Key row 4 scancodes 20..27 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + + PORT_START("LINE5") // Key row 5 scancodes 28..2F + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('@') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('#') PORT_CHAR('~') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LSHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + + PORT_START("LINE6") // Key row 6 scancodes 30..37 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PRT SC") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) + + PORT_START("LINE7") // Key row 7 scancodes 38..3F + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ALT") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) // Either alt + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + + PORT_START("LINE8") // Key row 8 scancodes 40..47 + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NUM LOCK") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SCROLL LOCK") PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + + PORT_START("LINE9") // Key row 9 scancodes 48..4F + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP-") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP+") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + + PORT_START("LINEA") /* Key row 10 scancodes 50..57 */ + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP.") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END +} // anonymous namespace + -UINT8 rmnimbus_keyboard_device::keyboard_handler(UINT8 last_code, UINT8 *scan_line) +rmnimbus_keyboard_device::rmnimbus_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) + : buffered_rs232_device(mconfig, RMNIMBUS_KEYBOARD, "RM Nimbus Keyboard", tag, owner, 0, "rmnimbus_keyboard", __FILE__) + , device_matrix_keyboard_interface(mconfig, *this, "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", "LINE8", "LINE9", "LINEA") { - int i = *scan_line, j; - UINT8 code = 0, change; - - if (i == 0) code = m_io_kbd0->read(); - else - if (i == 1) code = m_io_kbd1->read(); - else - if (i == 2) code = m_io_kbd2->read(); - else - if (i == 3) code = m_io_kbd3->read(); - else - if (i == 4) code = m_io_kbd4->read(); - else - if (i == 5) code = m_io_kbd5->read(); - else - if (i == 6) code = m_io_kbd6->read(); - else - if (i == 7) code = m_io_kbd7->read(); - else - if (i == 8) code = m_io_kbd8->read(); - else - if (i == 9) code = m_io_kbd9->read(); - else - if (i == 10) code = m_io_kbda->read(); - - *scan_line = (*scan_line + 1) % 11; - code = ~code; - - if(m_state[i] == code) - return 0; - - change = (m_state[i] ^ code); - - for(j = 0; j < 8; j++) - if((change >> j) == 1) break; - - change = (1 << j); - m_state[i] ^= change; - - return ((change & code) ? 0 : 0x80) | ((i << 3) + j); } -static INPUT_PORTS_START( rmnimbus_keyboard ) - PORT_START("TERM_LINE0") /* Key row 0 scancodes 00..07 */ - //PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1B) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - - PORT_START("TERM_LINE1") /* Key row 1 scancodes 08..0F */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(0x08) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(0x09) - - PORT_START("TERM_LINE2") /* Key row 2 scancodes 10..17 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - - PORT_START("TERM_LINE3") /* Key row 3 scancodes 18..1F */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0D) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) // Ether control - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - - PORT_START("TERM_LINE4") /* Key row 4 scancodes 20..27 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') - - PORT_START("TERM_LINE5") /* Key row 5 scancodes 28..2F */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("#") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('#') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSLASH") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LSHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TILDE") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - - - PORT_START("TERM_LINE6") /* Key row 6 scancodes 30..37 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PRSCR") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') - - PORT_START("TERM_LINE7") /* Key row 7 scancodes 38..3F */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ALT") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - - - PORT_START("TERM_LINE8") /* Key row 8 scancodes 40..47 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NUMLK") PORT_CODE(KEYCODE_NUMLOCK) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SCRLK") PORT_CODE(KEYCODE_SCRLOCK) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') - - PORT_START("TERM_LINE9") /* Key row 9 scancodes 48..4F */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP8") PORT_CODE(KEYCODE_8_PAD) //PORT_CHAR('8') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP9") PORT_CODE(KEYCODE_9_PAD) //PORT_CHAR('9') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP-") PORT_CODE(KEYCODE_MINUS_PAD) //PORT_CHAR('-') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP4") PORT_CODE(KEYCODE_4_PAD) //PORT_CHAR('4') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP5") PORT_CODE(KEYCODE_5_PAD) //PORT_CHAR('5') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP6") PORT_CODE(KEYCODE_6_PAD) //PORT_CHAR('6') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP+") PORT_CODE(KEYCODE_PLUS_PAD) //PORT_CHAR('+') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP1") PORT_CODE(KEYCODE_1_PAD) //PORT_CHAR('1') - - PORT_START("TERM_LINEA") /* Key row 10 scancodes 50..57 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP2") PORT_CODE(KEYCODE_2_PAD) //PORT_CHAR('2') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP3") PORT_CODE(KEYCODE_3_PAD) //PORT_CHAR('3') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP0") PORT_CODE(KEYCODE_0_PAD) //PORT_CHAR('0') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP.") PORT_CODE(KEYCODE_DEL_PAD) //PORT_CHAR('.') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) - //PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') - //PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') - //PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP+") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') - //PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') - - PORT_START("TERM_LINEC") - - PORT_START("RS232_TXBAUD") - PORT_CONFNAME(0xff, RS232_BAUD_9600, "TX Baud") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_BAUD_9600, "9600") - - PORT_START("RS232_STARTBITS") - PORT_CONFNAME(0xff, RS232_STARTBITS_1, "Start Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_STARTBITS_1, "1") - - PORT_START("RS232_DATABITS") - PORT_CONFNAME(0xff, RS232_DATABITS_8, "Data Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_DATABITS_8, "8") - - PORT_START("RS232_PARITY") - PORT_CONFNAME(0xff, RS232_PARITY_NONE, "Parity") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_PARITY_NONE, "None") - - PORT_START("RS232_STOPBITS") - PORT_CONFNAME(0xff, RS232_STOPBITS_1, "Stop Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_STOPBITS_1, "1") -INPUT_PORTS_END ioport_constructor rmnimbus_keyboard_device::device_input_ports() const { return INPUT_PORTS_NAME(rmnimbus_keyboard); } -void rmnimbus_keyboard_device::device_start() + +void rmnimbus_keyboard_device::device_reset() +{ + buffered_rs232_device::device_reset(); + + reset_key_state(); + clear_fifo(); + + set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1); + set_rate(9'600); + receive_register_reset(); + transmit_register_reset(); + + output_dcd(0); + output_dsr(0); + output_cts(0); + output_rxd(1); + + start_processing(attotime::from_hz(2'400)); +} + + +void rmnimbus_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - serial_keyboard_device::device_start(); - memset(m_state, '\0', sizeof(m_state)); + device_matrix_keyboard_interface::device_timer(timer, id, param, ptr); + buffered_rs232_device::device_timer(timer, id, param, ptr); } + +void rmnimbus_keyboard_device::key_make(UINT8 row, UINT8 column) +{ + transmit_byte((row << 3) | column); +} + + +void rmnimbus_keyboard_device::key_break(UINT8 row, UINT8 column) +{ + transmit_byte(0x80U | (row << 3) | column); +} + + +void rmnimbus_keyboard_device::received_byte(UINT8 byte) +{ + logerror("received command %02x", byte); +} + + const device_type RMNIMBUS_KEYBOARD = &device_creator<rmnimbus_keyboard_device>; diff --git a/src/mame/machine/rmnkbd.h b/src/mame/machine/rmnkbd.h index f60f600ac99..01cbce7f7ea 100644 --- a/src/mame/machine/rmnkbd.h +++ b/src/mame/machine/rmnkbd.h @@ -1,28 +1,27 @@ // license:BSD-3-Clause // copyright-holders:Carl -#ifndef RMNKBD_H_ -#define RMNKBD_H_ +#ifndef MAME_MACHINE_RMNKBD_H +#define MAME_MACHINE_RMNKBD_H -#include "bus/rs232/keyboard.h" +#include "bus/rs232/rs232.h" +#include "machine/keyboard.h" -class rmnimbus_keyboard_device : public serial_keyboard_device +class rmnimbus_keyboard_device : public buffered_rs232_device<16U>, protected device_matrix_keyboard_interface<11U> { public: rmnimbus_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual ioport_constructor device_input_ports() const override; protected: - virtual void device_start() override; + virtual void device_reset() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void key_make(UINT8 row, UINT8 column) override; + virtual void key_break(UINT8 row, UINT8 column) override; private: - virtual UINT8 keyboard_handler(UINT8 last_code, UINT8 *scan_line) override; - - required_ioport m_io_kbd8; - required_ioport m_io_kbd9; - required_ioport m_io_kbda; - UINT8 m_state[11]; + virtual void received_byte(UINT8 byte) override; }; extern const device_type RMNIMBUS_KEYBOARD; -#endif /* RMNKBD_H_ */ +#endif // MAME_MACHINE_RMNKBD_H diff --git a/src/mame/machine/seibucop/seibucop.cpp b/src/mame/machine/seibucop/seibucop.cpp index 72594e43513..280093b0835 100644 --- a/src/mame/machine/seibucop/seibucop.cpp +++ b/src/mame/machine/seibucop/seibucop.cpp @@ -49,18 +49,18 @@ - stage 4: has sprite stuck on bottom-left of screen; - palette dims too much on attract / continue screen. It's known that the DMA data arrangement gives same results on a real Legionnaire board, so shrug? - Seibu Cup Soccer - - Handles collision detection via the 130e/3bb0 macros - 130e version in this makes a sub instead of an add as last opcode, which in turn reflects with - the distance (which we do know that is internally loaded somehow). + Seibu Cup Soccer + - Handles collision detection via the 130e/3bb0 macros + 130e version in this makes a sub instead of an add as last opcode, which in turn reflects with + the distance (which we do know that is internally loaded somehow). d104 macro is called before this, it likely sets the range for the 130e snippets. Example snippet (note: there are multiple calls to 130e) 013F3C: 3D7C 130E 0100 move.w #$130e, ($100,A6) // angle macro 013F42: 302E 01B4 move.w ($1b4,A6), D0 // take the angle 013F46: 082E 000F 01B0 btst #$f, ($1b0,A6) // is status exception flag raised? 013F4C: 6712 beq $13f60 -013F4E: 2228 0004 move.l ($4,A0), D1 -013F52: B2A8 0044 cmp.l ($44,A0), D1 // compares Y value against the next object (yes, cop_regs[1] + 0x40 = cop_regs[0]) +013F4E: 2228 0004 move.l ($4,A0), D1 +013F52: B2A8 0044 cmp.l ($44,A0), D1 // compares Y value against the next object (yes, cop_regs[1] + 0x40 = cop_regs[0]) 013F56: 6708 beq $13f60 // if equal then check the distance 013F58: 6E04 bgt $13f5e 013F5A: 7040 moveq #$40, D0 // set angle direction left ... @@ -69,12 +69,12 @@ 013F60: 3D7C 3BB0 0100 move.w #$3bb0, ($100,A6) // dist macro 013F66: 1140 003D move.b D0, ($3d,A0) // move angle value to [0x3d] 013F6A: 4E75 rts - Zero Team - - Some faulty collision detection, e.g. crate in front of aquarium in stage 1 - - Bird Boss jumps to wrong direction - the sequence called is: - write to reg 4 then execute 0xfc84 and 0xf790, finally reads the distance. - + Zero Team + - Some faulty collision detection, e.g. crate in front of aquarium in stage 1 + - Bird Boss jumps to wrong direction + the sequence called is: + write to reg 4 then execute 0xfc84 and 0xf790, finally reads the distance. + Tech notes (to move into own file with doxy mainpage): ----------- [0x6fc] DMA mode bit scheme: @@ -83,16 +83,16 @@ ---- ---- ---x ---- internal buffer selector ---- ---- ---- x--- size modifier? Bus transfer size actually? ---- ---- ---- -xxx select channel - - work RAM object structure (in seibu cup soccer) - all object have a [0x40] boundary - [0x04-0x07] Y position - [0x08-0x0b] X position - [0x10-0x13] Y offset (a.k.a. calculated sine) - [0x14-0x17] X offset (a.k.a. calculated cosine) - [0x37] angle direction - TOC - [0x11381c] ball object + + work RAM object structure (in seibu cup soccer) + all object have a [0x40] boundary + [0x04-0x07] Y position + [0x08-0x0b] X position + [0x10-0x13] Y offset (a.k.a. calculated sine) + [0x14-0x17] X offset (a.k.a. calculated cosine) + [0x37] angle direction + TOC + [0x11381c] ball object ***************************************************************************/ @@ -316,7 +316,7 @@ WRITE16_MEMBER(raiden2cop_device::cop_pgm_data_w) cop_func_value[idx] = cop_latch_value; cop_func_mask[idx] = cop_latch_mask; bool upper_regs = ((cop_latch_trigger >> 10) & 1) == 1; // f1 - + if(data) { int off = data & 31; int reg = ((data >> 5) & 3) + (upper_regs == true ? 4 : 0); @@ -325,7 +325,7 @@ WRITE16_MEMBER(raiden2cop_device::cop_pgm_data_w) logerror("COPDIS: %04x s=%02x f1=%x l=%x f2=%02x %x %04x %02x %03x %02x.%x.%02x ", cop_latch_trigger, (cop_latch_trigger >> 11) << 3, (cop_latch_trigger >> 10) & 1, ((cop_latch_trigger >> 7) & 7)+1, cop_latch_trigger & 0x7f, cop_latch_value, cop_latch_mask, cop_latch_addr, data, op, reg, off); off *= 2; - + // COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 00 188 03.0.08 read32 10(r0) // COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 01 282 05.0.02 add32 4(r0) // COPDIS: 0205 s=00 f1=0 l=5 f2=05 6 ffeb 02 082 01.0.02 write32 4(r0) @@ -763,13 +763,13 @@ WRITE16_MEMBER(raiden2cop_device::cop_dma_trigger_w) case 0x85: case 0x86: case 0x87: - { + { dma_palette_brightness(); break; } /********************************************************************************************************************/ - case 0x09: + case 0x09: { UINT32 src, dst, size; int i; @@ -1145,7 +1145,7 @@ WRITE16_MEMBER( raiden2cop_device::cop_cmd_w) case 0x7e05: execute_7e05(offset, data); break; - + case 0xa100: case 0xa180: execute_a100(offset, data); // collisions @@ -1585,9 +1585,9 @@ WRITE16_MEMBER(raiden2cop_device::LEGACY_cop_cmd_w) return; } /* - [:raiden2cop] COPDIS: 5105 s=50 f1=0 l=3 f2=05 5 fefb 50 a80 15.0.00 [:raiden2cop] sub32 (r0) - [:raiden2cop] COPDIS: 5105 s=50 f1=0 l=3 f2=05 5 fefb 51 984 13.0.04 [:raiden2cop] write16h 8(r0) - [:raiden2cop] COPDIS: 5105 s=50 f1=0 l=3 f2=05 5 fefb 52 082 01.0.02 [:raiden2cop] addmem32 4(r0) + [:raiden2cop] COPDIS: 5105 s=50 f1=0 l=3 f2=05 5 fefb 50 a80 15.0.00 [:raiden2cop] sub32 (r0) + [:raiden2cop] COPDIS: 5105 s=50 f1=0 l=3 f2=05 5 fefb 51 984 13.0.04 [:raiden2cop] write16h 8(r0) + [:raiden2cop] COPDIS: 5105 s=50 f1=0 l=3 f2=05 5 fefb 52 082 01.0.02 [:raiden2cop] addmem32 4(r0) */ if (check_command_matches(command, 0xa80, 0x984, 0x082, 0x000, 0x000, 0x000, 0x000, 0x000, 5, 0xfefb)) @@ -1608,14 +1608,14 @@ WRITE16_MEMBER(raiden2cop_device::LEGACY_cop_cmd_w) printf("5905\n"); return; } - + // player to ball collision if (check_command_matches(command, 0xa88, 0x994, 0x088, 0x000, 0x000, 0x000, 0x000, 0x000, 5, 0xfefb)) { execute_f105(offset,data); return; } - + if (executed == 0) { printf("did not execute %04x\n", data); // cup soccer triggers this a lot (and others) diff --git a/src/mame/machine/seibucop/seibucop.h b/src/mame/machine/seibucop/seibucop.h index 88599840fc4..7802f791f3a 100644 --- a/src/mame/machine/seibucop/seibucop.h +++ b/src/mame/machine/seibucop/seibucop.h @@ -258,7 +258,7 @@ private: void LEGACY_execute_d104(int offset, UINT16 data); void LEGACY_execute_6980(int offset, UINT16 data); void LEGACY_execute_c480(int offset, UINT16 data); - + void cop_collision_update_hitbox(UINT16 data, int slot, UINT32 hitadr); void bcd_update(); diff --git a/src/mame/machine/seicop.cpp b/src/mame/machine/seicop.cpp index 5b1ba2b44a4..99e0a97daef 100644 --- a/src/mame/machine/seicop.cpp +++ b/src/mame/machine/seicop.cpp @@ -5,10 +5,10 @@ COPDX bootleg simulation - Seibu Cup Soccer (bootleg) - Notice that only the bare minimum is supported, which is what the bootleg device actually + Notice that only the bare minimum is supported, which is what the bootleg device actually provides. Unlike the original device and many other Seibu customs, it has no DMA. - Apparently it's an Actel PL84c FPGA programmed to be a Seibu COP clone. - The internal operations are actually loaded via the ROMs, we use the original algorithm + Apparently it's an Actel PL84c FPGA programmed to be a Seibu COP clone. + The internal operations are actually loaded via the ROMs, we use the original algorithm for the trigger until we find the proper hookup. ********************************************************************************************/ @@ -46,7 +46,7 @@ WRITE16_MEMBER(seibu_cop_bootleg_device::cmd_trigger_w) UINT8 offs; offs = (offset & 3) * 4; - + switch(data) { default: @@ -54,7 +54,7 @@ WRITE16_MEMBER(seibu_cop_bootleg_device::cmd_trigger_w) break; case 0x0000: break; - + case 0xf105: break; @@ -89,7 +89,7 @@ WRITE16_MEMBER(seibu_cop_bootleg_device::cmd_trigger_w) int target_reg = data & 0x200 ? 2 : 1; int dy = (m_host_space->read_dword(m_reg[target_reg]+4) >> 16) - (m_host_space->read_dword(m_reg[0]+4) >> 16); int dx = (m_host_space->read_dword(m_reg[target_reg]+8) >> 16) - (m_host_space->read_dword(m_reg[0]+8) >> 16); - + //m_status = 7; if(!dy) { m_status = 0x8000; @@ -112,7 +112,7 @@ WRITE16_MEMBER(seibu_cop_bootleg_device::cmd_trigger_w) break; } - + case 0x3bb0: { int dy = m_dy; @@ -121,13 +121,13 @@ WRITE16_MEMBER(seibu_cop_bootleg_device::cmd_trigger_w) dx >>= 16; dy >>= 16; m_dist = sqrt((double)(dx*dx+dy*dy)); - + // TODO: is this right? m_host_space->write_word(m_reg[0]+(0x38), m_dist); break; } - + // TODO: wrong case 0x42c2: { @@ -143,18 +143,18 @@ WRITE16_MEMBER(seibu_cop_bootleg_device::cmd_trigger_w) m_host_space->write_dword(m_reg[0] + (0x38), (m_dist << (5 - 1)) / div); break; } - + /* - 00000-0ffff: - amp = x/256 - ang = x & 255 - s = sin(ang*2*pi/256) - val = trunc(s*amp) - if(s<0) - val-- - if(s == 192) - val = -2*amp - */ + 00000-0ffff: + amp = x/256 + ang = x & 255 + s = sin(ang*2*pi/256) + val = trunc(s*amp) + if(s<0) + val-- + if(s == 192) + val = -2*amp + */ case 0x8100: { UINT16 sin_offs; //= m_host_space->read_dword(m_reg[0]+(0x34)); @@ -164,7 +164,7 @@ WRITE16_MEMBER(seibu_cop_bootleg_device::cmd_trigger_w) double angle = raw_angle * M_PI / 128; double amp = (65536 >> 5)*(m_host_space->read_word(m_reg[0]+(0x36^2)) & 0xff); int res; - + /* TODO: up direction, why? */ if(raw_angle == 0xc0) @@ -176,7 +176,7 @@ WRITE16_MEMBER(seibu_cop_bootleg_device::cmd_trigger_w) break; } - + case 0x8900: { int raw_angle = (m_host_space->read_word(m_reg[0]+(0x34^2)) & 0xff); @@ -201,7 +201,7 @@ WRITE16_MEMBER(seibu_cop_bootleg_device::cmd_trigger_w) break; } } - + } READ16_MEMBER(seibu_cop_bootleg_device::status_r) @@ -227,9 +227,9 @@ READ16_MEMBER(seibu_cop_bootleg_device::d104_move_r) WRITE16_MEMBER(seibu_cop_bootleg_device::d104_move_w) { if(offset == 1) - m_d104_move_offset = (m_d104_move_offset & 0xffff0000) | (data & 0xffff); + m_d104_move_offset = (m_d104_move_offset & 0xffff0000) | (data & 0xffff); else - m_d104_move_offset = (m_d104_move_offset & 0xffff) | (data << 16); + m_d104_move_offset = (m_d104_move_offset & 0xffff) | (data << 16); } // anything that is read thru ROM range 0xc**** is replacement code, therefore on this HW they are latches. @@ -247,8 +247,8 @@ ADDRESS_MAP_END seibu_cop_bootleg_device::seibu_cop_bootleg_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, SEIBU_COP_BOOTLEG, "Seibu COP (Bootleg)", tag, owner, clock, "seibu_cop_boot", __FILE__), - device_memory_interface(mconfig, *this), - m_space_config("regs", ENDIANNESS_LITTLE, 16, 9, 0, nullptr, *ADDRESS_MAP_NAME(seibucopbl_map)) + device_memory_interface(mconfig, *this), + m_space_config("regs", ENDIANNESS_LITTLE, 16, 9, 0, nullptr, *ADDRESS_MAP_NAME(seibucopbl_map)) { } @@ -275,7 +275,7 @@ void seibu_cop_bootleg_device::device_config_complete() void seibu_cop_bootleg_device::device_start() { -// m_cop_mcu_ram = reinterpret_cast<UINT16 *>(machine().root_device().memshare("cop_mcu_ram")->ptr()); +// m_cop_mcu_ram = reinterpret_cast<UINT16 *>(machine().root_device().memshare("cop_mcu_ram")->ptr()); } diff --git a/src/mame/machine/seicop.h b/src/mame/machine/seicop.h index eb15b497572..ec771f96edf 100644 --- a/src/mame/machine/seicop.h +++ b/src/mame/machine/seicop.h @@ -6,7 +6,7 @@ class seibu_cop_bootleg_device : public device_t, - public device_memory_interface + public device_memory_interface { public: seibu_cop_bootleg_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); @@ -34,7 +34,7 @@ protected: private: cpu_device *m_host_cpu; /**< reference to the host cpu */ - address_space *m_host_space; /**< reference to the host cpu space */ + address_space *m_host_space; /**< reference to the host cpu space */ const address_space_config m_space_config; inline UINT16 read_word(offs_t address); inline void write_word(offs_t address, UINT16 data); diff --git a/src/mame/machine/slapstic.cpp b/src/mame/machine/slapstic.cpp index 2d1e83aae67..50d14f2e4c2 100644 --- a/src/mame/machine/slapstic.cpp +++ b/src/mame/machine/slapstic.cpp @@ -182,7 +182,6 @@ #include "includes/slapstic.h" -#include "validity.h" extern const device_type SLAPSTIC = &device_creator<atari_slapstic_device>; diff --git a/src/mame/machine/st0016.cpp b/src/mame/machine/st0016.cpp index 54763268435..7cbc9d70182 100644 --- a/src/mame/machine/st0016.cpp +++ b/src/mame/machine/st0016.cpp @@ -719,7 +719,7 @@ UINT32 st0016_cpu_device::update(screen_device &screen, bitmap_ind16 &bitmap, co fprintf(p,"%.4x - %.4x - ",h,h>>3); for(j=0;j<8;j++) fprintf(p,"%.2x ",st0016_spriteram[h+j]); - fprintf(p,"\n"); + fprintf(p,"\n"); } fclose(p); } diff --git a/src/mame/machine/teleprinter.cpp b/src/mame/machine/teleprinter.cpp index 1c72a536883..92ac0a9b526 100644 --- a/src/mame/machine/teleprinter.cpp +++ b/src/mame/machine/teleprinter.cpp @@ -217,6 +217,10 @@ MACHINE_CONFIG_FRAGMENT( generic_teleprinter ) MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, teleprinter_device, tp_update) MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0) MCFG_GENERIC_KEYBOARD_CB(WRITE8(generic_terminal_device, kbd_put)) + + MCFG_SPEAKER_STANDARD_MONO("bell") + MCFG_SOUND_ADD("beeper", BEEP, 2'000) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "bell", 0.50) MACHINE_CONFIG_END machine_config_constructor teleprinter_device::device_mconfig_additions() const diff --git a/src/mame/machine/x68k_kbd.cpp b/src/mame/machine/x68k_kbd.cpp index 675038414c4..9939aef1f78 100644 --- a/src/mame/machine/x68k_kbd.cpp +++ b/src/mame/machine/x68k_kbd.cpp @@ -1,20 +1,18 @@ // license:BSD-3-Clause -// copyright-holders:Barry Rodewald +// copyright-holders:Barry Rodewald,Vas Crabb #include "machine/x68k_kbd.h" -x68k_keyboard_device::x68k_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) : - serial_keyboard_device(mconfig, X68K_KEYBOARD, "X68k Keyboard", tag, owner, 0, "x68k_keyboard", __FILE__), - m_io_kbd8(*this, "TERM_LINE8"), - m_io_kbd9(*this, "TERM_LINE9"), - m_io_kbda(*this, "TERM_LINEA"), - m_io_kbdb(*this, "TERM_LINEB"), - m_io_kbdd(*this, "TERM_LINED"), - m_io_kbde(*this, "TERM_LINEE") +#include "machine/keyboard.ipp" + + +x68k_keyboard_device::x68k_keyboard_device(const machine_config& mconfig, const char* tag, device_t* owner, UINT32 clock) + : buffered_rs232_device(mconfig, X68K_KEYBOARD, "X68k Keyboard", tag, owner, 0, "x68k_keyboard", __FILE__) + , device_matrix_keyboard_interface(mconfig, *this, "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", "LINE8", "LINE9", "LINEA", "LINEB", "LINEC", "LINED", "LINEE") { } -void x68k_keyboard_device::write(UINT8 data) +void x68k_keyboard_device::received_byte(UINT8 data) { /* Keyboard control commands: 00xxxxxx - TV Control @@ -39,292 +37,223 @@ void x68k_keyboard_device::write(UINT8 data) (repeat rate)^2*5 + 30ms 1xxxxxxx - xxxxxxx = keyboard LED status - b6 = "full size" + b6 = fullwidth b5 = hiragana b4 = insert b3 = caps b2 = code input - b1 = romaji input + b1 = romaji b0 = kana */ - if(data & 0x80) // LED status + if (data & 0x80) // LED status { - machine().output().set_value("key_led_kana",(data & 0x01) ? 0 : 1); - machine().output().set_value("key_led_romaji",(data & 0x02) ? 0 : 1); - machine().output().set_value("key_led_code",(data & 0x04) ? 0 : 1); - machine().output().set_value("key_led_caps",(data & 0x08) ? 0 : 1); - machine().output().set_value("key_led_insert",(data & 0x10) ? 0 : 1); - machine().output().set_value("key_led_hiragana",(data & 0x20) ? 0 : 1); - machine().output().set_value("key_led_fullsize",(data & 0x40) ? 0 : 1); - logerror("KB: LED status set to %02x\n",data & 0x7f); + machine().output().set_value("key_led_kana", (data & 0x01) ? 0 : 1); + machine().output().set_value("key_led_romaji", (data & 0x02) ? 0 : 1); + machine().output().set_value("key_led_code", (data & 0x04) ? 0 : 1); + machine().output().set_value("key_led_caps", (data & 0x08) ? 0 : 1); + machine().output().set_value("key_led_insert", (data & 0x10) ? 0 : 1); + machine().output().set_value("key_led_hiragana", (data & 0x20) ? 0 : 1); + machine().output().set_value("key_led_fullsize", (data & 0x40) ? 0 : 1); + logerror("KB: LED status set to %02x\n", data & 0x7f); } - if((data & 0xc0) == 0) // TV control + if ((data & 0xc0) == 0) // TV control { // nothing for now } - if((data & 0xf8) == 0x48) // Keyboard enable + if ((data & 0xf8) == 0x48) // Keyboard enable { m_enabled = data & 0x01; - logerror("KB: Keyboard enable bit = %i\n",m_enabled); + if (m_enabled) start_processing(attotime::from_hz(2'400)); + else stop_processing(); + logerror("KB: Keyboard enable bit = %i\n", m_enabled); } - if((data & 0xf0) == 0x60) // Key delay time + if ((data & 0xf0) == 0x60) // Key delay time { - m_delay = data & 0x0f; - logerror("KB: Keypress delay time is now %ims\n",(data & 0x0f)*100+200); + m_delay = ((data & 0x0f) * 100) + 200; + logerror("KB: Keypress delay time is now %ims\n", m_delay); } - if((data & 0xf0) == 0x70) // Key repeat rate + if ((data & 0xf0) == 0x70) // Key repeat rate { - m_repeat = data & 0x0f; - logerror("KB: Keypress repeat rate is now %ims\n",((data & 0x0f)^2)*5+30); + m_repeat = (((data & 0x0f)^2) * 5) + 30; + logerror("KB: Keypress repeat rate is now %ims\n", m_repeat); } } -UINT8 x68k_keyboard_device::keyboard_handler(UINT8 last_code, UINT8 *scan_line) +void x68k_keyboard_device::key_make(UINT8 row, UINT8 column) { - if (m_enabled) - { - for (int row = 0; row < 15; row++ ) - { - UINT8 data = 0; - - if (row == 0) data = m_io_kbd0->read(); - else - if (row == 1) data = m_io_kbd1->read(); - else - if (row == 2) data = m_io_kbd2->read(); - else - if (row == 3) data = m_io_kbd3->read(); - else - if (row == 4) data = m_io_kbd4->read(); - else - if (row == 5) data = m_io_kbd5->read(); - else - if (row == 6) data = m_io_kbd6->read(); - else - if (row == 7) data = m_io_kbd7->read(); - else - if (row == 8) data = m_io_kbd8->read(); - else - if (row == 9) data = m_io_kbd9->read(); - else - if (row == 10) data = m_io_kbda->read(); - else - if (row == 11) data = m_io_kbdb->read(); - else - if (row == 12) data = m_io_kbdc->read(); - else - if (row == 13) data = m_io_kbdd->read(); - else - if (row == 14) data = m_io_kbde->read(); - - for (int column = 0; column < 8; column++ ) - { - int new_down = (data & (1 << column)) != 0; - int scan_code = (row * 8) + column; - int old_down = m_key_down[scan_code]; - m_key_down[scan_code] = new_down; - - if (new_down && !old_down) - { - m_repeat_code = scan_code; - m_until_repeat = m_delay * 240; - - return scan_code; - } - else if(!new_down && old_down) - { - m_repeat_code = 0; - return scan_code + 0x80; - } - } - } + // TODO: work out which keys actually repeat (this assumes it's anything other than ctrl/opt/shift) + if (row != 0x0eU) + typematic_start(row, column, attotime::from_msec(m_delay), attotime::from_msec(m_repeat)); + else + typematic_restart(attotime::from_msec(m_delay), attotime::from_msec(m_repeat)); - if (m_repeat_code > 0 && m_key_down[m_repeat_code]) - { - m_until_repeat--; - if (m_until_repeat == 0) - { - m_until_repeat = m_repeat * 240; - return m_repeat_code; - } - } - } + transmit_byte((row << 3) | column); +} - return 0; +void x68k_keyboard_device::key_repeat(UINT8 row, UINT8 column) +{ + transmit_byte((row << 3) | column); +} + +void x68k_keyboard_device::key_break(UINT8 row, UINT8 column) +{ + device_matrix_keyboard_interface::key_break(row, column); + + transmit_byte(0x80U | (row << 3) | column); } static INPUT_PORTS_START( x68k_keyboard ) - PORT_START("TERM_LINE0") + PORT_START("LINE0") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED) // unused - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) /* ESC */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 ! \xE3\x83\x8C") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') /* 1 ! */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 \" \xE3\x83\x95") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') /* 2 " */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 # \xE3\x82\xA2 \xE3\x82\xA1") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') /* 3 # */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 $ \xE3\x82\xA6 \xE3\x82\xA5") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') /* 4 $ */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 % \xE3\x82\xA8 \xE3\x82\xA7") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') /* 5 % */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 & \xE3\x82\xAA \xE3\x82\xA9") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') /* 6 & */ - - PORT_START("TERM_LINE1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 \' \xE3\x83\xA4 \xE3\x83\xA3") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') /* 7 ' */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 ( \xE3\x83\xA6 \xE3\x83\xA5") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') /* 8 ( */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 ) \xE3\x83\xA8 \xE3\x83\xA7") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') /* 9 ) */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 \xE3\x83\xAF \xE3\x83\xB2") PORT_CODE(KEYCODE_0) PORT_CHAR('0') /* 0 */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- = \xE3\x83\x9B") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') /* - = */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("^ \xE3\x83\x98") PORT_CHAR('^') /* ^ */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xC2\xA5 \xE3\x83\xBC |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') /* Yen | */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) /* Backspace */ - - PORT_START("TERM_LINE2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) /* Tab */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q \xE3\x82\xBF") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') /* Q */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W \xE3\x83\x86") PORT_CODE(KEYCODE_W) PORT_CHAR('W') /* W */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E \xE3\x82\xA4 \xE3\x82\xA3") PORT_CODE(KEYCODE_E) PORT_CHAR('E') /* E */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R \xE3\x82\xB9") PORT_CODE(KEYCODE_R) PORT_CHAR('R') /* R */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T \xE3\x82\xAB") PORT_CODE(KEYCODE_T) PORT_CHAR('T') /* T */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y \xE3\x83\xB3") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') /* Y */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U \xE3\x83\x8A") PORT_CODE(KEYCODE_U) PORT_CHAR('U') /* U */ - - PORT_START("TERM_LINE3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I \xE3\x83\x8B") PORT_CODE(KEYCODE_I) PORT_CHAR('I') /* I */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O \xE3\x83\xA9") PORT_CODE(KEYCODE_O) PORT_CHAR('O') /* O */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P \xE3\x82\xBB") PORT_CODE(KEYCODE_P) PORT_CHAR('P') /* P */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@ ` \xE3\x82\x9B") PORT_CHAR('@') PORT_CHAR('`') /* @ */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[ { \xE3\x82\x9C \xE3\x80\x8C") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') /* [ { */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) /* Return */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A \xE3\x83\x81") PORT_CODE(KEYCODE_A) PORT_CHAR('A') /* A */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S \xE3\x83\x88") PORT_CODE(KEYCODE_S) PORT_CHAR('S') /* S */ - - PORT_START("TERM_LINE4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D \xE3\x82\xB7") PORT_CODE(KEYCODE_D) PORT_CHAR('D') /* D */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F \xE3\x83\x8F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') /* F */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G \xE3\x82\xAD") PORT_CODE(KEYCODE_G) PORT_CHAR('G') /* G */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H \xE3\x82\xAF") PORT_CODE(KEYCODE_H) PORT_CHAR('H') /* H */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J \xE3\x83\x9E") PORT_CODE(KEYCODE_J) PORT_CHAR('J') /* J */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K \xE3\x83\x8E") PORT_CODE(KEYCODE_K) PORT_CHAR('K') /* K */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L \xE3\x83\xAA") PORT_CODE(KEYCODE_L) PORT_CHAR('L') /* L */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; + \xE3\x83\xAC") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') /* ; + */ - - PORT_START("TERM_LINE5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": * \xE3\x82\xB1") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') /* : * */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("] } \xE3\x83\xA0 \xE3\x80\x8D") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') /* ] } */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z \xE3\x83\x84 \xE3\x83\x83") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') /* Z */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X \xE3\x82\xB5") PORT_CODE(KEYCODE_X) PORT_CHAR('X') /* X */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C \xE3\x82\xBD") PORT_CODE(KEYCODE_C) PORT_CHAR('C') /* C */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V \xE3\x83\x92") PORT_CODE(KEYCODE_V) PORT_CHAR('V') /* V */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B \xE3\x82\xB3") PORT_CODE(KEYCODE_B) PORT_CHAR('B') /* B */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N \xE3\x83\x9F") PORT_CODE(KEYCODE_N) PORT_CHAR('N') /* N */ - - PORT_START("TERM_LINE6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M \xE3\x83\xA2") PORT_CODE(KEYCODE_M) PORT_CHAR('M') /* M */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", < \xE3\x83\x8D \xE3\x80\x81") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') /* , < */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". > \xE3\x83\xAB \xE3\x80\x82") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') /* . > */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ? \xE3\x83\xA1 \xE3\x83\xBB") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') /* / ? */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("_ \xE3\x83\xAD") PORT_CHAR('_') /* Underscore (shifted only?) */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') /* Space */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) /* Home */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) /* Del */ - - PORT_START("TERM_LINE7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Roll Up") PORT_CODE(KEYCODE_PGUP) /* Roll Up */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Roll Down") PORT_CODE(KEYCODE_PGDN) /* Roll Down */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Undo") PORT_CODE(KEYCODE_END) /* Undo */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Left") PORT_CODE(KEYCODE_LEFT) /* Left */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Up") PORT_CODE(KEYCODE_UP) /* Up */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Right") PORT_CODE(KEYCODE_RIGHT) /* Right */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Down") PORT_CODE(KEYCODE_DOWN) /* Down */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey CLR") PORT_CODE(KEYCODE_NUMLOCK) /* CLR */ - - PORT_START("TERM_LINE8") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey /") PORT_CODE(KEYCODE_SLASH_PAD) /* / (numpad) */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) /* * (numpad) */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD) /* - (numpad) */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 7") PORT_CODE(KEYCODE_7_PAD) /* 7 (numpad) */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 8") PORT_CODE(KEYCODE_8_PAD) /* 8 (numpad) */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 9") PORT_CODE(KEYCODE_9_PAD) /* 9 (numpad) */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD) /* + (numpad) */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 4") PORT_CODE(KEYCODE_4_PAD) /* 4 (numpad) */ - - PORT_START("TERM_LINE9") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 5") PORT_CODE(KEYCODE_5_PAD) /* 5 (numpad) */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 6") PORT_CODE(KEYCODE_6_PAD) /* 6 (numpad) */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey =") /* = (numpad) */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 1") PORT_CODE(KEYCODE_1_PAD) /* 1 (numpad) */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 2") PORT_CODE(KEYCODE_2_PAD) /* 2 (numpad) */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 3") PORT_CODE(KEYCODE_3_PAD) /* 3 (numpad) */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey Enter") PORT_CODE(KEYCODE_ENTER_PAD) /* Enter (numpad) */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 0") PORT_CODE(KEYCODE_0_PAD) /* 0 (numpad) */ - - PORT_START("TERM_LINEA") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey ,") /* , (numpad) */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey .") PORT_CODE(KEYCODE_DEL_PAD) /* 2 (numpad) */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE8\xA8\x98\xE5\x8F\xB7 (Symbolic input)") /* Sign / Symbolic input (babelfish translation) */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE7\x99\xBB\xE9\x8C\xB2 (Register)") /* Register (babelfish translation) */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Help") /* Help */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF1") PORT_CODE(KEYCODE_F11) /* XF1 */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF2") PORT_CODE(KEYCODE_F12) /* XF2 */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF3") /* XF3 */ - - PORT_START("TERM_LINEB") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF4") /* XF4 */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF5") /* XF5 */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xe3\x81\x8b\xe3\x81\xaa (Kana)") /* Kana */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xe3\x83\xad\xe3\x83\xbc\xe3\x83\x9e\xe5\xad\x97 (Romaji)") /* Romaji */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE3\x82\xB3\xE3\x83\xBC\xE3\x83\x89 (Code input)") /* Code input */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) /* Caps lock */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Insert") PORT_CODE(KEYCODE_INSERT) /* Insert */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE3\x81\xB2\xE3\x82\x89\xE3\x81\x8C\xE3\x81\xAA (Hiragana)") /* Hiragana */ - - PORT_START("TERM_LINEC") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE5\x85\xA8\xE8\xA7\x92 (Full size)") /* Full size (babelfish translation) */ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) // Escape + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 ! \xE3\x81\xAC") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') // 1 ! nu + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 \" \xE3\x81\xB5") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') // 2 " fu + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 # \xE3\x81\x82 \xE3\x81\x81") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') // 3 # a + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 $ \xE3\x81\x86 \xE3\x81\x85") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') // 4 $ u + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 % \xE3\x81\x88 \xE3\x81\x87") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') // 5 % e + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 & \xE3\x81\x8A \xE3\x81\x89") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') // 6 & o + + PORT_START("LINE1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 \' \xE3\x82\x84 \xE3\x82\x83") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') // 7 ' ya + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 ( \xE3\x82\x86 \xE3\x82\x85") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') // 8 ( yu + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 ) \xE3\x82\x88 \xE3\x82\x87") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') // 9 ) yo + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 \xE3\x82\x8F \xE3\x82\x92") PORT_CODE(KEYCODE_0) PORT_CHAR('0') // 0 wa wo + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- = \xE3\x81\xBB") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') // - = ho + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("^ \xE3\x81\xB8") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') // ^ he + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xC2\xA5 | \xE3\x83\xBC") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\\') PORT_CHAR('|') // Yen | - + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) // Backspace + + PORT_START("LINE2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) // Tab + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q \xE3\x81\x9F") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') // Q ta + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W \xE3\x81\xA6") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') // W te + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E \xE3\x81\x84 \xE3\x81\x83") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') // E i + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R \xE3\x81\x99") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') // R su + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T \xE3\x81\x8B") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') // T ka + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y \xE3\x82\x93") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') // Y n + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U \xE3\x81\xAA") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') // U na + + PORT_START("LINE3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I \xE3\x81\xAB") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') // I ni + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O \xE3\x82\x89") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') // O ra + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P \xE3\x81\x9B") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') // P se + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@ ` \xE3\x82\x9B") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') // @ ` dakuten + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[ { \xE3\x82\x9C \xE3\x80\x8C") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') // [ { handakuten kagikakko + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) // Return + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A \xE3\x81\xA1") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') // A chi + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S \xE3\x81\xA8") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') // S to + + PORT_START("LINE4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D \xE3\x81\x97") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') // D shi + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F \xE3\x81\xAF") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') // F ha + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G \xE3\x81\x8D") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') // G ki + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H \xE3\x81\x8F") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') // H ku + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J \xE3\x81\xBE") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') // J ma + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K \xE3\x81\xAE") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') // K no + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L \xE3\x82\x8A") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') // L ri + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; + \xE3\x82\x8C") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') // ; + re + + PORT_START("LINE5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": * \xE3\x81\x91") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') // : * ke + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("] } \xE3\x82\x80 \xE3\x80\x8D") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') // ] } mu kagikakko + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z \xE3\x81\xA4 \xE3\x81\xA3") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') // Z tsu + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X \xE3\x81\x95") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') // X sa + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C \xE3\x81\x9D") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') // C so + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V \xE3\x81\xB2") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') // V hi + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B \xE3\x81\x93") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') // B ko + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N \xE3\x81\xBF") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') // N mi + + PORT_START("LINE6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M \xE3\x82\x82") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') // M mo + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", < \xE3\x81\xAD \xE3\x80\x81") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') // , < ne comma + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". > \xE3\x82\x8B \xE3\x80\x82") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') // . > ru stop + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ? \xE3\x82\x81 \xE3\x83\xBB") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') // / ? me interpunct + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("_ \xE3\x82\x8D") PORT_CHAR('_') // Underscore (shifted only?) ro + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') // Space + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) // Home + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) // Del + + PORT_START("LINE7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ROLL UP") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) // Roll Up + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ROLL DOWN") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) // Roll Down + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("UNDO") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) // Undo + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) // Left + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) // Up + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) // Right + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Cursor Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) // Down + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey CLR") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) // Clear + + PORT_START("LINE8") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey /") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) // / (numpad) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) // * (numpad) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) // - (numpad) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) // 7 (numpad) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) // 8 (numpad) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) // 9 (numpad) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) // + (numpad) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) // 4 (numpad) + + PORT_START("LINE9") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) // 5 (numpad) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) // 6 (numpad) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey =") // = (numpad) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) // 1 (numpad) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) // 2 (numpad) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) // 3 (numpad) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey ENTER") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) // Enter (numpad) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey 0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) // 0 (numpad) + + PORT_START("LINEA") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey ,") // , (numpad) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Tenkey .") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) // . (numpad) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE8\xA8\x98\xE5\x8F\xB7\xE5\x85\xA5\xE5\x8A\x9B (Symbol input)") // Kigou nyuuryoku (Symbol input) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE7\x99\xBB\xE9\x8C\xB2 (Register)") // Register (babelfish translation) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Help") // Help + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF1") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) // XF1 + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF2") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) // XF2 + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF3") // XF3 + + PORT_START("LINEB") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF4") // XF4 + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("XF5") PORT_CODE(KEYCODE_RALT) // XF5 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE3\x81\x8B\xE3\x81\xAA (Kana)") // Kana + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE3\x83\xAD\xE3\x83\xBC\xE3\x83\x9E\xE5\xAD\x97 (Romaji)") // Romaji + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE3\x82\xB3\xE3\x83\xBC\xE3\x83\x89\xE5\x85\xA5\xE5\x8A\x9B (Code input)") // Code input + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) // Caps lock + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) // Insert + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE3\x81\xB2\xE3\x82\x89\xE3\x81\x8C\xE3\x81\xAA (Hiragana)") PORT_CODE(KEYCODE_LALT) // Hiragana + + PORT_START("LINEC") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE5\x85\xA8\xE8\xA7\x92 (Fullwidth)") PORT_CODE(KEYCODE_RCONTROL) // Zenkaku (Fullwidth) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Break") /* Break */ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Copy") /* Copy */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) /* F1 */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) /* F2 */ - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) /* F3 */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) /* F4 */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) /* F5 */ - - PORT_START("TERM_LINED") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) /* F6 */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) /* F7 */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) /* F8 */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) /* F9 */ - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) /* F10 */ + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) // F1 + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) // F2 + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) // F3 + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) // F4 + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) // F5 + + PORT_START("LINED") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) // F6 + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) // F7 + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) // F8 + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) // F9 + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) // F10 // 0x6d reserved // 0x6e reserved // 0x6f reserved - PORT_START("TERM_LINEE") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) /* Shift */ - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) /* Ctrl */ - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Opt. 1") PORT_CODE(KEYCODE_PRTSCR) /* Opt1 */ - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Opt. 2") PORT_CODE(KEYCODE_PAUSE) /* Opt2 */ - - PORT_START("RS232_TXBAUD") - PORT_CONFNAME(0xff, RS232_BAUD_38400, "TX Baud") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_BAUD_38400, "38400") // TODO: Should be 2400 but MC68901 doesn't support divide by 16 - - PORT_START("RS232_STARTBITS") - PORT_CONFNAME(0xff, RS232_STARTBITS_1, "Start Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_STARTBITS_1, "1") - - PORT_START("RS232_DATABITS") - PORT_CONFNAME(0xff, RS232_DATABITS_8, "Data Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_DATABITS_8, "8") - - PORT_START("RS232_PARITY") - PORT_CONFNAME(0xff, RS232_PARITY_NONE, "Parity") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_PARITY_NONE, "None") - - PORT_START("RS232_STOPBITS") - PORT_CONFNAME(0xff, RS232_STOPBITS_1, "Stop Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_keyboard_device, update_serial) - PORT_CONFSETTING( RS232_STOPBITS_1, "1") + PORT_START("LINEE") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // Shift + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) // Control + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("OPT.1") PORT_CODE(KEYCODE_PRTSCR) // Opt1 + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("OPT.2") PORT_CODE(KEYCODE_PAUSE) // Opt2 INPUT_PORTS_END ioport_constructor x68k_keyboard_device::device_input_ports() const @@ -334,28 +263,44 @@ ioport_constructor x68k_keyboard_device::device_input_ports() const void x68k_keyboard_device::device_start() { - serial_keyboard_device::device_start(); - set_rcv_rate(38400); // TODO: Should be 2400 but MC68901 doesn't support divide by 16 + buffered_rs232_device::device_start(); + + save_item(NAME(m_delay)); + save_item(NAME(m_repeat)); + save_item(NAME(m_enabled)); } void x68k_keyboard_device::device_reset() { - serial_keyboard_device::device_reset(); + buffered_rs232_device::device_reset(); + + set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1); + set_rate(38'400); // TODO: Should be 2400 but MC68901 doesn't support divide by 16 + receive_register_reset(); + transmit_register_reset(); m_enabled = 0; m_delay = 500; // 3*100+200 m_repeat = 110; // 4^2*5+30 - m_repeat_code = 0; - memset(m_key_down, 0, sizeof(m_key_down)); + stop_processing(); + reset_key_state(); + typematic_stop(); + clear_fifo(); + + output_dcd(0); + output_dsr(0); + output_cts(0); + output_rxd(1); } -void x68k_keyboard_device::rcv_complete() +void x68k_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - receive_register_extract(); - write(get_received_char()); + device_matrix_keyboard_interface::device_timer(timer, id, param, ptr); + buffered_rs232_device::device_timer(timer, id, param, ptr); } + const device_type X68K_KEYBOARD = &device_creator<x68k_keyboard_device>; #if 0 diff --git a/src/mame/machine/x68k_kbd.h b/src/mame/machine/x68k_kbd.h index 09c5b1c0e0c..5540be8f151 100644 --- a/src/mame/machine/x68k_kbd.h +++ b/src/mame/machine/x68k_kbd.h @@ -1,11 +1,11 @@ // license:BSD-3-Clause -// copyright-holders:Barry Rodewald -#ifndef X68K_KBD_H_ -#define X68K_KBD_H_ +// copyright-holders:Barry Rodewald,Vas Crabb +#ifndef MAME_MACHINE_X68K_KBD_H +#define MAME_MACHINE_X68K_KBD_H #include "bus/rs232/keyboard.h" -class x68k_keyboard_device : public serial_keyboard_device +class x68k_keyboard_device : public buffered_rs232_device<16U>, protected device_matrix_keyboard_interface<15U> { public: x68k_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); @@ -14,28 +14,19 @@ public: protected: virtual void device_start() override; virtual void device_reset() override; - virtual void rcv_complete() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void key_make(UINT8 row, UINT8 column) override; + virtual void key_repeat(UINT8 row, UINT8 column) override; + virtual void key_break(UINT8 row, UINT8 column) override; private: - virtual UINT8 keyboard_handler(UINT8 last_code, UINT8 *scan_line) override; - void write(UINT8 data); - - required_ioport m_io_kbd8; - required_ioport m_io_kbd9; - required_ioport m_io_kbda; - required_ioport m_io_kbdb; - required_ioport m_io_kbdd; - required_ioport m_io_kbde; + virtual void received_byte(UINT8 data) override; int m_delay; // keypress delay after initial press int m_repeat; // keypress repeat rate - int m_enabled; // keyboard enabled? - - UINT8 m_key_down[15*8]; - int m_repeat_code; - int m_until_repeat; + UINT8 m_enabled; // keyboard enabled? }; extern const device_type X68K_KEYBOARD; -#endif /* X68KKBD_H_ */ +#endif // MAME_MACHINE_X68K_KBD_H diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 2bcc0310c3d..c459953f179 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -9368,6 +9368,12 @@ vcop3 // 2003.02.26 Virtua Cop 3 (Rev A) wangmid // 2004.07 Wangan Midnight Maximum Tune (export) (Rev B) wangmid2 // 2005.10 Wangan Midnight Maximum Tune 2 (Export) (Rev A) wangmid2j // 2005.04 Wangan Midnight Maximum Tune 2 (Japan) +questofd // 2004.09 Quest of D (CDV-10005C) +gundcb79 // 2005.10 Mobile Suit Gundam 0079 Card Builder (CDV-10010) +gundcb79a // 2006.10 Mobile Suit Gundam 0079 Card Builder Ver.2.02 (CDV-10024B) +gundcb83 // 2007.01 Mobile Suit Gundam 0083 Card Builder (CDV-10030) +gundcb83a // 2007.01 Mobile Suit Gundam 0083 Card Builder Check Disk (CDV-10031) +gundcb83b // 2008.08 Mobile Suit Gundam 0083 Card Builder Ver.2.10 (CDV-10037B) @source:chinagat.cpp chinagat // TA-0023 (c) 1988 Taito + Romstar license (US) @@ -28269,7 +28275,7 @@ ryuuha // (c) 1987 secolove // (c) 1986 seiha // (c) 1987 seiham // (c) 1987 -swinggal // (c) 1987 Digital Denshi +swinggal // (c) 1987 Digital Denshi vipclub // (c) 1988 Daiichi Denshi @source:nbmj8891.cpp @@ -34059,13 +34065,13 @@ sun3_460 // sun_s10 // sun_s20 // sun4_20 // -sun4_110 // +sun4_110 // sun4_300 // -sun4_400 // +sun4_400 // sun4_40 // sun4_50 // sun4_60 // -sun4_65 // +sun4_65 // sun4_75 // @source:suna16.cpp @@ -35736,8 +35742,8 @@ tutor // 1983? Tomy Tutor tv950 // @source:tv990.cpp -tv990 // 1992? TeleVideo -tv995 // 1994 TeleVideo +tv990 // 1992? TeleVideo +tv995 // 1994 TeleVideo @source:tvc.cpp tvc64 // diff --git a/src/mame/video/digdug.cpp b/src/mame/video/digdug.cpp index 7e24b76b576..b06cc2e9e08 100644 --- a/src/mame/video/digdug.cpp +++ b/src/mame/video/digdug.cpp @@ -142,6 +142,11 @@ TILE_GET_INFO_MEMBER(digdug_state::tx_get_tile_info) VIDEO_START_MEMBER(digdug_state,digdug) { + m_bg_select = 0; + m_tx_color_mode = 0; + m_bg_disable = 0; + m_bg_color_bank = 0; + m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(digdug_state::bg_get_tile_info),this),tilemap_mapper_delegate(FUNC(digdug_state::tilemap_scan),this),8,8,36,28); m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(digdug_state::tx_get_tile_info),this),tilemap_mapper_delegate(FUNC(digdug_state::tilemap_scan),this),8,8,36,28); diff --git a/src/mame/video/dynax.cpp b/src/mame/video/dynax.cpp index 5d254272406..48277da36b2 100644 --- a/src/mame/video/dynax.cpp +++ b/src/mame/video/dynax.cpp @@ -1283,11 +1283,14 @@ int dynax_state::debug_viewer(bitmap_ind16 &bitmap, const rectangle &cliprect ) if (machine().input().code_pressed_once(KEYCODE_R)) { r = (r + 1) & 0x7; i = size / 8 * r; } if (machine().input().code_pressed(KEYCODE_M) | machine().input().code_pressed_once(KEYCODE_K)) { - while (i < size && RAM[i]) i++; while (i < size && !RAM[i]) i++; + while (i < size && RAM[i]) i++; + while (i < size && !RAM[i]) i++; } if (machine().input().code_pressed(KEYCODE_N) | machine().input().code_pressed_once(KEYCODE_J)) { - if (i >= 2) i -= 2; while (i > 0 && RAM[i]) i--; i++; + if (i >= 2) i -= 2; + while (i > 0 && RAM[i]) i--; + i++; } m_blit_palettes = (c & 0xf) * 0x111; diff --git a/src/mame/video/epos.cpp b/src/mame/video/epos.cpp index ecc350afd0a..d0096b4dd45 100644 --- a/src/mame/video/epos.cpp +++ b/src/mame/video/epos.cpp @@ -90,7 +90,7 @@ UINT32 epos_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co int x = (offs % 136) * 2; int y = (offs / 136); - + if (flip_screen()) { x = 270 - x; // wrong diff --git a/src/mame/video/gime.cpp b/src/mame/video/gime.cpp index 38fcbfd76f3..8a1c2debae5 100644 --- a/src/mame/video/gime.cpp +++ b/src/mame/video/gime.cpp @@ -240,7 +240,7 @@ inline gime_base_device::pixel_t gime_base_device::get_composite_color(int color 0xfd8ef1, 0xef8eff, 0xd895ff, 0xb9a1ff, 0x86c4ff, 0x78d4f2, 0x71e2b6, 0xffffff, }; - // composite output with phase inverted + // composite output with phase inverted static pixel_t composite_palette_180[64] = { 0x000000, 0x5a0e5a, 0x4f0c4f, 0x360f40, 0x0d213c, 0x003334, 0x004141, 0x004943, 0x005409, 0x005600, 0x114c00, 0x263700, 0x392500, 0x491d00, 0x4f0f3e, 0x590e59, @@ -897,7 +897,7 @@ inline void gime_base_device::write_gime_register(offs_t offset, UINT8 data) // Bits 0-2 LPR Lines per row if (xorval & 0x20) { - // on phase invert re-load the alternate composite palette + // on phase invert re-load the alternate composite palette m_composite_phase_invert = (data & 0x20); update_composite_palette(); } diff --git a/src/mame/video/itech32.cpp b/src/mame/video/itech32.cpp index 712ff41a32c..da6a84f3f06 100644 --- a/src/mame/video/itech32.cpp +++ b/src/mame/video/itech32.cpp @@ -198,7 +198,7 @@ void itech32_state::video_start() m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(itech32_state::scanline_interrupt),this)); m_enable_latch[0] = 1; m_enable_latch[1] = (m_planes > 1) ? 1 : 0; - + save_item(NAME(m_xfer_xcount)); save_item(NAME(m_xfer_ycount)); save_item(NAME(m_xfer_xcur)); diff --git a/src/mame/video/legionna.cpp b/src/mame/video/legionna.cpp index 95d6182e445..07b8cce83af 100644 --- a/src/mame/video/legionna.cpp +++ b/src/mame/video/legionna.cpp @@ -13,8 +13,8 @@ - MBK - OBJ 3 - LBK - TODO: Anything else doesn't match this scheme (most notably Denjin Makai), - guess it's selectable by PROM, CRTC or COP ... + TODO: Anything else doesn't match this scheme (most notably Denjin Makai), + guess it's selectable by PROM, CRTC or COP ... ***************************************************************************/ @@ -224,13 +224,13 @@ void legionna_state::common_video_allocate_ptr() m_scrollram16 = std::make_unique<UINT16[]>(0x60/2); m_sprite_xoffs = 0; m_sprite_yoffs = 0; - + save_pointer(NAME(m_back_data.get()), 0x800/2); save_pointer(NAME(m_fore_data.get()), 0x800/2); save_pointer(NAME(m_mid_data.get()), 0x800/2); save_pointer(NAME(m_textram.get()), 0x1000/2); save_pointer(NAME(m_scrollram16.get()), 0x60/2); - + save_item(NAME(m_back_gfx_bank)); save_item(NAME(m_mid_gfx_bank)); save_item(NAME(m_fore_gfx_bank)); @@ -258,7 +258,7 @@ void legionna_state::common_video_start() VIDEO_START_MEMBER(legionna_state,legionna) { common_video_start(); - + m_sprite_pri_mask[0] = 0x0000; m_sprite_pri_mask[1] = 0xfff0; m_sprite_pri_mask[2] = 0xfffc; @@ -282,7 +282,7 @@ VIDEO_START_MEMBER(legionna_state,godzilla) m_has_extended_banking = 1; m_has_extended_priority = 0; - + m_sprite_pri_mask[0] = 0xfff0; m_sprite_pri_mask[1] = 0xfffc; m_sprite_pri_mask[2] = 0xfffe; @@ -293,7 +293,7 @@ VIDEO_START_MEMBER(legionna_state,godzilla) VIDEO_START_MEMBER(legionna_state,denjinmk) { common_video_allocate_ptr(); - + m_background_layer = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(legionna_state::get_back_tile_info),this),TILEMAP_SCAN_ROWS,16,16,32,32); m_midground_layer = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(legionna_state::get_mid_tile_info_denji),this), TILEMAP_SCAN_ROWS,16,16,32,32); m_foreground_layer = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(legionna_state::get_fore_tile_info_denji),this),TILEMAP_SCAN_ROWS,16,16,32,32); @@ -301,13 +301,13 @@ VIDEO_START_MEMBER(legionna_state,denjinmk) m_has_extended_banking = 1; m_has_extended_priority = 0; - + m_sprite_pri_mask[0] = 0xfff0; // normal sprites m_sprite_pri_mask[1] = 0xfffc; // luna park horse rides m_sprite_pri_mask[2] = 0xfffe; // door at the end of sewers part in level 1 m_sprite_pri_mask[3] = 0x0000; // briefing guy in pre-stage and portraits before a boss fight - -// m_background_layer->set_transparent_pen(15); + +// m_background_layer->set_transparent_pen(15); m_midground_layer->set_transparent_pen(15); m_foreground_layer->set_transparent_pen(15); m_text_layer->set_transparent_pen(7);//? @@ -420,21 +420,21 @@ void legionna_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,co pri_mask = m_sprite_pri_mask[cur_pri]; #if 0 static UINT8 pri_test; - + if(machine().input().code_pressed_once(KEYCODE_A)) pri_test++; - + if(machine().input().code_pressed_once(KEYCODE_A)) pri_test--; pri_test&=3; popmessage("%02x",pri_test); - + // quick and dirty priority tester if(cur_pri == pri_test) { static UINT16 test = 0xffff; - + if(machine().input().code_pressed_once(KEYCODE_Q)) test^=1; @@ -457,7 +457,7 @@ void legionna_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,co test^=0x40; if(machine().input().code_pressed_once(KEYCODE_I)) - test^=0x80; + test^=0x80; pri_mask = 0xffff & test; data = (data & 0xffc0) | (machine().rand() & 0x3f); @@ -592,7 +592,7 @@ UINT32 legionna_state::screen_update_heatbrl(screen_device &screen, bitmap_ind16 /* Setup the tilemaps */ screen.priority().fill(0, cliprect); bitmap.fill(m_palette->black_pen(), cliprect); /* wrong color? */ - + // TODO: priority order is different than anything else? if (!(m_layer_disable&0x0004)) m_foreground_layer->draw(screen, bitmap, cliprect, 0, 0); if (!(m_layer_disable&0x0002)) m_midground_layer->draw(screen, bitmap, cliprect, 0, 1); diff --git a/src/mame/video/pcd.cpp b/src/mame/video/pcd.cpp index b8c868ac074..b192fd62ad2 100644 --- a/src/mame/video/pcd.cpp +++ b/src/mame/video/pcd.cpp @@ -149,7 +149,7 @@ static MACHINE_CONFIG_FRAGMENT( pcx_video ) MCFG_CPU_ADD("graphics", I8031, XTAL_24MHz/2) MCFG_CPU_PROGRAM_MAP(pcx_vid_map) MCFG_CPU_IO_MAP(pcx_vid_io) - + MCFG_MCS51_SERIAL_TX_CB(WRITE8(pcx_video_device, tx_callback)) MCFG_MCS51_SERIAL_RX_CB(READ8(pcx_video_device, rx_callback)) diff --git a/src/mame/video/tiamc1.cpp b/src/mame/video/tiamc1.cpp index d813b0030fb..a87fb5ee31a 100644 --- a/src/mame/video/tiamc1.cpp +++ b/src/mame/video/tiamc1.cpp @@ -89,9 +89,24 @@ WRITE8_MEMBER(tiamc1_state::tiamc1_bg_hshift_w) m_bg_hshift = data; } +WRITE8_MEMBER(tiamc1_state::tiamc1_bg_bplctrl_w) +{ + m_bg_bplctrl = data; + update_bg_palette(); +} + WRITE8_MEMBER(tiamc1_state::tiamc1_palette_w) { + m_paletteram[offset] = data; m_palette->set_pen_color(offset, m_palette_ptr[data]); + update_bg_palette(); +} + +void tiamc1_state::update_bg_palette() +{ + UINT8 bplmask = ((m_bg_bplctrl >> 0) & 1) | ((m_bg_bplctrl >> 1) & 2) | ((m_bg_bplctrl >> 2) & 4) | ((m_bg_bplctrl >> 3) & 8); + for (int i = 0; i < 16; i++) + m_palette->set_pen_color(i + 16, m_palette_ptr[m_paletteram[i | bplmask]]); } PALETTE_INIT_MEMBER(tiamc1_state, tiamc1) @@ -139,7 +154,7 @@ TILE_GET_INFO_MEMBER(tiamc1_state::get_bg2_tile_info) void tiamc1_state::video_start() { - m_videoram = make_unique_clear<UINT8[]>(0x3040); + m_videoram = make_unique_clear<UINT8[]>(0x3050); m_charram = m_videoram.get() + 0x0800; /* Ram is banked */ m_tileram = m_videoram.get() + 0x0000; @@ -148,8 +163,9 @@ void tiamc1_state::video_start() m_spriteram_x = m_videoram.get() + 0x3010; m_spriteram_n = m_videoram.get() + 0x3020; m_spriteram_a = m_videoram.get() + 0x3030; + m_paletteram = m_videoram.get() + 0x3040; - save_pointer(NAME(m_videoram.get()), 0x3040); + save_pointer(NAME(m_videoram.get()), 0x3050); m_bg_tilemap1 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tiamc1_state::get_bg1_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); @@ -158,9 +174,12 @@ void tiamc1_state::video_start() 8, 8, 32, 32); m_bg_tilemap1->set_scrolldx(4, 4); m_bg_tilemap2->set_scrolldx(4, 4); + m_bg_tilemap1->set_palette_offset(16); + m_bg_tilemap2->set_palette_offset(16); m_bg_vshift = 0; m_bg_hshift = 0; + m_bg_bplctrl = 0; save_item(NAME(m_layers_ctrl)); save_item(NAME(m_bg_vshift)); @@ -173,14 +192,15 @@ VIDEO_START_MEMBER(tiamc1_state, kot) { m_charram = memregion("gfx2")->base(); - m_videoram = make_unique_clear<UINT8[]>(0x440); + m_videoram = make_unique_clear<UINT8[]>(0x450); m_tileram = m_videoram.get() + 0x000; m_spriteram_y = m_videoram.get() + 0x400; m_spriteram_x = m_videoram.get() + 0x410; m_spriteram_n = m_videoram.get() + 0x420; m_spriteram_a = m_videoram.get() + 0x430; + m_paletteram = m_videoram.get() + 0x440; - save_pointer(NAME(m_videoram.get()), 0x440); + save_pointer(NAME(m_videoram.get()), 0x450); m_bg_tilemap1 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tiamc1_state::get_bg1_tile_info), this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); diff --git a/src/mame/video/vtvideo.cpp b/src/mame/video/vtvideo.cpp index 61e7f601c8e..cd08b30b6ef 100644 --- a/src/mame/video/vtvideo.cpp +++ b/src/mame/video/vtvideo.cpp @@ -238,16 +238,16 @@ WRITE8_MEMBER(vt100_video_device::dc012_w) // - see 3.1.3.9.5 DC012 Programming Information (PC-100 spec) if ((offset & 0x100) ) // MHFU is disabled by writing a value to port 010C. { -// if (MHFU_FLAG == true) -// printf("MHFU *** DISABLED *** \n"); +// if (MHFU_FLAG == true) +// printf("MHFU *** DISABLED *** \n"); MHFU_FLAG = false; } else { -// if (MHFU_FLAG == false) -// printf("MHFU ___ENABLED___ %05x \n", space.device().safe_pc()); +// if (MHFU_FLAG == false) +// printf("MHFU ___ENABLED___ %05x \n", space.device().safe_pc()); MHFU_FLAG = true; - MHFU_counter = 0; + MHFU_counter = 0; } if (!(data & 0x08)) @@ -279,10 +279,10 @@ WRITE8_MEMBER(vt100_video_device::dc012_w) // PDF: reverse field ON m_reverse_field = 0; break; - case 0x0b: - // PDF: reverse field OFF - // SETUP: dark screen selected - m_reverse_field = 1; + case 0x0b: + // PDF: reverse field OFF + // SETUP: dark screen selected + m_reverse_field = 1; break; // Writing a 11XX bit combination clears the blink-flip flop (valid for 0x0C - 0x0F): @@ -845,10 +845,10 @@ int rainbow_video_device::MHFU(int ASK) { switch (ASK) { - case MHFU_IS_ENABLED: // "true": RETURN BOOLEAN (MHFU disabled or enabled?) + case MHFU_IS_ENABLED: // "true": RETURN BOOLEAN (MHFU disabled or enabled?) return MHFU_FLAG; - case MHFU_COUNT: // -1: increment IF ENABLED, return counter value (=> Rainbow.c) + case MHFU_COUNT: // -1: increment IF ENABLED, return counter value (=> Rainbow.c) if (MHFU_FLAG == true) if (MHFU_counter < 254) MHFU_counter++; @@ -856,17 +856,17 @@ int rainbow_video_device::MHFU(int ASK) case MHFU_VALUE: return MHFU_counter; - case MHFU_RESET: // -250 : RESET counter (NOTHING ELSE!) + case MHFU_RESET: // -250 : RESET counter (NOTHING ELSE!) MHFU_counter = 0; return MHFU_FLAG; - case MHFU_RESET_and_ENABLE: // -100 : RESET and ENABLE MHFU counter + case MHFU_RESET_and_ENABLE: // -100 : RESET and ENABLE MHFU counter MHFU_counter = 0; MHFU_FLAG = true; return -100; - case MHFU_RESET_and_DISABLE: // -200 : RESET and DISABLE MHFU + case MHFU_RESET_and_DISABLE: // -200 : RESET and DISABLE MHFU MHFU_counter = 0; MHFU_FLAG = false; diff --git a/src/osd/modules/file/windir.cpp b/src/osd/modules/file/windir.cpp index 9b67e163652..522e0e297a1 100644 --- a/src/osd/modules/file/windir.cpp +++ b/src/osd/modules/file/windir.cpp @@ -48,7 +48,7 @@ private: bool m_is_first; // true if this is the first entry entry m_entry; // current entry's data WIN32_FIND_DATA m_data; // current raw data - std::string m_name; // converted name of directory + std::string m_name; // converted name of directory }; //============================================================ diff --git a/src/osd/modules/input/input_common.cpp b/src/osd/modules/input/input_common.cpp index 65b1ce144a6..73af2e9e9e1 100644 --- a/src/osd/modules/input/input_common.cpp +++ b/src/osd/modules/input/input_common.cpp @@ -87,7 +87,7 @@ key_trans_entry keyboard_trans_table::s_default_table[] = KEY_TRANS_ENTRY1(TILDE, GRAVE, BACKQUOTE, GRAVE, VK_OEM_3, '`'), KEY_TRANS_ENTRY1(LSHIFT, LSHIFT, LSHIFT, LSHIFT, VK_LSHIFT, 0), KEY_TRANS_ENTRY1(BACKSLASH, BACKSLASH, BACKSLASH, BACKSLASH, VK_OEM_5, '\\'), -// KEY_TRANS_ENTRY1(BACKSLASH2, NONUSHASH, UNKNOWN, OEM_102, VK_OEM_102, '<'), +// KEY_TRANS_ENTRY1(BACKSLASH2, NONUSHASH, UNKNOWN, OEM_102, VK_OEM_102, '<'), // This is the additional key that ISO keyboards have over ANSI ones, located between left shift and Y. KEY_TRANS_ENTRY1(BACKSLASH2, NONUSBACKSLASH, UNKNOWN, OEM_102, VK_OEM_102, '<'), KEY_TRANS_ENTRY1(Z, Z, z, Z, 'Z', 'Z'), diff --git a/src/osd/modules/input/input_x11.cpp b/src/osd/modules/input/input_x11.cpp index 108b565012a..a3a7021c0a6 100644 --- a/src/osd/modules/input/input_x11.cpp +++ b/src/osd/modules/input/input_x11.cpp @@ -489,7 +489,7 @@ public: x11_event_manager::instance().subscribe(event_types, ARRAY_LENGTH(event_types), this); } - osd_printf_verbose("Lightgun: End initialization\n"); + osd_printf_verbose("Lightgun: End initialization\n"); } bool should_poll_devices(running_machine &machine) override diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index 8daea6c0c33..241f4b2a7f6 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.cpp +++ b/src/osd/modules/render/d3d/d3dhlsl.cpp @@ -48,12 +48,12 @@ public: { HRESULT result; - m_avi_writer = std::make_unique<avi_write>(machine, width, height); + m_avi_writer = std::make_unique<avi_write>(machine, width, height); m_frame.allocate(width, height); if (!m_frame.valid()) return; - + result = d3d->get_device()->CreateTexture(width, height, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &m_sys_texture, nullptr); if (FAILED(result)) { @@ -69,7 +69,7 @@ public: return; } m_vid_texture->GetSurfaceLevel(0, &m_vid_surface); - + m_initialized = true; } diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 4a3d6711c7c..29721c65b77 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -292,14 +292,14 @@ void renderer_bgfx::record() bool renderer_bgfx::init(running_machine &machine) { const char *bgfx_path = downcast<osd_options &>(machine.options()).bgfx_path(); - + osd::directory::ptr directory = osd::directory::open(bgfx_path); if (directory == nullptr) { osd_printf_verbose("Unable to find the %s folder. Please reinstall it to use the BGFX renderer\n", bgfx_path); return true; } - + return false; } diff --git a/src/osd/modules/render/drawd3d.cpp b/src/osd/modules/render/drawd3d.cpp index 122c8758f05..102abf35413 100644 --- a/src/osd/modules/render/drawd3d.cpp +++ b/src/osd/modules/render/drawd3d.cpp @@ -330,7 +330,7 @@ void renderer_d3d9::set_blendmode(int blendmode) blendop = D3DBLENDOP_ADD; blendsrc = D3DBLEND_SRCALPHA; blenddst = D3DBLEND_ONE; - break; + break; } // adjust the bits that changed @@ -479,7 +479,7 @@ texture_info *d3d_texture_manager::find_texinfo(const render_texinfo *texinfo, U UINT32 prim_page = (UINT32)texinfo->osddata & 1; if (test_screen != prim_screen || test_page != prim_page) continue; - + if ((*it)->get_hash() == hash && (*it)->get_texinfo().base == texinfo->base && (*it)->get_texinfo().width == texinfo->width && diff --git a/src/osd/osdcore.h b/src/osd/osdcore.h index 7b12a51422c..7464e076141 100644 --- a/src/osd/osdcore.h +++ b/src/osd/osdcore.h @@ -294,30 +294,30 @@ int osd_uchar_from_osdchar(unicode_char *uchar, const char *osdchar, size_t coun /*----------------------------------------------------------------------------- - osd_is_valid_filename_char: is the given character legal for filenames? + osd_is_valid_filename_char: is the given character legal for filenames? - Parameters: + Parameters: - uchar - the character to check + uchar - the character to check - Return value: + Return value: - Whether this character is legal in a filename + Whether this character is legal in a filename -----------------------------------------------------------------------------*/ bool osd_is_valid_filename_char(unicode_char uchar); /*----------------------------------------------------------------------------- - osd_is_valid_filepath_char: is the given character legal for paths? + osd_is_valid_filepath_char: is the given character legal for paths? - Parameters: + Parameters: - uchar - the character to check + uchar - the character to check - Return value: + Return value: - Whether this character is legal in a file path + Whether this character is legal in a file path -----------------------------------------------------------------------------*/ bool osd_is_valid_filepath_char(unicode_char uchar); diff --git a/src/osd/windows/video.cpp b/src/osd/windows/video.cpp index c38770ad719..0d4232fcd1c 100644 --- a/src/osd/windows/video.cpp +++ b/src/osd/windows/video.cpp @@ -145,7 +145,7 @@ std::shared_ptr<osd_monitor_info> win_monitor_info::monitor_from_handle(HMONITOR for (auto monitor : osd_monitor_info::list) if (*((HMONITOR*)monitor->oshandle()) == hmonitor) return monitor; - + return nullptr; } |