From 1968d3ebc38b1955f970aa7b2627a653c362916b Mon Sep 17 00:00:00 2001 From: Robbbert Date: Sat, 25 May 2013 06:25:59 +0000 Subject: [PATCH] (MESS) Applix: added keyboard (nw) --- src/mess/drivers/applix.c | 446 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 425 insertions(+), 21 deletions(-) diff --git a/src/mess/drivers/applix.c b/src/mess/drivers/applix.c index 4ec868c0d27..91eac11b416 100644 --- a/src/mess/drivers/applix.c +++ b/src/mess/drivers/applix.c @@ -30,7 +30,8 @@ #include "video/mc6845.h" #include "machine/6522via.h" #include "machine/wd_fdc.h" -#include "machine/pc_kbdc.h" +#include "cpu/mcs51/mcs51.h" + class applix_state : public driver_device @@ -92,6 +93,21 @@ public: bool m_data_or_cmd; bool m_buffer_empty; bool m_fdc_cmd; + UINT8 m_clock_count; + bool m_cp; + UINT8 m_p1; + UINT8 m_p1_data; + UINT8 m_p2; + UINT8 m_p3; + UINT16 m_last_write_addr; + DECLARE_READ8_MEMBER( internal_data_read ); + DECLARE_WRITE8_MEMBER( internal_data_write ); + DECLARE_READ8_MEMBER( p1_read ); + DECLARE_WRITE8_MEMBER( p1_write ); + DECLARE_READ8_MEMBER( p2_read ); + DECLARE_WRITE8_MEMBER( p2_write ); + DECLARE_READ8_MEMBER( p3_read ); + DECLARE_WRITE8_MEMBER( p3_write ); virtual void machine_reset(); virtual void video_start(); virtual void palette_init(); @@ -171,9 +187,30 @@ READ8_MEMBER( applix_state::applix_pb_r ) return m_pb; } +/* +d0 = /(in) printer busy signal +d1 = /(out) printer strobe +d2 = /(out) enable cassette write IRQ +d3 = (out) H = 640 video mode +d4 = /(out) enable cassette read IRQ +d5 = /(out) clear cass IRQ and output line +d6 = /(out) reset keyboard by pulling kbd clock low +d7 = /(out) reset keyboard flipflop +*/ WRITE8_MEMBER( applix_state::applix_pa_w ) -{ +{//printf("pa=%X ",data); m_pa = data; + + // Reset flipflop counter + if (!BIT(data, 7)) + m_clock_count = 0; + + // Reset keyboard + if (!BIT(data, 6)) + { + m_p3 = 0xff; + m_last_write_addr = 0; + } } WRITE8_MEMBER( applix_state::applix_pb_w ) @@ -332,6 +369,16 @@ static ADDRESS_MAP_START( subcpu_io, AS_IO, 8, applix_state ) AM_RANGE(0x60, 0x63) AM_MIRROR(0x1c) AM_READWRITE(port60_r,port60_w) //anotherZ80SCC ADDRESS_MAP_END +static ADDRESS_MAP_START( keytronic_pc3270_program, AS_PROGRAM, 8, applix_state ) + AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION("kbdcpu", 0) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( keytronic_pc3270_io, AS_IO, 8, applix_state ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(internal_data_read, internal_data_write) + AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READWRITE(p1_read, p1_write) + AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_READWRITE(p2_read, p2_write) + AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_READWRITE(p3_read, p3_write) +ADDRESS_MAP_END // io priorities: // 4 cassette @@ -340,6 +387,206 @@ ADDRESS_MAP_END /* Input ports */ static INPUT_PORTS_START( applix ) + PORT_START( "kb_keytronic_0f" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') /* 06 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') /* 05 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') /* 14 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') /* 13 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') /* 22 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') /* 21 */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7 (IRMA)") /* 41 */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6a?") /* 6a */ + + PORT_START( "kb_keytronic_30_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') /* 31 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') /* 32 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') /* 30 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') /* 2f */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') /* 2e */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') /* 33 */ + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "kb_keytronic_30_1" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) /* 58 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) /* 59 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) /* 5a */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) /* 5b */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) /* 5c */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) /* 5d */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6b?") /* 6b */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8 (IRMA)") /* 42 */ + + PORT_START( "kb_keytronic_31_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') /* 07 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') /* 08 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') /* 15 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') /* 16 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') /* 23 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') /* 24 */ + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "kb_keytronic_31_1" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) /* 37 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) /* 5f */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_NAME("LShift") /* 2a */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("<") /* 70 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') /* 2c */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') /* 2d */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6c?") /* 6c */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9 (IRMA)") /* 43 */ + + PORT_START( "kb_keytronic_32_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') /* 0a */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') /* 09 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') /* 18 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') /* 17 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') /* 26 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') /* 25 */ + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "kb_keytronic_32_1" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) /* 57 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) /* 1d */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) /* 71 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_NAME("LAlt") /* 38 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') /* 39 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) PORT_NAME("RAlt") /* 38 */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?69?") /* 69 */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F6 (IRMA)") /* 40 */ + + PORT_START( "kb_keytronic_33_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("KP 2") /* 50 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CODE(KEYCODE_END) PORT_NAME("KP 1") /* 4f */ + PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Down") /* 55 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Enter") /* 75 */ + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "kb_keytronic_33_1" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') /* 02 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') /* 29 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') /* 10 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) /* 0f */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') /* 1e */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_NAME("Caps") /* 3a */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?68?") /* 68 */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5 (IRMA)") /* 3f */ + + PORT_START( "kb_keytronic_34_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') /* 35 */ + PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) /* 36 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left") /* 56 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') /* 34 */ + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "kb_keytronic_34_1" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') /* 02 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') /* 03 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') /* 11 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') /* 12 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') /* 1f */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') /* 20 */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?67?") /* 67 */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4 (IRMA)") /* 3e */ + + PORT_START( "kb_keytronic_35_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') /* 0b */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') /* 0c */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') /* 19 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') /* 1a */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') /* 27 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') /* 28 */ + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "kb_keytronic_35_1" ) + PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?66?") /* 66 */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F3 (IRMA)") /* 3d */ + + PORT_START( "kb_keytronic_36_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) /* 0e */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') /* 0d */ + PORT_BIT( 0x14, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) /* 1c */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') /* 2b */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') /* 1b */ + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "kb_keytronic_36_1" ) + PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F2 (IRMA)") /* 3c */ + + PORT_START( "kb_keytronic_37_0" ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PA1") /* 7b */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("|<--") /* 7e */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/a\\") /* 7a */ + PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("KP +") /* 4e */ + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "kb_keytronic_37_1" ) + PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?64?") /* 64 */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1 (IRMA)") /* 3b */ + + PORT_START( "kb_keytronic_38_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SysReq") /* 54 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) /*PORT_CODE(KEYCODE_SCRLOCK)*/ PORT_NAME("ScrLock") /* 46 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("-->|") /* 7c */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CODE(KEYCODE_PGUP) PORT_NAME("KP 9") /* 49 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("KP -") /* 4a */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("KP 6") /* 4d */ + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START( "kb_keytronic_39_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_NAME("Esc") /* 01 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_NAME("NumLock") /* 45 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_HOME) PORT_NAME("KP 7") /* 47 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_UP) PORT_NAME("KP 8") /* 48 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("KP 4") /* 4b */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("KP 5") /* 4c */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?76?") /* 76 */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?63?") /* 63 */ + + PORT_START( "kb_keytronic_3a_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PrtSc *") /* 6f */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PA2") /* 7f */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right") /* 7d */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/a") /* 79 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Center") /* 77 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6e?") /* 6e */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?62?") /* 62 */ + + PORT_START( "kb_keytronic_3b_0" ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("KP 3") /* 51 */ + PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(KEYCODE_INSERT) PORT_NAME("KP 0") /* 52 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CODE(KEYCODE_DEL) PORT_NAME("KP .") /* 53 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Up") /* 78 */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6d?") /* 6d */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F10 (IRMA)") /* 44 */ + + PORT_START( "kb_keytronic_0b" ) + PORT_DIPNAME( 0x01, 0x01, "Protocol selection" ) + PORT_DIPSETTING( 0x00, "Enhanced XT, AT and PS/2 models" ) + PORT_DIPSETTING( 0x01, "Standard PC and XT" ) + PORT_DIPNAME( 0x02, 0x00, "IRMA/Native scan code set" ) + PORT_DIPSETTING( 0x00, "Native scan code set" ) + PORT_DIPSETTING( 0x02, "IRMA Emulation" ) + PORT_DIPNAME( 0x04, 0x04, "Enhanced 101/Native scan code set" ) + PORT_DIPSETTING( 0x00, "Native scan code set" ) + PORT_DIPSETTING( 0x04, "Enhanced 101 scan code set" ) + PORT_DIPNAME( 0x08, 0x08, "Enable E0" ) + PORT_DIPSETTING( 0x00, "Enable E0" ) + PORT_DIPSETTING( 0x08, "Disable E0" ) + PORT_DIPNAME( 0x10, 0x10, "Code tables" ) + PORT_DIPSETTING( 0x00, "U.S. code tables" ) + PORT_DIPSETTING( 0x10, "International code tables" ) + PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_DIPNAME( 0x80, 0x80, "Key click" ) + PORT_DIPSETTING( 0x00, "No key click" ) + PORT_DIPSETTING( 0x80, "Key click" ) + PORT_START("DSW") PORT_BIT( 0xf, 0, IPT_UNUSED ) PORT_DIPNAME( 0x10, 0x00, "Switch 0") PORT_DIPLOCATION("SW2:1") @@ -368,14 +615,16 @@ void applix_state::machine_reset() UINT8* ROM = memregion("maincpu")->base(); memcpy(m_expansion, ROM, 8); membank("bank1")->set_entry(0); + m_p3 = 0xff; + m_last_write_addr = 0; m_maincpu->reset(); } -//FLOPPY_FORMATS_MEMBER( mirage_state::floppy_formats ) -// FLOPPY_ESQ8IMG_FORMAT +//FLOPPY_FORMATS_MEMBER( applix_state::floppy_formats ) +// FLOPPY_APPLIX_FORMAT //FLOPPY_FORMATS_END -//static SLOT_INTERFACE_START( ensoniq_floppies ) +//static SLOT_INTERFACE_START( applix_floppies ) // SLOT_INTERFACE( "35dd", FLOPPY_35_DD ) //SLOT_INTERFACE_END @@ -490,21 +739,6 @@ static const via6522_interface applix_via = DEVCB_CPU_INPUT_LINE("maincpu", M68K_IRQ_2) //IRQ }; -WRITE_LINE_MEMBER( applix_state::kbd_clock_w ) -{ - m_via->write_cb1(state); // need to drop unknown number of pulses -} - -WRITE_LINE_MEMBER( applix_state::kbd_data_w ) -{ - m_via->write_cb2(state); -} - -static const pc_kbdc_interface applix_kbdc = -{ - DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, applix_state, kbd_clock_w), - DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, applix_state, kbd_data_w) -}; static MACHINE_CONFIG_START( applix, applix_state ) /* basic machine hardware */ @@ -513,6 +747,9 @@ static MACHINE_CONFIG_START( applix, applix_state ) MCFG_CPU_ADD("subcpu", Z80, XTAL_16MHz / 2) // Z80H MCFG_CPU_PROGRAM_MAP(subcpu_mem) MCFG_CPU_IO_MAP(subcpu_io) + MCFG_CPU_ADD("kbdcpu", I8051, 11060250) + MCFG_CPU_PROGRAM_MAP(keytronic_pc3270_program) + MCFG_CPU_IO_MAP(keytronic_pc3270_io) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -528,7 +765,6 @@ static MACHINE_CONFIG_START( applix, applix_state ) MCFG_VIA6522_ADD("via6522", 0, applix_via) MCFG_WD1772x_ADD("wd1772", XTAL_16MHz / 2) //connected to Z80H clock pin // MCFG_FLOPPY_DRIVE_ADD("wd1772:0", applix_floppies, "35dd", 0, applix_state::floppy_formats) - MCFG_PC_KBDC_ADD("kbdc", applix_kbdc) MACHINE_CONFIG_END /* ROM definition */ @@ -546,6 +782,9 @@ ROM_START( applix ) ROM_REGION(0x20000, "user1", 0) ROM_LOAD( "1616osv.045", 0x00000, 0x20000, CRC(b9f75432) SHA1(278964e2a02b1fe26ff34f09dc040e03c1d81a6d) ) + + ROM_REGION(0x2000, "kbdcpu", 0) + ROM_LOAD("14166.bin", 0x0000, 0x2000, CRC(1aea1b53) SHA1(b75b6d4509036406052157bc34159f7039cdc72e)) ROM_END @@ -572,3 +811,168 @@ DRIVER_INIT_MEMBER(applix_state, applix) /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ COMP( 1986, applix, 0, 0, applix, applix, applix_state, applix, "Applix Pty Ltd", "Applix 1616", GAME_NOT_WORKING | GAME_NO_SOUND) + + + +/**************************************************** KEYBOARD MODULE *****************************************/ + +READ8_MEMBER( applix_state::internal_data_read ) +{ + m_via->write_cb2( BIT(offset, 8) ); // data + bool cp = !BIT(offset, 9); + if (cp != m_cp) + { + m_cp = cp; + if (cp) + m_clock_count++; + } + if (m_clock_count > 2) + m_via->write_cb1( cp ); + + return 0xff; +} + + +WRITE8_MEMBER( applix_state::internal_data_write ) +{ + /* Check for low->high transition on AD8 */ + if ( ! ( m_last_write_addr & 0x0100 ) && ( offset & 0x0100 ) ) + { + switch (m_p1) + { + case 0x0e: + break; + case 0x0f: + m_p1_data = ioport("kb_keytronic_0f")->read(); + break; + case 0x30: + m_p1_data = ioport("kb_keytronic_30_0")->read(); + break; + case 0x31: + m_p1_data = ioport("kb_keytronic_31_0")->read(); + break; + case 0x32: + m_p1_data = ioport("kb_keytronic_32_0")->read(); + break; + case 0x33: + m_p1_data = ioport("kb_keytronic_33_0")->read(); + break; + case 0x34: + m_p1_data = ioport("kb_keytronic_34_0")->read(); + break; + case 0x35: + m_p1_data = ioport("kb_keytronic_35_0")->read(); + break; + case 0x36: + m_p1_data = ioport("kb_keytronic_36_0")->read(); + break; + case 0x37: + m_p1_data = ioport("kb_keytronic_37_0")->read() | (ioport("kb_keytronic_36_0")->read() & 0x01); + break; + case 0x38: + m_p1_data = ioport("kb_keytronic_38_0")->read(); + break; + case 0x39: + m_p1_data = ioport("kb_keytronic_39_0")->read(); + break; + case 0x3a: + m_p1_data = ioport("kb_keytronic_3a_0")->read(); + break; + case 0x3b: + m_p1_data = ioport("kb_keytronic_3b_0")->read(); + break; + } + } + + /* Check for low->high transition on AD9 */ + if ( ! ( m_last_write_addr & 0x0200 ) && ( offset & 0x0200 ) ) + { + switch (m_p1) + { + case 0x0b: + m_p1_data = ioport("kb_keytronic_0b")->read(); + break; + case 0x30: + m_p1_data = ioport("kb_keytronic_30_1")->read(); + break; + case 0x31: + m_p1_data = ioport("kb_keytronic_31_1")->read(); + break; + case 0x32: + m_p1_data = ioport("kb_keytronic_32_1")->read(); + break; + case 0x33: + m_p1_data = ioport("kb_keytronic_33_1")->read(); + break; + case 0x34: + m_p1_data = ioport("kb_keytronic_34_1")->read(); + break; + case 0x35: + m_p1_data = ioport("kb_keytronic_35_1")->read(); + break; + case 0x36: + m_p1_data = ioport("kb_keytronic_36_1")->read(); + break; + case 0x37: + m_p1_data = ioport("kb_keytronic_37_1")->read(); + break; + case 0x38: + m_p1_data = 0xff; + break; + case 0x39: + m_p1_data = 0xff; + break; + case 0x3a: + m_p1_data = 0xff; + break; + } + } + + m_last_write_addr = offset; +} + + +READ8_MEMBER( applix_state::p1_read ) +{ + return m_p1 & m_p1_data; +} + + +WRITE8_MEMBER( applix_state::p1_write ) +{ + m_p1 = data; +} + + +READ8_MEMBER( applix_state::p2_read ) +{ + return m_p2; +} + + +WRITE8_MEMBER( applix_state::p2_write ) +{ + m_p2 = data; +} + + +READ8_MEMBER( applix_state::p3_read ) +{ + UINT8 data = m_p3; + + data &= ~0x14; + + /* -INT0 signal */ + data |= 4;//(clock_signal() ? 0x04 : 0x00); + + /* T0 signal */ + data |= 0;//(data_signal() ? 0x00 : 0x10); + + return data; +} + + +WRITE8_MEMBER( applix_state::p3_write ) +{ + m_p3 = data; +}