Added driver_data struct and save states to the following drivers: news.c, nightgal.c and nycaptor.c

Added driver_data struct to the following drivers: nitedrvr.c and nmg5.c
This commit is contained in:
Fabio Priuli 2010-02-24 09:41:35 +00:00
parent a4545e4e34
commit 7b230a3218
13 changed files with 1100 additions and 718 deletions

View File

@ -21,8 +21,8 @@ driver by David Haywood
static ADDRESS_MAP_START( news_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( news_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM /* 4000-7fff is written to during startup, probably leftover code */ AM_RANGE(0x0000, 0x7fff) AM_ROM /* 4000-7fff is written to during startup, probably leftover code */
AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(news_fgram_w) AM_BASE(&news_fgram) AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(news_fgram_w) AM_BASE_MEMBER(news_state, fgram)
AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE(news_bgram_w) AM_BASE(&news_bgram) AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE(news_bgram_w) AM_BASE_MEMBER(news_state, bgram)
AM_RANGE(0x9000, 0x91ff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_be_w) AM_BASE_GENERIC(paletteram) AM_RANGE(0x9000, 0x91ff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_be_w) AM_BASE_GENERIC(paletteram)
AM_RANGE(0xc000, 0xc000) AM_READ_PORT("DSW") AM_RANGE(0xc000, 0xc000) AM_READ_PORT("DSW")
AM_RANGE(0xc001, 0xc001) AM_READ_PORT("INPUTS") AM_RANGE(0xc001, 0xc001) AM_READ_PORT("INPUTS")
@ -113,12 +113,33 @@ GFXDECODE_END
static MACHINE_START( news )
{
news_state *state = (news_state *)machine->driver_data;
state_save_register_global(machine, state->bgpic);
}
static MACHINE_RESET( news )
{
news_state *state = (news_state *)machine->driver_data;
state->bgpic = 0;
}
static MACHINE_DRIVER_START( news ) static MACHINE_DRIVER_START( news )
/* driver data */
MDRV_DRIVER_DATA(news_state)
/* basic machine hardware */ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", Z80,8000000) /* ? MHz */ MDRV_CPU_ADD("maincpu", Z80,8000000) /* ? MHz */
MDRV_CPU_PROGRAM_MAP(news_map) MDRV_CPU_PROGRAM_MAP(news_map)
MDRV_CPU_VBLANK_INT("screen", irq0_line_hold) MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
MDRV_MACHINE_START(news)
MDRV_MACHINE_RESET(news)
/* video hardware */ /* video hardware */
MDRV_SCREEN_ADD("screen", RASTER) MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60) MDRV_SCREEN_REFRESH_RATE(60)
@ -167,5 +188,5 @@ ROM_START( newsa )
ROM_LOAD( "virus.1", 0x00000, 0x40000, CRC(41f5935a) SHA1(1566d243f165019660cd4dd69df9f049e0130f15) ) ROM_LOAD( "virus.1", 0x00000, 0x40000, CRC(41f5935a) SHA1(1566d243f165019660cd4dd69df9f049e0130f15) )
ROM_END ROM_END
GAME( 1993, news, 0, news, news, 0, ROT0, "Poby / Virus", "News (set 1)", 0 ) GAME( 1993, news, 0, news, news, 0, ROT0, "Poby / Virus", "News (set 1)", GAME_SUPPORTS_SAVE )
GAME( 1993, newsa, news, news, newsa, 0, ROT0, "Poby", "News (set 2)", 0 ) GAME( 1993, newsa, news, news, newsa, 0, ROT0, "Poby", "News (set 2)", GAME_SUPPORTS_SAVE )

View File

@ -24,10 +24,28 @@ TODO:
#define MASTER_CLOCK XTAL_19_968MHz #define MASTER_CLOCK XTAL_19_968MHz
static UINT8 blit_raw_data[3]; typedef struct _nightgal_state nightgal_state;
static UINT8 *blit_buffer; struct _nightgal_state
static UINT8 pen_data[0x10]; {
static UINT8 pen_raw_data[0x10]; /* memory pointers */
UINT8 * blit_buffer;
/* video-related */
UINT8 blit_raw_data[3];
UINT8 true_blit[7];
UINT8 pen_data[0x10];
UINT8 pen_raw_data[0x10];
/* misc */
UINT8 nsc_latch, z80_latch;
UINT8 mux_data;
/* devices */
running_device *maincpu;
running_device *subcpu;
};
static READ8_HANDLER( blitter_status_r ) static READ8_HANDLER( blitter_status_r )
{ {
@ -36,16 +54,20 @@ static READ8_HANDLER( blitter_status_r )
static VIDEO_START( nightgal ) static VIDEO_START( nightgal )
{ {
blit_buffer = auto_alloc_array(machine, UINT8, 256*256); nightgal_state *state = (nightgal_state *)machine->driver_data;
state->blit_buffer = auto_alloc_array(machine, UINT8, 256*256);
state_save_register_global_pointer(machine, state->blit_buffer, 256*256);
} }
static VIDEO_UPDATE( nightgal ) static VIDEO_UPDATE( nightgal )
{ {
nightgal_state *state = (nightgal_state *)screen->machine->driver_data;
int x, y; int x, y;
for (y = cliprect->min_y; y <= cliprect->max_y; ++y) for (y = cliprect->min_y; y <= cliprect->max_y; ++y)
{ {
UINT8 *src = &blit_buffer[y * 512/2 + cliprect->min_x]; UINT8 *src = &state->blit_buffer[y * 512 / 2 + cliprect->min_x];
UINT16 *dst = BITMAP_ADDR16(bitmap, y, cliprect->min_x); UINT16 *dst = BITMAP_ADDR16(bitmap, y, cliprect->min_x);
for (x = cliprect->min_x; x <= cliprect->max_x; x += 2) for (x = cliprect->min_x; x <= cliprect->max_x; x += 2)
@ -60,83 +82,82 @@ static VIDEO_UPDATE( nightgal )
return 0; return 0;
} }
static UINT8 nightgal_gfx_nibble(running_machine *machine,int niboffset) static UINT8 nightgal_gfx_nibble( running_machine *machine, int niboffset )
{ {
UINT8 *blit_rom = memory_region(machine,"gfx1"); UINT8 *blit_rom = memory_region(machine,"gfx1");
if (niboffset&1) if (niboffset & 1)
{ {
return (blit_rom[(niboffset>>1)&0x1ffff] & 0xf0)>>4; return (blit_rom[(niboffset >> 1) & 0x1ffff] & 0xf0) >> 4;
} }
else else
{ {
return (blit_rom[(niboffset>>1)&0x1ffff] & 0x0f); return (blit_rom[(niboffset >> 1) & 0x1ffff] & 0x0f);
} }
} }
static void plot_nightgal_gfx_pixel(UINT8 pix, int x, int y) static void plot_nightgal_gfx_pixel( running_machine *machine, UINT8 pix, int x, int y )
{ {
if (y>=512) return; nightgal_state *state = (nightgal_state *)machine->driver_data;
if (x>=512) return; if (y >= 512) return;
if (y<0) return; if (x >= 512) return;
if (x<0) return; if (y < 0) return;
if (x < 0) return;
if (x&1) if (x & 1)
{ state->blit_buffer[(y * 256) + (x >> 1)] = (state->blit_buffer[(y * 256) + (x >> 1)] & 0x0f) | ((pix << 4) & 0xf0);
blit_buffer[(y*256)+(x>>1)] = (blit_buffer[(y*256)+(x>>1)] & 0x0f) | ((pix<<4) & 0xf0);
}
else else
{ state->blit_buffer[(y * 256) + (x >> 1)] = (state->blit_buffer[(y * 256) + (x >> 1)] & 0xf0) | (pix & 0x0f);
blit_buffer[(y*256)+(x>>1)] = (blit_buffer[(y*256)+(x>>1)] & 0xf0) | (pix & 0x0f);
}
} }
static WRITE8_HANDLER( nsc_true_blitter_w ) static WRITE8_HANDLER( nsc_true_blitter_w )
{ {
static UINT8 true_blit[7]; nightgal_state *state = (nightgal_state *)space->machine->driver_data;
int src, x, y, h, w, flipx;
int src,x,y,h,w, flipx; state->true_blit[offset] = data;
true_blit[offset] = data;
/*trigger blitter write to ram,might not be correct...*/ /*trigger blitter write to ram,might not be correct...*/
if(offset == 5) if (offset == 5)
{ {
//printf("%02x %02x %02x %02x %02x %02x %02x\n",true_blit[0],true_blit[1],true_blit[2],true_blit[3],true_blit[4],true_blit[5],true_blit[6]); //printf("%02x %02x %02x %02x %02x %02x %02x\n", state->true_blit[0], state->true_blit[1], state->true_blit[2], state->true_blit[3], state->true_blit[4], state->true_blit[5], state->true_blit[6]);
w = (true_blit[4] & 0xff)+1; w = (state->true_blit[4] & 0xff) + 1;
h = (true_blit[5] & 0xff)+1; h = (state->true_blit[5] & 0xff) + 1;
src = ((true_blit[1]<<8)|(true_blit[0]<<0)); src = ((state->true_blit[1] << 8) | (state->true_blit[0] << 0));
src |= (true_blit[6]&3)<<16; src |= (state->true_blit[6] & 3) << 16;
x = (state->true_blit[2] & 0xff);
x = (true_blit[2] & 0xff); y = (state->true_blit[3] & 0xff);
y = (true_blit[3] & 0xff);
// lowest bit of src controls flipping / draw direction? // lowest bit of src controls flipping / draw direction?
flipx=(true_blit[0] & 1); flipx = (state->true_blit[0] & 1);
if (!flipx) src += (w*h)-1; if (!flipx)
else src -= (w*h)-1; src += (w * h) - 1;
else
src -= (w * h) - 1;
{ {
int count = 0; int count = 0;
int xcount,ycount; int xcount, ycount;
for(ycount=0;ycount<h;ycount++) for (ycount = 0; ycount < h; ycount++)
{ {
for(xcount=0;xcount<w;xcount++) for (xcount = 0; xcount < w; xcount++)
{ {
int drawx = (x+xcount) & 0xff; int drawx = (x + xcount) & 0xff;
int drawy = (y+ycount) & 0xff; int drawy = (y + ycount) & 0xff;
UINT8 dat = nightgal_gfx_nibble(space->machine,src+count); UINT8 dat = nightgal_gfx_nibble(space->machine, src + count);
UINT8 cur_pen_hi = pen_data[(dat & 0xf0)>>4]; UINT8 cur_pen_hi = state->pen_data[(dat & 0xf0) >> 4];
UINT8 cur_pen_lo = pen_data[(dat & 0x0f)>>0]; UINT8 cur_pen_lo = state->pen_data[(dat & 0x0f) >> 0];
dat = cur_pen_lo | cur_pen_hi<<4; dat = cur_pen_lo | (cur_pen_hi << 4);
if((dat & 0xff) != 0) if ((dat & 0xff) != 0)
plot_nightgal_gfx_pixel(dat, drawx,drawy); plot_nightgal_gfx_pixel(space->machine, dat, drawx, drawy);
if (!flipx) count--; if (!flipx)
else count++; count--;
else
count++;
} }
} }
} }
@ -146,54 +167,56 @@ static WRITE8_HANDLER( nsc_true_blitter_w )
/* different register writes (probably a PAL line swapping).*/ /* different register writes (probably a PAL line swapping).*/
static WRITE8_HANDLER( sexygal_nsc_true_blitter_w ) static WRITE8_HANDLER( sexygal_nsc_true_blitter_w )
{ {
static UINT8 true_blit[7]; nightgal_state *state = (nightgal_state *)space->machine->driver_data;
int src, x, y, h, w, flipx;
int src,x,y,h,w, flipx; state->true_blit[offset] = data;
true_blit[offset] = data;
/*trigger blitter write to ram,might not be correct...*/ /*trigger blitter write to ram,might not be correct...*/
if(offset == 6) if (offset == 6)
{ {
//printf("%02x %02x %02x %02x %02x %02x %02x\n",true_blit[0],true_blit[1],true_blit[2],true_blit[3],true_blit[4],true_blit[5],true_blit[6]); //printf("%02x %02x %02x %02x %02x %02x %02x\n", state->true_blit[0], state->true_blit[1], state->true_blit[2], state->true_blit[3], state->true_blit[4], state->true_blit[5], state->true_blit[6]);
w = (true_blit[5] & 0xff)+1; w = (state->true_blit[5] & 0xff) + 1;
h = (true_blit[6] & 0xff)+1; h = (state->true_blit[6] & 0xff) + 1;
src = ((true_blit[1]<<8)|(true_blit[0]<<0)); src = ((state->true_blit[1] << 8) | (state->true_blit[0] << 0));
src |= (true_blit[2]&3)<<16; src |= (state->true_blit[2] & 3) << 16;
x = (true_blit[3] & 0xff); x = (state->true_blit[3] & 0xff);
y = (true_blit[4] & 0xff); y = (state->true_blit[4] & 0xff);
// lowest bit of src controls flipping / draw direction? // lowest bit of src controls flipping / draw direction?
flipx=(true_blit[0] & 1); flipx = (state->true_blit[0] & 1);
if (!flipx) src += (w*h)-1; if (!flipx)
else src -= (w*h)-1; src += (w * h) - 1;
else
src -= (w * h) - 1;
{ {
int count = 0; int count = 0;
int xcount,ycount; int xcount, ycount;
for(ycount=0;ycount<h;ycount++) for (ycount = 0; ycount < h; ycount++)
{ {
for(xcount=0;xcount<w;xcount++) for (xcount = 0; xcount < w; xcount++)
{ {
int drawx = (x+xcount) & 0xff; int drawx = (x + xcount) & 0xff;
int drawy = (y+ycount) & 0xff; int drawy = (y + ycount) & 0xff;
UINT8 dat = nightgal_gfx_nibble(space->machine,src+count); UINT8 dat = nightgal_gfx_nibble(space->machine, src + count);
UINT8 cur_pen_hi = pen_data[(dat & 0xf0)>>4]; UINT8 cur_pen_hi = state->pen_data[(dat & 0xf0) >> 4];
UINT8 cur_pen_lo = pen_data[(dat & 0x0f)>>0]; UINT8 cur_pen_lo = state->pen_data[(dat & 0x0f) >> 0];
dat = cur_pen_lo | cur_pen_hi<<4; dat = cur_pen_lo | cur_pen_hi << 4;
if((dat & 0xff) != 0) if ((dat & 0xff) != 0)
plot_nightgal_gfx_pixel(dat, drawx,drawy); plot_nightgal_gfx_pixel(space->machine, dat, drawx, drawy);
if (!flipx) count--; if (!flipx)
else count++; count--;
else
count++;
} }
} }
//printf("%02x %02x %02x %02x %02x %02x %02x\n",true_blit[0],true_blit[1],true_blit[2],true_blit[3],true_blit[4],true_blit[5],true_blit[6]); //cpu_set_input_line(state->maincpu, INPUT_LINE_NMI, PULSE_LINE );
//cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE );
} }
} }
} }
@ -212,26 +235,26 @@ static PALETTE_INIT( nightgal )
2, resistances_b, weights_b, 0, 0, 2, resistances_b, weights_b, 0, 0,
0, 0, 0, 0, 0); 0, 0, 0, 0, 0);
for (i = 0;i < machine->config->total_colors; i++) for (i = 0; i < machine->config->total_colors; i++)
{ {
int bit0, bit1, bit2; int bit0, bit1, bit2;
int r, g, b; int r, g, b;
/* red component */ /* red component */
bit0 = (color_prom[i] >> 0) & 0x01; bit0 = BIT(color_prom[i], 0);
bit1 = (color_prom[i] >> 1) & 0x01; bit1 = BIT(color_prom[i], 1);
bit2 = (color_prom[i] >> 2) & 0x01; bit2 = BIT(color_prom[i], 2);
r = combine_3_weights(weights_rg, bit0, bit1, bit2); r = combine_3_weights(weights_rg, bit0, bit1, bit2);
/* green component */ /* green component */
bit0 = (color_prom[i] >> 3) & 0x01; bit0 = BIT(color_prom[i], 3);
bit1 = (color_prom[i] >> 4) & 0x01; bit1 = BIT(color_prom[i], 4);
bit2 = (color_prom[i] >> 5) & 0x01; bit2 = BIT(color_prom[i], 5);
g = combine_3_weights(weights_rg, bit0, bit1, bit2); g = combine_3_weights(weights_rg, bit0, bit1, bit2);
/* blue component */ /* blue component */
bit0 = (color_prom[i] >> 6) & 0x01; bit0 = BIT(color_prom[i], 6);
bit1 = (color_prom[i] >> 7) & 0x01; bit1 = BIT(color_prom[i], 7);
b = combine_2_weights(weights_b, bit0, bit1); b = combine_2_weights(weights_b, bit0, bit1);
palette_set_color(machine, i, MAKE_RGB(r, g, b)); palette_set_color(machine, i, MAKE_RGB(r, g, b));
@ -261,59 +284,66 @@ master-slave algorythm
-executes a wai (i.e. halt) opcode then expects to receive another irq... -executes a wai (i.e. halt) opcode then expects to receive another irq...
*/ */
#define MAIN_Z80_RUN if(offset == 2) z80_latch = 0x00 #define MAIN_Z80_RUN if(offset == 2) state->z80_latch = 0x00
#define MAIN_Z80_HALT if(offset == 2) z80_latch = 0x80 #define MAIN_Z80_HALT if(offset == 2) state->z80_latch = 0x80
//#define SUB_NCS_RUN ncs_latch = 0x00 //#define SUB_NCS_RUN state->ncs_latch = 0x00
//#define SUB_NCS_HALT ncs_latch = 0x80 //#define SUB_NCS_HALT state->ncs_latch = 0x80
static UINT8 nsc_latch,z80_latch;
static WRITE8_HANDLER( nsc_latch_w ) static WRITE8_HANDLER( nsc_latch_w )
{ {
cputag_set_input_line(space->machine, "sub", 0, HOLD_LINE ); nightgal_state *state = (nightgal_state *)space->machine->driver_data;
cpu_set_input_line(state->subcpu, 0, HOLD_LINE );
} }
static READ8_HANDLER( nsc_latch_r ) static READ8_HANDLER( nsc_latch_r )
{ {
return z80_latch; nightgal_state *state = (nightgal_state *)space->machine->driver_data;
return state->z80_latch;
} }
static WRITE8_HANDLER( z80_latch_w ) static WRITE8_HANDLER( z80_latch_w )
{ {
nsc_latch = data; nightgal_state *state = (nightgal_state *)space->machine->driver_data;
state->nsc_latch = data;
} }
static READ8_HANDLER( z80_latch_r ) static READ8_HANDLER( z80_latch_r )
{ {
return nsc_latch; nightgal_state *state = (nightgal_state *)space->machine->driver_data;
return state->nsc_latch;
} }
/*z80 -> MCU video params*/ /*z80 -> MCU video params*/
static WRITE8_HANDLER( blitter_w ) static WRITE8_HANDLER( blitter_w )
{ {
blit_raw_data[offset] = data; nightgal_state *state = (nightgal_state *)space->machine->driver_data;
state->blit_raw_data[offset] = data;
MAIN_Z80_HALT; MAIN_Z80_HALT;
} }
static READ8_HANDLER( nsc_blit_r ) static READ8_HANDLER( nsc_blit_r )
{ {
nightgal_state *state = (nightgal_state *)space->machine->driver_data;
MAIN_Z80_RUN; MAIN_Z80_RUN;
return blit_raw_data[offset]; return state->blit_raw_data[offset];
} }
static WRITE8_HANDLER( blit_vregs_w ) static WRITE8_HANDLER( blit_vregs_w )
{ {
pen_raw_data[offset] = data; nightgal_state *state = (nightgal_state *)space->machine->driver_data;
state->pen_raw_data[offset] = data;
} }
static READ8_HANDLER( blit_vregs_r ) static READ8_HANDLER( blit_vregs_r )
{ {
return pen_raw_data[offset]; nightgal_state *state = (nightgal_state *)space->machine->driver_data;
return state->pen_raw_data[offset];
} }
static WRITE8_HANDLER( blit_true_vregs_w ) static WRITE8_HANDLER( blit_true_vregs_w )
{ {
pen_data[offset] = data; nightgal_state *state = (nightgal_state *)space->machine->driver_data;
state->pen_data[offset] = data;
} }
/******************************************** /********************************************
@ -322,21 +352,19 @@ static WRITE8_HANDLER( blit_true_vregs_w )
* *
********************************************/ ********************************************/
static UINT8 mux_data;
static WRITE8_HANDLER( mux_w ) static WRITE8_HANDLER( mux_w )
{ {
mux_data = ~data; nightgal_state *state = (nightgal_state *)space->machine->driver_data;
// printf("%02x\n",mux_data); state->mux_data = ~data;
//printf("%02x\n", state->mux_data);
} }
static READ8_DEVICE_HANDLER( input_1p_r ) static READ8_DEVICE_HANDLER( input_1p_r )
{ {
static UINT8 cr_clear; nightgal_state *state = (nightgal_state *)device->machine->driver_data;
UINT8 cr_clear = input_port_read(device->machine, "CR_CLEAR");
cr_clear = input_port_read(device->machine, "CR_CLEAR"); switch (state->mux_data)
switch(mux_data)
{ {
case 0x01: return input_port_read(device->machine, "PL1_1") | cr_clear; case 0x01: return input_port_read(device->machine, "PL1_1") | cr_clear;
case 0x02: return input_port_read(device->machine, "PL1_2") | cr_clear; case 0x02: return input_port_read(device->machine, "PL1_2") | cr_clear;
@ -345,19 +373,18 @@ static READ8_DEVICE_HANDLER( input_1p_r )
case 0x10: return input_port_read(device->machine, "PL1_5") | cr_clear; case 0x10: return input_port_read(device->machine, "PL1_5") | cr_clear;
case 0x20: return input_port_read(device->machine, "PL1_6") | cr_clear; case 0x20: return input_port_read(device->machine, "PL1_6") | cr_clear;
} }
// printf("%04x\n",mux_data); //printf("%04x\n", state->mux_data);
return (input_port_read(device->machine, "PL1_1") & input_port_read(device->machine, "PL1_2") & input_port_read(device->machine, "PL1_3") & return (input_port_read(device->machine, "PL1_1") & input_port_read(device->machine, "PL1_2") & input_port_read(device->machine, "PL1_3") &
input_port_read(device->machine, "PL1_4") & input_port_read(device->machine, "PL1_5") & input_port_read(device->machine, "PL1_6")) | cr_clear;//input_port_read(device->machine, "PL1_0") && ; input_port_read(device->machine, "PL1_4") & input_port_read(device->machine, "PL1_5") & input_port_read(device->machine, "PL1_6")) | cr_clear;
} }
static READ8_DEVICE_HANDLER( input_2p_r ) static READ8_DEVICE_HANDLER( input_2p_r )
{ {
static UINT8 coin_port; nightgal_state *state = (nightgal_state *)device->machine->driver_data;
UINT8 coin_port = input_port_read(device->machine, "COINS");
coin_port = input_port_read(device->machine, "COINS"); switch (state->mux_data)
switch(mux_data)
{ {
case 0x01: return input_port_read(device->machine, "PL2_1") | coin_port; case 0x01: return input_port_read(device->machine, "PL2_1") | coin_port;
case 0x02: return input_port_read(device->machine, "PL2_2") | coin_port; case 0x02: return input_port_read(device->machine, "PL2_2") | coin_port;
@ -366,11 +393,10 @@ static READ8_DEVICE_HANDLER( input_2p_r )
case 0x10: return input_port_read(device->machine, "PL2_5") | coin_port; case 0x10: return input_port_read(device->machine, "PL2_5") | coin_port;
case 0x20: return input_port_read(device->machine, "PL2_6") | coin_port; case 0x20: return input_port_read(device->machine, "PL2_6") | coin_port;
} }
// printf("%04x\n",mux_data); //printf("%04x\n", state->mux_data);
return (input_port_read(device->machine, "PL2_1") & input_port_read(device->machine, "PL2_2") & input_port_read(device->machine, "PL2_3") & return (input_port_read(device->machine, "PL2_1") & input_port_read(device->machine, "PL2_2") & input_port_read(device->machine, "PL2_3") &
input_port_read(device->machine, "PL2_4") & input_port_read(device->machine, "PL2_5") & input_port_read(device->machine, "PL2_6")) | coin_port;//input_port_read(device->machine, "PL1_0") && ; input_port_read(device->machine, "PL2_4") & input_port_read(device->machine, "PL2_5") & input_port_read(device->machine, "PL2_6")) | coin_port;
} }
/******************************************** /********************************************
@ -481,6 +507,7 @@ static INPUT_PORTS_START( sexygal )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
PORT_START("PL1_2") PORT_START("PL1_2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
@ -488,6 +515,7 @@ static INPUT_PORTS_START( sexygal )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) PORT_CODE(KEYCODE_3)//rate button PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) PORT_CODE(KEYCODE_3)//rate button
PORT_START("PL1_3") PORT_START("PL1_3")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
@ -495,12 +523,14 @@ static INPUT_PORTS_START( sexygal )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) //another D button PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) //another D button
PORT_START("PL1_4") PORT_START("PL1_4")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED ) //another opt 1 button PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED ) //another opt 1 button
PORT_START("PL1_5") PORT_START("PL1_5")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1P Option 1") PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1P Option 1")
@ -508,6 +538,7 @@ static INPUT_PORTS_START( sexygal )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1P Option 3") PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1P Option 3")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1P Option 4") PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1P Option 4")
PORT_START("PL1_6") PORT_START("PL1_6")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1P Pass") //??? PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1P Pass") //???
@ -520,6 +551,7 @@ static INPUT_PORTS_START( sexygal )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_PLAYER(2) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_PLAYER(2)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_PLAYER(2) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_PLAYER(2)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
PORT_START("PL2_2") PORT_START("PL2_2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B ) PORT_PLAYER(2) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B ) PORT_PLAYER(2)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F ) PORT_PLAYER(2) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F ) PORT_PLAYER(2)
@ -527,6 +559,7 @@ static INPUT_PORTS_START( sexygal )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N ) PORT_PLAYER(2) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N ) PORT_PLAYER(2)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) PORT_PLAYER(2) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) PORT_PLAYER(2)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) PORT_CODE(KEYCODE_4) PORT_PLAYER(2)//rate button PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) PORT_CODE(KEYCODE_4) PORT_PLAYER(2)//rate button
PORT_START("PL2_3") PORT_START("PL2_3")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C ) PORT_PLAYER(2) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C ) PORT_PLAYER(2)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G ) PORT_PLAYER(2) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G ) PORT_PLAYER(2)
@ -534,12 +567,14 @@ static INPUT_PORTS_START( sexygal )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) PORT_PLAYER(2) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) PORT_PLAYER(2)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) PORT_PLAYER(2) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) PORT_PLAYER(2)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) //another D button PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) //another D button
PORT_START("PL2_4") PORT_START("PL2_4")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D ) PORT_PLAYER(2) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D ) PORT_PLAYER(2)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H ) PORT_PLAYER(2) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H ) PORT_PLAYER(2)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L ) PORT_PLAYER(2) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L ) PORT_PLAYER(2)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) PORT_PLAYER(2) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) PORT_PLAYER(2)
PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED ) //another opt 1 button PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED ) //another opt 1 button
PORT_START("PL2_5") PORT_START("PL2_5")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE ) PORT_PLAYER(2) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE ) PORT_PLAYER(2)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2P Option 1") PORT_PLAYER(2) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2P Option 1") PORT_PLAYER(2)
@ -547,6 +582,7 @@ static INPUT_PORTS_START( sexygal )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) PORT_PLAYER(2) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) PORT_PLAYER(2)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2P Option 3") PORT_PLAYER(2) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2P Option 3") PORT_PLAYER(2)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2P Option 4") PORT_PLAYER(2) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2P Option 4") PORT_PLAYER(2)
PORT_START("PL2_6") PORT_START("PL2_6")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2P Pass") PORT_PLAYER(2) //??? PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2P Pass") PORT_PLAYER(2) //???
@ -693,7 +729,43 @@ static const ay8910_interface ay8910_config =
DEVCB_NULL DEVCB_NULL
}; };
static MACHINE_START( nightgal )
{
nightgal_state *state = (nightgal_state *)machine->driver_data;
state->maincpu = devtag_get_device(machine, "maincpu");
state->subcpu = devtag_get_device(machine, "sub");
state_save_register_global(machine, state->nsc_latch);
state_save_register_global(machine, state->z80_latch);
state_save_register_global(machine, state->mux_data);
state_save_register_global_array(machine, state->blit_raw_data);
state_save_register_global_array(machine, state->true_blit);
state_save_register_global_array(machine, state->pen_data);
state_save_register_global_array(machine, state->pen_raw_data);
}
static MACHINE_RESET( nightgal )
{
nightgal_state *state = (nightgal_state *)machine->driver_data;
state->nsc_latch = 0;
state->z80_latch = 0;
state->mux_data = 0;
memset(state->blit_raw_data, 0, ARRAY_LENGTH(state->blit_raw_data));
memset(state->true_blit, 0, ARRAY_LENGTH(state->true_blit));
memset(state->pen_data, 0, ARRAY_LENGTH(state->pen_data));
memset(state->pen_raw_data, 0, ARRAY_LENGTH(state->pen_raw_data));
}
static MACHINE_DRIVER_START( nightgal ) static MACHINE_DRIVER_START( nightgal )
/* driver data */
MDRV_DRIVER_DATA(nightgal_state)
/* basic machine hardware */ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", Z80,MASTER_CLOCK / 4) /* ? MHz */ MDRV_CPU_ADD("maincpu", Z80,MASTER_CLOCK / 4) /* ? MHz */
MDRV_CPU_PROGRAM_MAP(nightgal_map) MDRV_CPU_PROGRAM_MAP(nightgal_map)
@ -705,6 +777,9 @@ static MACHINE_DRIVER_START( nightgal )
MDRV_QUANTUM_PERFECT_CPU("maincpu") MDRV_QUANTUM_PERFECT_CPU("maincpu")
MDRV_MACHINE_START(nightgal)
MDRV_MACHINE_RESET(nightgal)
/* video hardware */ /* video hardware */
MDRV_SCREEN_ADD("screen", RASTER) MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60) MDRV_SCREEN_REFRESH_RATE(60)
@ -1026,11 +1101,11 @@ ROM_END
/* Type 1 HW*/ /* Type 1 HW*/
GAME( 1984, nightgal, 0, nightgal, sexygal, 0, ROT0,"Nichibutsu", "Night Gal (Japan 840920 AG 1-00)", GAME_NOT_WORKING|GAME_UNEMULATED_PROTECTION ) GAME( 1984, nightgal, 0, nightgal, sexygal, 0, ROT0, "Nichibutsu", "Night Gal (Japan 840920 AG 1-00)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_SUPPORTS_SAVE )
GAME( 1984, ngtbunny, 0, nightgal, sexygal, 0, ROT0,"Nichibutsu", "Night Bunny (Japan 840601 MRN 2-10)", GAME_NOT_WORKING|GAME_UNEMULATED_PROTECTION ) GAME( 1984, ngtbunny, 0, nightgal, sexygal, 0, ROT0, "Nichibutsu", "Night Bunny (Japan 840601 MRN 2-10)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_SUPPORTS_SAVE )
GAME( 1984, royalngt, ngtbunny,nightgal, sexygal, 0, ROT0,"Royal Denshi", "Royal Night (Japan 840220 RN 2-00)", GAME_NOT_WORKING|GAME_UNEMULATED_PROTECTION ) GAME( 1984, royalngt, ngtbunny, nightgal, sexygal, 0, ROT0, "Royal Denshi", "Royal Night (Japan 840220 RN 2-00)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_SUPPORTS_SAVE )
/* Type 2 HW*/ /* Type 2 HW*/
GAME( 1985, sexygal, 0, sexygal, sexygal, 0, ROT0,"Nichibutsu", "Sexy Gal (Japan 850501 SXG 1-00)", GAME_NOT_WORKING|GAME_UNEMULATED_PROTECTION ) GAME( 1985, sexygal, 0, sexygal, sexygal, 0, ROT0, "Nichibutsu", "Sexy Gal (Japan 850501 SXG 1-00)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_SUPPORTS_SAVE )
GAME( 1985, sweetgal, sexygal, sexygal, sexygal, 0, ROT0,"Nichibutsu", "Sweet Gal (Japan 850510 SWG 1-02)", GAME_NOT_WORKING|GAME_UNEMULATED_PROTECTION ) GAME( 1985, sweetgal, sexygal, sexygal, sexygal, 0, ROT0, "Nichibutsu", "Sweet Gal (Japan 850510 SWG 1-02)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_SUPPORTS_SAVE )
/* Type 3 HW*/ /* Type 3 HW*/
GAME( 1985, ngalsumr, 0, nightgal, sexygal, 0, ROT0,"Nichibutsu", "Night Gal Summer", GAME_NOT_WORKING|GAME_UNEMULATED_PROTECTION ) GAME( 1985, ngalsumr, 0, nightgal, sexygal, 0, ROT0, "Nichibutsu", "Night Gal Summer", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_SUPPORTS_SAVE )

View File

@ -44,13 +44,13 @@
static ADDRESS_MAP_START( nitedrvr_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( nitedrvr_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x00ff) AM_RAM AM_MIRROR(0x100) // SCRAM AM_RANGE(0x0000, 0x00ff) AM_RAM AM_MIRROR(0x100) // SCRAM
AM_RANGE(0x0200, 0x027f) AM_RAM_WRITE(nitedrvr_videoram_w) AM_MIRROR(0x180) AM_BASE_GENERIC(videoram) // PFW AM_RANGE(0x0200, 0x027f) AM_RAM_WRITE(nitedrvr_videoram_w) AM_MIRROR(0x180) AM_BASE_MEMBER(nitedrvr_state, videoram) // PFW
AM_RANGE(0x0400, 0x05ff) AM_WRITE(nitedrvr_hvc_w) AM_BASE(&nitedrvr_hvc) // POSH, POSV, CHAR, Watchdog AM_RANGE(0x0400, 0x05ff) AM_WRITE(nitedrvr_hvc_w) AM_BASE_MEMBER(nitedrvr_state, hvc) // POSH, POSV, CHAR, Watchdog
AM_RANGE(0x0600, 0x07ff) AM_READ(nitedrvr_in0_r) AM_RANGE(0x0600, 0x07ff) AM_READ(nitedrvr_in0_r)
AM_RANGE(0x0800, 0x09ff) AM_READ(nitedrvr_in1_r) AM_RANGE(0x0800, 0x09ff) AM_READ(nitedrvr_in1_r)
AM_RANGE(0x0a00, 0x0bff) AM_WRITE(nitedrvr_out0_w) AM_RANGE(0x0a00, 0x0bff) AM_WRITE(nitedrvr_out0_w)
AM_RANGE(0x0c00, 0x0dff) AM_WRITE(nitedrvr_out1_w) AM_RANGE(0x0c00, 0x0dff) AM_WRITE(nitedrvr_out1_w)
AM_RANGE(0x8000, 0x807f) AM_RAM AM_MIRROR(0x380) AM_BASE_GENERIC(videoram) // PFR AM_RANGE(0x8000, 0x807f) AM_RAM AM_MIRROR(0x380) AM_BASE_MEMBER(nitedrvr_state, videoram) // PFR
AM_RANGE(0x8400, 0x87ff) AM_READWRITE(nitedrvr_steering_reset_r, nitedrvr_steering_reset_w) AM_RANGE(0x8400, 0x87ff) AM_READWRITE(nitedrvr_steering_reset_r, nitedrvr_steering_reset_w)
AM_RANGE(0x9000, 0x9fff) AM_ROM // ROM1-ROM2 AM_RANGE(0x9000, 0x9fff) AM_ROM // ROM1-ROM2
AM_RANGE(0xfff0, 0xffff) AM_ROM // ROM2 for 6502 vectors AM_RANGE(0xfff0, 0xffff) AM_ROM // ROM2 for 6502 vectors
@ -135,7 +135,11 @@ GFXDECODE_END
/* Machine Driver */ /* Machine Driver */
static MACHINE_DRIVER_START( nitedrvr ) static MACHINE_DRIVER_START( nitedrvr )
// basic machine hardware
/* driver data */
MDRV_DRIVER_DATA(nitedrvr_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M6502, XTAL_12_096MHz/12) // 1 MHz MDRV_CPU_ADD("maincpu", M6502, XTAL_12_096MHz/12) // 1 MHz
MDRV_CPU_PROGRAM_MAP(nitedrvr_map) MDRV_CPU_PROGRAM_MAP(nitedrvr_map)
MDRV_CPU_VBLANK_INT("screen", irq0_line_hold) MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
@ -146,8 +150,7 @@ static MACHINE_DRIVER_START( nitedrvr )
MDRV_TIMER_ADD_PERIODIC("crash_timer", nitedrvr_crash_toggle_callback, NSEC(PERIOD_OF_555_ASTABLE_NSEC(RES_K(180), 330, CAP_U(1)))) MDRV_TIMER_ADD_PERIODIC("crash_timer", nitedrvr_crash_toggle_callback, NSEC(PERIOD_OF_555_ASTABLE_NSEC(RES_K(180), 330, CAP_U(1))))
// video hardware /* video hardware */
MDRV_SCREEN_ADD("screen", RASTER) MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(57) // how is this derived? MDRV_SCREEN_REFRESH_RATE(57) // how is this derived?
MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
@ -162,7 +165,7 @@ static MACHINE_DRIVER_START( nitedrvr )
MDRV_VIDEO_START(nitedrvr) MDRV_VIDEO_START(nitedrvr)
MDRV_VIDEO_UPDATE(nitedrvr) MDRV_VIDEO_UPDATE(nitedrvr)
// sound hardware /* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SPEAKER_STANDARD_MONO("mono")
MDRV_SOUND_ADD("discrete", DISCRETE, 0) MDRV_SOUND_ADD("discrete", DISCRETE, 0)
@ -201,4 +204,4 @@ ROM_END
/* Game Drivers */ /* Game Drivers */
GAME( 1976, nitedrvr, 0, nitedrvr, nitedrvr, 0, ROT0, "Atari", "Night Driver", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE) GAME( 1976, nitedrvr, 0, nitedrvr, nitedrvr, 0, ROT0, "Atari", "Night Driver", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )

View File

@ -225,62 +225,93 @@ Stephh's notes (based on the games M68000 code and some tests) :
#include "sound/okim6295.h" #include "sound/okim6295.h"
#include "sound/3812intf.h" #include "sound/3812intf.h"
static tilemap_t *fg_tilemap,*bg_tilemap;
static UINT16 *nmg5_bitmap; typedef struct _nmg5_state nmg5_state;
static UINT16 *fg_videoram,*bg_videoram,*scroll_ram; struct _nmg5_state
static UINT8 prot_val, input_data, priority_reg, gfx_bank; {
/* memory pointers */
UINT16 * fg_videoram;
UINT16 * bg_videoram;
UINT16 * scroll_ram;
UINT16 * bitmap;
UINT16 * spriteram;
// UINT16 * paletteram; // currently this uses generic palette handling
size_t spriteram_size;
/* video-related */
tilemap_t *bg_tilemap, *fg_tilemap;
/* misc */
UINT8 prot_val, input_data, priority_reg, gfx_bank;
/* devices */
running_device *maincpu;
running_device *soundcpu;
};
static WRITE16_HANDLER( fg_videoram_w ) static WRITE16_HANDLER( fg_videoram_w )
{ {
COMBINE_DATA(&fg_videoram[offset]); nmg5_state *state = (nmg5_state *)space->machine->driver_data;
tilemap_mark_tile_dirty(fg_tilemap,offset); COMBINE_DATA(&state->fg_videoram[offset]);
tilemap_mark_tile_dirty(state->fg_tilemap, offset);
} }
static WRITE16_HANDLER( bg_videoram_w ) static WRITE16_HANDLER( bg_videoram_w )
{ {
COMBINE_DATA(&bg_videoram[offset]); nmg5_state *state = (nmg5_state *)space->machine->driver_data;
tilemap_mark_tile_dirty(bg_tilemap,offset); COMBINE_DATA(&state->bg_videoram[offset]);
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
} }
static WRITE16_HANDLER( nmg5_soundlatch_w ) static WRITE16_HANDLER( nmg5_soundlatch_w )
{ {
nmg5_state *state = (nmg5_state *)space->machine->driver_data;
if (ACCESSING_BITS_0_7) if (ACCESSING_BITS_0_7)
{ {
soundlatch_w(space,0,data & 0xff); soundlatch_w(space, 0, data & 0xff);
cputag_set_input_line(space->machine, "soundcpu", INPUT_LINE_NMI, PULSE_LINE); cpu_set_input_line(state->soundcpu, INPUT_LINE_NMI, PULSE_LINE);
} }
} }
static READ16_HANDLER( prot_r ) static READ16_HANDLER( prot_r )
{ {
return prot_val | input_data; nmg5_state *state = (nmg5_state *)space->machine->driver_data;
return state->prot_val | state->input_data;
} }
static WRITE16_HANDLER( prot_w ) static WRITE16_HANDLER( prot_w )
{ {
input_data = data & 0xf; nmg5_state *state = (nmg5_state *)space->machine->driver_data;
state->input_data = data & 0x0f;
} }
static WRITE16_HANDLER( gfx_bank_w ) static WRITE16_HANDLER( gfx_bank_w )
{ {
if( gfx_bank != (data & 3) ) nmg5_state *state = (nmg5_state *)space->machine->driver_data;
if (state->gfx_bank != (data & 3))
{ {
gfx_bank = data & 3; state->gfx_bank = data & 3;
tilemap_mark_all_tiles_dirty_all(space->machine); tilemap_mark_all_tiles_dirty_all(space->machine);
} }
} }
static WRITE16_HANDLER( priority_reg_w ) static WRITE16_HANDLER( priority_reg_w )
{ {
priority_reg = data & 7; nmg5_state *state = (nmg5_state *)space->machine->driver_data;
if(priority_reg == 4 || priority_reg == 5 || priority_reg == 6) state->priority_reg = data & 7;
popmessage("unknown priority_reg value = %d\n",priority_reg);
if (state->priority_reg == 4 || state->priority_reg == 5 || state->priority_reg == 6)
popmessage("unknown priority_reg value = %d\n", state->priority_reg);
} }
static WRITE8_DEVICE_HANDLER( oki_banking_w ) static WRITE8_DEVICE_HANDLER( oki_banking_w )
{ {
okim6295_set_bank_base(device, (data & 1) ? 0x40000 : 0 ); okim6295_set_bank_base(device, (data & 1) ? 0x40000 : 0);
} }
/******************************************************************* /*******************************************************************
@ -293,7 +324,7 @@ static ADDRESS_MAP_START( nmg5_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_ROM AM_RANGE(0x000000, 0x0fffff) AM_ROM
AM_RANGE(0x120000, 0x12ffff) AM_RAM AM_RANGE(0x120000, 0x12ffff) AM_RAM
AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram) AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
AM_RANGE(0x160000, 0x1607ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) AM_RANGE(0x160000, 0x1607ff) AM_RAM AM_BASE_SIZE_MEMBER(nmg5_state, spriteram, spriteram_size)
AM_RANGE(0x180000, 0x180001) AM_WRITE(nmg5_soundlatch_w) AM_RANGE(0x180000, 0x180001) AM_WRITE(nmg5_soundlatch_w)
AM_RANGE(0x180002, 0x180003) AM_WRITENOP AM_RANGE(0x180002, 0x180003) AM_WRITENOP
AM_RANGE(0x180004, 0x180005) AM_READWRITE(prot_r, prot_w) AM_RANGE(0x180004, 0x180005) AM_READWRITE(prot_r, prot_w)
@ -302,18 +333,18 @@ static ADDRESS_MAP_START( nmg5_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x18000a, 0x18000b) AM_READ_PORT("SYSTEM") AM_RANGE(0x18000a, 0x18000b) AM_READ_PORT("SYSTEM")
AM_RANGE(0x18000c, 0x18000d) AM_READ_PORT("INPUTS") AM_RANGE(0x18000c, 0x18000d) AM_READ_PORT("INPUTS")
AM_RANGE(0x18000e, 0x18000f) AM_WRITE(priority_reg_w) AM_RANGE(0x18000e, 0x18000f) AM_WRITE(priority_reg_w)
AM_RANGE(0x300002, 0x300009) AM_WRITEONLY AM_BASE(&scroll_ram) AM_RANGE(0x300002, 0x300009) AM_WRITEONLY AM_BASE_MEMBER(nmg5_state, scroll_ram)
AM_RANGE(0x30000a, 0x30000f) AM_WRITENOP AM_RANGE(0x30000a, 0x30000f) AM_WRITENOP
AM_RANGE(0x320000, 0x321fff) AM_RAM_WRITE(bg_videoram_w) AM_BASE(&bg_videoram) AM_RANGE(0x320000, 0x321fff) AM_RAM_WRITE(bg_videoram_w) AM_BASE_MEMBER(nmg5_state, bg_videoram)
AM_RANGE(0x322000, 0x323fff) AM_RAM_WRITE(fg_videoram_w) AM_BASE(&fg_videoram) AM_RANGE(0x322000, 0x323fff) AM_RAM_WRITE(fg_videoram_w) AM_BASE_MEMBER(nmg5_state, fg_videoram)
AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE(&nmg5_bitmap) AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE_MEMBER(nmg5_state, bitmap)
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( pclubys_map, ADDRESS_SPACE_PROGRAM, 16 ) static ADDRESS_MAP_START( pclubys_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_ROM AM_RANGE(0x000000, 0x0fffff) AM_ROM
AM_RANGE(0x200000, 0x20ffff) AM_RAM AM_RANGE(0x200000, 0x20ffff) AM_RAM
AM_RANGE(0x440000, 0x4407ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram) AM_RANGE(0x440000, 0x4407ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
AM_RANGE(0x460000, 0x4607ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) AM_RANGE(0x460000, 0x4607ff) AM_RAM AM_BASE_SIZE_MEMBER(nmg5_state, spriteram, spriteram_size)
AM_RANGE(0x480000, 0x480001) AM_WRITE(nmg5_soundlatch_w) AM_RANGE(0x480000, 0x480001) AM_WRITE(nmg5_soundlatch_w)
AM_RANGE(0x480002, 0x480003) AM_WRITENOP AM_RANGE(0x480002, 0x480003) AM_WRITENOP
AM_RANGE(0x480004, 0x480005) AM_READWRITE(prot_r, prot_w) AM_RANGE(0x480004, 0x480005) AM_READWRITE(prot_r, prot_w)
@ -322,10 +353,10 @@ static ADDRESS_MAP_START( pclubys_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x48000a, 0x48000b) AM_READ_PORT("SYSTEM") AM_RANGE(0x48000a, 0x48000b) AM_READ_PORT("SYSTEM")
AM_RANGE(0x48000c, 0x48000d) AM_READ_PORT("INPUTS") AM_RANGE(0x48000c, 0x48000d) AM_READ_PORT("INPUTS")
AM_RANGE(0x48000e, 0x48000f) AM_WRITE(priority_reg_w) AM_RANGE(0x48000e, 0x48000f) AM_WRITE(priority_reg_w)
AM_RANGE(0x500002, 0x500009) AM_WRITEONLY AM_BASE(&scroll_ram) AM_RANGE(0x500002, 0x500009) AM_WRITEONLY AM_BASE_MEMBER(nmg5_state, scroll_ram)
AM_RANGE(0x520000, 0x521fff) AM_RAM_WRITE(bg_videoram_w) AM_BASE(&bg_videoram) AM_RANGE(0x520000, 0x521fff) AM_RAM_WRITE(bg_videoram_w) AM_BASE_MEMBER(nmg5_state, bg_videoram)
AM_RANGE(0x522000, 0x523fff) AM_RAM_WRITE(fg_videoram_w) AM_BASE(&fg_videoram) AM_RANGE(0x522000, 0x523fff) AM_RAM_WRITE(fg_videoram_w) AM_BASE_MEMBER(nmg5_state, fg_videoram)
AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE(&nmg5_bitmap) AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE_MEMBER(nmg5_state, bitmap)
ADDRESS_MAP_END ADDRESS_MAP_END
/******************************************************************* /*******************************************************************
@ -789,40 +820,43 @@ static INPUT_PORTS_START( wondstck )
INPUT_PORTS_END INPUT_PORTS_END
INLINE void get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,UINT16 *vram,int color) INLINE void get_tile_info( running_machine *machine, tile_data *tileinfo, int tile_index, UINT16 *vram, int color )
{ {
SET_TILE_INFO(0,vram[tile_index] | (gfx_bank << 16),color,0); nmg5_state *state = (nmg5_state *)machine->driver_data;
SET_TILE_INFO(0, vram[tile_index] | (state->gfx_bank << 16), color, 0);
} }
static TILE_GET_INFO( fg_get_tile_info ) { get_tile_info(machine,tileinfo,tile_index,fg_videoram, 0); } static TILE_GET_INFO( fg_get_tile_info ) { nmg5_state *state = (nmg5_state *)machine->driver_data; get_tile_info(machine, tileinfo, tile_index, state->fg_videoram, 0); }
static TILE_GET_INFO( bg_get_tile_info ) { get_tile_info(machine,tileinfo,tile_index,bg_videoram, 1); } static TILE_GET_INFO( bg_get_tile_info ) { nmg5_state *state = (nmg5_state *)machine->driver_data; get_tile_info(machine, tileinfo, tile_index, state->bg_videoram, 1); }
static VIDEO_START( nmg5 ) static VIDEO_START( nmg5 )
{ {
bg_tilemap = tilemap_create(machine, bg_get_tile_info,tilemap_scan_rows,8,8,64,64); nmg5_state *state = (nmg5_state *)machine->driver_data;
fg_tilemap = tilemap_create(machine, fg_get_tile_info,tilemap_scan_rows,8,8,64,64);
tilemap_set_transparent_pen(fg_tilemap,0); state->bg_tilemap = tilemap_create(machine, bg_get_tile_info, tilemap_scan_rows, 8, 8, 64, 64);
state->fg_tilemap = tilemap_create(machine, fg_get_tile_info, tilemap_scan_rows, 8, 8, 64, 64);
tilemap_set_transparent_pen(state->fg_tilemap, 0);
} }
static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect) static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{ {
UINT16 *spriteram16 = machine->generic.spriteram.u16; nmg5_state *state = (nmg5_state *)machine->driver_data;
UINT16 *spriteram = state->spriteram;
int offs; int offs;
for (offs = 0;offs < machine->generic.spriteram_size/2;offs += 4) for (offs = 0; offs < state->spriteram_size / 2; offs += 4)
{ {
int sx,sy,code,color,flipx,flipy,height,y; int sx, sy, code, color, flipx, flipy, height, y;
sx = spriteram16[offs + 2]; sx = spriteram[offs + 2];
sy = spriteram16[offs + 0]; sy = spriteram[offs + 0];
code = spriteram16[offs + 1]; code = spriteram[offs + 1];
color = (spriteram16[offs + 2] >> 9) & 0xf; color = (spriteram[offs + 2] >> 9) & 0xf;
height = 1 << ((spriteram16[offs + 0] & 0x0600) >> 9); height = 1 << ((spriteram[offs + 0] & 0x0600) >> 9);
flipx = spriteram16[offs + 0] & 0x2000; flipx = spriteram[offs + 0] & 0x2000;
flipy = spriteram16[offs + 0] & 0x4000; flipy = spriteram[offs + 0] & 0x4000;
for (y = 0;y < height;y++) for (y = 0; y < height; y++)
{ {
drawgfx_transpen(bitmap,cliprect,machine->gfx[1], drawgfx_transpen(bitmap,cliprect,machine->gfx[1],
code + (flipy ? height-1 - y : y), code + (flipy ? height-1 - y : y),
@ -840,28 +874,29 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
} }
} }
static void draw_bitmap(bitmap_t *bitmap) static void draw_bitmap( running_machine *machine, bitmap_t *bitmap )
{ {
int yyy=256; nmg5_state *state = (nmg5_state *)machine->driver_data;
int xxx=512/4; int yyy = 256;
UINT16 x,y,count; int xxx = 512 / 4;
int xoff=-12; UINT16 x, y, count;
int yoff=-9; int xoff = -12;
int yoff = -9;
int pix; int pix;
count=0; count = 0;
for (y=0;y<yyy;y++) for (y = 0; y < yyy; y++)
{ {
for(x=0;x<xxx;x++) for (x = 0; x < xxx; x++)
{ {
pix = (nmg5_bitmap[count]&0xf000)>>12; pix = (state->bitmap[count] & 0xf000) >> 12;
if (pix) *BITMAP_ADDR16(bitmap, y+yoff, x*4+0+xoff) = pix + 0x300; if (pix) *BITMAP_ADDR16(bitmap, y + yoff, x * 4 + 0 + xoff) = pix + 0x300;
pix = (nmg5_bitmap[count]&0x0f00)>>8; pix = (state->bitmap[count] & 0x0f00) >> 8;
if (pix) *BITMAP_ADDR16(bitmap, y+yoff, x*4+1+xoff) = pix + 0x300; if (pix) *BITMAP_ADDR16(bitmap, y + yoff, x * 4 + 1 + xoff) = pix + 0x300;
pix = (nmg5_bitmap[count]&0x00f0)>>4; pix = (state->bitmap[count] & 0x00f0) >> 4;
if (pix) *BITMAP_ADDR16(bitmap, y+yoff, x*4+2+xoff) = pix + 0x300; if (pix) *BITMAP_ADDR16(bitmap, y + yoff, x * 4 + 2 + xoff) = pix + 0x300;
pix = (nmg5_bitmap[count]&0x000f)>>0; pix = (state->bitmap[count] & 0x000f) >> 0;
if (pix) *BITMAP_ADDR16(bitmap, y+yoff, x*4+3+xoff) = pix + 0x300; if (pix) *BITMAP_ADDR16(bitmap, y + yoff, x * 4 + 3 + xoff) = pix + 0x300;
count++; count++;
} }
@ -871,42 +906,44 @@ static void draw_bitmap(bitmap_t *bitmap)
static VIDEO_UPDATE( nmg5 ) static VIDEO_UPDATE( nmg5 )
{ {
tilemap_set_scrolly(bg_tilemap,0,scroll_ram[3]+9); nmg5_state *state = (nmg5_state *)screen->machine->driver_data;
tilemap_set_scrollx(bg_tilemap,0,scroll_ram[2]+3);
tilemap_set_scrolly(fg_tilemap,0,scroll_ram[1]+9);
tilemap_set_scrollx(fg_tilemap,0,scroll_ram[0]-1);
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); tilemap_set_scrolly(state->bg_tilemap, 0, state->scroll_ram[3] + 9);
tilemap_set_scrollx(state->bg_tilemap, 0, state->scroll_ram[2] + 3);
tilemap_set_scrolly(state->fg_tilemap, 0, state->scroll_ram[1] + 9);
tilemap_set_scrollx(state->fg_tilemap, 0, state->scroll_ram[0] - 1);
if(priority_reg == 0) tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
if (state->priority_reg == 0)
{ {
draw_sprites(screen->machine,bitmap,cliprect); draw_sprites(screen->machine, bitmap, cliprect);
tilemap_draw(bitmap,cliprect,fg_tilemap,0,0); tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
draw_bitmap(bitmap); draw_bitmap(screen->machine, bitmap);
} }
else if(priority_reg == 1) else if (state->priority_reg == 1)
{ {
draw_bitmap(bitmap); draw_bitmap(screen->machine, bitmap);
draw_sprites(screen->machine,bitmap,cliprect); draw_sprites(screen->machine, bitmap, cliprect);
tilemap_draw(bitmap,cliprect,fg_tilemap,0,0); tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
} }
else if(priority_reg == 2) else if (state->priority_reg == 2)
{ {
draw_sprites(screen->machine,bitmap,cliprect); draw_sprites(screen->machine, bitmap, cliprect);
draw_bitmap(bitmap); draw_bitmap(screen->machine, bitmap);
tilemap_draw(bitmap,cliprect,fg_tilemap,0,0); tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
} }
else if(priority_reg == 3) else if (state->priority_reg == 3)
{ {
tilemap_draw(bitmap,cliprect,fg_tilemap,0,0); tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
draw_sprites(screen->machine,bitmap,cliprect); draw_sprites(screen->machine, bitmap, cliprect);
draw_bitmap(bitmap); draw_bitmap(screen->machine, bitmap);
} }
else if(priority_reg == 7) else if (state->priority_reg == 7)
{ {
tilemap_draw(bitmap,cliprect,fg_tilemap,0,0); tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
draw_bitmap(bitmap); draw_bitmap(screen->machine, bitmap);
draw_sprites(screen->machine,bitmap,cliprect); draw_sprites(screen->machine, bitmap, cliprect);
} }
return 0; return 0;
} }
@ -956,9 +993,10 @@ static GFXDECODE_START( pclubys )
GFXDECODE_END GFXDECODE_END
static void soundirq(running_device *device, int state) static void soundirq( running_device *device, int state )
{ {
cputag_set_input_line(device->machine, "soundcpu", 0, state); nmg5_state *driver_state = (nmg5_state *)device->machine->driver_data;
cpu_set_input_line(driver_state->soundcpu, 0, state);
} }
static const ym3812_interface ym3812_intf = static const ym3812_interface ym3812_intf =
@ -968,19 +1006,32 @@ static const ym3812_interface ym3812_intf =
static MACHINE_START( nmg5 ) static MACHINE_START( nmg5 )
{ {
state_save_register_global(machine, gfx_bank); nmg5_state *state = (nmg5_state *)machine->driver_data;
state_save_register_global(machine, priority_reg);
state_save_register_global(machine, input_data); state->maincpu = devtag_get_device(machine, "maincpu");
state->soundcpu = devtag_get_device(machine, "soundcpu");
state_save_register_global(machine, state->gfx_bank);
state_save_register_global(machine, state->priority_reg);
state_save_register_global(machine, state->input_data);
} }
static MACHINE_RESET( nmg5 ) static MACHINE_RESET( nmg5 )
{ {
nmg5_state *state = (nmg5_state *)machine->driver_data;
/* some games don't set the priority register so it should be hard-coded to a normal layout */ /* some games don't set the priority register so it should be hard-coded to a normal layout */
priority_reg = 7; state->priority_reg = 7;
state->gfx_bank = 0;
state->input_data = 0;
} }
static MACHINE_DRIVER_START( nmg5 ) static MACHINE_DRIVER_START( nmg5 )
/* driver data */
MDRV_DRIVER_DATA(nmg5_state)
/* basic machine hardware */ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 16000000) /* 16 MHz */ MDRV_CPU_ADD("maincpu", M68000, 16000000) /* 16 MHz */
MDRV_CPU_PROGRAM_MAP(nmg5_map) MDRV_CPU_PROGRAM_MAP(nmg5_map)
@ -1473,22 +1524,26 @@ ROM_END
static DRIVER_INIT( prot_val_00 ) static DRIVER_INIT( prot_val_00 )
{ {
prot_val = 0x00; nmg5_state *state = (nmg5_state *)machine->driver_data;
state->prot_val = 0x00;
} }
static DRIVER_INIT( prot_val_10 ) static DRIVER_INIT( prot_val_10 )
{ {
prot_val = 0x10; nmg5_state *state = (nmg5_state *)machine->driver_data;
state->prot_val = 0x10;
} }
static DRIVER_INIT( prot_val_20 ) static DRIVER_INIT( prot_val_20 )
{ {
prot_val = 0x20; nmg5_state *state = (nmg5_state *)machine->driver_data;
state->prot_val = 0x20;
} }
static DRIVER_INIT( prot_val_40 ) static DRIVER_INIT( prot_val_40 )
{ {
prot_val = 0x40; nmg5_state *state = (nmg5_state *)machine->driver_data;
state->prot_val = 0x40;
} }
GAME( 1998, nmg5, 0, nmg5, nmg5, prot_val_10, ROT0, "Yun Sung", "Multi 5 / New Multi Game 5", GAME_SUPPORTS_SAVE ) GAME( 1998, nmg5, 0, nmg5, nmg5, prot_val_10, ROT0, "Yun Sung", "Multi 5 / New Multi Game 5", GAME_SUPPORTS_SAVE )

View File

@ -153,40 +153,38 @@ Stephh's additional notes (based on the game Z80 code and some tests) :
#include "sound/msm5232.h" #include "sound/msm5232.h"
#include "includes/nycaptor.h" #include "includes/nycaptor.h"
UINT8 *nycaptor_sharedram;
static int generic_control_reg = 0;
static int sound_nmi_enable=0,pending_nmi=0;
int nyc_gametype=0;
static WRITE8_HANDLER( sub_cpu_halt_w ) static WRITE8_HANDLER( sub_cpu_halt_w )
{ {
cputag_set_input_line(space->machine, "sub", INPUT_LINE_HALT, (data) ? ASSERT_LINE : CLEAR_LINE); nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
cpu_set_input_line(state->subcpu, INPUT_LINE_HALT, (data) ? ASSERT_LINE : CLEAR_LINE);
} }
static UINT8 snd_data;
static READ8_HANDLER( from_snd_r ) static READ8_HANDLER( from_snd_r )
{ {
return snd_data; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
return state->snd_data;
} }
static WRITE8_HANDLER( to_main_w ) static WRITE8_HANDLER( to_main_w )
{ {
snd_data = data; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
state->snd_data = data;
} }
static READ8_HANDLER(nycaptor_sharedram_r) static READ8_HANDLER(nycaptor_sharedram_r)
{ {
return nycaptor_sharedram[offset]; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
return state->sharedram[offset];
} }
static WRITE8_HANDLER(nycaptor_sharedram_w) static WRITE8_HANDLER(nycaptor_sharedram_w)
{ {
nycaptor_sharedram[offset]=data; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
state->sharedram[offset] = data;
} }
static READ8_HANDLER( nycaptor_b_r ) static READ8_HANDLER( nycaptor_b_r )
{ {
return 1; return 1;
@ -194,9 +192,12 @@ static READ8_HANDLER( nycaptor_b_r )
static READ8_HANDLER( nycaptor_by_r ) static READ8_HANDLER( nycaptor_by_r )
{ {
int port=input_port_read(space->machine, "LIGHTY"); nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
if(nyc_gametype == 1) int port = input_port_read(space->machine, "LIGHTY");
if (state->gametype == 1)
port = 255 - port; port = 255 - port;
return port - 8; return port - 8;
} }
@ -208,23 +209,24 @@ static READ8_HANDLER( nycaptor_bx_r )
static WRITE8_HANDLER( sound_cpu_reset_w ) static WRITE8_HANDLER( sound_cpu_reset_w )
{ {
cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_RESET, (data&1 )? ASSERT_LINE : CLEAR_LINE); nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
cpu_set_input_line(state->audiocpu, INPUT_LINE_RESET, (data&1 )? ASSERT_LINE : CLEAR_LINE);
} }
static int vol_ctrl[16];
static MACHINE_RESET( ta7630 ) static MACHINE_RESET( ta7630 )
{ {
nycaptor_state *state = (nycaptor_state *)machine->driver_data;
int i; int i;
double db = 0.0; double db = 0.0;
double db_step = 0.50; /* 0.50 dB step (at least, maybe more) */ double db_step = 0.50; /* 0.50 dB step (at least, maybe more) */
double db_step_inc = 0.275; double db_step_inc = 0.275;
for (i=0; i<16; i++)
for (i = 0; i < 16; i++)
{ {
double max = 100.0 / pow(10.0, db/20.0 ); double max = 100.0 / pow(10.0, db/20.0 );
vol_ctrl[ 15-i ] = max; state->vol_ctrl[15 - i] = max;
/*logerror("vol_ctrl[%x] = %i (%f dB)\n",15-i,vol_ctrl[ 15-i ],db);*/ /*logerror("vol_ctrl[%x] = %i (%f dB)\n", 15 - i, state->vol_ctrl[15 - i], db);*/
db += db_step; db += db_step;
db_step += db_step_inc; db_step += db_step_inc;
} }
@ -232,28 +234,34 @@ static MACHINE_RESET( ta7630 )
static TIMER_CALLBACK( nmi_callback ) static TIMER_CALLBACK( nmi_callback )
{ {
if (sound_nmi_enable) cputag_set_input_line(machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE); nycaptor_state *state = (nycaptor_state *)machine->driver_data;
else pending_nmi = 1; if (state->sound_nmi_enable)
cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, PULSE_LINE);
else
state->pending_nmi = 1;
} }
static WRITE8_HANDLER( sound_command_w ) static WRITE8_HANDLER( sound_command_w )
{ {
soundlatch_w(space,0,data); soundlatch_w(space, 0, data);
timer_call_after_resynch(space->machine, NULL, data,nmi_callback); timer_call_after_resynch(space->machine, NULL, data, nmi_callback);
} }
static WRITE8_HANDLER( nmi_disable_w ) static WRITE8_HANDLER( nmi_disable_w )
{ {
sound_nmi_enable = 0; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
state->sound_nmi_enable = 0;
} }
static WRITE8_HANDLER( nmi_enable_w ) static WRITE8_HANDLER( nmi_enable_w )
{ {
sound_nmi_enable = 1; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
if (pending_nmi) state->sound_nmi_enable = 1;
if (state->pending_nmi)
{ {
cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE); cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, PULSE_LINE);
pending_nmi = 0; state->pending_nmi = 0;
} }
} }
@ -280,23 +288,25 @@ static const msm5232_interface msm5232_config =
static READ8_HANDLER ( nycaptor_generic_control_r ) static READ8_HANDLER ( nycaptor_generic_control_r )
{ {
return generic_control_reg; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
return state->generic_control_reg;
} }
static WRITE8_HANDLER( nycaptor_generic_control_w ) static WRITE8_HANDLER( nycaptor_generic_control_w )
{ {
generic_control_reg = data; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
state->generic_control_reg = data;
memory_set_bankptr(space->machine, "bank1", memory_region(space->machine, "maincpu") + 0x10000 + ((data&0x08)>>3)*0x4000 ); memory_set_bankptr(space->machine, "bank1", memory_region(space->machine, "maincpu") + 0x10000 + ((data&0x08)>>3)*0x4000 );
} }
static ADDRESS_MAP_START( nycaptor_master_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( nycaptor_master_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
AM_RANGE(0xc000, 0xc7ff) AM_READ(nycaptor_videoram_r) AM_WRITE(nycaptor_videoram_w) AM_BASE_GENERIC(videoram) AM_SIZE_GENERIC(videoram) AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(nycaptor_videoram_r, nycaptor_videoram_w) AM_BASE_SIZE_MEMBER(nycaptor_state, videoram, videoram_size)
AM_RANGE(0xd000, 0xd000) AM_READ(nycaptor_mcu_r) AM_WRITE(nycaptor_mcu_w) AM_RANGE(0xd000, 0xd000) AM_READWRITE(nycaptor_mcu_r, nycaptor_mcu_w)
AM_RANGE(0xd001, 0xd001) AM_WRITE(sub_cpu_halt_w) AM_RANGE(0xd001, 0xd001) AM_WRITE(sub_cpu_halt_w)
AM_RANGE(0xd002, 0xd002) AM_READ(nycaptor_generic_control_r) AM_WRITE(nycaptor_generic_control_w) /* bit 3 - memory bank at 0x8000-0xbfff */ AM_RANGE(0xd002, 0xd002) AM_READWRITE(nycaptor_generic_control_r, nycaptor_generic_control_w) /* bit 3 - memory bank at 0x8000-0xbfff */
AM_RANGE(0xd400, 0xd400) AM_READ(from_snd_r) AM_WRITE(sound_command_w) AM_RANGE(0xd400, 0xd400) AM_READWRITE(from_snd_r, sound_command_w)
AM_RANGE(0xd401, 0xd401) AM_READNOP AM_RANGE(0xd401, 0xd401) AM_READNOP
AM_RANGE(0xd403, 0xd403) AM_WRITE(sound_cpu_reset_w) AM_RANGE(0xd403, 0xd403) AM_WRITE(sound_cpu_reset_w)
AM_RANGE(0xd800, 0xd800) AM_READ_PORT("DSW0") AM_RANGE(0xd800, 0xd800) AM_READ_PORT("DSW0")
@ -307,31 +317,31 @@ static ADDRESS_MAP_START( nycaptor_master_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xd805, 0xd805) AM_READ(nycaptor_mcu_status_r1) AM_RANGE(0xd805, 0xd805) AM_READ(nycaptor_mcu_status_r1)
AM_RANGE(0xd806, 0xd806) AM_READNOP /* unknown ?sound? */ AM_RANGE(0xd806, 0xd806) AM_READNOP /* unknown ?sound? */
AM_RANGE(0xd807, 0xd807) AM_READ(nycaptor_mcu_status_r2) AM_RANGE(0xd807, 0xd807) AM_READ(nycaptor_mcu_status_r2)
AM_RANGE(0xdc00, 0xdc9f) AM_READ(nycaptor_spriteram_r) AM_WRITE(nycaptor_spriteram_w) AM_RANGE(0xdc00, 0xdc9f) AM_READWRITE(nycaptor_spriteram_r, nycaptor_spriteram_w)
AM_RANGE(0xdca0, 0xdcbf) AM_READ(nycaptor_scrlram_r) AM_WRITE(nycaptor_scrlram_w) AM_BASE(&nycaptor_scrlram) AM_RANGE(0xdca0, 0xdcbf) AM_READWRITE(nycaptor_scrlram_r, nycaptor_scrlram_w) AM_BASE_MEMBER(nycaptor_state, scrlram)
AM_RANGE(0xdce1, 0xdce1) AM_WRITENOP AM_RANGE(0xdce1, 0xdce1) AM_WRITENOP
AM_RANGE(0xdd00, 0xdeff) AM_READ(nycaptor_palette_r) AM_WRITE(nycaptor_palette_w) AM_RANGE(0xdd00, 0xdeff) AM_READWRITE(nycaptor_palette_r, nycaptor_palette_w)
AM_RANGE(0xdf03, 0xdf03) AM_READ(nycaptor_gfxctrl_r) AM_WRITE(nycaptor_gfxctrl_w) AM_RANGE(0xdf03, 0xdf03) AM_READWRITE(nycaptor_gfxctrl_r, nycaptor_gfxctrl_w)
AM_RANGE(0xe000, 0xffff) AM_READ(nycaptor_sharedram_r) AM_WRITE(nycaptor_sharedram_w) AM_BASE(&nycaptor_sharedram) AM_RANGE(0xe000, 0xffff) AM_READWRITE(nycaptor_sharedram_r, nycaptor_sharedram_w) AM_BASE_MEMBER(nycaptor_state, sharedram)
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( nycaptor_slave_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( nycaptor_slave_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0xc000, 0xc7ff) AM_READ(nycaptor_videoram_r) AM_WRITE(nycaptor_videoram_w) AM_BASE_GENERIC(videoram) AM_SIZE_GENERIC(videoram) AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(nycaptor_videoram_r, nycaptor_videoram_w) AM_BASE_SIZE_MEMBER(nycaptor_state, videoram, videoram_size)
AM_RANGE(0xd800, 0xd800) AM_READ_PORT("DSW0") AM_RANGE(0xd800, 0xd800) AM_READ_PORT("DSW0")
AM_RANGE(0xd801, 0xd801) AM_READ_PORT("DSW1") AM_RANGE(0xd801, 0xd801) AM_READ_PORT("DSW1")
AM_RANGE(0xd802, 0xd802) AM_READ_PORT("DSW2") AM_RANGE(0xd802, 0xd802) AM_READ_PORT("DSW2")
AM_RANGE(0xd803, 0xd803) AM_READ_PORT("IN0") AM_RANGE(0xd803, 0xd803) AM_READ_PORT("IN0")
AM_RANGE(0xd804, 0xd804) AM_READ_PORT("IN1") AM_RANGE(0xd804, 0xd804) AM_READ_PORT("IN1")
AM_RANGE(0xdc00, 0xdc9f) AM_READ(nycaptor_spriteram_r) AM_WRITE(nycaptor_spriteram_w) AM_RANGE(0xdc00, 0xdc9f) AM_READWRITE(nycaptor_spriteram_r, nycaptor_spriteram_w)
AM_RANGE(0xdca0, 0xdcbf) AM_WRITE(nycaptor_scrlram_w) AM_BASE(&nycaptor_scrlram) AM_RANGE(0xdca0, 0xdcbf) AM_WRITE(nycaptor_scrlram_w) AM_BASE_MEMBER(nycaptor_state, scrlram)
AM_RANGE(0xdd00, 0xdeff) AM_READ(nycaptor_palette_r) AM_WRITE(nycaptor_palette_w) AM_RANGE(0xdd00, 0xdeff) AM_READWRITE(nycaptor_palette_r, nycaptor_palette_w)
AM_RANGE(0xdf00, 0xdf00) AM_READ(nycaptor_bx_r) AM_RANGE(0xdf00, 0xdf00) AM_READ(nycaptor_bx_r)
AM_RANGE(0xdf01, 0xdf01) AM_READ(nycaptor_by_r) AM_RANGE(0xdf01, 0xdf01) AM_READ(nycaptor_by_r)
AM_RANGE(0xdf02, 0xdf02) AM_READ(nycaptor_b_r) AM_RANGE(0xdf02, 0xdf02) AM_READ(nycaptor_b_r)
AM_RANGE(0xdf03, 0xdf03) AM_READ(nycaptor_gfxctrl_r) AM_WRITENOP/* ? gfx control ? */ AM_RANGE(0xdf03, 0xdf03) AM_READ(nycaptor_gfxctrl_r) AM_WRITENOP/* ? gfx control ? */
AM_RANGE(0xe000, 0xffff) AM_READ(nycaptor_sharedram_r) AM_WRITE(nycaptor_sharedram_w) AM_RANGE(0xe000, 0xffff) AM_READWRITE(nycaptor_sharedram_r, nycaptor_sharedram_w)
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( nycaptor_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( nycaptor_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
@ -343,7 +353,7 @@ static ADDRESS_MAP_START( nycaptor_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xca00, 0xca00) AM_WRITENOP AM_RANGE(0xca00, 0xca00) AM_WRITENOP
AM_RANGE(0xcb00, 0xcb00) AM_WRITENOP AM_RANGE(0xcb00, 0xcb00) AM_WRITENOP
AM_RANGE(0xcc00, 0xcc00) AM_WRITENOP AM_RANGE(0xcc00, 0xcc00) AM_WRITENOP
AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r) AM_WRITE(to_main_w) AM_RANGE(0xd000, 0xd000) AM_READWRITE(soundlatch_r, to_main_w)
AM_RANGE(0xd200, 0xd200) AM_READNOP AM_WRITE(nmi_enable_w) AM_RANGE(0xd200, 0xd200) AM_READNOP AM_WRITE(nmi_enable_w)
AM_RANGE(0xd400, 0xd400) AM_WRITE(nmi_disable_w) AM_RANGE(0xd400, 0xd400) AM_WRITE(nmi_disable_w)
AM_RANGE(0xd600, 0xd600) AM_WRITENOP AM_RANGE(0xd600, 0xd600) AM_WRITENOP
@ -352,12 +362,12 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( nycaptor_m68705_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( nycaptor_m68705_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_GLOBAL_MASK(0x7ff) ADDRESS_MAP_GLOBAL_MASK(0x7ff)
AM_RANGE(0x0000, 0x0000) AM_READWRITE(nycaptor_68705_portA_r,nycaptor_68705_portA_w) AM_RANGE(0x0000, 0x0000) AM_READWRITE(nycaptor_68705_port_a_r, nycaptor_68705_port_a_w)
AM_RANGE(0x0001, 0x0001) AM_READWRITE(nycaptor_68705_portB_r,nycaptor_68705_portB_w) AM_RANGE(0x0001, 0x0001) AM_READWRITE(nycaptor_68705_port_b_r, nycaptor_68705_port_b_w)
AM_RANGE(0x0002, 0x0002) AM_READWRITE(nycaptor_68705_portC_r,nycaptor_68705_portC_w) AM_RANGE(0x0002, 0x0002) AM_READWRITE(nycaptor_68705_port_c_r, nycaptor_68705_port_c_w)
AM_RANGE(0x0004, 0x0004) AM_WRITE(nycaptor_68705_ddrA_w) AM_RANGE(0x0004, 0x0004) AM_WRITE(nycaptor_68705_ddr_a_w)
AM_RANGE(0x0005, 0x0005) AM_WRITE(nycaptor_68705_ddrB_w) AM_RANGE(0x0005, 0x0005) AM_WRITE(nycaptor_68705_ddr_b_w)
AM_RANGE(0x0006, 0x0006) AM_WRITE(nycaptor_68705_ddrC_w) AM_RANGE(0x0006, 0x0006) AM_WRITE(nycaptor_68705_ddr_c_w)
AM_RANGE(0x0010, 0x007f) AM_RAM AM_RANGE(0x0010, 0x007f) AM_RAM
AM_RANGE(0x0080, 0x07ff) AM_ROM AM_RANGE(0x0080, 0x07ff) AM_ROM
ADDRESS_MAP_END ADDRESS_MAP_END
@ -368,12 +378,12 @@ ADDRESS_MAP_END
static READ8_HANDLER(cyclshtg_mcu_status_r) static READ8_HANDLER(cyclshtg_mcu_status_r)
{ {
return 0xff; return 0xff;
} }
static READ8_HANDLER(cyclshtg_mcu_r) static READ8_HANDLER(cyclshtg_mcu_r)
{ {
return 7; return 7;
} }
static WRITE8_HANDLER(cyclshtg_mcu_w) static WRITE8_HANDLER(cyclshtg_mcu_w)
@ -383,13 +393,15 @@ static WRITE8_HANDLER(cyclshtg_mcu_w)
static READ8_HANDLER(cyclshtg_mcu_status_r1) static READ8_HANDLER(cyclshtg_mcu_status_r1)
{ {
return mame_rand(space->machine); return mame_rand(space->machine);
} }
static WRITE8_HANDLER( cyclshtg_generic_control_w ) static WRITE8_HANDLER( cyclshtg_generic_control_w )
{ {
int bank=(data>>2)&3; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
generic_control_reg = data; int bank = (data >> 2) & 3;
state->generic_control_reg = data;
memory_set_bankptr(space->machine, "bank1", memory_region(space->machine, "maincpu") + 0x10000 + bank*0x4000 ); memory_set_bankptr(space->machine, "bank1", memory_region(space->machine, "maincpu") + 0x10000 + bank*0x4000 );
} }
@ -397,11 +409,11 @@ static WRITE8_HANDLER( cyclshtg_generic_control_w )
static ADDRESS_MAP_START( cyclshtg_master_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( cyclshtg_master_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
AM_RANGE(0xc000, 0xcfff) AM_READ(nycaptor_videoram_r) AM_WRITE(nycaptor_videoram_w) AM_BASE_GENERIC(videoram) AM_SIZE_GENERIC(videoram) AM_RANGE(0xc000, 0xcfff) AM_READWRITE(nycaptor_videoram_r, nycaptor_videoram_w) AM_BASE_SIZE_MEMBER(nycaptor_state, videoram, videoram_size)
AM_RANGE(0xd000, 0xd000) AM_READ(cyclshtg_mcu_r) AM_WRITE(cyclshtg_mcu_w) AM_RANGE(0xd000, 0xd000) AM_READWRITE(cyclshtg_mcu_r, cyclshtg_mcu_w)
AM_RANGE(0xd001, 0xd001) AM_WRITE(sub_cpu_halt_w) AM_RANGE(0xd001, 0xd001) AM_WRITE(sub_cpu_halt_w)
AM_RANGE(0xd002, 0xd002) AM_READ(nycaptor_generic_control_r) AM_WRITE(cyclshtg_generic_control_w) AM_RANGE(0xd002, 0xd002) AM_READWRITE(nycaptor_generic_control_r, cyclshtg_generic_control_w)
AM_RANGE(0xd400, 0xd400) AM_READ(from_snd_r) AM_WRITE(sound_command_w) AM_RANGE(0xd400, 0xd400) AM_READWRITE(from_snd_r, sound_command_w)
AM_RANGE(0xd403, 0xd403) AM_WRITE(sound_cpu_reset_w) AM_RANGE(0xd403, 0xd403) AM_WRITE(sound_cpu_reset_w)
AM_RANGE(0xd800, 0xd800) AM_READ_PORT("DSW0") AM_RANGE(0xd800, 0xd800) AM_READ_PORT("DSW0")
AM_RANGE(0xd801, 0xd801) AM_READ_PORT("DSW1") AM_RANGE(0xd801, 0xd801) AM_READ_PORT("DSW1")
@ -411,46 +423,46 @@ static ADDRESS_MAP_START( cyclshtg_master_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xd805, 0xd805) AM_READ(cyclshtg_mcu_status_r) AM_RANGE(0xd805, 0xd805) AM_READ(cyclshtg_mcu_status_r)
AM_RANGE(0xd806, 0xd806) AM_READNOP AM_RANGE(0xd806, 0xd806) AM_READNOP
AM_RANGE(0xd807, 0xd807) AM_READ(cyclshtg_mcu_status_r) AM_RANGE(0xd807, 0xd807) AM_READ(cyclshtg_mcu_status_r)
AM_RANGE(0xdc00, 0xdc9f) AM_READ(nycaptor_spriteram_r) AM_WRITE(nycaptor_spriteram_w) AM_RANGE(0xdc00, 0xdc9f) AM_READWRITE(nycaptor_spriteram_r, nycaptor_spriteram_w)
AM_RANGE(0xdca0, 0xdcbf) AM_READ(nycaptor_scrlram_r) AM_WRITE(nycaptor_scrlram_w) AM_BASE(&nycaptor_scrlram) AM_RANGE(0xdca0, 0xdcbf) AM_READWRITE(nycaptor_scrlram_r, nycaptor_scrlram_w) AM_BASE_MEMBER(nycaptor_state, scrlram)
AM_RANGE(0xdce1, 0xdce1) AM_WRITENOP AM_RANGE(0xdce1, 0xdce1) AM_WRITENOP
AM_RANGE(0xdd00, 0xdeff) AM_READ(nycaptor_palette_r) AM_WRITE(nycaptor_palette_w) AM_RANGE(0xdd00, 0xdeff) AM_READWRITE(nycaptor_palette_r, nycaptor_palette_w)
AM_RANGE(0xdf03, 0xdf03) AM_READ(nycaptor_gfxctrl_r) AM_WRITE(nycaptor_gfxctrl_w) AM_RANGE(0xdf03, 0xdf03) AM_READWRITE(nycaptor_gfxctrl_r, nycaptor_gfxctrl_w)
AM_RANGE(0xe000, 0xffff) AM_READ(nycaptor_sharedram_r) AM_WRITE(nycaptor_sharedram_w) AM_BASE(&nycaptor_sharedram) AM_RANGE(0xe000, 0xffff) AM_READWRITE(nycaptor_sharedram_r, nycaptor_sharedram_w) AM_BASE_MEMBER(nycaptor_state, sharedram)
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( cyclshtg_slave_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( cyclshtg_slave_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_ROM AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xcfff) AM_READ(nycaptor_videoram_r) AM_WRITE(nycaptor_videoram_w) AM_BASE_GENERIC(videoram) AM_SIZE_GENERIC(videoram) AM_RANGE(0xc000, 0xcfff) AM_READWRITE(nycaptor_videoram_r, nycaptor_videoram_w) AM_BASE_SIZE_MEMBER(nycaptor_state, videoram, videoram_size)
AM_RANGE(0xd800, 0xd800) AM_READ_PORT("DSW0") AM_RANGE(0xd800, 0xd800) AM_READ_PORT("DSW0")
AM_RANGE(0xd801, 0xd801) AM_READ_PORT("DSW1") AM_RANGE(0xd801, 0xd801) AM_READ_PORT("DSW1")
AM_RANGE(0xd802, 0xd802) AM_READ_PORT("DSW2") AM_RANGE(0xd802, 0xd802) AM_READ_PORT("DSW2")
AM_RANGE(0xd803, 0xd803) AM_READ_PORT("IN0") AM_RANGE(0xd803, 0xd803) AM_READ_PORT("IN0")
AM_RANGE(0xd804, 0xd804) AM_READ_PORT("IN1") AM_RANGE(0xd804, 0xd804) AM_READ_PORT("IN1")
AM_RANGE(0xdc00, 0xdc9f) AM_READ(nycaptor_spriteram_r) AM_WRITE(nycaptor_spriteram_w) AM_RANGE(0xdc00, 0xdc9f) AM_READWRITE(nycaptor_spriteram_r, nycaptor_spriteram_w)
AM_RANGE(0xdca0, 0xdcbf) AM_WRITE(nycaptor_scrlram_w) AM_BASE(&nycaptor_scrlram) AM_RANGE(0xdca0, 0xdcbf) AM_WRITE(nycaptor_scrlram_w) AM_BASE_MEMBER(nycaptor_state, scrlram)
AM_RANGE(0xdd00, 0xdeff) AM_READ(nycaptor_palette_r) AM_WRITE(nycaptor_palette_w) AM_RANGE(0xdd00, 0xdeff) AM_READWRITE(nycaptor_palette_r, nycaptor_palette_w)
AM_RANGE(0xdf00, 0xdf00) AM_READ(nycaptor_bx_r) AM_RANGE(0xdf00, 0xdf00) AM_READ(nycaptor_bx_r)
AM_RANGE(0xdf01, 0xdf01) AM_READ(nycaptor_by_r) AM_RANGE(0xdf01, 0xdf01) AM_READ(nycaptor_by_r)
AM_RANGE(0xdf02, 0xdf02) AM_READ(nycaptor_b_r) AM_RANGE(0xdf02, 0xdf02) AM_READ(nycaptor_b_r)
AM_RANGE(0xdf03, 0xdf03) AM_READ(nycaptor_gfxctrl_r) AM_RANGE(0xdf03, 0xdf03) AM_READ(nycaptor_gfxctrl_r)
AM_RANGE(0xdf03, 0xdf03) AM_WRITENOP AM_RANGE(0xdf03, 0xdf03) AM_WRITENOP
AM_RANGE(0xe000, 0xffff) AM_READ(nycaptor_sharedram_r) AM_WRITE(nycaptor_sharedram_w) AM_RANGE(0xe000, 0xffff) AM_READWRITE(nycaptor_sharedram_r, nycaptor_sharedram_w)
ADDRESS_MAP_END ADDRESS_MAP_END
static READ8_HANDLER(unk_r) static READ8_HANDLER( unk_r )
{ {
return mame_rand(space->machine); return mame_rand(space->machine);
} }
static ADDRESS_MAP_START( bronx_master_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( bronx_master_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
AM_RANGE(0xc000, 0xcfff) AM_READ(nycaptor_videoram_r) AM_WRITE(nycaptor_videoram_w) AM_BASE_GENERIC(videoram) AM_SIZE_GENERIC(videoram) AM_RANGE(0xc000, 0xcfff) AM_READWRITE(nycaptor_videoram_r, nycaptor_videoram_w) AM_BASE_SIZE_MEMBER(nycaptor_state, videoram, videoram_size)
AM_RANGE(0xd000, 0xd000) AM_READ(cyclshtg_mcu_r) AM_WRITENOP AM_RANGE(0xd000, 0xd000) AM_READ(cyclshtg_mcu_r) AM_WRITENOP
AM_RANGE(0xd001, 0xd001) AM_WRITE(sub_cpu_halt_w) AM_RANGE(0xd001, 0xd001) AM_WRITE(sub_cpu_halt_w)
AM_RANGE(0xd002, 0xd002) AM_READ(nycaptor_generic_control_r) AM_WRITE(cyclshtg_generic_control_w) AM_RANGE(0xd002, 0xd002) AM_READWRITE(nycaptor_generic_control_r, cyclshtg_generic_control_w)
AM_RANGE(0xd400, 0xd400) AM_READ(from_snd_r) AM_WRITE(sound_command_w) AM_RANGE(0xd400, 0xd400) AM_READWRITE(from_snd_r, sound_command_w)
AM_RANGE(0xd401, 0xd401) AM_READ(unk_r) AM_RANGE(0xd401, 0xd401) AM_READ(unk_r)
AM_RANGE(0xd403, 0xd403) AM_WRITE(sound_cpu_reset_w) AM_RANGE(0xd403, 0xd403) AM_WRITE(sound_cpu_reset_w)
AM_RANGE(0xd800, 0xd800) AM_READ_PORT("DSW0") AM_RANGE(0xd800, 0xd800) AM_READ_PORT("DSW0")
@ -461,16 +473,16 @@ static ADDRESS_MAP_START( bronx_master_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xd805, 0xd805) AM_READ(cyclshtg_mcu_status_r) AM_RANGE(0xd805, 0xd805) AM_READ(cyclshtg_mcu_status_r)
AM_RANGE(0xd806, 0xd806) AM_READNOP AM_RANGE(0xd806, 0xd806) AM_READNOP
AM_RANGE(0xd807, 0xd807) AM_READ(cyclshtg_mcu_status_r) AM_RANGE(0xd807, 0xd807) AM_READ(cyclshtg_mcu_status_r)
AM_RANGE(0xdc00, 0xdc9f) AM_READ(nycaptor_spriteram_r) AM_WRITE(nycaptor_spriteram_w) AM_RANGE(0xdc00, 0xdc9f) AM_READWRITE(nycaptor_spriteram_r, nycaptor_spriteram_w)
AM_RANGE(0xdca0, 0xdcbf) AM_READ(nycaptor_scrlram_r) AM_WRITE(nycaptor_scrlram_w) AM_BASE(&nycaptor_scrlram) AM_RANGE(0xdca0, 0xdcbf) AM_READWRITE(nycaptor_scrlram_r, nycaptor_scrlram_w) AM_BASE_MEMBER(nycaptor_state, scrlram)
AM_RANGE(0xdd00, 0xdeff) AM_READ(nycaptor_palette_r) AM_WRITE(nycaptor_palette_w) AM_RANGE(0xdd00, 0xdeff) AM_READWRITE(nycaptor_palette_r, nycaptor_palette_w)
AM_RANGE(0xdf03, 0xdf03) AM_READ(nycaptor_gfxctrl_r) AM_WRITE(nycaptor_gfxctrl_w) AM_RANGE(0xdf03, 0xdf03) AM_READWRITE(nycaptor_gfxctrl_r, nycaptor_gfxctrl_w)
AM_RANGE(0xe000, 0xffff) AM_READ(nycaptor_sharedram_r) AM_WRITE(nycaptor_sharedram_w) AM_BASE(&nycaptor_sharedram) AM_RANGE(0xe000, 0xffff) AM_READWRITE(nycaptor_sharedram_r, nycaptor_sharedram_w) AM_BASE_MEMBER(nycaptor_state, sharedram)
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( bronx_slave_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( bronx_slave_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0xc000, 0xcfff) AM_READ(nycaptor_videoram_r) AM_WRITE(nycaptor_videoram_w) AM_BASE_GENERIC(videoram) AM_SIZE_GENERIC(videoram) AM_RANGE(0xc000, 0xcfff) AM_READWRITE(nycaptor_videoram_r, nycaptor_videoram_w) AM_BASE_SIZE_MEMBER(nycaptor_state, videoram, videoram_size)
AM_RANGE(0xd800, 0xd800) AM_READ_PORT("DSW0") AM_RANGE(0xd800, 0xd800) AM_READ_PORT("DSW0")
AM_RANGE(0xd801, 0xd801) AM_READ_PORT("DSW1") AM_RANGE(0xd801, 0xd801) AM_READ_PORT("DSW1")
AM_RANGE(0xd802, 0xd802) AM_READ_PORT("DSW2") AM_RANGE(0xd802, 0xd802) AM_READ_PORT("DSW2")
@ -478,14 +490,14 @@ static ADDRESS_MAP_START( bronx_slave_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xd804, 0xd804) AM_READ_PORT("IN1") AM_RANGE(0xd804, 0xd804) AM_READ_PORT("IN1")
AM_RANGE(0xd805, 0xd805) AM_READ(cyclshtg_mcu_status_r1) AM_RANGE(0xd805, 0xd805) AM_READ(cyclshtg_mcu_status_r1)
AM_RANGE(0xd807, 0xd807) AM_READ(cyclshtg_mcu_status_r) AM_RANGE(0xd807, 0xd807) AM_READ(cyclshtg_mcu_status_r)
AM_RANGE(0xdc00, 0xdc9f) AM_READ(nycaptor_spriteram_r) AM_WRITE(nycaptor_spriteram_w) AM_RANGE(0xdc00, 0xdc9f) AM_READWRITE(nycaptor_spriteram_r, nycaptor_spriteram_w)
AM_RANGE(0xdca0, 0xdcbf) AM_WRITE(nycaptor_scrlram_w) AM_BASE(&nycaptor_scrlram) AM_RANGE(0xdca0, 0xdcbf) AM_WRITE(nycaptor_scrlram_w) AM_BASE_MEMBER(nycaptor_state, scrlram)
AM_RANGE(0xdd00, 0xdeff) AM_READ(nycaptor_palette_r) AM_WRITE(nycaptor_palette_w) AM_RANGE(0xdd00, 0xdeff) AM_READWRITE(nycaptor_palette_r, nycaptor_palette_w)
AM_RANGE(0xdf00, 0xdf00) AM_READ(nycaptor_bx_r) AM_RANGE(0xdf00, 0xdf00) AM_READ(nycaptor_bx_r)
AM_RANGE(0xdf01, 0xdf01) AM_READ(nycaptor_by_r) AM_RANGE(0xdf01, 0xdf01) AM_READ(nycaptor_by_r)
AM_RANGE(0xdf02, 0xdf02) AM_READ(nycaptor_b_r) AM_RANGE(0xdf02, 0xdf02) AM_READ(nycaptor_b_r)
AM_RANGE(0xdf03, 0xdf03) AM_READ(nycaptor_gfxctrl_r) AM_WRITE(nycaptor_gfxctrl_w) AM_RANGE(0xdf03, 0xdf03) AM_READWRITE(nycaptor_gfxctrl_r, nycaptor_gfxctrl_w)
AM_RANGE(0xe000, 0xffff) AM_READ(nycaptor_sharedram_r) AM_WRITE(nycaptor_sharedram_w) AM_RANGE(0xe000, 0xffff) AM_READWRITE(nycaptor_sharedram_r, nycaptor_sharedram_w)
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( bronx_slave_io_map, ADDRESS_SPACE_IO, 8 ) static ADDRESS_MAP_START( bronx_slave_io_map, ADDRESS_SPACE_IO, 8 )
@ -683,7 +695,77 @@ GFXDECODE_END
static MACHINE_START( nycaptor )
{
nycaptor_state *state = (nycaptor_state *)machine->driver_data;
state->maincpu = devtag_get_device(machine, "maincpu");
state->audiocpu = devtag_get_device(machine, "audiocpu");
state->subcpu = devtag_get_device(machine, "sub");
state->mcu = devtag_get_device(machine, "mcu");
state_save_register_global(machine, state->generic_control_reg);
state_save_register_global(machine, state->sound_nmi_enable);
state_save_register_global(machine, state->pending_nmi);
state_save_register_global(machine, state->snd_data);
state_save_register_global_array(machine, state->vol_ctrl);
state_save_register_global(machine, state->char_bank);
state_save_register_global(machine, state->palette_bank);
state_save_register_global(machine, state->gfxctrl);
state_save_register_global(machine, state->port_a_in);
state_save_register_global(machine, state->port_a_out);
state_save_register_global(machine, state->ddr_a);
state_save_register_global(machine, state->port_b_in);
state_save_register_global(machine, state->port_b_out);
state_save_register_global(machine, state->ddr_b);
state_save_register_global(machine, state->port_c_in);
state_save_register_global(machine, state->port_c_out);
state_save_register_global(machine, state->ddr_c);
state_save_register_global(machine, state->mcu_sent);
state_save_register_global(machine, state->main_sent);
state_save_register_global(machine, state->from_main);
state_save_register_global(machine, state->from_mcu);
}
static MACHINE_RESET( nycaptor )
{
nycaptor_state *state = (nycaptor_state *)machine->driver_data;
MACHINE_RESET_CALL(ta7630);
state->generic_control_reg = 0;
state->sound_nmi_enable = 0;
state->pending_nmi = 0;
state->snd_data = 0;
state->char_bank = 0;
state->palette_bank = 0;
state->gfxctrl = 0;
state->port_a_in = 0;
state->port_a_out = 0;
state->ddr_a = 0;
state->port_b_in = 0;
state->port_b_out = 0;
state->ddr_b = 0;
state->port_c_in = 0;
state->port_c_out = 0;
state->ddr_c = 0;
state->mcu_sent = 0;
state->main_sent = 0;
state->from_main = 0;
state->from_mcu = 0;
memset(state->vol_ctrl, 0, ARRAY_LENGTH(state->vol_ctrl));
}
static MACHINE_DRIVER_START( nycaptor ) static MACHINE_DRIVER_START( nycaptor )
/* driver data */
MDRV_DRIVER_DATA(nycaptor_state)
/* basic machine hardware */ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", Z80,8000000/2) /* ??? */ MDRV_CPU_ADD("maincpu", Z80,8000000/2) /* ??? */
MDRV_CPU_PROGRAM_MAP(nycaptor_master_map) MDRV_CPU_PROGRAM_MAP(nycaptor_master_map)
@ -702,7 +784,8 @@ static MACHINE_DRIVER_START( nycaptor )
MDRV_QUANTUM_TIME(HZ(6000)) /* 100 CPU slices per frame - an high value to ensure proper synchronization of the CPUs */ MDRV_QUANTUM_TIME(HZ(6000)) /* 100 CPU slices per frame - an high value to ensure proper synchronization of the CPUs */
MDRV_MACHINE_RESET(ta7630) MDRV_MACHINE_START(nycaptor)
MDRV_MACHINE_RESET(nycaptor)
/* video hardware */ /* video hardware */
MDRV_SCREEN_ADD("screen", RASTER) MDRV_SCREEN_ADD("screen", RASTER)
@ -745,6 +828,10 @@ static MACHINE_DRIVER_START( nycaptor )
MACHINE_DRIVER_END MACHINE_DRIVER_END
static MACHINE_DRIVER_START( cyclshtg ) static MACHINE_DRIVER_START( cyclshtg )
/* driver data */
MDRV_DRIVER_DATA(nycaptor_state)
MDRV_CPU_ADD("maincpu", Z80,8000000/2) MDRV_CPU_ADD("maincpu", Z80,8000000/2)
MDRV_CPU_PROGRAM_MAP(cyclshtg_master_map) MDRV_CPU_PROGRAM_MAP(cyclshtg_master_map)
MDRV_CPU_VBLANK_INT("screen", irq0_line_hold) MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
@ -763,7 +850,8 @@ static MACHINE_DRIVER_START( cyclshtg )
#endif #endif
MDRV_QUANTUM_TIME(HZ(60)) MDRV_QUANTUM_TIME(HZ(60))
MDRV_MACHINE_RESET(ta7630) MDRV_MACHINE_START(nycaptor)
MDRV_MACHINE_RESET(nycaptor)
MDRV_SCREEN_ADD("screen", RASTER) MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60) MDRV_SCREEN_REFRESH_RATE(60)
@ -805,6 +893,10 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( bronx ) static MACHINE_DRIVER_START( bronx )
/* driver data */
MDRV_DRIVER_DATA(nycaptor_state)
MDRV_CPU_ADD("maincpu", Z80,8000000/2) MDRV_CPU_ADD("maincpu", Z80,8000000/2)
MDRV_CPU_PROGRAM_MAP(bronx_master_map) MDRV_CPU_PROGRAM_MAP(bronx_master_map)
MDRV_CPU_VBLANK_INT("screen", irq0_line_hold) MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
@ -819,7 +911,8 @@ static MACHINE_DRIVER_START( bronx )
MDRV_CPU_PERIODIC_INT(irq0_line_hold,2*60) MDRV_CPU_PERIODIC_INT(irq0_line_hold,2*60)
MDRV_QUANTUM_TIME(HZ(120)) MDRV_QUANTUM_TIME(HZ(120))
MDRV_MACHINE_RESET(ta7630) MDRV_MACHINE_START(nycaptor)
MDRV_MACHINE_RESET(nycaptor)
MDRV_SCREEN_ADD("screen", RASTER) MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60) MDRV_SCREEN_REFRESH_RATE(60)
@ -1189,36 +1282,44 @@ ROM_START( colt )
ROM_LOAD( "a50_14", 0x1c000, 0x4000, CRC(24b2f1bf) SHA1(4757aec2e4b99ce33d993ce1e19ee46a4eb76e86) ) ROM_LOAD( "a50_14", 0x1c000, 0x4000, CRC(24b2f1bf) SHA1(4757aec2e4b99ce33d993ce1e19ee46a4eb76e86) )
ROM_END ROM_END
static DRIVER_INIT(bronx) static DRIVER_INIT( bronx )
{ {
nycaptor_state *state = (nycaptor_state *)machine->driver_data;
int i; int i;
UINT8 *rom = memory_region(machine, "maincpu"); UINT8 *rom = memory_region(machine, "maincpu");
for(i=0;i<0x20000;i++)
rom[i]=BITSWAP8(rom[i],0,1,2,3,4,5,6,7); for (i = 0; i < 0x20000; i++)
nyc_gametype=1; rom[i] = BITSWAP8(rom[i], 0, 1, 2, 3, 4, 5, 6, 7);
state->gametype = 1;
} }
static DRIVER_INIT(colt) static DRIVER_INIT( colt )
{ {
nycaptor_state *state = (nycaptor_state *)machine->driver_data;
int i; int i;
UINT8 *rom = memory_region(machine, "maincpu"); UINT8 *rom = memory_region(machine, "maincpu");
for(i=0;i<0x20000;i++)
rom[i]=BITSWAP8(rom[i],0,1,2,3,4,5,6,7); for (i = 0; i < 0x20000; i++)
nyc_gametype=2; rom[i] = BITSWAP8(rom[i], 0, 1, 2, 3, 4, 5, 6, 7);
state->gametype = 2;
} }
static DRIVER_INIT(nycaptor) static DRIVER_INIT( nycaptor )
{ {
nyc_gametype=0; nycaptor_state *state = (nycaptor_state *)machine->driver_data;
state->gametype = 0;
} }
static DRIVER_INIT(cyclshtg) static DRIVER_INIT( cyclshtg )
{ {
nyc_gametype=1; nycaptor_state *state = (nycaptor_state *)machine->driver_data;
state->gametype = 1;
} }
GAME( 1985, nycaptor, 0, nycaptor, nycaptor, nycaptor, ROT0, "Taito", "N.Y. Captor", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) GAME( 1985, nycaptor, 0, nycaptor, nycaptor, nycaptor, ROT0, "Taito", "N.Y. Captor", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
GAME( 1986, cyclshtg, 0, cyclshtg, cyclshtg, cyclshtg, ROT90, "Taito", "Cycle Shooting", GAME_NOT_WORKING) GAME( 1986, cyclshtg, 0, cyclshtg, cyclshtg, cyclshtg, ROT90, "Taito", "Cycle Shooting", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
/* bootlegs */ /* bootlegs */
GAME( 1986, bronx, cyclshtg, bronx, cyclshtg, bronx, ROT90, "bootleg", "Bronx",GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND) GAME( 1986, bronx, cyclshtg, bronx, cyclshtg, bronx, ROT90, "bootleg", "Bronx", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
GAME( 1986, colt , nycaptor, bronx, nycaptor, colt, ROT0, "bootleg", "Colt",GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND|GAME_WRONG_COLORS) GAME( 1986, colt , nycaptor, bronx, nycaptor, colt, ROT0, "bootleg", "Colt", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE )

View File

@ -1,10 +1,23 @@
/*----------- defined in video/news.c -----------*/
extern UINT8 *news_fgram; typedef struct _news_state news_state;
extern UINT8 *news_bgram; struct _news_state
{
/* memory pointers */
UINT8 * bgram;
UINT8 * fgram;
// UINT8 * paletteram; // currently this uses generic palette handling
/* video-related */
tilemap_t *fg_tilemap, *bg_tilemap;
int bgpic;
};
/*----------- defined in video/news.c -----------*/
WRITE8_HANDLER( news_fgram_w ); WRITE8_HANDLER( news_fgram_w );
WRITE8_HANDLER( news_bgram_w ); WRITE8_HANDLER( news_bgram_w );
WRITE8_HANDLER( news_bgpic_w ); WRITE8_HANDLER( news_bgpic_w );
VIDEO_START( news ); VIDEO_START( news );
VIDEO_UPDATE( news ); VIDEO_UPDATE( news );

View File

@ -15,6 +15,33 @@
#define NITEDRVR_ATTRACT_EN NODE_06 #define NITEDRVR_ATTRACT_EN NODE_06
typedef struct _nitedrvr_state nitedrvr_state;
struct _nitedrvr_state
{
/* memory pointers */
UINT8 * hvc;
UINT8 * videoram;
/* video-related */
tilemap_t *bg_tilemap;
/* input */
UINT8 gear;
UINT8 track;
INT32 steering_buf;
INT32 steering_val;
UINT8 crash_en;
UINT8 crash_data;
UINT8 crash_data_en; // IC D8
UINT8 ac_line;
INT32 last_steering_val;
/* devices */
running_device *maincpu;
running_device *discrete;
};
/*----------- defined in machine/nitedrvr.c -----------*/ /*----------- defined in machine/nitedrvr.c -----------*/
READ8_HANDLER( nitedrvr_in0_r ); READ8_HANDLER( nitedrvr_in0_r );
@ -37,8 +64,6 @@ DISCRETE_SOUND_EXTERN( nitedrvr );
/*----------- defined in video/nitedrvr.c -----------*/ /*----------- defined in video/nitedrvr.c -----------*/
extern UINT8 *nitedrvr_hvc;
WRITE8_HANDLER( nitedrvr_hvc_w ); WRITE8_HANDLER( nitedrvr_hvc_w );
WRITE8_HANDLER( nitedrvr_videoram_w ); WRITE8_HANDLER( nitedrvr_videoram_w );

View File

@ -1,7 +1,38 @@
/*----------- defined in drivers/nycaptor.c -----------*/
extern UINT8 *nycaptor_sharedram; typedef struct _nycaptor_state nycaptor_state;
extern int nyc_gametype; struct _nycaptor_state
{
/* memory pointers */
UINT8 * sharedram;
UINT8 * scrlram;
UINT8 * videoram;
UINT8 * spriteram;
size_t videoram_size;
/* video-related */
tilemap_t *bg_tilemap;
int char_bank, palette_bank, gfxctrl;
/* mcu */
UINT8 from_main, from_mcu;
int mcu_sent, main_sent;
UINT8 port_a_in, port_a_out, ddr_a;
UINT8 port_b_in, port_b_out, ddr_b;
UINT8 port_c_in, port_c_out, ddr_c;
/* misc */
int generic_control_reg;
int sound_nmi_enable, pending_nmi;
UINT8 snd_data;
int vol_ctrl[16];
int gametype;
/* devices */
running_device *maincpu;
running_device *audiocpu;
running_device *subcpu;
running_device *mcu;
};
/*----------- defined in machine/nycaptor.c -----------*/ /*----------- defined in machine/nycaptor.c -----------*/
@ -9,27 +40,21 @@ extern int nyc_gametype;
READ8_HANDLER( nycaptor_mcu_r ); READ8_HANDLER( nycaptor_mcu_r );
READ8_HANDLER( nycaptor_mcu_status_r1 ); READ8_HANDLER( nycaptor_mcu_status_r1 );
READ8_HANDLER( nycaptor_mcu_status_r2 ); READ8_HANDLER( nycaptor_mcu_status_r2 );
READ8_HANDLER( nycaptor_68705_portC_r ); READ8_HANDLER( nycaptor_68705_port_c_r );
READ8_HANDLER( nycaptor_68705_portB_r ); READ8_HANDLER( nycaptor_68705_port_b_r );
READ8_HANDLER( nycaptor_68705_portA_r ); READ8_HANDLER( nycaptor_68705_port_a_r );
WRITE8_HANDLER( nycaptor_mcu_w ); WRITE8_HANDLER( nycaptor_mcu_w );
WRITE8_HANDLER( nycaptor_68705_portA_w ); WRITE8_HANDLER( nycaptor_68705_port_a_w );
WRITE8_HANDLER( nycaptor_68705_portB_w ); WRITE8_HANDLER( nycaptor_68705_port_b_w );
WRITE8_HANDLER( nycaptor_68705_portC_w ); WRITE8_HANDLER( nycaptor_68705_port_c_w );
WRITE8_HANDLER( nycaptor_68705_ddrA_w ); WRITE8_HANDLER( nycaptor_68705_ddr_a_w );
WRITE8_HANDLER( nycaptor_68705_ddrB_w ); WRITE8_HANDLER( nycaptor_68705_ddr_b_w );
WRITE8_HANDLER( nycaptor_68705_ddrC_w ); WRITE8_HANDLER( nycaptor_68705_ddr_c_w );
/*----------- defined in video/nycaptor.c -----------*/ /*----------- defined in video/nycaptor.c -----------*/
extern UINT8 *nycaptor_scrlram;
VIDEO_START( nycaptor );
VIDEO_UPDATE( nycaptor );
READ8_HANDLER( nycaptor_videoram_r ); READ8_HANDLER( nycaptor_videoram_r );
READ8_HANDLER( nycaptor_spriteram_r ); READ8_HANDLER( nycaptor_spriteram_r );
READ8_HANDLER( nycaptor_palette_r ); READ8_HANDLER( nycaptor_palette_r );
@ -41,3 +66,6 @@ WRITE8_HANDLER( nycaptor_spriteram_w );
WRITE8_HANDLER( nycaptor_palette_w ); WRITE8_HANDLER( nycaptor_palette_w );
WRITE8_HANDLER( nycaptor_gfxctrl_w ); WRITE8_HANDLER( nycaptor_gfxctrl_w );
WRITE8_HANDLER( nycaptor_scrlram_w ); WRITE8_HANDLER( nycaptor_scrlram_w );
VIDEO_START( nycaptor );
VIDEO_UPDATE( nycaptor );

View File

@ -8,16 +8,6 @@
#include "includes/nitedrvr.h" #include "includes/nitedrvr.h"
#include "sound/discrete.h" #include "sound/discrete.h"
static UINT8 nitedrvr_gear;
static UINT8 nitedrvr_track;
static INT32 nitedrvr_steering_buf;
static INT32 nitedrvr_steering_val;
static UINT8 nitedrvr_crash_en;
static UINT8 nitedrvr_crash_data;
static UINT8 nitedrvr_crash_data_en; // IC D8
static UINT8 ac_line;
static INT32 last_steering_val;
/*************************************************************************** /***************************************************************************
Steering Steering
@ -27,50 +17,56 @@ Be sure to keep returning a direction until steering_reset is called,
because D6 and D7 are apparently checked at different times, and a because D6 and D7 are apparently checked at different times, and a
change in-between can affect the direction you move. change in-between can affect the direction you move.
***************************************************************************/ ***************************************************************************/
static int nitedrvr_steering(running_machine *machine)
static int nitedrvr_steering( running_machine *machine )
{ {
int this_val; nitedrvr_state *state = (nitedrvr_state *)machine->driver_data;
int delta; int this_val = input_port_read(machine, "STEER");
int delta = this_val - state->last_steering_val;
this_val = input_port_read(machine, "STEER"); state->last_steering_val = this_val;
if (delta > 128)
delta -= 256;
else if (delta < -128)
delta += 256;
delta=this_val-last_steering_val;
last_steering_val=this_val;
if (delta>128) delta-=256;
else if (delta<-128) delta+=256;
/* Divide by four to make our steering less sensitive */ /* Divide by four to make our steering less sensitive */
nitedrvr_steering_buf+=(delta/4); state->steering_buf += (delta / 4);
if (nitedrvr_steering_buf>0) if (state->steering_buf > 0)
{ {
nitedrvr_steering_buf--; state->steering_buf--;
nitedrvr_steering_val=0xC0; state->steering_val = 0xc0;
} }
else if (nitedrvr_steering_buf<0) else if (state->steering_buf < 0)
{ {
nitedrvr_steering_buf++; state->steering_buf++;
nitedrvr_steering_val=0x80; state->steering_val = 0x80;
} }
else else
{ {
nitedrvr_steering_val=0x00; state->steering_val = 0x00;
} }
return nitedrvr_steering_val; return state->steering_val;
} }
/*************************************************************************** /***************************************************************************
nitedrvr_steering_reset nitedrvr_steering_reset
***************************************************************************/ ***************************************************************************/
READ8_HANDLER( nitedrvr_steering_reset_r ) READ8_HANDLER( nitedrvr_steering_reset_r )
{ {
nitedrvr_steering_val = 0; nitedrvr_state *state = (nitedrvr_state *)space->machine->driver_data;
state->steering_val = 0;
return 0; return 0;
} }
WRITE8_HANDLER( nitedrvr_steering_reset_w ) WRITE8_HANDLER( nitedrvr_steering_reset_w )
{ {
nitedrvr_steering_val = 0; nitedrvr_state *state = (nitedrvr_state *)space->machine->driver_data;
state->steering_val = 0;
} }
@ -104,13 +100,13 @@ Fill in the steering and gear bits in a special way.
READ8_HANDLER( nitedrvr_in0_r ) READ8_HANDLER( nitedrvr_in0_r )
{ {
int gear; nitedrvr_state *state = (nitedrvr_state *)space->machine->driver_data;
int gear = input_port_read(space->machine, "GEARS");
gear = input_port_read(space->machine, "GEARS"); if (gear & 0x10) state->gear = 1;
if (gear & 0x10) nitedrvr_gear=1; else if (gear & 0x20) state->gear = 2;
else if (gear & 0x20) nitedrvr_gear=2; else if (gear & 0x40) state->gear = 3;
else if (gear & 0x40) nitedrvr_gear=3; else if (gear & 0x80) state->gear = 4;
else if (gear & 0x80) nitedrvr_gear=4;
switch (offset & 0x03) switch (offset & 0x03)
{ {
@ -119,14 +115,18 @@ READ8_HANDLER( nitedrvr_in0_r )
case 0x01: /* No remapping necessary */ case 0x01: /* No remapping necessary */
return input_port_read(space->machine, "DSW1"); return input_port_read(space->machine, "DSW1");
case 0x02: /* Remap our gear shift */ case 0x02: /* Remap our gear shift */
if (nitedrvr_gear==1) return 0xE0; if (state->gear == 1)
else if (nitedrvr_gear==2) return 0xD0; return 0xe0;
else if (nitedrvr_gear==3) return 0xB0; else if (state->gear == 2)
else return 0x70; return 0xd0;
else if (state->gear == 3)
return 0xb0;
else
return 0x70;
case 0x03: /* Remap our steering */ case 0x03: /* Remap our steering */
return (input_port_read(space->machine, "DSW2") | nitedrvr_steering(space->machine)); return (input_port_read(space->machine, "DSW2") | nitedrvr_steering(space->machine));
default: default:
return 0xFF; return 0xff;
} }
} }
@ -164,14 +164,14 @@ Fill in the track difficulty switch and special signal in a special way.
READ8_HANDLER( nitedrvr_in1_r ) READ8_HANDLER( nitedrvr_in1_r )
{ {
int port; nitedrvr_state *state = (nitedrvr_state *)space->machine->driver_data;
int port = input_port_read(space->machine, "IN0");
ac_line=(ac_line+1) % 3; state->ac_line = (state->ac_line + 1) % 3;
port = input_port_read(space->machine, "IN0"); if (port & 0x10) state->track = 0;
if (port & 0x10) nitedrvr_track=0; else if (port & 0x20) state->track = 1;
else if (port & 0x20) nitedrvr_track=1; else if (port & 0x40) state->track = 2;
else if (port & 0x40) nitedrvr_track=2;
switch (offset & 0x07) switch (offset & 0x07)
{ {
@ -184,16 +184,16 @@ READ8_HANDLER( nitedrvr_in1_r )
case 0x03: case 0x03:
return ((port & 0x08) << 4); return ((port & 0x08) << 4);
case 0x04: case 0x04:
if (nitedrvr_track == 1) return 0x80; else return 0x00; if (state->track == 1) return 0x80; else return 0x00;
case 0x05: case 0x05:
if (nitedrvr_track == 0) return 0x80; else return 0x00; if (state->track == 0) return 0x80; else return 0x00;
case 0x06: case 0x06:
/* TODO: fix alternating signal? */ /* TODO: fix alternating signal? */
if (ac_line==0) return 0x80; else return 0x00; if (state->ac_line==0) return 0x80; else return 0x00;
case 0x07: case 0x07:
return 0x00; return 0x00;
default: default:
return 0xFF; return 0xff;
} }
} }
@ -209,12 +209,14 @@ D3 = !SPEED4
D4 = SKID1 D4 = SKID1
D5 = SKID2 D5 = SKID2
***************************************************************************/ ***************************************************************************/
WRITE8_HANDLER( nitedrvr_out0_w ) WRITE8_HANDLER( nitedrvr_out0_w )
{ {
running_device *discrete = devtag_get_device(space->machine, "discrete"); nitedrvr_state *state = (nitedrvr_state *)space->machine->driver_data;
discrete_sound_w(discrete, NITEDRVR_MOTOR_DATA, data & 0x0f); // Motor freq data
discrete_sound_w(discrete, NITEDRVR_SKID1_EN, data & 0x10); // Skid1 enable discrete_sound_w(state->discrete, NITEDRVR_MOTOR_DATA, data & 0x0f); // Motor freq data
discrete_sound_w(discrete, NITEDRVR_SKID2_EN, data & 0x20); // Skid2 enable discrete_sound_w(state->discrete, NITEDRVR_SKID1_EN, data & 0x10); // Skid1 enable
discrete_sound_w(state->discrete, NITEDRVR_SKID2_EN, data & 0x20); // Skid2 enable
} }
/*************************************************************************** /***************************************************************************
@ -227,75 +229,86 @@ D3 = Not used?
D4 = LED START D4 = LED START
D5 = Spare (Not used) D5 = Spare (Not used)
***************************************************************************/ ***************************************************************************/
WRITE8_HANDLER( nitedrvr_out1_w ) WRITE8_HANDLER( nitedrvr_out1_w )
{ {
running_device *discrete = devtag_get_device(space->machine, "discrete"); nitedrvr_state *state = (nitedrvr_state *)space->machine->driver_data;
set_led_status(space->machine, 0,data & 0x10); set_led_status(space->machine, 0, data & 0x10);
nitedrvr_crash_en = data & 0x01; state->crash_en = data & 0x01;
discrete_sound_w(discrete, NITEDRVR_CRASH_EN, nitedrvr_crash_en); // Crash enable
discrete_sound_w(discrete, NITEDRVR_ATTRACT_EN, data & 0x02); // Attract enable (sound disable)
if (!nitedrvr_crash_en) discrete_sound_w(state->discrete, NITEDRVR_CRASH_EN, state->crash_en); // Crash enable
discrete_sound_w(state->discrete, NITEDRVR_ATTRACT_EN, data & 0x02); // Attract enable (sound disable)
if (!state->crash_en)
{ {
/* Crash reset, set counter high and enable output */ /* Crash reset, set counter high and enable output */
nitedrvr_crash_data_en = 1; state->crash_data_en = 1;
nitedrvr_crash_data = 0x0f; state->crash_data = 0x0f;
/* Invert video */ /* Invert video */
palette_set_color(space->machine,1,MAKE_RGB(0x00,0x00,0x00)); /* BLACK */ palette_set_color(space->machine, 1, MAKE_RGB(0x00,0x00,0x00)); /* BLACK */
palette_set_color(space->machine,0,MAKE_RGB(0xff,0xff,0xff)); /* WHITE */ palette_set_color(space->machine, 0, MAKE_RGB(0xff,0xff,0xff)); /* WHITE */
} }
discrete_sound_w(discrete, NITEDRVR_BANG_DATA, nitedrvr_crash_data_en ? nitedrvr_crash_data : 0); // Crash Volume discrete_sound_w(state->discrete, NITEDRVR_BANG_DATA, state->crash_data_en ? state->crash_data : 0); // Crash Volume
} }
TIMER_DEVICE_CALLBACK( nitedrvr_crash_toggle_callback ) TIMER_DEVICE_CALLBACK( nitedrvr_crash_toggle_callback )
{ {
if (nitedrvr_crash_en && nitedrvr_crash_data_en) nitedrvr_state *state = (nitedrvr_state *)timer->machine->driver_data;
{
running_device *discrete = devtag_get_device(timer->machine, "discrete");
nitedrvr_crash_data--; if (state->crash_en && state->crash_data_en)
discrete_sound_w(discrete, NITEDRVR_BANG_DATA, nitedrvr_crash_data); // Crash Volume {
if (!nitedrvr_crash_data) nitedrvr_crash_data_en = 0; // Done counting? state->crash_data--;
if (nitedrvr_crash_data & 0x01) discrete_sound_w(state->discrete, NITEDRVR_BANG_DATA, state->crash_data); // Crash Volume
if (!state->crash_data)
state->crash_data_en = 0; // Done counting?
if (state->crash_data & 0x01)
{ {
/* Invert video */ /* Invert video */
palette_set_color(timer->machine,1,MAKE_RGB(0x00,0x00,0x00)); /* BLACK */ palette_set_color(timer->machine, 1, MAKE_RGB(0x00,0x00,0x00)); /* BLACK */
palette_set_color(timer->machine,0,MAKE_RGB(0xff,0xff,0xff)); /* WHITE */ palette_set_color(timer->machine, 0, MAKE_RGB(0xff,0xff,0xff)); /* WHITE */
} }
else else
{ {
/* Normal video */ /* Normal video */
palette_set_color(timer->machine,0,MAKE_RGB(0x00,0x00,0x00)); /* BLACK */ palette_set_color(timer->machine, 0, MAKE_RGB(0x00,0x00,0x00)); /* BLACK */
palette_set_color(timer->machine,1,MAKE_RGB(0xff,0xff,0xff)); /* WHITE */ palette_set_color(timer->machine, 1, MAKE_RGB(0xff,0xff,0xff)); /* WHITE */
} }
} }
} }
MACHINE_START( nitedrvr ) MACHINE_START( nitedrvr )
{ {
state_save_register_global(machine, nitedrvr_gear); nitedrvr_state *state = (nitedrvr_state *)machine->driver_data;
state_save_register_global(machine, nitedrvr_track);
state_save_register_global(machine, nitedrvr_steering_buf); state->maincpu = devtag_get_device(machine, "maincpu");
state_save_register_global(machine, nitedrvr_steering_val); state->discrete = devtag_get_device(machine, "discrete");
state_save_register_global(machine, nitedrvr_crash_en);
state_save_register_global(machine, nitedrvr_crash_data); state_save_register_global(machine, state->gear);
state_save_register_global(machine, nitedrvr_crash_data_en); state_save_register_global(machine, state->track);
state_save_register_global(machine, ac_line); state_save_register_global(machine, state->steering_buf);
state_save_register_global(machine, last_steering_val); state_save_register_global(machine, state->steering_val);
state_save_register_global(machine, state->crash_en);
state_save_register_global(machine, state->crash_data);
state_save_register_global(machine, state->crash_data_en);
state_save_register_global(machine, state->ac_line);
state_save_register_global(machine, state->last_steering_val);
} }
MACHINE_RESET( nitedrvr ) MACHINE_RESET( nitedrvr )
{ {
nitedrvr_gear = 1; nitedrvr_state *state = (nitedrvr_state *)machine->driver_data;
nitedrvr_track = 0;
nitedrvr_steering_buf = 0; state->gear = 1;
nitedrvr_steering_val = 0; state->track = 0;
nitedrvr_crash_en = 0; state->steering_buf = 0;
nitedrvr_crash_data = 0x0f; state->steering_val = 0;
nitedrvr_crash_data_en = 0; state->crash_en = 0;
ac_line = 0; state->crash_data = 0x0f;
last_steering_val = 0; state->crash_data_en = 0;
state->ac_line = 0;
state->last_steering_val = 0;
} }

View File

@ -10,27 +10,22 @@
#include "emu.h" #include "emu.h"
#include "includes/nycaptor.h" #include "includes/nycaptor.h"
static UINT8 from_main,from_mcu; READ8_HANDLER( nycaptor_68705_port_a_r )
static int mcu_sent = 0,main_sent = 0;
static UINT8 portA_in,portA_out,ddrA;
READ8_HANDLER( nycaptor_68705_portA_r )
{ {
nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
return (portA_out & ddrA) | (portA_in & ~ddrA); return (state->port_a_out & state->ddr_a) | (state->port_a_in & ~state->ddr_a);
} }
WRITE8_HANDLER( nycaptor_68705_portA_w ) WRITE8_HANDLER( nycaptor_68705_port_a_w )
{ {
nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
portA_out = data; state->port_a_out = data;
} }
WRITE8_HANDLER( nycaptor_68705_ddrA_w ) WRITE8_HANDLER( nycaptor_68705_ddr_a_w )
{ {
ddrA = data; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
state->ddr_a = data;
} }
/* /*
@ -42,87 +37,96 @@ WRITE8_HANDLER( nycaptor_68705_ddrA_w )
* 2 W when 0->1, copies port A to the latch for the main CPU * 2 W when 0->1, copies port A to the latch for the main CPU
*/ */
static UINT8 portB_in,portB_out,ddrB; READ8_HANDLER( nycaptor_68705_port_b_r )
READ8_HANDLER( nycaptor_68705_portB_r )
{ {
return (portB_out & ddrB) | (portB_in & ~ddrB); nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
return (state->port_b_out & state->ddr_b) | (state->port_b_in & ~state->ddr_b);
} }
WRITE8_HANDLER( nycaptor_68705_portB_w ) WRITE8_HANDLER( nycaptor_68705_port_b_w )
{ {
nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
if (BIT(state->ddr_b, 1) && BIT(~data, 1) && BIT(state->port_b_out, 1))
if ((ddrB & 0x02) && (~data & 0x02) && (portB_out & 0x02))
{ {
portA_in = from_main; state->port_a_in = state->from_main;
if (main_sent) cputag_set_input_line(space->machine, "mcu", 0, CLEAR_LINE);
main_sent = 0; if (state->main_sent)
cpu_set_input_line(state->mcu, 0, CLEAR_LINE);
state->main_sent = 0;
} }
if ((ddrB & 0x04) && (data & 0x04) && (~portB_out & 0x04))
{
from_mcu = portA_out; if (BIT(state->ddr_b, 2) && BIT(data, 2) && BIT(~state->port_b_out, 2))
mcu_sent = 1; {
state->from_mcu = state->port_a_out;
state->mcu_sent = 1;
} }
portB_out = data; state->port_b_out = data;
} }
WRITE8_HANDLER( nycaptor_68705_ddrB_w ) WRITE8_HANDLER( nycaptor_68705_ddr_b_w )
{ {
ddrB = data; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
state->ddr_b = data;
} }
static UINT8 portC_in,portC_out,ddrC; READ8_HANDLER( nycaptor_68705_port_c_r )
READ8_HANDLER( nycaptor_68705_portC_r )
{ {
portC_in = 0; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
if (main_sent) portC_in |= 0x01; state->port_c_in = 0;
if (!mcu_sent) portC_in |= 0x02;
return (portC_out & ddrC) | (portC_in & ~ddrC); if (state->main_sent)
state->port_c_in |= 0x01;
if (!state->mcu_sent)
state->port_c_in |= 0x02;
return (state->port_c_out & state->ddr_c) | (state->port_c_in & ~state->ddr_c);
} }
WRITE8_HANDLER( nycaptor_68705_portC_w ) WRITE8_HANDLER( nycaptor_68705_port_c_w )
{ {
nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
portC_out = data; state->port_c_out = data;
} }
WRITE8_HANDLER( nycaptor_68705_ddrC_w ) WRITE8_HANDLER( nycaptor_68705_ddr_c_w )
{ {
ddrC = data; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
state->ddr_c = data;
} }
WRITE8_HANDLER( nycaptor_mcu_w ) WRITE8_HANDLER( nycaptor_mcu_w )
{ {
nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
from_main = data; state->from_main = data;
main_sent = 1; state->main_sent = 1;
cputag_set_input_line(space->machine, "mcu", 0, ASSERT_LINE); cpu_set_input_line(state->mcu, 0, ASSERT_LINE);
} }
READ8_HANDLER( nycaptor_mcu_r ) READ8_HANDLER( nycaptor_mcu_r )
{ {
nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
mcu_sent = 0; state->mcu_sent = 0;
return from_mcu; return state->from_mcu;
} }
READ8_HANDLER( nycaptor_mcu_status_r1 ) READ8_HANDLER( nycaptor_mcu_status_r1 )
{ {
/* bit 1 = when 1, mcu has sent data to the main cpu */ nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
return mcu_sent?2:0; /* bit 1 = when 1, mcu has sent data to the main cpu */
return state->mcu_sent ? 2 : 0;
} }
READ8_HANDLER( nycaptor_mcu_status_r2 ) READ8_HANDLER( nycaptor_mcu_status_r2 )
{ {
/* bit 0 = when 1, mcu is ready to receive data from main cpu */ nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
return main_sent?0:1;
/* bit 0 = when 1, mcu is ready to receive data from main cpu */
return state->main_sent ? 0 : 1;
} }

View File

@ -2,14 +2,6 @@
#include "includes/news.h" #include "includes/news.h"
UINT8 *news_fgram;
UINT8 *news_bgram;
static int bgpic;
static tilemap_t *fg_tilemap, *bg_tilemap;
/*************************************************************************** /***************************************************************************
Callbacks for the TileMap code Callbacks for the TileMap code
@ -18,7 +10,8 @@ static tilemap_t *fg_tilemap, *bg_tilemap;
static TILE_GET_INFO( get_fg_tile_info ) static TILE_GET_INFO( get_fg_tile_info )
{ {
int code = (news_fgram[tile_index*2] << 8) | news_fgram[tile_index*2+1]; news_state *state = (news_state *)machine->driver_data;
int code = (state->fgram[tile_index * 2] << 8) | state->fgram[tile_index * 2 + 1];
SET_TILE_INFO( SET_TILE_INFO(
0, 0,
code & 0x0fff, code & 0x0fff,
@ -28,11 +21,13 @@ static TILE_GET_INFO( get_fg_tile_info )
static TILE_GET_INFO( get_bg_tile_info ) static TILE_GET_INFO( get_bg_tile_info )
{ {
int code = (news_bgram[tile_index*2] << 8) | news_bgram[tile_index*2+1]; news_state *state = (news_state *)machine->driver_data;
int code = (state->bgram[tile_index * 2] << 8) | state->bgram[tile_index * 2 + 1];
int color = (code & 0xf000) >> 12; int color = (code & 0xf000) >> 12;
code &= 0x0fff; code &= 0x0fff;
if ((code & 0x0e00) == 0x0e00) code = (code & 0x1ff) | (bgpic << 9); if ((code & 0x0e00) == 0x0e00)
code = (code & 0x1ff) | (state->bgpic << 9);
SET_TILE_INFO( SET_TILE_INFO(
0, 0,
@ -51,11 +46,12 @@ static TILE_GET_INFO( get_bg_tile_info )
VIDEO_START( news ) VIDEO_START( news )
{ {
news_state *state = (news_state *)machine->driver_data;
fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_rows,8,8,32, 32); state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
tilemap_set_transparent_pen(fg_tilemap,0); tilemap_set_transparent_pen(state->fg_tilemap, 0);
bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_rows,8,8,32, 32); state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
} }
@ -68,22 +64,28 @@ VIDEO_START( news )
WRITE8_HANDLER( news_fgram_w ) WRITE8_HANDLER( news_fgram_w )
{ {
news_fgram[offset] = data; news_state *state = (news_state *)space->machine->driver_data;
tilemap_mark_tile_dirty(fg_tilemap,offset/2);
state->fgram[offset] = data;
tilemap_mark_tile_dirty(state->fg_tilemap, offset / 2);
} }
WRITE8_HANDLER( news_bgram_w ) WRITE8_HANDLER( news_bgram_w )
{ {
news_bgram[offset] = data; news_state *state = (news_state *)space->machine->driver_data;
tilemap_mark_tile_dirty(bg_tilemap,offset/2);
state->bgram[offset] = data;
tilemap_mark_tile_dirty(state->bg_tilemap, offset / 2);
} }
WRITE8_HANDLER( news_bgpic_w ) WRITE8_HANDLER( news_bgpic_w )
{ {
if (bgpic != data) news_state *state = (news_state *)space->machine->driver_data;
if (state->bgpic != data)
{ {
bgpic = data; state->bgpic = data;
tilemap_mark_all_tiles_dirty(bg_tilemap); tilemap_mark_all_tiles_dirty(state->bg_tilemap);
} }
} }
@ -97,7 +99,8 @@ WRITE8_HANDLER( news_bgpic_w )
VIDEO_UPDATE( news ) VIDEO_UPDATE( news )
{ {
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); news_state *state = (news_state *)screen->machine->driver_data;
tilemap_draw(bitmap,cliprect,fg_tilemap,0,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
return 0; return 0;
} }

View File

@ -7,19 +7,19 @@
#include "emu.h" #include "emu.h"
#include "includes/nitedrvr.h" #include "includes/nitedrvr.h"
UINT8 *nitedrvr_hvc;
static tilemap_t *bg_tilemap;
WRITE8_HANDLER( nitedrvr_videoram_w ) WRITE8_HANDLER( nitedrvr_videoram_w )
{ {
space->machine->generic.videoram.u8[offset] = data; nitedrvr_state *state = (nitedrvr_state *)space->machine->driver_data;
tilemap_mark_tile_dirty(bg_tilemap, offset);
state->videoram[offset] = data;
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
} }
WRITE8_HANDLER( nitedrvr_hvc_w ) WRITE8_HANDLER( nitedrvr_hvc_w )
{ {
nitedrvr_hvc[offset & 0x3f] = data; nitedrvr_state *state = (nitedrvr_state *)space->machine->driver_data;
state->hvc[offset & 0x3f] = data;
if ((offset & 0x30) == 0x30) if ((offset & 0x30) == 0x30)
watchdog_reset_w(space, 0, 0); watchdog_reset_w(space, 0, 0);
@ -27,7 +27,8 @@ WRITE8_HANDLER( nitedrvr_hvc_w )
static TILE_GET_INFO( get_bg_tile_info ) static TILE_GET_INFO( get_bg_tile_info )
{ {
int code = machine->generic.videoram.u8[tile_index] & 0x3f; nitedrvr_state *state = (nitedrvr_state *)machine->driver_data;
int code = state->videoram[tile_index] & 0x3f;
SET_TILE_INFO(0, code, 0, 0); SET_TILE_INFO(0, code, 0, 0);
} }
@ -36,10 +37,11 @@ static TILE_GET_INFO( get_bg_tile_info )
VIDEO_START( nitedrvr ) VIDEO_START( nitedrvr )
{ {
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); nitedrvr_state *state = (nitedrvr_state *)machine->driver_data;
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
} }
static void draw_box(bitmap_t *bitmap, int bx, int by, int ex, int ey ) static void draw_box( bitmap_t *bitmap, int bx, int by, int ex, int ey )
{ {
int x, y; int x, y;
@ -53,18 +55,19 @@ static void draw_box(bitmap_t *bitmap, int bx, int by, int ex, int ey )
return; return;
} }
static void draw_roadway(bitmap_t *bitmap) static void draw_roadway( running_machine *machine, bitmap_t *bitmap )
{ {
nitedrvr_state *state = (nitedrvr_state *)machine->driver_data;
int roadway; int roadway;
for (roadway = 0; roadway < 16; roadway++) for (roadway = 0; roadway < 16; roadway++)
{ {
int bx, by, ex, ey; int bx, by, ex, ey;
bx = nitedrvr_hvc[roadway]; bx = state->hvc[roadway];
by = nitedrvr_hvc[roadway + 16]; by = state->hvc[roadway + 16];
ex = bx + ((nitedrvr_hvc[roadway + 32] & 0xf0) >> 4); ex = bx + ((state->hvc[roadway + 32] & 0xf0) >> 4);
ey = by + (16 - (nitedrvr_hvc[roadway + 32] & 0x0f)); ey = by + (16 - (state->hvc[roadway + 32] & 0x0f));
draw_box(bitmap, bx, by, ex, ey); draw_box(bitmap, bx, by, ex, ey);
} }
@ -72,7 +75,9 @@ static void draw_roadway(bitmap_t *bitmap)
VIDEO_UPDATE( nitedrvr ) VIDEO_UPDATE( nitedrvr )
{ {
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); nitedrvr_state *state = (nitedrvr_state *)screen->machine->driver_data;
draw_roadway(bitmap);
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
draw_roadway(screen->machine, bitmap);
return 0; return 0;
} }

View File

@ -11,175 +11,206 @@
#define NYCAPTOR_DEBUG 0 #define NYCAPTOR_DEBUG 0
#if NYCAPTOR_DEBUG #if NYCAPTOR_DEBUG
static int nycaptor_mask=0; static int nycaptor_mask = 0;
#endif #endif
static tilemap_t *bg_tilemap;
static int char_bank,palette_bank,gfxctrl;
UINT8 *nycaptor_scrlram;
static UINT8 *nycaptor_spriteram;
/* /*
298 (e298) - spot (0-3) , 299 (e299) - lives 298 (e298) - spot (0-3) , 299 (e299) - lives
spot number isn't set to 0 in main menu ; lives - yes spot number isn't set to 0 in main menu ; lives - yes
sprites in main menu req priority 'type' 0 sprites in main menu req priority 'type' 0
*/ */
static int nycaptor_spot(void) static int nycaptor_spot( running_machine *machine )
{ {
if(nyc_gametype==0 || nyc_gametype==2) nycaptor_state *state = (nycaptor_state *)machine->driver_data;
return nycaptor_sharedram[0x299]?nycaptor_sharedram[0x298]:0;
if (state->gametype == 0 || state->gametype == 2)
return state->sharedram[0x299] ? state->sharedram[0x298] : 0;
else else
return 0; return 0;
} }
WRITE8_HANDLER(nycaptor_spriteram_w) WRITE8_HANDLER(nycaptor_spriteram_w)
{ {
nycaptor_spriteram[offset]=data; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
state->spriteram[offset] = data;
} }
READ8_HANDLER(nycaptor_spriteram_r) READ8_HANDLER(nycaptor_spriteram_r)
{ {
return nycaptor_spriteram[offset]; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
return state->spriteram[offset];
} }
static TILE_GET_INFO( get_tile_info ) static TILE_GET_INFO( get_tile_info )
{ {
int pal; nycaptor_state *state = (nycaptor_state *)machine->driver_data;
tileinfo->category = (machine->generic.videoram.u8[tile_index*2 + 1] & 0x30)>>4; int pal = state->videoram[tile_index * 2 + 1] & 0x0f;
pal=machine->generic.videoram.u8[tile_index*2+1]&0x0f; tileinfo->category = (state->videoram[tile_index * 2 + 1] & 0x30) >> 4;
tileinfo->group=0;
if((!nycaptor_spot())&&(pal==6))tileinfo->group=1; tileinfo->group = 0;
if(((nycaptor_spot()==3)&&(pal==8))||((nycaptor_spot()==1)&&(pal==0xc)))tileinfo->group=2;
if((nycaptor_spot()==1)&&(tileinfo->category==2))tileinfo->group=3; if ((!nycaptor_spot(machine)) && (pal == 6))
tileinfo->group = 1;
if (((nycaptor_spot(machine) == 3) && (pal == 8)) || ((nycaptor_spot(machine) == 1) && (pal == 0xc)))
tileinfo->group = 2;
if ((nycaptor_spot(machine) == 1) && (tileinfo->category == 2))
tileinfo->group = 3;
#if NYCAPTOR_DEBUG #if NYCAPTOR_DEBUG
if(nycaptor_mask&(1<<tileinfo->category)) if (nycaptor_mask & (1 << tileinfo->category))
{ {
if(nycaptor_spot())pal=0xe;else pal=4; if (nycaptor_spot(machine))
} pal = 0xe;
else
pal = 4;
}
#endif #endif
SET_TILE_INFO( SET_TILE_INFO(
0, 0,
machine->generic.videoram.u8[tile_index*2] + ((machine->generic.videoram.u8[tile_index*2+1] & 0xc0) << 2) +0x400 * char_bank, state->videoram[tile_index * 2] + ((state->videoram[tile_index * 2 + 1] & 0xc0) << 2) + 0x400 * state->char_bank,
pal,0 pal, 0
); );
} }
VIDEO_START( nycaptor ) VIDEO_START( nycaptor )
{ {
nycaptor_spriteram = auto_alloc_array(machine, UINT8, 160); nycaptor_state *state = (nycaptor_state *)machine->driver_data;
bg_tilemap = tilemap_create( machine, get_tile_info,tilemap_scan_rows,8,8,32,32 );
tilemap_set_transmask(bg_tilemap,0,0xf800,0x7ff); //split 0 state->spriteram = auto_alloc_array(machine, UINT8, 160);
tilemap_set_transmask(bg_tilemap,1,0xfe00,0x01ff);//split 1 state->bg_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_rows, 8, 8, 32, 32 );
tilemap_set_transmask(bg_tilemap,2,0xfffc,0x0003);//split 2
tilemap_set_transmask(bg_tilemap,3,0xfff0,0x000f);//split 3 tilemap_set_transmask(state->bg_tilemap, 0, 0xf800, 0x7ff); //split 0
tilemap_set_transmask(state->bg_tilemap, 1, 0xfe00, 0x01ff);//split 1
tilemap_set_transmask(state->bg_tilemap, 2, 0xfffc, 0x0003);//split 2
tilemap_set_transmask(state->bg_tilemap, 3, 0xfff0, 0x000f);//split 3
machine->generic.paletteram.u8 = auto_alloc_array(machine, UINT8, 0x200); machine->generic.paletteram.u8 = auto_alloc_array(machine, UINT8, 0x200);
machine->generic.paletteram2.u8 = auto_alloc_array(machine, UINT8, 0x200); machine->generic.paletteram2.u8 = auto_alloc_array(machine, UINT8, 0x200);
tilemap_set_scroll_cols(bg_tilemap,32); tilemap_set_scroll_cols(state->bg_tilemap, 32);
state_save_register_global_pointer(machine, state->spriteram, 160);
state_save_register_global_pointer(machine, machine->generic.paletteram.u8, 0x200);
state_save_register_global_pointer(machine, machine->generic.paletteram2.u8, 0x200);
} }
WRITE8_HANDLER( nycaptor_videoram_w ) WRITE8_HANDLER( nycaptor_videoram_w )
{ {
space->machine->generic.videoram.u8[offset] = data; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
tilemap_mark_tile_dirty(bg_tilemap,offset>>1); state->videoram[offset] = data;
tilemap_mark_tile_dirty(state->bg_tilemap, offset >> 1);
} }
READ8_HANDLER( nycaptor_videoram_r ) READ8_HANDLER( nycaptor_videoram_r )
{ {
return space->machine->generic.videoram.u8[offset]; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
return state->videoram[offset];
} }
WRITE8_HANDLER( nycaptor_palette_w ) WRITE8_HANDLER( nycaptor_palette_w )
{ {
if(nyc_gametype==2) //colt nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
if (state->gametype == 2) //colt
return; return;
if (offset & 0x100) if (offset & 0x100)
paletteram_xxxxBBBBGGGGRRRR_split2_w(space, (offset & 0xff) + (palette_bank << 8),data); paletteram_xxxxBBBBGGGGRRRR_split2_w(space, (offset & 0xff) + (state->palette_bank << 8), data);
else else
paletteram_xxxxBBBBGGGGRRRR_split1_w(space, (offset & 0xff) + (palette_bank << 8),data); paletteram_xxxxBBBBGGGGRRRR_split1_w(space, (offset & 0xff) + (state->palette_bank << 8), data);
} }
READ8_HANDLER( nycaptor_palette_r ) READ8_HANDLER( nycaptor_palette_r )
{ {
nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
if (offset & 0x100) if (offset & 0x100)
return space->machine->generic.paletteram2.u8[ (offset & 0xff) + (palette_bank << 8) ]; return space->machine->generic.paletteram2.u8[(offset & 0xff) + (state->palette_bank << 8)];
else else
return space->machine->generic.paletteram.u8 [ (offset & 0xff) + (palette_bank << 8) ]; return space->machine->generic.paletteram.u8 [(offset & 0xff) + (state->palette_bank << 8)];
} }
WRITE8_HANDLER( nycaptor_gfxctrl_w ) WRITE8_HANDLER( nycaptor_gfxctrl_w )
{ {
if (gfxctrl == data) nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
return;
gfxctrl = data;
if(char_bank != ((data & 0x18) >> 3)) if (state->gfxctrl == data)
return;
state->gfxctrl = data;
if (state->char_bank != ((data & 0x18) >> 3))
{ {
char_bank=((data & 0x18) >> 3); state->char_bank = ((data & 0x18) >> 3);
tilemap_mark_all_tiles_dirty( bg_tilemap ); tilemap_mark_all_tiles_dirty(state->bg_tilemap);
} }
palette_bank = (data & 0x20) >> 5;
state->palette_bank = BIT(data, 5);
} }
READ8_HANDLER( nycaptor_gfxctrl_r ) READ8_HANDLER( nycaptor_gfxctrl_r )
{ {
return gfxctrl; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
return state->gfxctrl;
} }
READ8_HANDLER( nycaptor_scrlram_r ) READ8_HANDLER( nycaptor_scrlram_r )
{ {
return nycaptor_scrlram[offset]; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
return state->scrlram[offset];
} }
WRITE8_HANDLER( nycaptor_scrlram_w ) WRITE8_HANDLER( nycaptor_scrlram_w )
{ {
nycaptor_scrlram[offset] = data; nycaptor_state *state = (nycaptor_state *)space->machine->driver_data;
tilemap_set_scrolly(bg_tilemap, offset, data ); state->scrlram[offset] = data;
tilemap_set_scrolly(state->bg_tilemap, offset, data);
} }
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect,int pri) static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri )
{ {
nycaptor_state *state = (nycaptor_state *)machine->driver_data;
int i; int i;
for (i=0;i<0x20;i++)
{
int pr = nycaptor_spriteram[0x9f-i];
int offs = (pr & 0x1f) * 4;
int code,sx,sy,flipx,flipy,pal,priori;
code = nycaptor_spriteram[offs+2] + ((nycaptor_spriteram[offs+1] & 0x10) << 4);//1 bit wolny = 0x20 for (i = 0; i < 0x20; i++)
pal=nycaptor_spriteram[offs+1] & 0x0f; {
sx = nycaptor_spriteram[offs+3]; int pr = state->spriteram[0x9f - i];
sy = 240-nycaptor_spriteram[offs+0]; int offs = (pr & 0x1f) * 4;
priori=(pr&0xe0)>>5; int code, sx, sy, flipx, flipy, pal, priori;
if(priori==pri)
code = state->spriteram[offs + 2] + ((state->spriteram[offs + 1] & 0x10) << 4);//1 bit wolny = 0x20
pal = state->spriteram[offs + 1] & 0x0f;
sx = state->spriteram[offs + 3];
sy = 240 - state->spriteram[offs + 0];
priori = (pr & 0xe0) >> 5;
if (priori == pri)
{ {
#if NYCAPTOR_DEBUG #if NYCAPTOR_DEBUG
if(nycaptor_mask&(1<<(pri+4)))pal=0xd; if (nycaptor_mask & (1 << (pri + 4))) pal = 0xd;
#endif #endif
flipx = ((nycaptor_spriteram[offs+1]&0x40)>>6); flipx = BIT(state->spriteram[offs + 1], 6);
flipy = ((nycaptor_spriteram[offs+1]&0x80)>>7); flipy = BIT(state->spriteram[offs + 1], 7);
drawgfx_transpen(bitmap,cliprect,machine->gfx[1], drawgfx_transpen(bitmap, cliprect, machine->gfx[1],
code, code,
pal, pal,
flipx,flipy, flipx,flipy,
sx,sy,15); sx,sy,15);
if(nycaptor_spriteram[offs+3]>240) if (state->spriteram[offs + 3] > 240)
{ {
sx = (nycaptor_spriteram[offs+3]-256); sx = (state->spriteram[offs + 3] - 256);
drawgfx_transpen(bitmap,cliprect,machine->gfx[1], drawgfx_transpen(bitmap, cliprect, machine->gfx[1],
code, code,
pal, pal,
flipx,flipy, flipx,flipy,
sx,sy,15); sx,sy,15);
} }
} }
} }
@ -198,109 +229,114 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
x - no bg/sprite pri. x - no bg/sprite pri.
*/ */
#define mKEY_MASK(x,y) if (input_code_pressed_once(machine, x)){nycaptor_mask|=y;tilemap_mark_all_tiles_dirty( bg_tilemap );} #define mKEY_MASK(x,y) if (input_code_pressed_once(machine, x)) { nycaptor_mask |= y; tilemap_mark_all_tiles_dirty(state->bg_tilemap);}
static void nycaptor_setmask(running_machine *machine) static void nycaptor_setmask( running_machine *machine )
{ {
mKEY_MASK(KEYCODE_Q,1); /* bg */ nycaptor_state *state = (nycaptor_state *)machine->driver_data;
mKEY_MASK(KEYCODE_W,2);
mKEY_MASK(KEYCODE_E,4);
mKEY_MASK(KEYCODE_R,8);
mKEY_MASK(KEYCODE_A,0x10); /* sprites */ mKEY_MASK(KEYCODE_Q, 1); /* bg */
mKEY_MASK(KEYCODE_S,0x20); mKEY_MASK(KEYCODE_W, 2);
mKEY_MASK(KEYCODE_D,0x40); mKEY_MASK(KEYCODE_E, 4);
mKEY_MASK(KEYCODE_F,0x80); mKEY_MASK(KEYCODE_R, 8);
mKEY_MASK(KEYCODE_G,0x100);
mKEY_MASK(KEYCODE_H,0x200);
mKEY_MASK(KEYCODE_J,0x400);
mKEY_MASK(KEYCODE_K,0x800);
if (input_code_pressed_once(machine, KEYCODE_Z)){nycaptor_mask=0;tilemap_mark_all_tiles_dirty( bg_tilemap );} /* disable */ mKEY_MASK(KEYCODE_A, 0x10); /* sprites */
if (input_code_pressed_once(machine, KEYCODE_X)){nycaptor_mask|=0x1000;tilemap_mark_all_tiles_dirty( bg_tilemap );} /* no layers */ mKEY_MASK(KEYCODE_S, 0x20);
mKEY_MASK(KEYCODE_D, 0x40);
mKEY_MASK(KEYCODE_F, 0x80);
mKEY_MASK(KEYCODE_G, 0x100);
mKEY_MASK(KEYCODE_H, 0x200);
mKEY_MASK(KEYCODE_J, 0x400);
mKEY_MASK(KEYCODE_K, 0x800);
if (input_code_pressed_once(machine, KEYCODE_Z)){nycaptor_mask = 0; tilemap_mark_all_tiles_dirty(state->bg_tilemap);} /* disable */
if (input_code_pressed_once(machine, KEYCODE_X)){nycaptor_mask |= 0x1000; tilemap_mark_all_tiles_dirty(state->bg_tilemap);} /* no layers */
} }
#endif #endif
VIDEO_UPDATE( nycaptor ) VIDEO_UPDATE( nycaptor )
{ {
nycaptor_state *state = (nycaptor_state *)screen->machine->driver_data;
#if NYCAPTOR_DEBUG #if NYCAPTOR_DEBUG
nycaptor_setmask(screen->machine); nycaptor_setmask(screen->machine);
if(nycaptor_mask&0x1000) if (nycaptor_mask & 0x1000)
{ {
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1|3,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 3, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0|3,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 3, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1|2,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 2, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0|2,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 2, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1|1,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 1, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0|1,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 1, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1|0,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 0, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0|0,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 0, 0);
draw_sprites(screen->machine, bitmap,cliprect,0); draw_sprites(screen->machine, bitmap, cliprect, 0);
draw_sprites(screen->machine, bitmap,cliprect,1); draw_sprites(screen->machine, bitmap, cliprect, 1);
draw_sprites(screen->machine, bitmap,cliprect,2); draw_sprites(screen->machine, bitmap, cliprect, 2);
draw_sprites(screen->machine, bitmap,cliprect,3); draw_sprites(screen->machine, bitmap, cliprect, 3);
draw_sprites(screen->machine, bitmap,cliprect,4); draw_sprites(screen->machine, bitmap, cliprect, 4);
draw_sprites(screen->machine, bitmap,cliprect,5); draw_sprites(screen->machine, bitmap, cliprect, 5);
draw_sprites(screen->machine, bitmap,cliprect,6); draw_sprites(screen->machine, bitmap, cliprect, 6);
draw_sprites(screen->machine, bitmap,cliprect,7); draw_sprites(screen->machine, bitmap, cliprect, 7);
} }
else else
#endif #endif
switch (nycaptor_spot()&3) switch (nycaptor_spot(screen->machine) & 3)
{ {
case 0: case 0:
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1|3,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 3, 0);
draw_sprites(screen->machine, bitmap,cliprect,6); draw_sprites(screen->machine, bitmap, cliprect, 6);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0|3,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 3, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1|2,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 2, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0|2,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 2, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1|1,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 1, 0);
draw_sprites(screen->machine, bitmap,cliprect,3); draw_sprites(screen->machine, bitmap, cliprect, 3);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0|1,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 1, 0);
draw_sprites(screen->machine, bitmap,cliprect,0); draw_sprites(screen->machine, bitmap, cliprect, 0);
draw_sprites(screen->machine, bitmap,cliprect,2); draw_sprites(screen->machine, bitmap, cliprect, 2);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1|0,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 0, 0);
draw_sprites(screen->machine, bitmap,cliprect,1); draw_sprites(screen->machine, bitmap, cliprect, 1);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0|0,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 0, 0);
break; break;
case 1: case 1:
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1|3,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 3, 0);
draw_sprites(screen->machine, bitmap,cliprect,3); draw_sprites(screen->machine, bitmap, cliprect, 3);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0|3,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 3, 0);
draw_sprites(screen->machine, bitmap,cliprect,2); draw_sprites(screen->machine, bitmap, cliprect, 2);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1|2,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 2, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1|1,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 1, 0);
draw_sprites(screen->machine, bitmap,cliprect,1); draw_sprites(screen->machine, bitmap, cliprect, 1);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0|1,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 1, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0|2,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 2, 0);
draw_sprites(screen->machine, bitmap,cliprect,0); draw_sprites(screen->machine, bitmap, cliprect, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1|0,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 0, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0|0,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 0, 0);
break; break;
case 2: case 2:
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1|3,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 3, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0|3,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 3, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1|1,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 1, 0);
draw_sprites(screen->machine, bitmap,cliprect,1); draw_sprites(screen->machine, bitmap, cliprect, 1);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0|1,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 1, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1|2,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 2, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0|2,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 2, 0);
draw_sprites(screen->machine, bitmap,cliprect,0); draw_sprites(screen->machine, bitmap, cliprect, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1|0,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 0, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0|0,0); tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 0, 0);
break; break;
case 3:
tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 1, 0);
draw_sprites(screen->machine, bitmap, cliprect, 1);
tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 1, 0);
draw_sprites(screen->machine, bitmap, cliprect, 0);
tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 0, 0);
tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 0, 0);
break;
}
case 3:
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1|1,0);
draw_sprites(screen->machine, bitmap,cliprect,1);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0|1,0);
draw_sprites(screen->machine, bitmap,cliprect,0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1|0,0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0|0,0);
break;
}
return 0; return 0;
} }