diff options
Diffstat (limited to 'src/mame/drivers/modellot.cpp')
-rw-r--r-- | src/mame/drivers/modellot.cpp | 74 |
1 files changed, 51 insertions, 23 deletions
diff --git a/src/mame/drivers/modellot.cpp b/src/mame/drivers/modellot.cpp index 762468eecdc..8e8e710fe06 100644 --- a/src/mame/drivers/modellot.cpp +++ b/src/mame/drivers/modellot.cpp @@ -53,35 +53,41 @@ class modellot_state : public driver_device public: modellot_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) - , m_p_videoram(*this, "videoram") , m_maincpu(*this, "maincpu") + , m_rom(*this, "maincpu") + , m_ram(*this, "mainram") + , m_p_videoram(*this, "videoram") , m_p_chargen(*this, "chargen") { } void modellot(machine_config &config); private: - uint8_t port77_r(); - uint8_t portff_r(); + u8 port77_r(); + u8 portff_r(); void kbd_put(u8 data); - uint32_t screen_update_modellot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_modellot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void io_map(address_map &map); void mem_map(address_map &map); - uint8_t m_term_data; - virtual void machine_reset() override; - required_shared_ptr<uint8_t> m_p_videoram; + u8 m_term_data; + void machine_start() override; + void machine_reset() override; + memory_passthrough_handler *m_rom_shadow_tap; required_device<cpu_device> m_maincpu; + required_region_ptr<u8> m_rom; + required_shared_ptr<u8> m_ram; + required_shared_ptr<u8> m_p_videoram; required_region_ptr<u8> m_p_chargen; }; void modellot_state::mem_map(address_map &map) { map.unmap_value_high(); - map(0x0000, 0xbfff).ram(); // 48k ram + map(0x0000, 0xbfff).ram().share("mainram"); // 48k ram map(0xc000, 0xc3ff).ram().share("videoram"); - map(0xe000, 0xffff).rom(); + map(0xe000, 0xffff).rom().region("maincpu", 0); } void modellot_state::io_map(address_map &map) @@ -97,14 +103,14 @@ void modellot_state::io_map(address_map &map) static INPUT_PORTS_START( modellot ) INPUT_PORTS_END -uint8_t modellot_state::port77_r() +u8 modellot_state::port77_r() { return 4; } -uint8_t modellot_state::portff_r() +u8 modellot_state::portff_r() { - uint8_t data = (m_term_data) ? m_term_data ^ 0x7f : 0xff; + u8 data = (m_term_data) ? (m_term_data ^ 0x7f) : 0xff; m_term_data = 0; return data; } @@ -117,10 +123,31 @@ void modellot_state::kbd_put(u8 data) void modellot_state::machine_reset() { m_term_data = 1; - m_maincpu->set_state_int(Z80_PC, 0xe000); + + address_space &program = m_maincpu->space(AS_PROGRAM); + program.install_rom(0x0000, 0x07ff, m_rom); // 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(); + + // reinstall ram over the rom shadow + m_maincpu->space(AS_PROGRAM).install_ram(0x0000, 0x07ff, m_ram); + } + + // return the original data + return data; + }); +} + +void modellot_state::machine_start() +{ + save_item(NAME(m_term_data)); } -const gfx_layout modellot_charlayout = +const gfx_layout charlayout = { 8, 16, /* 8x16 characters */ 128, /* 128 characters */ @@ -133,20 +160,20 @@ const gfx_layout modellot_charlayout = }; static GFXDECODE_START( gfx_modellot ) - GFXDECODE_ENTRY( "chargen", 0x0000, modellot_charlayout, 0, 1 ) + GFXDECODE_ENTRY( "chargen", 0x0000, charlayout, 0, 1 ) GFXDECODE_END -uint32_t modellot_state::screen_update_modellot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 modellot_state::screen_update_modellot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx,inv; - uint16_t sy=0,ma=0,x; + u8 y,ra,chr,gfx,inv; + u16 sy=0,ma=0,x; for (y = 0; y < 16; y++) { for (ra = 0; ra < 16; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix16(sy++); for (x = 0; x < 64; x++) { @@ -207,10 +234,10 @@ void modellot_state::modellot(machine_config &config) /* ROM definition */ ROM_START( modellot ) - ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) //ROM_LOAD( "fdc8119.u3", 0x0000, 0x0400, CRC(a8aee944) SHA1(f2cc598ed2e7a1a620e2f3f53c1a573965f6af26)) - ROM_LOAD( "dt49-48.u1", 0xe000, 0x0400, CRC(2441c438) SHA1(832994a4214a744b7e19e5f74000c95ae65e3759)) - ROM_LOAD( "ht20.u2", 0xe400, 0x0400, CRC(497c0495) SHA1(d03beebc4c31284729f6eac3bdf1fbf44adf7fff)) + ROM_LOAD( "dt49-48.u1", 0x0000, 0x0400, CRC(2441c438) SHA1(832994a4214a744b7e19e5f74000c95ae65e3759)) + ROM_LOAD( "ht20.u2", 0x0400, 0x0400, CRC(497c0495) SHA1(d03beebc4c31284729f6eac3bdf1fbf44adf7fff)) ROM_REGION( 0x0800, "chargen", ROMREGION_INVERT ) ROM_LOAD( "gcem1.u3", 0x0000, 0x0200, CRC(e7739268) SHA1(091ef69282abe657d5f38c70a572964f5200a1d5)) @@ -220,4 +247,5 @@ ROM_START( modellot ) ROM_END /* Driver */ -COMP( 1979, modellot, 0, 0, modellot, modellot, modellot_state, empty_init, "General Processor", "Modello T", MACHINE_IS_SKELETON ) +COMP( 1979, modellot, 0, 0, modellot, modellot, modellot_state, empty_init, "General Processor", "Modello T", MACHINE_IS_SKELETON | MACHINE_SUPPORTS_SAVE ) + |