diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2018-09-16 23:56:22 -0400 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2018-09-16 23:56:22 -0400 |
commit | fec4507cb9c2fccfde4b31dab43edc1b94976d3c (patch) | |
tree | 060b2c628fc1f07ce5f21ccca80e5f2f0ed3b070 | |
parent | e15011b974e3ddb4704beb32a6a6a33d284cac3a (diff) |
pcx: Make display work again in new resolution
This includes a workaround for a regression that likely occurred with e39e873875b98ee1cd4a0bc81226a9e56b169497.
-rw-r--r-- | src/devices/video/scn2674.cpp | 17 | ||||
-rw-r--r-- | src/mame/video/pcd.cpp | 75 | ||||
-rw-r--r-- | src/mame/video/pcd.h | 10 |
3 files changed, 46 insertions, 56 deletions
diff --git a/src/devices/video/scn2674.cpp b/src/devices/video/scn2674.cpp index 3058e110846..67a5fe19f94 100644 --- a/src/devices/video/scn2674.cpp +++ b/src/devices/video/scn2674.cpp @@ -601,7 +601,13 @@ void scn2674_device::write_interrupt_mask(bool enabled, uint8_t bits) if (BIT(changed_bits, 3)) LOGMASKED(LOG_INTR, "Line Zero IRQ %s\n", enabled ? "enabled" : "disabled"); if (BIT(changed_bits, 4)) + { LOGMASKED(LOG_INTR, "V-Blank IRQ %s\n", enabled ? "enabled" : "disabled"); + + // hack to allow PC-X to get its first interrupt + if (BIT(bits, 4) && !m_display_enabled) + recompute_parameters(); + } } void scn2674_device::write_delayed_command(uint8_t data) @@ -919,9 +925,10 @@ WRITE8_MEMBER( scn2674_device::write ) void scn2674_device::recompute_parameters() { - int horiz_pix_total = ((m_equalizing_constant + (m_horz_sync_width << 1)) << 1) * m_hpixels_per_column; + int horiz_chars_total = (m_equalizing_constant + (m_horz_sync_width << 1)) << 1; + int horiz_pix_total = horiz_chars_total * m_hpixels_per_column; int vert_pix_total = m_rows_per_screen * m_scanline_per_char_row + m_vert_front_porch + m_vert_back_porch + m_vsync_width; - attoseconds_t refresh = screen().frame_period().attoseconds(); + attoseconds_t refresh = screen().frame_period().as_attoseconds(); int max_visible_x = (m_character_per_row * m_hpixels_per_column) - 1; int max_visible_y = (m_rows_per_screen * m_scanline_per_char_row) - 1; @@ -931,10 +938,10 @@ void scn2674_device::recompute_parameters() return; } - LOGMASKED(LOG_IR, "width %u height %u max_x %u max_y %u refresh %f\n", horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, 1 / ATTOSECONDS_TO_DOUBLE(refresh)); + //attoseconds_t refresh = clocks_to_attotime(horiz_chars_total * vert_pix_total).as_attoseconds(); + LOGMASKED(LOG_IR, "width %u height %u max_x %u max_y %u refresh %f\n", horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, ATTOSECONDS_TO_HZ(refresh)); - rectangle visarea; - visarea.set(0, max_visible_x, 0, max_visible_y); + rectangle visarea(0, max_visible_x, 0, max_visible_y); screen().configure(horiz_pix_total, vert_pix_total, visarea, refresh); m_scanline_timer->adjust(screen().time_until_pos(0, 0), 0, screen().scan_period()); diff --git a/src/mame/video/pcd.cpp b/src/mame/video/pcd.cpp index 003ad8ca1b8..b6609505c8f 100644 --- a/src/mame/video/pcd.cpp +++ b/src/mame/video/pcd.cpp @@ -36,7 +36,6 @@ pcx_video_device::pcx_video_device(const machine_config &mconfig, const char *ta pcdx_video_device(mconfig, PCX_VIDEO, tag, owner, clock), device_serial_interface(mconfig, *this), m_crtc(*this, "crtc"), - m_vram(4*1024), m_charrom(*this, "char"), m_txd_handler(*this) { @@ -129,16 +128,22 @@ void pcx_video_device::pcx_vid_map(address_map &map) void pcx_video_device::pcx_vid_io(address_map &map) { - map(0x8000, 0x8007).rw("crtc", FUNC(scn2672_device::read), FUNC(scn2672_device::write)); + map(0x8000, 0x8007).rw(m_crtc, FUNC(scn2672_device::read), FUNC(scn2672_device::write)); map(0x8008, 0x8008).r(FUNC(pcx_video_device::unk_r)); - map(0xa000, 0xa001).rw(FUNC(pcx_video_device::vram_latch_r), FUNC(pcx_video_device::vram_latch_w)); + map(0xa000, 0xa000).rw(m_crtc, FUNC(scn2672_device::buffer_r), FUNC(scn2672_device::buffer_w)); + map(0xa001, 0xa001).rw(m_crtc, FUNC(scn2672_device::attr_buffer_r), FUNC(scn2672_device::attr_buffer_w)); map(0xa002, 0xa003).rw(FUNC(pcx_video_device::term_mcu_r), FUNC(pcx_video_device::term_mcu_w)); map(0xc000, 0xc7ff).ram(); } -void pcx_video_device::pcx_vram(address_map &map) +void pcx_video_device::pcx_char_ram(address_map &map) { - map(0x0000, 0x07ff).rw(FUNC(pcx_video_device::vram_r), FUNC(pcx_video_device::vram_w)); + map(0x0000, 0x07ff).ram(); +} + +void pcx_video_device::pcx_attr_ram(address_map &map) +{ + map(0x0000, 0x07ff).ram(); } MACHINE_CONFIG_START(pcx_video_device::device_add_mconfig) @@ -161,7 +166,8 @@ MACHINE_CONFIG_START(pcx_video_device::device_add_mconfig) m_crtc->set_character_width(12); m_crtc->set_display_callback(FUNC(pcx_video_device::display_pixels)); m_crtc->set_screen("screen"); - m_crtc->set_addrmap(0, &pcx_video_device::pcx_vram); + m_crtc->set_addrmap(0, &pcx_video_device::pcx_char_ram); + m_crtc->set_addrmap(1, &pcx_video_device::pcx_attr_ram); MACHINE_CONFIG_END @@ -211,19 +217,25 @@ SCN2674_DRAW_CHARACTER_MEMBER(pcd_video_device::display_pixels) SCN2672_DRAW_CHARACTER_MEMBER(pcx_video_device::display_pixels) { - uint8_t data; - address <<= 1; - data = m_charrom[m_vram[address] * 16 + linecount + (m_vram[address + 1] & 0x20 ? 4096 : 0)]; - if(cursor && blink) - data = 0xff; - if(m_p1 & 0x20) - data = ~data; - for(int i = 0; i < 8; i++) + uint16_t data = m_charrom[charcode * 16 + linecount + (attrcode & 0x20 ? 4096 : 0)]; + + if (cursor && blink) + data = 0x3ff; + else { - rgb_t pix = palette().pen(BIT(data, 7) ? 1 : 0); - bitmap.pix32(y, x++) = pix; - bitmap.pix32(y, x++) = pix; data <<= 1; + data |= data << 1; + } + + if (m_p1 & 0x20) + data ^= 0x3ff; + + for (int i = 0; i < 12; i++) + { + rgb_t pix = palette().pen(BIT(data, 10) ? 1 : 0); + bitmap.pix32(y, x++) = pix; + if (i != 1) + data <<= 1; } } @@ -365,31 +377,6 @@ WRITE8_MEMBER(pcx_video_device::term_mcu_w) } } -WRITE8_MEMBER(pcx_video_device::vram_w) -{ - offset <<= 1; - m_vram[offset] = m_vram_latch_w[0]; - m_vram[offset+1] = m_vram_latch_w[1]; -} - -READ8_MEMBER(pcx_video_device::vram_r) -{ - offset <<= 1; - m_vram_latch_r[0] = m_vram[offset]; - m_vram_latch_r[1] = m_vram[offset+1]; - return m_vram[offset]; -} - -WRITE8_MEMBER(pcx_video_device::vram_latch_w) -{ - m_vram_latch_w[offset] = data; -} - -READ8_MEMBER(pcx_video_device::vram_latch_r) -{ - return m_vram_latch_r[offset]; -} - READ8_MEMBER(pcdx_video_device::detect_r) { return 0; @@ -429,8 +416,8 @@ void pcd_video_device::device_reset() void pcd_video_device::map(address_map &map) { - map(0x00, 0x0f).w("crtc", FUNC(scn2674_device::write)).umask16(0x00ff); - map(0x00, 0x0f).r("crtc", FUNC(scn2674_device::read)).umask16(0xff00); + map(0x00, 0x0f).w(m_crtc, FUNC(scn2674_device::write)).umask16(0x00ff); + map(0x00, 0x0f).r(m_crtc, FUNC(scn2674_device::read)).umask16(0xff00); map(0x20, 0x20).w(FUNC(pcd_video_device::vram_sw_w)); map(0x30, 0x33).rw("graphics", FUNC(i8741_device::upi41_master_r), FUNC(i8741_device::upi41_master_w)).umask16(0x00ff); } diff --git a/src/mame/video/pcd.h b/src/mame/video/pcd.h index 1c92a66512b..22a28000616 100644 --- a/src/mame/video/pcd.h +++ b/src/mame/video/pcd.h @@ -93,16 +93,13 @@ public: DECLARE_WRITE8_MEMBER(term_w); DECLARE_READ8_MEMBER(term_mcu_r); DECLARE_WRITE8_MEMBER(term_mcu_w); - DECLARE_READ8_MEMBER(vram_r); - DECLARE_WRITE8_MEMBER(vram_w); - DECLARE_READ8_MEMBER(vram_latch_r); - DECLARE_WRITE8_MEMBER(vram_latch_w); DECLARE_READ8_MEMBER(unk_r); DECLARE_WRITE8_MEMBER(p1_w); void pcx_vid_io(address_map &map); void pcx_vid_map(address_map &map); - void pcx_vram(address_map &map); + void pcx_char_ram(address_map &map); + void pcx_attr_ram(address_map &map); protected: void device_start() override; void device_reset() override; @@ -115,10 +112,9 @@ protected: private: required_device<scn2672_device> m_crtc; - std::vector<uint8_t> m_vram; required_region_ptr<uint8_t> m_charrom; devcb_write_line m_txd_handler; - uint8_t m_term_key, m_term_char, m_term_stat, m_vram_latch_r[2], m_vram_latch_w[2], m_p1; + uint8_t m_term_key, m_term_char, m_term_stat, m_p1; DECLARE_READ8_MEMBER(rx_callback); DECLARE_WRITE8_MEMBER(tx_callback); |