summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author MetalliC <0vetal0@gmail.com>2015-02-24 13:31:17 +0200
committer MetalliC <0vetal0@gmail.com>2015-02-24 13:31:17 +0200
commite9345bcfc0767018d0a23895bbaf963122ccc0ae (patch)
tree1f60be53c41b43ae6af4119ec9a0982461e8a1e2
parentc0be42503cbf233b36fa65a056339acebd73a365 (diff)
(MESS) fix Timex ZX-clones regression (nw)
-rw-r--r--src/mess/drivers/pentagon.c2
-rw-r--r--src/mess/drivers/spec128.c2
-rw-r--r--src/mess/drivers/timex.c2
-rw-r--r--src/mess/includes/spectrum.h6
-rw-r--r--src/mess/video/spectrum.c80
-rw-r--r--src/mess/video/timex.c17
6 files changed, 89 insertions, 20 deletions
diff --git a/src/mess/drivers/pentagon.c b/src/mess/drivers/pentagon.c
index 84600c13ea2..d333e057c2f 100644
--- a/src/mess/drivers/pentagon.c
+++ b/src/mess/drivers/pentagon.c
@@ -121,7 +121,7 @@ WRITE8_MEMBER(pentagon_state::pentagon_port_7ffd_w)
return;
if ((m_port_7ffd_data ^ data) & 0x08)
- spectrum_UpdateBorderBitmap();
+ spectrum_UpdateScreenBitmap();
/* store new state */
m_port_7ffd_data = data;
diff --git a/src/mess/drivers/spec128.c b/src/mess/drivers/spec128.c
index dc90391157a..65fa65ecfd7 100644
--- a/src/mess/drivers/spec128.c
+++ b/src/mess/drivers/spec128.c
@@ -173,7 +173,7 @@ WRITE8_MEMBER(spectrum_state::spectrum_128_port_7ffd_w)
return;
if ((m_port_7ffd_data ^ data) & 0x08)
- spectrum_UpdateBorderBitmap();
+ spectrum_UpdateScreenBitmap();
/* store new state */
m_port_7ffd_data = data;
diff --git a/src/mess/drivers/timex.c b/src/mess/drivers/timex.c
index ade345aeb1c..8a462e340e8 100644
--- a/src/mess/drivers/timex.c
+++ b/src/mess/drivers/timex.c
@@ -694,6 +694,7 @@ static MACHINE_CONFIG_DERIVED( ts2068, spectrum_128 )
MCFG_SCREEN_SIZE(TS2068_SCREEN_WIDTH, TS2068_SCREEN_HEIGHT)
MCFG_SCREEN_VISIBLE_AREA(0, TS2068_SCREEN_WIDTH-1, 0, TS2068_SCREEN_HEIGHT-1)
MCFG_SCREEN_UPDATE_DRIVER(spectrum_state, screen_update_ts2068)
+ MCFG_SCREEN_VBLANK_DRIVER(spectrum_state, screen_eof_timex)
MCFG_GFXDECODE_MODIFY("gfxdecode", ts2068)
@@ -738,6 +739,7 @@ static MACHINE_CONFIG_DERIVED( tc2048, spectrum )
MCFG_SCREEN_SIZE(TS2068_SCREEN_WIDTH, SPEC_SCREEN_HEIGHT)
MCFG_SCREEN_VISIBLE_AREA(0, TS2068_SCREEN_WIDTH-1, 0, SPEC_SCREEN_HEIGHT-1)
MCFG_SCREEN_UPDATE_DRIVER(spectrum_state, screen_update_tc2048)
+ MCFG_SCREEN_VBLANK_DRIVER(spectrum_state, screen_eof_timex)
MCFG_VIDEO_START_OVERRIDE(spectrum_state, spectrum_128 )
diff --git a/src/mess/includes/spectrum.h b/src/mess/includes/spectrum.h
index 27b7a5bee25..dd86e8f242b 100644
--- a/src/mess/includes/spectrum.h
+++ b/src/mess/includes/spectrum.h
@@ -179,6 +179,7 @@ public:
UINT32 screen_update_tc2048(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_ts2068(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void screen_eof_spectrum(screen_device &screen, bool state);
+ void screen_eof_timex(screen_device &screen, bool state);
INTERRUPT_GEN_MEMBER(spec_interrupt);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( spectrum_cart );
@@ -189,6 +190,8 @@ public:
unsigned int m_previous_border_x, m_previous_border_y;
bitmap_ind16 m_border_bitmap;
+ unsigned int m_previous_screen_x, m_previous_screen_y;
+ bitmap_ind16 m_screen_bitmap;
DECLARE_FLOPPY_FORMATS( floppy_formats );
void spectrum_128_update_memory();
@@ -233,7 +236,8 @@ protected:
optional_ioport m_io_plus4;
void spectrum_UpdateBorderBitmap();
- inline unsigned char get_display_color (unsigned char color, int invert);
+ void spectrum_UpdateScreenBitmap();
+ inline unsigned char get_display_color(unsigned char color, int invert);
inline void spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color);
void ts2068_hires_scanline(bitmap_ind16 &bitmap, int y, int borderlines);
void ts2068_64col_scanline(bitmap_ind16 &bitmap, int y, int borderlines, unsigned short inkcolor);
diff --git a/src/mess/video/spectrum.c b/src/mess/video/spectrum.c
index 379a7f1a104..d3640db4ce6 100644
--- a/src/mess/video/spectrum.c
+++ b/src/mess/video/spectrum.c
@@ -25,8 +25,12 @@ VIDEO_START_MEMBER(spectrum_state,spectrum)
m_frame_number = 0;
m_flash_invert = 0;
- m_previous_border_x = 0; m_previous_border_y = 0;
+ m_previous_border_x = 0;
+ m_previous_border_y = 0;
machine().first_screen()->register_screen_bitmap(m_border_bitmap);
+ m_previous_screen_x = 0;
+ m_previous_screen_y = 0;
+ machine().first_screen()->register_screen_bitmap(m_screen_bitmap);
m_screen_location = m_video_ram;
}
@@ -37,8 +41,12 @@ VIDEO_START_MEMBER(spectrum_state,spectrum_128)
m_frame_number = 0;
m_flash_invert = 0;
- m_previous_border_x = 0; m_previous_border_y = 0;
+ m_previous_border_x = 0;
+ m_previous_border_y = 0;
machine().first_screen()->register_screen_bitmap(m_border_bitmap);
+ m_previous_screen_x = 0;
+ m_previous_screen_y = 0;
+ machine().first_screen()->register_screen_bitmap(m_screen_bitmap);
m_screen_location = m_ram->pointer() + (5 << 14);
}
@@ -61,6 +69,7 @@ void spectrum_state::screen_eof_spectrum(screen_device &screen, bool state)
if (state)
{
spectrum_UpdateBorderBitmap();
+ spectrum_UpdateScreenBitmap();
m_frame_number++;
@@ -104,9 +113,15 @@ inline void spectrum_state::spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int
UINT32 spectrum_state::screen_update_spectrum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
+ static const rectangle rect(SPEC_LEFT_BORDER, SPEC_LEFT_BORDER + SPEC_DISPLAY_XSIZE - 1, SPEC_TOP_BORDER, SPEC_TOP_BORDER + SPEC_DISPLAY_YSIZE - 1);
+
if (m_border_bitmap.valid())
copyscrollbitmap(bitmap, m_border_bitmap, 0, 0, 0, 0, cliprect);
+ spectrum_UpdateScreenBitmap();
+ if (m_screen_bitmap.valid())
+ copyscrollbitmap(bitmap, m_screen_bitmap, 0, 0, 0, 0, rect);
+
#if 0
// note, don't update borders in here, this can time travel w/regards to other timers and may end up giving you
// screen positions earlier than the last write handler gave you
@@ -181,33 +196,28 @@ PALETTE_INIT_MEMBER(spectrum_state,spectrum)
palette.set_pen_colors(0, spectrum_palette, ARRAY_LENGTH(spectrum_palette));
}
-
-/* The code below is just a per-pixel 'partial update' for the border */
-
-void spectrum_state::spectrum_UpdateBorderBitmap()
+void spectrum_state::spectrum_UpdateScreenBitmap()
{
unsigned int x = machine().first_screen()->hpos();
unsigned int y = machine().first_screen()->vpos();
- int width = m_border_bitmap.width();
- int height = m_border_bitmap.height();
+ int width = m_screen_bitmap.width();
+ int height = m_screen_bitmap.height();
- if (m_border_bitmap.valid())
+ if (m_screen_bitmap.valid())
{
- UINT16 border = m_port_fe_data & 0x07;
-
- //printf("update border from %d,%d to %d,%d\n", m_previous_border_x, m_previous_border_y, x, y);
+ //printf("update screen from %d,%d to %d,%d\n", m_previous_screen_x, m_previous_screen_y, x, y);
do
{
- UINT16 scrx = m_previous_border_x - SPEC_LEFT_BORDER;
- UINT16 scry = m_previous_border_y - SPEC_TOP_BORDER;
+ UINT16 scrx = m_previous_screen_x - SPEC_LEFT_BORDER;
+ UINT16 scry = m_previous_screen_y - SPEC_TOP_BORDER;
if (scrx < SPEC_DISPLAY_XSIZE && scry < SPEC_DISPLAY_YSIZE)
{
// this can/must be optimised
if ((scrx & 7) == 0) {
- UINT16 *bm = &m_border_bitmap.pix16(m_previous_border_y, m_previous_border_x);
+ UINT16 *bm = &m_screen_bitmap.pix16(m_previous_screen_y, m_previous_screen_x);
UINT8 attr = *(m_screen_location + ((scry & 0xF8) << 2) + (scrx >> 3) + 0x1800);
UINT8 scr = *(m_screen_location + ((scry & 7) << 8) + ((scry & 0x38) << 2) + ((scry & 0xC0) << 5) + (scrx >> 3));
UINT16 ink = (attr & 0x07) + ((attr >> 3) & 0x08);
@@ -219,8 +229,44 @@ void spectrum_state::spectrum_UpdateBorderBitmap()
for (UINT8 b = 0x80; b != 0; b >>= 1)
*bm++ = (scr & b) ? ink : pap;
}
- } else
- m_border_bitmap.pix16(m_previous_border_y, m_previous_border_x) = border;
+ }
+
+ m_previous_screen_x += 1;
+
+ if (m_previous_screen_x >= width)
+ {
+ m_previous_screen_x = 0;
+ m_previous_screen_y += 1;
+
+ if (m_previous_screen_y >= height)
+ {
+ m_previous_screen_y = 0;
+ }
+ }
+ } while (!((m_previous_screen_x == x) && (m_previous_screen_y == y)));
+
+ }
+}
+
+/* The code below is just a per-pixel 'partial update' for the border */
+
+void spectrum_state::spectrum_UpdateBorderBitmap()
+{
+ unsigned int x = machine().first_screen()->hpos();
+ unsigned int y = machine().first_screen()->vpos();
+ int width = m_border_bitmap.width();
+ int height = m_border_bitmap.height();
+
+
+ if (m_border_bitmap.valid())
+ {
+ UINT16 border = m_port_fe_data & 0x07;
+
+ //printf("update border from %d,%d to %d,%d\n", m_previous_border_x, m_previous_border_y, x, y);
+
+ do
+ {
+ m_border_bitmap.pix16(m_previous_border_y, m_previous_border_x) = border;
m_previous_border_x += 1;
diff --git a/src/mess/video/timex.c b/src/mess/video/timex.c
index d4180f66fd0..1ce26f41eb3 100644
--- a/src/mess/video/timex.c
+++ b/src/mess/video/timex.c
@@ -29,6 +29,23 @@ VIDEO_START_MEMBER(spectrum_state,ts2068)
m_frame_invert_count = 30;
}
+void spectrum_state::screen_eof_timex(screen_device &screen, bool state)
+{
+ // rising edge
+ if (state)
+ {
+ spectrum_UpdateBorderBitmap();
+
+ m_frame_number++;
+
+ if (m_frame_number >= m_frame_invert_count)
+ {
+ m_frame_number = 0;
+ m_flash_invert = !m_flash_invert;
+ }
+ }
+}
+
/*******************************************************************
*