diff --git a/src/mame/drivers/cntsteer.c b/src/mame/drivers/cntsteer.c index e4b30c4aed0..424f13e0392 100644 --- a/src/mame/drivers/cntsteer.c +++ b/src/mame/drivers/cntsteer.c @@ -1,43 +1,38 @@ -/******************************************************************************* +/************************************************************************************** Counter Steer (c) 1985 Data East Corporation Zero Target (c) 1985 Data East Corporation Gekitsui Oh (c) 1985 Data East Corporation Emulation by Bryan McPhail, mish@tendril.co.uk - Improvements by Pierpaolo Prazzoli, David Haywood + Improvements by Pierpaolo Prazzoli, David Haywood, Angelo Salese Various things aren't fully understood, for example the rotating BG layer todo: finish sprite fixes - roz fixes - colour fixes? - input fixes? - sound - make cntsteer work + correct roz rotation + colour fixes. Foreground layer & sprites + Dip-Switches + make cntsteer work, comms looks awkward and probably different than Zero Target cleanup split into driver/video - add any missing sha info etc. - remove unneeded debug code - -*******************************************************************************/ +***************************************************************************************/ #include "driver.h" #include "cpu/m6502/m6502.h" -#include "deprecat.h" #include "cpu/m6809/m6809.h" #include "sound/ay8910.h" -#include "sound/2203intf.h" static tilemap *bg_tilemap, *fg_tilemap; - static UINT8 *videoram2; static int flipscreen=0; -static int bg_bank = 0; +static int bg_bank = 0,bg_color_bank; +static int scrolly = 0, scrollx = 0, scrollx_hi = 0, scrolly_hi = 0, rotation_x = 0, rotation_sign = 0; +static int disable_roz; static PALETTE_INIT( zerotrgt ) { @@ -47,38 +42,41 @@ static PALETTE_INIT( zerotrgt ) int bit0,bit1,bit2,r,g,b; /* red component */ - bit0 = (color_prom[i] >> 0) & 0x01; + bit0 = (color_prom[i] >> 2) & 0x01; bit1 = (color_prom[i] >> 1) & 0x01; - bit2 = (color_prom[i] >> 2) & 0x01; + bit2 = (color_prom[i] >> 0) & 0x01; r = /*255 - */(0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2); /* green component */ - bit0 = (color_prom[i] >> 4) & 0x01; + bit0 = (color_prom[i] >> 6) & 0x01; bit1 = (color_prom[i] >> 5) & 0x01; - bit2 = (color_prom[i] >> 6) & 0x01; + bit2 = (color_prom[i] >> 4) & 0x01; g =/* 255 - */(0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2); /* blue component */ - bit0 = (color_prom[i+256] >> 0) & 0x01; + bit0 = (color_prom[i+256] >> 2) & 0x01; bit1 = (color_prom[i+256] >> 1) & 0x01; - bit2 = (color_prom[i+256] >> 2) & 0x01; + bit2 = (color_prom[i+256] >> 0) & 0x01; b = /*255 - */(0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2); palette_set_color(machine,i,MAKE_RGB(r,g,b)); } } -static int colo=0; + static TILE_GET_INFO( get_bg_tile_info ) { int code = videoram2[tile_index]; - SET_TILE_INFO(2, code + bg_bank, 0/*colo*/, 0); + SET_TILE_INFO(2, code + bg_bank, bg_color_bank, 0); } static TILE_GET_INFO( get_fg_tile_info ) { int code = videoram[tile_index]; - int attr = videoram[tile_index + 0x400]; + int attr = colorram[tile_index]; - SET_TILE_INFO(0, code + ((attr & 0x0f) << 8), ((attr & 0x70) >> 4)+colo, 0); + code|= (attr & 0x01)<<8; + + /*TODO: bit 3 (8) used on the plane junctions but unknown purpose (color mask? Inverted bitplanes?) */ + SET_TILE_INFO(0, code, 0x20+((attr & 0x70)>>4), 0); } static VIDEO_START( zerotrgt ) @@ -95,16 +93,14 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta { int offs; - /* Sprites */ for (offs = 0;offs < 0x200;offs += 4) { int multi,fx,fy,sx,sy,sy2,code,code2,color; code = spriteram[offs+3] + ( ( spriteram[offs+1] & 0xc0 ) << 2 ); -//todo.. code2 = code+1; - sx = (241 - spriteram[offs+2]); + sx = (241 - spriteram[offs+2]); //this is wrong. //if (sx < -7) sx += 256; sy = 241 - spriteram[offs]; @@ -118,8 +114,6 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta multi = spriteram[offs+1] & 0x10; - - if (flipscreen) { sy=240-sy; sx=240-sx; @@ -151,126 +145,68 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta } } -static int scrolly = 0, scrollx = 0, scrolly_hi = 0, rotation_x = 0, rotation_y = 0, rotation_sign = 0; - static VIDEO_UPDATE( zerotrgt ) { -static int rot2=0,zoom=0; -static int scroll=0; - - if (input_code_pressed_once(KEYCODE_Q)) + if(disable_roz) + bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine)); //black or pen 0? + else { - colo++; - mame_printf_debug("colo = %X\n",colo); - tilemap_mark_all_tiles_dirty(bg_tilemap); - tilemap_mark_all_tiles_dirty(fg_tilemap); + tilemap_draw_roz(bitmap, cliprect, bg_tilemap, + (scrollx | scrollx_hi ) << 16, (scrolly | scrolly_hi) << 16, + 1<<16, (rotation_sign) ? -rotation_x<<8 : rotation_x<<8, + 0<<16, 1<<16, + 1, + 0, 0); } - if (input_code_pressed_once(KEYCODE_W)) - { - colo--; - mame_printf_debug("colo = %X\n",colo); - tilemap_mark_all_tiles_dirty(bg_tilemap); - tilemap_mark_all_tiles_dirty(fg_tilemap); - } - - - if (input_code_pressed_once(KEYCODE_E)) - { - rot2++; - mame_printf_debug("rot2 = %X\n",rot2); - } - - if (input_code_pressed_once(KEYCODE_R)) - { - rot2--; - mame_printf_debug("rot2 = %X\n",rot2); - } - - if (input_code_pressed_once(KEYCODE_T)) - { - zoom+=0x100; - mame_printf_debug("zoom= %X\n",zoom); - } - - if (input_code_pressed_once(KEYCODE_Y)) - { - zoom-=0x100; - mame_printf_debug("zoom= %X\n",zoom); - } - - if (input_code_pressed_once(KEYCODE_A)) - { - scroll+=0x10; - mame_printf_debug("scroll = %d\n",scroll); - } - - if (input_code_pressed_once(KEYCODE_S)) - { - scroll-=0x10; - mame_printf_debug("scroll = %d\n",scroll); - } - - - if (input_code_pressed_once(KEYCODE_I)) - { - scrollx+=0x10; - mame_printf_debug("scrollx = %d\n",scrollx); - } - - if (input_code_pressed_once(KEYCODE_O)) - { - scrollx-=0x10; - mame_printf_debug("scrollx = %d\n",scrollx); - } - -// if (input_code_pressed(KEYCODE_A)) cpu_cause_interrupt(0,M6809_INT_IRQ); - - -// spriteram=batwings_ram+0x100; -// tilemap_set_scrolly( bg_tilemap, 0, scrolly | scrolly_hi); -// tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); - - scrollx = 256; - - if(rotation_sign) - rotation_x = -rotation_x; - - tilemap_draw_roz(bitmap, cliprect, bg_tilemap, - scrollx << 16, (scrolly | scrolly_hi) << 16, - 1<<16, rotation_x << 10, - rotation_y << 8, 1<<16, - 1, - 0, 0); - tilemap_draw(bitmap,cliprect,fg_tilemap,0,0); draw_sprites(screen->machine,bitmap,cliprect,0); draw_sprites(screen->machine,bitmap,cliprect,1); -#if 0 -{ - - int i,j; - char buf[60]; - struct osd_bitmap *mybitmap = bitmap; - UINT8 *RAM = memory_region(machine, "maincpu"); - -buf[0] = 0; -for (i = 0;i < 8;i+=2) - sprintf(&buf[strlen(buf)],"%04X\n",RAM[0x3000+i+1]+(RAM[0x3000+i]<<8)); -ui_draw_text(buf,50,8*6); -} -#endif - return 0; } -static WRITE8_HANDLER( cntsteer_foreground_w ) +/* +[0] = scroll y +[1] = scroll x +[2] = -x-- ---- disable roz layer (Used when you lose a life / start a new play) + --xx ---- bg bank + ---- -xxx bg color bank +[3] = xx-- ---- high word scrolling x bits + --xx ---- high word scrolling y bits + ---- -x-- flip screen bit (inverted) + ---- ---x rotation sign (landscape should be turning right (0) == / , turning left (1) == \) +[4] = xxxx xxxx rotation factor? +*/ +static WRITE8_HANDLER(cntsteer_vregs_w) +{ +// static UINT8 test[5]; + +// test[offset] = data; +// popmessage("%02x %02x %02x %02x %02x",test[0],test[1],test[2],test[3],test[4]); + + switch(offset) + { + case 0: scrolly = data; break; + case 1: scrollx = data; break; + case 2: bg_bank = (data & 0x30) << 4; bg_color_bank = (data & 7); disable_roz = (data & 0x40); tilemap_mark_all_tiles_dirty(bg_tilemap); break; + case 3: rotation_sign = (data & 1); flip_screen_set(space->machine, !(data & 4)); scrolly_hi = (data & 0x30) << 4; scrollx_hi = (data & 0xc0) << 2; break; + case 4: rotation_x = data; break; + } +} + +static WRITE8_HANDLER( cntsteer_foreground_vram_w ) { videoram[offset] = data; - tilemap_mark_tile_dirty(fg_tilemap, offset & 0x3ff); + tilemap_mark_tile_dirty(fg_tilemap, offset); +} + +static WRITE8_HANDLER( cntsteer_foreground_attr_w ) +{ + colorram[offset] = data; + tilemap_mark_tile_dirty(fg_tilemap, offset); } static WRITE8_HANDLER( cntsteer_background_w ) @@ -279,38 +215,26 @@ static WRITE8_HANDLER( cntsteer_background_w ) tilemap_mark_tile_dirty(bg_tilemap, offset); } -#if 0 -static WRITE8_HANDLER( gekitsui_int_w ) -{ -// if (errorlog) fprintf(errorlog,"%04x: CPU 2 causes NMI\n",cpu_get_pc()); - cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_NMI, ASSERT_LINE); -} -static WRITE8_HANDLER( gekitsui_int2_w ) // not used.. -{ -// if (errorlog) fprintf(errorlog,"%04x: CPU 1 causes IRQ\n",cpu_get_pc()); - cpu_set_input_line(space->machine->cpu[1], M6809_IRQ_LINE, ASSERT_LINE); -} -#endif +/************************************* + * + * CPU comms + * + *************************************/ static WRITE8_HANDLER( gekitsui_sub_irq_ack ) { cpu_set_input_line(space->machine->cpu[1], M6809_IRQ_LINE, CLEAR_LINE); } -#if 0 -static WRITE8_HANDLER( cntsteer_int_w ) -{ - cpu_set_input_line(space->machine->cpu[0], M6809_IRQ_LINE, ASSERT_LINE); -} -#endif - static WRITE8_HANDLER( cntsteer_sound_w ) { soundlatch_w(space,0,data); + cpu_set_input_line(space->machine->cpu[2], 0, HOLD_LINE); } static WRITE8_HANDLER( zerotrgt_ctrl_w ) { + /*TODO: check this.*/ logerror("CTRL: %04x: %04x: %04x\n",cpu_get_pc(space->cpu),offset,data); // if (offset==0) cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE); @@ -319,156 +243,35 @@ static WRITE8_HANDLER( zerotrgt_ctrl_w ) // if (offset==2) cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, CLEAR_LINE); } -#if 0 -static WRITE8_HANDLER( cntsteer_halt_cpu0_w ) -{ -// if (errorlog) fprintf(errorlog,"%04x: CPU halt %02x\n",cpu_get_pc(),data); -// cpu_halt(0,0); /* Halt cpu */ -} - -static WRITE8_HANDLER( cntsteer_restart_cpu0_w ) -{ -// if (errorlog) fprintf(errorlog,"%04x: CPU restart %02x\n",cpu_get_pc(),data); -//if (data&0x4) cpu_halt(0,1); /* Restart cpu */ -} -#endif - - /***************************************************************************/ -#if 0 -static ADDRESS_MAP_START( cntsteer_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE(1) - AM_RANGE(0x1000, 0x11ff) AM_RAM AM_BASE(&spriteram) - AM_RANGE(0x1200, 0x1fff) AM_RAM - AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(cntsteer_foreground_w) AM_BASE(&videoram) - AM_RANGE(0x2800, 0x2fff) AM_RAM - -// AM_RANGE(0x1b00, 0x1b00) AM_READ_PORT("DSW0") -// AM_RANGE(0x1b01, 0x1b01) AM_READ_PORT("DSW0") -// AM_RANGE(0x3000, 0x3003) AM_WRITE(zerotrgt_ctrl_w) -// AM_RANGE(0x3000, 0x3000) AM_WRITE(cntsteer_halt_cpu0_w) -// AM_RANGE(0x3001, 0x3001) AM_WRITE(gekitsui_int2_w) - -// AM_RANGE(0x3003, 0x3003) AM_READ_PORT("DSW1") - AM_RANGE(0x8000, 0xffff) AM_ROM -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( cntsteer_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE(1) - AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(cntsteer_background_w) AM_BASE(&videoram2) - AM_RANGE(0x3000, 0x3000) AM_READ_PORT("DSW0") - AM_RANGE(0x3001, 0x3001) AM_READ_PORT("DSW1") - AM_RANGE(0x3002, 0x3002) AM_READ_PORT("P1") - AM_RANGE(0x3003, 0x3003) AM_READ_PORT("P2") -// AM_RANGE(0x3002, 0x3002) AM_WRITE(gekitsui_int_w) -// AM_RANGE(0x3000, 0x3003) AM_WRITE(zerotrgt_ctrl_w) -// wrong 0 1 2 3 are scroll/rotate -// AM_RANGE(0x3002, 0x3002) AM_WRITE(cntsteer_restart_cpu0_w) -// AM_RANGE(0x3000, 0x3003) AM_WRITENOP -// 3007 and 3003 have values.. - AM_RANGE(0x3007, 0x3007) AM_WRITE(cntsteer_sound_w) -// AM_RANGE(0x300a, 0x300a) AM_WRITE(cntsteer_int_w) -// AM_RANGE(0x3004, 0x3004) AM_WRITE(cntsteer_int_w) - AM_RANGE(0x4000, 0xffff) AM_ROM -ADDRESS_MAP_END -#endif - static ADDRESS_MAP_START( gekitsui_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE(1) AM_RANGE(0x1000, 0x11ff) AM_RAM AM_BASE(&spriteram) AM_RANGE(0x1200, 0x1fff) AM_RAM - AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(cntsteer_foreground_w) AM_BASE(&videoram) + AM_RANGE(0x2000, 0x23ff) AM_RAM_WRITE(cntsteer_foreground_vram_w) AM_BASE(&videoram) + AM_RANGE(0x2400, 0x27ff) AM_RAM_WRITE(cntsteer_foreground_attr_w) AM_BASE(&colorram) AM_RANGE(0x3000, 0x3003) AM_WRITE(zerotrgt_ctrl_w) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END -static int newdata[5]; - -static WRITE8_HANDLER(scrivi) -{ - if(offset == 0) - { - scrolly = data; - return; - - } - - if(offset == 1) - { - //rotation related? zoom? -// increment or decrement.. incyx? - rotation_y = data; - } - - if(offset == 4) - { - rotation_x = data; - - if(data != newdata[offset]) - {newdata[offset] = data; - if(data >0x55) - mame_printf_debug("off = %X data = %X\n",offset,data); - } - return; - - } - - if(offset == 2) - { - bg_bank = (data & 0x30) << 4; - // scrollx = data & 0x0f; - // mame_printf_debug("scrollx = %d %X\n",scrollx<<8,scrollx); - if(data != newdata[offset]) - {newdata[offset] = data; - if(data & ~0x30) - mame_printf_debug("off = %X data = %X\n",offset,data&~0x30); - } - tilemap_mark_all_tiles_dirty(bg_tilemap); - return; - } - - if(offset == 3) - { - rotation_sign = !(data & 1); - - flip_screen_set(space->machine, !(data & 4)); - - scrolly_hi = (data & 0xf0) << 4; - - if(data != newdata[offset]) - {newdata[offset] = data; - if(data & ~0xf5) - mame_printf_debug("off = %X data = %X\n",offset,data&~0xf5); - } - return; - - } - - if(data != newdata[offset] && offset !=1) { - newdata[offset] = data; - mame_printf_debug("off = %X data = %X\n",offset,data); - } -} - static ADDRESS_MAP_START( gekitsui_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE(1) AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(cntsteer_background_w) AM_BASE(&videoram2) AM_RANGE(0x3000, 0x3000) AM_READ_PORT("DSW0") - AM_RANGE(0x3001, 0x3001) AM_READ_PORT("DSW1") + AM_RANGE(0x3001, 0x3001) AM_READ_PORT("P2") AM_RANGE(0x3002, 0x3002) AM_READ_PORT("P1") - AM_RANGE(0x3003, 0x3003) AM_READ_PORT("P2") - AM_RANGE(0x3000, 0x3004) AM_WRITE(scrivi) /* Scroll, gfx? */ + AM_RANGE(0x3003, 0x3003) AM_READ_PORT("COINS") + AM_RANGE(0x3000, 0x3004) AM_WRITE(cntsteer_vregs_w) AM_RANGE(0x3005, 0x3005) AM_WRITE(gekitsui_sub_irq_ack) AM_RANGE(0x3007, 0x3007) AM_WRITE(cntsteer_sound_w) AM_RANGE(0x4000, 0xffff) AM_ROM ADDRESS_MAP_END - /***************************************************************************/ static int nmimask; + static WRITE8_HANDLER( nmimask_w ) { nmimask = data & 0x80; } static INTERRUPT_GEN ( sound_interrupt ) { if (!nmimask) cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); } @@ -487,6 +290,7 @@ ADDRESS_MAP_END /***************************************************************************/ + static INPUT_PORTS_START( cntsteer ) PORT_START("DSW0") PORT_DIPNAME( 0x01, 0x01, "0" ) @@ -514,31 +318,14 @@ static INPUT_PORTS_START( cntsteer ) PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_START("DSW1") - PORT_DIPNAME( 0x01, 0x01, "1" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_START("P2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL + PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK ) PORT_START("P1") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY @@ -546,109 +333,24 @@ static INPUT_PORTS_START( cntsteer ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) - PORT_START("P2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON5 ) -// PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK ) -// PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) - PORT_DIPNAME( 0x80, 0x80, "vblank" ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_START("COINS") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) + PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END - -#ifdef UNUSED_DEFINITION -static INPUT_PORTS_START( zerotrgt ) - PORT_START("DSW0") - PORT_DIPNAME( 0x01, 0x01, "0" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("DSW1") - PORT_DIPNAME( 0x01, 0x01, "1" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("P1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) - - PORT_START("P2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON5 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) -INPUT_PORTS_END -#endif - /***************************************************************************/ /* this layout is bad and reads way beyond the end of the array */ static const gfx_layout cntsteer_charlayout = { 8,8, /* 8*8 characters */ - RGN_FRAC(1,2), + 0x200, 2, /* 2 bits per pixel */ { 0, 4 }, /* the two bitplanes for 4 pixels are packed into one byte */ { 0, 1, 2, 3, 0x800*8+0, 0x800*8+1, 0x800*8+2, 0x800*8+3 }, @@ -660,7 +362,7 @@ static const gfx_layout cntsteer_charlayout = static const gfx_layout zerotrgt_charlayout = { 8,8, - RGN_FRAC(1,2), + 0x200, 2, { 4,0 }, { 0, 1, 2, 3, 1024*8*8+0, 1024*8*8+1, 1024*8*8+2, 1024*8*8+3 }, @@ -683,7 +385,7 @@ static const gfx_layout sprites = static const gfx_layout tilelayout = { 16,16, - 0x200, + 0x400, 3, /* 3 bits per pixel */ { RGN_FRAC(4,8)+4, 0, 4 }, { 3, 2, 1, 0, 11, 10, 9 , 8, 19, 18, 17,16, 27, 26, 25, 24 }, @@ -716,7 +418,6 @@ static MACHINE_RESET( zerotrgt ) nmimask = 0; } - static MACHINE_DRIVER_START( cntsteer ) MDRV_CPU_ADD("maincpu", M6809, 2000000) /* ? */ MDRV_CPU_PROGRAM_MAP(gekitsui_cpu1_map,0) @@ -726,9 +427,9 @@ static MACHINE_DRIVER_START( cntsteer ) MDRV_CPU_PROGRAM_MAP(gekitsui_cpu2_map,0) // MDRV_CPU_VBLANK_INT("screen", nmi_line_pulse) /* ? */ -// MDRV_CPU_ADD("audiocpu", M6502, 1500000) /* ? */ -// MDRV_CPU_PROGRAM_MAP(sound_map,0) -// MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,16) /* ? */ // should be interrupt, 16? + MDRV_CPU_ADD("audiocpu", M6502, 1500000) /* ? */ + MDRV_CPU_PROGRAM_MAP(sound_map,0) + MDRV_CPU_PERIODIC_INT(sound_interrupt, 1000) /* video hardware */ MDRV_SCREEN_ADD("screen", RASTER) @@ -736,9 +437,10 @@ static MACHINE_DRIVER_START( cntsteer ) MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MDRV_SCREEN_SIZE(256, 256) - MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) + MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) + + MDRV_QUANTUM_TIME(HZ(6000)) - // interleave 200? MDRV_GFXDECODE(cntsteer) MDRV_PALETTE_LENGTH(256) // MDRV_PALETTE_INIT(zerotrgt) @@ -748,7 +450,11 @@ static MACHINE_DRIVER_START( cntsteer ) /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") -// MDRV_SOUND_ADD("ym", YM2203, ym2203_config) + MDRV_SOUND_ADD("ay1", AY8910, 1500000) + MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MDRV_SOUND_ADD("ay2", AY8910, 1500000) + MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_DRIVER_END static MACHINE_DRIVER_START( zerotrgt ) @@ -762,20 +468,20 @@ static MACHINE_DRIVER_START( zerotrgt ) MDRV_CPU_ADD("audiocpu", M6502, 1500000) /* ? */ MDRV_CPU_PROGRAM_MAP(sound_map,0) - MDRV_CPU_VBLANK_INT_HACK(irq0_line_pulse,16) /* ? */ // should be interrupt, 16? MDRV_CPU_PERIODIC_INT(sound_interrupt, 1000) + MDRV_QUANTUM_TIME(HZ(6000)) + /* video hardware */ MDRV_SCREEN_ADD("screen", RASTER) MDRV_SCREEN_REFRESH_RATE(60) MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MDRV_SCREEN_SIZE(256, 256) - MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) + MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) MDRV_MACHINE_RESET(zerotrgt) - // interleave 200? MDRV_GFXDECODE(zerotrgt) MDRV_PALETTE_LENGTH(256) @@ -805,8 +511,8 @@ ROM_START( cntsteer ) ROM_LOAD( "by11", 0x8000, 0x4000, CRC(00624e34) SHA1(27bd472e9f2feef4a2c4753d8b0da26ff30d930d) ) ROM_LOAD( "by10", 0xc000, 0x4000, CRC(9227a9ce) SHA1(8c86f22f90a3a8853562469037ffa06693045f4c) ) - ROM_REGION( 0x10000, "cpu2", 0 ) - ROM_LOAD( "by00", 0xc000, 0x2000, CRC(740e4896) SHA1(959652515188966e1c2810eabf2f428fe31a31a9) ) + ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_LOAD( "by00", 0xe000, 0x2000, CRC(740e4896) SHA1(959652515188966e1c2810eabf2f428fe31a31a9) ) ROM_REGION( 0x4000, "gfx1", ROMREGION_DISPOSE ) /* Characters */ ROM_LOAD( "by09", 0x0000, 0x2000, CRC(273eddae) SHA1(4b5450407217d9110acb85e02ea9a6584552362e) ) @@ -833,6 +539,8 @@ ROM_START( cntsteer ) ROM_LOAD( "by20", 0x30000, 0x2000, CRC(e2198c9e) SHA1(afea262db9154301f4b9e53e1fc91985dd934170) ) ROM_REGION( 0x200, "proms", ROMREGION_ERASE00 ) + ROM_LOAD( "mb7118h.7k", 0x0000, 0x100, NO_DUMP ) + ROM_LOAD( "mb7052.6k", 0x0100, 0x100, NO_DUMP ) ROM_END ROM_START( zerotrgt ) @@ -960,16 +668,12 @@ static void init_cntsteer(void) static DRIVER_INIT( zerotrgt ) { - int i; - for (i=0; i