summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Robbbert <Robbbert@users.noreply.github.com>2020-06-08 03:04:22 +1000
committer Robbbert <Robbbert@users.noreply.github.com>2020-06-08 03:04:22 +1000
commit9543ccb3224d9f62e5361eed3092f5879765c426 (patch)
tree6c2cc5fe70b23815a399ad9664dc4732a22bd29f
parentfdc44f82acc3ec828dde6a2a81ad43b687beae36 (diff)
(nw) okean240, tavernie : small cleanups
-rw-r--r--src/mame/drivers/okean240.cpp216
-rw-r--r--src/mame/drivers/tavernie.cpp15
2 files changed, 96 insertions, 135 deletions
diff --git a/src/mame/drivers/okean240.cpp b/src/mame/drivers/okean240.cpp
index c71ef2696c7..5722c3a96d9 100644
--- a/src/mame/drivers/okean240.cpp
+++ b/src/mame/drivers/okean240.cpp
@@ -2,11 +2,13 @@
// copyright-holders:Robbbert
/***************************************************************************
- Okeah-240 (Ocean-240)
+Okeah-240 (Ocean-240).
+Rom says "Chernogolovka Mosk. Reg. Tel 51-24". Chernogolovka is a town
+about 43km from Moscow. It has various research facilities.
- 28/12/2011 Skeleton driver.
+2011-12-28 Skeleton driver.
- Info from EMU80:
+Info from EMU80:
intctl : K580wn59
irq[0]=kbd.irq2
@@ -71,8 +73,11 @@ public:
, m_scroll(0)
, m_tog(0)
, m_p_videoram(*this, "videoram")
+ , m_io_keyboard(*this, "X%d", 0)
, m_io_modifiers(*this, "MODIFIERS")
, m_maincpu(*this, "maincpu")
+ , m_rom(*this, "maincpu")
+ , m_ram(*this, "mainram")
, m_ppikbd(*this, "ppikbd")
{ }
@@ -80,27 +85,19 @@ public:
void okean240t(machine_config &config);
void okean240(machine_config &config);
- void init_okean240();
-
private:
- enum
- {
- TIMER_OKEAN_BOOT
- };
-
- uint8_t okean240_kbd_status_r();
- uint8_t okean240a_kbd_status_r();
- uint8_t term_status_r();
- uint8_t term_r();
- uint8_t okean240_port40_r();
- uint8_t okean240_port41_r();
- void okean240_port42_w(uint8_t data);
- uint8_t okean240a_port40_r();
- uint8_t okean240a_port41_r();
- uint8_t okean240a_port42_r();
+ u8 okean240_kbd_status_r();
+ u8 okean240a_kbd_status_r();
+ u8 term_status_r();
+ u8 term_r();
+ u8 okean240_port40_r();
+ u8 okean240_port41_r();
+ void okean240_port42_w(u8 data);
+ u8 okean240a_port40_r();
+ u8 okean240a_port41_r();
+ u8 okean240a_port42_r();
void kbd_put(u8 data);
- void scroll_w(uint8_t data);
- uint32_t screen_update_okean240(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ u32 screen_update_okean240(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void okean240_io(address_map &map);
void okean240_mem(address_map &map);
@@ -109,21 +106,22 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
- uint8_t m_term_data;
- uint8_t m_j;
- uint8_t m_scroll;
- uint8_t m_tog;
- required_shared_ptr<uint8_t> m_p_videoram;
+ u8 m_term_data;
+ u8 m_j;
+ u8 m_scroll;
+ u8 m_tog;
+ required_shared_ptr<u8> m_p_videoram;
+ optional_ioport_array<11> m_io_keyboard;
optional_ioport m_io_modifiers;
- ioport_port *m_io_port[11];
+ memory_passthrough_handler *m_rom_shadow_tap;
required_device<i8080_cpu_device> m_maincpu;
+ required_region_ptr<u8> m_rom;
+ required_shared_ptr<u8> m_ram;
required_device<i8255_device> m_ppikbd;
};
// okean240 requires bit 4 to change
-uint8_t okean240_state::okean240_kbd_status_r()
+u8 okean240_state::okean240_kbd_status_r()
{
m_tog ^= 0x18;
if (m_term_data)
@@ -133,14 +131,14 @@ uint8_t okean240_state::okean240_kbd_status_r()
}
// see if a key is pressed and indicate status
-uint8_t okean240_state::okean240a_kbd_status_r()
+u8 okean240_state::okean240a_kbd_status_r()
{
- uint8_t i,j;
+ u8 i,j;
m_tog ^= 0x18;
for (i = 0; i < 11; i++)
{
- j = m_io_port[i]->read();
+ j = m_io_keyboard[i]->read();
if (j)
return m_tog | 2;
}
@@ -149,30 +147,30 @@ uint8_t okean240_state::okean240a_kbd_status_r()
}
// for test rom
-uint8_t okean240_state::term_status_r()
+u8 okean240_state::term_status_r()
{
return (m_term_data) ? 3 : 1;
}
-uint8_t okean240_state::okean240_port40_r()
+u8 okean240_state::okean240_port40_r()
{
// port 40 (get ascii key value)
return term_r();
}
-uint8_t okean240_state::okean240_port41_r()
+u8 okean240_state::okean240_port41_r()
{
// port 41 bit 1 (test rom status bit)
m_tog ^= 6;
return m_tog;
}
-uint8_t okean240_state::okean240a_port40_r()
+u8 okean240_state::okean240a_port40_r()
{
// port 40 (get a column)
- for (uint8_t i = 0; i < 11; i++)
+ for (u8 i = 0; i < 11; i++)
{
- uint8_t j = m_io_port[i]->read();
+ u8 j = m_io_keyboard[i]->read();
if (j)
{
if (j==m_j) return 0;
@@ -184,7 +182,7 @@ uint8_t okean240_state::okean240a_port40_r()
return 0;
}
-uint8_t okean240_state::okean240a_port41_r()
+u8 okean240_state::okean240a_port41_r()
{
// port 41 bits 6&7 (modifier keys), and bit 1 (test rom status bit)
{
@@ -193,12 +191,12 @@ uint8_t okean240_state::okean240a_port41_r()
}
}
-uint8_t okean240_state::okean240a_port42_r()
+u8 okean240_state::okean240a_port42_r()
{
// port 42 (get a row)
- for (uint8_t i = 0; i < 11; i++)
+ for (u8 i = 0; i < 11; i++)
{
- if (m_io_port[i]->read() )
+ if (m_io_keyboard[i]->read() )
return i;
}
return 0;
@@ -206,33 +204,27 @@ uint8_t okean240_state::okean240a_port42_r()
// This is a keyboard acknowledge pulse, it goes high then
// straightaway low, if reading port 40 indicates a key is pressed.
-void okean240_state::okean240_port42_w(uint8_t data)
+void okean240_state::okean240_port42_w(u8 data)
{
// okean240: port 42 bit 7
// okean240a: port 42 bit 4
}
// for test rom
-uint8_t okean240_state::term_r()
+u8 okean240_state::term_r()
{
- uint8_t ret = m_term_data;
+ u8 ret = m_term_data;
m_term_data = 0;
return ret;
}
-void okean240_state::scroll_w(uint8_t data)
-{
- m_scroll = data;
-}
-
void okean240_state::okean240_mem(address_map &map)
{
map.unmap_value_high();
- map(0x0000, 0x07ff).bankrw("boot");
- map(0x0800, 0x3fff).ram();
+ map(0x0000, 0x3fff).ram().share("mainram");
map(0x4000, 0x7fff).ram().share("videoram");
map(0x8000, 0xbfff).ram();
- map(0xc000, 0xffff).rom();
+ map(0xc000, 0xffff).rom().region("maincpu", 0);
}
void okean240_state::okean240_io(address_map &map)
@@ -242,8 +234,7 @@ void okean240_state::okean240_io(address_map &map)
map(0x60, 0x63).rw("pit", FUNC(pit8253_device::read), FUNC(pit8253_device::write));
map(0x80, 0x81).rw("pic", FUNC(pic8259_device::read), FUNC(pic8259_device::write));
map(0x80, 0x80).r(FUNC(okean240_state::okean240_kbd_status_r));
- map(0xa0, 0xa0).r(FUNC(okean240_state::term_r));
- map(0xa1, 0xa1).r(FUNC(okean240_state::term_status_r));
+ map(0xa0, 0xa1).rw("uart", FUNC(i8251_device::read), FUNC(i8251_device::write));
map(0xc0, 0xc3).rw("ppic", FUNC(i8255_device::read), FUNC(i8255_device::write));
map(0xe0, 0xe3).rw("ppie", FUNC(i8255_device::read), FUNC(i8255_device::write));
}
@@ -251,13 +242,8 @@ void okean240_state::okean240_io(address_map &map)
void okean240_state::okean240a_io(address_map &map)
{
map.global_mask(0xff);
- map(0x40, 0x43).rw(m_ppikbd, FUNC(i8255_device::read), FUNC(i8255_device::write));
- map(0x60, 0x63).rw("pit", FUNC(pit8253_device::read), FUNC(pit8253_device::write));
- map(0x80, 0x81).rw("pic", FUNC(pic8259_device::read), FUNC(pic8259_device::write));
+ okean240_io(map);
map(0x80, 0x80).r(FUNC(okean240_state::okean240a_kbd_status_r));
- map(0xa0, 0xa1).rw("uart", FUNC(i8251_device::read), FUNC(i8251_device::write));
- map(0xc0, 0xc3).rw("ppic", FUNC(i8255_device::read), FUNC(i8255_device::write));
- map(0xe0, 0xe3).rw("ppie", FUNC(i8255_device::read), FUNC(i8255_device::write));
// map(0x00, 0x1f)=ppa00.data
// map(0x20, 0x23)=dsk.data
// map(0x24, 0x24)=dsk.wait
@@ -273,14 +259,8 @@ void okean240_state::okean240a_io(address_map &map)
void okean240_state::okean240t_io(address_map &map)
{
map.global_mask(0xff);
+ okean240_io(map);
map(0x20, 0x23).nopw();
- map(0x40, 0x43).rw(m_ppikbd, FUNC(i8255_device::read), FUNC(i8255_device::write));
- map(0x60, 0x63).rw("pit", FUNC(pit8253_device::read), FUNC(pit8253_device::write));
- map(0x80, 0x81).rw("pic", FUNC(pic8259_device::read), FUNC(pic8259_device::write));
- map(0x80, 0x80).r(FUNC(okean240_state::okean240_kbd_status_r));
- map(0xa0, 0xa1).rw("uart", FUNC(i8251_device::read), FUNC(i8251_device::write));
- map(0xc0, 0xc3).rw("ppic", FUNC(i8255_device::read), FUNC(i8255_device::write));
- map(0xe0, 0xe3).rw("ppie", FUNC(i8255_device::read), FUNC(i8255_device::write));
}
/* Input ports */
@@ -389,7 +369,7 @@ static INPUT_PORTS_START( okean240a )
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0')
- PORT_START("XA")
+ PORT_START("X10")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
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_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')
@@ -405,65 +385,53 @@ static INPUT_PORTS_START( okean240a )
INPUT_PORTS_END
-void okean240_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
-{
- switch (id)
- {
- case TIMER_OKEAN_BOOT:
- /* after the first 6 bytes have been read from ROM, switch the ram back in */
- membank("boot")->set_entry(0);
- break;
- default:
- throw emu_fatalerror("Unknown id in okean240_state::device_timer");
- }
-}
-
-
void okean240_state::machine_start()
{
- char kbdrow[6];
-
- for (int i = 0; i < 11; i++)
- {
- sprintf(kbdrow,"X%X",i);
- m_io_port[i] = ioport(kbdrow);
- }
+ save_item(NAME(m_term_data));
+ save_item(NAME(m_j));
+ save_item(NAME(m_scroll));
+ save_item(NAME(m_tog));
}
void okean240_state::machine_reset()
{
- timer_set(attotime::from_usec(10), TIMER_OKEAN_BOOT);
- membank("boot")->set_entry(1);
m_term_data = 0;
m_j = 0;
m_scroll = 0;
-}
-void okean240_state::kbd_put(u8 data)
-{
- m_term_data = data;
-}
+ address_space &program = m_maincpu->space(AS_PROGRAM);
+ program.install_rom(0x0000, 0x07ff, m_rom+0x2000); // do it here for F3
+ m_rom_shadow_tap = program.install_read_tap(0xe000, 0xe7ff, "rom_shadow_r",[this](offs_t offset, u8 &data, u8 mem_mask)
+ {
+ if (!machine().side_effects_disabled())
+ {
+ // delete this tap
+ m_rom_shadow_tap->remove();
-void okean240_state::init_okean240()
-{
- uint8_t *RAM = memregion("maincpu")->base();
- membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xe000);
+ // reinstall ram over the rom shadow
+ m_maincpu->space(AS_PROGRAM).install_ram(0x0000, 0x07ff, m_ram);
+ }
+
+ // return the original data
+ return data;
+ });
}
-void okean240_state::video_start()
+void okean240_state::kbd_put(u8 data)
{
+ m_term_data = data;
}
-uint32_t okean240_state::screen_update_okean240(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+u32 okean240_state::screen_update_okean240(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- uint8_t gfx,ma; // ma must be 8bit
- uint16_t x,y;
+ u8 gfx,ma; // ma must be 8bit
+ u16 x,y;
for (y = 0; y < 256; y++)
{
ma = y + m_scroll;
- uint16_t *p = &bitmap.pix16(y);
+ u16 *p = &bitmap.pix16(y);
for (x = 0; x < 0x4000; x+=0x200)
{
@@ -499,11 +467,11 @@ static const gfx_layout okean240_charlayout =
};
static GFXDECODE_START( gfx_okean240 )
- GFXDECODE_ENTRY( "maincpu", 0xec08, okean240_charlayout, 0, 1 )
+ GFXDECODE_ENTRY( "maincpu", 0x2c08, okean240_charlayout, 0, 1 )
GFXDECODE_END
static GFXDECODE_START( gfx_okean240a )
- GFXDECODE_ENTRY( "maincpu", 0xef63, okean240_charlayout, 0, 1 )
+ GFXDECODE_ENTRY( "maincpu", 0x2f63, okean240_charlayout, 0, 1 )
GFXDECODE_END
@@ -531,7 +499,7 @@ void okean240_state::okean240t(machine_config &config)
m_ppikbd->out_pc_callback().set(FUNC(okean240_state::okean240_port42_w));
i8255_device &ppic(I8255(config, "ppic"));
- ppic.out_pa_callback().set(FUNC(okean240_state::scroll_w));
+ ppic.out_pa_callback().set([this] (u8 data) { m_scroll = data; });
I8255(config, "ppie");
@@ -573,34 +541,32 @@ void okean240_state::okean240(machine_config &config)
okean240t(config);
m_maincpu->set_addrmap(AS_IO, &okean240_state::okean240_io);
GFXDECODE(config, "gfxdecode", "palette", gfx_okean240);
- config.device_remove("uart");
- config.device_remove("rs232");
- subdevice<pit8253_device>("pit")->out_handler<1>().set_nop();
+ subdevice<rs232_port_device>("rs232")->set_default_option(nullptr); // not used for keyboard
generic_keyboard_device &keyboard(GENERIC_KEYBOARD(config, "keyboard", 0));
keyboard.set_keyboard_callback(FUNC(okean240_state::kbd_put));
}
/* ROM definition */
ROM_START( okean240 )
- ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
- ROM_LOAD( "monitor.bin", 0xe000, 0x2000, CRC(587799bc) SHA1(1f677afa96722ca4ed2643eaca243548845fc854) )
- ROM_LOAD( "cpm80.bin", 0xc000, 0x2000, CRC(7378e4f9) SHA1(c3c06c6f2e953546452ca6f82140a79d0e4953b4) )
+ ROM_REGION( 0x4000, "maincpu", 0 )
+ ROM_LOAD( "monitor.bin", 0x2000, 0x2000, CRC(587799bc) SHA1(1f677afa96722ca4ed2643eaca243548845fc854) )
+ ROM_LOAD( "cpm80.bin", 0x0000, 0x2000, CRC(7378e4f9) SHA1(c3c06c6f2e953546452ca6f82140a79d0e4953b4) )
ROM_END
ROM_START( okean240a )
- ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
- ROM_LOAD( "fddmonitor.bin", 0xe000, 0x2000, CRC(bcac5ca0) SHA1(602ab824704d3d5d07b3787f6227ff903c33c9d5) )
- ROM_LOAD( "fddcpm80.bin", 0xc000, 0x2000, CRC(b89a7e16) SHA1(b8f937c04f430be18e48f296ed3ef37194171204) )
+ ROM_REGION( 0x4000, "maincpu", 0 )
+ ROM_LOAD( "fddmonitor.bin", 0x2000, 0x2000, CRC(bcac5ca0) SHA1(602ab824704d3d5d07b3787f6227ff903c33c9d5) )
+ ROM_LOAD( "fddcpm80.bin", 0x0000, 0x2000, CRC(b89a7e16) SHA1(b8f937c04f430be18e48f296ed3ef37194171204) )
ROM_END
ROM_START( okean240t )
- ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
- ROM_LOAD( "test.bin", 0xe000, 0x0800, CRC(e9e2b7b9) SHA1(e4e0b6984a2514b6ba3e97500d487ea1a68b7577) )
+ ROM_REGION( 0x4000, "maincpu", ROMREGION_ERASEFF )
+ ROM_LOAD( "test.bin", 0x2000, 0x0800, CRC(e9e2b7b9) SHA1(e4e0b6984a2514b6ba3e97500d487ea1a68b7577) )
ROM_END
/* Driver */
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
-COMP( 1986, okean240, 0, 0, okean240, okean240, okean240_state, init_okean240, "<unknown>", "Okeah-240", MACHINE_NOT_WORKING | MACHINE_NO_SOUND)
-COMP( 1986, okean240a, okean240, 0, okean240a, okean240a, okean240_state, init_okean240, "<unknown>", "Ocean-240 with FDD", MACHINE_NOT_WORKING | MACHINE_NO_SOUND)
-COMP( 1986, okean240t, okean240, 0, okean240t, okean240, okean240_state, init_okean240, "<unknown>", "Ocean-240 Test ROM", MACHINE_NOT_WORKING | MACHINE_NO_SOUND)
+COMP( 1986, okean240, 0, 0, okean240, okean240, okean240_state, empty_init, "<unknown>", "Okeah-240", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE )
+COMP( 1986, okean240a, okean240, 0, okean240a, okean240a, okean240_state, empty_init, "<unknown>", "Ocean-240 with FDD", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE )
+COMP( 1986, okean240t, okean240, 0, okean240t, okean240, okean240_state, empty_init, "<unknown>", "Ocean-240 Test ROM", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/tavernie.cpp b/src/mame/drivers/tavernie.cpp
index 06916901143..0293cc0ad34 100644
--- a/src/mame/drivers/tavernie.cpp
+++ b/src/mame/drivers/tavernie.cpp
@@ -80,7 +80,6 @@ public:
, m_pia0(*this, "pia0")
, m_acia(*this, "acia")
, m_ptm(*this, "ptm")
- , m_rs232(*this, "rs232")
{ }
void cpu09(machine_config &config);
@@ -99,7 +98,6 @@ protected:
required_device<pia6821_device> m_pia0;
required_device<acia6850_device> m_acia;
required_device<ptm6840_device> m_ptm;
- required_device<rs232_port_device> m_rs232;
private:
virtual void machine_reset() override;
@@ -432,10 +430,10 @@ void cpu09_state::cpu09(machine_config &config)
m_acia->txd_handler().set("rs232", FUNC(rs232_port_device::write_txd));
m_acia->rts_handler().set("rs232", FUNC(rs232_port_device::write_rts));
- RS232_PORT(config, m_rs232, default_rs232_devices, "terminal");
- m_rs232->rxd_handler().set("acia", FUNC(acia6850_device::write_rxd));
- m_rs232->cts_handler().set("acia", FUNC(acia6850_device::write_cts));
- m_rs232->set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(terminal));
+ rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "terminal"));
+ rs232.rxd_handler().set("acia", FUNC(acia6850_device::write_rxd));
+ rs232.cts_handler().set("acia", FUNC(acia6850_device::write_cts));
+ rs232.set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(terminal));
}
void ivg09_state::ivg09(machine_config &config)
@@ -458,10 +456,7 @@ void ivg09_state::ivg09(machine_config &config)
BEEP(config, m_beep, 950).add_route(ALL_OUTPUTS, "mono", 0.50); // guess
/* Devices */
- config.device_remove("rs232");
- RS232_PORT(config, m_rs232, default_rs232_devices, nullptr);
- m_rs232->rxd_handler().set("acia", FUNC(acia6850_device::write_rxd));
- m_rs232->cts_handler().set("acia", FUNC(acia6850_device::write_cts));
+ subdevice<rs232_port_device>("rs232")->set_default_option(nullptr);
generic_keyboard_device &keyboard(GENERIC_KEYBOARD(config, "keyboard", 0));
keyboard.set_keyboard_callback(FUNC(ivg09_state::kbd_put));