Previous 15994 Revisions Next

r13343 Tuesday 22nd November, 2011 at 20:10:36 UTC by Wilbert Pol
smsvdp.c: screen_tag must now be configured instead of magically depending on the machine's primary_screen. (nw)
[src/mess/drivers]sms.c
[src/mess/video]smsvdp.c smsvdp.h

src/mess/video/smsvdp.c
r13342r13343
127127   devcb_resolved_write_line   m_int_callback;
128128   devcb_resolved_write_line   m_pause_callback;
129129   emu_timer        *m_smsvdp_display_timer;
130   screen_device    *m_screen;
130131};
131132
132133static TIMER_CALLBACK( smsvdp_display_callback );
r13342r13343
163164{
164165   smsvdp_t *smsvdp = get_safe_token(device);
165166
166   screen_device *screen = device->machine().first_screen();
167   int height = screen->height();
167   int height = smsvdp->m_screen->height();
168168   int M1, M2, M3, M4;
169169   M1 = smsvdp->m_reg[0x01] & 0x10;
170170   M2 = smsvdp->m_reg[0x00] & 0x02;
r13342r13343
232232READ8_DEVICE_HANDLER( sms_vdp_vcount_r )
233233{
234234   smsvdp_t *smsvdp = get_safe_token(device);
235   int vpos = device->machine().primary_screen->vpos();
235   int vpos = smsvdp->m_screen->vpos();
236236
237   if (device->machine().primary_screen->hpos() < VCOUNT_CHANGE_HPOS)
237   if (smsvdp->m_screen->hpos() < VCOUNT_CHANGE_HPOS)
238238   {
239239      vpos--;
240240      if (vpos < 0)
241         vpos += device->machine().primary_screen->height();
241         vpos += smsvdp->m_screen->height();
242242   }
243243
244244   return (smsvdp->m_sms_frame_timing[INIT_VCOUNT] + vpos) & 0xff;
r13342r13343
318318   smsvdp_t *smsvdp = (smsvdp_t *) ptr;
319319
320320   rectangle rec;
321   int vpos = machine.primary_screen->vpos();
321   int vpos = smsvdp->m_screen->vpos();
322322   int vpos_limit = smsvdp->m_sms_frame_timing[VERTICAL_BLANKING] + smsvdp->m_sms_frame_timing[TOP_BLANKING]
323323                  + smsvdp->m_sms_frame_timing[TOP_BORDER] + smsvdp->m_sms_frame_timing[ACTIVE_DISPLAY_V]
324324                  + smsvdp->m_sms_frame_timing[BOTTOM_BORDER] + smsvdp->m_sms_frame_timing[BOTTOM_BLANKING];
r13342r13343
350350   {
351351      if (vpos == vpos_limit)
352352      {
353         machine.scheduler().timer_set(machine.primary_screen->time_until_pos(vpos, HINT_HPOS), FUNC(smsvdp_check_hint),0 ,smsvdp);
353         machine.scheduler().timer_set(smsvdp->m_screen->time_until_pos(vpos, HINT_HPOS), FUNC(smsvdp_check_hint),0 ,smsvdp);
354354      }
355355      else
356356      {
r13342r13343
359359
360360      if (vpos == vpos_limit + 1)
361361      {
362         machine.scheduler().timer_set(machine.primary_screen->time_until_pos(vpos, VINT_FLAG_HPOS), FUNC(smsvdp_set_status), (int)STATUS_VINT, smsvdp);
363         machine.scheduler().timer_set(machine.primary_screen->time_until_pos(vpos, VINT_HPOS), FUNC(smsvdp_check_vint), 0, smsvdp);
362         machine.scheduler().timer_set(smsvdp->m_screen->time_until_pos(vpos, VINT_FLAG_HPOS), FUNC(smsvdp_set_status), (int)STATUS_VINT, smsvdp);
363         machine.scheduler().timer_set(smsvdp->m_screen->time_until_pos(vpos, VINT_HPOS), FUNC(smsvdp_check_vint), 0, smsvdp);
364364      }
365365
366366      sms_update_palette(smsvdp);
r13342r13343
392392         smsvdp->m_reg9copy = smsvdp->m_reg[0x09];
393393      }
394394
395      machine.scheduler().timer_set(machine.primary_screen->time_until_pos(vpos, HINT_HPOS), FUNC(smsvdp_check_hint),0, smsvdp);
395      machine.scheduler().timer_set(smsvdp->m_screen->time_until_pos(vpos, HINT_HPOS), FUNC(smsvdp_check_hint),0, smsvdp);
396396
397397      sms_update_palette(smsvdp);
398398
r13342r13343
561561
562562         if (reg_num == 1)
563563         {
564            device->machine().scheduler().timer_set(device->machine().primary_screen->time_until_pos(device->machine().primary_screen->vpos(), VINT_HPOS), FUNC(smsvdp_check_vint),0 ,smsvdp);
564            device->machine().scheduler().timer_set(smsvdp->m_screen->time_until_pos(smsvdp->m_screen->vpos(), VINT_HPOS), FUNC(smsvdp_check_vint),0 ,smsvdp);
565565         }
566566         smsvdp->m_addrmode = 0;
567567         break;
r13342r13343
702702         else if (line >= 0 && line < smsvdp->m_sms_frame_timing[ACTIVE_DISPLAY_V])
703703         {
704704            /* Too many sprites per line */
705            machine.scheduler().timer_set(machine.primary_screen->time_until_pos(pixel_plot_y + line, SPROVR_HPOS), FUNC(smsvdp_set_status), (int)STATUS_SPROVR, smsvdp);
705            machine.scheduler().timer_set(smsvdp->m_screen->time_until_pos(pixel_plot_y + line, SPROVR_HPOS), FUNC(smsvdp_set_status), (int)STATUS_SPROVR, smsvdp);
706706         }
707707         sprite_buffer_count++;
708708      }
r13342r13343
857857         }
858858      }
859859      if (sprite_col_occurred)
860         machine.scheduler().timer_set(machine.primary_screen->time_until_pos(pixel_plot_y + line, SPRCOL_BASEHPOS + sprite_col_x), FUNC(smsvdp_set_status), (int)STATUS_SPRCOL, smsvdp);
860         machine.scheduler().timer_set(smsvdp->m_screen->time_until_pos(pixel_plot_y + line, SPRCOL_BASEHPOS + sprite_col_x), FUNC(smsvdp_set_status), (int)STATUS_SPRCOL, smsvdp);
861861   }
862862
863863   /* Fill column 0 with overscan color from m_reg[0x07] */
r13342r13343
909909         else if (line >= 0 && line < smsvdp->m_sms_frame_timing[ACTIVE_DISPLAY_V])
910910         {
911911            /* Too many sprites per line */
912            machine.scheduler().timer_set(machine.primary_screen->time_until_pos(pixel_plot_y + line, SPROVR_HPOS), FUNC(smsvdp_set_status), (int)STATUS_SPROVR, smsvdp);
912            machine.scheduler().timer_set(smsvdp->m_screen->time_until_pos(pixel_plot_y + line, SPROVR_HPOS), FUNC(smsvdp_set_status), (int)STATUS_SPROVR, smsvdp);
913913         }
914914         sprite_buffer_count++;
915915      }
r13342r13343
11211121         }
11221122      }
11231123      if (sprite_col_occurred)
1124         machine.scheduler().timer_set(machine.primary_screen->time_until_pos(pixel_plot_y + line, SPRCOL_BASEHPOS + sprite_col_x), FUNC(smsvdp_set_status), (int)STATUS_SPRCOL, smsvdp);
1124         machine.scheduler().timer_set(smsvdp->m_screen->time_until_pos(pixel_plot_y + line, SPRCOL_BASEHPOS + sprite_col_x), FUNC(smsvdp_set_status), (int)STATUS_SPRCOL, smsvdp);
11251125   }
11261126}
11271127
r13342r13343
14231423   smsvdp_t *smsvdp = get_safe_token(device);
14241424   const smsvdp_interface *intf = get_interface(device);
14251425
1426   screen_device *screen = device->machine().first_screen();
1427   int width = screen->width();
1428   int height = screen->height();
1426   smsvdp->m_screen = device->machine().device<screen_device>( intf->screen_tag );
1427   int width = smsvdp->m_screen->width();
1428   int height = smsvdp->m_screen->height();
14291429
14301430   smsvdp->m_features = intf->model;
14311431
r13342r13343
14451445   smsvdp->m_tmpbitmap = auto_bitmap_alloc(device->machine(), width, height, BITMAP_FORMAT_INDEXED32);
14461446
14471447   smsvdp->m_smsvdp_display_timer = device->machine().scheduler().timer_alloc(FUNC(smsvdp_display_callback), smsvdp);
1448   smsvdp->m_smsvdp_display_timer->adjust(screen->time_until_pos(0, DISPLAY_CB_HPOS), 0, screen->scan_period());
1448   smsvdp->m_smsvdp_display_timer->adjust(smsvdp->m_screen->time_until_pos(0, DISPLAY_CB_HPOS), 0, smsvdp->m_screen->scan_period());
14491449
14501450   device->save_item(NAME(smsvdp->m_status));
14511451   device->save_item(NAME(smsvdp->m_reg9copy));
src/mess/video/smsvdp.h
r13342r13343
4848struct _smsvdp_interface
4949{
5050   UINT32             model;                /* Select model/features for the emulation */
51   const char         *screen_tag;
5152   devcb_write_line   int_callback;         /* Interrupt callback function */
5253   devcb_write_line   pause_callback;       /* Pause callback function */
5354};
src/mess/drivers/sms.c
r13342r13343
353353static const smsvdp_interface _315_5124_intf =
354354{
355355   MODEL_315_5124,
356   "screen",
356357   DEVCB_LINE(sms_int_callback),
357358   DEVCB_LINE(sms_pause_callback)
358359};
r13342r13343
360361static const smsvdp_interface _315_5246_intf =
361362{
362363   MODEL_315_5246,
364   "screen",
363365   DEVCB_LINE(sms_int_callback),
364366   DEVCB_LINE(sms_pause_callback)
365367};
r13342r13343
367369static const smsvdp_interface _315_5378_intf =
368370{
369371   MODEL_315_5378,
372   "screen",
370373   DEVCB_LINE(sms_int_callback),
371374   DEVCB_LINE(sms_pause_callback)
372375};
r13342r13343
374377static const smsvdp_interface sms_store_intf =
375378{
376379   MODEL_315_5124,
380   "screen",
377381   DEVCB_LINE(sms_store_int_callback),
378382   DEVCB_LINE(sms_pause_callback)
379383};

Previous 15994 Revisions Next


© 1998-2018 The MESS Team