Previous 15994 Revisions Next

r1274 Thursday 15th November, 2007 at 10:01:10 UTC by Wilbert Pol
[SMS/GG] It is possible to read the vdp status bits just before an interrupt is received by the z80. Added a slight delay to allow this. Fixes bug #1419.
[src/mess/video]smsvdp.c

src/mess/video/smsvdp.c
r1273r1274
4040#include "video/smsvdp.h"
4141#include "includes/sms.h"
4242#include "video/generic.h"
43#include "cpu/z80/z80.h"
4443
4544#define IS_SMS1_VDP      ( features & MODEL_315_5124 )
4645#define IS_SMS2_VDP      ( features & MODEL_315_5246 )
r1273r1274
224223   return (0);
225224}
226225
226static TIMER_CALLBACK(smsvdp_set_irq) {
227   irqState = 1;
228   if ( int_callback ) {
229      int_callback( ASSERT_LINE );
230   }
231}
232
227233static TIMER_CALLBACK(smsvdp_display_callback)
228234{
229235   rectangle rec;
r1273r1274
255261         if ( lineCountDownCounter == 0x00 ) {
256262            lineCountDownCounter = reg[0x0A];
257263            statusReg |= STATUS_HINT;
258            irqState = 1;
259264            if ( reg[0x00] & 0x10 ) {
260               if ( int_callback ) {
261                  int_callback( ASSERT_LINE );
262               }
265               /* Delay triggering of interrupt to allow software to read the status bit before the irq */
266               mame_timer_set( video_screen_get_time_until_pos( 0, video_screen_get_vpos(0), video_screen_get_hpos(0) + 1 ), 0, smsvdp_set_irq );
263267            }
264268         }
265269
266270      }
267271      if ( vpos == vpos_limit + 1 ) {
268272         statusReg |= STATUS_VINT;
269         irqState = 1;
270273         if ( reg[0x01] & 0x20 ) {
271            if ( int_callback ) {
272               int_callback( ASSERT_LINE );
273            }
274            /* Delay triggering of interrupt to allow software to read the status bit before the irq */
275            mame_timer_set( video_screen_get_time_until_pos( 0, video_screen_get_vpos(0), video_screen_get_hpos(0) + 1 ), 0, smsvdp_set_irq );
274276         }
275277      }
276278      if ( video_skip_this_frame() ) {
r1273r1274
303305      if ( lineCountDownCounter == 0x00 ) {
304306         lineCountDownCounter = reg[0x0A];
305307         statusReg |= STATUS_HINT;
306         irqState = 1;
307308         if ( reg[0x00] & 0x10 ) {
308            if ( int_callback ) {
309               int_callback( ASSERT_LINE );
310            }
309            /* Delay triggering of interrupt to allow software to read the status bit before the irq */
310            mame_timer_set( video_screen_get_time_until_pos( 0, video_screen_get_vpos(0), video_screen_get_hpos(0) + 1 ), 0, smsvdp_set_irq );
311311         }
312312      } else {
313313         lineCountDownCounter -= 1;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team