From 6ec0943fb9ec4e63d67ac73922f68deaf6eec0cf Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Wed, 27 Sep 2017 19:22:42 +0200 Subject: [PATCH 01/12] new working software list addition --------------------------------------------- lynx: MegaPak 1 [anonymous] --- hash/lynx.xml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hash/lynx.xml b/hash/lynx.xml index 1b6a161e96e..00834d070e9 100644 --- a/hash/lynx.xml +++ b/hash/lynx.xml @@ -11,7 +11,6 @@ Undumped Self-Published Titles: * Cyber Virus (Songbird Productions, CF2007) * Cyber Virus - CinciClassic Edition (Songbird Productions, CF20B1) * Lynx Othello (H. Dodgson) -* MegaPak 1 (Songbird Productions, CF2010) - too new (2008) * PokerMania (MW Software) * Ponx (Songbird Productions, CF2002) * Remnant - Planar Wars 3D (Songbird Productions, CF2005) @@ -607,6 +606,18 @@ Known undumped prototypes: + + MegaPak 1 (Euro, USA) + 2007 + Songbird Productions + + + + + + + + Ms. Pac-Man (Euro, USA) 1990 From b3f2d43d91e8a48ae15d877287b4e90c1dc732d0 Mon Sep 17 00:00:00 2001 From: angelosa Date: Wed, 27 Sep 2017 22:18:52 +0200 Subject: [PATCH 02/12] ygv608.cpp: screen control 11 (layer transparency enable), made POST screens again green for NCV1 & 2 (nw) --- src/mame/video/ygv608.cpp | 366 +++++++++++++++++++++----------------- src/mame/video/ygv608.h | 9 + 2 files changed, 211 insertions(+), 164 deletions(-) diff --git a/src/mame/video/ygv608.cpp b/src/mame/video/ygv608.cpp index 94ccc59d2bb..4086ea9364c 100644 --- a/src/mame/video/ygv608.cpp +++ b/src/mame/video/ygv608.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Mark McDougall +// copyright-holders:Mark McDougall, Angelo Salese /* * Yamaha YGV608 - PVDC2 Pattern mode Video Display Controller 2 @@ -42,7 +42,7 @@ * - fix tilemap dirty flags, move tilemap data in own space prolly helps; * - DMA from/to ROM; * - color palette accessors presumably accesses an internal RAMDAC with controllable auto-increment, convert to that; - * - fix char getting cut off from GAME SELECT msg in NCV2; + * - fix char getting cut off from GAME SELECT msg in NCV2 (sprite issue); * - clean-ups & documentation; * * @@ -222,9 +222,9 @@ enum { // R#11(prm) #define PRM_SABDEX 0x00 -#define PRM_ASBDEX 0x04 -#define PRM_SEABDX 0x08 -#define PRM_ASEBDX 0x0c +#define PRM_ASBDEX 0x01 +#define PRM_SEABDX 0x02 +#define PRM_ASEBDX 0x03 // R#40 #define HDW_SHIFT 0 @@ -383,6 +383,7 @@ static ADDRESS_MAP_START( regs_map, AS_IO, 8, ygv608_device ) AM_RANGE( 8, 8) AM_READWRITE(screen_ctrl_8_r, screen_ctrl_8_w) AM_RANGE( 9, 9) AM_READWRITE(screen_ctrl_9_r, screen_ctrl_9_w) AM_RANGE(10, 10) AM_READWRITE(screen_ctrl_10_r, screen_ctrl_10_w) + AM_RANGE(11, 11) AM_READWRITE(screen_ctrl_11_r, screen_ctrl_11_w) AM_RANGE(13, 13) AM_WRITE(border_color_w) // interrupt section @@ -996,7 +997,7 @@ void ygv608_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect int i; /* ensure that sprites are enabled */ - if( (m_dspe == false ) || (m_sprite_disable == true)) + if( (m_dspe == false ) || (m_sprite_disable == true) ) return; /* draw sprites */ @@ -1004,153 +1005,157 @@ void ygv608_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect sa = &m_sprite_attribute_table.s[MAX_SPRITES-1]; for( i=0; iattr >> 4) & 0x0f; - sx = ( (int)(sa->attr & 0x02) << 7 ) | (int)sa->sx; - sy = ( ( ( (int)(sa->attr & 0x01) << 8 ) | (int)sa->sy ) + 1 ) & 0x1ff; - attr = (sa->attr & 0x0c) >> 2; - g_attr = m_sprite_aux_reg & 3; - spf = (m_regs.s.r12 & r12_spf) >> 6; + color = (sa->attr >> 4) & 0x0f; + sx = ( (int)(sa->attr & 0x02) << 7 ) | (int)sa->sx; + sy = ( ( ( (int)(sa->attr & 0x01) << 8 ) | (int)sa->sy ) + 1 ) & 0x1ff; + attr = (sa->attr & 0x0c) >> 2; + g_attr = m_sprite_aux_reg & 3; + spf = (m_regs.s.r12 & r12_spf) >> 6; - if (m_sprite_aux_mode == SPAS_SPRITESIZE ) - { - size = g_attr; - flipx = (attr & SZ_HORIZREVERSE) != 0; - flipy = (attr & SZ_VERTREVERSE) != 0; - } - else - { - size = attr; - flipx = (g_attr & SZ_HORIZREVERSE) != 0; - flipy = (g_attr & SZ_VERTREVERSE) != 0; - } - - switch( size ) - { - case SZ_8X8 : - code = ( (int)m_sprite_bank << 8 ) | (int)sa->sn; - if (spf != 0) - color = ( code >> ( (spf - 1) * 2 ) ) & 0x0f; - if( code >= layout_total(GFX_8X8_4BIT) ) { - logerror( "SZ_8X8: sprite=%d\n", code ); - code = 0; + if (m_sprite_aux_mode == SPAS_SPRITESIZE ) + { + size = g_attr; + flipx = (attr & SZ_HORIZREVERSE) != 0; + flipy = (attr & SZ_VERTREVERSE) != 0; } - gfx(GFX_8X8_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x10000, - color, - flipx,flipy, - sx,sy,0x00); - // redraw with wrap-around - if( sx > 512-8 ) - gfx(GFX_8X8_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x10000, - color, - flipx,flipy, - sx-512,sy,0x00); - if( sy > 512-8 ) - gfx(GFX_8X8_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x10000, - color, - flipx,flipy, - sx,sy-512,0x00); - // really should draw again for both wrapped! - // - ignore until someone thinks it's required - break; - - case SZ_16X16 : - code = ( ( (int)m_sprite_bank & 0xfc ) << 6 ) | (int)sa->sn; - if (spf != 0) - color = ( code >> (spf * 2) ) & 0x0f; - if( code >= layout_total(GFX_16X16_4BIT) ) { - logerror( "SZ_8X8: sprite=%d\n", code ); - code = 0; + else + { + size = attr; + flipx = (g_attr & SZ_HORIZREVERSE) != 0; + flipy = (g_attr & SZ_VERTREVERSE) != 0; } - gfx(GFX_16X16_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x4000, - color, - flipx,flipy, - sx,sy,0x00); - // redraw with wrap-around - if( sx > 512-16 ) - gfx(GFX_16X16_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x4000, - color, - flipx,flipy, - sx-512,sy,0x00); - if( sy > 512-16 ) - gfx(GFX_16X16_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x4000, - color, - flipx,flipy, - sx,sy-512,0x00); - // really should draw again for both wrapped! - // - ignore until someone thinks it's required - break; - case SZ_32X32 : - code = ( ( (int)m_sprite_bank & 0xf0 ) << 4 ) | (int)sa->sn; - if (spf != 0) - color = ( code >> ( (spf + 1) * 2 ) ) & 0x0f; - if( code >= layout_total(GFX_32X32_4BIT) ) { - logerror( "SZ_32X32: sprite=%d\n", code ); - code = 0; + switch( size ) + { + case SZ_8X8: + code = ( (int)m_sprite_bank << 8 ) | (int)sa->sn; + if (spf != 0) + color = ( code >> ( (spf - 1) * 2 ) ) & 0x0f; + if( code >= layout_total(GFX_8X8_4BIT) ) + { + logerror( "SZ_8X8: sprite=%d\n", code ); + code = 0; + } + gfx(GFX_8X8_4BIT)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*0x10000, + color, + flipx,flipy, + sx,sy,0x00); + // redraw with wrap-around + if( sx > 512-8 ) + gfx(GFX_8X8_4BIT)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*0x10000, + color, + flipx,flipy, + sx-512,sy,0x00); + if( sy > 512-8 ) + gfx(GFX_8X8_4BIT)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*0x10000, + color, + flipx,flipy, + sx,sy-512,0x00); + // really should draw again for both wrapped! + // - ignore until someone thinks it's required + break; + + case SZ_16X16: + code = ( ( (int)m_sprite_bank & 0xfc ) << 6 ) | (int)sa->sn; + if (spf != 0) + color = ( code >> (spf * 2) ) & 0x0f; + if( code >= layout_total(GFX_16X16_4BIT) ) + { + logerror( "SZ_8X8: sprite=%d\n", code ); + code = 0; + } + gfx(GFX_16X16_4BIT)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*0x4000, + color, + flipx,flipy, + sx,sy,0x00); + // redraw with wrap-around + if( sx > 512-16 ) + gfx(GFX_16X16_4BIT)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*0x4000, + color, + flipx,flipy, + sx-512,sy,0x00); + if( sy > 512-16 ) + gfx(GFX_16X16_4BIT)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*0x4000, + color, + flipx,flipy, + sx,sy-512,0x00); + // really should draw again for both wrapped! + // - ignore until someone thinks it's required + break; + + case SZ_32X32: + code = ( ( (int)m_sprite_bank & 0xf0 ) << 4 ) | (int)sa->sn; + if (spf != 0) + color = ( code >> ( (spf + 1) * 2 ) ) & 0x0f; + if( code >= layout_total(GFX_32X32_4BIT) ) + { + logerror( "SZ_32X32: sprite=%d\n", code ); + code = 0; + } + gfx(GFX_32X32_4BIT)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*0x1000, + color, + flipx,flipy, + sx,sy,0x00); + // redraw with wrap-around + if( sx > 512-32 ) + gfx(GFX_32X32_4BIT)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*0x1000, + color, + flipx,flipy, + sx-512,sy,0x00); + if( sy > 512-32 ) + gfx(GFX_32X32_4BIT)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*0x1000, + color, + flipx,flipy, + sx,sy-512,0x00); + // really should draw again for both wrapped! + // - ignore until someone thinks it's required + break; + + case SZ_64X64: + code = ( ( (int)m_sprite_bank & 0xc0 ) << 2 ) | (int)sa->sn; + if (spf != 0) + color = ( code >> ( (spf + 1) * 2 ) ) & 0x0f; + if( code >= layout_total(GFX_64X64_4BIT) ) + { + logerror( "SZ_64X64: sprite=%d\n", code ); + code = 0; + } + gfx(GFX_64X64_4BIT)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*0x400, + color, + flipx,flipy, + sx,sy,0x00); + // redraw with wrap-around + if( sx > 512-64 ) + gfx(GFX_64X64_4BIT)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*0x400, + color, + flipx,flipy, + sx-512,sy,0x00); + if( sy > 512-64 ) + gfx(GFX_64X64_4BIT)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*0x400, + color, + flipx,flipy, + sx,sy-512,0x00); + // really should draw again for both wrapped! + // - ignore until someone thinks it's required + break; + + default: + break; } - gfx(GFX_32X32_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x1000, - color, - flipx,flipy, - sx,sy,0x00); - // redraw with wrap-around - if( sx > 512-32 ) - gfx(GFX_32X32_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x1000, - color, - flipx,flipy, - sx-512,sy,0x00); - if( sy > 512-32 ) - gfx(GFX_32X32_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x1000, - color, - flipx,flipy, - sx,sy-512,0x00); - // really should draw again for both wrapped! - // - ignore until someone thinks it's required - break; - - case SZ_64X64 : - code = ( ( (int)m_sprite_bank & 0xc0 ) << 2 ) | (int)sa->sn; - if (spf != 0) - color = ( code >> ( (spf + 1) * 2 ) ) & 0x0f; - if( code >= layout_total(GFX_64X64_4BIT) ) { - logerror( "SZ_64X64: sprite=%d\n", code ); - code = 0; - } - gfx(GFX_64X64_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x400, - color, - flipx,flipy, - sx,sy,0x00); - // redraw with wrap-around - if( sx > 512-64 ) - gfx(GFX_64X64_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x400, - color, - flipx,flipy, - sx-512,sy,0x00); - if( sy > 512-64 ) - gfx(GFX_64X64_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x400, - color, - flipx,flipy, - sx,sy-512,0x00); - // really should draw again for both wrapped! - // - ignore until someone thinks it's required - break; - - default : - break; - } } #endif @@ -1241,9 +1246,9 @@ uint32_t ygv608_device::update_screen(screen_device &screen, bitmap_ind16 &bitma m_tilemap_A = m_tilemap_A_cache_16[index]; m_tilemap_A->mark_all_dirty(); - m_tilemap_A->set_transparent_pen(0 ); + m_tilemap_A->set_transparent_pen(0); // for NCV1 it's sufficient to scroll only columns - m_tilemap_A->set_scroll_cols(m_page_x ); + m_tilemap_A->set_scroll_cols(m_page_x); if (m_pattern_size == PTS_8X8 ) m_tilemap_B = m_tilemap_B_cache_8[index]; @@ -1252,7 +1257,7 @@ uint32_t ygv608_device::update_screen(screen_device &screen, bitmap_ind16 &bitma m_tilemap_B->mark_all_dirty(); // for NCV1 it's sufficient to scroll only columns - m_tilemap_B->set_scroll_cols(m_page_x ); + m_tilemap_B->set_scroll_cols(m_page_x); // now clear the screen in case we change to 1-plane mode m_work_bitmap.fill(0, finalclip ); @@ -1292,12 +1297,12 @@ uint32_t ygv608_device::update_screen(screen_device &screen, bitmap_ind16 &bitma m_tilemap_A->enable(m_dspe == true); if(m_md & MD_1PLANE ) - m_tilemap_B->enable(0 ); + m_tilemap_B->enable(0); else m_tilemap_B->enable(m_dspe == true); - m_tilemap_A ->mark_all_dirty(); - m_tilemap_B ->mark_all_dirty(); + m_tilemap_A->mark_all_dirty(); + m_tilemap_B->mark_all_dirty(); /* @@ -1316,7 +1321,10 @@ uint32_t ygv608_device::update_screen(screen_device &screen, bitmap_ind16 &bitma { draw_layer_roz(screen, m_work_bitmap, finalclip, m_tilemap_B); - copybitmap( bitmap, m_work_bitmap, 0, 0, 0, 0, finalclip); + if(m_planeB_trans_enable == true) + copybitmap_trans( bitmap, m_work_bitmap, 0, 0, 0, 0, finalclip, 0); + else + copybitmap( bitmap, m_work_bitmap, 0, 0, 0, 0, finalclip); } // for some reason we can't use an opaque m_tilemap_A @@ -1324,15 +1332,19 @@ uint32_t ygv608_device::update_screen(screen_device &screen, bitmap_ind16 &bitma // - look at why this is the case?!? m_work_bitmap.fill(0, visarea ); - if ((m_regs.s.r11 & r11_prm) == PRM_ASBDEX || - (m_regs.s.r11 & r11_prm) == PRM_ASEBDX ) + if (m_priority_mode == PRM_ASBDEX || + m_priority_mode == PRM_ASEBDX ) draw_sprites(bitmap, finalclip); draw_layer_roz(screen, m_work_bitmap, finalclip, m_tilemap_A); - copybitmap_trans( bitmap, m_work_bitmap, 0, 0, 0, 0, finalclip, 0); + + if(m_planeA_trans_enable == true) + copybitmap_trans( bitmap, m_work_bitmap, 0, 0, 0, 0, finalclip, 0); + else + copybitmap( bitmap, m_work_bitmap, 0, 0, 0, 0, finalclip); - if ((m_regs.s.r11 & r11_prm) == PRM_SABDEX || - (m_regs.s.r11 & r11_prm) == PRM_SEABDX) + if (m_priority_mode == PRM_SABDEX || + m_priority_mode == PRM_SEABDX) draw_sprites(bitmap,finalclip ); @@ -2049,7 +2061,14 @@ WRITE8_MEMBER( ygv608_device::screen_ctrl_9_w ) } } - // R#10R - screen control: mosaic & sprite +// R#10R - screen control 10: mosaic & sprite +/*** + * xx-- ---- SPAx: Auxiliary bits of sprite attribute table (0=8x8 or no flip, 1=16x16 or flipy, 2=32x32 or flipx, 3=64x64 or flipx & y ) + * --x- ---- SPAS: Auxiliary function select (0=SPAx selects sprite size, 1=SPAx selects flipping) + * ---x ---- SPRD: Sprite display disable + * ---- xx-- MCBx: Mosaic enable on plane B + * ---- --xx MCAx: Mosaic enable on plane A + ***/ READ8_MEMBER( ygv608_device::screen_ctrl_10_r ) { return (m_sprite_aux_reg << 6) | ((m_sprite_aux_mode == true) << 5) | ((m_sprite_disable == true) << 4) @@ -2059,15 +2078,34 @@ READ8_MEMBER( ygv608_device::screen_ctrl_10_r ) // R#10W - screen control: mosaic & sprite WRITE8_MEMBER( ygv608_device::screen_ctrl_10_w ) { + m_sprite_aux_reg = (data & 0xc0) >> 6; + m_sprite_aux_mode = BIT(data, 5); + m_sprite_disable = BIT(data, 4); + // check mosaic - m_mosaic_aplane = data & 3; m_mosaic_bplane = (data & 0xc) >> 2; + m_mosaic_aplane = data & 3; if(m_mosaic_aplane || m_mosaic_bplane) popmessage("Mosaic effect %02x %02x",m_mosaic_aplane,m_mosaic_bplane); +} + +// R#11R - screen control 11 +READ8_MEMBER( ygv608_device::screen_ctrl_11_r ) +{ + return (m_scm<<6)|(m_yse<<5)|(m_cbdr<<4)| + (m_priority_mode<<2)|(m_planeB_trans_enable<<1)|(m_planeA_trans_enable<<0); +} + +// R#11W - screen control 11 +WRITE8_MEMBER( ygv608_device::screen_ctrl_11_w ) +{ +/**/m_scm = (data >> 6) & 3; +/**/m_yse = BIT(data,5); +/**/m_cbdr = BIT(data,4); + m_priority_mode = (data >> 2) & 3; + m_planeB_trans_enable = BIT(data,1); + m_planeA_trans_enable = BIT(data,0); - m_sprite_disable = BIT(data, 4); - m_sprite_aux_mode = BIT(data, 5); - m_sprite_aux_reg = (data & 0xc0) >> 6; } // R#13W - border color diff --git a/src/mame/video/ygv608.h b/src/mame/video/ygv608.h index c5d4d2ff70f..c499e130a1a 100644 --- a/src/mame/video/ygv608.h +++ b/src/mame/video/ygv608.h @@ -64,6 +64,8 @@ public: DECLARE_WRITE8_MEMBER(screen_ctrl_9_w); DECLARE_READ8_MEMBER(screen_ctrl_10_r); DECLARE_WRITE8_MEMBER(screen_ctrl_10_w); + DECLARE_READ8_MEMBER(screen_ctrl_11_r); + DECLARE_WRITE8_MEMBER(screen_ctrl_11_w); DECLARE_READ8_MEMBER(irq_mask_r); DECLARE_WRITE8_MEMBER(irq_mask_w); DECLARE_READ8_MEMBER(irq_ctrl_r); @@ -320,6 +322,13 @@ private: uint8_t m_h_div_size; /**< SLH: size of horizontal division in screen division scrolling */ uint8_t m_v_div_size; /**< SLV: size of vertical division in screen division scrolling */ + bool m_planeA_trans_enable; /**< CTPA: enable transparency for plane A */ + bool m_planeB_trans_enable; /**< CTPA: enable transparency for plane B */ + uint8_t m_priority_mode; /**< PRM: priority mode select */ + bool m_cbdr; /**< CBDR: color bus terminals CB7 to 0 and SPRT */ + bool m_yse; /**< YSE: permission control of trasparency timing output of YS terminal */ + uint8_t m_scm; /**< SCM: output frequency of clock signal output from terminal FSC */ + // screen section devcb_write_line m_vblank_handler; devcb_write_line m_raster_handler; From 1f3a452cd09eb29eaa402e14583bfe96f5ca573f Mon Sep 17 00:00:00 2001 From: angelosa Date: Wed, 27 Sep 2017 22:26:54 +0200 Subject: [PATCH 03/12] ygv608.cpp: kill legacy code (nw) --- src/mame/video/ygv608.cpp | 72 +++++++-------------------------------- src/mame/video/ygv608.h | 2 -- 2 files changed, 12 insertions(+), 62 deletions(-) diff --git a/src/mame/video/ygv608.cpp b/src/mame/video/ygv608.cpp index 4086ea9364c..8e0e81cf9f5 100644 --- a/src/mame/video/ygv608.cpp +++ b/src/mame/video/ygv608.cpp @@ -958,13 +958,8 @@ TILE_GET_INFO_MEMBER( ygv608_device::get_tile_info_B_16 ) void ygv608_device::postload() { - int i; - m_screen_resize = 1; m_tilemap_resize = 1; - - for(i = 0; i < 50; i++) - SetPostShortcuts(i); } void ygv608_device::register_state_save() @@ -1652,9 +1647,7 @@ WRITE8_MEMBER( ygv608_device::register_data_w ) uint8_t regNum = m_register_address & 0x3f; //logerror( "R#%d = $%02X\n", regNum, data ); - SetPreShortcuts (regNum, data); m_regs.b[regNum] = data; - SetPostShortcuts (regNum); m_iospace->write_byte(regNum, data); if (m_register_autoinc_w == true) @@ -1708,8 +1701,6 @@ WRITE8_MEMBER( ygv608_device::system_control_w ) // TODO: actual timing of this void ygv608_device::HandleYGV608Reset() { - int i; - /* Clear ports #0-7 */ memset( &m_ports.b[0], 0, 8 ); @@ -1723,12 +1714,6 @@ void ygv608_device::HandleYGV608Reset() SPRITE_ATTR_TABLE_SIZE ); memset( m_scroll_data_table, 0, 2*256 ); memset( m_colour_palette, 0, 256*3 ); - - /* should set shortcuts here too */ - for( i=0; i<50; i++ ) { - //SetPreShortcuts( i ); - SetPostShortcuts( i ); - } } /* @@ -1737,7 +1722,6 @@ void ygv608_device::HandleYGV608Reset() it for testing trojan ROM software. - So leave it in! */ - void ygv608_device::HandleRomTransfers(uint8_t type) { popmessage("ROM DMA used %02x",type); @@ -2281,10 +2265,15 @@ WRITE8_MEMBER( ygv608_device::crtc_w ) case 40: { + int new_display_width = (data & 0x3f) * 16; + m_crtc.htotal &= ~0x600; m_crtc.htotal |= (data & 0xc0) << 3; - m_crtc.display_width = (data & 0x3f) * 16; + if(new_display_width != m_crtc.display_width) + m_screen_resize = 1; + + m_crtc.display_width = new_display_width; break; } @@ -2313,9 +2302,13 @@ WRITE8_MEMBER( ygv608_device::crtc_w ) case 44: { - // TODO: VSLS, bit 6 + int new_display_height = (data & 0x3f) * 8; - m_crtc.display_height = (data & 0x3f) * 8; + // TODO: VSLS, bit 6 + if(new_display_height != m_crtc.display_height) + m_screen_resize = 1; + + m_crtc.display_height = new_display_height; break; } @@ -2366,47 +2359,6 @@ void ygv608_device::screen_configure() m_vblank_timer->adjust(m_screen->time_until_pos(m_crtc.display_height,0), 0, m_screen->frame_period()); } -// Set any "short-cut" variables before we update the YGV608 registers -// - these are used only in optimisation of the emulation -void ygv608_device::SetPreShortcuts( int reg, int data ) -{ - switch( reg ) { - - - case 40 : - if( ( ( data >> HDW_SHIFT ) & HDW_MASK ) != (m_regs.s.r40 & r40_hdw)) - m_screen_resize = 1; - break; - - case 44 : - if( ( ( data >> VDW_SHIFT ) & VDW_MASK ) != (m_regs.s.r44 & r44_vdw)) - m_screen_resize = 1; - break; - } -} - -// Set any "short-cut" variables after we have updated the YGV608 registers -// - these are used only in optimisation of the emulation -// TODO: actually this is legacy code that needs to go away -void ygv608_device::SetPostShortcuts(int reg ) -{ - - switch (reg) - { - - - case 11 : - //ShowYGV608Registers(); - break; - - } - -} - - - - - void ygv608_device::ShowYGV608Registers() { diff --git a/src/mame/video/ygv608.h b/src/mame/video/ygv608.h index c499e130a1a..c08b2966f9c 100644 --- a/src/mame/video/ygv608.h +++ b/src/mame/video/ygv608.h @@ -219,8 +219,6 @@ private: void HandleYGV608Reset(); void HandleRomTransfers(uint8_t type); - void SetPreShortcuts(int reg, int data ); - void SetPostShortcuts(int reg); void ShowYGV608Registers(); union { From 89a97d353c8bb9fd7ffc5dde5fc380aac17435dd Mon Sep 17 00:00:00 2001 From: cracyc Date: Wed, 27 Sep 2017 16:01:36 -0500 Subject: [PATCH 04/12] data_marp: bail if database not open (nw) --- plugins/data/data_marp.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/data/data_marp.lua b/plugins/data/data_marp.lua index 129d144a2c6..0919683d3e6 100644 --- a/plugins/data/data_marp.lua +++ b/plugins/data/data_marp.lua @@ -111,10 +111,12 @@ local function init() db:exec("END TRANSACTION") end -init() +if db then + init() +end function dat.check(set, softlist) - if softlist or not ver then + if softlist or not ver or not db then return nil end info = nil From 16689994a7e61617579a6fae53e2f546c993439a Mon Sep 17 00:00:00 2001 From: angelosa Date: Wed, 27 Sep 2017 23:44:44 +0200 Subject: [PATCH 05/12] ygv608.cpp: enabled sprite wraparound when both sx and sy goes past clipping boundaries, fixes Namco Classics Vol. 2 disappearing char on game select [Angelo Salese] --- src/mame/video/ygv608.cpp | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/src/mame/video/ygv608.cpp b/src/mame/video/ygv608.cpp index 8e0e81cf9f5..75cc80a6750 100644 --- a/src/mame/video/ygv608.cpp +++ b/src/mame/video/ygv608.cpp @@ -42,7 +42,7 @@ * - fix tilemap dirty flags, move tilemap data in own space prolly helps; * - DMA from/to ROM; * - color palette accessors presumably accesses an internal RAMDAC with controllable auto-increment, convert to that; - * - fix char getting cut off from GAME SELECT msg in NCV2 (sprite issue); + * - fix char getting cut off from GAME SELECT msg in NCV2 (done, sprite wraparound for sx & sy); * - clean-ups & documentation; * * @@ -1021,7 +1021,7 @@ void ygv608_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect flipx = (g_attr & SZ_HORIZREVERSE) != 0; flipy = (g_attr & SZ_VERTREVERSE) != 0; } - + switch( size ) { case SZ_8X8: @@ -1051,8 +1051,12 @@ void ygv608_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect color, flipx,flipy, sx,sy-512,0x00); - // really should draw again for both wrapped! - // - ignore until someone thinks it's required + if( sx > 512-8 && sy > 512-8) + gfx(GFX_8X8_4BIT)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*0x10000, + color, + flipx,flipy, + sx-512,sy-512,0x00); break; case SZ_16X16: @@ -1082,8 +1086,12 @@ void ygv608_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect color, flipx,flipy, sx,sy-512,0x00); - // really should draw again for both wrapped! - // - ignore until someone thinks it's required + if( sx > 512-16 && sy > 512-16) + gfx(GFX_16X16_4BIT)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*0x4000, + color, + flipx,flipy, + sx-512,sy-512,0x00); break; case SZ_32X32: @@ -1113,8 +1121,12 @@ void ygv608_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect color, flipx,flipy, sx,sy-512,0x00); - // really should draw again for both wrapped! - // - ignore until someone thinks it's required + if( sx > 512-32 && sy > 512-32) + gfx(GFX_32X32_4BIT)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*0x1000, + color, + flipx,flipy, + sx-512,sy-512,0x00); break; case SZ_64X64: @@ -1144,8 +1156,12 @@ void ygv608_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect color, flipx,flipy, sx,sy-512,0x00); - // really should draw again for both wrapped! - // - ignore until someone thinks it's required + if( sx > 512-64 && sy > 512-64 ) + gfx(GFX_64X64_4BIT)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*0x400, + color, + flipx,flipy, + sx-512,sy-512,0x00); break; default: @@ -2021,7 +2037,7 @@ WRITE8_MEMBER( ygv608_device::screen_ctrl_9_w ) m_tilemap_resize = 1; m_pattern_size = new_pts; - m_h_div_size = (data >> 3) & 7; +/**/m_h_div_size = (data >> 3) & 7; m_v_div_size = (data >> 0) & 7; //popmessage("%02x %02x",m_h_div_size,m_v_div_size); @@ -2089,7 +2105,6 @@ WRITE8_MEMBER( ygv608_device::screen_ctrl_11_w ) m_priority_mode = (data >> 2) & 3; m_planeB_trans_enable = BIT(data,1); m_planeA_trans_enable = BIT(data,0); - } // R#13W - border color From a07bc6c5ea3df4b55ddab738fc31381352a2cdeb Mon Sep 17 00:00:00 2001 From: angelosa Date: Thu, 28 Sep 2017 00:19:06 +0200 Subject: [PATCH 06/12] ygv608.cpp: sprite drawing cleanups (nw) --- src/mame/video/ygv608.cpp | 186 +++++++++----------------------------- 1 file changed, 41 insertions(+), 145 deletions(-) diff --git a/src/mame/video/ygv608.cpp b/src/mame/video/ygv608.cpp index 75cc80a6750..664d79d7f65 100644 --- a/src/mame/video/ygv608.cpp +++ b/src/mame/video/ygv608.cpp @@ -982,7 +982,11 @@ void ygv608_device::register_state_save() void ygv608_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { #ifdef _ENABLE_SPRITES - + const int sprite_limits[4] = { 512-8, 512-16, 512-32, 512-64 }; + const uint32_t spritebank_size[4] = { 0x10000, 0x4000, 0x1000, 0x400 }; + const int sprite_shift[4] = { 8, 6, 4, 2 }; + const int sprite_mask[4] = { 0xff, 0xfc, 0xf0, 0xc0 }; + const int spf_shift[4] = { -1, 0, +1, +2 }; // sprites are always clipped to 512x512 // - regardless of the visible display dimensions rectangle spriteClip(0, 512, 0, 512); @@ -1021,152 +1025,44 @@ void ygv608_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect flipx = (g_attr & SZ_HORIZREVERSE) != 0; flipy = (g_attr & SZ_VERTREVERSE) != 0; } - - switch( size ) + + // calculate code and apply sprite base address + code = ( (int)(m_sprite_bank & sprite_mask[size]) << sprite_shift[size] ) | (int)sa->sn; + // apply spf to color (invalidates individual attribute bits for color) + if (spf != 0) + color = ( code >> ( (spf + spf_shift[size]) * 2 ) ) & 0x0f; + // check code boundary (TODO: do we really need this?) + if( code >= layout_total(size) ) { - case SZ_8X8: - code = ( (int)m_sprite_bank << 8 ) | (int)sa->sn; - if (spf != 0) - color = ( code >> ( (spf - 1) * 2 ) ) & 0x0f; - if( code >= layout_total(GFX_8X8_4BIT) ) - { - logerror( "SZ_8X8: sprite=%d\n", code ); - code = 0; - } - gfx(GFX_8X8_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x10000, - color, - flipx,flipy, - sx,sy,0x00); - // redraw with wrap-around - if( sx > 512-8 ) - gfx(GFX_8X8_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x10000, - color, - flipx,flipy, - sx-512,sy,0x00); - if( sy > 512-8 ) - gfx(GFX_8X8_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x10000, - color, - flipx,flipy, - sx,sy-512,0x00); - if( sx > 512-8 && sy > 512-8) - gfx(GFX_8X8_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x10000, - color, - flipx,flipy, - sx-512,sy-512,0x00); - break; - - case SZ_16X16: - code = ( ( (int)m_sprite_bank & 0xfc ) << 6 ) | (int)sa->sn; - if (spf != 0) - color = ( code >> (spf * 2) ) & 0x0f; - if( code >= layout_total(GFX_16X16_4BIT) ) - { - logerror( "SZ_8X8: sprite=%d\n", code ); - code = 0; - } - gfx(GFX_16X16_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x4000, - color, - flipx,flipy, - sx,sy,0x00); - // redraw with wrap-around - if( sx > 512-16 ) - gfx(GFX_16X16_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x4000, - color, - flipx,flipy, - sx-512,sy,0x00); - if( sy > 512-16 ) - gfx(GFX_16X16_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x4000, - color, - flipx,flipy, - sx,sy-512,0x00); - if( sx > 512-16 && sy > 512-16) - gfx(GFX_16X16_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x4000, - color, - flipx,flipy, - sx-512,sy-512,0x00); - break; - - case SZ_32X32: - code = ( ( (int)m_sprite_bank & 0xf0 ) << 4 ) | (int)sa->sn; - if (spf != 0) - color = ( code >> ( (spf + 1) * 2 ) ) & 0x0f; - if( code >= layout_total(GFX_32X32_4BIT) ) - { - logerror( "SZ_32X32: sprite=%d\n", code ); - code = 0; - } - gfx(GFX_32X32_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x1000, - color, - flipx,flipy, - sx,sy,0x00); - // redraw with wrap-around - if( sx > 512-32 ) - gfx(GFX_32X32_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x1000, - color, - flipx,flipy, - sx-512,sy,0x00); - if( sy > 512-32 ) - gfx(GFX_32X32_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x1000, - color, - flipx,flipy, - sx,sy-512,0x00); - if( sx > 512-32 && sy > 512-32) - gfx(GFX_32X32_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x1000, - color, - flipx,flipy, - sx-512,sy-512,0x00); - break; - - case SZ_64X64: - code = ( ( (int)m_sprite_bank & 0xc0 ) << 2 ) | (int)sa->sn; - if (spf != 0) - color = ( code >> ( (spf + 1) * 2 ) ) & 0x0f; - if( code >= layout_total(GFX_64X64_4BIT) ) - { - logerror( "SZ_64X64: sprite=%d\n", code ); - code = 0; - } - gfx(GFX_64X64_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x400, - color, - flipx,flipy, - sx,sy,0x00); - // redraw with wrap-around - if( sx > 512-64 ) - gfx(GFX_64X64_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x400, - color, - flipx,flipy, - sx-512,sy,0x00); - if( sy > 512-64 ) - gfx(GFX_64X64_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x400, - color, - flipx,flipy, - sx,sy-512,0x00); - if( sx > 512-64 && sy > 512-64 ) - gfx(GFX_64X64_4BIT)->transpen(bitmap,spriteClip, - code+m_namcond1_gfxbank*0x400, - color, - flipx,flipy, - sx-512,sy-512,0x00); - break; - - default: - break; + logerror( "SZ_%d: sprite=%d\n", size, code ); + code = 0; } + // draw the sprite + gfx(size)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*spritebank_size[size], + color, + flipx,flipy, + sx,sy,0x00); + // draw with wraparound + if(sx > sprite_limits[size] || sy > sprite_limits[size] ) + { + gfx(size)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*spritebank_size[size], + color, + flipx,flipy, + sx-512,sy,0x00); + gfx(size)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*spritebank_size[size], + color, + flipx,flipy, + sx,sy-512,0x00); + gfx(size)->transpen(bitmap,spriteClip, + code+m_namcond1_gfxbank*spritebank_size[size], + color, + flipx,flipy, + sx-512,sy-512,0x00); + } + } #endif From 64c6e9fe6ba8c832277ddb23a3ec633712c03a1d Mon Sep 17 00:00:00 2001 From: angelosa Date: Thu, 28 Sep 2017 00:41:52 +0200 Subject: [PATCH 07/12] ygv608.cpp: screen control 12 (nw) --- src/mame/video/ygv608.cpp | 33 ++++++++++++++++++++++++--------- src/mame/video/ygv608.h | 6 ++++++ 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/mame/video/ygv608.cpp b/src/mame/video/ygv608.cpp index 664d79d7f65..f3fcb7248ba 100644 --- a/src/mame/video/ygv608.cpp +++ b/src/mame/video/ygv608.cpp @@ -384,6 +384,7 @@ static ADDRESS_MAP_START( regs_map, AS_IO, 8, ygv608_device ) AM_RANGE( 9, 9) AM_READWRITE(screen_ctrl_9_r, screen_ctrl_9_w) AM_RANGE(10, 10) AM_READWRITE(screen_ctrl_10_r, screen_ctrl_10_w) AM_RANGE(11, 11) AM_READWRITE(screen_ctrl_11_r, screen_ctrl_11_w) + AM_RANGE(12, 12) AM_READWRITE(screen_ctrl_12_r, screen_ctrl_12_w) AM_RANGE(13, 13) AM_WRITE(border_color_w) // interrupt section @@ -651,11 +652,11 @@ TILE_GET_INFO_MEMBER( ygv608_device::get_tile_info_A_8 ) logerror( "A_8X8: tilemap=%d\n", j ); j = 0; } - if ((m_regs.s.r12 & r12_apf) != 0) + if (m_planeA_color_fetch != 0) { // attribute only valid in 16 color mode if( set == GFX_8X8_4BIT ) - attr = ( j >> ( ((m_regs.s.r12 & r12_apf) - 1 ) * 2 ) ) & 0x0f; + attr = ( j >> ( (m_planeA_color_fetch - 1 ) * 2 ) ) & 0x0f; } // banking if (set == GFX_8X8_4BIT) @@ -749,9 +750,9 @@ TILE_GET_INFO_MEMBER( ygv608_device::get_tile_info_B_8 ) logerror( "B_8X8: tilemap=%d\n", j ); j = 0; } - if ((m_regs.s.r12 & r12_bpf) != 0) + if (m_planeB_color_fetch != 0) { - uint8_t color = (m_regs.s.r12 & r12_bpf) >> 3; + uint8_t color = (m_planeB_color_fetch); /* assume 16 colour mode for now... */ attr = ( j >> ( (color - 1 ) * 2 ) ) & 0x0f; @@ -841,11 +842,11 @@ TILE_GET_INFO_MEMBER( ygv608_device::get_tile_info_A_16 ) j = 0; } - if ((m_regs.s.r12 & r12_apf) != 0) + if (m_planeA_color_fetch != 0) { // attribute only valid in 16 color mode if( set == GFX_16X16_4BIT ) - attr = ( j >> ( ((m_regs.s.r12 & r12_apf)) * 2 ) ) & 0x0f; + attr = ( j >> ( m_planeA_color_fetch * 2 ) ) & 0x0f; } // banking @@ -934,9 +935,9 @@ TILE_GET_INFO_MEMBER( ygv608_device::get_tile_info_B_16 ) j = 0; } - if ((m_regs.s.r12 & r12_bpf) != 0) + if (m_planeB_color_fetch != 0) { - uint8_t color = (m_regs.s.r12 & r12_bpf) >> 3; + uint8_t color = (m_planeB_color_fetch); /* assume 16 colour mode for now... */ attr = ( j >> (color * 2)) & 0x0f; @@ -1011,7 +1012,7 @@ void ygv608_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect sy = ( ( ( (int)(sa->attr & 0x01) << 8 ) | (int)sa->sy ) + 1 ) & 0x1ff; attr = (sa->attr & 0x0c) >> 2; g_attr = m_sprite_aux_reg & 3; - spf = (m_regs.s.r12 & r12_spf) >> 6; + spf = m_sprite_color_fetch; if (m_sprite_aux_mode == SPAS_SPRITESIZE ) { @@ -2003,6 +2004,20 @@ WRITE8_MEMBER( ygv608_device::screen_ctrl_11_w ) m_planeA_trans_enable = BIT(data,0); } +// R#12R - screen control 12: color fetch modes +READ8_MEMBER( ygv608_device::screen_ctrl_12_r ) +{ + return (m_sprite_color_fetch<<6)|(m_planeB_color_fetch<<3)|(m_planeA_color_fetch<<0); +} + +// R#12W - screen control 12: color fetch modes +WRITE8_MEMBER( ygv608_device::screen_ctrl_12_w ) +{ + m_sprite_color_fetch = (data >> 6) & 3; + m_planeB_color_fetch = (data >> 3) & 7; + m_planeA_color_fetch = (data >> 0) & 7; +} + // R#13W - border color WRITE8_MEMBER( ygv608_device::border_color_w ) { diff --git a/src/mame/video/ygv608.h b/src/mame/video/ygv608.h index c08b2966f9c..ef2c2fc1efe 100644 --- a/src/mame/video/ygv608.h +++ b/src/mame/video/ygv608.h @@ -66,6 +66,8 @@ public: DECLARE_WRITE8_MEMBER(screen_ctrl_10_w); DECLARE_READ8_MEMBER(screen_ctrl_11_r); DECLARE_WRITE8_MEMBER(screen_ctrl_11_w); + DECLARE_READ8_MEMBER(screen_ctrl_12_r); + DECLARE_WRITE8_MEMBER(screen_ctrl_12_w); DECLARE_READ8_MEMBER(irq_mask_r); DECLARE_WRITE8_MEMBER(irq_mask_w); DECLARE_READ8_MEMBER(irq_ctrl_r); @@ -327,6 +329,10 @@ private: bool m_yse; /**< YSE: permission control of trasparency timing output of YS terminal */ uint8_t m_scm; /**< SCM: output frequency of clock signal output from terminal FSC */ + uint8_t m_planeA_color_fetch; /**< APF: A plane color fetch mode */ + uint8_t m_planeB_color_fetch; /**< BPF: B plane color fetch mode */ + uint8_t m_sprite_color_fetch; /**< SPF: sprite color fetch mode */ + // screen section devcb_write_line m_vblank_handler; devcb_write_line m_raster_handler; From 5c712b4083321dde78cae9902672b7b584aa9cf0 Mon Sep 17 00:00:00 2001 From: angelosa Date: Thu, 28 Sep 2017 01:02:07 +0200 Subject: [PATCH 08/12] ygv608.cpp: kill legacy register code (nw) --- src/mame/video/ygv608.cpp | 248 +++----------------------------------- src/mame/video/ygv608.h | 76 ------------ 2 files changed, 14 insertions(+), 310 deletions(-) diff --git a/src/mame/video/ygv608.cpp b/src/mame/video/ygv608.cpp index f3fcb7248ba..35c126e36ab 100644 --- a/src/mame/video/ygv608.cpp +++ b/src/mame/video/ygv608.cpp @@ -74,101 +74,6 @@ enum { p7_ts = 0x04, p7_tn = 0x02, p7_sr = 0x01, - - r0_pnya = 0x80, // if set, increment name table address after reads - r0_b_a = 0x40, // if set, we're reading from the second plane of tile data - r0_pny = 0x3f, // y-coordinate of current name table address - - r1_pnxa = 0x80, // if set, increment name table address after read - r1_res1 = 0x40, - r1_pnx = 0x3f, // x-coordinate of current name table address - - r2_cpaw = 0x80, // if set, increment color palette address after writes - r2_cpar = 0x40, // if set, increment color palette address after reads -// r2_res2 = 0x20, - r2_b_a = 0x10, - r2_scaw = 0x08, // if set, increment scroll address after writes - r2_scar = 0x04, // if set, increment scroll address after reads - r2_saaw = 0x02, // if set, increment sprite address after writes - r2_saar = 0x01, // if set, increment sprite address after reads - - r7_dckm = 0x80, - r7_flip = 0x40, -// r7_res7 = 0x30, - r7_zron = 0x08, // if set, roz plane is active - r7_md = 0x06, // determines 1 of 4 possible video modes - r7_dspe = 0x01, // if set, display is enabled - - r8_hds = 0xc0, - r8_vds = 0x30, - r8_rlrt = 0x08, - r8_rlsc = 0x04, -// r8_res8 = 0x02, - r8_pgs = 0x01, - - r9_pts = 0xc0, - r9_slh = 0x38, - r9_slv = 0x07, - - r10_spa = 0xc0, // misc global sprite attributes (x/y flip or sprite size) - r10_spas = 0x20, // if set, spa controls sprite flip, if clear, controls sprite size - r10_sprd = 0x10, // if set, sprites are disabled - r10_mcb = 0x0c, - r10_mca = 0x03, - - r11_scm = 0xc0, - r11_yse = 0x20, - r11_cbdr = 0x10, - r11_prm = 0x0c, // determines one of 4 priority settings - r11_ctpb = 0x02, - r11_ctpa = 0x01, - - r12_spf = 0xc0, - r12_bpf = 0x38, - r12_apf = 0x07, - -// r14_res14 = 0xfc, - r14_iep = 0x02, // if set, generate IRQ on position detection (?) - r14_iev = 0x01, // if set, generate IRQ on vertical border interval draw - - // these 4 are currently unimplemented by us - r16_fpm = 0x80, - r16_il8 = 0x40, - r16_res16 = 0x20, - r16_ih = 0x1f, - - r17_ba1 = 0x70, - r17_ba0 = 0x07, - r18_ba3 = 0x70, - r18_ba2 = 0x07, - r19_ba5 = 0x70, - r19_ba4 = 0x07, - r20_ba7 = 0x70, - r20_ba6 = 0x07, - r21_bb1 = 0x70, - r21_bb0 = 0x07, - r22_bb3 = 0x70, - r22_bb2 = 0x07, - r23_bb5 = 0x70, - r23_bb4 = 0x07, - r24_bb7 = 0x70, - r24_bb6 = 0x07, - - r39_hsw = 0xe0, - r39_hbw = 0x1f, - - r40_htl89 = 0xc0, - r40_hdw = 0x3f, - - r43_vsw = 0xe0, - r43_vbw = 0x1f, - - r44_vsls = 0x40, - r44_vdw = 0x1f, - - r45_vtl8 = 0x80, - r45_tres = 0x40, - r45_vdp = 0x1f }; @@ -443,7 +348,7 @@ ygv608_device::ygv608_device( const machine_config &mconfig, const char *tag, de void ygv608_device::device_start() { memset(&m_ports, 0, sizeof(m_ports)); - memset(&m_regs, 0, sizeof(m_regs)); +// memset(&m_regs, 0, sizeof(m_regs)); memset(&m_pattern_name_table, 0, sizeof(m_pattern_name_table)); memset(&m_sprite_attribute_table, 0, sizeof(m_sprite_attribute_table)); @@ -966,7 +871,7 @@ void ygv608_device::postload() void ygv608_device::register_state_save() { save_item(NAME(m_ports.b)); - save_item(NAME(m_regs.b)); +// save_item(NAME(m_regs.b)); save_item(NAME(m_pattern_name_table)); save_item(NAME(m_sprite_attribute_table.b)); save_item(NAME(m_scroll_data_table)); @@ -1382,9 +1287,7 @@ READ8_MEMBER( ygv608_device::palette_data_r ) READ8_MEMBER(ygv608_device::register_data_r) { int regNum = m_register_address & 0x3f; - uint8_t res = m_regs.b[regNum]; - - //m_iospace->read_byte(regNum); + uint8_t res = m_iospace->read_byte(regNum); if (m_register_autoinc_r == true) @@ -1560,7 +1463,6 @@ WRITE8_MEMBER( ygv608_device::register_data_w ) uint8_t regNum = m_register_address & 0x3f; //logerror( "R#%d = $%02X\n", regNum, data ); - m_regs.b[regNum] = data; m_iospace->write_byte(regNum, data); if (m_register_autoinc_w == true) @@ -1614,12 +1516,18 @@ WRITE8_MEMBER( ygv608_device::system_control_w ) // TODO: actual timing of this void ygv608_device::HandleYGV608Reset() { + int i; /* Clear ports #0-7 */ memset( &m_ports.b[0], 0, 8 ); /* Clear registers #0-38, #47-49 */ - memset( &m_regs.b[0], 0, 39 ); - memset( &m_regs.b[47], 0, 3 ); + for(i=0;i<39;i++) + m_iospace->write_byte(i, 0x00); + for(i=47;i<50;i++) + m_iospace->write_byte(i, 0x00); + +// memset( &m_regs.b[0], 0, 39 ); +// memset( &m_regs.b[47], 0, 3 ); /* Clear internal ram */ memset( m_pattern_name_table, 0, 4096 ); @@ -1640,6 +1548,7 @@ void ygv608_device::HandleRomTransfers(uint8_t type) popmessage("ROM DMA used %02x",type); #if 0 + // TODO: eventually update this code to latest static uint8_t *sdt = (uint8_t *)m_scroll_data_table; static uint8_t *sat = (uint8_t *)m_sprite_attribute_table.b; @@ -1698,7 +1607,7 @@ void ygv608_device::HandleRomTransfers(uint8_t type) // R#0R - Pattern Name Table Access pointer Y READ8_MEMBER( ygv608_device::pattern_name_table_y_r ) { - return ((m_xtile_autoinc == true) << 7) | ((m_plane_select_access == true) << 6) | m_xtile_ptr; + return (m_ytile_autoinc << 7) | (m_plane_select_access << 6) | m_ytile_ptr; } // R#0W - Pattern Name Table Access pointer Y @@ -1718,7 +1627,7 @@ WRITE8_MEMBER( ygv608_device::pattern_name_table_y_w ) // R#1R - Pattern Name Table Access pointer X READ8_MEMBER( ygv608_device::pattern_name_table_x_r ) { - return ((m_xtile_autoinc == true) << 7) | m_xtile_ptr; + return (m_xtile_autoinc << 7) | m_xtile_ptr; } // R#1W - Pattern Name Table Access pointer X @@ -2286,132 +2195,3 @@ void ygv608_device::screen_configure() } -void ygv608_device::ShowYGV608Registers() -{ - int p, b; - - logerror( "YGV608 Registers\n" ); - logerror( - "\tR#00: $%02X : PNYA(%d),B/A(%c),PNY(%d)\n", - m_regs.b[0], - m_regs.s.r0 & r0_pnya, - ((m_plane_select_access == true) ? 'B' : 'A' ), - m_regs.s.r0 & r0_pny); - - logerror( - "\tR#01: $%02X : PNXA(%d),PNX(%d)\n", - m_regs.b[1], - m_regs.s.r1 & r1_pnxa, - m_regs.s.r1 & r1_pnx); - - logerror( - "\tR#02: $%02X : CPAW(%d),CPAR(%d),B/A(%d),SCAW(%d),SCAR(%d),SAAW(%d),SAAR(%d)\n", - m_regs.b[2], - m_regs.s.r2 & r2_cpaw, - m_regs.s.r2 & r2_cpar, - m_regs.s.r2 & r2_b_a, - m_regs.s.r2 & r2_scaw, - m_regs.s.r2 & r2_scar, - m_regs.s.r2 & r2_saaw, - m_regs.s.r2 & r2_saar); - - logerror( - "\tR#03: $%02X : SAA($%02X)\n", - m_regs.b[3], - m_sprite_address ); - - logerror( - "\tR#04: $%02X : SCA($%02X)\n", - m_regs.b[4], - m_regs.s.sca ); - - logerror( - "\tR#05: $%02X : CC($%02X)\n", - m_regs.b[5], - m_regs.s.cc ); - - logerror( - "\tR#06: $%02X : SBA($%02X)\n", - m_regs.b[6], - m_sprite_bank ); - - logerror( - "\tR#07: $%02X : DSPE(%d),MD(%d),ZRON(%d),FLIP(%d),DCKM(%d)\n", - m_regs.b[7], - m_regs.s.r7 & r7_dspe, - m_regs.s.r7 & r7_md, - m_regs.s.r7 & r7_zron, - m_regs.s.r7 & r7_flip, - m_regs.s.r7 & r7_dckm); - - logerror( - "\tR#08: $%02X : HDS(%d),VDS(%d),RLRT(%d),RLSC(%d),PGS(%d)\n", - m_regs.b[8], - m_regs.s.r8 & r8_hds, - m_regs.s.r8 & r8_vds, - m_regs.s.r8 & r8_rlrt, - m_regs.s.r8 & r8_rlsc, - m_regs.s.r8 & r8_pgs); - - logerror( - "\tR#11: $%02X : CTPA(%d),CTPB(%d),PRM(%d),CBDR(%d),YSE(%d),SCM(%d)\n", - m_regs.b[11], - m_regs.s.r11 & r11_ctpa, - m_regs.s.r11 & r11_ctpb, - m_regs.s.r11 & r11_prm, - m_regs.s.r11 & r11_cbdr, - m_regs.s.r11 & r11_yse, - m_regs.s.r11 & r11_scm); - - logerror( - "\tR#40: $%02X : HTL9:8($%02X)=$%06X,HDW(%d)\n", - m_regs.b[40], - m_regs.s.r40 & r40_htl89, (int)(m_regs.s.r40 & r40_htl89) << 8, - m_regs.s.r40 & r40_hdw); - - logerror( - "\tR#41: $%02X : HDSP($%02X)\n", - m_regs.b[41], - m_regs.s.hdsp ); - - logerror( - "\tR#42: $%02X : HTL7:0($%02X)\n", - m_regs.b[42], - m_regs.s.htl ); - - logerror( - "\t HTL=$%03X\n", - ( (int)(m_regs.s.r40 & r40_htl89) << 8 ) | - ( (int)m_regs.s.htl ) ); - - logerror( - "\tR#47: $%02X : TB12:5($%02X) = $%06X\n", - m_regs.b[47], - m_regs.s.tb5, (int)m_regs.s.tb5 << 5 ); - - logerror( - "\tR#48: $%02X : TB20:13($%02X) = $%06X\n", - m_regs.b[48], - m_regs.s.tb13, (int)m_regs.s.tb13 << 13 ); - - logerror( - "\t TB=$%06X\n", - ( (int)m_regs.s.tb13 << 13 ) | - ( (int)m_regs.s.tb5 << 5 ) ); - - logerror( - "\tR#49: $%02X : TN11:4($%02X) = $%04X\n", - m_regs.b[49], - m_regs.s.tn4, (int)m_regs.s.tn4 << 4 ); - - logerror( - "ShortCuts:\n" ); - - for( p=0; p<2; p++ ) { - logerror( "\t" ); - for( b=0; b<8; b++ ) { - logerror( "%02X ", m_base_addr[p][b] ); - } - logerror( "\n" ); - } -} diff --git a/src/mame/video/ygv608.h b/src/mame/video/ygv608.h index ef2c2fc1efe..5ad738acad7 100644 --- a/src/mame/video/ygv608.h +++ b/src/mame/video/ygv608.h @@ -120,76 +120,6 @@ private: uint8_t p7; // P#7 - system control port (read/write) }; - struct YGV_REGS { - uint8_t r0; // R#0 - pattern name table access ptr (r/w) - uint8_t r1; // R#1 - pattern name table access ptr (r/w) - uint8_t r2; // R#2 - built in ram access control - uint8_t saa; // R#3 - sprite attribute table access ptr (r/w) - uint8_t sca; // R#4 - scroll table access ptr (r/w) - uint8_t cc; // R#5 - color palette access ptr (r/w) - uint8_t sba; // R#6 - sprite generator base address (r/w) - - // R#7 - R#11 - screen control (r/w) - uint8_t r7; // misc screen control (r/w) - uint8_t r8; // misc screen control (r/w) - uint8_t r9; // misc screen control (r/w) - uint8_t r10; // misc screen control (r/w) - uint8_t r11; // misc screen control (r/w) - - uint8_t r12; // R#12 - color palette selection (r/w) - uint8_t bdc; // R#13 - border colour (wo) - - // R#14 - R#16 - interrupt control - uint8_t r14; - uint8_t il; - uint8_t r16; - - // R#17 - R#24 - base address (wo) - uint8_t r17; - uint8_t r18; - uint8_t r19; - uint8_t r20; - uint8_t r21; - uint8_t r22; - uint8_t r23; - uint8_t r24; - - // R#25 - R#38 - enlargement, contraction and rotation parameters (wo) - uint8_t ax0; - uint8_t ax8; - uint8_t ax16; - - uint8_t dx0; - uint8_t dx8; - uint8_t dxy0; - uint8_t dxy8; - - uint8_t ay0; - uint8_t ay8; - uint8_t ay16; - - uint8_t dy0; - uint8_t dy8; - uint8_t dyx0; - uint8_t dyx8; - - // R#39 - R#46 - display scan control (wo) - uint8_t r39; - uint8_t r40; - uint8_t hdsp; - uint8_t htl; - uint8_t r43; - uint8_t r44; - uint8_t r45; - uint8_t vtl; - - // R#47 - R#49 - rom transfer control (wo) - uint8_t tb5; - uint8_t tb13; - uint8_t tn4; - - }; - static constexpr unsigned MAX_SPRITES = SPRITE_ATTR_TABLE_SIZE >> 2; struct SPRITE_ATTR { @@ -221,18 +151,12 @@ private: void HandleYGV608Reset(); void HandleRomTransfers(uint8_t type); - void ShowYGV608Registers(); union { uint8_t b[8]; YGV_PORTS s; } m_ports; - union { - uint8_t b[50]; - YGV_REGS s; - } m_regs; - /* * Built in ram */ From d77fd4db55c99df68d1bf8cbc39c7893877b75a8 Mon Sep 17 00:00:00 2001 From: angelosa Date: Thu, 28 Sep 2017 01:42:58 +0200 Subject: [PATCH 09/12] ygv608.cpp: kill legacy ports variables (nw) --- src/mame/video/ygv608.cpp | 64 +++++++++++++++------------------------ src/mame/video/ygv608.h | 24 ++++----------- 2 files changed, 31 insertions(+), 57 deletions(-) diff --git a/src/mame/video/ygv608.cpp b/src/mame/video/ygv608.cpp index 35c126e36ab..172fb3b82a0 100644 --- a/src/mame/video/ygv608.cpp +++ b/src/mame/video/ygv608.cpp @@ -54,28 +54,6 @@ #include "screen.h" -// Fundamental constants -enum { - p5_rwai = 0x80, // increment register select on reads - p5_rrai = 0x40, // increment register select on writes - p5_rn = 0x3f, // register select - -// p6_res6 = 0xe0, - p6_fp = 0x10, // position detection flag - p6_fv = 0x08, // vertical border interval flag - p6_fc = 0x04, - p6_hb = 0x02, // horizontal blanking flag? - p6_vb = 0x01, // vertical blanking flag? - -// p7_res7 = 0xc0, - p7_tr = 0x20, - p7_tc = 0x10, - p7_tl = 0x08, - p7_ts = 0x04, - p7_tn = 0x02, - p7_sr = 0x01, -}; - // TODO: move these into enums // R#7(md) @@ -322,7 +300,7 @@ DEVICE_ADDRESS_MAP_START( port_map, 8, ygv608_device ) AM_RANGE(0x02, 0x02) AM_READWRITE(scroll_data_r,scroll_data_w) AM_RANGE(0x03, 0x03) AM_READWRITE(palette_data_r,palette_data_w) AM_RANGE(0x04, 0x04) AM_READWRITE(register_data_r,register_data_w) - AM_RANGE(0x05, 0x05) AM_WRITE(register_select_w) + AM_RANGE(0x05, 0x05) AM_READNOP AM_WRITE(register_select_w) AM_RANGE(0x06, 0x06) AM_READWRITE(status_port_r,status_port_w) AM_RANGE(0x07, 0x07) AM_READWRITE(system_control_r,system_control_w) ADDRESS_MAP_END @@ -347,7 +325,7 @@ ygv608_device::ygv608_device( const machine_config &mconfig, const char *tag, de //------------------------------------------------- void ygv608_device::device_start() { - memset(&m_ports, 0, sizeof(m_ports)); +// memset(&m_ports, 0, sizeof(m_ports)); // memset(&m_regs, 0, sizeof(m_regs)); memset(&m_pattern_name_table, 0, sizeof(m_pattern_name_table)); memset(&m_sprite_attribute_table, 0, sizeof(m_sprite_attribute_table)); @@ -870,7 +848,7 @@ void ygv608_device::postload() void ygv608_device::register_state_save() { - save_item(NAME(m_ports.b)); +// save_item(NAME(m_ports.b)); // save_item(NAME(m_regs.b)); save_item(NAME(m_pattern_name_table)); save_item(NAME(m_sprite_attribute_table.b)); @@ -1254,14 +1232,14 @@ READ8_MEMBER( ygv608_device::sprite_data_r ) // P#2R - scroll data port READ8_MEMBER( ygv608_device::scroll_data_r ) { - uint8_t res = m_scroll_data_table[m_ba_plane_select][m_scroll_address]; + uint8_t res = m_scroll_data_table[m_ba_plane_scroll_select][m_scroll_address]; if (m_scar == true) { m_scroll_address++; /* handle wrap to next plane */ if (m_scroll_address == 0) - m_ba_plane_select ^= 1; + m_ba_plane_scroll_select ^= 1; } return res; @@ -1324,7 +1302,7 @@ READ8_MEMBER( ygv608_device::status_port_r ) // P#7R - system control port READ8_MEMBER( ygv608_device::system_control_r ) { - return (uint8_t)(m_ports.b[7]); + return m_dma_status; } // P#0W - pattern name table data write @@ -1427,14 +1405,14 @@ WRITE8_MEMBER( ygv608_device::sprite_data_w ) // P#2W - scroll data port WRITE8_MEMBER( ygv608_device::scroll_data_w ) { - m_scroll_data_table[m_ba_plane_select][m_scroll_address] = data; + m_scroll_data_table[m_ba_plane_scroll_select][m_scroll_address] = data; if (m_scaw == true) { m_scroll_address++; /* handle wrap to next plane */ if (m_scroll_address == 0) - m_ba_plane_select ^= 1; + m_ba_plane_scroll_select ^= 1; } } @@ -1505,21 +1483,27 @@ WRITE8_MEMBER( ygv608_device::status_port_w ) // P#7W - system control port WRITE8_MEMBER( ygv608_device::system_control_w ) { - m_ports.b[7] = data; - if (m_ports.b[7] & 0x3e) + m_dma_status = data; + if (m_dma_status & 0x3e) HandleRomTransfers(data & 0x3e); - if (m_ports.b[7] & 0x01) - HandleYGV608Reset(); + if (m_dma_status & 0x01) + HandleReset(); } // TODO: actual timing of this -void ygv608_device::HandleYGV608Reset() +void ygv608_device::HandleReset() { int i; /* Clear ports #0-7 */ - memset( &m_ports.b[0], 0, 8 ); - + //memset( &m_ports.b[0], 0, 8 ); + // most likely variables to be reset here from ports, there might be more + pattern_name_base_w = 0; + pattern_name_base_r = 0; + m_register_address = 0; + m_register_autoinc_r = false; + m_register_autoinc_w = false; + /* Clear registers #0-38, #47-49 */ for(i=0;i<39;i++) m_iospace->write_byte(i, 0x00); @@ -1620,6 +1604,7 @@ WRITE8_MEMBER( ygv608_device::pattern_name_table_y_w ) m_ytile_ptr &= m_page_y -1; m_ytile_autoinc = BIT(data,7); m_plane_select_access = BIT(data,6); + // TODO: done by Dig Dug Original if(m_ytile_autoinc == true && m_xtile_autoinc == true) logerror("%s: Warning both X/Y Tiles autoinc enabled!\n",this->tag()); } @@ -1639,6 +1624,7 @@ WRITE8_MEMBER( ygv608_device::pattern_name_table_x_w ) // xTile, m_page_x ); m_xtile_ptr &= m_page_x -1; m_xtile_autoinc = BIT(data,7); + // TODO: done by Dig Dug Original if(m_ytile_autoinc == true && m_xtile_autoinc == true) logerror("%s: Warning both X/Y Tiles autoinc enabled!\n",this->tag()); } @@ -1656,7 +1642,7 @@ WRITE8_MEMBER( ygv608_device::pattern_name_table_x_w ) READ8_MEMBER( ygv608_device::ram_access_ctrl_r ) { return (m_cpaw<<7) | (m_cpar<<6) | - (m_ba_plane_select<<4) | + (m_ba_plane_scroll_select<<4) | (m_scaw<<3) | (m_scar<<2) | (m_saaw<<1) | (m_saar<<0); } @@ -1667,7 +1653,7 @@ WRITE8_MEMBER( ygv608_device::ram_access_ctrl_w ) m_saaw = BIT(data,1); m_scar = BIT(data,2); m_scaw = BIT(data,3); - m_ba_plane_select = BIT(data,4); + m_ba_plane_scroll_select = BIT(data,4); m_cpar = BIT(data,6); m_cpaw = BIT(data,7); } diff --git a/src/mame/video/ygv608.h b/src/mame/video/ygv608.h index 5ad738acad7..25043a604e9 100644 --- a/src/mame/video/ygv608.h +++ b/src/mame/video/ygv608.h @@ -109,17 +109,6 @@ private: const address_space_config m_io_space_config; static constexpr unsigned SPRITE_ATTR_TABLE_SIZE = 256; - struct YGV_PORTS { - uint8_t na; // P#0 - pattern name table data port (read/write) - uint8_t p1; // P#1 - sprite data port (read/write) - uint8_t p2; // P#2 - scroll data port (read/write) - uint8_t p3; // P#3 - colour palette data port (read/write) - uint8_t p4; // P#4 - register data port (read/write) - uint8_t p5; // P#5 - register select port (write only) - uint8_t p6; // P#6 - status port (read/write) - uint8_t p7; // P#7 - system control port (read/write) - }; - static constexpr unsigned MAX_SPRITES = SPRITE_ATTR_TABLE_SIZE >> 2; struct SPRITE_ATTR { @@ -149,13 +138,9 @@ private: tilemap_t *m_tilemap_B; bitmap_ind16 m_work_bitmap; - void HandleYGV608Reset(); + void HandleReset(); void HandleRomTransfers(uint8_t type); - union { - uint8_t b[8]; - YGV_PORTS s; - } m_ports; /* * Built in ram @@ -181,6 +166,7 @@ private: uint8_t m_na8_mask; // mask on/off na11/9:8 int m_col_shift; // shift in scroll table column index + // base address shortcuts uint32_t m_base_addr[2][8]; uint32_t m_base_y_shift; // for extracting pattern y coord 'base' @@ -194,10 +180,12 @@ private: int pattern_name_base_r,pattern_name_base_w; /* pattern name table base address */ // === new variable handling starts here === + uint8_t m_screen_status; /**< port #6: status port r/w */ + uint8_t m_dma_status; /**< port #7: system control port r/w */ + uint8_t m_register_address; /**< RN: Register address select */ bool m_register_autoinc_r; /**< RRAI: Register address auto-increment on read */ bool m_register_autoinc_w; /**< RWAI: Register address auto-increment on write */ - uint8_t m_screen_status; /**< CD: status port r/w */ bool m_raster_irq_mask; /**< IEP: raster irq mask (INT1 occurs if 1) */ bool m_vblank_irq_mask; /**< IEV: vblank irq mask (INT0 occurs if 1) */ @@ -228,7 +216,7 @@ private: bool m_scaw; /**< SCAW: Address autoinc after writing scroll data table */ bool m_cpar; /**< CPAR: Address autoinc after reading color palette */ bool m_cpaw; /**< CPAW: Address autoinc after writing color palette */ - bool m_ba_plane_select; /**< B/(A) P#2 gains access to scroll data table in A/B plane */ + bool m_ba_plane_scroll_select; /**< B/(A) P#2 gains access to scroll data table in A/B plane */ bool m_dspe; /**< DSPE: display permission of pattern plane(s) (screen blanked if 0) */ uint8_t m_md; /**< MDx: mode for pattern planes */ From 80956d201124a738d84cfc3e484a8567b9ae9ccf Mon Sep 17 00:00:00 2001 From: angelosa Date: Thu, 28 Sep 2017 03:45:18 +0200 Subject: [PATCH 10/12] ygv608.cpp: fix CRTC vblank period, fixes NCV2: Dig Dug Original regression [Angelo Salese] --- src/mame/drivers/namcond1.cpp | 2 ++ src/mame/video/ygv608.cpp | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mame/drivers/namcond1.cpp b/src/mame/drivers/namcond1.cpp index 73e596877f5..b5b92a2a9f9 100644 --- a/src/mame/drivers/namcond1.cpp +++ b/src/mame/drivers/namcond1.cpp @@ -209,6 +209,8 @@ static ADDRESS_MAP_START( abcheck_map, AS_PROGRAM, 16, namcond1_state ) AM_RANGE(0x400000, 0x40ffff) AM_RAM AM_SHARE("shared_ram") AM_RANGE(0x600000, 0x607fff) AM_RAM AM_SHARE("zpr1") AM_RANGE(0x608000, 0x60ffff) AM_RAM AM_SHARE("zpr2") + AM_RANGE(0x700000, 0x700001) AM_WRITENOP + AM_RANGE(0x740000, 0x740001) AM_WRITENOP AM_RANGE(0x780000, 0x780001) AM_READ(printer_r) AM_RANGE(0x800000, 0x80000f) AM_DEVICE8("ygv608", ygv608_device, port_map, 0xff00) AM_RANGE(0xa00000, 0xa00fff) AM_DEVREADWRITE8("at28c16", at28c16_device, read, write, 0xff00) diff --git a/src/mame/video/ygv608.cpp b/src/mame/video/ygv608.cpp index 172fb3b82a0..ba65cce66cf 100644 --- a/src/mame/video/ygv608.cpp +++ b/src/mame/video/ygv608.cpp @@ -2089,7 +2089,7 @@ WRITE8_MEMBER( ygv608_device::crtc_w ) int new_display_width = (data & 0x3f) * 16; m_crtc.htotal &= ~0x600; - m_crtc.htotal |= (data & 0xc0) << 3; + m_crtc.htotal |= ((data & 0xc0) << 3); if(new_display_width != m_crtc.display_width) m_screen_resize = 1; @@ -2108,7 +2108,7 @@ WRITE8_MEMBER( ygv608_device::crtc_w ) case 42: { m_crtc.htotal &= ~0x1fe; - m_crtc.htotal |= (data & 0xff) << 1; + m_crtc.htotal |= ((data & 0xff) << 1); //printf("H %d %d %d %d %d\n",m_crtc.htotal,m_crtc.display_hstart,m_crtc.display_width,m_crtc.display_hsync,m_crtc.border_width); break; @@ -2148,7 +2148,7 @@ WRITE8_MEMBER( ygv608_device::crtc_w ) { m_crtc.vtotal &= ~0xff; m_crtc.vtotal |= data & 0xff; - + // TODO: call it for all mods in the CRTC, add sanity checks screen_configure(); @@ -2170,7 +2170,9 @@ void ygv608_device::screen_configure() //rectangle visarea(m_crtc.display_hstart, display_hend, m_crtc.display_vstart, display_vend); rectangle visarea(0, display_hend, 0, display_vend); - attoseconds_t period = HZ_TO_ATTOSECONDS(m_screen->clock()) * m_crtc.vtotal * (m_crtc.htotal / 2); + // TODO: Dig Dug Original wants this to be 60.60 Hz (like original Namco HW), lets compensate somehow + // (clock is really 6144000 x 8 = 49152000, so it must have same parameters in practice) + attoseconds_t period = HZ_TO_ATTOSECONDS(m_screen->clock()) * (m_crtc.vtotal + m_crtc.display_vsync) * ((m_crtc.htotal + 12 - m_crtc.display_hsync) / 2); m_screen->configure(m_crtc.htotal / 2, m_crtc.vtotal, visarea, period ); From d41cb5fb0473d9d6b15ad6916ae35553a5676968 Mon Sep 17 00:00:00 2001 From: Justin Kerk Date: Wed, 27 Sep 2017 18:51:09 -0700 Subject: [PATCH 11/12] New working software list additions ----------------------------------- ibm5150: Operation Wolf (3.5"), Out Run [breiztiger] --- hash/ibm5150.xml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/hash/ibm5150.xml b/hash/ibm5150.xml index a273f8ef0cf..5234303766b 100644 --- a/hash/ibm5150.xml +++ b/hash/ibm5150.xml @@ -6927,7 +6927,7 @@ has been replaced with an all-zero block. --> - Operation Wolf + Operation Wolf (5.25") 1989 Taito Corporation @@ -6943,6 +6943,29 @@ has been replaced with an all-zero block. --> + + Operation Wolf (3.5") + 1989 + Taito Corporation + + + + + + + + + + Out Run + 1989 + Sega Computer Software + + + + + + + Over the Net 1991 From a1042c621146faa721e6c285e6177caa77a4e786 Mon Sep 17 00:00:00 2001 From: angelosa Date: Thu, 28 Sep 2017 04:07:39 +0200 Subject: [PATCH 12/12] ygv608.cpp: note about missing registers (nw) --- src/mame/video/ygv608.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mame/video/ygv608.cpp b/src/mame/video/ygv608.cpp index ba65cce66cf..d8fe6a80395 100644 --- a/src/mame/video/ygv608.cpp +++ b/src/mame/video/ygv608.cpp @@ -286,6 +286,8 @@ static ADDRESS_MAP_START( regs_map, AS_IO, 8, ygv608_device ) // CRTC AM_RANGE(39, 46) AM_WRITE(crtc_w) +// 47-48 ROM transfer control - DMA source address +// 49 ROM transfer control - DMA size ADDRESS_MAP_END /***************************************