Previous 15994 Revisions Next

r14914 Saturday 14th April, 2012 at 13:25:15 UTC by Wilbert Pol
scv.c: Fixed regression (nw)
[src/mess/drivers]scv.c

src/mess/drivers/scv.c
r14913r14914
1515{
1616public:
1717   scv_state(const machine_config &mconfig, device_type type, const char *tag)
18      : driver_device(mconfig, type, tag) ,
19      m_p_videoram(*this, "p_videoram"){ }
18      : driver_device(mconfig, type, tag) { }
2019
2120   DECLARE_WRITE8_MEMBER(scv_porta_w);
2221   DECLARE_READ8_MEMBER(scv_portb_r);
r14913r14914
2524   DECLARE_WRITE8_MEMBER(scv_cart_ram_w);
2625   DECLARE_WRITE8_MEMBER(scv_cart_ram2_w);
2726   DECLARE_WRITE_LINE_MEMBER(scv_upd1771_ack_w);
28   required_shared_ptr<UINT8> m_p_videoram;
27   UINT8 *m_videoram;
2928   UINT8 m_porta;
3029   UINT8 m_portc;
3130   emu_timer *m_vb_timer;
r14913r14914
4241static ADDRESS_MAP_START( scv_mem, AS_PROGRAM, 8, scv_state )
4342   AM_RANGE( 0x0000, 0x0fff ) AM_ROM      /* BIOS */
4443
45   AM_RANGE( 0x2000, 0x3403 ) AM_RAM AM_BASE(m_p_videoram )   /* VRAM + 4 registers */
44   AM_RANGE( 0x2000, 0x3403 ) AM_RAM AM_BASE(m_videoram )   /* VRAM + 4 registers */
4645
4746   AM_RANGE( 0x3600, 0x3600 ) AM_DEVWRITE_LEGACY("upd1771c", upd1771_w )
4847
r14913r14914
442441   y += clip_y * 2;
443442   for ( j = clip_y * 4; j < 32; j += 4 )
444443   {
445      UINT8 pat0 = state->m_p_videoram[ tile_idx * 32 + j + 0 ];
446      UINT8 pat1 = state->m_p_videoram[ tile_idx * 32 + j + 1 ];
447      UINT8 pat2 = state->m_p_videoram[ tile_idx * 32 + j + 2 ];
448      UINT8 pat3 = state->m_p_videoram[ tile_idx * 32 + j + 3 ];
444      UINT8 pat0 = state->m_videoram[ tile_idx * 32 + j + 0 ];
445      UINT8 pat1 = state->m_videoram[ tile_idx * 32 + j + 1 ];
446      UINT8 pat2 = state->m_videoram[ tile_idx * 32 + j + 2 ];
447      UINT8 pat3 = state->m_videoram[ tile_idx * 32 + j + 3 ];
449448
450449      if ( ( top && j < 16 ) || ( bottom && j >= 16 ) )
451450      {
r14913r14914
549548{
550549   scv_state *state = screen.machine().driver_data<scv_state>();
551550   int x, y;
552   UINT8 fg = state->m_p_videoram[0x1403] >> 4;
553   UINT8 bg = state->m_p_videoram[0x1403] & 0x0f;
554   UINT8 gr_fg = state->m_p_videoram[0x1401] >> 4;
555   UINT8 gr_bg = state->m_p_videoram[0x1401] & 0x0f;
556   int clip_x = ( state->m_p_videoram[0x1402] & 0x0f ) * 2;
557   int clip_y = state->m_p_videoram[0x1402] >> 4;
551   UINT8 fg = state->m_videoram[0x1403] >> 4;
552   UINT8 bg = state->m_videoram[0x1403] & 0x0f;
553   UINT8 gr_fg = state->m_videoram[0x1401] >> 4;
554   UINT8 gr_bg = state->m_videoram[0x1401] & 0x0f;
555   int clip_x = ( state->m_videoram[0x1402] & 0x0f ) * 2;
556   int clip_y = state->m_videoram[0x1402] >> 4;
558557
559558   /* Clear the screen */
560559   bitmap.fill(gr_bg , cliprect);
r14913r14914
565564      int text_y = 0;
566565
567566      if ( y < clip_y )
568         text_y = ( state->m_p_videoram[0x1400] & 0x80 ) ? 0 : 1;
567         text_y = ( state->m_videoram[0x1400] & 0x80 ) ? 0 : 1;
569568      else
570         text_y = ( state->m_p_videoram[0x1400] & 0x80 ) ? 1 : 0;
569         text_y = ( state->m_videoram[0x1400] & 0x80 ) ? 1 : 0;
571570
572571      for ( x = 0; x < 32; x++ )
573572      {
574573         int text_x = 0;
575         UINT8 d = state->m_p_videoram[ 0x1000 + y * 32 + x ];
574         UINT8 d = state->m_videoram[ 0x1000 + y * 32 + x ];
576575
577576         if ( x < clip_x )
578            text_x = ( state->m_p_videoram[0x1400] & 0x40 ) ? 0 : 1;
577            text_x = ( state->m_videoram[0x1400] & 0x40 ) ? 0 : 1;
579578         else
580            text_x = ( state->m_p_videoram[0x1400] & 0x40 ) ? 1 : 0;
579            text_x = ( state->m_videoram[0x1400] & 0x40 ) ? 1 : 0;
581580
582581         if ( text_x && text_y )
583582         {
r14913r14914
587586         }
588587         else
589588         {
590            switch ( state->m_p_videoram[0x1400] & 0x03 )
589            switch ( state->m_videoram[0x1400] & 0x03 )
591590            {
592591            case 0x01:      /* Semi graphics mode */
593592               draw_semi_graph( bitmap, x * 8    , y * 16     , d & 0x80, gr_fg );
r14913r14914
611610   }
612611
613612   /* Draw sprites if enabled */
614   if ( state->m_p_videoram[0x1400] & 0x10 )
613   if ( state->m_videoram[0x1400] & 0x10 )
615614   {
616615      int i;
617616
618617      for ( i = 0; i < 128; i++ )
619618      {
620         UINT8 spr_y = state->m_p_videoram[ 0x1200 + i * 4 ] & 0xfe;
621         UINT8 y_32 = state->m_p_videoram[ 0x1200 + i * 4 ] & 0x01;      /* Xx32 sprite */
622         UINT8 clip = state->m_p_videoram[ 0x1201 + i * 4 ] >> 4;
623         UINT8 col = state->m_p_videoram[ 0x1201 + i * 4 ] & 0x0f;
624         UINT8 spr_x = state->m_p_videoram[ 0x1202 + i * 4 ] & 0xfe;
625         UINT8 x_32 = state->m_p_videoram[ 0x1202 + i * 4 ] & 0x01;      /* 32xX sprite */
626         UINT8 tile_idx = state->m_p_videoram[ 0x1203 + i * 4 ] & 0x7f;
627         UINT8 half = state->m_p_videoram[ 0x1203 + i * 4] & 0x80;
619         UINT8 spr_y = state->m_videoram[ 0x1200 + i * 4 ] & 0xfe;
620         UINT8 y_32 = state->m_videoram[ 0x1200 + i * 4 ] & 0x01;      /* Xx32 sprite */
621         UINT8 clip = state->m_videoram[ 0x1201 + i * 4 ] >> 4;
622         UINT8 col = state->m_videoram[ 0x1201 + i * 4 ] & 0x0f;
623         UINT8 spr_x = state->m_videoram[ 0x1202 + i * 4 ] & 0xfe;
624         UINT8 x_32 = state->m_videoram[ 0x1202 + i * 4 ] & 0x01;      /* 32xX sprite */
625         UINT8 tile_idx = state->m_videoram[ 0x1203 + i * 4 ] & 0x7f;
626         UINT8 half = state->m_videoram[ 0x1203 + i * 4] & 0x80;
628627         UINT8 left = 1;
629628         UINT8 right = 1;
630629         UINT8 top = 1;
r14913r14914
668667         }
669668
670669         /* Check if 2 color sprites are enabled */
671         if ( ( state->m_p_videoram[0x1400] & 0x20 ) && ( i & 0x20 ) )
670         if ( ( state->m_videoram[0x1400] & 0x20 ) && ( i & 0x20 ) )
672671         {
673672            /* 2 color sprite handling */
674673            draw_sprite( state, bitmap, spr_x, spr_y, tile_idx, col, left, right, top, bottom, clip );

Previous 15994 Revisions Next


© 1998-2018 The MESS Team