Previous 199869 Revisions Next

r36095 Tuesday 24th February, 2015 at 11:31:17 UTC by MetalliC
(MESS) fix Timex ZX-clones regression (nw)
[/branches/kale/src/mess/drivers]pentagon.c spec128.c timex.c
[/branches/kale/src/mess/includes]spectrum.h
[/branches/kale/src/mess/video]spectrum.c timex.c

branches/kale/src/mess/drivers/pentagon.c
r244606r244607
121121      return;
122122
123123   if ((m_port_7ffd_data ^ data) & 0x08)
124      spectrum_UpdateBorderBitmap();
124      spectrum_UpdateScreenBitmap();
125125
126126   /* store new state */
127127   m_port_7ffd_data = data;
branches/kale/src/mess/drivers/spec128.c
r244606r244607
173173         return;
174174
175175   if ((m_port_7ffd_data ^ data) & 0x08)
176      spectrum_UpdateBorderBitmap();
176      spectrum_UpdateScreenBitmap();
177177
178178   /* store new state */
179179   m_port_7ffd_data = data;
branches/kale/src/mess/drivers/timex.c
r244606r244607
694694   MCFG_SCREEN_SIZE(TS2068_SCREEN_WIDTH, TS2068_SCREEN_HEIGHT)
695695   MCFG_SCREEN_VISIBLE_AREA(0, TS2068_SCREEN_WIDTH-1, 0, TS2068_SCREEN_HEIGHT-1)
696696   MCFG_SCREEN_UPDATE_DRIVER(spectrum_state, screen_update_ts2068)
697   MCFG_SCREEN_VBLANK_DRIVER(spectrum_state, screen_eof_timex)
697698
698699   MCFG_GFXDECODE_MODIFY("gfxdecode", ts2068)
699700
r244606r244607
738739   MCFG_SCREEN_SIZE(TS2068_SCREEN_WIDTH, SPEC_SCREEN_HEIGHT)
739740   MCFG_SCREEN_VISIBLE_AREA(0, TS2068_SCREEN_WIDTH-1, 0, SPEC_SCREEN_HEIGHT-1)
740741   MCFG_SCREEN_UPDATE_DRIVER(spectrum_state, screen_update_tc2048)
742   MCFG_SCREEN_VBLANK_DRIVER(spectrum_state, screen_eof_timex)
741743
742744   MCFG_VIDEO_START_OVERRIDE(spectrum_state, spectrum_128 )
743745
branches/kale/src/mess/includes/spectrum.h
r244606r244607
179179   UINT32 screen_update_tc2048(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
180180   UINT32 screen_update_ts2068(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
181181   void screen_eof_spectrum(screen_device &screen, bool state);
182   void screen_eof_timex(screen_device &screen, bool state);
182183   INTERRUPT_GEN_MEMBER(spec_interrupt);
183184   DECLARE_DEVICE_IMAGE_LOAD_MEMBER( spectrum_cart );
184185
r244606r244607
189190
190191   unsigned int m_previous_border_x, m_previous_border_y;
191192   bitmap_ind16 m_border_bitmap;
193   unsigned int m_previous_screen_x, m_previous_screen_y;
194   bitmap_ind16 m_screen_bitmap;
192195
193196   DECLARE_FLOPPY_FORMATS( floppy_formats );
194197   void spectrum_128_update_memory();
r244606r244607
233236   optional_ioport m_io_plus4;
234237
235238   void spectrum_UpdateBorderBitmap();
236   inline unsigned char get_display_color (unsigned char color, int invert);
239   void spectrum_UpdateScreenBitmap();
240   inline unsigned char get_display_color(unsigned char color, int invert);
237241   inline void spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color);
238242   void ts2068_hires_scanline(bitmap_ind16 &bitmap, int y, int borderlines);
239243   void ts2068_64col_scanline(bitmap_ind16 &bitmap, int y, int borderlines, unsigned short inkcolor);
branches/kale/src/mess/video/spectrum.c
r244606r244607
2525   m_frame_number = 0;
2626   m_flash_invert = 0;
2727
28   m_previous_border_x = 0; m_previous_border_y = 0;
28   m_previous_border_x = 0;
29   m_previous_border_y = 0;
2930   machine().first_screen()->register_screen_bitmap(m_border_bitmap);
31   m_previous_screen_x = 0;
32   m_previous_screen_y = 0;
33   machine().first_screen()->register_screen_bitmap(m_screen_bitmap);
3034
3135   m_screen_location = m_video_ram;
3236}
r244606r244607
3741   m_frame_number = 0;
3842   m_flash_invert = 0;
3943
40   m_previous_border_x = 0; m_previous_border_y = 0;
44   m_previous_border_x = 0;
45   m_previous_border_y = 0;
4146   machine().first_screen()->register_screen_bitmap(m_border_bitmap);
47   m_previous_screen_x = 0;
48   m_previous_screen_y = 0;
49   machine().first_screen()->register_screen_bitmap(m_screen_bitmap);
4250
4351   m_screen_location = m_ram->pointer() + (5 << 14);
4452}
r244606r244607
6169   if (state)
6270   {
6371      spectrum_UpdateBorderBitmap();
72      spectrum_UpdateScreenBitmap();
6473
6574      m_frame_number++;
6675
r244606r244607
104113
105114UINT32 spectrum_state::screen_update_spectrum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
106115{
116   static const rectangle rect(SPEC_LEFT_BORDER, SPEC_LEFT_BORDER + SPEC_DISPLAY_XSIZE - 1, SPEC_TOP_BORDER, SPEC_TOP_BORDER + SPEC_DISPLAY_YSIZE - 1);
117
107118   if (m_border_bitmap.valid())
108119      copyscrollbitmap(bitmap, m_border_bitmap, 0, 0, 0, 0, cliprect);
109120
121   spectrum_UpdateScreenBitmap();
122   if (m_screen_bitmap.valid())
123      copyscrollbitmap(bitmap, m_screen_bitmap, 0, 0, 0, 0, rect);
124
110125#if 0
111126   // note, don't update borders in here, this can time travel w/regards to other timers and may end up giving you
112127   // screen positions earlier than the last write handler gave you
r244606r244607
181196   palette.set_pen_colors(0, spectrum_palette, ARRAY_LENGTH(spectrum_palette));
182197}
183198
184
185/* The code below is just a per-pixel 'partial update' for the border */
186
187void spectrum_state::spectrum_UpdateBorderBitmap()
199void spectrum_state::spectrum_UpdateScreenBitmap()
188200{
189201   unsigned int x = machine().first_screen()->hpos();
190202   unsigned int y = machine().first_screen()->vpos();
191   int width = m_border_bitmap.width();
192   int height = m_border_bitmap.height();
203   int width = m_screen_bitmap.width();
204   int height = m_screen_bitmap.height();
193205
194206
195   if (m_border_bitmap.valid())
207   if (m_screen_bitmap.valid())
196208   {
197      UINT16 border = m_port_fe_data & 0x07;
209      //printf("update screen from %d,%d to %d,%d\n", m_previous_screen_x, m_previous_screen_y, x, y);
198210
199      //printf("update border from %d,%d to %d,%d\n", m_previous_border_x, m_previous_border_y, x, y);
200
201211      do
202212      {
203         UINT16 scrx = m_previous_border_x - SPEC_LEFT_BORDER;
204         UINT16 scry = m_previous_border_y - SPEC_TOP_BORDER;
213         UINT16 scrx = m_previous_screen_x - SPEC_LEFT_BORDER;
214         UINT16 scry = m_previous_screen_y - SPEC_TOP_BORDER;
205215
206216         if (scrx < SPEC_DISPLAY_XSIZE && scry < SPEC_DISPLAY_YSIZE)
207217         {
208218            // this can/must be optimised
209219            if ((scrx & 7) == 0) {
210               UINT16 *bm = &m_border_bitmap.pix16(m_previous_border_y, m_previous_border_x);
220               UINT16 *bm = &m_screen_bitmap.pix16(m_previous_screen_y, m_previous_screen_x);
211221               UINT8 attr = *(m_screen_location + ((scry & 0xF8) << 2) + (scrx >> 3) + 0x1800);
212222               UINT8 scr = *(m_screen_location + ((scry & 7) << 8) + ((scry & 0x38) << 2) + ((scry & 0xC0) << 5) + (scrx >> 3));
213223               UINT16 ink = (attr & 0x07) + ((attr >> 3) & 0x08);
r244606r244607
219229               for (UINT8 b = 0x80; b != 0; b >>= 1)
220230                  *bm++ = (scr & b) ? ink : pap;
221231            }
222         } else
223            m_border_bitmap.pix16(m_previous_border_y, m_previous_border_x) = border;
232         }
224233
234         m_previous_screen_x += 1;
235
236         if (m_previous_screen_x >= width)
237         {
238            m_previous_screen_x = 0;
239            m_previous_screen_y += 1;
240
241            if (m_previous_screen_y >= height)
242            {
243               m_previous_screen_y = 0;
244            }
245         }
246      } while (!((m_previous_screen_x == x) && (m_previous_screen_y == y)));
247
248   }
249}
250
251/* The code below is just a per-pixel 'partial update' for the border */
252
253void spectrum_state::spectrum_UpdateBorderBitmap()
254{
255   unsigned int x = machine().first_screen()->hpos();
256   unsigned int y = machine().first_screen()->vpos();
257   int width = m_border_bitmap.width();
258   int height = m_border_bitmap.height();
259
260
261   if (m_border_bitmap.valid())
262   {
263      UINT16 border = m_port_fe_data & 0x07;
264
265      //printf("update border from %d,%d to %d,%d\n", m_previous_border_x, m_previous_border_y, x, y);
266
267      do
268      {
269         m_border_bitmap.pix16(m_previous_border_y, m_previous_border_x) = border;
270
225271         m_previous_border_x += 1;
226272
227273         if (m_previous_border_x >= width)
branches/kale/src/mess/video/timex.c
r244606r244607
2929   m_frame_invert_count = 30;
3030}
3131
32void spectrum_state::screen_eof_timex(screen_device &screen, bool state)
33{
34   // rising edge
35   if (state)
36   {
37      spectrum_UpdateBorderBitmap();
3238
39      m_frame_number++;
40
41      if (m_frame_number >= m_frame_invert_count)
42      {
43         m_frame_number = 0;
44         m_flash_invert = !m_flash_invert;
45      }
46   }
47}
48
49
3350/*******************************************************************
3451 *
3552 *      Update the TS2068 display.


Previous 199869 Revisions Next


© 1997-2024 The MAME Team