summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorGravatarGravatar R. Belmont <rb6502@users.noreply.github.com>2014-01-10 03:15:35 +0000
committerGravatarGravatar R. Belmont <rb6502@users.noreply.github.com>2014-01-10 03:15:35 +0000
commit16944c361e6d8afdce89caf7c34e64b3e93372c1 (patch)
tree607ecee2b3e2dc9c0a2b072edd6bed56cb310a26 /src
parent0c310baef57efe3e7405026516cd139bfffddec8 (diff)
(MESS) DEC Rainbow updates:
- Removed preliminary keyboard/sound hacks [Bavarese] - Improved LK201 mapping (KBD13 keys, keys > F12) [Bavarese] - Layout LED polarity fixed [Bavarese] - Improved (still imperfect) bidirectional comms with LK201 [R. Belmont]
Diffstat (limited to 'src')
-rw-r--r--src/mess/drivers/rainbow.c154
-rw-r--r--src/mess/layout/rainbow.lay40
-rw-r--r--src/mess/machine/dec_lk201.c36
-rw-r--r--src/mess/machine/dec_lk201.h7
4 files changed, 61 insertions, 176 deletions
diff --git a/src/mess/drivers/rainbow.c b/src/mess/drivers/rainbow.c
index ad203bb8aed..893a20d0812 100644
--- a/src/mess/drivers/rainbow.c
+++ b/src/mess/drivers/rainbow.c
@@ -160,9 +160,8 @@ W16 pulls J2 printer port pin 1 to GND when set (chassis to logical GND).
W17 pulls J1 serial port pin 1 to GND when set (chassis to logical GND).
****************************************************************************/
-// Workarounds DO NOT APPLY to the 190-B ROM. Only enable when compiling the 'rainbow' driver -
+// Workaround DOES NOT APPLY to the 190-B ROM. Only enable when compiling the 'rainbow' driver -
//#define FORCE_RAINBOW_100_LOGO
-#define KBD_DELAY 875 // (debounce delay). Recommended: 875.
#include "emu.h"
#include "cpu/i86/i86.h"
@@ -175,7 +174,6 @@ W17 pulls J1 serial port pin 1 to GND when set (chassis to logical GND).
#include "machine/i8251.h"
#include "machine/dec_lk201.h"
-#include "sound/beep.h"
#include "machine/nvram.h"
#include "rainbow.lh" // BEZEL - LAYOUT with LEDs for diag 1-7, keyboard 8-11 and floppy 20-23
@@ -195,7 +193,6 @@ public:
m_inp8(*this, "MEMORY PRESENT"),
m_inp9(*this, "MONITOR TYPE"),
- m_beep(*this, "beeper"),
m_crtc(*this, "vt100_video"),
m_i8088(*this, "maincpu"),
m_z80(*this, "subcpu"),
@@ -220,8 +217,6 @@ public:
required_ioport m_inp8;
required_ioport m_inp9;
- required_device<beep_device> m_beep;
-
required_device<rainbow_video_device> m_crtc;
required_device<cpu_device> m_i8088;
required_device<cpu_device> m_z80;
@@ -252,10 +247,6 @@ public:
DECLARE_WRITE8_MEMBER(floating_bus_w);
DECLARE_READ8_MEMBER(hd_status_68_r);
- // EMULATOR TRAP TO INTERCEPT KEYBOARD cmd in AH and PARAMETER in AL (port 90 = AL / port 91 = AH)
- // TODO: beeper and led handling should better be handled by LK201 code.
- DECLARE_WRITE8_MEMBER(PORT90_W);
- DECLARE_WRITE8_MEMBER(PORT91_W);
DECLARE_READ8_MEMBER(i8088_latch_r);
DECLARE_WRITE8_MEMBER(i8088_latch_w);
@@ -338,32 +329,6 @@ void rainbow_state::machine_start()
rom[0xf4384]=0xeb; // JMPS => BOOT80
#endif
- // Enables PORT90_W + PORT91_W via BIOS call (offset +$21 in HIGH ROM)
- // F8 / FC ROM REGION (CHECK + PATCH)
- if(rom[0xfc000 + 0x0022] == 0x22 && rom[0xfc000 + 0x0023] == 0x28)
- {
- rom[0xf4303]=0x00; // Disable CRC CHECK (F0 / F4 ROM)
-
- rom[0xfc000 + 0x0022] =0xfe; // jmp to offset $1922
- rom[0xfc000 + 0x0023] =0x18;
-
- rom[0xfc000 + 0x1922] =0xe6; // out 90,al
- rom[0xfc000 + 0x1923] =0x90;
-
- rom[0xfc000 + 0x1924] =0x86; // xchg al,ah
- rom[0xfc000 + 0x1925] =0xc4;
-
- rom[0xfc000 + 0x1926] =0xe6; // out 91,al
- rom[0xfc000 + 0x1927] =0x91;
-
- rom[0xfc000 + 0x1928] =0x86; // xchg al,ah
- rom[0xfc000 + 0x1929] =0xc4;
-
- rom[0xfc000 + 0x192a] =0xe9; // jmp (original jump offset $2846) e9 + 19 0f
- rom[0xfc000 + 0x192b] =0x19;
- rom[0xfc000 + 0x192c] =0x0f;
- }
-
}
static ADDRESS_MAP_START( rainbow8088_map, AS_PROGRAM, 8, rainbow_state)
@@ -443,9 +408,6 @@ static ADDRESS_MAP_START( rainbow8088_io , AS_IO, 8, rainbow_state)
// - DOS 3 has a 1024 cylinder limit (32 MB).
// - the custom boot loader that comes with 'WUTIL 3.2' allows 117 MB and 8 surfaces.
AM_RANGE (0x68, 0x68) AM_READ(hd_status_68_r)
-
- AM_RANGE (0x90, 0x90) AM_WRITE(PORT90_W)
- AM_RANGE (0x91, 0x91) AM_WRITE(PORT91_W)
ADDRESS_MAP_END
static ADDRESS_MAP_START(rainbowz80_mem, AS_PROGRAM, 8, rainbow_state)
@@ -468,9 +430,8 @@ ADDRESS_MAP_END
/* Input ports */
-/* KEYBOARD (preliminary - transfer to DEC_LK201.xx as soon as possible) */
-static INPUT_PORTS_START( rainbow100b_in )
/* DIP switches */
+static INPUT_PORTS_START( rainbow100b_in )
PORT_START("MONITOR TYPE")
PORT_DIPNAME( 0x03, 0x03, "MONOCHROME MONITOR")
PORT_DIPSETTING( 0x01, "PAPER WHITE" )
@@ -565,9 +526,6 @@ void rainbow_state::machine_reset()
m_KBD = 0;
- m_beep->set_frequency(2000);
- m_beep->set_state(0);
-
// RESET ALL LEDs
output_set_value("led1", 1);
output_set_value("led2", 1);
@@ -576,10 +534,12 @@ void rainbow_state::machine_reset()
output_set_value("led5", 1);
output_set_value("led6", 1);
output_set_value("led7", 1);
- output_set_value("led8", 1);
- output_set_value("led9", 1);
- output_set_value("led10", 1);
- output_set_value("led11", 1);
+
+ // GREEN KEYBOARD LEDs (1 = on, 0 = off):
+ output_set_value("led_wait", 0); // led8
+ output_set_value("led_compose", 0); // led9
+ output_set_value("led_lock", 0); // led10
+ output_set_value("led_hold", 0); // led11
MOTOR_DISABLE_counter = 2; // soon resets drv.LEDs
m_unit = 0;
@@ -758,87 +718,6 @@ WRITE8_MEMBER(rainbow_state::comm_control_w)
// printf("%02x to COMM.CONTROL REGISTER\n", data);
}
-// EMULATOR TRAP (patched into ROM @ machine_start) via BIOS : call / offset +$21 (AL / AH)
-WRITE8_MEMBER(rainbow_state::PORT90_W)
-{
- //printf("KBD COMMAND : %02x to AL (90)\n", data);
-
- m_KBD = 0; // reset previous command.
-
- if(MOTOR_DISABLE_counter == 0)
- {
- if (data == LK_CMD_POWER_UP) { // Powerup (beep)
- //m_beep->set_state(1);
- //m_beep_counter=600; // BELL = 125 ms
- }
-
- if (data == LK_CMD_BELL) {
- m_KBD = data;
- m_beep->set_state(1);
- m_beep_counter=600; // BELL = 125 ms
- }
-
- if (data == LK_CMD_SOUND_CLK) { // emit a keyclick (2ms)
- m_KBD = data;
- m_beep->set_state(1);
- m_beep_counter=25; // longer than calculated ( 9,6 )
- }
-
- if (data == LK_CMD_ENB_BELL) { // enable the bell - PARAMETER: VOLUME!
- m_KBD = data;
- }
-
- if (data == LK_CMD_ENB_KEYCLK) { // enable the keyclick- PARAMETER: VOLUME!
- m_KBD = data;
- }
-
- if (data == LK_CMD_LEDS_ON ) { // light LEDs -
- m_KBD = data;
- }
- if (data == LK_CMD_LEDS_OFF) { // switch off LEDs -
- m_KBD = data;
- }
-
- } // prevent beeps during disk load operations
-}
-
-WRITE8_MEMBER(rainbow_state::PORT91_W)
-{
- // 4 leds, represented in the low 4 bits of a byte
- if (m_KBD == LK_CMD_LEDS_ON) { // light LEDs -
- if (data & 1) { output_set_value("led8", 0); } // KEYBOARD : "Wait" LED
- if (data & 2) { output_set_value("led9", 0); } // KEYBOARD : "Compose" LED
- if (data & 4) { output_set_value("led10", 0); } // KEYBOARD : "Lock" LED
- if (data & 8) { output_set_value("led11", 0); } // KEYBOARD : "Hold" LED
- m_KBD = 0; // reset previous command.
- }
- if (m_KBD == LK_CMD_LEDS_OFF) { // switch off LEDs -
- if (data & 1) { output_set_value("led8", 1); } // KEYBOARD : "Wait" LED
- if (data & 2) { output_set_value("led9", 1); } // KEYBOARD : "Compose" LED
- if (data & 4) { output_set_value("led10", 1); } // KEYBOARD : "Lock" LED
- if (data & 8) { output_set_value("led11", 1); } // KEYBOARD : "Hold" LED
- m_KBD = 0; // reset previous command.
- }
-
- // NVRAM offet $A8 : BELL VOLUME (=> ENABLE BELL 0x23)
- if ( (m_KBD == LK_CMD_BELL) || (m_KBD == LK_CMD_ENB_BELL) ) /* BOTH sound or enable bell have a parameter */
- { /* max volume is 0, lowest is 0x7 */
-// printf("\n%02x BELL CMD has bell volume = %02x\n", m_KBD, 8 - (data & 7));
- m_KBD = 0; // reset previous command.
- }
-
- // NVRAM offet $A9 = KEYCLICK VOLUME (=> ENABLE CLK 0x1b)
- // NVRAM offset $8C = KEYCLICK ENABLE / DISABLE (0/1)
- if ( ( m_KBD == LK_CMD_ENB_KEYCLK ) || ( m_KBD == LK_CMD_SOUND_CLK ) ) /* BOTH keyclick cmds have a parameter */
- { // max volume is 0, lowest is 0x7 - 87 (BELL VOL:1) and 80 (BELL VOL:8)
-// printf("\n%02x CLICK CMD - keyclick volume = %02x\n", m_KBD, 8 - (data & 7));
- m_KBD = 0; // reset previous command.
- }
-
-if (m_KBD > 0)
- printf("UNHANDLED PARAM FOR MODE: %02x / KBD PARAM %02x to AH (91) \n", m_KBD, data);
-
-}
// 8088 reads port 0x00. See page 133 (4-34)
READ8_MEMBER(rainbow_state::i8088_latch_r)
{
@@ -1146,7 +1025,7 @@ WRITE_LINE_MEMBER(rainbow_state::kbd_rxready_w)
WRITE_LINE_MEMBER(rainbow_state::kbd_txready_w)
{
-// printf("txready %d\n", state);
+// printf("8251 txready %d\n", state);
m_kbd_tx_ready = (state == 1) ? true : false;
update_kbd_irq();
}
@@ -1176,13 +1055,8 @@ TIMER_DEVICE_CALLBACK_MEMBER(rainbow_state::keyboard_tick)
*/
}
- if (m_beep_counter > 1)
+ if (m_beep_counter > 0)
m_beep_counter--;
- else
- if ( m_beep_counter == 1 )
- { m_beep->set_state(0);
- m_beep_counter = 0;
- }
}
static const vt_video_interface video_interface =
@@ -1268,11 +1142,6 @@ static MACHINE_CONFIG_START( rainbow, rainbow_state )
MCFG_RAINBOW_VIDEO_ADD("vt100_video", video_interface)
- /* sound hardware */
- MCFG_SPEAKER_STANDARD_MONO("mono")
- MCFG_SOUND_ADD("beeper", BEEP, 0)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50)
-
MCFG_FD1793_ADD("wd1793", rainbow_wd17xx_interface )
MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(floppy_intf)
MCFG_SOFTWARE_LIST_ADD("flop_list","rainbow")
@@ -1281,6 +1150,8 @@ static MACHINE_CONFIG_START( rainbow, rainbow_state )
MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", rainbow_state, keyboard_tick, attotime::from_hz(4800*16)) // 8251 is set to /16 on the clock input
MCFG_LK201_ADD()
+ MCFG_LK201_SET_TX_CALLBACK(DEVWRITELINE("kbdser", i8251_device, write_rx))
+
MCFG_NVRAM_ADD_0FILL("nvram")
MACHINE_CONFIG_END
@@ -1328,3 +1199,4 @@ ROM_END
/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */
COMP( 1983, rainbow , 0 , 0, rainbow, rainbow100b_in, driver_device, 0, "Digital Equipment Corporation", "Rainbow 100-B", GAME_NOT_WORKING | GAME_IMPERFECT_COLORS)
COMP( 1985, rainb190, rainbow, 0, rainbow, rainbow100b_in, driver_device, 0, "Digital Equipment Corporation", "Rainbow 190-B", GAME_NOT_WORKING | GAME_IMPERFECT_COLORS)
+
diff --git a/src/mess/layout/rainbow.lay b/src/mess/layout/rainbow.lay
index c41c81d3c9a..e2f682c1524 100644
--- a/src/mess/layout/rainbow.lay
+++ b/src/mess/layout/rainbow.lay
@@ -18,10 +18,10 @@
</element>
<element name="greenkbd" defstate="0">
- <disk state="0">
+ <disk state="1">
<color red="0.0" green="0.75" blue="0.0" />
</disk>
- <disk state="1">
+ <disk state="0">
<color red="0.0" green="0.20" blue="0.0" />
</disk>
</element>
@@ -85,27 +85,28 @@
</text>
</element>
- <element name="l8wait">
- <text string="WAIT">
+ <element name="l8_hold">
+ <text string="HOLD">
<color red="1.0" green="1.0" blue="1.0" />
</text>
</element>
- <element name="l9">
- <text string="COMP">
+ <element name="l9_lock">
+ <text string="LOCK">
<color red="1.0" green="1.0" blue="1.0" />
</text>
- </element>
- <element name="l10">
- <text string="LOCK">
+ </element>
+ <element name="l10_comp">
+ <text string="COMP">
<color red="1.0" green="1.0" blue="1.0" />
</text>
</element>
- <element name="l11">
- <text string="HOLD">
+ <element name="l11_wait">
+ <text string="WAIT">
<color red="1.0" green="1.0" blue="1.0" />
</text>
</element>
+
<view name="Default Layout">
<screen index="0">
<bounds x="30" y="0" width="640" height="480" />
@@ -145,16 +146,17 @@
<bezel name="led7" element="sysled">
<bounds x="15" y="196" width="10" height="10" />
</bezel>
- <bezel name="led8" element="greenkbd">
+
+ <bezel name="led_hold" element="greenkbd">
<bounds x="15" y="226" width="10" height="10" />
</bezel>
- <bezel name="led9" element="greenkbd">
+ <bezel name="led_lock" element="greenkbd">
<bounds x="15" y="246" width="10" height="10" />
</bezel>
- <bezel name="led10" element="greenkbd">
+ <bezel name="led_compose" element="greenkbd">
<bounds x="15" y="265" width="10" height="10" />
</bezel>
- <bezel name="led11" element="greenkbd">
+ <bezel name="led_wait" element="greenkbd">
<bounds x="15" y="285" width="10" height="10" />
</bezel>
@@ -192,16 +194,16 @@
<bezel name="label7" element="l7">
<bounds x="0" y="193" width="15" height="16" />
</bezel>
- <bezel name="label8" element="l8wait">
+ <bezel name="label8" element="l8_hold">
<bounds x="0" y="222" width="15" height="16" />
</bezel>
- <bezel name="label9" element="l9">
+ <bezel name="label9" element="l9_lock">
<bounds x="0" y="242" width="15" height="16" />
</bezel>
- <bezel name="label10" element="l10">
+ <bezel name="label10" element="l10_comp">
<bounds x="0" y="262" width="15" height="16" />
</bezel>
- <bezel name="label11" element="l11">
+ <bezel name="label11" element="l11_wait">
<bounds x="0" y="282" width="15" height="16" />
</bezel>
</view>
diff --git a/src/mess/machine/dec_lk201.c b/src/mess/machine/dec_lk201.c
index d323f67cdf1..b1aeeeadae0 100644
--- a/src/mess/machine/dec_lk201.c
+++ b/src/mess/machine/dec_lk201.c
@@ -332,20 +332,20 @@ INPUT_PORTS_START( lk201 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L)
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9)
- PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F13")
+ PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F13") PORT_CODE(KEYCODE_PRTSCR)
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F12") PORT_CODE(KEYCODE_F12)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START("KBD11")
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/")
- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(";")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH)
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(";") PORT_CODE(KEYCODE_COLON)
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) // FIXME - duplicate "Return"
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P)
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0)
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE)
- PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Additional Options")
+ PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Additional Options (F14)") PORT_CODE(KEYCODE_SCRLOCK)
PORT_START("KBD12")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH)
@@ -353,7 +353,7 @@ INPUT_PORTS_START( lk201 )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE)
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Select") PORT_CODE(KEYCODE_DEL)
- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Help")
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Help (F15)") PORT_CODE(KEYCODE_RALT)
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Find") PORT_CODE(KEYCODE_INSERT)
@@ -363,8 +363,8 @@ INPUT_PORTS_START( lk201 )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE)
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Previous") PORT_CODE(KEYCODE_END)
- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS)
- PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD )
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Do (F16)")
+ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Insert Here") PORT_CODE(KEYCODE_HOME)
PORT_START("KBD14")
@@ -388,7 +388,7 @@ INPUT_PORTS_START( lk201 )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F17")
PORT_START("KBD16")
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Num .") PORT_CODE(KEYCODE_DEL_PAD) // "." on num.pad
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Num 3") PORT_CODE(KEYCODE_3_PAD)
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Num 6") PORT_CODE(KEYCODE_6_PAD)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN)
@@ -402,7 +402,7 @@ INPUT_PORTS_START( lk201 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Num ,") PORT_CODE(KEYCODE_PLUS_PAD)
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Num -")
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PF4") PORT_CODE(KEYCODE_MINUS_PAD)
- PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F20")
+ PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F20") PORT_CODE(KEYCODE_PAUSE)
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F19")
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
@@ -429,6 +429,7 @@ ioport_constructor lk201_device::device_input_ports() const
lk201_device::lk201_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, LK201, "DEC LK201 keyboard", tag, owner, clock, "lk201", __FILE__),
device_serial_interface(mconfig, *this),
+ m_tx_write(*this),
m_maincpu(*this, LK201_CPU_TAG),
m_speaker(*this, LK201_SPK_TAG),
m_kbd0(*this, "KBD0"),
@@ -458,6 +459,7 @@ lk201_device::lk201_device(const machine_config &mconfig, const char *tag, devic
void lk201_device::device_start()
{
+ m_tx_write.resolve_safe();
}
@@ -467,7 +469,7 @@ void lk201_device::device_start()
void lk201_device::device_reset()
{
- set_rate(4800);
+ set_rate(4800);
set_data_frame(8, 1, PARITY_NONE, false);
sci_status = (SCSR_TC | SCSR_TDRE);
@@ -489,10 +491,10 @@ void lk201_device::device_timer(emu_timer &timer, device_timer_id id, int param,
void lk201_device::rcv_complete()
{
- printf("lk201 got %02x\n", get_received_char());
sci_status |= SCSR_RDRF;
update_interrupts();
receive_register_extract();
+// printf("lk201 got %02x\n", get_received_char());
}
void lk201_device::tra_complete()
@@ -503,7 +505,8 @@ void lk201_device::tra_complete()
void lk201_device::tra_callback()
{
- transmit_register_send_bit();
+ int bit = transmit_register_send_bit();
+ m_tx_write(bit);
}
void lk201_device::input_callback(UINT8 state)
@@ -596,10 +599,10 @@ void lk201_device::send_port(address_space &space, UINT8 offset, UINT8 data)
if (((data & 0x80) == 0) && (ports[offset] & 0x80))
{
// Lower nibble contains the LED values (1 = on, 0 = off)
- output_set_value("led_wait", (led_data & 0x1) == 0);
- output_set_value("led_comp", (led_data & 0x2) == 0);
- output_set_value("led_hold", (led_data & 0x4) == 0);
- output_set_value("led_lock", (led_data & 0x8) == 0);
+ output_set_value("led_wait" , (led_data & 0x1) == 0);
+ output_set_value("led_compose", (led_data & 0x2) == 0);
+ output_set_value("led_hold" , (led_data & 0x4) == 0);
+ output_set_value("led_lock" , (led_data & 0x8) == 0);
}
break;
}
@@ -657,6 +660,7 @@ WRITE8_MEMBER( lk201_device::sci_w )
break;
case SCI_SCDR: // Data
+// printf("LK201: sending %02x\n", data);
transmit_register_setup(data);
sci_status &= ~(SCSR_TC | SCSR_TDRE);
m_maincpu->set_input_line(M68HC05EG_INT_CPI, 0);
diff --git a/src/mess/machine/dec_lk201.h b/src/mess/machine/dec_lk201.h
index 3c17bf78aea..adb4b5f517f 100644
--- a/src/mess/machine/dec_lk201.h
+++ b/src/mess/machine/dec_lk201.h
@@ -39,6 +39,9 @@
#define MCFG_LK201_REMOVE() \
MCFG_DEVICE_REMOVE(LK201_TAG)
+#define MCFG_LK201_SET_TX_CALLBACK(_cb) \
+ devcb = &lk201_device::set_tx_cb(*device, DEVCB2_##_cb);
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -60,6 +63,10 @@ public:
DECLARE_READ8_MEMBER( spi_r );
DECLARE_WRITE8_MEMBER( spi_w );
+ template<class _Object> static devcb2_base &set_tx_cb(device_t &device, _Object wr) { return downcast<lk201_device &>(device).m_tx_write.set_callback(wr); }
+
+ devcb2_write_line m_tx_write;
+
protected:
// device-level overrides
virtual machine_config_constructor device_mconfig_additions() const;