mirror of
https://github.com/holub/mame
synced 2025-05-22 21:58:57 +03:00
Added driver data struct and save states to the following drivers:
kangaroo.c, karnov.c, kchamp.c, kickgoal.c, kingobox.c, kncljoe.c, koikoi.c, kopunch.c, ksayakyu.c and kyugo.c
This commit is contained in:
parent
db86be935f
commit
637085584b
7
.gitattributes
vendored
7
.gitattributes
vendored
@ -2517,9 +2517,16 @@ src/mame/includes/jedi.h svneol=native#text/plain
|
||||
src/mame/includes/jpmimpct.h svneol=native#text/plain
|
||||
src/mame/includes/kaneko16.h svneol=native#text/plain
|
||||
src/mame/includes/kangaroo.h svneol=native#text/plain
|
||||
src/mame/includes/karnov.h svneol=native#text/plain
|
||||
src/mame/includes/kchamp.h svneol=native#text/plain
|
||||
src/mame/includes/kickgoal.h svneol=native#text/plain
|
||||
src/mame/includes/kingobox.h svneol=native#text/plain
|
||||
src/mame/includes/klax.h svneol=native#text/plain
|
||||
src/mame/includes/kncljoe.h svneol=native#text/plain
|
||||
src/mame/includes/konamigx.h svneol=native#text/plain
|
||||
src/mame/includes/konamipt.h svneol=native#text/plain
|
||||
src/mame/includes/kopunch.h svneol=native#text/plain
|
||||
src/mame/includes/ksayakyu.h svneol=native#text/plain
|
||||
src/mame/includes/kyugo.h svneol=native#text/plain
|
||||
src/mame/includes/lasso.h svneol=native#text/plain
|
||||
src/mame/includes/lazercmd.h svneol=native#text/plain
|
||||
|
@ -155,22 +155,17 @@
|
||||
|
||||
#include "driver.h"
|
||||
#include "cpu/mb88xx/mb88xx.h"
|
||||
#include "kangaroo.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/ay8910.h"
|
||||
#include "includes/kangaroo.h"
|
||||
|
||||
|
||||
#define MASTER_CLOCK XTAL_10MHz
|
||||
|
||||
|
||||
|
||||
static READ8_HANDLER(mcu_sim_r);
|
||||
static WRITE8_HANDLER(mcu_sim_w);
|
||||
|
||||
static UINT8 kangaroo_clock;
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Machine init
|
||||
@ -180,20 +175,23 @@ static UINT8 kangaroo_clock;
|
||||
static MACHINE_START( kangaroo )
|
||||
{
|
||||
memory_configure_bank(machine, "bank1", 0, 2, memory_region(machine, "gfx1"), 0x2000);
|
||||
state_save_register_global(machine, kangaroo_clock);
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_START( kangaroo_mcu )
|
||||
{
|
||||
kangaroo_state *state = (kangaroo_state *)machine->driver_data;
|
||||
|
||||
MACHINE_START_CALL(kangaroo);
|
||||
memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xef00, 0xefff, 0, 0, mcu_sim_r, mcu_sim_w);
|
||||
kangaroo_clock = 0;
|
||||
state_save_register_global(machine, state->clock);
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_RESET( kangaroo )
|
||||
{
|
||||
kangaroo_state *state = (kangaroo_state *)machine->driver_data;
|
||||
|
||||
/* I think there is a bug in the startup checks of the game. At the very */
|
||||
/* beginning, during the RAM check, it goes one byte too far, and ends up */
|
||||
/* trying to write, and re-read, location dfff. To the best of my knowledge, */
|
||||
@ -206,6 +204,8 @@ static MACHINE_RESET( kangaroo )
|
||||
/* Anyway, what I do here is just immediately generate the NMI, so the game */
|
||||
/* properly starts. */
|
||||
cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
|
||||
state->clock = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -222,7 +222,8 @@ static MACHINE_RESET( kangaroo )
|
||||
|
||||
static READ8_HANDLER( mcu_sim_r )
|
||||
{
|
||||
return ++kangaroo_clock & 0x0f;
|
||||
kangaroo_state *state = (kangaroo_state *)space->machine->driver_data;
|
||||
return ++state->clock & 0x0f;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( mcu_sim_w )
|
||||
@ -257,7 +258,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0xe000, 0xe3ff) AM_RAM
|
||||
AM_RANGE(0xe400, 0xe400) AM_MIRROR(0x03ff) AM_READ_PORT("DSW0")
|
||||
AM_RANGE(0xe800, 0xe80a) AM_MIRROR(0x03f0) AM_WRITE(kangaroo_video_control_w) AM_BASE(&kangaroo_video_control)
|
||||
AM_RANGE(0xe800, 0xe80a) AM_MIRROR(0x03f0) AM_WRITE(kangaroo_video_control_w) AM_BASE_MEMBER(kangaroo_state, video_control)
|
||||
AM_RANGE(0xec00, 0xec00) AM_MIRROR(0x00ff) AM_READ_PORT("IN0") AM_WRITE(soundlatch_w)
|
||||
AM_RANGE(0xed00, 0xed00) AM_MIRROR(0x00ff) AM_READ_PORT("IN1") AM_WRITE(kangaroo_coin_counter_w)
|
||||
AM_RANGE(0xee00, 0xee00) AM_MIRROR(0x00ff) AM_READ_PORT("IN2")
|
||||
@ -428,6 +429,9 @@ INPUT_PORTS_END
|
||||
|
||||
static MACHINE_DRIVER_START( nomcu )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(kangaroo_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, MASTER_CLOCK/4)
|
||||
MDRV_CPU_PROGRAM_MAP(main_map)
|
||||
@ -572,7 +576,7 @@ ROM_END
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1981, fnkyfish, 0, nomcu, fnkyfish, 0, ROT90, "Sun Electronics", "Funky Fish", 0 )
|
||||
GAME( 1982, kangaroo, 0, mcu, kangaroo, 0, ROT90, "Sun Electronics", "Kangaroo", 0 )
|
||||
GAME( 1982, kangarooa,kangaroo, mcu, kangaroo, 0, ROT90, "[Sun Electronics] (Atari license)", "Kangaroo (Atari)", 0 )
|
||||
GAME( 1982, kangaroob,kangaroo, nomcu, kangaroo, 0, ROT90, "bootleg", "Kangaroo (bootleg)", 0 )
|
||||
GAME( 1981, fnkyfish, 0, nomcu, fnkyfish, 0, ROT90, "Sun Electronics", "Funky Fish", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1982, kangaroo, 0, mcu, kangaroo, 0, ROT90, "Sun Electronics", "Kangaroo", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1982, kangarooa, kangaroo, mcu, kangaroo, 0, ROT90, "[Sun Electronics] (Atari license)", "Kangaroo (Atari)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1982, kangaroob, kangaroo, nomcu, kangaroo, 0, ROT90, "bootleg", "Kangaroo (bootleg)", GAME_SUPPORTS_SAVE )
|
||||
|
@ -42,307 +42,332 @@
|
||||
#include "cpu/m6502/m6502.h"
|
||||
#include "sound/2203intf.h"
|
||||
#include "sound/3526intf.h"
|
||||
#include "includes/karnov.h"
|
||||
|
||||
PALETTE_INIT( karnov );
|
||||
VIDEO_UPDATE( karnov );
|
||||
WRITE16_HANDLER( karnov_playfield_swap_w );
|
||||
WRITE16_HANDLER( karnov_videoram_w );
|
||||
void karnov_flipscreen_w(running_machine *machine, int data);
|
||||
|
||||
VIDEO_START( karnov );
|
||||
VIDEO_START( wndrplnt );
|
||||
|
||||
enum { KARNOV=0, KARNOVJ, CHELNOV, CHELNOVJ, CHELNOVW, WNDRPLNT };
|
||||
|
||||
static UINT16 i8751_return,i8751_needs_ack,i8751_coin_pending,i8751_command_queue;
|
||||
static UINT16 *karnov_ram;
|
||||
extern UINT16 karnov_scroll[2], *karnov_pf_data;
|
||||
static int microcontroller_id,coin_mask;
|
||||
|
||||
/******************************************************************************/
|
||||
/*************************************
|
||||
*
|
||||
* Microcontroller emulation
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/* Emulation of the protected microcontroller - for coins & general protection */
|
||||
static void karnov_i8751_w(running_machine *machine, int data)
|
||||
static void karnov_i8751_w( running_machine *machine, int data )
|
||||
{
|
||||
karnov_state *state = (karnov_state *)machine->driver_data;
|
||||
|
||||
/* Pending coin operations may cause protection commands to be queued */
|
||||
if (i8751_needs_ack)
|
||||
if (state->i8751_needs_ack)
|
||||
{
|
||||
i8751_command_queue=data;
|
||||
state->i8751_command_queue = data;
|
||||
return;
|
||||
}
|
||||
|
||||
i8751_return=0;
|
||||
if (data==0x100 && microcontroller_id==KARNOVJ) i8751_return=0x56a; /* Japan version */
|
||||
if (data==0x100 && microcontroller_id==KARNOV) i8751_return=0x56b; /* USA version */
|
||||
if ((data&0xf00)==0x300) i8751_return=(data&0xff)*0x12; /* Player sprite mapping */
|
||||
state->i8751_return = 0;
|
||||
|
||||
if (data == 0x100 && state->microcontroller_id == KARNOVJ) /* Japan version */
|
||||
state->i8751_return = 0x56a;
|
||||
|
||||
if (data == 0x100 && state->microcontroller_id == KARNOV) /* USA version */
|
||||
state->i8751_return = 0x56b;
|
||||
|
||||
if ((data & 0xf00) == 0x300)
|
||||
state->i8751_return = (data & 0xff) * 0x12; /* Player sprite mapping */
|
||||
|
||||
/* I'm not sure the ones marked ^ appear in the right order */
|
||||
if (data==0x400) i8751_return=0x4000; /* Get The Map... */
|
||||
if (data==0x402) i8751_return=0x40a6; /* Ancient Ruins */
|
||||
if (data==0x403) i8751_return=0x4054; /* Forest... */
|
||||
if (data==0x404) i8751_return=0x40de; /* ^Rocky hills */
|
||||
if (data==0x405) i8751_return=0x4182; /* Sea */
|
||||
if (data==0x406) i8751_return=0x41ca; /* Town */
|
||||
if (data==0x407) i8751_return=0x421e; /* Desert */
|
||||
if (data==0x401) i8751_return=0x4138; /* ^Whistling wind */
|
||||
if (data==0x408) i8751_return=0x4276; /* ^Heavy Gates */
|
||||
if (data == 0x400) state->i8751_return = 0x4000; /* Get The Map... */
|
||||
if (data == 0x402) state->i8751_return = 0x40a6; /* Ancient Ruins */
|
||||
if (data == 0x403) state->i8751_return = 0x4054; /* Forest... */
|
||||
if (data == 0x404) state->i8751_return = 0x40de; /* ^Rocky hills */
|
||||
if (data == 0x405) state->i8751_return = 0x4182; /* Sea */
|
||||
if (data == 0x406) state->i8751_return = 0x41ca; /* Town */
|
||||
if (data == 0x407) state->i8751_return = 0x421e; /* Desert */
|
||||
if (data == 0x401) state->i8751_return = 0x4138; /* ^Whistling wind */
|
||||
if (data == 0x408) state->i8751_return = 0x4276; /* ^Heavy Gates */
|
||||
|
||||
// if (!i8751_return && data!=0x300) logerror("%s - Unknown Write %02x intel\n",cpuexec_describe_context(machine),data);
|
||||
// if (!state->i8751_return && data != 0x300) logerror("%s - Unknown Write %02x intel\n", cpuexec_describe_context(machine), data);
|
||||
|
||||
cputag_set_input_line(machine, "maincpu", 6, HOLD_LINE); /* Signal main cpu task is complete */
|
||||
i8751_needs_ack=1;
|
||||
cpu_set_input_line(state->maincpu, 6, HOLD_LINE); /* Signal main cpu task is complete */
|
||||
state->i8751_needs_ack = 1;
|
||||
}
|
||||
|
||||
static void wndrplnt_i8751_w(running_machine *machine, int data)
|
||||
static void wndrplnt_i8751_w( running_machine *machine, int data )
|
||||
{
|
||||
karnov_state *state = (karnov_state *)machine->driver_data;
|
||||
|
||||
/* The last command hasn't been ACK'd (probably a conflict with coin command) */
|
||||
if (i8751_needs_ack)
|
||||
if (state->i8751_needs_ack)
|
||||
{
|
||||
i8751_command_queue=data;
|
||||
state->i8751_command_queue = data;
|
||||
return;
|
||||
}
|
||||
|
||||
i8751_return=0;
|
||||
if (data==0x100) i8751_return=0x67a;
|
||||
if (data==0x200) i8751_return=0x214;
|
||||
if (data==0x300) i8751_return=0x17; /* Copyright text on title screen */
|
||||
// if (data==0x300) i8751_return=0x1; /* (USA) Copyright text on title screen */
|
||||
state->i8751_return=0;
|
||||
|
||||
if (data == 0x100) state->i8751_return = 0x67a;
|
||||
if (data == 0x200) state->i8751_return = 0x214;
|
||||
if (data == 0x300) state->i8751_return = 0x17; /* Copyright text on title screen */
|
||||
// if (data == 0x300) state->i8751_return = 0x1; /* (USA) Copyright text on title screen */
|
||||
|
||||
/* The game writes many values in the 0x600 range, but only a specific mask
|
||||
matters for the return value */
|
||||
if ((data&0x600)==0x600)
|
||||
if ((data & 0x600) == 0x600)
|
||||
{
|
||||
switch (data&0x18)
|
||||
switch (data & 0x18)
|
||||
{
|
||||
case 0x00: i8751_return=0x4d53; break;
|
||||
case 0x08: i8751_return=0x4b54; break;
|
||||
case 0x10: i8751_return=0x5453; break;
|
||||
case 0x18: i8751_return=0x5341; break;
|
||||
case 0x00: state->i8751_return = 0x4d53; break;
|
||||
case 0x08: state->i8751_return = 0x4b54; break;
|
||||
case 0x10: state->i8751_return = 0x5453; break;
|
||||
case 0x18: state->i8751_return = 0x5341; break;
|
||||
}
|
||||
}
|
||||
// else logerror("%s - Unknown Write %02x intel\n",cpuexec_describe_context(machine),data);
|
||||
// else logerror("%s - Unknown Write %02x intel\n", cpuexec_describe_context(machine), data);
|
||||
|
||||
/* These are 68k function call addresses - different address for each power-up */
|
||||
if (data==0x400) i8751_return=0x594;
|
||||
if (data==0x401) i8751_return=0x5ea;
|
||||
if (data==0x402) i8751_return=0x628;
|
||||
if (data==0x403) i8751_return=0x66c;
|
||||
if (data==0x404) i8751_return=0x6a4;
|
||||
if (data==0x405) i8751_return=0x6a4;
|
||||
if (data==0x406) i8751_return=0x6a4;
|
||||
if (data == 0x400) state->i8751_return = 0x594;
|
||||
if (data == 0x401) state->i8751_return = 0x5ea;
|
||||
if (data == 0x402) state->i8751_return = 0x628;
|
||||
if (data == 0x403) state->i8751_return = 0x66c;
|
||||
if (data == 0x404) state->i8751_return = 0x6a4;
|
||||
if (data == 0x405) state->i8751_return = 0x6a4;
|
||||
if (data == 0x406) state->i8751_return = 0x6a4;
|
||||
|
||||
/* This is 68k program code which is executed every frame */
|
||||
if (data==0x50c) i8751_return=0x13fc;
|
||||
if (data==0x50b) i8751_return=0x00ff;
|
||||
if (data==0x50a) i8751_return=0x0006;
|
||||
if (data==0x509) i8751_return=0x0000;
|
||||
if (data==0x508) i8751_return=0x4a39;
|
||||
if (data==0x507) i8751_return=0x0006;
|
||||
if (data==0x506) i8751_return=0x0000;
|
||||
if (data==0x505) i8751_return=0x66f8;
|
||||
if (data==0x504) i8751_return=0x4a39;
|
||||
if (data==0x503) i8751_return=0x000c;
|
||||
if (data==0x502) i8751_return=0x0003;
|
||||
if (data==0x501) i8751_return=0x6bf8;
|
||||
if (data==0x500) i8751_return=0x4e75;
|
||||
if (data == 0x50c) state->i8751_return = 0x13fc;
|
||||
if (data == 0x50b) state->i8751_return = 0x00ff;
|
||||
if (data == 0x50a) state->i8751_return = 0x0006;
|
||||
if (data == 0x509) state->i8751_return = 0x0000;
|
||||
if (data == 0x508) state->i8751_return = 0x4a39;
|
||||
if (data == 0x507) state->i8751_return = 0x0006;
|
||||
if (data == 0x506) state->i8751_return = 0x0000;
|
||||
if (data == 0x505) state->i8751_return = 0x66f8;
|
||||
if (data == 0x504) state->i8751_return = 0x4a39;
|
||||
if (data == 0x503) state->i8751_return = 0x000c;
|
||||
if (data == 0x502) state->i8751_return = 0x0003;
|
||||
if (data == 0x501) state->i8751_return = 0x6bf8;
|
||||
if (data == 0x500) state->i8751_return = 0x4e75;
|
||||
|
||||
cputag_set_input_line(machine, "maincpu", 6, HOLD_LINE); /* Signal main cpu task is complete */
|
||||
i8751_needs_ack=1;
|
||||
cpu_set_input_line(state->maincpu, 6, HOLD_LINE); /* Signal main cpu task is complete */
|
||||
state->i8751_needs_ack = 1;
|
||||
}
|
||||
|
||||
static void chelnov_i8751_w(running_machine *machine, int data)
|
||||
static void chelnov_i8751_w( running_machine *machine, int data )
|
||||
{
|
||||
static int level;
|
||||
karnov_state *state = (karnov_state *)machine->driver_data;
|
||||
|
||||
/* Pending coin operations may cause protection commands to be queued */
|
||||
if (i8751_needs_ack)
|
||||
if (state->i8751_needs_ack)
|
||||
{
|
||||
i8751_command_queue=data;
|
||||
state->i8751_command_queue = data;
|
||||
return;
|
||||
}
|
||||
|
||||
i8751_return=0;
|
||||
if (data==0x200 && microcontroller_id==CHELNOVJ) i8751_return=0x7734; /* Japan version */
|
||||
if (data==0x200 && microcontroller_id==CHELNOV) i8751_return=0x783e; /* USA version */
|
||||
if (data==0x200 && microcontroller_id==CHELNOVW) i8751_return=0x7736; /* World version */
|
||||
if (data==0x100 && microcontroller_id==CHELNOVJ) i8751_return=0x71a; /* Japan version */
|
||||
if (data==0x100 && microcontroller_id==CHELNOV) i8751_return=0x71b; /* USA version */
|
||||
if (data==0x100 && microcontroller_id==CHELNOVW) i8751_return=0x71c; /* World version */
|
||||
state->i8751_return = 0;
|
||||
|
||||
if (data>=0x6000 && data<0x8000) i8751_return=1; /* patched */
|
||||
if ((data&0xf000)==0x1000) level=1; /* Level 1 */
|
||||
if ((data&0xf000)==0x2000) level++; /* Level Increment */
|
||||
if ((data&0xf000)==0x3000)
|
||||
{ /* Sprite table mapping */
|
||||
int b=data&0xff;
|
||||
switch (level)
|
||||
if (data == 0x200 && state->microcontroller_id == CHELNOVJ) /* Japan version */
|
||||
state->i8751_return = 0x7734;
|
||||
|
||||
if (data == 0x200 && state->microcontroller_id == CHELNOV) /* USA version */
|
||||
state->i8751_return = 0x783e;
|
||||
|
||||
if (data == 0x200 && state->microcontroller_id == CHELNOVW) /* World version */
|
||||
state->i8751_return = 0x7736;
|
||||
|
||||
if (data == 0x100 && state->microcontroller_id == CHELNOVJ) /* Japan version */
|
||||
state->i8751_return = 0x71a;
|
||||
|
||||
if (data == 0x100 && state->microcontroller_id == CHELNOV) /* USA version */
|
||||
state->i8751_return = 0x71b;
|
||||
|
||||
if (data == 0x100 && state->microcontroller_id == CHELNOVW) /* World version */
|
||||
state->i8751_return = 0x71c;
|
||||
|
||||
if (data >= 0x6000 && data < 0x8000)
|
||||
state->i8751_return = 1; /* patched */
|
||||
|
||||
if ((data & 0xf000) == 0x1000) state->i8751_level = 1; /* Level 1 */
|
||||
if ((data & 0xf000) == 0x2000) state->i8751_level++; /* Level Increment */
|
||||
|
||||
if ((data & 0xf000) == 0x3000)
|
||||
{
|
||||
/* Sprite table mapping */
|
||||
int b = data & 0xff;
|
||||
switch (state->i8751_level)
|
||||
{
|
||||
case 1: /* Level 1, Sprite mapping tables */
|
||||
if (microcontroller_id==CHELNOV)
|
||||
{ /* USA */
|
||||
if (b<2) i8751_return=0;
|
||||
else if (b<6) i8751_return=1;
|
||||
else if (b<0xb) i8751_return=2;
|
||||
else if (b<0xf) i8751_return=3;
|
||||
else if (b<0x13) i8751_return=4;
|
||||
else i8751_return=5;
|
||||
if (state->microcontroller_id == CHELNOV) /* USA */
|
||||
{
|
||||
if (b < 2) state->i8751_return = 0;
|
||||
else if (b < 6) state->i8751_return = 1;
|
||||
else if (b < 0xb) state->i8751_return = 2;
|
||||
else if (b < 0xf) state->i8751_return = 3;
|
||||
else if (b < 0x13) state->i8751_return = 4;
|
||||
else state->i8751_return = 5;
|
||||
}
|
||||
else
|
||||
{ /* Japan, World */
|
||||
if (b<3) i8751_return=0;
|
||||
else if (b<8) i8751_return=1;
|
||||
else if (b<0xc) i8751_return=2;
|
||||
else if (b<0x10) i8751_return=3;
|
||||
else if (b<0x19) i8751_return=4;
|
||||
else if (b<0x1b) i8751_return=5;
|
||||
else if (b<0x22) i8751_return=6;
|
||||
else if (b<0x28) i8751_return=7;
|
||||
else i8751_return=8;
|
||||
else /* Japan, World */
|
||||
{
|
||||
if (b < 3) state->i8751_return = 0;
|
||||
else if (b < 8) state->i8751_return = 1;
|
||||
else if (b < 0xc) state->i8751_return = 2;
|
||||
else if (b < 0x10) state->i8751_return = 3;
|
||||
else if (b < 0x19) state->i8751_return = 4;
|
||||
else if (b < 0x1b) state->i8751_return = 5;
|
||||
else if (b < 0x22) state->i8751_return = 6;
|
||||
else if (b < 0x28) state->i8751_return = 7;
|
||||
else state->i8751_return = 8;
|
||||
}
|
||||
break;
|
||||
case 2: /* Level 2, Sprite mapping tables, USA & Japan are the same */
|
||||
if (b<3) i8751_return=0;
|
||||
else if (b<9) i8751_return=1;
|
||||
else if (b<0x11) i8751_return=2;
|
||||
else if (b<0x1b) i8751_return=3;
|
||||
else if (b<0x21) i8751_return=4;
|
||||
else if (b<0x28) i8751_return=5;
|
||||
else i8751_return=6;
|
||||
if (b < 3) state->i8751_return = 0;
|
||||
else if (b < 9) state->i8751_return = 1;
|
||||
else if (b < 0x11) state->i8751_return = 2;
|
||||
else if (b < 0x1b) state->i8751_return = 3;
|
||||
else if (b < 0x21) state->i8751_return = 4;
|
||||
else if (b < 0x28) state->i8751_return = 5;
|
||||
else state->i8751_return = 6;
|
||||
break;
|
||||
case 3: /* Level 3, Sprite mapping tables, USA & Japan are the same */
|
||||
if (b<5) i8751_return=0;
|
||||
else if (b<9) i8751_return=1;
|
||||
else if (b<0xd) i8751_return=2;
|
||||
else if (b<0x11) i8751_return=3;
|
||||
else if (b<0x1b) i8751_return=4;
|
||||
else if (b<0x1c) i8751_return=5;
|
||||
else if (b<0x22) i8751_return=6;
|
||||
else if (b<0x27) i8751_return=7;
|
||||
else i8751_return=8;
|
||||
if (b < 5) state->i8751_return = 0;
|
||||
else if (b < 9) state->i8751_return = 1;
|
||||
else if (b < 0xd) state->i8751_return = 2;
|
||||
else if (b < 0x11) state->i8751_return = 3;
|
||||
else if (b < 0x1b) state->i8751_return = 4;
|
||||
else if (b < 0x1c) state->i8751_return = 5;
|
||||
else if (b < 0x22) state->i8751_return = 6;
|
||||
else if (b < 0x27) state->i8751_return = 7;
|
||||
else state->i8751_return = 8;
|
||||
break;
|
||||
case 4: /* Level 4, Sprite mapping tables, USA & Japan are the same */
|
||||
if (b<4) i8751_return=0;
|
||||
else if (b<0xc) i8751_return=1;
|
||||
else if (b<0xf) i8751_return=2;
|
||||
else if (b<0x19) i8751_return=3;
|
||||
else if (b<0x1c) i8751_return=4;
|
||||
else if (b<0x22) i8751_return=5;
|
||||
else if (b<0x29) i8751_return=6;
|
||||
else i8751_return=7;
|
||||
if (b < 4) state->i8751_return = 0;
|
||||
else if (b < 0xc) state->i8751_return = 1;
|
||||
else if (b < 0xf) state->i8751_return = 2;
|
||||
else if (b < 0x19) state->i8751_return = 3;
|
||||
else if (b < 0x1c) state->i8751_return = 4;
|
||||
else if (b < 0x22) state->i8751_return = 5;
|
||||
else if (b < 0x29) state->i8751_return = 6;
|
||||
else state->i8751_return = 7;
|
||||
break;
|
||||
case 5: /* Level 5, Sprite mapping tables */
|
||||
if (b<7) i8751_return=0;
|
||||
else if (b<0xe) i8751_return=1;
|
||||
else if (b<0x14) i8751_return=2;
|
||||
else if (b<0x1a) i8751_return=3;
|
||||
else if (b<0x23) i8751_return=4;
|
||||
else if (b<0x27) i8751_return=5;
|
||||
else i8751_return=6;
|
||||
if (b < 7) state->i8751_return = 0;
|
||||
else if (b < 0xe) state->i8751_return = 1;
|
||||
else if (b < 0x14) state->i8751_return = 2;
|
||||
else if (b < 0x1a) state->i8751_return = 3;
|
||||
else if (b < 0x23) state->i8751_return = 4;
|
||||
else if (b < 0x27) state->i8751_return = 5;
|
||||
else state->i8751_return = 6;
|
||||
break;
|
||||
case 6: /* Level 6, Sprite mapping tables */
|
||||
if (b<3) i8751_return=0;
|
||||
else if (b<0xb) i8751_return=1;
|
||||
else if (b<0x11) i8751_return=2;
|
||||
else if (b<0x17) i8751_return=3;
|
||||
else if (b<0x1d) i8751_return=4;
|
||||
else if (b<0x24) i8751_return=5;
|
||||
else i8751_return=6;
|
||||
if (b < 3) state->i8751_return = 0;
|
||||
else if (b < 0xb) state->i8751_return = 1;
|
||||
else if (b < 0x11) state->i8751_return = 2;
|
||||
else if (b < 0x17) state->i8751_return = 3;
|
||||
else if (b < 0x1d) state->i8751_return = 4;
|
||||
else if (b < 0x24) state->i8751_return = 5;
|
||||
else state->i8751_return = 6;
|
||||
break;
|
||||
case 7: /* Level 7, Sprite mapping tables */
|
||||
if (b<5) i8751_return=0;
|
||||
else if (b<0xb) i8751_return=1;
|
||||
else if (b<0x11) i8751_return=2;
|
||||
else if (b<0x1a) i8751_return=3;
|
||||
else if (b<0x21) i8751_return=4;
|
||||
else if (b<0x27) i8751_return=5;
|
||||
else i8751_return=6;
|
||||
if (b < 5) state->i8751_return = 0;
|
||||
else if (b < 0xb) state->i8751_return = 1;
|
||||
else if (b < 0x11) state->i8751_return = 2;
|
||||
else if (b < 0x1a) state->i8751_return = 3;
|
||||
else if (b < 0x21) state->i8751_return = 4;
|
||||
else if (b < 0x27) state->i8751_return = 5;
|
||||
else state->i8751_return = 6;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// logerror("%s - Unknown Write %02x intel\n",cpuexec_describe_context(machine),data);
|
||||
// logerror("%s - Unknown Write %02x intel\n", cpuexec_describe_context(machine), data);
|
||||
|
||||
cputag_set_input_line(machine, "maincpu", 6, HOLD_LINE); /* Signal main cpu task is complete */
|
||||
i8751_needs_ack=1;
|
||||
cpu_set_input_line(state->maincpu, 6, HOLD_LINE); /* Signal main cpu task is complete */
|
||||
state->i8751_needs_ack = 1;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/*************************************
|
||||
*
|
||||
* Memory handlers
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static WRITE16_HANDLER( karnov_control_w )
|
||||
{
|
||||
karnov_state *state = (karnov_state *)space->machine->driver_data;
|
||||
|
||||
/* Mnemonics filled in from the schematics, brackets are my comments */
|
||||
switch (offset<<1)
|
||||
switch (offset << 1)
|
||||
{
|
||||
case 0: /* SECLR (Interrupt ack for Level 6 i8751 interrupt) */
|
||||
cputag_set_input_line(space->machine, "maincpu", 6, CLEAR_LINE);
|
||||
cpu_set_input_line(state->maincpu, 6, CLEAR_LINE);
|
||||
|
||||
if (i8751_needs_ack)
|
||||
if (state->i8751_needs_ack)
|
||||
{
|
||||
/* If a command and coin insert happen at once, then the i8751 will queue the
|
||||
coin command until the previous command is ACK'd */
|
||||
if (i8751_coin_pending)
|
||||
/* If a command and coin insert happen at once, then the i8751 will queue the coin command until the previous command is ACK'd */
|
||||
if (state->i8751_coin_pending)
|
||||
{
|
||||
i8751_return=i8751_coin_pending;
|
||||
cputag_set_input_line(space->machine, "maincpu", 6, HOLD_LINE);
|
||||
i8751_coin_pending=0;
|
||||
state->i8751_return = state->i8751_coin_pending;
|
||||
cpu_set_input_line(state->maincpu, 6, HOLD_LINE);
|
||||
state->i8751_coin_pending = 0;
|
||||
}
|
||||
else if (i8751_command_queue)
|
||||
else if (state->i8751_command_queue)
|
||||
{
|
||||
/* Pending control command - just write it back as SECREQ */
|
||||
i8751_needs_ack=0;
|
||||
karnov_control_w(space,3,i8751_command_queue,0xffff);
|
||||
i8751_command_queue=0;
|
||||
state->i8751_needs_ack = 0;
|
||||
karnov_control_w(space, 3, state->i8751_command_queue, 0xffff);
|
||||
state->i8751_command_queue = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
i8751_needs_ack=0;
|
||||
state->i8751_needs_ack = 0;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
case 2: /* SONREQ (Sound CPU byte) */
|
||||
soundlatch_w(space,0,data&0xff);
|
||||
cputag_set_input_line (space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
soundlatch_w(space, 0, data & 0xff);
|
||||
cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, PULSE_LINE);
|
||||
break;
|
||||
|
||||
case 4: /* DM (DMA to buffer spriteram) */
|
||||
buffer_spriteram16_w(space,0,0,0xffff);
|
||||
buffer_spriteram16_w(space, 0, 0, 0xffff);
|
||||
break;
|
||||
|
||||
case 6: /* SECREQ (Interrupt & Data to i8751) */
|
||||
if (microcontroller_id==KARNOV || microcontroller_id==KARNOVJ) karnov_i8751_w(space->machine, data);
|
||||
if (microcontroller_id==CHELNOV || microcontroller_id==CHELNOVJ || microcontroller_id==CHELNOVW) chelnov_i8751_w(space->machine, data);
|
||||
if (microcontroller_id==WNDRPLNT) wndrplnt_i8751_w(space->machine, data);
|
||||
if (state->microcontroller_id == KARNOV || state->microcontroller_id == KARNOVJ)
|
||||
karnov_i8751_w(space->machine, data);
|
||||
if (state->microcontroller_id == CHELNOV || state->microcontroller_id == CHELNOVJ || state->microcontroller_id == CHELNOVW)
|
||||
chelnov_i8751_w(space->machine, data);
|
||||
if (state->microcontroller_id == WNDRPLNT)
|
||||
wndrplnt_i8751_w(space->machine, data);
|
||||
break;
|
||||
|
||||
case 8: /* HSHIFT (9 bits) - Top bit indicates video flip */
|
||||
COMBINE_DATA(&karnov_scroll[0]);
|
||||
karnov_flipscreen_w(space->machine, data>>15);
|
||||
COMBINE_DATA(&state->scroll[0]);
|
||||
karnov_flipscreen_w(space->machine, data >> 15);
|
||||
break;
|
||||
|
||||
case 0xa: /* VSHIFT */
|
||||
COMBINE_DATA(&karnov_scroll[1]);
|
||||
COMBINE_DATA(&state->scroll[1]);
|
||||
break;
|
||||
|
||||
case 0xc: /* SECR (Reset i8751) */
|
||||
logerror("Reset i8751\n");
|
||||
i8751_needs_ack=0;
|
||||
i8751_coin_pending=0;
|
||||
i8751_command_queue=0;
|
||||
i8751_return=0;
|
||||
state->i8751_needs_ack = 0;
|
||||
state->i8751_coin_pending = 0;
|
||||
state->i8751_command_queue = 0;
|
||||
state->i8751_return = 0;
|
||||
break;
|
||||
|
||||
case 0xe: /* INTCLR (Interrupt ack for Level 7 vbl interrupt) */
|
||||
cputag_set_input_line(space->machine, "maincpu", 7, CLEAR_LINE);
|
||||
cpu_set_input_line(state->maincpu, 7, CLEAR_LINE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static READ16_HANDLER( karnov_control_r )
|
||||
{
|
||||
switch (offset<<1)
|
||||
karnov_state *state = (karnov_state *)space->machine->driver_data;
|
||||
|
||||
switch (offset << 1)
|
||||
{
|
||||
case 0:
|
||||
return input_port_read(space->machine, "P1_P2");
|
||||
@ -351,27 +376,30 @@ static READ16_HANDLER( karnov_control_r )
|
||||
case 4:
|
||||
return input_port_read(space->machine, "DSW");
|
||||
case 6: /* i8751 return values */
|
||||
return i8751_return;
|
||||
return state->i8751_return;
|
||||
}
|
||||
|
||||
return ~0;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/*************************************
|
||||
*
|
||||
* Address maps
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static ADDRESS_MAP_START( karnov_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x05ffff) AM_ROM
|
||||
AM_RANGE(0x060000, 0x063fff) AM_RAM AM_BASE(&karnov_ram)
|
||||
AM_RANGE(0x060000, 0x063fff) AM_RAM AM_BASE_MEMBER(karnov_state, ram)
|
||||
AM_RANGE(0x080000, 0x080fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0x0a0000, 0x0a07ff) AM_RAM_WRITE(karnov_videoram_w) AM_BASE_GENERIC(videoram)
|
||||
AM_RANGE(0x0a0000, 0x0a07ff) AM_RAM_WRITE(karnov_videoram_w) AM_BASE_MEMBER(karnov_state, videoram)
|
||||
AM_RANGE(0x0a0800, 0x0a0fff) AM_WRITE(karnov_videoram_w) /* Wndrplnt Mirror */
|
||||
AM_RANGE(0x0a1000, 0x0a17ff) AM_WRITEONLY AM_BASE(&karnov_pf_data)
|
||||
AM_RANGE(0x0a1000, 0x0a17ff) AM_WRITEONLY AM_BASE_MEMBER(karnov_state, pf_data)
|
||||
AM_RANGE(0x0a1800, 0x0a1fff) AM_WRITE(karnov_playfield_swap_w)
|
||||
AM_RANGE(0x0c0000, 0x0c0007) AM_READ(karnov_control_r)
|
||||
AM_RANGE(0x0c0000, 0x0c000f) AM_WRITE(karnov_control_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static ADDRESS_MAP_START( karnov_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x05ff) AM_RAM
|
||||
@ -382,8 +410,11 @@ static ADDRESS_MAP_START( karnov_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Input ports
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static INPUT_PORTS_START( common )
|
||||
PORT_START("P1_P2")
|
||||
@ -627,7 +658,12 @@ static INPUT_PORTS_START( chelnovu )
|
||||
PORT_DIPUNUSED( 0x8000, 0x8000 )
|
||||
INPUT_PORTS_END
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Graphics definitions
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static const gfx_layout chars =
|
||||
{
|
||||
@ -672,36 +708,45 @@ static GFXDECODE_START( karnov )
|
||||
GFXDECODE_ENTRY( "gfx3", 0, sprites, 256, 16 ) /* colors 256-511 */
|
||||
GFXDECODE_END
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Interrupt generator
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static INTERRUPT_GEN( karnov_interrupt )
|
||||
{
|
||||
static int latch;
|
||||
karnov_state *state = (karnov_state *)device->machine->driver_data;
|
||||
|
||||
/* Coin input to the i8751 generates an interrupt to the main cpu */
|
||||
if (input_port_read(device->machine, "FAKE") == coin_mask) latch=1;
|
||||
if (input_port_read(device->machine, "FAKE") != coin_mask && latch)
|
||||
if (input_port_read(device->machine, "FAKE") == state->coin_mask)
|
||||
state->latch = 1;
|
||||
|
||||
if (input_port_read(device->machine, "FAKE") != state->coin_mask && state->latch)
|
||||
{
|
||||
if (i8751_needs_ack)
|
||||
if (state->i8751_needs_ack)
|
||||
{
|
||||
/* i8751 is busy - queue the command */
|
||||
i8751_coin_pending=input_port_read(device->machine, "FAKE") | 0x8000;
|
||||
state->i8751_coin_pending = input_port_read(device->machine, "FAKE") | 0x8000;
|
||||
}
|
||||
else
|
||||
{
|
||||
i8751_return=input_port_read(device->machine, "FAKE") | 0x8000;
|
||||
cpu_set_input_line(device,6,HOLD_LINE);
|
||||
i8751_needs_ack=1;
|
||||
state->i8751_return = input_port_read(device->machine, "FAKE") | 0x8000;
|
||||
cpu_set_input_line(device, 6, HOLD_LINE);
|
||||
state->i8751_needs_ack = 1;
|
||||
}
|
||||
latch=0;
|
||||
|
||||
state->latch = 0;
|
||||
}
|
||||
|
||||
cpu_set_input_line(device,7,HOLD_LINE); /* VBL */
|
||||
cpu_set_input_line(device, 7, HOLD_LINE); /* VBL */
|
||||
}
|
||||
|
||||
static void sound_irq(const device_config *device, int linestate)
|
||||
static void sound_irq( const device_config *device, int linestate )
|
||||
{
|
||||
cputag_set_input_line(device->machine, "audiocpu", 0, linestate); /* IRQ */
|
||||
karnov_state *state = (karnov_state *)device->machine->driver_data;
|
||||
cpu_set_input_line(state->audiocpu, 0, linestate); /* IRQ */
|
||||
}
|
||||
|
||||
static const ym3526_interface ym3526_config =
|
||||
@ -709,15 +754,55 @@ static const ym3526_interface ym3526_config =
|
||||
sound_irq
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
/*************************************
|
||||
*
|
||||
* Machine driver
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( karnov )
|
||||
{
|
||||
karnov_state *state = (karnov_state *)machine->driver_data;
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
state->audiocpu = devtag_get_device(machine, "audiocpu");
|
||||
|
||||
state_save_register_global(machine, state->flipscreen);
|
||||
state_save_register_global_array(machine, state->scroll);
|
||||
|
||||
state_save_register_global(machine, state->i8751_return);
|
||||
state_save_register_global(machine, state->i8751_needs_ack);
|
||||
state_save_register_global(machine, state->i8751_coin_pending);
|
||||
state_save_register_global(machine, state->i8751_command_queue);
|
||||
state_save_register_global(machine, state->i8751_level);
|
||||
state_save_register_global(machine, state->latch);
|
||||
|
||||
}
|
||||
|
||||
static MACHINE_RESET( karnov )
|
||||
{
|
||||
memset(karnov_ram,0,0x4000/2); /* Chelnov likes ram clear on reset.. */
|
||||
karnov_state *state = (karnov_state *)machine->driver_data;
|
||||
|
||||
memset(state->ram, 0, 0x4000 / 2); /* Chelnov likes ram clear on reset.. */
|
||||
|
||||
state->i8751_return = 0;
|
||||
state->i8751_needs_ack = 0;
|
||||
state->i8751_coin_pending = 0;
|
||||
state->i8751_command_queue = 0;
|
||||
state->i8751_level = 0;
|
||||
// state->latch = 0;
|
||||
|
||||
state->flipscreen = 0;
|
||||
state->scroll[0] = 0;
|
||||
state->scroll[0] = 0;
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_DRIVER_START( karnov )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(karnov_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M68000, 10000000) /* 10 MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(karnov_map)
|
||||
@ -726,6 +811,7 @@ static MACHINE_DRIVER_START( karnov )
|
||||
MDRV_CPU_ADD("audiocpu", M6502, 1500000) /* Accurate */
|
||||
MDRV_CPU_PROGRAM_MAP(karnov_sound_map)
|
||||
|
||||
MDRV_MACHINE_START(karnov)
|
||||
MDRV_MACHINE_RESET(karnov)
|
||||
|
||||
/* video hardware */
|
||||
@ -759,6 +845,9 @@ MACHINE_DRIVER_END
|
||||
|
||||
static MACHINE_DRIVER_START( wndrplnt )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(karnov_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M68000, 10000000) /* 10 MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(karnov_map)
|
||||
@ -767,6 +856,7 @@ static MACHINE_DRIVER_START( wndrplnt )
|
||||
MDRV_CPU_ADD("audiocpu", M6502, 1500000) /* Accurate */
|
||||
MDRV_CPU_PROGRAM_MAP(karnov_sound_map)
|
||||
|
||||
MDRV_MACHINE_START(karnov)
|
||||
MDRV_MACHINE_RESET(karnov)
|
||||
|
||||
/* video hardware */
|
||||
@ -797,7 +887,12 @@ static MACHINE_DRIVER_START( wndrplnt )
|
||||
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
MACHINE_DRIVER_END
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* ROM definition(s)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
ROM_START( karnov )
|
||||
ROM_REGION( 0x60000, "maincpu", 0 ) /* 6*64k for 68000 code */
|
||||
@ -1006,61 +1101,77 @@ ROM_START( chelnovj )
|
||||
ROM_LOAD( "ee20.l6", 0x0400, 0x0400, CRC(41816132) SHA1(89a1194bd8bf39f13419df685e489440bdb05676) )
|
||||
ROM_END
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Driver initialization
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static DRIVER_INIT( karnov )
|
||||
{
|
||||
microcontroller_id=KARNOV;
|
||||
coin_mask=0;
|
||||
karnov_state *state = (karnov_state *)machine->driver_data;
|
||||
state->microcontroller_id = KARNOV;
|
||||
state->coin_mask = 0;
|
||||
}
|
||||
|
||||
static DRIVER_INIT( karnovj )
|
||||
{
|
||||
microcontroller_id=KARNOVJ;
|
||||
coin_mask=0;
|
||||
karnov_state *state = (karnov_state *)machine->driver_data;
|
||||
state->microcontroller_id = KARNOVJ;
|
||||
state->coin_mask = 0;
|
||||
}
|
||||
|
||||
static DRIVER_INIT( wndrplnt )
|
||||
{
|
||||
microcontroller_id=WNDRPLNT;
|
||||
coin_mask=0;
|
||||
karnov_state *state = (karnov_state *)machine->driver_data;
|
||||
state->microcontroller_id = WNDRPLNT;
|
||||
state->coin_mask = 0;
|
||||
}
|
||||
|
||||
static DRIVER_INIT( chelnov )
|
||||
{
|
||||
karnov_state *state = (karnov_state *)machine->driver_data;
|
||||
UINT16 *RAM = (UINT16 *)memory_region(machine, "maincpu");
|
||||
|
||||
microcontroller_id=CHELNOV;
|
||||
coin_mask=0xe0;
|
||||
RAM[0x0A26/2]=0x4E71; /* removes a protection lookup table */
|
||||
RAM[0x062a/2]=0x4E71; /* hangs waiting on i8751 int */
|
||||
state->microcontroller_id = CHELNOV;
|
||||
state->coin_mask = 0xe0;
|
||||
RAM[0x0a26/2] = 0x4e71; /* removes a protection lookup table */
|
||||
RAM[0x062a/2] = 0x4e71; /* hangs waiting on i8751 int */
|
||||
}
|
||||
|
||||
static DRIVER_INIT( chelnovw )
|
||||
{
|
||||
karnov_state *state = (karnov_state *)machine->driver_data;
|
||||
UINT16 *RAM = (UINT16 *)memory_region(machine, "maincpu");
|
||||
|
||||
microcontroller_id=CHELNOVW;
|
||||
coin_mask=0xe0;
|
||||
RAM[0x0A26/2]=0x4E71; /* removes a protection lookup table */
|
||||
RAM[0x062a/2]=0x4E71; /* hangs waiting on i8751 int */
|
||||
state->microcontroller_id = CHELNOVW;
|
||||
state->coin_mask = 0xe0;
|
||||
RAM[0x0a26/2] = 0x4e71; /* removes a protection lookup table */
|
||||
RAM[0x062a/2] = 0x4e71; /* hangs waiting on i8751 int */
|
||||
}
|
||||
|
||||
static DRIVER_INIT( chelnovj )
|
||||
{
|
||||
karnov_state *state = (karnov_state *)machine->driver_data;
|
||||
UINT16 *RAM = (UINT16 *)memory_region(machine, "maincpu");
|
||||
|
||||
microcontroller_id=CHELNOVJ;
|
||||
coin_mask=0xe0;
|
||||
RAM[0x0a2e/2]=0x4E71; /* removes a protection lookup table */
|
||||
RAM[0x062a/2]=0x4E71; /* hangs waiting on i8751 int */
|
||||
state->microcontroller_id = CHELNOVJ;
|
||||
state->coin_mask = 0xe0;
|
||||
RAM[0x0a2e/2] = 0x4e71; /* removes a protection lookup table */
|
||||
RAM[0x062a/2] = 0x4e71; /* hangs waiting on i8751 int */
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
GAME( 1987, karnov, 0, karnov, karnov, karnov, ROT0, "Data East USA", "Karnov (US)", 0 )
|
||||
GAME( 1987, karnovj, karnov, karnov, karnov, karnovj, ROT0, "Data East Corporation", "Karnov (Japan)", 0 )
|
||||
GAME( 1987, wndrplnt, 0, wndrplnt, wndrplnt,wndrplnt, ROT270, "Data East Corporation", "Wonder Planet (Japan)", 0 )
|
||||
GAME( 1988, chelnov, 0, karnov, chelnov, chelnovw, ROT0, "Data East Corporation", "Chelnov - Atomic Runner (World)", 0 )
|
||||
GAME( 1988, chelnovu, chelnov, karnov, chelnovu, chelnov, ROT0, "Data East USA", "Chelnov - Atomic Runner (US)", 0 )
|
||||
GAME( 1988, chelnovj, chelnov, karnov, chelnovu, chelnovj, ROT0, "Data East Corporation", "Chelnov - Atomic Runner (Japan)", 0 )
|
||||
/*************************************
|
||||
*
|
||||
* Game driver(s)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1987, karnov, 0, karnov, karnov, karnov, ROT0, "Data East USA", "Karnov (US)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1987, karnovj, karnov, karnov, karnov, karnovj, ROT0, "Data East Corporation", "Karnov (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1987, wndrplnt, 0, wndrplnt, wndrplnt, wndrplnt, ROT270, "Data East Corporation", "Wonder Planet (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1988, chelnov, 0, karnov, chelnov, chelnovw, ROT0, "Data East Corporation", "Chelnov - Atomic Runner (World)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1988, chelnovu, chelnov, karnov, chelnovu, chelnov, ROT0, "Data East USA", "Chelnov - Atomic Runner (US)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1988, chelnovj, chelnov, karnov, chelnovu, chelnovj, ROT0, "Data East Corporation", "Chelnov - Atomic Runner (Japan)", GAME_SUPPORTS_SAVE )
|
||||
|
@ -61,69 +61,59 @@ Same as VS version but with a DAC instead of a MSM5205. Also some minor
|
||||
IO ports and memory map changes. Dip switches differ too.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/ay8910.h"
|
||||
#include "sound/dac.h"
|
||||
#include "sound/msm5205.h"
|
||||
#include "includes/kchamp.h"
|
||||
|
||||
|
||||
/* from video */
|
||||
extern WRITE8_HANDLER( kchamp_videoram_w );
|
||||
extern WRITE8_HANDLER( kchamp_colorram_w );
|
||||
extern WRITE8_HANDLER( kchamp_flipscreen_w );
|
||||
|
||||
extern PALETTE_INIT( kchamp );
|
||||
extern VIDEO_START( kchamp );
|
||||
extern VIDEO_UPDATE( kchamp );
|
||||
extern VIDEO_UPDATE( kchampvs );
|
||||
|
||||
|
||||
static int nmi_enable = 0;
|
||||
static int sound_nmi_enable = 0;
|
||||
|
||||
/********************
|
||||
* VS Version *
|
||||
********************/
|
||||
|
||||
static WRITE8_HANDLER( control_w )
|
||||
{
|
||||
nmi_enable = data & 1;
|
||||
kchamp_state *state = (kchamp_state *)space->machine->driver_data;
|
||||
state->nmi_enable = data & 1;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( sound_reset_w )
|
||||
{
|
||||
if ( !( data & 1 ) )
|
||||
cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_RESET, PULSE_LINE);
|
||||
kchamp_state *state = (kchamp_state *)space->machine->driver_data;
|
||||
if (!(data & 1))
|
||||
cpu_set_input_line(state->audiocpu, INPUT_LINE_RESET, PULSE_LINE);
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( sound_control_w )
|
||||
{
|
||||
msm5205_reset_w( device, !( data & 1 ) );
|
||||
sound_nmi_enable = ( ( data >> 1 ) & 1 );
|
||||
kchamp_state *state = (kchamp_state *)device->machine->driver_data;
|
||||
msm5205_reset_w(device, !(data & 1));
|
||||
state->sound_nmi_enable = ((data >> 1) & 1);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( sound_command_w )
|
||||
{
|
||||
soundlatch_w( space, 0, data );
|
||||
cputag_set_input_line_and_vector(space->machine, "audiocpu", 0, HOLD_LINE, 0xff );
|
||||
kchamp_state *state = (kchamp_state *)space->machine->driver_data;
|
||||
soundlatch_w(space, 0, data);
|
||||
cpu_set_input_line_and_vector(state->audiocpu, 0, HOLD_LINE, 0xff);
|
||||
}
|
||||
|
||||
static int msm_data = 0;
|
||||
static int msm_play_lo_nibble;
|
||||
|
||||
static WRITE8_HANDLER( sound_msm_w )
|
||||
{
|
||||
msm_data = data;
|
||||
msm_play_lo_nibble = 1;
|
||||
kchamp_state *state = (kchamp_state *)space->machine->driver_data;
|
||||
state->msm_data = data;
|
||||
state->msm_play_lo_nibble = 1;
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( kchampvs_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0xbfff) AM_ROM
|
||||
AM_RANGE(0xc000, 0xcfff) AM_RAM
|
||||
AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(kchamp_videoram_w) AM_BASE_GENERIC(videoram)
|
||||
AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(kchamp_colorram_w) AM_BASE_GENERIC(colorram)
|
||||
AM_RANGE(0xd800, 0xd8ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(kchamp_videoram_w) AM_BASE_MEMBER(kchamp_state, videoram)
|
||||
AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(kchamp_colorram_w) AM_BASE_MEMBER(kchamp_state, colorram)
|
||||
AM_RANGE(0xd800, 0xd8ff) AM_RAM AM_BASE_SIZE_MEMBER(kchamp_state, spriteram, spriteram_size)
|
||||
AM_RANGE(0xd900, 0xdfff) AM_RAM
|
||||
AM_RANGE(0xe000, 0xffff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
@ -158,24 +148,27 @@ ADDRESS_MAP_END
|
||||
********************/
|
||||
static READ8_HANDLER( sound_reset_r )
|
||||
{
|
||||
cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_RESET, PULSE_LINE);
|
||||
kchamp_state *state = (kchamp_state *)space->machine->driver_data;
|
||||
cpu_set_input_line(state->audiocpu, INPUT_LINE_RESET, PULSE_LINE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( kc_sound_control_w )
|
||||
{
|
||||
if ( offset == 0 )
|
||||
sound_nmi_enable = ( ( data >> 7 ) & 1 );
|
||||
kchamp_state *state = (kchamp_state *)space->machine->driver_data;
|
||||
|
||||
if (offset == 0)
|
||||
state->sound_nmi_enable = ((data >> 7) & 1);
|
||||
// else
|
||||
// DAC_set_volume(0,( data == 1 ) ? 255 : 0,0);
|
||||
// DAC_set_volume(0, (data == 1) ? 255 : 0, 0);
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( kchamp_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0xbfff) AM_ROM
|
||||
AM_RANGE(0xc000, 0xdfff) AM_RAM
|
||||
AM_RANGE(0xe000, 0xe3ff) AM_RAM_WRITE(kchamp_videoram_w) AM_BASE_GENERIC(videoram)
|
||||
AM_RANGE(0xe400, 0xe7ff) AM_RAM_WRITE(kchamp_colorram_w) AM_BASE_GENERIC(colorram)
|
||||
AM_RANGE(0xea00, 0xeaff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0xe000, 0xe3ff) AM_RAM_WRITE(kchamp_videoram_w) AM_BASE_MEMBER(kchamp_state, videoram)
|
||||
AM_RANGE(0xe400, 0xe7ff) AM_RAM_WRITE(kchamp_colorram_w) AM_BASE_MEMBER(kchamp_state, colorram)
|
||||
AM_RANGE(0xea00, 0xeaff) AM_RAM AM_BASE_SIZE_MEMBER(kchamp_state, spriteram, spriteram_size)
|
||||
AM_RANGE(0xeb00, 0xffff) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -355,29 +348,26 @@ GFXDECODE_END
|
||||
|
||||
static INTERRUPT_GEN( kc_interrupt )
|
||||
{
|
||||
|
||||
if ( nmi_enable )
|
||||
kchamp_state *state = (kchamp_state *)device->machine->driver_data;
|
||||
if (state->nmi_enable)
|
||||
cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
|
||||
static void msmint(const device_config *device)
|
||||
static void msmint( const device_config *device )
|
||||
{
|
||||
kchamp_state *state = (kchamp_state *)device->machine->driver_data;
|
||||
|
||||
static int counter = 0;
|
||||
|
||||
if ( msm_play_lo_nibble )
|
||||
msm5205_data_w( device, msm_data & 0x0f );
|
||||
if (state->msm_play_lo_nibble)
|
||||
msm5205_data_w(device, state->msm_data & 0x0f);
|
||||
else
|
||||
msm5205_data_w( device, ( msm_data >> 4 ) & 0x0f );
|
||||
msm5205_data_w(device, (state->msm_data >> 4) & 0x0f);
|
||||
|
||||
msm_play_lo_nibble ^= 1;
|
||||
state->msm_play_lo_nibble ^= 1;
|
||||
|
||||
if ( !( counter ^= 1 ) )
|
||||
if (!(state->counter ^= 1))
|
||||
{
|
||||
if ( sound_nmi_enable )
|
||||
{
|
||||
cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE );
|
||||
}
|
||||
if (state->sound_nmi_enable)
|
||||
cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -393,27 +383,63 @@ static const msm5205_interface msm_interface =
|
||||
|
||||
static INTERRUPT_GEN( sound_int )
|
||||
{
|
||||
if ( sound_nmi_enable )
|
||||
kchamp_state *state = (kchamp_state *)device->machine->driver_data;
|
||||
if (state->sound_nmi_enable)
|
||||
cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_START( kchamp )
|
||||
{
|
||||
kchamp_state *state = (kchamp_state *)machine->driver_data;
|
||||
|
||||
state->audiocpu = devtag_get_device(machine, "audiocpu");
|
||||
|
||||
state_save_register_global(machine, state->nmi_enable);
|
||||
state_save_register_global(machine, state->sound_nmi_enable);
|
||||
}
|
||||
|
||||
static MACHINE_START( kchampvs )
|
||||
{
|
||||
kchamp_state *state = (kchamp_state *)machine->driver_data;
|
||||
|
||||
MACHINE_START_CALL(kchamp);
|
||||
|
||||
state_save_register_global(machine, state->msm_data);
|
||||
state_save_register_global(machine, state->msm_play_lo_nibble);
|
||||
state_save_register_global(machine, state->counter);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( kchamp )
|
||||
{
|
||||
kchamp_state *state = (kchamp_state *)machine->driver_data;
|
||||
|
||||
state->nmi_enable = 0;
|
||||
state->sound_nmi_enable = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( kchampvs )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(kchamp_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, XTAL_12MHz/4) /* verified on pcb */
|
||||
MDRV_CPU_ADD("maincpu", Z80, XTAL_12MHz/4) /* verified on pcb */
|
||||
MDRV_CPU_PROGRAM_MAP(kchampvs_map)
|
||||
MDRV_CPU_IO_MAP(kchampvs_io_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", kc_interrupt)
|
||||
|
||||
MDRV_CPU_ADD("audiocpu", Z80, XTAL_12MHz/4) /* verified on pcb */
|
||||
MDRV_CPU_ADD("audiocpu", Z80, XTAL_12MHz/4) /* verified on pcb */
|
||||
MDRV_CPU_PROGRAM_MAP(kchampvs_sound_map)
|
||||
MDRV_CPU_IO_MAP(kchampvs_sound_io_map) /* irq's triggered from main cpu */
|
||||
/* nmi's from msm5205 */
|
||||
|
||||
MDRV_MACHINE_START(kchampvs)
|
||||
MDRV_MACHINE_RESET(kchamp)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(59.10) /* verified on pcb */
|
||||
MDRV_SCREEN_REFRESH_RATE(59.10) /* verified on pcb */
|
||||
MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
|
||||
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
||||
MDRV_SCREEN_SIZE(32*8, 32*8)
|
||||
@ -429,13 +455,13 @@ static MACHINE_DRIVER_START( kchampvs )
|
||||
/* sound hardware */
|
||||
MDRV_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
MDRV_SOUND_ADD("ay1", AY8910, XTAL_12MHz/8) /* verified on pcb */
|
||||
MDRV_SOUND_ADD("ay1", AY8910, XTAL_12MHz/8) /* verified on pcb */
|
||||
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
|
||||
|
||||
MDRV_SOUND_ADD("ay2", AY8910, XTAL_12MHz/8) /* verified on pcb */
|
||||
MDRV_SOUND_ADD("ay2", AY8910, XTAL_12MHz/8) /* verified on pcb */
|
||||
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
|
||||
|
||||
MDRV_SOUND_ADD("msm", MSM5205, 375000) /* verified on pcb, discrete circuit clock */
|
||||
MDRV_SOUND_ADD("msm", MSM5205, 375000) /* verified on pcb, discrete circuit clock */
|
||||
MDRV_SOUND_CONFIG(msm_interface)
|
||||
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
MACHINE_DRIVER_END
|
||||
@ -446,6 +472,9 @@ MACHINE_DRIVER_END
|
||||
|
||||
static MACHINE_DRIVER_START( kchamp )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(kchamp_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, 3000000) /* 12MHz / 4 = 3.0 MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(kchamp_map)
|
||||
@ -459,6 +488,9 @@ static MACHINE_DRIVER_START( kchamp )
|
||||
/* irq's triggered from main cpu */
|
||||
/* nmi's from 125 Hz clock */
|
||||
|
||||
MDRV_MACHINE_START(kchamp)
|
||||
MDRV_MACHINE_RESET(kchamp)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -711,7 +743,7 @@ static UINT8 *decrypt_code(running_machine *machine)
|
||||
|
||||
memory_set_decrypted_region(space, 0x0000, 0xffff, decrypted);
|
||||
|
||||
for (A = 0;A < 0x10000;A++)
|
||||
for (A = 0; A < 0x10000; A++)
|
||||
decrypted[A] = (rom[A] & 0x55) | ((rom[A] & 0x88) >> 2) | ((rom[A] & 0x22) << 2);
|
||||
|
||||
return decrypted;
|
||||
@ -720,6 +752,7 @@ static UINT8 *decrypt_code(running_machine *machine)
|
||||
|
||||
static DRIVER_INIT( kchampvs )
|
||||
{
|
||||
kchamp_state *state = (kchamp_state *)machine->driver_data;
|
||||
UINT8 *rom = memory_region(machine, "maincpu");
|
||||
UINT8 *decrypted = decrypt_code(machine);
|
||||
int A;
|
||||
@ -742,28 +775,27 @@ static DRIVER_INIT( kchampvs )
|
||||
A += 2;
|
||||
decrypted[A] = rom[A]; /* fix fourth opcode (ld ($xxxx),a */
|
||||
/* and from here on, opcodes are encrypted */
|
||||
|
||||
state->counter = 0;
|
||||
state->msm_data = 0;
|
||||
state->msm_play_lo_nibble = 0;
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( kchamp )
|
||||
{
|
||||
nmi_enable = 0;
|
||||
sound_nmi_enable = 0;
|
||||
}
|
||||
|
||||
static DRIVER_INIT( kchampvs2 )
|
||||
{
|
||||
DRIVER_INIT_CALL( kchamp );
|
||||
kchamp_state *state = (kchamp_state *)machine->driver_data;
|
||||
|
||||
decrypt_code(machine);
|
||||
msm_data = 0;
|
||||
msm_play_lo_nibble = 1;
|
||||
state->counter = 0;
|
||||
state->msm_data = 0;
|
||||
state->msm_play_lo_nibble = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
GAME( 1984, kchamp, 0, kchamp, kchamp, kchamp, ROT90, "Data East USA", "Karate Champ (US)", 0 )
|
||||
GAME( 1984, karatedo, kchamp, kchamp, kchamp, kchamp, ROT90, "Data East Corporation", "Karate Dou (Japan)", 0 )
|
||||
GAME( 1984, kchampvs, kchamp, kchampvs, kchampvs, kchampvs, ROT90, "Data East USA", "Karate Champ (US, VS version set 1)", 0 )
|
||||
GAME( 1984, kchampvs2, kchamp, kchampvs, kchampvs, kchampvs2, ROT90, "Data East USA", "Karate Champ (US, VS version set 2)", 0 )
|
||||
GAME( 1984, karatevs, kchamp, kchampvs, kchampvs, kchampvs, ROT90, "Data East Corporation", "Taisen Karate Dou (Japan VS version)", 0 )
|
||||
|
||||
GAME( 1984, kchamp, 0, kchamp, kchamp, 0, ROT90, "Data East USA", "Karate Champ (US)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, karatedo, kchamp, kchamp, kchamp, 0, ROT90, "Data East Corporation", "Karate Dou (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, kchampvs, kchamp, kchampvs, kchampvs, kchampvs, ROT90, "Data East USA", "Karate Champ (US, VS version set 1)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, kchampvs2, kchamp, kchampvs, kchampvs, kchampvs2, ROT90, "Data East USA", "Karate Champ (US, VS version set 2)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, karatevs, kchamp, kchampvs, kchampvs, kchampvs, ROT90, "Data East Corporation", "Taisen Karate Dou (Japan VS version)", GAME_SUPPORTS_SAVE )
|
||||
|
@ -37,8 +37,9 @@ lev 7 : 0x7c : 0000 0000 - x
|
||||
#include "driver.h"
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "cpu/pic16c5x/pic16c5x.h"
|
||||
#include "machine/eeprom.h"
|
||||
#include "machine/eepromdev.h"
|
||||
#include "sound/okim6295.h"
|
||||
#include "includes/kickgoal.h"
|
||||
|
||||
/**************************************************************************
|
||||
This table converts commands sent from the main CPU, into sample numbers
|
||||
@ -108,27 +109,13 @@ Hollywood Action
|
||||
|
||||
#define oki_time_base 0x08
|
||||
|
||||
//static int kickgoal_sound;
|
||||
//static int kickgoal_melody;
|
||||
static int kickgoal_melody_loop;
|
||||
//static int kickgoal_snd_bank;
|
||||
static int snd_new, snd_sam[4];
|
||||
|
||||
|
||||
UINT16 *kickgoal_fgram, *kickgoal_bgram, *kickgoal_bg2ram, *kickgoal_scrram;
|
||||
|
||||
WRITE16_HANDLER( kickgoal_fgram_w );
|
||||
WRITE16_HANDLER( kickgoal_bgram_w );
|
||||
WRITE16_HANDLER( kickgoal_bg2ram_w );
|
||||
|
||||
VIDEO_START( kickgoal );
|
||||
VIDEO_UPDATE( kickgoal );
|
||||
|
||||
VIDEO_START( actionhw );
|
||||
VIDEO_UPDATE( actionhw );
|
||||
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
|
||||
//static int kickgoal_sound;
|
||||
//static int state->melody;
|
||||
//static int kickgoal_snd_bank;
|
||||
|
||||
static void kickgoal_play(const device_config *device, int melody, int data)
|
||||
{
|
||||
int status = okim6295_r(device,0);
|
||||
@ -137,12 +124,12 @@ static void kickgoal_play(const device_config *device, int melody, int data)
|
||||
if (kickgoal_sound == 0) popmessage("Unknown sound command %02x",kickgoal_sound);
|
||||
|
||||
if (melody) {
|
||||
if (kickgoal_melody != kickgoal_sound) {
|
||||
kickgoal_melody = kickgoal_sound;
|
||||
kickgoal_melody_loop = kickgoal_sound;
|
||||
if (state->melody != kickgoal_sound) {
|
||||
state->melody = kickgoal_sound;
|
||||
state->melody_loop = kickgoal_sound;
|
||||
if (status & 0x08)
|
||||
okim6295_w(device,0,0x40);
|
||||
okim6295_w(device,0,(0x80 | kickgoal_melody));
|
||||
okim6295_w(device,0,(0x80 | state->melody));
|
||||
okim6295_w(device,0,0x81);
|
||||
}
|
||||
}
|
||||
@ -170,8 +157,8 @@ WRITE16_DEVICE_HANDLER( kickgoal_snd_w )
|
||||
if (data >= 0x40) {
|
||||
if (data == 0xfe) {
|
||||
okim6295_w(device,0,0x40); /* Stop playing the melody */
|
||||
kickgoal_melody = 0x00;
|
||||
kickgoal_melody_loop = 0x00;
|
||||
state->melody = 0x00;
|
||||
state->melody_loop = 0x00;
|
||||
}
|
||||
else {
|
||||
logerror("Unknown command (%02x) sent to the Sound controller\n",data);
|
||||
@ -217,9 +204,11 @@ WRITE16_DEVICE_HANDLER( kickgoal_snd_w )
|
||||
|
||||
static WRITE16_DEVICE_HANDLER( actionhw_snd_w )
|
||||
{
|
||||
kickgoal_state *state = (kickgoal_state *)device->machine->driver_data;
|
||||
logerror("%s: Writing %04x to Sound CPU - mask %04x\n",cpuexec_describe_context(device->machine),data,mem_mask);
|
||||
|
||||
if (!ACCESSING_BITS_0_7) data >>= 8;
|
||||
if (!ACCESSING_BITS_0_7)
|
||||
data >>= 8;
|
||||
|
||||
switch (data)
|
||||
{
|
||||
@ -227,214 +216,221 @@ static WRITE16_DEVICE_HANDLER( actionhw_snd_w )
|
||||
case 0xfd: okim6295_set_bank_base(device, (2 * 0x40000)); break;
|
||||
case 0xfe: okim6295_set_bank_base(device, (1 * 0x40000)); break;
|
||||
case 0xff: okim6295_set_bank_base(device, (3 * 0x40000)); break;
|
||||
case 0x78: okim6295_w(device,0,data);
|
||||
snd_sam[0]=00; snd_sam[1]=00; snd_sam[2]=00; snd_sam[3]=00;
|
||||
case 0x78:
|
||||
okim6295_w(device, 0, data);
|
||||
state->snd_sam[0] = 00; state->snd_sam[1]= 00; state->snd_sam[2] = 00; state->snd_sam[3] = 00;
|
||||
break;
|
||||
default:
|
||||
if (state->snd_new) /* Play new sample */
|
||||
{
|
||||
if ((data & 0x80) && (state->snd_sam[3] != state->snd_new))
|
||||
{
|
||||
logerror("About to play sample %02x at vol %02x\n", state->snd_new, data);
|
||||
if ((okim6295_r(device, 0) & 0x08) != 0x08)
|
||||
{
|
||||
logerror("Playing sample %02x at vol %02x\n", state->snd_new, data);
|
||||
okim6295_w(device, 0, state->snd_new);
|
||||
okim6295_w(device, 0, data);
|
||||
}
|
||||
state->snd_new = 00;
|
||||
}
|
||||
if ((data & 0x40) && (state->snd_sam[2] != state->snd_new))
|
||||
{
|
||||
logerror("About to play sample %02x at vol %02x\n", state->snd_new, data);
|
||||
if ((okim6295_r(device, 0) & 0x04) != 0x04)
|
||||
{
|
||||
logerror("Playing sample %02x at vol %02x\n", state->snd_new, data);
|
||||
okim6295_w(device, 0, state->snd_new);
|
||||
okim6295_w(device, 0, data);
|
||||
}
|
||||
state->snd_new = 00;
|
||||
}
|
||||
if ((data & 0x20) && (state->snd_sam[1] != state->snd_new))
|
||||
{
|
||||
logerror("About to play sample %02x at vol %02x\n", state->snd_new, data);
|
||||
if ((okim6295_r(device, 0) & 0x02) != 0x02)
|
||||
{
|
||||
logerror("Playing sample %02x at vol %02x\n", state->snd_new, data);
|
||||
okim6295_w(device, 0, state->snd_new);
|
||||
okim6295_w(device, 0, data);
|
||||
}
|
||||
state->snd_new = 00;
|
||||
}
|
||||
if ((data & 0x10) && (state->snd_sam[0] != state->snd_new))
|
||||
{
|
||||
logerror("About to play sample %02x at vol %02x\n", state->snd_new, data);
|
||||
if ((okim6295_r(device, 0) & 0x01) != 0x01)
|
||||
{
|
||||
logerror("Playing sample %02x at vol %02x\n", state->snd_new, data);
|
||||
okim6295_w(device, 0, state->snd_new);
|
||||
okim6295_w(device, 0, data);
|
||||
}
|
||||
state->snd_new = 00;
|
||||
}
|
||||
break;
|
||||
default: if (snd_new) /* Play new sample */
|
||||
{
|
||||
if ((data & 0x80) && (snd_sam[3] != snd_new))
|
||||
{
|
||||
logerror("About to play sample %02x at vol %02x\n",snd_new,data);
|
||||
if ((okim6295_r(device,0) & 0x08) != 0x08)
|
||||
{
|
||||
logerror("Playing sample %02x at vol %02x\n",snd_new,data);
|
||||
okim6295_w(device,0,snd_new);
|
||||
okim6295_w(device,0,data);
|
||||
}
|
||||
snd_new = 00;
|
||||
}
|
||||
if ((data & 0x40) && (snd_sam[2] != snd_new))
|
||||
{
|
||||
logerror("About to play sample %02x at vol %02x\n",snd_new,data);
|
||||
if ((okim6295_r(device,0) & 0x04) != 0x04)
|
||||
{
|
||||
logerror("Playing sample %02x at vol %02x\n",snd_new,data);
|
||||
okim6295_w(device,0,snd_new);
|
||||
okim6295_w(device,0,data);
|
||||
}
|
||||
snd_new = 00;
|
||||
}
|
||||
if ((data & 0x20) && (snd_sam[1] != snd_new))
|
||||
{
|
||||
logerror("About to play sample %02x at vol %02x\n",snd_new,data);
|
||||
if ((okim6295_r(device,0) & 0x02) != 0x02)
|
||||
{
|
||||
logerror("Playing sample %02x at vol %02x\n",snd_new,data);
|
||||
okim6295_w(device,0,snd_new);
|
||||
okim6295_w(device,0,data);
|
||||
}
|
||||
snd_new = 00;
|
||||
}
|
||||
if ((data & 0x10) && (snd_sam[0] != snd_new))
|
||||
{
|
||||
logerror("About to play sample %02x at vol %02x\n",snd_new,data);
|
||||
if ((okim6295_r(device,0) & 0x01) != 0x01)
|
||||
{
|
||||
logerror("Playing sample %02x at vol %02x\n",snd_new,data);
|
||||
okim6295_w(device,0,snd_new);
|
||||
okim6295_w(device,0,data);
|
||||
}
|
||||
snd_new = 00;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if (data > 0x80) /* New sample command */
|
||||
{
|
||||
logerror("Next sample %02x\n",data);
|
||||
snd_new = data;
|
||||
break;
|
||||
}
|
||||
else /* Turn a channel off */
|
||||
{
|
||||
logerror("Turning channel %02x off\n",data);
|
||||
okim6295_w(device,0,data);
|
||||
if (data & 0x40) snd_sam[3] = 00;
|
||||
if (data & 0x20) snd_sam[2] = 00;
|
||||
if (data & 0x10) snd_sam[1] = 00;
|
||||
if (data & 0x08) snd_sam[0] = 00;
|
||||
snd_new = 00;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (data > 0x80) /* New sample command */
|
||||
{
|
||||
logerror("Next sample %02x\n", data);
|
||||
state->snd_new = data;
|
||||
break;
|
||||
}
|
||||
else /* Turn a channel off */
|
||||
{
|
||||
logerror("Turning channel %02x off\n", data);
|
||||
okim6295_w(device, 0, data);
|
||||
if (data & 0x40) state->snd_sam[3] = 00;
|
||||
if (data & 0x20) state->snd_sam[2] = 00;
|
||||
if (data & 0x10) state->snd_sam[1] = 00;
|
||||
if (data & 0x08) state->snd_sam[0] = 00;
|
||||
state->snd_new = 00;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static int m6295_comm;
|
||||
static int m6295_bank;
|
||||
static UINT16 m6295_key_delay;
|
||||
static INTERRUPT_GEN( kickgoal_interrupt )
|
||||
{
|
||||
const device_config *adpcm = devtag_get_device(device->machine, "oki");
|
||||
kickgoal_state *state = (kickgoal_state *)device->machine->driver_data;
|
||||
|
||||
if ((okim6295_r(adpcm,0) & 0x08) == 0)
|
||||
if ((okim6295_r(state->adpcm, 0) & 0x08) == 0)
|
||||
{
|
||||
switch(kickgoal_melody_loop)
|
||||
switch(state->melody_loop)
|
||||
{
|
||||
case 0x060: kickgoal_melody_loop = 0x061; break;
|
||||
case 0x061: kickgoal_melody_loop = 0x062; break;
|
||||
case 0x062: kickgoal_melody_loop = 0x060; break;
|
||||
case 0x060: state->melody_loop = 0x061; break;
|
||||
case 0x061: state->melody_loop = 0x062; break;
|
||||
case 0x062: state->melody_loop = 0x060; break;
|
||||
|
||||
case 0x065: kickgoal_melody_loop = 0x165; break;
|
||||
case 0x165: kickgoal_melody_loop = 0x265; break;
|
||||
case 0x265: kickgoal_melody_loop = 0x365; break;
|
||||
case 0x365: kickgoal_melody_loop = 0x066; break;
|
||||
case 0x066: kickgoal_melody_loop = 0x067; break;
|
||||
case 0x067: kickgoal_melody_loop = 0x068; break;
|
||||
case 0x068: kickgoal_melody_loop = 0x065; break;
|
||||
case 0x065: state->melody_loop = 0x165; break;
|
||||
case 0x165: state->melody_loop = 0x265; break;
|
||||
case 0x265: state->melody_loop = 0x365; break;
|
||||
case 0x365: state->melody_loop = 0x066; break;
|
||||
case 0x066: state->melody_loop = 0x067; break;
|
||||
case 0x067: state->melody_loop = 0x068; break;
|
||||
case 0x068: state->melody_loop = 0x065; break;
|
||||
|
||||
case 0x063: kickgoal_melody_loop = 0x063; break;
|
||||
case 0x064: kickgoal_melody_loop = 0x064; break;
|
||||
case 0x069: kickgoal_melody_loop = 0x069; break;
|
||||
case 0x06a: kickgoal_melody_loop = 0x06a; break;
|
||||
case 0x06b: kickgoal_melody_loop = 0x06b; break;
|
||||
case 0x06c: kickgoal_melody_loop = 0x06c; break;
|
||||
case 0x063: state->melody_loop = 0x063; break;
|
||||
case 0x064: state->melody_loop = 0x064; break;
|
||||
case 0x069: state->melody_loop = 0x069; break;
|
||||
case 0x06a: state->melody_loop = 0x06a; break;
|
||||
case 0x06b: state->melody_loop = 0x06b; break;
|
||||
case 0x06c: state->melody_loop = 0x06c; break;
|
||||
|
||||
default: kickgoal_melody_loop = 0x00; break;
|
||||
default: state->melody_loop = 0x00; break;
|
||||
}
|
||||
|
||||
if (kickgoal_melody_loop)
|
||||
if (state->melody_loop)
|
||||
{
|
||||
// logerror("Changing to sample %02x\n",kickgoal_melody_loop);
|
||||
okim6295_w(adpcm,0,((0x80 | kickgoal_melody_loop) & 0xff));
|
||||
okim6295_w(adpcm,0,0x81);
|
||||
// logerror("Changing to sample %02x\n", state->melody_loop);
|
||||
okim6295_w(state->adpcm, 0, ((0x80 | state->melody_loop) & 0xff));
|
||||
okim6295_w(state->adpcm, 0, 0x81);
|
||||
}
|
||||
}
|
||||
if ( input_code_pressed_once(device->machine, KEYCODE_PGUP) )
|
||||
if (input_code_pressed_once(device->machine, KEYCODE_PGUP))
|
||||
{
|
||||
if (m6295_key_delay >= (0x60 * oki_time_base))
|
||||
if (state->m6295_key_delay >= (0x60 * oki_time_base))
|
||||
{
|
||||
m6295_bank += 0x01;
|
||||
m6295_bank &= 0x03;
|
||||
if (m6295_bank == 0x03) m6295_bank = 0x00;
|
||||
popmessage("Changing Bank to %02x",m6295_bank);
|
||||
okim6295_set_bank_base(adpcm, ((m6295_bank) * 0x40000));
|
||||
state->m6295_bank += 0x01;
|
||||
state->m6295_bank &= 0x03;
|
||||
if (state->m6295_bank == 0x03)
|
||||
state->m6295_bank = 0x00;
|
||||
popmessage("Changing Bank to %02x", state->m6295_bank);
|
||||
okim6295_set_bank_base(state->adpcm, ((state->m6295_bank) * 0x40000));
|
||||
|
||||
if (m6295_key_delay == 0xffff) m6295_key_delay = 0x00;
|
||||
else m6295_key_delay = (0x30 * oki_time_base);
|
||||
if (state->m6295_key_delay == 0xffff)
|
||||
state->m6295_key_delay = 0x00;
|
||||
else
|
||||
state->m6295_key_delay = (0x30 * oki_time_base);
|
||||
}
|
||||
else
|
||||
m6295_key_delay += (0x01 * oki_time_base);
|
||||
state->m6295_key_delay += (0x01 * oki_time_base);
|
||||
}
|
||||
else if ( input_code_pressed_once(device->machine, KEYCODE_PGDN) )
|
||||
else if (input_code_pressed_once(device->machine, KEYCODE_PGDN))
|
||||
{
|
||||
if (m6295_key_delay >= (0x60 * oki_time_base))
|
||||
if (state->m6295_key_delay >= (0x60 * oki_time_base))
|
||||
{
|
||||
m6295_bank -= 0x01;
|
||||
m6295_bank &= 0x03;
|
||||
if (m6295_bank == 0x03) m6295_bank = 0x02;
|
||||
popmessage("Changing Bank to %02x",m6295_bank);
|
||||
okim6295_set_bank_base(adpcm, ((m6295_bank) * 0x40000));
|
||||
state->m6295_bank -= 0x01;
|
||||
state->m6295_bank &= 0x03;
|
||||
if (state->m6295_bank == 0x03)
|
||||
state->m6295_bank = 0x02;
|
||||
popmessage("Changing Bank to %02x", state->m6295_bank);
|
||||
okim6295_set_bank_base(state->adpcm, ((state->m6295_bank) * 0x40000));
|
||||
|
||||
if (m6295_key_delay == 0xffff) m6295_key_delay = 0x00;
|
||||
else m6295_key_delay = (0x30 * oki_time_base);
|
||||
if (state->m6295_key_delay == 0xffff)
|
||||
state->m6295_key_delay = 0x00;
|
||||
else
|
||||
state->m6295_key_delay = (0x30 * oki_time_base);
|
||||
}
|
||||
else
|
||||
m6295_key_delay += (0x01 * oki_time_base);
|
||||
state->m6295_key_delay += (0x01 * oki_time_base);
|
||||
}
|
||||
else if ( input_code_pressed_once(device->machine, KEYCODE_INSERT) )
|
||||
else if (input_code_pressed_once(device->machine, KEYCODE_INSERT))
|
||||
{
|
||||
if (m6295_key_delay >= (0x60 * oki_time_base))
|
||||
if (state->m6295_key_delay >= (0x60 * oki_time_base))
|
||||
{
|
||||
m6295_comm += 1;
|
||||
m6295_comm &= 0x7f;
|
||||
if (m6295_comm == 0x00) { okim6295_set_bank_base(adpcm, (0 * 0x40000)); m6295_bank = 0; }
|
||||
if (m6295_comm == 0x60) { okim6295_set_bank_base(adpcm, (0 * 0x40000)); m6295_bank = 0; }
|
||||
if (m6295_comm == 0x65) { okim6295_set_bank_base(adpcm, (1 * 0x40000)); m6295_bank = 1; }
|
||||
if (m6295_comm == 0x69) { okim6295_set_bank_base(adpcm, (2 * 0x40000)); m6295_bank = 2; }
|
||||
if (m6295_comm == 0x70) { okim6295_set_bank_base(adpcm, (1 * 0x40000)); m6295_bank = 1; }
|
||||
popmessage("Sound test command %02x on Bank %02x",m6295_comm,m6295_bank);
|
||||
state->m6295_comm += 1;
|
||||
state->m6295_comm &= 0x7f;
|
||||
if (state->m6295_comm == 0x00) { okim6295_set_bank_base(state->adpcm, (0 * 0x40000)); state->m6295_bank = 0; }
|
||||
if (state->m6295_comm == 0x60) { okim6295_set_bank_base(state->adpcm, (0 * 0x40000)); state->m6295_bank = 0; }
|
||||
if (state->m6295_comm == 0x65) { okim6295_set_bank_base(state->adpcm, (1 * 0x40000)); state->m6295_bank = 1; }
|
||||
if (state->m6295_comm == 0x69) { okim6295_set_bank_base(state->adpcm, (2 * 0x40000)); state->m6295_bank = 2; }
|
||||
if (state->m6295_comm == 0x70) { okim6295_set_bank_base(state->adpcm, (1 * 0x40000)); state->m6295_bank = 1; }
|
||||
popmessage("Sound test command %02x on Bank %02x", state->m6295_comm, state->m6295_bank);
|
||||
|
||||
if (m6295_key_delay == 0xffff) m6295_key_delay = 0x00;
|
||||
else m6295_key_delay = (0x5d * oki_time_base);
|
||||
if (state->m6295_key_delay == 0xffff)
|
||||
state->m6295_key_delay = 0x00;
|
||||
else
|
||||
state->m6295_key_delay = (0x5d * oki_time_base);
|
||||
}
|
||||
else
|
||||
m6295_key_delay += (0x01 * oki_time_base);
|
||||
state->m6295_key_delay += (0x01 * oki_time_base);
|
||||
}
|
||||
else if ( input_code_pressed_once(device->machine, KEYCODE_DEL) )
|
||||
else if (input_code_pressed_once(device->machine, KEYCODE_DEL))
|
||||
{
|
||||
if (m6295_key_delay >= (0x60 * oki_time_base))
|
||||
if (state->m6295_key_delay >= (0x60 * oki_time_base))
|
||||
{
|
||||
m6295_comm -= 1;
|
||||
m6295_comm &= 0x7f;
|
||||
if (m6295_comm == 0x2b) { okim6295_set_bank_base(adpcm, (0 * 0x40000)); m6295_bank = 0; }
|
||||
if (m6295_comm == 0x64) { okim6295_set_bank_base(adpcm, (0 * 0x40000)); m6295_bank = 0; }
|
||||
if (m6295_comm == 0x68) { okim6295_set_bank_base(adpcm, (1 * 0x40000)); m6295_bank = 1; }
|
||||
if (m6295_comm == 0x6c) { okim6295_set_bank_base(adpcm, (2 * 0x40000)); m6295_bank = 2; }
|
||||
if (m6295_comm == 0x76) { okim6295_set_bank_base(adpcm, (1 * 0x40000)); m6295_bank = 1; }
|
||||
popmessage("Sound test command %02x on Bank %02x",m6295_comm,m6295_bank);
|
||||
state->m6295_comm -= 1;
|
||||
state->m6295_comm &= 0x7f;
|
||||
if (state->m6295_comm == 0x2b) { okim6295_set_bank_base(state->adpcm, (0 * 0x40000)); state->m6295_bank = 0; }
|
||||
if (state->m6295_comm == 0x64) { okim6295_set_bank_base(state->adpcm, (0 * 0x40000)); state->m6295_bank = 0; }
|
||||
if (state->m6295_comm == 0x68) { okim6295_set_bank_base(state->adpcm, (1 * 0x40000)); state->m6295_bank = 1; }
|
||||
if (state->m6295_comm == 0x6c) { okim6295_set_bank_base(state->adpcm, (2 * 0x40000)); state->m6295_bank = 2; }
|
||||
if (state->m6295_comm == 0x76) { okim6295_set_bank_base(state->adpcm, (1 * 0x40000)); state->m6295_bank = 1; }
|
||||
popmessage("Sound test command %02x on Bank %02x", state->m6295_comm, state->m6295_bank);
|
||||
|
||||
if (m6295_key_delay == 0xffff) m6295_key_delay = 0x00;
|
||||
else m6295_key_delay = (0x5d * oki_time_base);
|
||||
if (state->m6295_key_delay == 0xffff)
|
||||
state->m6295_key_delay = 0x00;
|
||||
else
|
||||
state->m6295_key_delay = (0x5d * oki_time_base);
|
||||
}
|
||||
else
|
||||
m6295_key_delay += (0x01 * oki_time_base);
|
||||
state->m6295_key_delay += (0x01 * oki_time_base);
|
||||
}
|
||||
else if ( input_code_pressed_once(device->machine, KEYCODE_Z) )
|
||||
else if (input_code_pressed_once(device->machine, KEYCODE_Z))
|
||||
{
|
||||
if (m6295_key_delay >= (0x80 * oki_time_base))
|
||||
if (state->m6295_key_delay >= (0x80 * oki_time_base))
|
||||
{
|
||||
okim6295_w(adpcm,0,0x78);
|
||||
okim6295_w(adpcm,0,(0x80 | m6295_comm));
|
||||
okim6295_w(adpcm,0,0x11);
|
||||
okim6295_w(state->adpcm, 0, 0x78);
|
||||
okim6295_w(state->adpcm, 0, (0x80 | state->m6295_comm));
|
||||
okim6295_w(state->adpcm, 0, 0x11);
|
||||
|
||||
popmessage("Playing sound %02x on Bank %02x",m6295_comm,m6295_bank);
|
||||
popmessage("Playing sound %02x on Bank %02x", state->m6295_comm, state->m6295_bank);
|
||||
|
||||
if (m6295_key_delay == 0xffff) m6295_key_delay = 0x00;
|
||||
else m6295_key_delay = (0x60 * oki_time_base);
|
||||
if (state->m6295_key_delay == 0xffff)
|
||||
state->m6295_key_delay = 0x00;
|
||||
else
|
||||
state->m6295_key_delay = (0x60 * oki_time_base);
|
||||
}
|
||||
else
|
||||
m6295_key_delay += (0x01 * oki_time_base);
|
||||
// logerror("Sending %02x to the sound CPU\n",m6295_comm);
|
||||
state->m6295_key_delay += (0x01 * oki_time_base);
|
||||
// logerror("Sending %02x to the sound CPU\n", state->m6295_comm);
|
||||
}
|
||||
else m6295_key_delay = 0xffff;
|
||||
else
|
||||
state->m6295_key_delay = 0xffff;
|
||||
}
|
||||
|
||||
|
||||
static const UINT8 *kickgoal_default_eeprom;
|
||||
static int kickgoal_default_eeprom_length;
|
||||
|
||||
static const UINT8 kickgoal_default_eeprom_type1[128] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
@ -447,30 +443,13 @@ static const UINT8 kickgoal_default_eeprom_type1[128] = {
|
||||
};
|
||||
|
||||
|
||||
static NVRAM_HANDLER( kickgoal )
|
||||
{
|
||||
if (read_or_write)
|
||||
eeprom_save(file);
|
||||
else
|
||||
{
|
||||
eeprom_init(machine, &eeprom_interface_93C46);
|
||||
|
||||
if (file) eeprom_load(file);
|
||||
else
|
||||
{
|
||||
if (kickgoal_default_eeprom) /* Sane Defaults */
|
||||
eeprom_set_data(kickgoal_default_eeprom,kickgoal_default_eeprom_length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static READ16_HANDLER( kickgoal_eeprom_r )
|
||||
{
|
||||
kickgoal_state *state = (kickgoal_state *)space->machine->driver_data;
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
return eeprom_read_bit();
|
||||
return eepromdev_read_bit(state->eeprom);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -478,18 +457,19 @@ static READ16_HANDLER( kickgoal_eeprom_r )
|
||||
|
||||
static WRITE16_HANDLER( kickgoal_eeprom_w )
|
||||
{
|
||||
kickgoal_state *state = (kickgoal_state *)space->machine->driver_data;
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
switch (offset)
|
||||
{
|
||||
case 0:
|
||||
eeprom_set_cs_line((data & 0x0001) ? CLEAR_LINE : ASSERT_LINE);
|
||||
eepromdev_set_cs_line(state->eeprom, (data & 0x0001) ? CLEAR_LINE : ASSERT_LINE);
|
||||
break;
|
||||
case 1:
|
||||
eeprom_set_clock_line((data & 0x0001) ? ASSERT_LINE : CLEAR_LINE);
|
||||
eepromdev_set_clock_line(state->eeprom, (data & 0x0001) ? ASSERT_LINE : CLEAR_LINE);
|
||||
break;
|
||||
case 2:
|
||||
eeprom_write_bit(data & 0x0001);
|
||||
eepromdev_write_bit(state->eeprom, data & 0x0001);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -507,12 +487,12 @@ static ADDRESS_MAP_START( kickgoal_program_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x800004, 0x800005) AM_DEVWRITE("oki", actionhw_snd_w)
|
||||
AM_RANGE(0x900000, 0x900005) AM_WRITE(kickgoal_eeprom_w)
|
||||
AM_RANGE(0x900006, 0x900007) AM_READ(kickgoal_eeprom_r)
|
||||
AM_RANGE(0xa00000, 0xa03fff) AM_RAM_WRITE(kickgoal_fgram_w) AM_BASE(&kickgoal_fgram) /* FG Layer */
|
||||
AM_RANGE(0xa04000, 0xa07fff) AM_RAM_WRITE(kickgoal_bgram_w) AM_BASE(&kickgoal_bgram) /* Higher BG Layer */
|
||||
AM_RANGE(0xa08000, 0xa0bfff) AM_RAM_WRITE(kickgoal_bg2ram_w) AM_BASE(&kickgoal_bg2ram) /* Lower BG Layer */
|
||||
AM_RANGE(0xa00000, 0xa03fff) AM_RAM_WRITE(kickgoal_fgram_w) AM_BASE_MEMBER(kickgoal_state, fgram) /* FG Layer */
|
||||
AM_RANGE(0xa04000, 0xa07fff) AM_RAM_WRITE(kickgoal_bgram_w) AM_BASE_MEMBER(kickgoal_state, bgram) /* Higher BG Layer */
|
||||
AM_RANGE(0xa08000, 0xa0bfff) AM_RAM_WRITE(kickgoal_bg2ram_w) AM_BASE_MEMBER(kickgoal_state, bg2ram) /* Lower BG Layer */
|
||||
AM_RANGE(0xa0c000, 0xa0ffff) AM_RAM // more tilemap?
|
||||
AM_RANGE(0xa10000, 0xa1000f) AM_WRITEONLY AM_BASE(&kickgoal_scrram) /* Scroll Registers */
|
||||
AM_RANGE(0xb00000, 0xb007ff) AM_WRITEONLY AM_BASE_SIZE_GENERIC(spriteram) /* Sprites */
|
||||
AM_RANGE(0xa10000, 0xa1000f) AM_WRITEONLY AM_BASE_MEMBER(kickgoal_state, scrram) /* Scroll Registers */
|
||||
AM_RANGE(0xb00000, 0xb007ff) AM_WRITEONLY AM_BASE_SIZE_MEMBER(kickgoal_state, spriteram, spriteram_size) /* Sprites */
|
||||
AM_RANGE(0xc00000, 0xc007ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE_GENERIC(paletteram) /* Palette */ // actionhw reads this
|
||||
AM_RANGE(0xff0000, 0xffffff) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
@ -663,10 +643,41 @@ GFXDECODE_END
|
||||
|
||||
/* MACHINE drivers ***********************************************************/
|
||||
|
||||
static MACHINE_START( kickgoal )
|
||||
{
|
||||
kickgoal_state *state = (kickgoal_state *)machine->driver_data;
|
||||
|
||||
state->adpcm = devtag_get_device(machine, "oki");
|
||||
state->eeprom = devtag_get_device(machine, "eeprom");
|
||||
|
||||
state_save_register_global_array(machine, state->snd_sam);
|
||||
state_save_register_global(machine, state->melody_loop);
|
||||
state_save_register_global(machine, state->snd_new);
|
||||
state_save_register_global(machine, state->m6295_comm);
|
||||
state_save_register_global(machine, state->m6295_bank);
|
||||
state_save_register_global(machine, state->m6295_key_delay);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( kickgoal )
|
||||
{
|
||||
kickgoal_state *state = (kickgoal_state *)machine->driver_data;
|
||||
|
||||
state->melody_loop = 0;
|
||||
state->snd_new = 0;
|
||||
state->snd_sam[0] = 0;
|
||||
state->snd_sam[1] = 0;
|
||||
state->snd_sam[2] = 0;
|
||||
state->snd_sam[3] = 0;
|
||||
state->m6295_comm = 0;
|
||||
state->m6295_bank = 0;
|
||||
state->m6295_key_delay = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( kickgoal )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(kickgoal_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M68000, 12000000) /* 12 MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(kickgoal_program_map)
|
||||
@ -678,7 +689,10 @@ static MACHINE_DRIVER_START( kickgoal )
|
||||
/* Program and Data Maps are internal to the MCU */
|
||||
MDRV_CPU_IO_MAP(kickgoal_sound_io_map)
|
||||
|
||||
MDRV_NVRAM_HANDLER(kickgoal)
|
||||
MDRV_MACHINE_START(kickgoal)
|
||||
MDRV_MACHINE_RESET(kickgoal)
|
||||
|
||||
MDRV_EEPROM_93C46_ADD("eeprom", 128, kickgoal_default_eeprom_type1)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
@ -703,6 +717,9 @@ MACHINE_DRIVER_END
|
||||
|
||||
static MACHINE_DRIVER_START( actionhw )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(kickgoal_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M68000, XTAL_12MHz) /* verified on pcb */
|
||||
MDRV_CPU_PROGRAM_MAP(kickgoal_program_map)
|
||||
@ -713,7 +730,10 @@ static MACHINE_DRIVER_START( actionhw )
|
||||
/* Program and Data Maps are internal to the MCU */
|
||||
MDRV_CPU_IO_MAP(actionhw_io_map)
|
||||
|
||||
MDRV_NVRAM_HANDLER(kickgoal) // 93C46 really
|
||||
MDRV_MACHINE_START(kickgoal)
|
||||
MDRV_MACHINE_RESET(kickgoal)
|
||||
|
||||
MDRV_EEPROM_93C46_ADD("eeprom", 128, kickgoal_default_eeprom_type1)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
@ -806,11 +826,8 @@ static DRIVER_INIT( kickgoal )
|
||||
/* fix "bug" that prevents game from writing to EEPROM */
|
||||
rom[0x12b0/2] = 0x0001;
|
||||
#endif
|
||||
|
||||
kickgoal_default_eeprom = kickgoal_default_eeprom_type1;
|
||||
kickgoal_default_eeprom_length = sizeof(kickgoal_default_eeprom_type1);
|
||||
}
|
||||
|
||||
|
||||
GAME( 1995, kickgoal,0, kickgoal, kickgoal, kickgoal, ROT0, "TCH", "Kick Goal", GAME_NO_SOUND )
|
||||
GAME( 1995, actionhw,0, actionhw, kickgoal, kickgoal, ROT0, "TCH", "Action Hollywood", GAME_IMPERFECT_SOUND )
|
||||
GAME( 1995, kickgoal,0, kickgoal, kickgoal, kickgoal, ROT0, "TCH", "Kick Goal", GAME_NO_SOUND | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1995, actionhw,0, actionhw, kickgoal, kickgoal, ROT0, "TCH", "Action Hollywood", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
|
@ -19,49 +19,32 @@ Main CPU:
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/ay8910.h"
|
||||
#include "sound/dac.h"
|
||||
|
||||
/* from video */
|
||||
extern UINT8 *kingofb_videoram2;
|
||||
extern UINT8 *kingofb_colorram2;
|
||||
extern UINT8 *kingofb_scroll_y;
|
||||
|
||||
extern WRITE8_HANDLER( kingofb_videoram_w );
|
||||
extern WRITE8_HANDLER( kingofb_colorram_w );
|
||||
extern WRITE8_HANDLER( kingofb_videoram2_w );
|
||||
extern WRITE8_HANDLER( kingofb_colorram2_w );
|
||||
|
||||
extern WRITE8_HANDLER( kingofb_f800_w );
|
||||
|
||||
extern PALETTE_INIT( kingofb );
|
||||
extern VIDEO_START( kingofb );
|
||||
extern VIDEO_UPDATE( kingofb );
|
||||
|
||||
extern PALETTE_INIT( ringking );
|
||||
extern VIDEO_START( ringking );
|
||||
extern VIDEO_UPDATE( ringking );
|
||||
|
||||
int kingofb_nmi_enable = 0;
|
||||
#include "includes/kingobox.h"
|
||||
|
||||
static WRITE8_HANDLER( video_interrupt_w )
|
||||
{
|
||||
cputag_set_input_line_and_vector(space->machine, "video", 0, HOLD_LINE, 0xff );
|
||||
kingofb_state *state = (kingofb_state *)space->machine->driver_data;
|
||||
cpu_set_input_line_and_vector(state->video_cpu, 0, HOLD_LINE, 0xff);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( sprite_interrupt_w )
|
||||
{
|
||||
cputag_set_input_line_and_vector(space->machine, "sprite", 0, HOLD_LINE, 0xff );
|
||||
kingofb_state *state = (kingofb_state *)space->machine->driver_data;
|
||||
cpu_set_input_line_and_vector(state->sprite_cpu, 0, HOLD_LINE, 0xff);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( scroll_interrupt_w )
|
||||
{
|
||||
sprite_interrupt_w( space, offset, data );
|
||||
*kingofb_scroll_y = data;
|
||||
kingofb_state *state = (kingofb_state *)space->machine->driver_data;
|
||||
sprite_interrupt_w(space, offset, data);
|
||||
*state->scroll_y = data;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( sound_command_w )
|
||||
{
|
||||
soundlatch_w( space, 0, data );
|
||||
cputag_set_input_line_and_vector(space->machine, "audiocpu", 0, HOLD_LINE, 0xff );
|
||||
kingofb_state *state = (kingofb_state *)space->machine->driver_data;
|
||||
soundlatch_w(space, 0, data);
|
||||
cpu_set_input_line_and_vector(state->audio_cpu, 0, HOLD_LINE, 0xff);
|
||||
}
|
||||
|
||||
|
||||
@ -73,7 +56,7 @@ static ADDRESS_MAP_START( kingobox_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0xf000, 0xf7ff) AM_RAM /* ???? */
|
||||
AM_RANGE(0xf800, 0xf800) AM_WRITE(kingofb_f800_w) /* NMI enable, palette bank */
|
||||
AM_RANGE(0xf801, 0xf801) AM_WRITENOP /* ???? */
|
||||
AM_RANGE(0xf802, 0xf802) AM_WRITEONLY AM_BASE(&kingofb_scroll_y)
|
||||
AM_RANGE(0xf802, 0xf802) AM_WRITEONLY AM_BASE_MEMBER(kingofb_state, scroll_y)
|
||||
AM_RANGE(0xf803, 0xf803) AM_WRITE(scroll_interrupt_w)
|
||||
AM_RANGE(0xf804, 0xf804) AM_WRITE(video_interrupt_w)
|
||||
AM_RANGE(0xf807, 0xf807) AM_WRITE(sound_command_w) /* sound latch */
|
||||
@ -89,24 +72,24 @@ static ADDRESS_MAP_START( kingobox_video_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x3fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x87ff) AM_RAM /* work ram */
|
||||
AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_SHARE("share1") /* shared with main */
|
||||
AM_RANGE(0xc000, 0xc0ff) AM_RAM_WRITE(kingofb_videoram_w) AM_BASE_GENERIC(videoram) /* background vram */
|
||||
AM_RANGE(0xc400, 0xc4ff) AM_RAM_WRITE(kingofb_colorram_w) AM_BASE_GENERIC(colorram) /* background colorram */
|
||||
AM_RANGE(0xc800, 0xcbff) AM_RAM_WRITE(kingofb_videoram2_w) AM_BASE(&kingofb_videoram2) /* foreground vram */
|
||||
AM_RANGE(0xcc00, 0xcfff) AM_RAM_WRITE(kingofb_colorram2_w) AM_BASE(&kingofb_colorram2) /* foreground colorram */
|
||||
AM_RANGE(0xc000, 0xc0ff) AM_RAM_WRITE(kingofb_videoram_w) AM_BASE_MEMBER(kingofb_state, videoram) /* background vram */
|
||||
AM_RANGE(0xc400, 0xc4ff) AM_RAM_WRITE(kingofb_colorram_w) AM_BASE_MEMBER(kingofb_state, colorram) /* background colorram */
|
||||
AM_RANGE(0xc800, 0xcbff) AM_RAM_WRITE(kingofb_videoram2_w) AM_BASE_MEMBER(kingofb_state, videoram2) /* foreground vram */
|
||||
AM_RANGE(0xcc00, 0xcfff) AM_RAM_WRITE(kingofb_colorram2_w) AM_BASE_MEMBER(kingofb_state, colorram2) /* foreground colorram */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( kingobox_sprite_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x1fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x87ff) AM_RAM /* work ram */
|
||||
AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_SHARE("share2") /* shared with main */
|
||||
AM_RANGE(0xc000, 0xc3ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) /* sprite ram */
|
||||
AM_RANGE(0xc000, 0xc3ff) AM_RAM AM_BASE_SIZE_MEMBER(kingofb_state, spriteram, spriteram_size) /* sprite ram */
|
||||
AM_RANGE(0xc400, 0xc43f) AM_RAM /* something related to scroll? */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( kingobox_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0xbfff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x8000) AM_WRITENOP /* ??? */
|
||||
AM_RANGE(0xc000, 0xc3ff) AM_RAM /* work ram */
|
||||
AM_RANGE(0xc000, 0xc3ff) AM_RAM /* work ram */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( kingobox_sound_io_map, ADDRESS_SPACE_IO, 8 )
|
||||
@ -132,7 +115,7 @@ static ADDRESS_MAP_START( ringking_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0xe003, 0xe003) AM_READ_PORT("P2")
|
||||
AM_RANGE(0xe004, 0xe004) AM_READ_PORT("SYSTEM")
|
||||
AM_RANGE(0xe005, 0xe005) AM_READ_PORT("EXTRA")
|
||||
AM_RANGE(0xe800, 0xe800) AM_WRITEONLY AM_BASE(&kingofb_scroll_y)
|
||||
AM_RANGE(0xe800, 0xe800) AM_WRITEONLY AM_BASE_MEMBER(kingofb_state, scroll_y)
|
||||
AM_RANGE(0xf000, 0xf7ff) AM_RAM /* ???? */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -140,17 +123,17 @@ static ADDRESS_MAP_START( ringking_video_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x3fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x87ff) AM_RAM /* work ram */
|
||||
AM_RANGE(0xc000, 0xc7ff) AM_RAM AM_SHARE("share1") /* shared with main */
|
||||
AM_RANGE(0xa800, 0xa8ff) AM_RAM_WRITE(kingofb_videoram_w) AM_BASE_GENERIC(videoram) /* background vram */
|
||||
AM_RANGE(0xac00, 0xacff) AM_RAM_WRITE(kingofb_colorram_w) AM_BASE_GENERIC(colorram) /* background colorram */
|
||||
AM_RANGE(0xa000, 0xa3ff) AM_RAM_WRITE(kingofb_videoram2_w) AM_BASE(&kingofb_videoram2) /* foreground vram */
|
||||
AM_RANGE(0xa400, 0xa7ff) AM_RAM_WRITE(kingofb_colorram2_w) AM_BASE(&kingofb_colorram2) /* foreground colorram */
|
||||
AM_RANGE(0xa800, 0xa8ff) AM_RAM_WRITE(kingofb_videoram_w) AM_BASE_MEMBER(kingofb_state, videoram) /* background vram */
|
||||
AM_RANGE(0xac00, 0xacff) AM_RAM_WRITE(kingofb_colorram_w) AM_BASE_MEMBER(kingofb_state, colorram) /* background colorram */
|
||||
AM_RANGE(0xa000, 0xa3ff) AM_RAM_WRITE(kingofb_videoram2_w) AM_BASE_MEMBER(kingofb_state, videoram2) /* foreground vram */
|
||||
AM_RANGE(0xa400, 0xa7ff) AM_RAM_WRITE(kingofb_colorram2_w) AM_BASE_MEMBER(kingofb_state, colorram2) /* foreground colorram */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( ringking_sprite_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x1fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x87ff) AM_RAM /* work ram */
|
||||
AM_RANGE(0xc800, 0xcfff) AM_RAM AM_SHARE("share2") /* shared with main */
|
||||
AM_RANGE(0xa000, 0xa3ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) /* sprite ram */
|
||||
AM_RANGE(0xa000, 0xa3ff) AM_RAM AM_BASE_SIZE_MEMBER(kingofb_state, spriteram, spriteram_size) /* sprite ram */
|
||||
AM_RANGE(0xa400, 0xa43f) AM_RAM /* something related to scroll? */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -163,55 +146,55 @@ ADDRESS_MAP_END
|
||||
|
||||
|
||||
static INPUT_PORTS_START( kingofb )
|
||||
PORT_START("DSW1") /* 0xfc01 */
|
||||
PORT_DIPNAME( 0x03, 0x01, "Rest Up Points" )
|
||||
PORT_DIPSETTING( 0x02, "70000" )
|
||||
PORT_DIPSETTING( 0x01, "100000" )
|
||||
PORT_DIPSETTING( 0x03, "150000" )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( No ) )
|
||||
PORT_DIPNAME( 0x04, 0x00, DEF_STR( Demo_Sounds ) )
|
||||
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x18, 0x00, DEF_STR( Difficulty ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Easy ) )
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( Medium ) )
|
||||
PORT_DIPSETTING( 0x10, DEF_STR( Hard ) )
|
||||
PORT_DIPSETTING( 0x18, DEF_STR( Hardest ) )
|
||||
PORT_START("DSW1") /* 0xfc01 */
|
||||
PORT_DIPNAME( 0x03, 0x01, "Rest Up Points" )
|
||||
PORT_DIPSETTING( 0x02, "70000" )
|
||||
PORT_DIPSETTING( 0x01, "100000" )
|
||||
PORT_DIPSETTING( 0x03, "150000" )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( No ) )
|
||||
PORT_DIPNAME( 0x04, 0x00, DEF_STR( Demo_Sounds ) )
|
||||
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x18, 0x00, DEF_STR( Difficulty ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Easy ) )
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( Medium ) )
|
||||
PORT_DIPSETTING( 0x10, DEF_STR( Hard ) )
|
||||
PORT_DIPSETTING( 0x18, DEF_STR( Hardest ) )
|
||||
PORT_DIPNAME( 0x20, 0x20, DEF_STR( Cabinet ) )
|
||||
PORT_DIPSETTING( 0x20, DEF_STR( Upright ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) )
|
||||
PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x40, DEF_STR( On ) )
|
||||
PORT_DIPSETTING( 0x20, DEF_STR( Upright ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) )
|
||||
PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x40, DEF_STR( On ) )
|
||||
PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
|
||||
|
||||
PORT_START("DSW2") /* 0xfc01 */
|
||||
PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
|
||||
PORT_DIPSETTING( 0x07, DEF_STR( 4C_1C ) )
|
||||
PORT_DIPSETTING( 0x06, DEF_STR( 3C_1C ) )
|
||||
PORT_DIPSETTING( 0x05, DEF_STR( 2C_1C ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) )
|
||||
PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) )
|
||||
PORT_DIPSETTING( 0x02, DEF_STR( 1C_3C ) )
|
||||
PORT_DIPSETTING( 0x03, DEF_STR( 1C_4C ) )
|
||||
PORT_DIPSETTING( 0x04, DEF_STR( 1C_5C ) )
|
||||
PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x10, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x20, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x40, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x80, 0x00, "Freeze" )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x80, DEF_STR( On ) )
|
||||
PORT_START("DSW2") /* 0xfc01 */
|
||||
PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
|
||||
PORT_DIPSETTING( 0x07, DEF_STR( 4C_1C ) )
|
||||
PORT_DIPSETTING( 0x06, DEF_STR( 3C_1C ) )
|
||||
PORT_DIPSETTING( 0x05, DEF_STR( 2C_1C ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) )
|
||||
PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) )
|
||||
PORT_DIPSETTING( 0x02, DEF_STR( 1C_3C ) )
|
||||
PORT_DIPSETTING( 0x03, DEF_STR( 1C_4C ) )
|
||||
PORT_DIPSETTING( 0x04, DEF_STR( 1C_5C ) )
|
||||
PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x10, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x20, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x40, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x80, 0x00, "Freeze" )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x80, DEF_STR( On ) )
|
||||
|
||||
PORT_START("P1") /* 0xfc02 */
|
||||
PORT_START("P1") /* 0xfc02 */
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
|
||||
@ -221,7 +204,7 @@ static INPUT_PORTS_START( kingofb )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
|
||||
|
||||
PORT_START("P2") /* 0xfc03 */
|
||||
PORT_START("P2") /* 0xfc03 */
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL
|
||||
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
|
||||
@ -241,7 +224,7 @@ static INPUT_PORTS_START( kingofb )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
|
||||
|
||||
PORT_START("EXTRA") /* 0xfc05 */
|
||||
PORT_START("EXTRA") /* 0xfc05 */
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_COCKTAIL
|
||||
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
|
||||
@ -253,50 +236,50 @@ static INPUT_PORTS_START( kingofb )
|
||||
INPUT_PORTS_END
|
||||
|
||||
static INPUT_PORTS_START( ringking )
|
||||
PORT_START("DSW1") /* 0xe000 */
|
||||
PORT_DIPNAME( 0x03, 0x03, "Replay" )
|
||||
PORT_DIPSETTING( 0x01, "70000" )
|
||||
PORT_DIPSETTING( 0x02, "100000" )
|
||||
PORT_DIPSETTING( 0x00, "150000" )
|
||||
PORT_DIPSETTING( 0x03, DEF_STR( No ) )
|
||||
PORT_DIPNAME( 0x04, 0x04, DEF_STR( Demo_Sounds ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x04, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x18, 0x10, "Difficulty (2P)" )
|
||||
PORT_DIPSETTING( 0x18, DEF_STR( Easy ) )
|
||||
PORT_DIPSETTING( 0x10, DEF_STR( Medium ) )
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( Hard ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
|
||||
PORT_START("DSW1") /* 0xe000 */
|
||||
PORT_DIPNAME( 0x03, 0x03, "Replay" )
|
||||
PORT_DIPSETTING( 0x01, "70000" )
|
||||
PORT_DIPSETTING( 0x02, "100000" )
|
||||
PORT_DIPSETTING( 0x00, "150000" )
|
||||
PORT_DIPSETTING( 0x03, DEF_STR( No ) )
|
||||
PORT_DIPNAME( 0x04, 0x04, DEF_STR( Demo_Sounds ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x04, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x18, 0x10, "Difficulty (2P)" )
|
||||
PORT_DIPSETTING( 0x18, DEF_STR( Easy ) )
|
||||
PORT_DIPSETTING( 0x10, DEF_STR( Medium ) )
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( Hard ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
|
||||
PORT_DIPNAME( 0x20, 0x00, DEF_STR( Cabinet ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Upright ) )
|
||||
PORT_DIPSETTING( 0x20, DEF_STR( Cocktail ) )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Upright ) )
|
||||
PORT_DIPSETTING( 0x20, DEF_STR( Cocktail ) )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
|
||||
|
||||
PORT_START("DSW2") /* 0xe001 */
|
||||
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) )
|
||||
PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) )
|
||||
PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) )
|
||||
PORT_DIPSETTING( 0x01, DEF_STR( 1C_3C ) )
|
||||
PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) )
|
||||
PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) )
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) )
|
||||
PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) )
|
||||
PORT_DIPNAME( 0x30, 0x10, "Difficulty (1P)" )
|
||||
PORT_DIPSETTING( 0x30, DEF_STR( Easy ) )
|
||||
PORT_DIPSETTING( 0x10, DEF_STR( Medium ) )
|
||||
PORT_DIPSETTING( 0x20, DEF_STR( Hard ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
|
||||
PORT_DIPNAME( 0x40, 0x40, "Boxing Match" )
|
||||
PORT_DIPSETTING( 0x40, "2 Win, End" )
|
||||
PORT_DIPSETTING( 0x00, "1 Win, End" )
|
||||
PORT_DIPNAME( 0x80, 0x80, "Freeze" )
|
||||
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
PORT_START("DSW2") /* 0xe001 */
|
||||
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) )
|
||||
PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) )
|
||||
PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) )
|
||||
PORT_DIPSETTING( 0x01, DEF_STR( 1C_3C ) )
|
||||
PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) )
|
||||
PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) )
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) )
|
||||
PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) )
|
||||
PORT_DIPNAME( 0x30, 0x10, "Difficulty (1P)" )
|
||||
PORT_DIPSETTING( 0x30, DEF_STR( Easy ) )
|
||||
PORT_DIPSETTING( 0x10, DEF_STR( Medium ) )
|
||||
PORT_DIPSETTING( 0x20, DEF_STR( Hard ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
|
||||
PORT_DIPNAME( 0x40, 0x40, "Boxing Match" )
|
||||
PORT_DIPSETTING( 0x40, "2 Win, End" )
|
||||
PORT_DIPSETTING( 0x00, "1 Win, End" )
|
||||
PORT_DIPNAME( 0x80, 0x80, "Freeze" )
|
||||
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
|
||||
PORT_START("P1") /* 0xe002 */
|
||||
PORT_START("P1") /* 0xe002 */
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
|
||||
@ -306,7 +289,7 @@ static INPUT_PORTS_START( ringking )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
|
||||
PORT_START("P2") /* 0xe003 */
|
||||
PORT_START("P2") /* 0xe003 */
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_COCKTAIL
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
|
||||
@ -326,7 +309,7 @@ static INPUT_PORTS_START( ringking )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
|
||||
PORT_START("EXTRA") /* 0xfc05 */
|
||||
PORT_START("EXTRA") /* 0xfc05 */
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
@ -465,13 +448,37 @@ static const ay8910_interface ay8910_config =
|
||||
|
||||
static INTERRUPT_GEN( kingofb_interrupt )
|
||||
{
|
||||
kingofb_state *state = (kingofb_state *)device->machine->driver_data;
|
||||
|
||||
if ( kingofb_nmi_enable )
|
||||
if (state->nmi_enable)
|
||||
cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
|
||||
static MACHINE_START( kingofb )
|
||||
{
|
||||
kingofb_state *state = (kingofb_state *)machine->driver_data;
|
||||
|
||||
state->video_cpu = devtag_get_device(machine, "video");
|
||||
state->sprite_cpu = devtag_get_device(machine, "sprite");
|
||||
state->audio_cpu = devtag_get_device(machine, "audiocpu");
|
||||
|
||||
state_save_register_global(machine, state->nmi_enable);
|
||||
state_save_register_global(machine, state->palette_bank);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( kingofb )
|
||||
{
|
||||
kingofb_state *state = (kingofb_state *)machine->driver_data;
|
||||
|
||||
state->nmi_enable = 0;
|
||||
state->palette_bank = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( kingofb )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(kingofb_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, 4000000) /* 4.0 MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(kingobox_map)
|
||||
@ -492,6 +499,9 @@ static MACHINE_DRIVER_START( kingofb )
|
||||
|
||||
MDRV_QUANTUM_TIME(HZ(6000)) /* We really need heavy synching among the processors */
|
||||
|
||||
MDRV_MACHINE_START(kingofb)
|
||||
MDRV_MACHINE_RESET(kingofb)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -522,6 +532,9 @@ MACHINE_DRIVER_END
|
||||
/* Ring King */
|
||||
static MACHINE_DRIVER_START( ringking )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(kingofb_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, 4000000) /* 4.0 MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(ringking_map)
|
||||
@ -542,6 +555,9 @@ static MACHINE_DRIVER_START( ringking )
|
||||
|
||||
MDRV_QUANTUM_TIME(HZ(6000)) /* We really need heavy synching among the processors */
|
||||
|
||||
MDRV_MACHINE_START(kingofb)
|
||||
MDRV_MACHINE_RESET(kingofb)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -787,7 +803,7 @@ static DRIVER_INIT( ringkin3 )
|
||||
UINT8 *RAM = memory_region(machine, "proms");
|
||||
|
||||
/* expand the first color PROM to look like the kingofb ones... */
|
||||
for (i = 0;i < 0x100;i++)
|
||||
for (i = 0; i < 0x100; i++)
|
||||
RAM[i] = RAM[i + 0x100] >> 4;
|
||||
}
|
||||
|
||||
@ -798,24 +814,23 @@ static DRIVER_INIT( ringkinw )
|
||||
UINT8 *USER1 = memory_region(machine, "user1");
|
||||
|
||||
/* change the PROMs encode in a simple format to use kingofb decode */
|
||||
for(i=0,j=0; j < 0x40; i++,j++)
|
||||
for(i = 0, j = 0; j < 0x40; i++, j++)
|
||||
{
|
||||
if((i & 0xf) == 8)
|
||||
i+=8;
|
||||
i += 8;
|
||||
|
||||
for(k = 0; k <= 3; k++)
|
||||
{
|
||||
PROMS[j + 0x000 + 0x40*k] = USER1[i + 0x000 + 0x100*k]; /* R */
|
||||
PROMS[j + 0x100 + 0x40*k] = USER1[i + 0x400 + 0x100*k]; /* G */
|
||||
PROMS[j + 0x200 + 0x40*k] = USER1[i + 0x800 + 0x100*k]; /* B */
|
||||
PROMS[j + 0x000 + 0x40 * k] = USER1[i + 0x000 + 0x100 * k]; /* R */
|
||||
PROMS[j + 0x100 + 0x40 * k] = USER1[i + 0x400 + 0x100 * k]; /* G */
|
||||
PROMS[j + 0x200 + 0x40 * k] = USER1[i + 0x800 + 0x100 * k]; /* B */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
GAME( 1985, kingofb, 0, kingofb, kingofb, 0, ROT90, "Woodplace", "King of Boxer (English)", 0 )
|
||||
GAME( 1985, ringking, kingofb, ringking, ringking, 0, ROT90, "Data East USA", "Ring King (US set 1)", 0 )
|
||||
GAME( 1985, ringking2, kingofb, ringking, ringking, 0, ROT90, "Data East USA", "Ring King (US set 2)", 0 )
|
||||
GAME( 1985, ringking3, kingofb, kingofb, kingofb, ringkin3, ROT90, "Data East USA", "Ring King (US set 3)", 0 )
|
||||
GAME( 1985, ringkingw, kingofb, kingofb, kingofb, ringkinw, ROT90, "Woodplace", "Ring King (US, Woodplace license)", 0 )
|
||||
GAME( 1985, kingofb, 0, kingofb, kingofb, 0, ROT90, "Woodplace", "King of Boxer (English)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, ringking, kingofb, ringking, ringking, 0, ROT90, "Data East USA", "Ring King (US set 1)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, ringking2, kingofb, ringking, ringking, 0, ROT90, "Data East USA", "Ring King (US set 2)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, ringking3, kingofb, kingofb, kingofb, ringkin3, ROT90, "Data East USA", "Ring King (US set 3)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, ringkingw, kingofb, kingofb, kingofb, ringkinw, ROT90, "Woodplace", "Ring King (US, Woodplace license)", GAME_SUPPORTS_SAVE )
|
||||
|
@ -16,10 +16,10 @@ TODO:
|
||||
- sprite vs. sprite priority especially on ground level
|
||||
|
||||
Updates:
|
||||
- proper sound hw emulation(TS 070308)
|
||||
- you can't play anymore after you die(clock speed too low, check XTAL)
|
||||
- scrolling in bike levels(scroll register overflow)
|
||||
- sprites disappearing at left screen edge(bad clipping)
|
||||
- proper sound hw emulation (TS 070308)
|
||||
- you can't play anymore after you die (clock speed too low, check XTAL)
|
||||
- scrolling in bike levels (scroll register overflow)
|
||||
- sprites disappearing at left screen edge (bad clipping)
|
||||
- artifacts in stage 3 and others(clear sprite mem at bank switch?)
|
||||
(081503AT)
|
||||
|
||||
@ -30,33 +30,24 @@ Updates:
|
||||
#include "cpu/m6800/m6800.h"
|
||||
#include "sound/ay8910.h"
|
||||
#include "sound/sn76496.h"
|
||||
|
||||
|
||||
/* from video */
|
||||
extern VIDEO_START( kncljoe );
|
||||
extern PALETTE_INIT( kncljoe );
|
||||
extern VIDEO_UPDATE( kncljoe );
|
||||
extern WRITE8_HANDLER(kncljoe_videoram_w);
|
||||
extern WRITE8_HANDLER(kncljoe_control_w);
|
||||
extern WRITE8_HANDLER(kncljoe_scroll_w);
|
||||
extern UINT8 *kncljoe_scrollregs;
|
||||
|
||||
static UINT8 port1, port2;
|
||||
#include "includes/kncljoe.h"
|
||||
|
||||
|
||||
static WRITE8_HANDLER( sound_cmd_w )
|
||||
{
|
||||
kncljoe_state *state = (kncljoe_state *)space->machine->driver_data;
|
||||
|
||||
if ((data & 0x80) == 0)
|
||||
soundlatch_w(space, 0, data & 0x7f);
|
||||
else
|
||||
cputag_set_input_line(space->machine, "soundcpu", 0, ASSERT_LINE);
|
||||
cpu_set_input_line(state->soundcpu, 0, ASSERT_LINE);
|
||||
}
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0xbfff) AM_ROM
|
||||
AM_RANGE(0xc000, 0xcfff) AM_RAM_WRITE(kncljoe_videoram_w) AM_BASE_GENERIC(videoram)
|
||||
AM_RANGE(0xd000, 0xd001) AM_WRITE(kncljoe_scroll_w) AM_BASE(&kncljoe_scrollregs)
|
||||
AM_RANGE(0xc000, 0xcfff) AM_RAM_WRITE(kncljoe_videoram_w) AM_BASE_MEMBER(kncljoe_state, videoram)
|
||||
AM_RANGE(0xd000, 0xd001) AM_WRITE(kncljoe_scroll_w) AM_BASE_MEMBER(kncljoe_state, scrollregs)
|
||||
AM_RANGE(0xd800, 0xd800) AM_READ_PORT("SYSTEM")
|
||||
AM_RANGE(0xd801, 0xd801) AM_READ_PORT("P1")
|
||||
AM_RANGE(0xd802, 0xd802) AM_READ_PORT("P2")
|
||||
@ -68,31 +59,35 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0xd803, 0xd803) AM_DEVWRITE("sn2", sn76496_w)
|
||||
AM_RANGE(0xd807, 0xd807) AM_READNOP /* unknown read */
|
||||
AM_RANGE(0xd817, 0xd817) AM_READNOP /* unknown read */
|
||||
AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE_SIZE_MEMBER(kncljoe_state, spriteram, spriteram_size)
|
||||
AM_RANGE(0xf000, 0xffff) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( m6803_port1_w )
|
||||
{
|
||||
port1 = data;
|
||||
kncljoe_state *state = (kncljoe_state *)device->machine->driver_data;
|
||||
state->port1 = data;
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( m6803_port2_w )
|
||||
{
|
||||
kncljoe_state *state = (kncljoe_state *)device->machine->driver_data;
|
||||
|
||||
/* write latch */
|
||||
if ((port2 & 0x01) && !(data & 0x01))
|
||||
if ((state->port2 & 0x01) && !(data & 0x01))
|
||||
{
|
||||
/* control or data port? */
|
||||
if (port2 & 0x08)
|
||||
ay8910_data_address_w(device, port2 >> 2, port1);
|
||||
if (state->port2 & 0x08)
|
||||
ay8910_data_address_w(device, state->port2 >> 2, state->port1);
|
||||
}
|
||||
port2 = data;
|
||||
state->port2 = data;
|
||||
}
|
||||
|
||||
static READ8_DEVICE_HANDLER( m6803_port1_r )
|
||||
{
|
||||
if (port2 & 0x08)
|
||||
kncljoe_state *state = (kncljoe_state *)device->machine->driver_data;
|
||||
|
||||
if (state->port2 & 0x08)
|
||||
return ay8910_r(device, 0);
|
||||
return 0xff;
|
||||
}
|
||||
@ -104,7 +99,8 @@ static READ8_DEVICE_HANDLER( m6803_port2_r )
|
||||
|
||||
static WRITE8_HANDLER( sound_irq_ack_w )
|
||||
{
|
||||
cputag_set_input_line(space->machine, "soundcpu", 0, CLEAR_LINE);
|
||||
kncljoe_state *state = (kncljoe_state *)space->machine->driver_data;
|
||||
cpu_set_input_line(state->soundcpu, 0, CLEAR_LINE);
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER(unused_w)
|
||||
@ -252,10 +248,36 @@ static INTERRUPT_GEN (sound_nmi)
|
||||
cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
|
||||
static MACHINE_START( kncljoe )
|
||||
{
|
||||
kncljoe_state *state = (kncljoe_state *)machine->driver_data;
|
||||
|
||||
state->soundcpu = devtag_get_device(machine, "soundcpu");
|
||||
|
||||
state_save_register_global(machine, state->port1);
|
||||
state_save_register_global(machine, state->port2);
|
||||
state_save_register_global(machine, state->tile_bank);
|
||||
state_save_register_global(machine, state->sprite_bank);
|
||||
state_save_register_global(machine, state->flipscreen);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( kncljoe )
|
||||
{
|
||||
kncljoe_state *state = (kncljoe_state *)machine->driver_data;
|
||||
|
||||
state->port1 = 0;
|
||||
state->port2 = 0;
|
||||
state->tile_bank = 0;
|
||||
state->sprite_bank = 0;
|
||||
state->flipscreen = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( kncljoe )
|
||||
|
||||
/* basic machine hardware */
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(kncljoe_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, XTAL_6MHz) /* verified on pcb */
|
||||
MDRV_CPU_PROGRAM_MAP(main_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
|
||||
@ -265,6 +287,8 @@ static MACHINE_DRIVER_START( kncljoe )
|
||||
MDRV_CPU_IO_MAP(sound_portmap)
|
||||
MDRV_CPU_PERIODIC_INT(sound_nmi, (double)3970) //measured 3.970 kHz
|
||||
|
||||
MDRV_MACHINE_START(kncljoe)
|
||||
MDRV_MACHINE_RESET(kncljoe)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)
|
||||
@ -397,6 +421,6 @@ ROM_END
|
||||
|
||||
|
||||
|
||||
GAME( 1985, kncljoe, 0, kncljoe, kncljoe, 0, ROT0, "[Seibu Kaihatsu] (Taito license)", "Knuckle Joe (set 1)", 0 )
|
||||
GAME( 1985, kncljoea, kncljoe, kncljoe, kncljoe, 0, ROT0, "[Seibu Kaihatsu] (Taito license)", "Knuckle Joe (set 2)", 0 )
|
||||
GAME( 1985, bcrusher, kncljoe, kncljoe, kncljoe, 0, ROT0, "bootleg", "Bone Crusher", 0 )
|
||||
GAME( 1985, kncljoe, 0, kncljoe, kncljoe, 0, ROT0, "[Seibu Kaihatsu] (Taito license)", "Knuckle Joe (set 1)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, kncljoea, kncljoe, kncljoe, kncljoe, 0, ROT0, "[Seibu Kaihatsu] (Taito license)", "Knuckle Joe (set 2)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, bcrusher, kncljoe, kncljoe, kncljoe, 0, ROT0, "bootleg", "Bone Crusher", GAME_SUPPORTS_SAVE )
|
||||
|
@ -27,7 +27,7 @@ There's four reads in a row of input port 3 - 32 possibilities.
|
||||
But only 14 are valid - two lookup tables are used to decode the inputs.
|
||||
|
||||
For example, for one of input keys game expects data: 0,0,8,0
|
||||
It's encoded (in internal lookup table, as well as in inputTab[]) as 0x68 :
|
||||
It's encoded (in internal lookup table, as well as in input_tab[]) as 0x68 :
|
||||
- bits 0-4 = data to return (valid values are 1,2,4,8,$10 - only one bit set)
|
||||
- bits 5-7 = read cycle (1-4) to return above data
|
||||
All other reads should return 0.
|
||||
@ -41,88 +41,161 @@ to prevent disabling inputs.
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/ay8910.h"
|
||||
|
||||
static int inputcnt=0;
|
||||
static int inputval=0;
|
||||
static int inputlen=0;
|
||||
static tilemap *koikoi_tilemap;
|
||||
static int ioram[8];
|
||||
#define KOIKOI_CRYSTAL 15468000
|
||||
|
||||
static const int inputTab[]= { 0x22, 0x64, 0x44, 0x68, 0x30, 0x50, 0x70, 0x48, 0x28, 0x21, 0x41, 0x82, 0x81, 0x42 };
|
||||
static const int input_tab[]= { 0x22, 0x64, 0x44, 0x68, 0x30, 0x50, 0x70, 0x48, 0x28, 0x21, 0x41, 0x82, 0x81, 0x42 };
|
||||
|
||||
typedef struct _koikoi_state koikoi_state;
|
||||
struct _koikoi_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
|
||||
/* video-related */
|
||||
tilemap *tmap;
|
||||
|
||||
/* misc */
|
||||
int inputcnt;
|
||||
int inputval;
|
||||
int inputlen;
|
||||
int ioram[8];
|
||||
};
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Video emulation
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static TILE_GET_INFO( get_tile_info )
|
||||
{
|
||||
int code = machine->generic.videoram.u8[tile_index]|((machine->generic.videoram.u8[tile_index+0x400] & 0x40)<<2);
|
||||
int color = (machine->generic.videoram.u8[tile_index+0x400]&0x1f);
|
||||
int flip = (machine->generic.videoram.u8[tile_index+0x400]&0x80)?(TILEMAP_FLIPX|TILEMAP_FLIPY):0;
|
||||
koikoi_state *state = (koikoi_state *)machine->driver_data;
|
||||
int code = state->videoram[tile_index] | ((state->videoram[tile_index + 0x400] & 0x40) << 2);
|
||||
int color = (state->videoram[tile_index + 0x400] & 0x1f);
|
||||
int flip = (state->videoram[tile_index + 0x400] & 0x80) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0;
|
||||
|
||||
SET_TILE_INFO( 0, code, color, flip);
|
||||
SET_TILE_INFO( 0, code, color, flip);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER(vram_w)
|
||||
static PALETTE_INIT( koikoi ) //wrong
|
||||
{
|
||||
space->machine->generic.videoram.u8[offset]=data;
|
||||
tilemap_mark_tile_dirty(koikoi_tilemap,offset&0x3ff);
|
||||
}
|
||||
int i;
|
||||
|
||||
static READ8_DEVICE_HANDLER(input_r)
|
||||
{
|
||||
if(inputcnt<0)
|
||||
for (i = 0; i < 0x100; i++)
|
||||
{
|
||||
return 0;
|
||||
int bit0, bit1, bit2, bit3, r, g, b;
|
||||
|
||||
bit0 = (color_prom[i] >> 3) & 0x01;
|
||||
bit1 = (color_prom[i] >> 2) & 0x01;
|
||||
bit2 = (color_prom[i] >> 1) & 0x01;
|
||||
bit3 = (color_prom[i] >> 0) & 0x01;
|
||||
|
||||
r = bit0 * 0xaa + bit3 * 0x55;
|
||||
g = bit1 * 0xaa + bit3 * 0x55;
|
||||
b = bit2 * 0xaa + bit3 * 0x55;
|
||||
|
||||
palette_set_color(machine, i, MAKE_RGB(r, g, b));
|
||||
}
|
||||
}
|
||||
|
||||
if(!inputcnt)
|
||||
static VIDEO_START(koikoi)
|
||||
{
|
||||
koikoi_state *state = (koikoi_state *)machine->driver_data;
|
||||
state->tmap = tilemap_create(machine, get_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
}
|
||||
|
||||
static VIDEO_UPDATE(koikoi)
|
||||
{
|
||||
koikoi_state *state = (koikoi_state *)screen->machine->driver_data;
|
||||
tilemap_draw(bitmap, cliprect, state->tmap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Memory handlers
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static WRITE8_HANDLER( vram_w )
|
||||
{
|
||||
koikoi_state *state = (koikoi_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->tmap, offset & 0x3ff);
|
||||
}
|
||||
|
||||
static READ8_DEVICE_HANDLER( input_r )
|
||||
{
|
||||
koikoi_state *state = (koikoi_state *)device->machine->driver_data;
|
||||
|
||||
if (state->inputcnt < 0)
|
||||
return 0;
|
||||
|
||||
if (!state->inputcnt)
|
||||
{
|
||||
int key=input_port_read(device->machine, "IN1");
|
||||
int keyval=0; //we must return 0 (0x2 in 2nd read) to clear 4 bit at $6600 and allow next read
|
||||
int key = input_port_read(device->machine, "IN1");
|
||||
int keyval = 0; //we must return 0 (0x2 in 2nd read) to clear 4 bit at $6600 and allow next read
|
||||
|
||||
if(key)
|
||||
if (key)
|
||||
{
|
||||
while(!(key&1)) { key>>=1; keyval++; }
|
||||
while (!(key & 1))
|
||||
{
|
||||
key >>= 1;
|
||||
keyval++;
|
||||
}
|
||||
}
|
||||
|
||||
inputval=inputTab[keyval]&0x1f;
|
||||
inputlen=inputTab[keyval]>>5;
|
||||
state->inputval = input_tab[keyval] & 0x1f;
|
||||
state->inputlen = input_tab[keyval] >> 5;
|
||||
}
|
||||
|
||||
if(inputlen==++inputcnt) //return expected value
|
||||
if (state->inputlen == ++state->inputcnt) //return expected value
|
||||
{
|
||||
return inputval^0xff;
|
||||
return state->inputval ^ 0xff;
|
||||
}
|
||||
|
||||
if(inputcnt>4) //end of cycle
|
||||
if (state->inputcnt > 4) //end of cycle
|
||||
{
|
||||
inputcnt=-1;
|
||||
state->inputcnt = -1;
|
||||
}
|
||||
|
||||
return 0xff; //return 0^0xff
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER(unknown_w)
|
||||
static WRITE8_DEVICE_HANDLER( unknown_w )
|
||||
{
|
||||
//unknown... could be input select (player 1 or 2 = fd/fe or ef/df(??) )
|
||||
}
|
||||
|
||||
static READ8_HANDLER(io_r)
|
||||
static READ8_HANDLER( io_r )
|
||||
{
|
||||
if(!offset)
|
||||
return input_port_read(space->machine, "IN0")^ioram[4]; //coin
|
||||
koikoi_state *state = (koikoi_state *)space->machine->driver_data;
|
||||
if (!offset)
|
||||
return input_port_read(space->machine, "IN0") ^ state->ioram[4]; //coin
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER(io_w)
|
||||
static WRITE8_HANDLER( io_w )
|
||||
{
|
||||
if(offset==7 && data==0)
|
||||
inputcnt=0; //reset read cycle counter
|
||||
koikoi_state *state = (koikoi_state *)space->machine->driver_data;
|
||||
if (offset == 7 && data == 0)
|
||||
state->inputcnt = 0; //reset read cycle counter
|
||||
|
||||
ioram[offset]=data;
|
||||
state->ioram[offset] = data;
|
||||
}
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Address maps
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static ADDRESS_MAP_START( koikoi_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x2fff) AM_ROM
|
||||
AM_RANGE(0x6000, 0x67ff) AM_RAM
|
||||
AM_RANGE(0x7000, 0x77ff) AM_RAM_WRITE(vram_w) AM_BASE_GENERIC(videoram)
|
||||
AM_RANGE(0x7000, 0x77ff) AM_RAM_WRITE(vram_w) AM_BASE_MEMBER(koikoi_state, videoram)
|
||||
AM_RANGE(0x8000, 0x8000) AM_READ_PORT("DSW")
|
||||
AM_RANGE(0x9000, 0x9007) AM_READWRITE(io_r, io_w)
|
||||
ADDRESS_MAP_END
|
||||
@ -134,6 +207,12 @@ static ADDRESS_MAP_START( koikoi_io_map, ADDRESS_SPACE_IO, 8 )
|
||||
AM_RANGE(0x06, 0x07) AM_DEVWRITE("aysnd", ay8910_data_address_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Input ports
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static INPUT_PORTS_START( koikoi )
|
||||
PORT_START("DSW")
|
||||
PORT_DIPNAME( 0x03, 0x01, "Timer C" )
|
||||
@ -181,37 +260,12 @@ static INPUT_PORTS_START( koikoi )
|
||||
PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_START2 )
|
||||
INPUT_PORTS_END
|
||||
|
||||
static PALETTE_INIT( koikoi ) //wrong
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0;i < 0x100;i++)
|
||||
{
|
||||
int bit0,bit1,bit2,bit3,r,g,b;
|
||||
|
||||
bit0 = (color_prom[i] >> 3) & 0x01;
|
||||
bit1 = (color_prom[i] >> 2) & 0x01;
|
||||
bit2 = (color_prom[i] >> 1) & 0x01;
|
||||
bit3 = (color_prom[i] >> 0) & 0x01;
|
||||
|
||||
r=bit0*0xaa+bit3*0x55;
|
||||
g=bit1*0xaa+bit3*0x55;
|
||||
b=bit2*0xaa+bit3*0x55;
|
||||
|
||||
palette_set_color(machine,i,MAKE_RGB(r,g,b));
|
||||
}
|
||||
}
|
||||
|
||||
static VIDEO_START(koikoi)
|
||||
{
|
||||
koikoi_tilemap = tilemap_create(machine, get_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
}
|
||||
|
||||
static VIDEO_UPDATE(koikoi)
|
||||
{
|
||||
tilemap_draw(bitmap,cliprect,koikoi_tilemap,0,0);
|
||||
return 0;
|
||||
}
|
||||
/*************************************
|
||||
*
|
||||
* Graphics definitions
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static const gfx_layout tilelayout =
|
||||
{
|
||||
@ -231,6 +285,12 @@ static GFXDECODE_START( koikoi )
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Sound interface
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static const ay8910_interface ay8910_config =
|
||||
{
|
||||
AY8910_LEGACY_OUTPUT,
|
||||
@ -239,16 +299,50 @@ static const ay8910_interface ay8910_config =
|
||||
DEVCB_HANDLER(unknown_w), DEVCB_NULL
|
||||
};
|
||||
|
||||
#define KOIKOI_CRYSTAL 15468000
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Machine driver
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( koikoi )
|
||||
{
|
||||
koikoi_state *state = (koikoi_state *)machine->driver_data;
|
||||
|
||||
state_save_register_global(machine, state->inputcnt);
|
||||
state_save_register_global(machine, state->inputval);
|
||||
state_save_register_global(machine, state->inputlen);
|
||||
state_save_register_global_array(machine, state->ioram);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( koikoi )
|
||||
{
|
||||
koikoi_state *state = (koikoi_state *)machine->driver_data;
|
||||
int i;
|
||||
|
||||
state->inputcnt = -1;
|
||||
state->inputval = 0;
|
||||
state->inputlen = 0;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
state->ioram[i] = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( koikoi )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(koikoi_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80,KOIKOI_CRYSTAL/4) /* ?? */
|
||||
MDRV_CPU_PROGRAM_MAP(koikoi_map)
|
||||
MDRV_CPU_IO_MAP(koikoi_io_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", nmi_line_pulse)
|
||||
|
||||
MDRV_MACHINE_START(koikoi)
|
||||
MDRV_MACHINE_RESET(koikoi)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -273,12 +367,11 @@ static MACHINE_DRIVER_START( koikoi )
|
||||
MACHINE_DRIVER_END
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Game driver(s)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* ROM definition(s)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
ROM_START( koikoi )
|
||||
ROM_REGION( 0x10000, "maincpu", 0 ) /* code */
|
||||
@ -302,4 +395,10 @@ ROM_START( koikoi )
|
||||
ROM_LOAD( "pal16r8a_red.ic10", 0x0800, 0x0104, CRC(027ad661) SHA1(fa5aafe6deb3a9865498152b92dd3776ea10a51d) )
|
||||
ROM_END
|
||||
|
||||
GAME( 1982, koikoi, 0, koikoi, koikoi, 0, ROT270, "Kiwako", "Koi Koi Part 2", GAME_WRONG_COLORS )
|
||||
/*************************************
|
||||
*
|
||||
* Game driver(s)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1982, koikoi, 0, koikoi, koikoi, 0, ROT270, "Kiwako", "Koi Koi Part 2", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE )
|
||||
|
@ -1,29 +1,17 @@
|
||||
/********************************************************
|
||||
|
||||
KO Punch (c) 1981 Sega
|
||||
KO Punch (c) 1981 Sega
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "cpu/i8085/i8085.h"
|
||||
|
||||
extern UINT8 *kopunch_videoram2;
|
||||
|
||||
extern WRITE8_HANDLER( kopunch_videoram_w );
|
||||
extern WRITE8_HANDLER( kopunch_videoram2_w );
|
||||
extern WRITE8_HANDLER( kopunch_scroll_x_w );
|
||||
extern WRITE8_HANDLER( kopunch_scroll_y_w );
|
||||
extern WRITE8_HANDLER( kopunch_gfxbank_w );
|
||||
|
||||
extern PALETTE_INIT( kopunch );
|
||||
extern VIDEO_START( kopunch );
|
||||
extern VIDEO_UPDATE( kopunch );
|
||||
|
||||
#include "includes/kopunch.h"
|
||||
|
||||
static INTERRUPT_GEN( kopunch_interrupt )
|
||||
{
|
||||
cpu_set_input_line(device,I8085_RST75_LINE,ASSERT_LINE);
|
||||
cpu_set_input_line(device,I8085_RST75_LINE,CLEAR_LINE);
|
||||
cpu_set_input_line(device, I8085_RST75_LINE, ASSERT_LINE);
|
||||
cpu_set_input_line(device, I8085_RST75_LINE, CLEAR_LINE);
|
||||
}
|
||||
|
||||
static READ8_HANDLER( kopunch_in_r )
|
||||
@ -37,7 +25,7 @@ static READ8_HANDLER( kopunch_in_r )
|
||||
|
||||
static WRITE8_HANDLER( kopunch_lamp_w )
|
||||
{
|
||||
set_led_status(space->machine, 0,~data & 0x80);
|
||||
set_led_status(space->machine, 0, ~data & 0x80);
|
||||
|
||||
// if ((data & 0x7f) != 0x7f)
|
||||
// popmessage("port 38 = %02x",data);
|
||||
@ -45,8 +33,8 @@ static WRITE8_HANDLER( kopunch_lamp_w )
|
||||
|
||||
static WRITE8_HANDLER( kopunch_coin_w )
|
||||
{
|
||||
coin_counter_w(space->machine, 0,~data & 0x80);
|
||||
coin_counter_w(space->machine, 1,~data & 0x40);
|
||||
coin_counter_w(space->machine, 0, ~data & 0x80);
|
||||
coin_counter_w(space->machine, 1, ~data & 0x40);
|
||||
|
||||
// if ((data & 0x3f) != 0x3f)
|
||||
// popmessage("port 34 = %02x",data);
|
||||
@ -57,8 +45,8 @@ static WRITE8_HANDLER( kopunch_coin_w )
|
||||
static ADDRESS_MAP_START( kopunch_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x1fff) AM_ROM
|
||||
AM_RANGE(0x2000, 0x23ff) AM_RAM
|
||||
AM_RANGE(0x6000, 0x63ff) AM_RAM_WRITE(kopunch_videoram_w) AM_BASE_GENERIC(videoram)
|
||||
AM_RANGE(0x7000, 0x70ff) AM_RAM_WRITE(kopunch_videoram2_w) AM_BASE(&kopunch_videoram2)
|
||||
AM_RANGE(0x6000, 0x63ff) AM_RAM_WRITE(kopunch_videoram_w) AM_BASE_MEMBER(kopunch_state, videoram)
|
||||
AM_RANGE(0x7000, 0x70ff) AM_RAM_WRITE(kopunch_videoram2_w) AM_BASE_MEMBER(kopunch_state, videoram2)
|
||||
AM_RANGE(0x7100, 0x7aff) AM_RAM // ???
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -82,16 +70,20 @@ ADDRESS_MAP_END
|
||||
|
||||
static INPUT_CHANGED( left_coin_inserted )
|
||||
{
|
||||
kopunch_state *state = (kopunch_state *)field->port->machine->driver_data;
|
||||
|
||||
/* left coin insertion causes a rst6.5 (vector 0x34) */
|
||||
if(newval)
|
||||
cputag_set_input_line(field->port->machine, "maincpu", I8085_RST65_LINE, HOLD_LINE);
|
||||
if (newval)
|
||||
cpu_set_input_line(state->maincpu, I8085_RST65_LINE, HOLD_LINE);
|
||||
}
|
||||
|
||||
static INPUT_CHANGED( right_coin_inserted )
|
||||
{
|
||||
kopunch_state *state = (kopunch_state *)field->port->machine->driver_data;
|
||||
|
||||
/* right coin insertion causes a rst5.5 (vector 0x2c) */
|
||||
if(newval)
|
||||
cputag_set_input_line(field->port->machine, "maincpu", I8085_RST55_LINE, HOLD_LINE);
|
||||
if (newval)
|
||||
cpu_set_input_line(state->maincpu, I8085_RST55_LINE, HOLD_LINE);
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( kopunch )
|
||||
@ -108,9 +100,9 @@ static INPUT_PORTS_START( kopunch )
|
||||
PORT_START("SYSTEM")
|
||||
PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* punch strength (high 3 bits) */
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(1) PORT_CHANGED(right_coin_inserted, 0)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON6 )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON7 )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) PORT_CHANGED(left_coin_inserted, 0)
|
||||
|
||||
PORT_START("DSW")
|
||||
@ -179,14 +171,36 @@ static GFXDECODE_START( kopunch )
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
static MACHINE_START( kopunch )
|
||||
{
|
||||
kopunch_state *state = (kopunch_state *)machine->driver_data;
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
|
||||
state_save_register_global(machine, state->gfxbank);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( kopunch )
|
||||
{
|
||||
kopunch_state *state = (kopunch_state *)machine->driver_data;
|
||||
|
||||
state->gfxbank = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( kopunch )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(kopunch_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", 8085A, 4000000) /* 4 MHz ???? Uses SIM, must be 8085 */
|
||||
MDRV_CPU_PROGRAM_MAP(kopunch_map)
|
||||
MDRV_CPU_IO_MAP(kopunch_io_map)
|
||||
MDRV_CPU_VBLANK_INT("screen",kopunch_interrupt)
|
||||
|
||||
MDRV_MACHINE_START(kopunch)
|
||||
MDRV_MACHINE_RESET(kopunch)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -236,4 +250,4 @@ ROM_START( kopunch )
|
||||
ROM_LOAD( "epr1100", 0x0040, 0x0020, CRC(bedb66b1) SHA1(8e78bb205d900075b761e1baa5f5813174ff28ba) ) /* unknown */
|
||||
ROM_END
|
||||
|
||||
GAME( 1981, kopunch, 0, kopunch, kopunch, 0, ROT270, "Sega", "KO Punch", GAME_NO_SOUND | GAME_NOT_WORKING)
|
||||
GAME( 1981, kopunch, 0, kopunch, kopunch, 0, ROT270, "Sega", "KO Punch", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
|
||||
|
@ -67,16 +67,10 @@ SRAM:
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/ay8910.h"
|
||||
#include "sound/dac.h"
|
||||
#include "includes/ksayakyu.h"
|
||||
|
||||
#define MAIN_CLOCK XTAL_18_432MHz
|
||||
|
||||
WRITE8_HANDLER( ksayakyu_videoram_w );
|
||||
WRITE8_HANDLER( ksayakyu_videoctrl_w );
|
||||
PALETTE_INIT( ksayakyu );
|
||||
VIDEO_START( ksayakyu );
|
||||
VIDEO_UPDATE( ksayakyu );
|
||||
|
||||
static int sound_status;
|
||||
|
||||
static WRITE8_HANDLER( bank_select_w )
|
||||
{
|
||||
@ -87,24 +81,27 @@ static WRITE8_HANDLER( bank_select_w )
|
||||
xxxxxxx - unused ?
|
||||
|
||||
*/
|
||||
memory_set_bankptr(space->machine, "bank1", memory_region(space->machine, "maincpu") + ((data&1) * 0x4000) + 0x10000 );
|
||||
memory_set_bank(space->machine, "bank1", data & 0x01);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( latch_w )
|
||||
{
|
||||
sound_status&=~0x80;
|
||||
soundlatch_w(space,0,data|0x80);
|
||||
ksayakyu_state *state = (ksayakyu_state *)space->machine->driver_data;
|
||||
state->sound_status &= ~0x80;
|
||||
soundlatch_w(space, 0, data | 0x80);
|
||||
}
|
||||
|
||||
static READ8_HANDLER (sound_status_r)
|
||||
{
|
||||
return sound_status|4;
|
||||
ksayakyu_state *state = (ksayakyu_state *)space->machine->driver_data;
|
||||
return state->sound_status | 4;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER(tomaincpu_w)
|
||||
{
|
||||
sound_status|=0x80;
|
||||
soundlatch_w(space,0,data);
|
||||
ksayakyu_state *state = (ksayakyu_state *)space->machine->driver_data;
|
||||
state->sound_status |= 0x80;
|
||||
soundlatch_w(space, 0, data);
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( maincpu_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
@ -121,8 +118,8 @@ static ADDRESS_MAP_START( maincpu_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0xa806, 0xa806) AM_READ(sound_status_r)
|
||||
AM_RANGE(0xa807, 0xa807) AM_READNOP /* watchdog ? */
|
||||
AM_RANGE(0xa808, 0xa808) AM_WRITE(bank_select_w)
|
||||
AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(ksayakyu_videoram_w) AM_BASE_GENERIC(videoram)
|
||||
AM_RANGE(0xb800, 0xbfff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(ksayakyu_videoram_w) AM_BASE_MEMBER(ksayakyu_state, videoram)
|
||||
AM_RANGE(0xb800, 0xbfff) AM_RAM AM_BASE_SIZE_MEMBER(ksayakyu_state, spriteram, spriteram_size)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( soundcpu_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
@ -176,17 +173,17 @@ INPUT_PORTS_END
|
||||
|
||||
static WRITE8_DEVICE_HANDLER(dummy1_w)
|
||||
{
|
||||
// printf("%02x 1\n",data);
|
||||
// printf("%02x 1\n", data);
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER(dummy2_w)
|
||||
{
|
||||
// printf("%02x 2\n",data);
|
||||
// printf("%02x 2\n", data);
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER(dummy3_w)
|
||||
{
|
||||
// printf("%02x 3\n",data);
|
||||
// printf("%02x 3\n", data);
|
||||
}
|
||||
|
||||
|
||||
@ -252,7 +249,34 @@ static GFXDECODE_START( ksayakyu )
|
||||
GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 0, 16 )
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
static MACHINE_START( ksayakyu )
|
||||
{
|
||||
ksayakyu_state *state = (ksayakyu_state *)machine->driver_data;
|
||||
UINT8 *ROM = memory_region(machine, "maincpu");
|
||||
|
||||
memory_configure_bank(machine, "bank1", 0, 2, &ROM[0x10000], 0x4000);
|
||||
|
||||
state_save_register_global(machine, state->sound_status);
|
||||
state_save_register_global(machine, state->video_ctrl);
|
||||
state_save_register_global(machine, state->flipscreen);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( ksayakyu )
|
||||
{
|
||||
ksayakyu_state *state = (ksayakyu_state *)machine->driver_data;
|
||||
|
||||
state->sound_status = 0xff;
|
||||
state->video_ctrl = 0;
|
||||
state->flipscreen = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( ksayakyu )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(ksayakyu_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80,MAIN_CLOCK/8) //divider is guessed
|
||||
MDRV_CPU_PROGRAM_MAP(maincpu_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
|
||||
@ -263,6 +287,9 @@ static MACHINE_DRIVER_START( ksayakyu )
|
||||
|
||||
MDRV_QUANTUM_TIME(HZ(60000))
|
||||
|
||||
MDRV_MACHINE_START(ksayakyu)
|
||||
MDRV_MACHINE_RESET(ksayakyu)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -329,9 +356,4 @@ ROM_START( ksayakyu )
|
||||
ROM_LOAD( "9f.bin", 0x0000, 0x0100, CRC(ff71b27f) SHA1(6aad2bd2be997595a05ddb81d24df8fe1435910b) )
|
||||
ROM_END
|
||||
|
||||
static DRIVER_INIT( ksayakyu )
|
||||
{
|
||||
sound_status = 0xff;
|
||||
}
|
||||
|
||||
GAME( 1985, ksayakyu, 0, ksayakyu, ksayakyu, ksayakyu, ORIENTATION_FLIP_Y, "Taito Corporation", "Kusayakyuu",0 )
|
||||
GAME( 1985, ksayakyu, 0, ksayakyu, ksayakyu, 0, ORIENTATION_FLIP_Y, "Taito Corporation", "Kusayakyuu", GAME_SUPPORTS_SAVE )
|
||||
|
@ -24,32 +24,20 @@
|
||||
#include "driver.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "deprecat.h"
|
||||
#include "kyugo.h"
|
||||
#include "sound/ay8910.h"
|
||||
|
||||
|
||||
static UINT8 *shared_ram;
|
||||
static WRITE8_HANDLER( kyugo_sub_cpu_control_w );
|
||||
#include "includes/kyugo.h"
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Machine initialization
|
||||
* Memory handlers
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_RESET( kyugo )
|
||||
{
|
||||
const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
|
||||
// must start with interrupts and sub CPU disabled
|
||||
cpu_interrupt_enable(cputag_get_cpu(machine, "maincpu"), 0);
|
||||
kyugo_sub_cpu_control_w(space, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( kyugo_sub_cpu_control_w )
|
||||
{
|
||||
cputag_set_input_line(space->machine, "sub", INPUT_LINE_HALT, data ? CLEAR_LINE : ASSERT_LINE);
|
||||
kyugo_state *state = (kyugo_state *)space->machine->driver_data;
|
||||
cpu_set_input_line(state->subcpu, INPUT_LINE_HALT, data ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -61,15 +49,15 @@ static WRITE8_HANDLER( kyugo_sub_cpu_control_w )
|
||||
|
||||
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(kyugo_bgvideoram_w) AM_BASE(&kyugo_bgvideoram)
|
||||
AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE(kyugo_bgattribram_w) AM_BASE(&kyugo_bgattribram)
|
||||
AM_RANGE(0x9000, 0x97ff) AM_RAM_WRITE(kyugo_fgvideoram_w) AM_BASE(&kyugo_fgvideoram)
|
||||
AM_RANGE(0x9800, 0x9fff) AM_RAM_READ(kyugo_spriteram_2_r) AM_BASE(&kyugo_spriteram_2)
|
||||
AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_BASE(&kyugo_spriteram_1)
|
||||
AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(kyugo_bgvideoram_w) AM_BASE_MEMBER(kyugo_state, bgvideoram)
|
||||
AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE(kyugo_bgattribram_w) AM_BASE_MEMBER(kyugo_state, bgattribram)
|
||||
AM_RANGE(0x9000, 0x97ff) AM_RAM_WRITE(kyugo_fgvideoram_w) AM_BASE_MEMBER(kyugo_state, fgvideoram)
|
||||
AM_RANGE(0x9800, 0x9fff) AM_RAM_READ(kyugo_spriteram_2_r) AM_BASE_MEMBER(kyugo_state, spriteram_2)
|
||||
AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_BASE_MEMBER(kyugo_state, spriteram_1)
|
||||
AM_RANGE(0xa800, 0xa800) AM_WRITE(kyugo_scroll_x_lo_w)
|
||||
AM_RANGE(0xb000, 0xb000) AM_WRITE(kyugo_gfxctrl_w)
|
||||
AM_RANGE(0xb800, 0xb800) AM_WRITE(kyugo_scroll_y_w)
|
||||
AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("share1") AM_BASE(&shared_ram)
|
||||
AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("share1") AM_BASE_MEMBER(kyugo_state, shared_ram)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
@ -459,8 +447,43 @@ static const ay8910_interface ay8910_config =
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( kyugo )
|
||||
{
|
||||
kyugo_state *state = (kyugo_state *)machine->driver_data;
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
state->subcpu = devtag_get_device(machine, "sub");
|
||||
|
||||
state_save_register_global(machine, state->scroll_x_lo);
|
||||
state_save_register_global(machine, state->scroll_x_hi);
|
||||
state_save_register_global(machine, state->scroll_y);
|
||||
state_save_register_global(machine, state->bgpalbank);
|
||||
state_save_register_global(machine, state->fgcolor);
|
||||
state_save_register_global(machine, state->flipscreen);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( kyugo )
|
||||
{
|
||||
kyugo_state *state = (kyugo_state *)machine->driver_data;
|
||||
const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
|
||||
// must start with interrupts and sub CPU disabled
|
||||
cpu_interrupt_enable(cputag_get_cpu(machine, "maincpu"), 0);
|
||||
kyugo_sub_cpu_control_w(space, 0, 0);
|
||||
|
||||
state->scroll_x_lo = 0;
|
||||
state->scroll_x_hi = 0;
|
||||
state->scroll_y = 0;
|
||||
state->bgpalbank = 0;
|
||||
state->fgcolor = 0;
|
||||
state->flipscreen = 0;
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_DRIVER_START( gyrodine )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(kyugo_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, XTAL_18_432MHz/6) /* verified on pcb */
|
||||
MDRV_CPU_PROGRAM_MAP(main_map)
|
||||
@ -474,6 +497,7 @@ static MACHINE_DRIVER_START( gyrodine )
|
||||
|
||||
MDRV_QUANTUM_TIME(HZ(6000))
|
||||
|
||||
MDRV_MACHINE_START(kyugo)
|
||||
MDRV_MACHINE_RESET(kyugo)
|
||||
|
||||
/* video hardware */
|
||||
@ -1211,8 +1235,10 @@ static DRIVER_INIT( gyrodine )
|
||||
|
||||
static DRIVER_INIT( srdmissn )
|
||||
{
|
||||
kyugo_state *state = (kyugo_state *)machine->driver_data;
|
||||
|
||||
/* shared RAM is mapped at 0xe000 as well */
|
||||
memory_install_ram(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xe000, 0xe7ff, 0, 0, shared_ram);
|
||||
memory_install_ram(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xe000, 0xe7ff, 0, 0, state->shared_ram);
|
||||
|
||||
/* extra RAM on sub CPU */
|
||||
memory_install_ram(cputag_get_address_space(machine, "sub", ADDRESS_SPACE_PROGRAM), 0x8800, 0x8fff, 0, 0, NULL);
|
||||
@ -1226,20 +1252,20 @@ static DRIVER_INIT( srdmissn )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1984, gyrodine, 0, gyrodine, gyrodine, gyrodine, ROT90, "Crux (Taito Corporation license)", "Gyrodine (Taito Corporation license)", 0 )
|
||||
GAME( 1984, gyrodinec,gyrodine, gyrodine, gyrodine, gyrodine, ROT90, "Crux", "Gyrodine", 0 )
|
||||
GAME( 1984, buzzard, gyrodine, gyrodine, gyrodine, gyrodine, ROT90, "Crux", "Buzzard", 0 )
|
||||
GAME( 1985, sonofphx, 0, sonofphx, sonofphx, 0, ROT90, "Associated Overseas MFR, Inc", "Son of Phoenix", 0 )
|
||||
GAME( 1985, repulse, sonofphx, sonofphx, sonofphx, 0, ROT90, "Sega", "Repulse", 0 )
|
||||
GAME( 1985, 99lstwar, sonofphx, sonofphx, sonofphx, 0, ROT90, "Proma", "'99: The Last War", 0 )
|
||||
GAME( 1985, 99lstwara,sonofphx, sonofphx, sonofphx, 0, ROT90, "Proma", "'99: The Last War (alternate)", 0 )
|
||||
GAME( 1985, 99lstwark,sonofphx, sonofphx, sonofphx, 0, ROT90, "Kyugo", "'99: The Last War (Kyugo)", 0 )
|
||||
GAME( 1985, flashgal, 0, flashgal, flashgal, 0, ROT0, "Sega", "Flashgal (set 1)", 0 )
|
||||
GAME( 1985, flashgala,flashgal, flashgla, flashgal, 0, ROT0, "Sega", "Flashgal (set 2)", 0 )
|
||||
GAME( 1986, srdmissn, 0, srdmissn, srdmissn, srdmissn, ROT90, "Taito Corporation", "S.R.D. Mission", 0 )
|
||||
GAME( 1986, fx, srdmissn, srdmissn, srdmissn, srdmissn, ROT90, "bootleg", "F-X", 0 )
|
||||
GAME( 1986, legend, 0, legend, legend, srdmissn, ROT0, "Sega / Coreland", "Legend", 0 )
|
||||
GAME( 1987, airwolf, 0, srdmissn, airwolf, srdmissn, ROT0, "Kyugo", "Airwolf", 0 )
|
||||
GAME( 1987, airwolfa, airwolf, srdmissn, airwolf, srdmissn, ROT0, "Kyugo (UA Theatre license)", "Airwolf (US)", 0 )
|
||||
GAME( 1987, skywolf, airwolf, srdmissn, skywolf, srdmissn, ROT0, "bootleg", "Sky Wolf (set 1)", 0 )
|
||||
GAME( 1987, skywolf2, airwolf, srdmissn, airwolf, srdmissn, ROT0, "bootleg", "Sky Wolf (set 2)", 0 )
|
||||
GAME( 1984, gyrodine, 0, gyrodine, gyrodine, gyrodine, ROT90, "Crux (Taito Corporation license)", "Gyrodine (Taito Corporation license)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, gyrodinec, gyrodine, gyrodine, gyrodine, gyrodine, ROT90, "Crux", "Gyrodine", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, buzzard, gyrodine, gyrodine, gyrodine, gyrodine, ROT90, "Crux", "Buzzard", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, sonofphx, 0, sonofphx, sonofphx, 0, ROT90, "Associated Overseas MFR, Inc", "Son of Phoenix", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, repulse, sonofphx, sonofphx, sonofphx, 0, ROT90, "Sega", "Repulse", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, 99lstwar, sonofphx, sonofphx, sonofphx, 0, ROT90, "Proma", "'99: The Last War", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, 99lstwara, sonofphx, sonofphx, sonofphx, 0, ROT90, "Proma", "'99: The Last War (alternate)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, 99lstwark, sonofphx, sonofphx, sonofphx, 0, ROT90, "Kyugo", "'99: The Last War (Kyugo)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, flashgal, 0, flashgal, flashgal, 0, ROT0, "Sega", "Flashgal (set 1)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, flashgala, flashgal, flashgla, flashgal, 0, ROT0, "Sega", "Flashgal (set 2)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1986, srdmissn, 0, srdmissn, srdmissn, srdmissn, ROT90, "Taito Corporation", "S.R.D. Mission", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1986, fx, srdmissn, srdmissn, srdmissn, srdmissn, ROT90, "bootleg", "F-X", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1986, legend, 0, legend, legend, srdmissn, ROT0, "Sega / Coreland", "Legend", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1987, airwolf, 0, srdmissn, airwolf, srdmissn, ROT0, "Kyugo", "Airwolf", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1987, airwolfa, airwolf, srdmissn, airwolf, srdmissn, ROT0, "Kyugo (UA Theatre license)", "Airwolf (US)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1987, skywolf, airwolf, srdmissn, skywolf, srdmissn, ROT0, "bootleg", "Sky Wolf (set 1)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1987, skywolf2, airwolf, srdmissn, airwolf, srdmissn, ROT0, "bootleg", "Sky Wolf (set 2)", GAME_SUPPORTS_SAVE )
|
||||
|
@ -6,9 +6,23 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
/*----------- defined in video/kangaroo.c -----------*/
|
||||
typedef struct _kangaroo_state kangaroo_state;
|
||||
struct _kangaroo_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * video_control;
|
||||
|
||||
extern UINT8 *kangaroo_video_control;
|
||||
/* video-related */
|
||||
UINT32 *videoram;
|
||||
|
||||
/* misc */
|
||||
UINT8 clock;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------- defined in video/kangaroo.c -----------*/
|
||||
|
||||
VIDEO_START( kangaroo );
|
||||
VIDEO_UPDATE( kangaroo );
|
||||
|
53
src/mame/includes/karnov.h
Normal file
53
src/mame/includes/karnov.h
Normal file
@ -0,0 +1,53 @@
|
||||
/*************************************************************************
|
||||
|
||||
Karnov - Wonder Planet - Chelnov
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _karnov_state karnov_state;
|
||||
struct _karnov_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT16 * videoram;
|
||||
UINT16 * ram;
|
||||
UINT16 * pf_data;
|
||||
// UINT16 * spriteram; // currently this uses generic buffered spriteram
|
||||
|
||||
/* video-related */
|
||||
bitmap_t *bitmap_f;
|
||||
tilemap *fix_tilemap;
|
||||
int flipscreen;
|
||||
UINT16 scroll[2];
|
||||
|
||||
/* misc */
|
||||
UINT16 i8751_return, i8751_needs_ack, i8751_coin_pending, i8751_command_queue;
|
||||
int i8751_level; // needed by chelnov
|
||||
int microcontroller_id, coin_mask;
|
||||
int latch;
|
||||
|
||||
/* devices */
|
||||
const device_config *maincpu;
|
||||
const device_config *audiocpu;
|
||||
};
|
||||
|
||||
enum {
|
||||
KARNOV = 0,
|
||||
KARNOVJ,
|
||||
CHELNOV,
|
||||
CHELNOVJ,
|
||||
CHELNOVW,
|
||||
WNDRPLNT
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/karnov.c -----------*/
|
||||
|
||||
WRITE16_HANDLER( karnov_playfield_swap_w );
|
||||
WRITE16_HANDLER( karnov_videoram_w );
|
||||
|
||||
void karnov_flipscreen_w(running_machine *machine, int data);
|
||||
|
||||
PALETTE_INIT( karnov );
|
||||
VIDEO_START( karnov );
|
||||
VIDEO_START( wndrplnt );
|
||||
VIDEO_UPDATE( karnov );
|
40
src/mame/includes/kchamp.h
Normal file
40
src/mame/includes/kchamp.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*************************************************************************
|
||||
|
||||
Karate Champ
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _kchamp_state kchamp_state;
|
||||
struct _kchamp_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
UINT8 * colorram;
|
||||
UINT8 * spriteram;
|
||||
size_t spriteram_size;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap;
|
||||
|
||||
/* misc */
|
||||
int nmi_enable;
|
||||
int sound_nmi_enable;
|
||||
int msm_data;
|
||||
int msm_play_lo_nibble;
|
||||
int counter;
|
||||
|
||||
/* devices */
|
||||
const device_config *audiocpu;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/kchamp.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( kchamp_videoram_w );
|
||||
WRITE8_HANDLER( kchamp_colorram_w );
|
||||
WRITE8_HANDLER( kchamp_flipscreen_w );
|
||||
|
||||
PALETTE_INIT( kchamp );
|
||||
VIDEO_START( kchamp );
|
||||
VIDEO_UPDATE( kchamp );
|
||||
VIDEO_UPDATE( kchampvs );
|
44
src/mame/includes/kickgoal.h
Normal file
44
src/mame/includes/kickgoal.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*************************************************************************
|
||||
|
||||
Kick Goal - Action Hollywood
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _kickgoal_state kickgoal_state;
|
||||
struct _kickgoal_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT16 * fgram;
|
||||
UINT16 * bgram;
|
||||
UINT16 * bg2ram;
|
||||
UINT16 * scrram;
|
||||
UINT16 * spriteram;
|
||||
// UINT16 * paletteram; // currently this uses generic palette handling
|
||||
size_t spriteram_size;
|
||||
|
||||
/* video-related */
|
||||
tilemap *fgtm, *bgtm, *bg2tm;
|
||||
|
||||
/* misc */
|
||||
int melody_loop;
|
||||
int snd_new, snd_sam[4];
|
||||
int m6295_comm, m6295_bank;
|
||||
UINT16 m6295_key_delay;
|
||||
|
||||
/* devices */
|
||||
const device_config *adpcm;
|
||||
const device_config *eeprom;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/kickgoal.c -----------*/
|
||||
|
||||
WRITE16_HANDLER( kickgoal_fgram_w );
|
||||
WRITE16_HANDLER( kickgoal_bgram_w );
|
||||
WRITE16_HANDLER( kickgoal_bg2ram_w );
|
||||
|
||||
VIDEO_START( kickgoal );
|
||||
VIDEO_UPDATE( kickgoal );
|
||||
|
||||
VIDEO_START( actionhw );
|
||||
VIDEO_UPDATE( actionhw );
|
47
src/mame/includes/kingobox.h
Normal file
47
src/mame/includes/kingobox.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*************************************************************************
|
||||
|
||||
King of Boxer - Ring King
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _kingofb_state kingofb_state;
|
||||
struct _kingofb_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
UINT8 * videoram2;
|
||||
UINT8 * colorram;
|
||||
UINT8 * colorram2;
|
||||
UINT8 * spriteram;
|
||||
UINT8 * scroll_y;
|
||||
size_t spriteram_size;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap, *fg_tilemap;
|
||||
int palette_bank;
|
||||
|
||||
/* misc */
|
||||
int nmi_enable;
|
||||
|
||||
/* devices */
|
||||
const device_config *video_cpu;
|
||||
const device_config *sprite_cpu;
|
||||
const device_config *audio_cpu;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/kingobox.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( kingofb_videoram_w );
|
||||
WRITE8_HANDLER( kingofb_colorram_w );
|
||||
WRITE8_HANDLER( kingofb_videoram2_w );
|
||||
WRITE8_HANDLER( kingofb_colorram2_w );
|
||||
WRITE8_HANDLER( kingofb_f800_w );
|
||||
|
||||
PALETTE_INIT( kingofb );
|
||||
VIDEO_START( kingofb );
|
||||
VIDEO_UPDATE( kingofb );
|
||||
|
||||
PALETTE_INIT( ringking );
|
||||
VIDEO_START( ringking );
|
||||
VIDEO_UPDATE( ringking );
|
38
src/mame/includes/kncljoe.h
Normal file
38
src/mame/includes/kncljoe.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*************************************************************************
|
||||
|
||||
Knuckle Joe
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _kncljoe_state kncljoe_state;
|
||||
struct _kncljoe_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
UINT8 * spriteram;
|
||||
UINT8 * scrollregs;
|
||||
size_t spriteram_size;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap;
|
||||
int tile_bank, sprite_bank;
|
||||
int flipscreen;
|
||||
|
||||
/* misc */
|
||||
UINT8 port1, port2;
|
||||
|
||||
/* devices */
|
||||
const device_config *soundcpu;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*----------- defined in video/kncljoe.c -----------*/
|
||||
|
||||
WRITE8_HANDLER(kncljoe_videoram_w);
|
||||
WRITE8_HANDLER(kncljoe_control_w);
|
||||
WRITE8_HANDLER(kncljoe_scroll_w);
|
||||
|
||||
PALETTE_INIT( kncljoe );
|
||||
VIDEO_START( kncljoe );
|
||||
VIDEO_UPDATE( kncljoe );
|
35
src/mame/includes/kopunch.h
Normal file
35
src/mame/includes/kopunch.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*************************************************************************
|
||||
|
||||
KO Punch
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _kopunch_state kopunch_state;
|
||||
struct _kopunch_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
UINT8 * videoram2;
|
||||
UINT8 * colorram;
|
||||
UINT8 * spriteram;
|
||||
size_t spriteram_size;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap, *fg_tilemap;
|
||||
int gfxbank;
|
||||
|
||||
/* devices */
|
||||
const device_config *maincpu;
|
||||
};
|
||||
|
||||
/*----------- defined in video/kopunch.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( kopunch_videoram_w );
|
||||
WRITE8_HANDLER( kopunch_videoram2_w );
|
||||
WRITE8_HANDLER( kopunch_scroll_x_w );
|
||||
WRITE8_HANDLER( kopunch_scroll_y_w );
|
||||
WRITE8_HANDLER( kopunch_gfxbank_w );
|
||||
|
||||
PALETTE_INIT( kopunch );
|
||||
VIDEO_START( kopunch );
|
||||
VIDEO_UPDATE( kopunch );
|
30
src/mame/includes/ksayakyu.h
Normal file
30
src/mame/includes/ksayakyu.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*************************************************************************
|
||||
|
||||
Kusayakyuu
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _ksayakyu_state ksayakyu_state;
|
||||
struct _ksayakyu_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
UINT8 * spriteram;
|
||||
size_t spriteram_size;
|
||||
|
||||
/* video-related */
|
||||
tilemap *tilemap, *textmap;
|
||||
int video_ctrl, flipscreen;
|
||||
|
||||
/* misc */
|
||||
int sound_status;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/ksayakyu.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( ksayakyu_videoram_w );
|
||||
WRITE8_HANDLER( ksayakyu_videoctrl_w );
|
||||
PALETTE_INIT( ksayakyu );
|
||||
VIDEO_START( ksayakyu );
|
||||
VIDEO_UPDATE( ksayakyu );
|
@ -4,13 +4,31 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
/*----------- defined in video/kyugo.c -----------*/
|
||||
typedef struct _kyugo_state kyugo_state;
|
||||
struct _kyugo_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * fgvideoram;
|
||||
UINT8 * bgvideoram;
|
||||
UINT8 * bgattribram;
|
||||
UINT8 * spriteram_1;
|
||||
UINT8 * spriteram_2;
|
||||
UINT8 * shared_ram;
|
||||
|
||||
extern UINT8 *kyugo_fgvideoram;
|
||||
extern UINT8 *kyugo_bgvideoram;
|
||||
extern UINT8 *kyugo_bgattribram;
|
||||
extern UINT8 *kyugo_spriteram_1;
|
||||
extern UINT8 *kyugo_spriteram_2;
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap, *fg_tilemap;
|
||||
UINT8 scroll_x_lo, scroll_x_hi, scroll_y;
|
||||
int bgpalbank, fgcolor;
|
||||
int flipscreen;
|
||||
const UINT8 *color_codes;
|
||||
|
||||
/* devices */
|
||||
const device_config *maincpu;
|
||||
const device_config *subcpu;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/kyugo.c -----------*/
|
||||
|
||||
READ8_HANDLER( kyugo_spriteram_2_r );
|
||||
|
||||
@ -23,5 +41,4 @@ WRITE8_HANDLER( kyugo_scroll_y_w );
|
||||
WRITE8_HANDLER( kyugo_flipscreen_w );
|
||||
|
||||
VIDEO_START( kyugo );
|
||||
|
||||
VIDEO_UPDATE( kyugo );
|
||||
|
@ -5,16 +5,11 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "kangaroo.h"
|
||||
|
||||
|
||||
UINT8 *kangaroo_video_control;
|
||||
|
||||
#include "includes/kangaroo.h"
|
||||
|
||||
static void blitter_execute(running_machine *machine);
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Video setup
|
||||
@ -23,9 +18,11 @@ static void blitter_execute(running_machine *machine);
|
||||
|
||||
VIDEO_START( kangaroo )
|
||||
{
|
||||
kangaroo_state *state = (kangaroo_state *)machine->driver_data;
|
||||
|
||||
/* video RAM is accessed 32 bits at a time (two planes, 4bpp each, 4 pixels) */
|
||||
machine->generic.videoram.u32 = auto_alloc_array(machine, UINT32, 256 * 64);
|
||||
state_save_register_global_pointer(machine, machine->generic.videoram.u32, 256 * 64);
|
||||
state->videoram = auto_alloc_array(machine, UINT32, 256 * 64);
|
||||
state_save_register_global_pointer(machine, state->videoram, 256 * 64);
|
||||
}
|
||||
|
||||
|
||||
@ -36,8 +33,9 @@ VIDEO_START( kangaroo )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void videoram_write(running_machine *machine, UINT16 offset, UINT8 data, UINT8 mask)
|
||||
static void videoram_write( running_machine *machine, UINT16 offset, UINT8 data, UINT8 mask )
|
||||
{
|
||||
kangaroo_state *state = (kangaroo_state *)machine->driver_data;
|
||||
UINT32 expdata, layermask;
|
||||
|
||||
/* data contains 4 2-bit values packed as DCBADCBA; expand these into 4 8-bit values */
|
||||
@ -59,13 +57,14 @@ static void videoram_write(running_machine *machine, UINT16 offset, UINT8 data,
|
||||
if (mask & 0x01) layermask |= 0x0c0c0c0c;
|
||||
|
||||
/* update layers */
|
||||
machine->generic.videoram.u32[offset] = (machine->generic.videoram.u32[offset] & ~layermask) | (expdata & layermask);
|
||||
state->videoram[offset] = (state->videoram[offset] & ~layermask) | (expdata & layermask);
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( kangaroo_videoram_w )
|
||||
{
|
||||
videoram_write(space->machine, offset, data, kangaroo_video_control[8]);
|
||||
kangaroo_state *state = (kangaroo_state *)space->machine->driver_data;
|
||||
videoram_write(space->machine, offset, data, state->video_control[8]);
|
||||
}
|
||||
|
||||
|
||||
@ -78,7 +77,8 @@ WRITE8_HANDLER( kangaroo_videoram_w )
|
||||
|
||||
WRITE8_HANDLER( kangaroo_video_control_w )
|
||||
{
|
||||
kangaroo_video_control[offset] = data;
|
||||
kangaroo_state *state = (kangaroo_state *)space->machine->driver_data;
|
||||
state->video_control[offset] = data;
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
@ -100,15 +100,16 @@ WRITE8_HANDLER( kangaroo_video_control_w )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void blitter_execute(running_machine *machine)
|
||||
static void blitter_execute( running_machine *machine )
|
||||
{
|
||||
kangaroo_state *state = (kangaroo_state *)machine->driver_data;
|
||||
UINT32 gfxhalfsize = memory_region_length(machine, "gfx1") / 2;
|
||||
const UINT8 *gfxbase = memory_region(machine, "gfx1");
|
||||
UINT16 src = kangaroo_video_control[0] + 256 * kangaroo_video_control[1];
|
||||
UINT16 dst = kangaroo_video_control[2] + 256 * kangaroo_video_control[3];
|
||||
UINT8 height = kangaroo_video_control[5];
|
||||
UINT8 width = kangaroo_video_control[4];
|
||||
UINT8 mask = kangaroo_video_control[8];
|
||||
UINT16 src = state->video_control[0] + 256 * state->video_control[1];
|
||||
UINT16 dst = state->video_control[2] + 256 * state->video_control[3];
|
||||
UINT8 height = state->video_control[5];
|
||||
UINT8 width = state->video_control[4];
|
||||
UINT8 mask = state->video_control[8];
|
||||
int x, y;
|
||||
|
||||
/* during DMA operations, the top 2 bits are ORed together, as well as the bottom 2 bits */
|
||||
@ -122,8 +123,8 @@ static void blitter_execute(running_machine *machine)
|
||||
{
|
||||
UINT16 effdst = (dst + x) & 0x3fff;
|
||||
UINT16 effsrc = src++ & (gfxhalfsize - 1);
|
||||
videoram_write(machine, effdst, gfxbase[0*gfxhalfsize + effsrc], mask & 0x05);
|
||||
videoram_write(machine, effdst, gfxbase[1*gfxhalfsize + effsrc], mask & 0x0a);
|
||||
videoram_write(machine, effdst, gfxbase[0 * gfxhalfsize + effsrc], mask & 0x05);
|
||||
videoram_write(machine, effdst, gfxbase[1 * gfxhalfsize + effsrc], mask & 0x0a);
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,16 +138,17 @@ static void blitter_execute(running_machine *machine)
|
||||
|
||||
VIDEO_UPDATE( kangaroo )
|
||||
{
|
||||
UINT8 scrolly = kangaroo_video_control[6];
|
||||
UINT8 scrollx = kangaroo_video_control[7];
|
||||
UINT8 maska = (kangaroo_video_control[10] & 0x28) >> 3;
|
||||
UINT8 maskb = (kangaroo_video_control[10] & 0x07) >> 0;
|
||||
UINT8 xora = (kangaroo_video_control[9] & 0x20) ? 0xff : 0x00;
|
||||
UINT8 xorb = (kangaroo_video_control[9] & 0x10) ? 0xff : 0x00;
|
||||
UINT8 enaa = (kangaroo_video_control[9] & 0x08);
|
||||
UINT8 enab = (kangaroo_video_control[9] & 0x04);
|
||||
UINT8 pria = (~kangaroo_video_control[9] & 0x02);
|
||||
UINT8 prib = (~kangaroo_video_control[9] & 0x01);
|
||||
kangaroo_state *state = (kangaroo_state *)screen->machine->driver_data;
|
||||
UINT8 scrolly = state->video_control[6];
|
||||
UINT8 scrollx = state->video_control[7];
|
||||
UINT8 maska = (state->video_control[10] & 0x28) >> 3;
|
||||
UINT8 maskb = (state->video_control[10] & 0x07) >> 0;
|
||||
UINT8 xora = (state->video_control[9] & 0x20) ? 0xff : 0x00;
|
||||
UINT8 xorb = (state->video_control[9] & 0x10) ? 0xff : 0x00;
|
||||
UINT8 enaa = (state->video_control[9] & 0x08);
|
||||
UINT8 enab = (state->video_control[9] & 0x04);
|
||||
UINT8 pria = (~state->video_control[9] & 0x02);
|
||||
UINT8 prib = (~state->video_control[9] & 0x01);
|
||||
rgb_t pens[8];
|
||||
int x, y;
|
||||
|
||||
@ -165,8 +167,8 @@ VIDEO_UPDATE( kangaroo )
|
||||
UINT8 effya = scrolly + (y ^ xora);
|
||||
UINT8 effxb = (x / 2) ^ xorb;
|
||||
UINT8 effyb = y ^ xorb;
|
||||
UINT8 pixa = (screen->machine->generic.videoram.u32[effya + 256 * (effxa / 4)] >> (8 * (effxa % 4) + 0)) & 0x0f;
|
||||
UINT8 pixb = (screen->machine->generic.videoram.u32[effyb + 256 * (effxb / 4)] >> (8 * (effxb % 4) + 4)) & 0x0f;
|
||||
UINT8 pixa = (state->videoram[effya + 256 * (effxa / 4)] >> (8 * (effxa % 4) + 0)) & 0x0f;
|
||||
UINT8 pixb = (state->videoram[effyb + 256 * (effxb / 4)] >> (8 * (effxb % 4) + 4)) & 0x0f;
|
||||
UINT8 finalpens;
|
||||
|
||||
/* for each layer, contribute bits if (a) enabled, and (b) either has priority or the opposite plane is 0 */
|
||||
|
@ -5,11 +5,7 @@
|
||||
*******************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
|
||||
static bitmap_t *bitmap_f;
|
||||
UINT16 karnov_scroll[2], *karnov_pf_data;
|
||||
static tilemap *fix_tilemap;
|
||||
static int flipscreen;
|
||||
#include "includes/karnov.h"
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -38,13 +34,14 @@ static int flipscreen;
|
||||
bit 0 -- 2.2kohm resistor -- BLUE
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
PALETTE_INIT( karnov )
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0;i < machine->config->total_colors;i++)
|
||||
for (i = 0; i < machine->config->total_colors; i++)
|
||||
{
|
||||
int bit0,bit1,bit2,bit3,r,g,b;
|
||||
int bit0, bit1, bit2, bit3, r, g, b;
|
||||
|
||||
bit0 = (color_prom[0] >> 0) & 0x01;
|
||||
bit1 = (color_prom[0] >> 1) & 0x01;
|
||||
@ -62,94 +59,117 @@ PALETTE_INIT( karnov )
|
||||
bit3 = (color_prom[machine->config->total_colors] >> 3) & 0x01;
|
||||
b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
|
||||
|
||||
palette_set_color(machine,i,MAKE_RGB(r,g,b));
|
||||
palette_set_color(machine, i, MAKE_RGB(r, g, b));
|
||||
color_prom++;
|
||||
}
|
||||
}
|
||||
|
||||
void karnov_flipscreen_w(running_machine *machine, int data)
|
||||
void karnov_flipscreen_w( running_machine *machine, int data )
|
||||
{
|
||||
flipscreen=data;
|
||||
tilemap_set_flip_all(machine,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
karnov_state *state = (karnov_state *)machine->driver_data;
|
||||
state->flipscreen = data;
|
||||
tilemap_set_flip_all(machine, state->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
}
|
||||
|
||||
static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
static void draw_background( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
int my,mx,offs,color,tile,fx,fy;
|
||||
int scrollx=karnov_scroll[0];
|
||||
int scrolly=karnov_scroll[1];
|
||||
karnov_state *state = (karnov_state *)machine->driver_data;
|
||||
int my, mx, offs, color, tile, fx, fy;
|
||||
int scrollx = state->scroll[0];
|
||||
int scrolly = state->scroll[1];
|
||||
|
||||
if (flipscreen) fx=fy=1; else fx=fy=0;
|
||||
if (state->flipscreen)
|
||||
fx = fy = 1;
|
||||
else
|
||||
fx = fy = 0;
|
||||
|
||||
mx=-1; my=0;
|
||||
for (offs = 0;offs < 0x400; offs ++) {
|
||||
mx = -1;
|
||||
my = 0;
|
||||
|
||||
for (offs = 0; offs < 0x400; offs ++)
|
||||
{
|
||||
mx++;
|
||||
if (mx==32) {mx=0; my++;}
|
||||
if (mx == 32)
|
||||
{
|
||||
mx=0;
|
||||
my++;
|
||||
}
|
||||
|
||||
tile=karnov_pf_data[offs];
|
||||
tile = state->pf_data[offs];
|
||||
color = tile >> 12;
|
||||
tile = tile&0x7ff;
|
||||
if (flipscreen)
|
||||
drawgfx_opaque(bitmap_f,0,machine->gfx[1],tile,
|
||||
tile = tile & 0x7ff;
|
||||
if (state->flipscreen)
|
||||
drawgfx_opaque(state->bitmap_f, 0, machine->gfx[1],tile,
|
||||
color, fx, fy, 496-16*mx,496-16*my);
|
||||
else
|
||||
drawgfx_opaque(bitmap_f,0,machine->gfx[1],tile,
|
||||
drawgfx_opaque(state->bitmap_f, 0, machine->gfx[1],tile,
|
||||
color, fx, fy, 16*mx,16*my);
|
||||
}
|
||||
|
||||
if (!flipscreen) {
|
||||
scrolly=-scrolly;
|
||||
scrollx=-scrollx;
|
||||
} else {
|
||||
scrolly=scrolly+256;
|
||||
scrollx=scrollx+256;
|
||||
if (!state->flipscreen)
|
||||
{
|
||||
scrolly = -scrolly;
|
||||
scrollx = -scrollx;
|
||||
}
|
||||
else
|
||||
{
|
||||
scrolly = scrolly + 256;
|
||||
scrollx = scrollx + 256;
|
||||
}
|
||||
copyscrollbitmap(bitmap,bitmap_f,1,&scrollx,1,&scrolly,cliprect);
|
||||
|
||||
copyscrollbitmap(bitmap, state->bitmap_f, 1, &scrollx, 1, &scrolly, cliprect);
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
karnov_state *state = (karnov_state *)machine->driver_data;
|
||||
UINT16 *buffered_spriteram16 = machine->generic.buffered_spriteram.u16;
|
||||
int offs;
|
||||
|
||||
for (offs = 0;offs <0x800;offs += 4) {
|
||||
int x,y,sprite,sprite2,colour,fx,fy,extra;
|
||||
for (offs = 0; offs <0x800; offs += 4)
|
||||
{
|
||||
int x, y, sprite, sprite2, colour, fx, fy, extra;
|
||||
|
||||
y=buffered_spriteram16[offs];
|
||||
if (!(y&0x8000)) continue;
|
||||
y = buffered_spriteram16[offs];
|
||||
if (!(y & 0x8000))
|
||||
continue;
|
||||
|
||||
y=y&0x1ff;
|
||||
sprite=buffered_spriteram16[offs+3];
|
||||
colour=sprite>>12;
|
||||
sprite=sprite&0xfff;
|
||||
x=buffered_spriteram16[offs+2]&0x1ff;
|
||||
y = y & 0x1ff;
|
||||
sprite = buffered_spriteram16[offs + 3];
|
||||
colour = sprite >> 12;
|
||||
sprite = sprite & 0xfff;
|
||||
x = buffered_spriteram16[offs + 2] & 0x1ff;
|
||||
|
||||
fx=buffered_spriteram16[offs+1];
|
||||
if ((fx&0x10)) extra=1; else extra=0;
|
||||
fy=fx&0x2;
|
||||
fx=fx&0x4;
|
||||
fx = buffered_spriteram16[offs + 1];
|
||||
extra = (fx & 0x10) ? 1 : 0;
|
||||
fy = fx & 0x2;
|
||||
fx = fx & 0x4;
|
||||
|
||||
if (extra) y=y+16;
|
||||
if (extra)
|
||||
y = y + 16;
|
||||
|
||||
/* Convert the co-ords..*/
|
||||
x=(x+16)%0x200;
|
||||
y=(y+16)%0x200;
|
||||
x=256 - x;
|
||||
y=256 - y;
|
||||
if (flipscreen) {
|
||||
y=240-y;
|
||||
x=240-x;
|
||||
if (fx) fx=0; else fx=1;
|
||||
if (fy) fy=0; else fy=1;
|
||||
if (extra) y=y-16;
|
||||
/* Convert the co-ords..*/
|
||||
x = (x + 16) % 0x200;
|
||||
y = (y + 16) % 0x200;
|
||||
x = 256 - x;
|
||||
y = 256 - y;
|
||||
if (state->flipscreen)
|
||||
{
|
||||
y = 240 - y;
|
||||
x = 240 - x;
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
if (extra) y = y - 16;
|
||||
}
|
||||
|
||||
/* Y Flip determines order of multi-sprite */
|
||||
if (extra && fy) {
|
||||
sprite2=sprite;
|
||||
if (extra && fy)
|
||||
{
|
||||
sprite2 = sprite;
|
||||
sprite++;
|
||||
}
|
||||
else sprite2=sprite+1;
|
||||
else
|
||||
sprite2 = sprite + 1;
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
|
||||
sprite,
|
||||
@ -167,9 +187,10 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
|
||||
|
||||
VIDEO_UPDATE( karnov )
|
||||
{
|
||||
draw_background(screen->machine,bitmap,cliprect);
|
||||
draw_sprites(screen->machine,bitmap,cliprect);
|
||||
tilemap_draw(bitmap,cliprect,fix_tilemap,0,0);
|
||||
karnov_state *state = (karnov_state *)screen->machine->driver_data;
|
||||
draw_background(screen->machine, bitmap, cliprect);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
tilemap_draw(bitmap, cliprect, state->fix_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -177,7 +198,8 @@ VIDEO_UPDATE( karnov )
|
||||
|
||||
static TILE_GET_INFO( get_fix_tile_info )
|
||||
{
|
||||
int tile=machine->generic.videoram.u16[tile_index];
|
||||
karnov_state *state = (karnov_state *)machine->driver_data;
|
||||
int tile = state->videoram[tile_index];
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
tile&0xfff,
|
||||
@ -187,36 +209,44 @@ static TILE_GET_INFO( get_fix_tile_info )
|
||||
|
||||
WRITE16_HANDLER( karnov_videoram_w )
|
||||
{
|
||||
COMBINE_DATA(&space->machine->generic.videoram.u16[offset]);
|
||||
tilemap_mark_tile_dirty(fix_tilemap,offset);
|
||||
karnov_state *state = (karnov_state *)space->machine->driver_data;
|
||||
COMBINE_DATA(&state->videoram[offset]);
|
||||
tilemap_mark_tile_dirty(state->fix_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( karnov_playfield_swap_w )
|
||||
{
|
||||
karnov_state *state = (karnov_state *)space->machine->driver_data;
|
||||
offset = ((offset & 0x1f) << 5) | ((offset & 0x3e0) >> 5);
|
||||
COMBINE_DATA(&karnov_pf_data[offset]);
|
||||
COMBINE_DATA(&state->pf_data[offset]);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
VIDEO_START( karnov )
|
||||
{
|
||||
/* Allocate bitmaps */
|
||||
bitmap_f = auto_bitmap_alloc(machine,512,512,video_screen_get_format(machine->primary_screen));
|
||||
karnov_state *state = (karnov_state *)machine->driver_data;
|
||||
|
||||
fix_tilemap=tilemap_create(machine, get_fix_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
/* Allocate bitmap & tilemap */
|
||||
state->bitmap_f = auto_bitmap_alloc(machine, 512, 512, video_screen_get_format(machine->primary_screen));
|
||||
state->fix_tilemap = tilemap_create(machine, get_fix_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
|
||||
tilemap_set_transparent_pen(fix_tilemap,0);
|
||||
state_save_register_global_bitmap(machine, state->bitmap_f);
|
||||
|
||||
tilemap_set_transparent_pen(state->fix_tilemap, 0);
|
||||
}
|
||||
|
||||
VIDEO_START( wndrplnt )
|
||||
{
|
||||
/* Allocate bitmaps */
|
||||
bitmap_f = auto_bitmap_alloc(machine,512,512,video_screen_get_format(machine->primary_screen));
|
||||
karnov_state *state = (karnov_state *)machine->driver_data;
|
||||
|
||||
fix_tilemap=tilemap_create(machine, get_fix_tile_info,tilemap_scan_cols,8,8,32,32);
|
||||
/* Allocate bitmap & tilemap */
|
||||
state->bitmap_f = auto_bitmap_alloc(machine, 512, 512, video_screen_get_format(machine->primary_screen));
|
||||
state->fix_tilemap = tilemap_create(machine, get_fix_tile_info, tilemap_scan_cols, 8, 8, 32, 32);
|
||||
|
||||
tilemap_set_transparent_pen(fix_tilemap,0);
|
||||
state_save_register_global_bitmap(machine, state->bitmap_f);
|
||||
|
||||
tilemap_set_transparent_pen(state->fix_tilemap, 0);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -7,33 +7,35 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "includes/kchamp.h"
|
||||
|
||||
static tilemap *bg_tilemap;
|
||||
|
||||
PALETTE_INIT( kchamp )
|
||||
{
|
||||
int i, red, green, blue;
|
||||
|
||||
for (i = 0;i < machine->config->total_colors;i++)
|
||||
for (i = 0; i < machine->config->total_colors; i++)
|
||||
{
|
||||
red = color_prom[i];
|
||||
green = color_prom[machine->config->total_colors+i];
|
||||
blue = color_prom[2*machine->config->total_colors+i];
|
||||
green = color_prom[machine->config->total_colors + i];
|
||||
blue = color_prom[2 * machine->config->total_colors + i];
|
||||
|
||||
palette_set_color_rgb(machine,i,pal4bit(red),pal4bit(green),pal4bit(blue));
|
||||
palette_set_color_rgb(machine, i, pal4bit(red), pal4bit(green), pal4bit(blue));
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( kchamp_videoram_w )
|
||||
{
|
||||
space->machine->generic.videoram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
kchamp_state *state = (kchamp_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( kchamp_colorram_w )
|
||||
{
|
||||
space->machine->generic.colorram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
kchamp_state *state = (kchamp_state *)space->machine->driver_data;
|
||||
state->colorram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( kchamp_flipscreen_w )
|
||||
@ -43,43 +45,45 @@ WRITE8_HANDLER( kchamp_flipscreen_w )
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
int code = machine->generic.videoram.u8[tile_index] + ((machine->generic.colorram.u8[tile_index] & 7) << 8);
|
||||
int color = (machine->generic.colorram.u8[tile_index] >> 3) & 0x1f;
|
||||
kchamp_state *state = (kchamp_state *)machine->driver_data;
|
||||
int code = state->videoram[tile_index] + ((state->colorram[tile_index] & 7) << 8);
|
||||
int color = (state->colorram[tile_index] >> 3) & 0x1f;
|
||||
|
||||
SET_TILE_INFO(0, code, color, 0);
|
||||
}
|
||||
|
||||
VIDEO_START( kchamp )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
|
||||
8, 8, 32, 32);
|
||||
kchamp_state *state = (kchamp_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
}
|
||||
|
||||
/*
|
||||
Sprites
|
||||
-------
|
||||
Offset Encoding
|
||||
0 YYYYYYYY
|
||||
1 TTTTTTTT
|
||||
2 FGGTCCCC
|
||||
3 XXXXXXXX
|
||||
Offset Encoding
|
||||
0 YYYYYYYY
|
||||
1 TTTTTTTT
|
||||
2 FGGTCCCC
|
||||
3 XXXXXXXX
|
||||
*/
|
||||
|
||||
static void kchamp_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
static void kchamp_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
UINT8 *spriteram = machine->generic.spriteram.u8;
|
||||
kchamp_state *state = (kchamp_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = 0; offs < 0x100; offs += 4)
|
||||
for (offs = 0; offs < 0x100; offs += 4)
|
||||
{
|
||||
int attr = spriteram[offs + 2];
|
||||
int bank = 1 + ((attr & 0x60) >> 5);
|
||||
int code = spriteram[offs + 1] + ((attr & 0x10) << 4);
|
||||
int color = attr & 0x0f;
|
||||
int bank = 1 + ((attr & 0x60) >> 5);
|
||||
int code = spriteram[offs + 1] + ((attr & 0x10) << 4);
|
||||
int color = attr & 0x0f;
|
||||
int flipx = 0;
|
||||
int flipy = attr & 0x80;
|
||||
int sx = spriteram[offs + 3] - 8;
|
||||
int sy = 247 - spriteram[offs];
|
||||
int flipy = attr & 0x80;
|
||||
int sx = spriteram[offs + 3] - 8;
|
||||
int sy = 247 - spriteram[offs];
|
||||
|
||||
if (flip_screen_get(machine))
|
||||
{
|
||||
@ -89,25 +93,26 @@ static void kchamp_draw_sprites(running_machine *machine, bitmap_t *bitmap, cons
|
||||
flipy = !flipy;
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap, cliprect, machine->gfx[bank], code, color, flipx, flipy, sx, sy, 0);
|
||||
drawgfx_transpen(bitmap, cliprect, machine->gfx[bank], code, color, flipx, flipy, sx, sy, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void kchampvs_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
static void kchampvs_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
UINT8 *spriteram = machine->generic.spriteram.u8;
|
||||
kchamp_state *state = (kchamp_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = 0; offs < 0x100; offs += 4)
|
||||
for (offs = 0; offs < 0x100; offs += 4)
|
||||
{
|
||||
int attr = spriteram[offs + 2];
|
||||
int bank = 1 + ((attr & 0x60) >> 5);
|
||||
int code = spriteram[offs + 1] + ((attr & 0x10) << 4);
|
||||
int color = attr & 0x0f;
|
||||
int bank = 1 + ((attr & 0x60) >> 5);
|
||||
int code = spriteram[offs + 1] + ((attr & 0x10) << 4);
|
||||
int color = attr & 0x0f;
|
||||
int flipx = 0;
|
||||
int flipy = attr & 0x80;
|
||||
int sx = spriteram[offs + 3];
|
||||
int sy = 240 - spriteram[offs];
|
||||
int flipy = attr & 0x80;
|
||||
int sx = spriteram[offs + 3];
|
||||
int sy = 240 - spriteram[offs];
|
||||
|
||||
if (flip_screen_get(machine))
|
||||
{
|
||||
@ -117,21 +122,25 @@ static void kchampvs_draw_sprites(running_machine *machine, bitmap_t *bitmap, co
|
||||
flipy = !flipy;
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap, cliprect, machine->gfx[bank], code, color, flipx, flipy, sx, sy, 0);
|
||||
drawgfx_transpen(bitmap, cliprect, machine->gfx[bank], code, color, flipx, flipy, sx, sy, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VIDEO_UPDATE( kchamp )
|
||||
{
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
kchamp_state *state = (kchamp_state *)screen->machine->driver_data;
|
||||
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
kchamp_draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( kchampvs )
|
||||
{
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
kchamp_state *state = (kchamp_state *)screen->machine->driver_data;
|
||||
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
kchampvs_draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,108 +1,117 @@
|
||||
/* Kick Goal - video */
|
||||
|
||||
#include "driver.h"
|
||||
#include "includes/kickgoal.h"
|
||||
|
||||
|
||||
WRITE16_HANDLER( kickgoal_fgram_w )
|
||||
{
|
||||
kickgoal_state *state = (kickgoal_state *)space->machine->driver_data;
|
||||
state->fgram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->fgtm, offset / 2);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( kickgoal_bgram_w )
|
||||
{
|
||||
kickgoal_state *state = (kickgoal_state *)space->machine->driver_data;
|
||||
state->bgram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bgtm, offset / 2);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( kickgoal_bg2ram_w )
|
||||
{
|
||||
kickgoal_state *state = (kickgoal_state *)space->machine->driver_data;
|
||||
state->bg2ram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg2tm, offset / 2);
|
||||
}
|
||||
|
||||
|
||||
extern UINT16 *kickgoal_fgram, *kickgoal_bgram, *kickgoal_bg2ram, *kickgoal_scrram;
|
||||
static tilemap *kickgoal_fgtm, *kickgoal_bgtm, *kickgoal_bg2tm;
|
||||
|
||||
/* FG */
|
||||
static TILE_GET_INFO( get_kickgoal_fg_tile_info )
|
||||
{
|
||||
int tileno = kickgoal_fgram[tile_index*2] & 0x0fff;
|
||||
int color = kickgoal_fgram[tile_index*2+1] & 0x000f;
|
||||
kickgoal_state *state = (kickgoal_state *)machine->driver_data;
|
||||
int tileno = state->fgram[tile_index * 2] & 0x0fff;
|
||||
int color = state->fgram[tile_index * 2 + 1] & 0x000f;
|
||||
|
||||
SET_TILE_INFO(0,tileno + 0x7000,color + 0x00,0);
|
||||
SET_TILE_INFO(0, tileno + 0x7000, color + 0x00, 0);
|
||||
}
|
||||
|
||||
/* BG */
|
||||
static TILE_GET_INFO( get_kickgoal_bg_tile_info )
|
||||
{
|
||||
int tileno = kickgoal_bgram[tile_index*2] & 0x0fff;
|
||||
int color = kickgoal_bgram[tile_index*2+1] & 0x000f;
|
||||
kickgoal_state *state = (kickgoal_state *)machine->driver_data;
|
||||
int tileno = state->bgram[tile_index * 2] & 0x0fff;
|
||||
int color = state->bgram[tile_index * 2 + 1] & 0x000f;
|
||||
|
||||
SET_TILE_INFO(1,tileno + 0x1000,color + 0x10,0);
|
||||
SET_TILE_INFO(1, tileno + 0x1000, color + 0x10, 0);
|
||||
}
|
||||
|
||||
/* BG 2 */
|
||||
static TILE_GET_INFO( get_kickgoal_bg2_tile_info )
|
||||
{
|
||||
int tileno = kickgoal_bg2ram[tile_index*2] & 0x07ff;
|
||||
int color = kickgoal_bg2ram[tile_index*2+1] & 0x000f;
|
||||
int flipx = kickgoal_bg2ram[tile_index*2+1] & 0x0020;
|
||||
kickgoal_state *state = (kickgoal_state *)machine->driver_data;
|
||||
int tileno = state->bg2ram[tile_index * 2] & 0x07ff;
|
||||
int color = state->bg2ram[tile_index * 2 + 1] & 0x000f;
|
||||
int flipx = state->bg2ram[tile_index * 2 + 1] & 0x0020;
|
||||
|
||||
SET_TILE_INFO(2,tileno + 0x800,color + 0x20,flipx ? TILE_FLIPX : 0);
|
||||
SET_TILE_INFO(2, tileno + 0x800, color + 0x20, flipx ? TILE_FLIPX : 0);
|
||||
}
|
||||
|
||||
|
||||
static TILEMAP_MAPPER( tilemap_scan_kicksbg2 )
|
||||
{
|
||||
/* logical (col,row) -> memory offset */
|
||||
return col*8 + (row & 0x7) + ((row & 0x3c) >> 3) * 0x200;
|
||||
return col * 8 + (row & 0x7) + ((row & 0x3c) >> 3) * 0x200;
|
||||
}
|
||||
|
||||
static TILEMAP_MAPPER( tilemap_scan_kicksbg )
|
||||
{
|
||||
/* logical (col,row) -> memory offset */
|
||||
return col*16 + (row & 0xf) + ((row & 0x70) >> 4) * 0x400;
|
||||
return col * 16 + (row & 0xf) + ((row & 0x70) >> 4) * 0x400;
|
||||
}
|
||||
|
||||
static TILEMAP_MAPPER( tilemap_scan_kicksfg )
|
||||
{
|
||||
/* logical (col,row) -> memory offset */
|
||||
return col*32 + (row & 0x1f) + ((row & 0x20) >> 5) * 0x800;
|
||||
return col * 32 + (row & 0x1f) + ((row & 0x20) >> 5) * 0x800;
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( kickgoal )
|
||||
{
|
||||
kickgoal_fgtm = tilemap_create(machine, get_kickgoal_fg_tile_info,tilemap_scan_kicksfg, 8, 16,64,64);
|
||||
tilemap_set_transparent_pen(kickgoal_fgtm,15);
|
||||
kickgoal_bgtm = tilemap_create(machine, get_kickgoal_bg_tile_info,tilemap_scan_kicksbg, 16, 32,64,64);
|
||||
tilemap_set_transparent_pen(kickgoal_bgtm,15);
|
||||
kickgoal_bg2tm = tilemap_create(machine, get_kickgoal_bg2_tile_info,tilemap_scan_kicksbg2, 32, 64,64,64);
|
||||
kickgoal_state *state = (kickgoal_state *)machine->driver_data;
|
||||
|
||||
state->fgtm = tilemap_create(machine, get_kickgoal_fg_tile_info, tilemap_scan_kicksfg, 8, 16, 64, 64);
|
||||
state->bgtm = tilemap_create(machine, get_kickgoal_bg_tile_info, tilemap_scan_kicksbg, 16, 32, 64, 64);
|
||||
state->bg2tm = tilemap_create(machine, get_kickgoal_bg2_tile_info, tilemap_scan_kicksbg2, 32, 64, 64, 64);
|
||||
|
||||
tilemap_set_transparent_pen(state->fgtm, 15);
|
||||
tilemap_set_transparent_pen(state->bgtm, 15);
|
||||
}
|
||||
|
||||
|
||||
|
||||
WRITE16_HANDLER( kickgoal_fgram_w )
|
||||
static void kickgoal_draw_sprites( running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect )
|
||||
{
|
||||
kickgoal_fgram[offset] = data;
|
||||
tilemap_mark_tile_dirty(kickgoal_fgtm,offset/2);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( kickgoal_bgram_w )
|
||||
{
|
||||
kickgoal_bgram[offset] = data;
|
||||
tilemap_mark_tile_dirty(kickgoal_bgtm,offset/2);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( kickgoal_bg2ram_w )
|
||||
{
|
||||
kickgoal_bg2ram[offset] = data;
|
||||
tilemap_mark_tile_dirty(kickgoal_bg2tm,offset/2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void kickgoal_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
|
||||
{
|
||||
UINT16 *spriteram16 = machine->generic.spriteram.u16;
|
||||
kickgoal_state *state = (kickgoal_state *)machine->driver_data;
|
||||
UINT16 *spriteram = state->spriteram;
|
||||
const gfx_element *gfx = machine->gfx[1];
|
||||
int offs;
|
||||
|
||||
for (offs = 0;offs < machine->generic.spriteram_size/2;offs += 4)
|
||||
for (offs = 0; offs < state->spriteram_size / 2; offs += 4)
|
||||
{
|
||||
int xpos = spriteram16[offs+3];
|
||||
int ypos = spriteram16[offs+0] & 0x00ff;
|
||||
int tileno = spriteram16[offs+2] & 0x0fff;
|
||||
int flipx = spriteram16[offs+1] & 0x0020;
|
||||
int color = spriteram16[offs+1] & 0x000f;
|
||||
int xpos = spriteram[offs + 3];
|
||||
int ypos = spriteram[offs + 0] & 0x00ff;
|
||||
int tileno = spriteram[offs + 2] & 0x0fff;
|
||||
int flipx = spriteram[offs + 1] & 0x0020;
|
||||
int color = spriteram[offs + 1] & 0x000f;
|
||||
|
||||
if (spriteram16[offs+0] & 0x0100) break;
|
||||
if (spriteram[offs + 0] & 0x0100)
|
||||
break;
|
||||
|
||||
ypos *= 2;
|
||||
|
||||
ypos = 0x200-ypos;
|
||||
ypos = 0x200 - ypos;
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,gfx,
|
||||
tileno,
|
||||
@ -115,32 +124,34 @@ static void kickgoal_draw_sprites(running_machine *machine, bitmap_t *bitmap,con
|
||||
|
||||
VIDEO_UPDATE( kickgoal )
|
||||
{
|
||||
kickgoal_state *state = (kickgoal_state *)screen->machine->driver_data;
|
||||
|
||||
/* set scroll */
|
||||
tilemap_set_scrollx( kickgoal_fgtm, 0, kickgoal_scrram[0] );
|
||||
tilemap_set_scrolly( kickgoal_fgtm, 0, kickgoal_scrram[1]*2 );
|
||||
tilemap_set_scrollx( kickgoal_bgtm, 0, kickgoal_scrram[2] );
|
||||
tilemap_set_scrolly( kickgoal_bgtm, 0, kickgoal_scrram[3]*2 );
|
||||
tilemap_set_scrollx( kickgoal_bg2tm, 0, kickgoal_scrram[4] );
|
||||
tilemap_set_scrolly( kickgoal_bg2tm, 0, kickgoal_scrram[5]*2 );
|
||||
tilemap_set_scrollx(state->fgtm, 0, state->scrram[0]);
|
||||
tilemap_set_scrolly(state->fgtm, 0, state->scrram[1] * 2);
|
||||
tilemap_set_scrollx(state->bgtm, 0, state->scrram[2]);
|
||||
tilemap_set_scrolly(state->bgtm, 0, state->scrram[3] * 2);
|
||||
tilemap_set_scrollx(state->bg2tm, 0, state->scrram[4]);
|
||||
tilemap_set_scrolly(state->bg2tm, 0, state->scrram[5] * 2);
|
||||
|
||||
/* draw */
|
||||
tilemap_draw(bitmap,cliprect,kickgoal_bg2tm,0,0);
|
||||
tilemap_draw(bitmap,cliprect,kickgoal_bgtm,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg2tm, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->bgtm, 0, 0);
|
||||
|
||||
kickgoal_draw_sprites(screen->machine,bitmap,cliprect);
|
||||
kickgoal_draw_sprites(screen->machine, bitmap, cliprect);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,kickgoal_fgtm,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->fgtm, 0, 0);
|
||||
|
||||
/*
|
||||
popmessage ("Regs %04x %04x %04x %04x %04x %04x %04x %04x",
|
||||
kickgoal_scrram[0],
|
||||
kickgoal_scrram[1],
|
||||
kickgoal_scrram[2],
|
||||
kickgoal_scrram[3],
|
||||
kickgoal_scrram[4],
|
||||
kickgoal_scrram[5],
|
||||
kickgoal_scrram[6],
|
||||
kickgoal_scrram[7]);
|
||||
state->scrram[0],
|
||||
state->scrram[1],
|
||||
state->scrram[2],
|
||||
state->scrram[3],
|
||||
state->scrram[4],
|
||||
state->scrram[5],
|
||||
state->scrram[6],
|
||||
state->scrram[7]);
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
@ -150,82 +161,88 @@ VIDEO_UPDATE( kickgoal )
|
||||
/* FG */
|
||||
static TILE_GET_INFO( get_actionhw_fg_tile_info )
|
||||
{
|
||||
int tileno = kickgoal_fgram[tile_index*2] & 0x0fff;
|
||||
int color = kickgoal_fgram[tile_index*2+1] & 0x000f;
|
||||
kickgoal_state *state = (kickgoal_state *)machine->driver_data;
|
||||
int tileno = state->fgram[tile_index * 2] & 0x0fff;
|
||||
int color = state->fgram[tile_index * 2 + 1] & 0x000f;
|
||||
|
||||
SET_TILE_INFO(0,tileno + 0x7000*2,color + 0x00,0);
|
||||
SET_TILE_INFO(0, tileno + 0x7000 * 2, color + 0x00, 0);
|
||||
}
|
||||
|
||||
/* BG */
|
||||
static TILE_GET_INFO( get_actionhw_bg_tile_info )
|
||||
{
|
||||
int tileno = kickgoal_bgram[tile_index*2] & 0x1fff;
|
||||
int color = kickgoal_bgram[tile_index*2+1] & 0x000f;
|
||||
int flipx = kickgoal_bgram[tile_index*2+1] & 0x0020;
|
||||
int flipy = kickgoal_bgram[tile_index*2+1] & 0x0040;
|
||||
kickgoal_state *state = (kickgoal_state *)machine->driver_data;
|
||||
int tileno = state->bgram[tile_index * 2] & 0x1fff;
|
||||
int color = state->bgram[tile_index * 2 + 1] & 0x000f;
|
||||
int flipx = state->bgram[tile_index * 2 + 1] & 0x0020;
|
||||
int flipy = state->bgram[tile_index * 2 + 1] & 0x0040;
|
||||
|
||||
SET_TILE_INFO(1,tileno + 0x0000,color + 0x10,(flipx ? TILE_FLIPX : 0) | (flipy ? TILE_FLIPY : 0));
|
||||
SET_TILE_INFO(1, tileno + 0x0000, color + 0x10, (flipx ? TILE_FLIPX : 0) | (flipy ? TILE_FLIPY : 0));
|
||||
}
|
||||
|
||||
/* BG 2 */
|
||||
static TILE_GET_INFO( get_actionhw_bg2_tile_info )
|
||||
{
|
||||
int tileno = kickgoal_bg2ram[tile_index*2] & 0x1fff;
|
||||
int color = kickgoal_bg2ram[tile_index*2+1] & 0x000f;
|
||||
int flipx = kickgoal_bg2ram[tile_index*2+1] & 0x0020;
|
||||
int flipy = kickgoal_bg2ram[tile_index*2+1] & 0x0040;
|
||||
kickgoal_state *state = (kickgoal_state *)machine->driver_data;
|
||||
int tileno = state->bg2ram[tile_index * 2] & 0x1fff;
|
||||
int color = state->bg2ram[tile_index * 2 + 1] & 0x000f;
|
||||
int flipx = state->bg2ram[tile_index * 2 + 1] & 0x0020;
|
||||
int flipy = state->bg2ram[tile_index * 2 + 1] & 0x0040;
|
||||
|
||||
SET_TILE_INFO(1,tileno + 0x2000,color + 0x20,(flipx ? TILE_FLIPX : 0) | (flipy ? TILE_FLIPY : 0));
|
||||
SET_TILE_INFO(1, tileno + 0x2000, color + 0x20, (flipx ? TILE_FLIPX : 0) | (flipy ? TILE_FLIPY : 0));
|
||||
}
|
||||
|
||||
|
||||
static TILEMAP_MAPPER( tilemap_scan_actionhwbg2 )
|
||||
{
|
||||
/* logical (col,row) -> memory offset */
|
||||
return col*16 + (row & 0xf) + ((row & 0x70) >> 4) * 0x400;
|
||||
return col * 16 + (row & 0xf) + ((row & 0x70) >> 4) * 0x400;
|
||||
}
|
||||
|
||||
static TILEMAP_MAPPER( tilemap_scan_actionhwbg )
|
||||
{
|
||||
/* logical (col,row) -> memory offset */
|
||||
return col*16 + (row & 0xf) + ((row & 0x70) >> 4) * 0x400;
|
||||
return col * 16 + (row & 0xf) + ((row & 0x70) >> 4) * 0x400;
|
||||
}
|
||||
|
||||
static TILEMAP_MAPPER( tilemap_scan_actionhwfg )
|
||||
{
|
||||
/* logical (col,row) -> memory offset */
|
||||
return col*32 + (row & 0x1f) + ((row & 0x20) >> 5) * 0x800;
|
||||
return col * 32 + (row & 0x1f) + ((row & 0x20) >> 5) * 0x800;
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( actionhw )
|
||||
{
|
||||
kickgoal_fgtm = tilemap_create(machine, get_actionhw_fg_tile_info,tilemap_scan_actionhwfg, 8, 8,64,64);
|
||||
kickgoal_bgtm = tilemap_create(machine, get_actionhw_bg_tile_info,tilemap_scan_actionhwbg, 16,16,64,64);
|
||||
kickgoal_bg2tm = tilemap_create(machine, get_actionhw_bg2_tile_info,tilemap_scan_actionhwbg2, 16,16,64,64);
|
||||
kickgoal_state *state = (kickgoal_state *)machine->driver_data;
|
||||
|
||||
tilemap_set_transparent_pen(kickgoal_fgtm,15);
|
||||
tilemap_set_transparent_pen(kickgoal_bgtm,15);
|
||||
state->fgtm = tilemap_create(machine, get_actionhw_fg_tile_info, tilemap_scan_actionhwfg, 8, 8, 64, 64);
|
||||
state->bgtm = tilemap_create(machine, get_actionhw_bg_tile_info, tilemap_scan_actionhwbg, 16, 16, 64, 64);
|
||||
state->bg2tm = tilemap_create(machine, get_actionhw_bg2_tile_info, tilemap_scan_actionhwbg2, 16, 16, 64, 64);
|
||||
|
||||
tilemap_set_transparent_pen(state->fgtm, 15);
|
||||
tilemap_set_transparent_pen(state->bgtm, 15);
|
||||
}
|
||||
|
||||
|
||||
static void actionhw_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
|
||||
{
|
||||
UINT16 *spriteram16 = machine->generic.spriteram.u16;
|
||||
kickgoal_state *state = (kickgoal_state *)machine->driver_data;
|
||||
UINT16 *spriteram = state->spriteram;
|
||||
const gfx_element *gfx = machine->gfx[1];
|
||||
int offs;
|
||||
|
||||
for (offs = 0;offs < machine->generic.spriteram_size/2;offs += 4)
|
||||
for (offs = 0; offs < state->spriteram_size / 2; offs += 4)
|
||||
{
|
||||
int xpos = spriteram16[offs+3];
|
||||
int ypos = spriteram16[offs+0] & 0x00ff;
|
||||
int tileno = spriteram16[offs+2] & 0x3fff;
|
||||
int flipx = spriteram16[offs+1] & 0x0020;
|
||||
int color = spriteram16[offs+1] & 0x000f;
|
||||
int xpos = spriteram[offs + 3];
|
||||
int ypos = spriteram[offs + 0] & 0x00ff;
|
||||
int tileno = spriteram[offs + 2] & 0x3fff;
|
||||
int flipx = spriteram[offs + 1] & 0x0020;
|
||||
int color = spriteram[offs + 1] & 0x000f;
|
||||
|
||||
if (spriteram16[offs+0] & 0x0100) break;
|
||||
if (spriteram[offs + 0] & 0x0100) break;
|
||||
|
||||
ypos = 0x110-ypos;
|
||||
ypos = 0x110 - ypos;
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,gfx,
|
||||
tileno+0x4000,
|
||||
@ -238,20 +255,21 @@ static void actionhw_draw_sprites(running_machine *machine, bitmap_t *bitmap,con
|
||||
|
||||
VIDEO_UPDATE( actionhw )
|
||||
{
|
||||
kickgoal_state *state = (kickgoal_state *)screen->machine->driver_data;
|
||||
/* set scroll */
|
||||
tilemap_set_scrollx( kickgoal_fgtm, 0, kickgoal_scrram[0] );
|
||||
tilemap_set_scrolly( kickgoal_fgtm, 0, kickgoal_scrram[1] );
|
||||
tilemap_set_scrollx( kickgoal_bgtm, 0, kickgoal_scrram[2] );
|
||||
tilemap_set_scrolly( kickgoal_bgtm, 0, kickgoal_scrram[3] );
|
||||
tilemap_set_scrollx( kickgoal_bg2tm, 0, kickgoal_scrram[4] );
|
||||
tilemap_set_scrolly( kickgoal_bg2tm, 0, kickgoal_scrram[5] );
|
||||
tilemap_set_scrollx(state->fgtm, 0, state->scrram[0]);
|
||||
tilemap_set_scrolly(state->fgtm, 0, state->scrram[1]);
|
||||
tilemap_set_scrollx(state->bgtm, 0, state->scrram[2]);
|
||||
tilemap_set_scrolly(state->bgtm, 0, state->scrram[3]);
|
||||
tilemap_set_scrollx(state->bg2tm, 0, state->scrram[4]);
|
||||
tilemap_set_scrolly(state->bg2tm, 0, state->scrram[5]);
|
||||
|
||||
/* draw */
|
||||
tilemap_draw(bitmap,cliprect,kickgoal_bg2tm,0,0);
|
||||
tilemap_draw(bitmap,cliprect,kickgoal_bgtm,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg2tm, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->bgtm, 0, 0);
|
||||
|
||||
actionhw_draw_sprites(screen->machine,bitmap,cliprect);
|
||||
actionhw_draw_sprites(screen->machine, bitmap, cliprect);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,kickgoal_fgtm,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->fgtm, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,15 +1,7 @@
|
||||
#include "driver.h"
|
||||
#include "video/resnet.h"
|
||||
#include "includes/kingobox.h"
|
||||
|
||||
UINT8 *kingofb_videoram2;
|
||||
UINT8 *kingofb_colorram2;
|
||||
UINT8 *kingofb_scroll_y;
|
||||
|
||||
extern int kingofb_nmi_enable;
|
||||
|
||||
static int palette_bank;
|
||||
|
||||
static tilemap *bg_tilemap, *fg_tilemap;
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -31,22 +23,21 @@ static tilemap *bg_tilemap, *fg_tilemap;
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static void palette_init_common(running_machine *machine, const UINT8 *color_prom,
|
||||
void (*get_rgb_data)(const UINT8 *, int, int *, int *, int *))
|
||||
static void palette_init_common( running_machine *machine, const UINT8 *color_prom, void (*get_rgb_data)(const UINT8 *, int, int *, int *, int *) )
|
||||
{
|
||||
static const int resistances[4] = { 1500, 750, 360, 180 };
|
||||
static const int resistances[4] = { 1500, 750, 360, 180 };
|
||||
static const int resistances_fg[1] = { 51 };
|
||||
double rweights[4], gweights[4], bweights[4];
|
||||
double rweights_fg[1], gweights_fg[1], bweights_fg[1];
|
||||
int i;
|
||||
|
||||
/* compute the color output resistor weights */
|
||||
double scale = compute_resistor_weights(0, 255, -1.0,
|
||||
double scale = compute_resistor_weights(0, 255, -1.0,
|
||||
1, resistances_fg, rweights_fg, 0, 0,
|
||||
1, resistances_fg, gweights_fg, 0, 0,
|
||||
1, resistances_fg, bweights_fg, 0, 0);
|
||||
|
||||
compute_resistor_weights(0, 255, scale,
|
||||
compute_resistor_weights(0, 255, scale,
|
||||
4, resistances, rweights, 470, 0,
|
||||
4, resistances, gweights, 470, 0,
|
||||
4, resistances, bweights, 470, 0);
|
||||
@ -114,7 +105,7 @@ static void palette_init_common(running_machine *machine, const UINT8 *color_pro
|
||||
}
|
||||
|
||||
|
||||
static void kingofb_get_rgb_data(const UINT8 *color_prom, int i, int *r_data, int *g_data, int *b_data)
|
||||
static void kingofb_get_rgb_data( const UINT8 *color_prom, int i, int *r_data, int *g_data, int *b_data )
|
||||
{
|
||||
*r_data = color_prom[i + 0x000] & 0x0f;
|
||||
*g_data = color_prom[i + 0x100] & 0x0f;
|
||||
@ -122,7 +113,7 @@ static void kingofb_get_rgb_data(const UINT8 *color_prom, int i, int *r_data, in
|
||||
}
|
||||
|
||||
|
||||
static void ringking_get_rgb_data(const UINT8 *color_prom, int i, int *r_data, int *g_data, int *b_data)
|
||||
static void ringking_get_rgb_data( const UINT8 *color_prom, int i, int *r_data, int *g_data, int *b_data )
|
||||
{
|
||||
*r_data = (color_prom[i + 0x000] >> 4) & 0x0f;
|
||||
*g_data = (color_prom[i + 0x000] >> 0) & 0x0f;
|
||||
@ -142,36 +133,41 @@ PALETTE_INIT( ringking )
|
||||
|
||||
WRITE8_HANDLER( kingofb_videoram_w )
|
||||
{
|
||||
space->machine->generic.videoram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
kingofb_state *state = (kingofb_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( kingofb_colorram_w )
|
||||
{
|
||||
space->machine->generic.colorram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
kingofb_state *state = (kingofb_state *)space->machine->driver_data;
|
||||
state->colorram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( kingofb_videoram2_w )
|
||||
{
|
||||
kingofb_videoram2[offset] = data;
|
||||
tilemap_mark_tile_dirty(fg_tilemap, offset);
|
||||
kingofb_state *state = (kingofb_state *)space->machine->driver_data;
|
||||
state->videoram2[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->fg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( kingofb_colorram2_w )
|
||||
{
|
||||
kingofb_colorram2[offset] = data;
|
||||
tilemap_mark_tile_dirty(fg_tilemap, offset);
|
||||
kingofb_state *state = (kingofb_state *)space->machine->driver_data;
|
||||
state->colorram2[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->fg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( kingofb_f800_w )
|
||||
{
|
||||
kingofb_nmi_enable = data & 0x20;
|
||||
kingofb_state *state = (kingofb_state *)space->machine->driver_data;
|
||||
state->nmi_enable = data & 0x20;
|
||||
|
||||
if (palette_bank != ((data & 0x18) >> 3))
|
||||
if (state->palette_bank != ((data & 0x18) >> 3))
|
||||
{
|
||||
palette_bank = (data & 0x18) >> 3;
|
||||
tilemap_mark_all_tiles_dirty(bg_tilemap);
|
||||
state->palette_bank = (data & 0x18) >> 3;
|
||||
tilemap_mark_all_tiles_dirty(state->bg_tilemap);
|
||||
}
|
||||
|
||||
if (flip_screen_get(space->machine) != (data & 0x80))
|
||||
@ -183,19 +179,21 @@ WRITE8_HANDLER( kingofb_f800_w )
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
int attr = machine->generic.colorram.u8[tile_index];
|
||||
kingofb_state *state = (kingofb_state *)machine->driver_data;
|
||||
int attr = state->colorram[tile_index];
|
||||
int bank = ((attr & 0x04) >> 2) + 2;
|
||||
int code = (tile_index / 16) ? machine->generic.videoram.u8[tile_index] + ((attr & 0x03) << 8) : 0;
|
||||
int color = ((attr & 0x70) >> 4) + 8 * palette_bank;
|
||||
int code = (tile_index / 16) ? state->videoram[tile_index] + ((attr & 0x03) << 8) : 0;
|
||||
int color = ((attr & 0x70) >> 4) + 8 * state->palette_bank;
|
||||
|
||||
SET_TILE_INFO(bank, code, color, 0);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_fg_tile_info )
|
||||
{
|
||||
int attr = kingofb_colorram2[tile_index];
|
||||
kingofb_state *state = (kingofb_state *)machine->driver_data;
|
||||
int attr = state->colorram2[tile_index];
|
||||
int bank = (attr & 0x02) >> 1;
|
||||
int code = kingofb_videoram2[tile_index] + ((attr & 0x01) << 8);
|
||||
int code = state->videoram2[tile_index] + ((attr & 0x01) << 8);
|
||||
int color = (attr & 0x38) >> 3;
|
||||
|
||||
SET_TILE_INFO(bank, code, color, 0);
|
||||
@ -203,31 +201,34 @@ static TILE_GET_INFO( get_fg_tile_info )
|
||||
|
||||
VIDEO_START( kingofb )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_cols_flip_y, 16, 16, 16, 16);
|
||||
fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_cols_flip_y, 8, 8, 32, 32);
|
||||
kingofb_state *state = (kingofb_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_cols_flip_y, 16, 16, 16, 16);
|
||||
state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_cols_flip_y, 8, 8, 32, 32);
|
||||
|
||||
tilemap_set_transparent_pen(fg_tilemap, 0);
|
||||
tilemap_set_transparent_pen(state->fg_tilemap, 0);
|
||||
}
|
||||
|
||||
static void kingofb_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
{
|
||||
UINT8 *spriteram = machine->generic.spriteram.u8;
|
||||
kingofb_state *state = (kingofb_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = 0; offs < machine->generic.spriteram_size; offs += 4)
|
||||
for (offs = 0; offs < state->spriteram_size; offs += 4)
|
||||
{
|
||||
int roffs,bank,code,color,flipx,flipy,sx,sy;
|
||||
int roffs, bank, code, color, flipx, flipy, sx, sy;
|
||||
|
||||
/* the offset into spriteram seems scrambled */
|
||||
roffs = BITSWAP16(offs,15,14,13,12,11,10,4,7,6,5,9,8,3,2,1,0) ^ 0x3c;
|
||||
if (roffs & 0x200) roffs ^= 0x1c0;
|
||||
if (roffs & 0x200)
|
||||
roffs ^= 0x1c0;
|
||||
|
||||
bank = (spriteram[roffs + 3] & 0x04) >> 2;
|
||||
code = spriteram[roffs + 2] + ((spriteram[roffs + 3] & 0x03) << 8);
|
||||
color = ((spriteram[roffs + 3] & 0x70) >> 4) + 8 * palette_bank;
|
||||
color = ((spriteram[roffs + 3] & 0x70) >> 4) + 8 * state->palette_bank;
|
||||
flipx = 0;
|
||||
flipy = spriteram[roffs + 3] & 0x80;
|
||||
sx = spriteram[roffs+1];
|
||||
sx = spriteram[roffs + 1];
|
||||
sy = spriteram[roffs];
|
||||
|
||||
if (flip_screen_get(machine))
|
||||
@ -247,10 +248,12 @@ static void kingofb_draw_sprites(running_machine *machine, bitmap_t *bitmap, con
|
||||
|
||||
VIDEO_UPDATE( kingofb )
|
||||
{
|
||||
tilemap_set_scrolly(bg_tilemap, 0, -(*kingofb_scroll_y));
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
kingofb_state *state = (kingofb_state *)screen->machine->driver_data;
|
||||
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, -(*state->scroll_y));
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
kingofb_draw_sprites(screen->machine, bitmap, cliprect);
|
||||
tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -258,36 +261,36 @@ VIDEO_UPDATE( kingofb )
|
||||
|
||||
static TILE_GET_INFO( ringking_get_bg_tile_info )
|
||||
{
|
||||
int code = (tile_index / 16) ? machine->generic.videoram.u8[tile_index] : 0;
|
||||
int color = ((machine->generic.colorram.u8[tile_index] & 0x70) >> 4) + 8 * palette_bank;
|
||||
kingofb_state *state = (kingofb_state *)machine->driver_data;
|
||||
int code = (tile_index / 16) ? state->videoram[tile_index] : 0;
|
||||
int color = ((state->colorram[tile_index] & 0x70) >> 4) + 8 * state->palette_bank;
|
||||
|
||||
SET_TILE_INFO(4, code, color, 0);
|
||||
}
|
||||
|
||||
VIDEO_START( ringking )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, ringking_get_bg_tile_info, tilemap_scan_cols_flip_y,
|
||||
16, 16, 16, 16);
|
||||
kingofb_state *state = (kingofb_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create(machine, ringking_get_bg_tile_info, tilemap_scan_cols_flip_y, 16, 16, 16, 16);
|
||||
state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_cols_flip_y, 8, 8, 32, 32);
|
||||
|
||||
fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_cols_flip_y,
|
||||
8, 8, 32, 32);
|
||||
|
||||
tilemap_set_transparent_pen(fg_tilemap, 0);
|
||||
tilemap_set_transparent_pen(state->fg_tilemap, 0);
|
||||
}
|
||||
|
||||
static void ringking_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
static void ringking_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
UINT8 *spriteram = machine->generic.spriteram.u8;
|
||||
kingofb_state *state = (kingofb_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = 0; offs < machine->generic.spriteram_size; offs += 4)
|
||||
for (offs = 0; offs < state->spriteram_size; offs += 4)
|
||||
{
|
||||
int bank = (spriteram[offs + 1] & 0x04) >> 2;
|
||||
int code = spriteram[offs + 3] + ((spriteram[offs + 1] & 0x03) << 8);
|
||||
int color = ((spriteram[offs + 1] & 0x70) >> 4) + 8 * palette_bank;
|
||||
int color = ((spriteram[offs + 1] & 0x70) >> 4) + 8 * state->palette_bank;
|
||||
int flipx = 0;
|
||||
int flipy = ( spriteram[offs + 1] & 0x80 ) ? 0 : 1;
|
||||
int sx = spriteram[offs+2];
|
||||
int flipy = (spriteram[offs + 1] & 0x80) ? 0 : 1;
|
||||
int sx = spriteram[offs + 2];
|
||||
int sy = spriteram[offs];
|
||||
|
||||
if (flip_screen_get(machine))
|
||||
@ -307,9 +310,11 @@ static void ringking_draw_sprites(running_machine *machine, bitmap_t *bitmap, co
|
||||
|
||||
VIDEO_UPDATE( ringking )
|
||||
{
|
||||
tilemap_set_scrolly(bg_tilemap, 0, -(*kingofb_scroll_y));
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
kingofb_state *state = (kingofb_state *)screen->machine->driver_data;
|
||||
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, -(*state->scroll_y));
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
ringking_draw_sprites(screen->machine, bitmap, cliprect);
|
||||
tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,12 +5,8 @@ Knuckle Joe - (c) 1985 Taito Corporation
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "includes/kncljoe.h"
|
||||
|
||||
static tilemap *bg_tilemap;
|
||||
static int tile_bank,sprite_bank;
|
||||
static int flipscreen;
|
||||
|
||||
UINT8 *kncljoe_scrollregs;
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -86,8 +82,9 @@ PALETTE_INIT( kncljoe )
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
int attr = machine->generic.videoram.u8[2*tile_index+1];
|
||||
int code = machine->generic.videoram.u8[2*tile_index] + ((attr & 0xc0) << 2) + (tile_bank << 10);
|
||||
kncljoe_state *state = (kncljoe_state *)machine->driver_data;
|
||||
int attr = state->videoram[2 * tile_index + 1];
|
||||
int code = state->videoram[2 * tile_index] + ((attr & 0xc0) << 2) + (state->tile_bank << 10);
|
||||
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
@ -106,11 +103,10 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
VIDEO_START( kncljoe )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_rows,8,8,64,32);
|
||||
kncljoe_state *state = (kncljoe_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 64, 32);
|
||||
|
||||
tilemap_set_scroll_rows(bg_tilemap,4);
|
||||
|
||||
tile_bank = sprite_bank = flipscreen = 0;
|
||||
tilemap_set_scroll_rows(state->bg_tilemap, 4);
|
||||
}
|
||||
|
||||
|
||||
@ -123,12 +119,14 @@ VIDEO_START( kncljoe )
|
||||
|
||||
WRITE8_HANDLER( kncljoe_videoram_w )
|
||||
{
|
||||
space->machine->generic.videoram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap,offset/2);
|
||||
kncljoe_state *state = (kncljoe_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset / 2);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( kncljoe_control_w )
|
||||
{
|
||||
kncljoe_state *state = (kncljoe_state *)space->machine->driver_data;
|
||||
int i;
|
||||
/*
|
||||
0x01 screen flip
|
||||
@ -140,37 +138,38 @@ WRITE8_HANDLER( kncljoe_control_w )
|
||||
reset when IN0 - Coin 1 goes low (active)
|
||||
set after IN0 - Coin 1 goes high AND the credit has been added
|
||||
*/
|
||||
flipscreen = data & 0x01;
|
||||
tilemap_set_flip_all(space->machine,flipscreen ? TILEMAP_FLIPX : TILEMAP_FLIPY);
|
||||
state->flipscreen = data & 0x01;
|
||||
tilemap_set_flip_all(space->machine, state->flipscreen ? TILEMAP_FLIPX : TILEMAP_FLIPY);
|
||||
|
||||
coin_counter_w(space->machine, 0,data & 0x02);
|
||||
coin_counter_w(space->machine, 1,data & 0x20);
|
||||
coin_counter_w(space->machine, 0, data & 0x02);
|
||||
coin_counter_w(space->machine, 1, data & 0x20);
|
||||
|
||||
i = (data & 0x10) >> 4;
|
||||
if (tile_bank != i)
|
||||
if (state->tile_bank != i)
|
||||
{
|
||||
tile_bank = i;
|
||||
tilemap_mark_all_tiles_dirty(bg_tilemap);
|
||||
state->tile_bank = i;
|
||||
tilemap_mark_all_tiles_dirty(state->bg_tilemap);
|
||||
}
|
||||
|
||||
i = (data & 0x04) >> 2;
|
||||
if (sprite_bank != i)
|
||||
if (state->sprite_bank != i)
|
||||
{
|
||||
sprite_bank = i;
|
||||
memset(memory_region(space->machine, "maincpu")+0xf100, 0, 0x180);
|
||||
state->sprite_bank = i;
|
||||
memset(memory_region(space->machine, "maincpu") + 0xf100, 0, 0x180);
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( kncljoe_scroll_w )
|
||||
{
|
||||
kncljoe_state *state = (kncljoe_state *)space->machine->driver_data;
|
||||
int scrollx;
|
||||
|
||||
kncljoe_scrollregs[offset] = data;
|
||||
scrollx = kncljoe_scrollregs[0] | kncljoe_scrollregs[1]<<8;
|
||||
tilemap_set_scrollx(bg_tilemap,0,scrollx);
|
||||
tilemap_set_scrollx(bg_tilemap,1,scrollx);
|
||||
tilemap_set_scrollx(bg_tilemap,2,scrollx);
|
||||
tilemap_set_scrollx(bg_tilemap,3,0);
|
||||
state->scrollregs[offset] = data;
|
||||
scrollx = state->scrollregs[0] | state->scrollregs[1] << 8;
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, scrollx);
|
||||
tilemap_set_scrollx(state->bg_tilemap, 1, scrollx);
|
||||
tilemap_set_scrollx(state->bg_tilemap, 2, scrollx);
|
||||
tilemap_set_scrollx(state->bg_tilemap, 3, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -181,17 +180,18 @@ WRITE8_HANDLER( kncljoe_scroll_w )
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
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 )
|
||||
{
|
||||
UINT8 *spriteram = machine->generic.spriteram.u8;
|
||||
kncljoe_state *state = (kncljoe_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
rectangle clip = *cliprect;
|
||||
const gfx_element *gfx = machine->gfx[1 + sprite_bank];
|
||||
const gfx_element *gfx = machine->gfx[1 + state->sprite_bank];
|
||||
int i, j;
|
||||
static const int pribase[4]={0x0180, 0x0080, 0x0100, 0x0000};
|
||||
const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen);
|
||||
|
||||
/* score covers sprites */
|
||||
if (flipscreen)
|
||||
if (state->flipscreen)
|
||||
{
|
||||
if (clip.max_y > visarea->max_y - 64)
|
||||
clip.max_y = visarea->max_y - 64;
|
||||
@ -202,42 +202,47 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
clip.min_y = visarea->min_y + 64;
|
||||
}
|
||||
|
||||
for (i=0; i<4; i++)
|
||||
for (j=0x7c; j>=0; j-=4)
|
||||
{
|
||||
int offs = pribase[i] + j;
|
||||
int sy = spriteram[offs];
|
||||
int sx = spriteram[offs+3];
|
||||
int code = spriteram[offs+2];
|
||||
int attr = spriteram[offs+1];
|
||||
int flipx = attr & 0x40;
|
||||
int flipy = !(attr & 0x80);
|
||||
int color = attr & 0x0f;
|
||||
|
||||
if (attr & 0x10) code += 512;
|
||||
if (attr & 0x20) code += 256;
|
||||
|
||||
if (flipscreen)
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0x7c; j >= 0; j -= 4)
|
||||
{
|
||||
flipx = !flipx;
|
||||
flipy = !flipy;
|
||||
sx = 240 - sx;
|
||||
sy = 240 - sy;
|
||||
}
|
||||
int offs = pribase[i] + j;
|
||||
int sy = spriteram[offs];
|
||||
int sx = spriteram[offs + 3];
|
||||
int code = spriteram[offs + 2];
|
||||
int attr = spriteram[offs + 1];
|
||||
int flipx = attr & 0x40;
|
||||
int flipy = !(attr & 0x80);
|
||||
int color = attr & 0x0f;
|
||||
|
||||
if (sx >= 256-8) sx -= 256;
|
||||
if (attr & 0x10)
|
||||
code += 512;
|
||||
if (attr & 0x20)
|
||||
code += 256;
|
||||
|
||||
drawgfx_transpen(bitmap,&clip,gfx,
|
||||
if (state->flipscreen)
|
||||
{
|
||||
flipx = !flipx;
|
||||
flipy = !flipy;
|
||||
sx = 240 - sx;
|
||||
sy = 240 - sy;
|
||||
}
|
||||
|
||||
if (sx >= 256-8)
|
||||
sx -= 256;
|
||||
|
||||
drawgfx_transpen(bitmap,&clip,gfx,
|
||||
code,
|
||||
color,
|
||||
flipx,flipy,
|
||||
sx,sy,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( kncljoe )
|
||||
{
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
||||
draw_sprites(screen->machine,bitmap,cliprect);
|
||||
kncljoe_state *state = (kncljoe_state *)screen->machine->driver_data;
|
||||
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,19 +1,15 @@
|
||||
#include "driver.h"
|
||||
#include "includes/kopunch.h"
|
||||
|
||||
UINT8 *kopunch_videoram2;
|
||||
|
||||
static int gfxbank;
|
||||
|
||||
static tilemap *bg_tilemap, *fg_tilemap;
|
||||
|
||||
PALETTE_INIT( kopunch )
|
||||
{
|
||||
int i;
|
||||
|
||||
color_prom+=24; /* first 24 colors are black */
|
||||
for (i = 0;i < machine->config->total_colors;i++)
|
||||
color_prom += 24; /* first 24 colors are black */
|
||||
for (i = 0; i < machine->config->total_colors; i++)
|
||||
{
|
||||
int bit0,bit1,bit2,r,g,b;
|
||||
int bit0, bit1, bit2, r, g, b;
|
||||
|
||||
/* red component */
|
||||
bit0 = (*color_prom >> 0) & 0x01;
|
||||
@ -31,72 +27,82 @@ PALETTE_INIT( kopunch )
|
||||
bit2 = (*color_prom >> 7) & 0x01;
|
||||
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
|
||||
palette_set_color(machine,i,MAKE_RGB(r,g,b));
|
||||
palette_set_color(machine, i, MAKE_RGB(r, g, b));
|
||||
color_prom++;
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( kopunch_videoram_w )
|
||||
{
|
||||
space->machine->generic.videoram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(fg_tilemap, offset);
|
||||
kopunch_state *state = (kopunch_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->fg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( kopunch_videoram2_w )
|
||||
{
|
||||
kopunch_videoram2[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
kopunch_state *state = (kopunch_state *)space->machine->driver_data;
|
||||
state->videoram2[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( kopunch_scroll_x_w )
|
||||
{
|
||||
tilemap_set_scrollx(bg_tilemap, 0, data);
|
||||
kopunch_state *state = (kopunch_state *)space->machine->driver_data;
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, data);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( kopunch_scroll_y_w )
|
||||
{
|
||||
tilemap_set_scrolly(bg_tilemap, 0, data);
|
||||
kopunch_state *state = (kopunch_state *)space->machine->driver_data;
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, data);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( kopunch_gfxbank_w )
|
||||
{
|
||||
if (gfxbank != (data & 0x07))
|
||||
kopunch_state *state = (kopunch_state *)space->machine->driver_data;
|
||||
if (state->gfxbank != (data & 0x07))
|
||||
{
|
||||
gfxbank = data & 0x07;
|
||||
tilemap_mark_all_tiles_dirty(bg_tilemap);
|
||||
state->gfxbank = data & 0x07;
|
||||
tilemap_mark_all_tiles_dirty(state->bg_tilemap);
|
||||
}
|
||||
|
||||
tilemap_set_flip(bg_tilemap, (data & 0x08) ? TILEMAP_FLIPY : 0);
|
||||
tilemap_set_flip(state->bg_tilemap, (data & 0x08) ? TILEMAP_FLIPY : 0);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_fg_tile_info )
|
||||
{
|
||||
int code = machine->generic.videoram.u8[tile_index];
|
||||
kopunch_state *state = (kopunch_state *)machine->driver_data;
|
||||
int code = state->videoram[tile_index];
|
||||
|
||||
SET_TILE_INFO(0, code, 0, 0);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
int code = (kopunch_videoram2[tile_index] & 0x7f) + 128 * gfxbank;
|
||||
kopunch_state *state = (kopunch_state *)machine->driver_data;
|
||||
int code = (state->videoram2[tile_index] & 0x7f) + 128 * state->gfxbank;
|
||||
|
||||
SET_TILE_INFO(1, code, 0, 0);
|
||||
}
|
||||
|
||||
VIDEO_START( kopunch )
|
||||
{
|
||||
fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 16, 16, 16, 16);
|
||||
kopunch_state *state = (kopunch_state *)machine->driver_data;
|
||||
state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 16, 16, 16, 16);
|
||||
|
||||
tilemap_set_transparent_pen(fg_tilemap, 0);
|
||||
tilemap_set_transparent_pen(state->fg_tilemap, 0);
|
||||
|
||||
tilemap_set_scrolldx(bg_tilemap, 16, 16);
|
||||
tilemap_set_scrolldx(state->bg_tilemap, 16, 16);
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( kopunch )
|
||||
{
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0);
|
||||
kopunch_state *state = (kopunch_state *)screen->machine->driver_data;
|
||||
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
#include "driver.h"
|
||||
#include "includes/ksayakyu.h"
|
||||
|
||||
static tilemap *ksayakyu_tilemap;
|
||||
static tilemap *ksayakyu_textmap;
|
||||
|
||||
static int video_ctrl;
|
||||
static int flipscreen;
|
||||
|
||||
WRITE8_HANDLER(ksayakyu_videoram_w)
|
||||
{
|
||||
space->machine->generic.videoram.u8[offset]=data;
|
||||
tilemap_mark_tile_dirty(ksayakyu_textmap,offset>>1);
|
||||
ksayakyu_state *state = (ksayakyu_state *)space->machine->driver_data;
|
||||
state->videoram[offset]=data;
|
||||
tilemap_mark_tile_dirty(state->textmap, offset >> 1);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER(ksayakyu_videoctrl_w)
|
||||
@ -23,38 +20,39 @@ WRITE8_HANDLER(ksayakyu_videoctrl_w)
|
||||
xxx - scroll offset
|
||||
|
||||
*/
|
||||
video_ctrl=data;
|
||||
ksayakyu_state *state = (ksayakyu_state *)space->machine->driver_data;
|
||||
state->video_ctrl = data;
|
||||
|
||||
flipscreen = data & 4;
|
||||
flip_screen_set( space->machine,flipscreen );
|
||||
tilemap_set_scrolly( ksayakyu_tilemap, 0, (data&0xe0)<<3 );
|
||||
if(flipscreen)
|
||||
tilemap_set_flip( ksayakyu_tilemap, (data & 2) ? TILEMAP_FLIPY : TILEMAP_FLIPX | TILEMAP_FLIPY);
|
||||
state->flipscreen = data & 4;
|
||||
flip_screen_set(space->machine, state->flipscreen);
|
||||
tilemap_set_scrolly(state->tilemap, 0, (data & 0xe0) << 3);
|
||||
if(state->flipscreen)
|
||||
tilemap_set_flip(state->tilemap, (data & 2) ? TILEMAP_FLIPY : TILEMAP_FLIPX | TILEMAP_FLIPY);
|
||||
else
|
||||
tilemap_set_flip( ksayakyu_tilemap, (data & 2) ? TILEMAP_FLIPX : 0);
|
||||
tilemap_set_flip(state->tilemap, (data & 2) ? TILEMAP_FLIPX : 0);
|
||||
}
|
||||
|
||||
PALETTE_INIT( ksayakyu )
|
||||
{
|
||||
const UINT8 *prom = memory_region(machine, "proms");
|
||||
int r,g,b,i;
|
||||
int r, g, b, i;
|
||||
|
||||
for (i=0;i<0x100;i++)
|
||||
for (i = 0; i < 0x100; i++)
|
||||
{
|
||||
r = (prom[i] & 0x07) >> 0;
|
||||
g = (prom[i] & 0x38) >> 3;
|
||||
b = (prom[i] & 0xc0) >> 6;
|
||||
|
||||
palette_set_color_rgb(machine,i,pal3bit(r),pal3bit(g),pal2bit(b));
|
||||
palette_set_color_rgb(machine, i, pal3bit(r), pal3bit(g), pal2bit(b));
|
||||
}
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_ksayakyu_tile_info )
|
||||
{
|
||||
int code = memory_region(machine, "user1")[tile_index];
|
||||
int attr = memory_region(machine, "user1")[tile_index+0x2000];
|
||||
code+=(attr&3)<<8;
|
||||
SET_TILE_INFO(1,code,((attr>>2)&0x0f)*2,(attr&0x80) ? TILE_FLIPX : 0);
|
||||
int attr = memory_region(machine, "user1")[tile_index + 0x2000];
|
||||
code += (attr & 3) << 8;
|
||||
SET_TILE_INFO(1, code, ((attr >> 2) & 0x0f) * 2, (attr & 0x80) ? TILE_FLIPX : 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -64,14 +62,15 @@ xy-- ---- flip bits
|
||||
*/
|
||||
static TILE_GET_INFO( get_text_tile_info )
|
||||
{
|
||||
int code = machine->generic.videoram.u8[tile_index*2+1];
|
||||
int attr = machine->generic.videoram.u8[tile_index*2];
|
||||
int flags = ((attr&0x80) ? TILE_FLIPX : 0) | ((attr&0x40) ? TILE_FLIPY : 0);
|
||||
ksayakyu_state *state = (ksayakyu_state *)machine->driver_data;
|
||||
int code = state->videoram[tile_index * 2 + 1];
|
||||
int attr = state->videoram[tile_index * 2];
|
||||
int flags = ((attr & 0x80) ? TILE_FLIPX : 0) | ((attr & 0x40) ? TILE_FLIPY : 0);
|
||||
int color = (attr & 0x3c) >> 2;
|
||||
|
||||
code|=(attr&3)<<8;
|
||||
code |= (attr & 3) << 8;
|
||||
|
||||
SET_TILE_INFO(0,code,color,flags);
|
||||
SET_TILE_INFO(0, code, color, flags);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -82,32 +81,33 @@ static TILE_GET_INFO( get_text_tile_info )
|
||||
[3]
|
||||
*/
|
||||
|
||||
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 )
|
||||
{
|
||||
const UINT8 *source = machine->generic.spriteram.u8+machine->generic.spriteram_size-4;
|
||||
const UINT8 *finish = machine->generic.spriteram.u8;
|
||||
ksayakyu_state *state = (ksayakyu_state *)machine->driver_data;
|
||||
const UINT8 *source = state->spriteram + state->spriteram_size - 4;
|
||||
const UINT8 *finish = state->spriteram;
|
||||
|
||||
while( source>=finish ) /* is order correct ? */
|
||||
while (source>=finish) /* is order correct ? */
|
||||
{
|
||||
int sx=source[2];
|
||||
int sy=240-source[1];
|
||||
int attributes=source[3];
|
||||
int tile=source[0];
|
||||
int flipx=(tile&0x80)?1:0;
|
||||
int flipy=0;
|
||||
int sx = source[2];
|
||||
int sy = 240 - source[1];
|
||||
int attributes = source[3];
|
||||
int tile = source[0];
|
||||
int flipx = (tile & 0x80) ? 1 : 0;
|
||||
int flipy = 0;
|
||||
|
||||
gfx_element *gfx = machine->gfx[2];
|
||||
|
||||
if (flipscreen)
|
||||
if (state->flipscreen)
|
||||
{
|
||||
sx = 240-sx;
|
||||
sy = 240-sy;
|
||||
flipx^=1;
|
||||
flipy^=1;
|
||||
sx = 240 - sx;
|
||||
sy = 240 - sy;
|
||||
flipx ^= 1;
|
||||
flipy ^= 1;
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,gfx,
|
||||
tile&0x7f,
|
||||
tile & 0x7f,
|
||||
(attributes & 0x78) >> 3,
|
||||
flipx,flipy,
|
||||
sx,sy,0 );
|
||||
@ -118,17 +118,22 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
VIDEO_START(ksayakyu)
|
||||
{
|
||||
ksayakyu_tilemap = tilemap_create(machine, get_ksayakyu_tile_info,tilemap_scan_rows, 8, 8,32,32*8);
|
||||
ksayakyu_textmap = tilemap_create(machine, get_text_tile_info,tilemap_scan_rows, 8, 8,32,32);
|
||||
tilemap_set_transparent_pen(ksayakyu_textmap,0);
|
||||
ksayakyu_state *state = (ksayakyu_state *)machine->driver_data;
|
||||
state->tilemap = tilemap_create(machine, get_ksayakyu_tile_info, tilemap_scan_rows, 8, 8, 32, 32 * 8);
|
||||
state->textmap = tilemap_create(machine, get_text_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
tilemap_set_transparent_pen(state->textmap, 0);
|
||||
}
|
||||
|
||||
VIDEO_UPDATE(ksayakyu)
|
||||
{
|
||||
bitmap_fill(bitmap,cliprect,0);
|
||||
if(video_ctrl&1)
|
||||
tilemap_draw(bitmap,cliprect,ksayakyu_tilemap,0,0);
|
||||
tilemap_draw(bitmap,cliprect,ksayakyu_textmap, 0,0);
|
||||
draw_sprites(screen->machine,bitmap,cliprect);
|
||||
ksayakyu_state *state = (ksayakyu_state *)screen->machine->driver_data;
|
||||
|
||||
bitmap_fill(bitmap, cliprect, 0);
|
||||
|
||||
if (state->video_ctrl & 1)
|
||||
tilemap_draw(bitmap, cliprect,state->tilemap, 0, 0);
|
||||
|
||||
tilemap_draw(bitmap, cliprect, state->textmap, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,24 +5,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "kyugo.h"
|
||||
|
||||
|
||||
UINT8 *kyugo_fgvideoram;
|
||||
UINT8 *kyugo_bgvideoram;
|
||||
UINT8 *kyugo_bgattribram;
|
||||
UINT8 *kyugo_spriteram_1;
|
||||
UINT8 *kyugo_spriteram_2;
|
||||
|
||||
|
||||
static UINT8 scroll_x_lo;
|
||||
static UINT8 scroll_x_hi;
|
||||
static UINT8 scroll_y;
|
||||
static tilemap *fg_tilemap;
|
||||
static tilemap *bg_tilemap;
|
||||
static int bgpalbank,fgcolor;
|
||||
static int flipscreen;
|
||||
static const UINT8 *color_codes;
|
||||
#include "includes/kyugo.h"
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
@ -33,21 +16,23 @@ static const UINT8 *color_codes;
|
||||
|
||||
static TILE_GET_INFO( get_fg_tile_info )
|
||||
{
|
||||
int code = kyugo_fgvideoram[tile_index];
|
||||
kyugo_state *state = (kyugo_state *)machine->driver_data;
|
||||
int code = state->fgvideoram[tile_index];
|
||||
SET_TILE_INFO(0,
|
||||
code,
|
||||
2*color_codes[code >> 3] + fgcolor,
|
||||
2 * state->color_codes[code >> 3] + state->fgcolor,
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
int code = kyugo_bgvideoram[tile_index];
|
||||
int attr = kyugo_bgattribram[tile_index];
|
||||
kyugo_state *state = (kyugo_state *)machine->driver_data;
|
||||
int code = state->bgvideoram[tile_index];
|
||||
int attr = state->bgattribram[tile_index];
|
||||
SET_TILE_INFO(1,
|
||||
code | ((attr & 0x03) << 8),
|
||||
(attr >> 4) | (bgpalbank << 4),
|
||||
(attr >> 4) | (state->bgpalbank << 4),
|
||||
TILE_FLIPYX((attr & 0x0c) >> 2));
|
||||
}
|
||||
|
||||
@ -60,16 +45,17 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
VIDEO_START( kyugo )
|
||||
{
|
||||
color_codes = memory_region(machine, "proms") + 0x300;
|
||||
kyugo_state *state = (kyugo_state *)machine->driver_data;
|
||||
|
||||
state->color_codes = memory_region(machine, "proms") + 0x300;
|
||||
|
||||
fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 8,8, 64,32);
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8,8, 64,32);
|
||||
state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 8, 8, 64, 32);
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 64, 32);
|
||||
|
||||
tilemap_set_transparent_pen(fg_tilemap,0);
|
||||
tilemap_set_transparent_pen(state->fg_tilemap, 0);
|
||||
|
||||
tilemap_set_scrolldx(fg_tilemap, 0, 224);
|
||||
tilemap_set_scrolldx(bg_tilemap, -32, 32);
|
||||
tilemap_set_scrolldx(state->fg_tilemap, 0, 224);
|
||||
tilemap_set_scrolldx(state->bg_tilemap, -32, 32);
|
||||
}
|
||||
|
||||
|
||||
@ -81,57 +67,67 @@ VIDEO_START( kyugo )
|
||||
|
||||
WRITE8_HANDLER( kyugo_fgvideoram_w )
|
||||
{
|
||||
kyugo_fgvideoram[offset] = data;
|
||||
tilemap_mark_tile_dirty( fg_tilemap, offset );
|
||||
kyugo_state *state = (kyugo_state *)space->machine->driver_data;
|
||||
|
||||
state->fgvideoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->fg_tilemap, offset);
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( kyugo_bgvideoram_w )
|
||||
{
|
||||
kyugo_bgvideoram[offset] = data;
|
||||
tilemap_mark_tile_dirty( bg_tilemap, offset );
|
||||
kyugo_state *state = (kyugo_state *)space->machine->driver_data;
|
||||
|
||||
state->bgvideoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( kyugo_bgattribram_w )
|
||||
{
|
||||
kyugo_bgattribram[offset] = data;
|
||||
tilemap_mark_tile_dirty( bg_tilemap, offset );
|
||||
kyugo_state *state = (kyugo_state *)space->machine->driver_data;
|
||||
|
||||
state->bgattribram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
|
||||
READ8_HANDLER( kyugo_spriteram_2_r )
|
||||
{
|
||||
kyugo_state *state = (kyugo_state *)space->machine->driver_data;
|
||||
|
||||
// only the lower nibble is connected
|
||||
return kyugo_spriteram_2[offset] | 0xf0;
|
||||
return state->spriteram_2[offset] | 0xf0;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( kyugo_scroll_x_lo_w )
|
||||
{
|
||||
scroll_x_lo = data;
|
||||
kyugo_state *state = (kyugo_state *)space->machine->driver_data;
|
||||
state->scroll_x_lo = data;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( kyugo_gfxctrl_w )
|
||||
{
|
||||
kyugo_state *state = (kyugo_state *)space->machine->driver_data;
|
||||
|
||||
/* bit 0 is scroll MSB */
|
||||
scroll_x_hi = data & 0x01;
|
||||
state->scroll_x_hi = data & 0x01;
|
||||
|
||||
/* bit 5 is front layer color (Son of Phoenix only) */
|
||||
if (fgcolor != ((data & 0x20) >> 5))
|
||||
if (state->fgcolor != ((data & 0x20) >> 5))
|
||||
{
|
||||
fgcolor = (data & 0x20) >> 5;
|
||||
state->fgcolor = (data & 0x20) >> 5;
|
||||
|
||||
tilemap_mark_all_tiles_dirty(fg_tilemap);
|
||||
tilemap_mark_all_tiles_dirty(state->fg_tilemap);
|
||||
}
|
||||
|
||||
/* bit 6 is background palette bank */
|
||||
if (bgpalbank != ((data & 0x40) >> 6))
|
||||
if (state->bgpalbank != ((data & 0x40) >> 6))
|
||||
{
|
||||
bgpalbank = (data & 0x40) >> 6;
|
||||
|
||||
tilemap_mark_all_tiles_dirty(bg_tilemap);
|
||||
state->bgpalbank = (data & 0x40) >> 6;
|
||||
tilemap_mark_all_tiles_dirty(state->bg_tilemap);
|
||||
}
|
||||
|
||||
if (data & 0x9e)
|
||||
@ -141,17 +137,19 @@ WRITE8_HANDLER( kyugo_gfxctrl_w )
|
||||
|
||||
WRITE8_HANDLER( kyugo_scroll_y_w )
|
||||
{
|
||||
scroll_y = data;
|
||||
kyugo_state *state = (kyugo_state *)space->machine->driver_data;
|
||||
state->scroll_y = data;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( kyugo_flipscreen_w )
|
||||
{
|
||||
if (flipscreen != (data & 0x01))
|
||||
{
|
||||
flipscreen = (data & 0x01);
|
||||
kyugo_state *state = (kyugo_state *)space->machine->driver_data;
|
||||
|
||||
tilemap_set_flip_all(space->machine, (flipscreen ? (TILEMAP_FLIPX | TILEMAP_FLIPY): 0));
|
||||
if (state->flipscreen != (data & 0x01))
|
||||
{
|
||||
state->flipscreen = (data & 0x01);
|
||||
tilemap_set_flip_all(space->machine, (state->flipscreen ? (TILEMAP_FLIPX | TILEMAP_FLIPY): 0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,45 +160,50 @@ WRITE8_HANDLER( kyugo_flipscreen_w )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
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 )
|
||||
{
|
||||
kyugo_state *state = (kyugo_state *)machine->driver_data;
|
||||
|
||||
/* sprite information is scattered through memory */
|
||||
/* and uses a portion of the text layer memory (outside the visible area) */
|
||||
UINT8 *spriteram_area1 = &kyugo_spriteram_1[0x28];
|
||||
UINT8 *spriteram_area2 = &kyugo_spriteram_2[0x28];
|
||||
UINT8 *spriteram_area3 = &kyugo_fgvideoram[0x28];
|
||||
UINT8 *spriteram_area1 = &state->spriteram_1[0x28];
|
||||
UINT8 *spriteram_area2 = &state->spriteram_2[0x28];
|
||||
UINT8 *spriteram_area3 = &state->fgvideoram[0x28];
|
||||
|
||||
int n;
|
||||
|
||||
for( n = 0; n < 12*2; n++ )
|
||||
for (n = 0; n < 12 * 2; n++)
|
||||
{
|
||||
int offs,y,sy,sx,color;
|
||||
int offs, y, sy, sx, color;
|
||||
|
||||
offs = 2*(n % 12) + 64*(n / 12);
|
||||
offs = 2 * (n % 12) + 64 * (n / 12);
|
||||
|
||||
sx = spriteram_area3[offs+1] + 256 * (spriteram_area2[offs+1] & 1);
|
||||
if (sx > 320) sx -= 512;
|
||||
sx = spriteram_area3[offs + 1] + 256 * (spriteram_area2[offs + 1] & 1);
|
||||
if (sx > 320)
|
||||
sx -= 512;
|
||||
|
||||
sy = 255 - spriteram_area1[offs] + 2;
|
||||
if (sy > 0xf0) sy -= 256;
|
||||
if (sy > 0xf0)
|
||||
sy -= 256;
|
||||
|
||||
if (flipscreen) sy = 240 - sy;
|
||||
if (state->flipscreen)
|
||||
sy = 240 - sy;
|
||||
|
||||
color = spriteram_area1[offs+1] & 0x1f;
|
||||
color = spriteram_area1[offs + 1] & 0x1f;
|
||||
|
||||
for (y = 0;y < 16;y++)
|
||||
for (y = 0; y < 16; y++)
|
||||
{
|
||||
int code,attr,flipx,flipy;
|
||||
int code, attr, flipx, flipy;
|
||||
|
||||
code = spriteram_area3[offs + 128*y];
|
||||
attr = spriteram_area2[offs + 128*y];
|
||||
code = spriteram_area3[offs + 128 * y];
|
||||
attr = spriteram_area2[offs + 128 * y];
|
||||
|
||||
code = code | ((attr & 0x01) << 9) | ((attr & 0x02) << 7);
|
||||
|
||||
flipx = attr & 0x08;
|
||||
flipy = attr & 0x04;
|
||||
|
||||
if (flipscreen)
|
||||
if (state->flipscreen)
|
||||
{
|
||||
flipx = !flipx;
|
||||
flipy = !flipy;
|
||||
@ -211,7 +214,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
code,
|
||||
color,
|
||||
flipx,flipy,
|
||||
sx,flipscreen ? sy - 16*y : sy + 16*y, 0 );
|
||||
sx,state->flipscreen ? sy - 16*y : sy + 16*y, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -219,15 +222,17 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
VIDEO_UPDATE( kyugo )
|
||||
{
|
||||
if (flipscreen)
|
||||
tilemap_set_scrollx(bg_tilemap,0,-(scroll_x_lo + (scroll_x_hi*256)));
|
||||
kyugo_state *state = (kyugo_state *)screen->machine->driver_data;
|
||||
|
||||
if (state->flipscreen)
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, -(state->scroll_x_lo + (state->scroll_x_hi * 256)));
|
||||
else
|
||||
tilemap_set_scrollx(bg_tilemap,0, scroll_x_lo + (scroll_x_hi*256));
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, state->scroll_x_lo + (state->scroll_x_hi * 256));
|
||||
|
||||
tilemap_set_scrolly(bg_tilemap,0,scroll_y);
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, state->scroll_y);
|
||||
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user