From 45d711778caf7f0fb2d0b73b890be41e46fb5240 Mon Sep 17 00:00:00 2001 From: AJR Date: Tue, 18 Jun 2019 23:30:23 -0400 Subject: tek4404: Updates; display restored (nw) - Map the boot PROM properly - Add DUART - Add debug RAM - Leave provisions for MMU banking - Use raw parameters for screen mc68681: Save a few more registers (nw) --- src/devices/machine/mc68681.cpp | 2 + src/mame/drivers/tek440x.cpp | 100 +++++++++++++++++++++++++++++----------- 2 files changed, 75 insertions(+), 27 deletions(-) diff --git a/src/devices/machine/mc68681.cpp b/src/devices/machine/mc68681.cpp index 5d321796ff3..2787720cc64 100644 --- a/src/devices/machine/mc68681.cpp +++ b/src/devices/machine/mc68681.cpp @@ -214,7 +214,9 @@ void duart_base_device::device_start() save_item(NAME(IMR)); save_item(NAME(ISR)); save_item(NAME(OPCR)); + save_item(NAME(OPR)); save_item(NAME(CTR)); + save_item(NAME(IPCR)); save_item(NAME(IP_last_state)); save_item(NAME(half_period)); } diff --git a/src/mame/drivers/tek440x.cpp b/src/mame/drivers/tek440x.cpp index 0425b681b8d..ce67fc345f0 100644 --- a/src/mame/drivers/tek440x.cpp +++ b/src/mame/drivers/tek440x.cpp @@ -46,16 +46,16 @@ #include "cpu/m68000/m68000.h" #include "cpu/m6502/m6502.h" #include "machine/am9513.h" +#include "machine/bankdev.h" #include "machine/mos6551.h" // debug tty #include "machine/mc146818.h" +#include "machine/mc68681.h" #include "sound/sn76496.h" #include "emupal.h" #include "screen.h" #include "speaker.h" -#define VIDEO_CLOCK XTAL(25'200'000) - class tek440x_state : public driver_device { public: @@ -63,6 +63,9 @@ public: driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_fdccpu(*this, "fdccpu"), + m_vm(*this, "vm"), + m_snsnd(*this, "snsnd"), + m_prom(*this, "maincpu"), m_mainram(*this, "mainram"), m_vram(*this, "vram") { } @@ -72,13 +75,25 @@ public: private: virtual void machine_start() override; virtual void machine_reset() override; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + u16 memory_r(offs_t offset, u16 mem_mask); + void memory_w(offs_t offset, u16 data, u16 mem_mask); + void sound_w(u8 data); + + void logical_map(address_map &map); + void physical_map(address_map &map); + void fdccpu_map(address_map &map); + required_device m_maincpu; required_device m_fdccpu; - required_shared_ptr m_mainram; - required_shared_ptr m_vram; - void fdccpu_map(address_map &map); - void maincpu_map(address_map &map); + required_device m_vm; + required_device m_snsnd; + required_region_ptr m_prom; + required_shared_ptr m_mainram; + required_shared_ptr m_vram; + + bool m_boot; }; /************************************* @@ -89,6 +104,7 @@ private: void tek440x_state::machine_start() { + save_item(NAME(m_boot)); } @@ -101,10 +117,7 @@ void tek440x_state::machine_start() void tek440x_state::machine_reset() { - uint8_t *ROM = memregion("maincpu")->base(); - uint8_t *RAM = (uint8_t *)m_mainram.target(); - - memcpy(RAM, ROM, 256); + m_boot = true; } @@ -115,11 +128,11 @@ void tek440x_state::machine_reset() * *************************************/ -uint32_t tek440x_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 tek440x_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const uint16_t *video_ram; - uint16_t word; - uint16_t *line; + const u16 *video_ram; + u16 word; + u16 *line; int y, x, b; for (y = 0; y < 480; y++) @@ -148,21 +161,47 @@ uint32_t tek440x_state::screen_update(screen_device &screen, bitmap_ind16 &bitma * *************************************/ -void tek440x_state::maincpu_map(address_map &map) +u16 tek440x_state::memory_r(offs_t offset, u16 mem_mask) +{ + if (m_boot) + return m_prom[offset & 0x3fff]; + + // TODO: banking + return m_vm->read16(offset, mem_mask); +} + +void tek440x_state::memory_w(offs_t offset, u16 data, u16 mem_mask) +{ + // TODO: banking + m_vm->write16(offset, data, mem_mask); +} + +void tek440x_state::sound_w(u8 data) +{ + m_snsnd->write(data); + m_boot = false; +} + +void tek440x_state::logical_map(address_map &map) +{ + map(0x000000, 0x7fffff).rw(FUNC(tek440x_state::memory_r), FUNC(tek440x_state::memory_w)); +} + +void tek440x_state::physical_map(address_map &map) { map(0x000000, 0x1fffff).ram().share("mainram"); map(0x600000, 0x61ffff).ram().share("vram"); - map(0x740000, 0x747fff).rom().region("maincpu", 0); - // 760000 - optional debug ROM + map(0x740000, 0x747fff).rom().mirror(0x8000).region("maincpu", 0); + map(0x760000, 0x760fff).ram().mirror(0xf000); // debug RAM map(0x780000, 0x781fff).ram(); // map registers // 782000-783fff: video address registers // 784000-785fff: video control registers - map(0x788000, 0x788000).w("snsnd", FUNC(sn76496_device::write)); + map(0x788000, 0x788000).w(FUNC(tek440x_state::sound_w)); // 78a000-78bfff: NS32081 FPU map(0x78c000, 0x78c007).rw("aica", FUNC(mos6551_device::read), FUNC(mos6551_device::write)).umask16(0xff00); // 7b1000-7b2fff: diagnostic registers // 7b2000-7b3fff: Centronics printer data - // 7b4000-7b5fff: 68681 DUART + map(0x7b4000, 0x7b401f).rw("duart", FUNC(mc68681_device::read), FUNC(mc68681_device::write)).umask16(0xff00); // 7b6000-7b7fff: Mouse map(0x7b8000, 0x7b8003).mirror(0x100).rw("timer", FUNC(am9513_device::read16), FUNC(am9513_device::write16)); // 7ba000-7bbfff: MC146818 RTC @@ -195,7 +234,13 @@ void tek440x_state::tek4404(machine_config &config) { /* basic machine hardware */ M68010(config, m_maincpu, 40_MHz_XTAL / 4); // MC68010L10 - m_maincpu->set_addrmap(AS_PROGRAM, &tek440x_state::maincpu_map); + m_maincpu->set_addrmap(AS_PROGRAM, &tek440x_state::logical_map); + + ADDRESS_MAP_BANK(config, m_vm); + m_vm->set_addrmap(0, &tek440x_state::physical_map); + m_vm->set_data_width(16); + m_vm->set_addr_width(23); + m_vm->set_endianness(ENDIANNESS_BIG); M6502(config, m_fdccpu, 1000000); m_fdccpu->set_addrmap(AS_PROGRAM, &tek440x_state::fdccpu_map); @@ -203,17 +248,18 @@ void tek440x_state::tek4404(machine_config &config) /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); - screen.set_refresh_hz(60); - screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */); - screen.set_size(640, 480); - screen.set_visarea(0, 639, 0, 479); + screen.set_raw(25.2_MHz_XTAL, 800, 0, 640, 525, 0, 480); // 31.5 kHz horizontal (guessed), 60 Hz vertical screen.set_screen_update(FUNC(tek440x_state::screen_update)); screen.set_palette("palette"); PALETTE(config, "palette", palette_device::MONOCHROME); - mos6551_device &aica(MOS6551(config, "aica", 0)); + mos6551_device &aica(MOS6551(config, "aica", 40_MHz_XTAL / 4 / 10)); aica.set_xtal(1.8432_MHz_XTAL); aica.txd_handler().set("rs232", FUNC(rs232_port_device::write_txd)); + aica.irq_handler().set_inputline(m_maincpu, M68K_IRQ_7); + + mc68681_device &duart(MC68681(config, "duart", 3.6864_MHz_XTAL)); + duart.irq_cb().set_inputline(m_maincpu, M68K_IRQ_5); AM9513(config, "timer", 40_MHz_XTAL / 4 / 10); // from CPU E output @@ -225,7 +271,7 @@ void tek440x_state::tek4404(machine_config &config) SPEAKER(config, "mono").front_center(); - SN76496(config, "snsnd", VIDEO_CLOCK / 8).add_route(ALL_OUTPUTS, "mono", 0.80); + SN76496(config, m_snsnd, 25.2_MHz_XTAL / 8).add_route(ALL_OUTPUTS, "mono", 0.80); } -- cgit v1.2.3