mirror of
https://github.com/holub/mame
synced 2025-10-06 17:08:28 +03:00
Added save states and driver data struct to glass.c & homedata.c
Added driver data struct to hyprduel.c
This commit is contained in:
parent
14cb5e25ce
commit
d1a758c12a
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -2474,6 +2474,7 @@ src/mame/includes/gberet.h svneol=native#text/plain
|
||||
src/mame/includes/gcpinbal.h svneol=native#text/plain
|
||||
src/mame/includes/genesis.h svneol=native#text/plain
|
||||
src/mame/includes/ginganin.h svneol=native#text/plain
|
||||
src/mame/includes/glass.h svneol=native#text/plain
|
||||
src/mame/includes/gng.h svneol=native#text/plain
|
||||
src/mame/includes/goal92.h svneol=native#text/plain
|
||||
src/mame/includes/goindol.h svneol=native#text/plain
|
||||
|
@ -11,36 +11,22 @@ The DS5002FP has up to 128KB undumped gameplay code making the game unplayable :
|
||||
#include "driver.h"
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "sound/okim6295.h"
|
||||
|
||||
extern UINT16 *glass_vregs;
|
||||
extern UINT16 *glass_videoram;
|
||||
extern UINT16 *glass_spriteram;
|
||||
extern int glass_current_bit;
|
||||
|
||||
/* from video/glass.c */
|
||||
WRITE16_HANDLER( glass_vram_w );
|
||||
WRITE16_HANDLER( glass_blitter_w );
|
||||
VIDEO_START( glass );
|
||||
VIDEO_UPDATE( glass );
|
||||
|
||||
static int cause_interrupt;
|
||||
|
||||
static MACHINE_RESET( glass )
|
||||
{
|
||||
cause_interrupt = 1;
|
||||
glass_current_bit = 0;
|
||||
}
|
||||
#include "includes/glass.h"
|
||||
|
||||
static WRITE16_HANDLER( clr_int_w )
|
||||
{
|
||||
cause_interrupt = 1;
|
||||
glass_state *state = (glass_state *)space->machine->driver_data;
|
||||
state->cause_interrupt = 1;
|
||||
}
|
||||
|
||||
static INTERRUPT_GEN( glass_interrupt )
|
||||
{
|
||||
if (cause_interrupt){
|
||||
glass_state *state = (glass_state *)device->machine->driver_data;
|
||||
|
||||
if (state->cause_interrupt)
|
||||
{
|
||||
cpu_set_input_line(device, 6, HOLD_LINE);
|
||||
cause_interrupt = 0;
|
||||
state->cause_interrupt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,14 +57,14 @@ static WRITE16_HANDLER( OKIM6295_bankswitch_w )
|
||||
{
|
||||
UINT8 *RAM = memory_region(space->machine, "oki");
|
||||
|
||||
if (ACCESSING_BITS_0_7){
|
||||
if (ACCESSING_BITS_0_7)
|
||||
memcpy(&RAM[0x30000], &RAM[0x40000 + (data & 0x0f) * 0x10000], 0x10000);
|
||||
}
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( glass_coin_w )
|
||||
{
|
||||
switch (offset >> 3){
|
||||
switch (offset >> 3)
|
||||
{
|
||||
case 0x00: /* Coin Lockouts */
|
||||
case 0x01:
|
||||
coin_lockout_w(space->machine, (offset >> 3) & 0x01, ~data & 0x01);
|
||||
@ -94,12 +80,12 @@ static WRITE16_HANDLER( glass_coin_w )
|
||||
|
||||
static ADDRESS_MAP_START( glass_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x07ffff) AM_ROM /* ROM */
|
||||
AM_RANGE(0x100000, 0x101fff) AM_RAM_WRITE(glass_vram_w) AM_BASE(&glass_videoram) /* Video RAM */
|
||||
AM_RANGE(0x100000, 0x101fff) AM_RAM_WRITE(glass_vram_w) AM_BASE_MEMBER(glass_state, videoram) /* Video RAM */
|
||||
AM_RANGE(0x102000, 0x102fff) AM_RAM /* Extra Video RAM */
|
||||
AM_RANGE(0x108000, 0x108007) AM_WRITEONLY AM_BASE(&glass_vregs) /* Video Registers */
|
||||
AM_RANGE(0x108000, 0x108007) AM_WRITEONLY AM_BASE_MEMBER(glass_state, vregs) /* Video Registers */
|
||||
AM_RANGE(0x108008, 0x108009) AM_WRITE(clr_int_w) /* CLR INT Video */
|
||||
AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram) /* Palette */
|
||||
AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(&glass_spriteram) /* Sprite RAM */
|
||||
AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE_MEMBER(glass_state, spriteram) /* Sprite RAM */
|
||||
AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW2")
|
||||
AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1")
|
||||
AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1")
|
||||
@ -185,13 +171,40 @@ INPUT_PORTS_END
|
||||
|
||||
|
||||
|
||||
static MACHINE_START( glass )
|
||||
{
|
||||
glass_state *state = (glass_state *)machine->driver_data;
|
||||
|
||||
state_save_register_global(machine, state->cause_interrupt);
|
||||
state_save_register_global(machine, state->current_bit);
|
||||
state_save_register_global(machine, state->current_command);
|
||||
state_save_register_global_array(machine, state->blitter_serial_buffer);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( glass )
|
||||
{
|
||||
glass_state *state = (glass_state *)machine->driver_data;
|
||||
int i;
|
||||
|
||||
state->cause_interrupt = 1;
|
||||
state->current_bit = 0;
|
||||
state->current_command = 0;
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
state->blitter_serial_buffer[i] = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( glass )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(glass_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M68000,24000000/2) /* 12 MHz (M680000 P12) */
|
||||
MDRV_CPU_PROGRAM_MAP(glass_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", glass_interrupt)
|
||||
|
||||
MDRV_MACHINE_START(glass)
|
||||
MDRV_MACHINE_RESET(glass)
|
||||
|
||||
/* video hardware */
|
||||
@ -296,7 +309,8 @@ static void glass_ROM16_split_gfx(running_machine *machine, const char *src_reg,
|
||||
UINT8 *dst = (UINT8 *)memory_region(machine, dst_reg);
|
||||
|
||||
/* fill destination areas with the proper data */
|
||||
for (i = 0; i < length/2; i++){
|
||||
for (i = 0; i < length / 2; i++)
|
||||
{
|
||||
dst[dest1 + i] = src[start + i * 2 + 0];
|
||||
dst[dest2 + i] = src[start + i * 2 + 1];
|
||||
}
|
||||
@ -323,6 +337,6 @@ static DRIVER_INIT( glass )
|
||||
glass_ROM16_split_gfx(machine, "gfx2", "gfx1", 0x0200000, 0x0200000, 0x0200000, 0x0300000);
|
||||
}
|
||||
|
||||
GAME( 1993, glass, 0, glass, glass, glass, ROT0, "Gaelco", "Glass (Ver 1.1)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
|
||||
GAME( 1993, glass10, glass, glass, glass, glass, ROT0, "Gaelco", "Glass (Ver 1.0)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
|
||||
GAME( 1993, glassbrk, glass, glass, glass, glass, ROT0, "Gaelco", "Glass (Ver 1.0, Break Edition)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
|
||||
GAME( 1993, glass, 0, glass, glass, glass, ROT0, "Gaelco", "Glass (Ver 1.1)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1993, glass10, glass, glass, glass, glass, ROT0, "Gaelco", "Glass (Ver 1.0)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1993, glassbrk, glass, glass, glass, glass, ROT0, "Gaelco", "Glass (Ver 1.0, Break Edition)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
|
||||
|
@ -224,15 +224,10 @@ Custom: GX61A01
|
||||
#include "sound/2203intf.h"
|
||||
#include "sound/sn76496.h"
|
||||
|
||||
|
||||
/********************************************************************************/
|
||||
|
||||
|
||||
static int vblank;
|
||||
|
||||
static INTERRUPT_GEN( homedata_irq )
|
||||
{
|
||||
vblank = 1;
|
||||
homedata_state *state = (homedata_state *)device->machine->driver_data;
|
||||
state->vblank = 1;
|
||||
cpu_set_input_line(device, M6809_FIRQ_LINE, HOLD_LINE);
|
||||
}
|
||||
|
||||
@ -250,10 +245,9 @@ static INTERRUPT_GEN( upd7807_irq )
|
||||
|
||||
********************************************************************************/
|
||||
|
||||
static int keyb;
|
||||
|
||||
static READ8_HANDLER( mrokumei_keyboard_r )
|
||||
{
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
int res = 0x3f,i;
|
||||
static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4" };
|
||||
|
||||
@ -262,7 +256,7 @@ static READ8_HANDLER( mrokumei_keyboard_r )
|
||||
{
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
if (keyb & (1 << i))
|
||||
if (state->keyb & (1 << i))
|
||||
{
|
||||
res = input_port_read(space->machine, keynames[i]) & 0x3f;
|
||||
break;
|
||||
@ -276,11 +270,12 @@ static READ8_HANDLER( mrokumei_keyboard_r )
|
||||
* bit 6: vblank
|
||||
* other bits are inputs
|
||||
*/
|
||||
res |= homedata_visible_page << 7;
|
||||
res |= state->visible_page << 7;
|
||||
|
||||
if (vblank) res |= 0x40;
|
||||
if (state->vblank)
|
||||
res |= 0x40;
|
||||
|
||||
vblank = 0;
|
||||
state->vblank = 0;
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -288,35 +283,36 @@ static READ8_HANDLER( mrokumei_keyboard_r )
|
||||
|
||||
static WRITE8_HANDLER( mrokumei_keyboard_select_w )
|
||||
{
|
||||
keyb = data;
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
state->keyb = data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int sndbank;
|
||||
|
||||
static READ8_HANDLER( mrokumei_sound_io_r )
|
||||
{
|
||||
if (sndbank & 4)
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
if (state->sndbank & 4)
|
||||
return(soundlatch_r(space, 0));
|
||||
else
|
||||
return memory_region(space->machine, "audiocpu")[0x10000 + offset + (sndbank & 1) * 0x10000];
|
||||
return memory_region(space->machine, "audiocpu")[0x10000 + offset + (state->sndbank & 1) * 0x10000];
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( mrokumei_sound_bank_w )
|
||||
{
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
/* bit 0 = ROM bank
|
||||
bit 2 = ROM or soundlatch
|
||||
*/
|
||||
sndbank = data;
|
||||
state->sndbank = data;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( mrokumei_sound_io_w )
|
||||
{
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
switch (offset & 0xff)
|
||||
{
|
||||
case 0x40:
|
||||
dac_signed_data_w(devtag_get_device(space->machine, "dac"),data);
|
||||
dac_signed_data_w(state->dac, data);
|
||||
break;
|
||||
default:
|
||||
logerror("%04x: I/O write to port %04x\n", cpu_get_pc(space->cpu), offset);
|
||||
@ -326,8 +322,9 @@ static WRITE8_HANDLER( mrokumei_sound_io_w )
|
||||
|
||||
static WRITE8_HANDLER( mrokumei_sound_cmd_w )
|
||||
{
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
soundlatch_w(space, offset, data);
|
||||
cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE);
|
||||
cpu_set_input_line(state->audiocpu, 0, HOLD_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -339,20 +336,22 @@ static WRITE8_HANDLER( mrokumei_sound_cmd_w )
|
||||
|
||||
********************************************************************************/
|
||||
|
||||
static int upd7807_porta,upd7807_portc;
|
||||
|
||||
static READ8_HANDLER( reikaids_upd7807_porta_r )
|
||||
{
|
||||
return upd7807_porta;
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
return state->upd7807_porta;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( reikaids_upd7807_porta_w )
|
||||
{
|
||||
upd7807_porta = data;
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
state->upd7807_porta = data;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( reikaids_upd7807_portc_w )
|
||||
{
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
|
||||
/* port C layout:
|
||||
7 coin counter
|
||||
6 to main CPU (data)
|
||||
@ -370,61 +369,48 @@ static WRITE8_HANDLER( reikaids_upd7807_portc_w )
|
||||
|
||||
coin_counter_w(space->machine, 0, ~data & 0x80);
|
||||
|
||||
if (BIT(upd7807_portc,5) && !BIT(data,5)) /* write clock 1->0 */
|
||||
{
|
||||
const device_config *device = devtag_get_device(space->machine, "ymsnd");
|
||||
ym2203_w(device, BIT(data,3), upd7807_porta);
|
||||
}
|
||||
if (BIT(state->upd7807_portc, 5) && !BIT(data, 5)) /* write clock 1->0 */
|
||||
ym2203_w(state->ym, BIT(data, 3), state->upd7807_porta);
|
||||
|
||||
if (BIT(upd7807_portc,4) && !BIT(data,4)) /* read clock 1->0 */
|
||||
{
|
||||
const device_config *device = devtag_get_device(space->machine, "ymsnd");
|
||||
upd7807_porta = ym2203_r(device, BIT(data,3));
|
||||
}
|
||||
if (BIT(state->upd7807_portc, 4) && !BIT(data, 4)) /* read clock 1->0 */
|
||||
state->upd7807_porta = ym2203_r(state->ym, BIT(data, 3));
|
||||
|
||||
upd7807_portc = data;
|
||||
}
|
||||
|
||||
static MACHINE_RESET( reikaids_upd7807 )
|
||||
{
|
||||
const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
|
||||
/* on reset, ports are set as input (high impedance), therefore 0xff output */
|
||||
reikaids_which=homedata_priority;
|
||||
reikaids_upd7807_portc_w(space,0,0xff);
|
||||
state->upd7807_portc = data;
|
||||
}
|
||||
|
||||
static READ8_HANDLER( reikaids_io_r )
|
||||
{
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
int res = input_port_read(space->machine, "IN2"); // bit 4 = coin, bit 5 = service
|
||||
|
||||
res |= BIT(upd7807_portc,2) * 0x01; // bit 0 = upd7807 status
|
||||
res |= BIT(upd7807_portc,6) * 0x02; // bit 1 = upd7807 data
|
||||
if (vblank) res |= 0x04; // bit 2 = vblank
|
||||
res |= homedata_visible_page * 0x08; // bit 3 = visible page
|
||||
res |= BIT(state->upd7807_portc, 2) * 0x01; // bit 0 = upd7807 status
|
||||
res |= BIT(state->upd7807_portc, 6) * 0x02; // bit 1 = upd7807 data
|
||||
if (state->vblank)
|
||||
res |= 0x04; // bit 2 = vblank
|
||||
res |= state->visible_page * 0x08; // bit 3 = visible page
|
||||
|
||||
vblank = 0;
|
||||
state->vblank = 0;
|
||||
|
||||
//logerror("%04x: io_r %02x\n", cpu_get_pc(space->cpu), res);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static int snd_command;
|
||||
|
||||
static READ8_HANDLER( reikaids_snd_command_r )
|
||||
{
|
||||
//logerror("%04x: sndmcd_r (%02x)\n",cpu_get_pc(space->cpu),snd_command);
|
||||
return snd_command;
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
//logerror("%04x: sndmcd_r (%02x)\n", cpu_get_pc(space->cpu), state->snd_command);
|
||||
return state->snd_command;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( reikaids_snd_command_w )
|
||||
{
|
||||
snd_command = data;
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
state->snd_command = data;
|
||||
//logerror("%04x: coprocessor_command_w %02x\n", cpu_get_pc(space->cpu), data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************************************************************************
|
||||
|
||||
Newer Mahjong games:
|
||||
@ -433,53 +419,56 @@ static WRITE8_HANDLER( reikaids_snd_command_w )
|
||||
|
||||
********************************************************************************/
|
||||
|
||||
static int to_cpu,from_cpu;
|
||||
|
||||
static WRITE8_HANDLER( pteacher_snd_command_w )
|
||||
{
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
//logerror("%04x: snd_command_w %02x\n", cpu_get_pc(space->cpu), data);
|
||||
from_cpu = data;
|
||||
state->from_cpu = data;
|
||||
}
|
||||
|
||||
static READ8_HANDLER( pteacher_snd_r )
|
||||
{
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
//logerror("%04x: pteacher_snd_r %02x\n",cpu_get_pc(space->cpu),to_cpu);
|
||||
return to_cpu;
|
||||
return state->to_cpu;
|
||||
}
|
||||
|
||||
static READ8_HANDLER( pteacher_io_r )
|
||||
{
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
/* bit 6: !vblank
|
||||
* bit 7: visible page
|
||||
* other bits seem unused
|
||||
*/
|
||||
|
||||
int res = (homedata_visible_page ^ 1) << 7;
|
||||
int res = (state->visible_page ^ 1) << 7;
|
||||
|
||||
if (!vblank) res |= 0x40;
|
||||
if (!state->vblank)
|
||||
res |= 0x40;
|
||||
|
||||
vblank = 0;
|
||||
state->vblank = 0;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static READ8_HANDLER( pteacher_keyboard_r )
|
||||
{
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5" };
|
||||
int dips = input_port_read(space->machine, "DSW");
|
||||
|
||||
// logerror("%04x: keyboard_r with port A = %02x\n",cpu_get_pc(space->cpu),upd7807_porta);
|
||||
|
||||
if (upd7807_porta & 0x80)
|
||||
if (state->upd7807_porta & 0x80)
|
||||
{
|
||||
/* player 1 + dip switches */
|
||||
int row = (upd7807_porta & 0x07);
|
||||
int row = (state->upd7807_porta & 0x07);
|
||||
return input_port_read(space->machine, keynames[row]) | (((dips >> row) & 1) << 5); // 0-5
|
||||
}
|
||||
if (upd7807_porta & 0x08)
|
||||
if (state->upd7807_porta & 0x08)
|
||||
{
|
||||
/* player 2 (not supported) + dip switches */
|
||||
int row = ((upd7807_porta >> 4) & 0x07);
|
||||
int row = ((state->upd7807_porta >> 4) & 0x07);
|
||||
return 0xdf | (((dips >> (row + 5)) & 1) << 5); // 6-11
|
||||
}
|
||||
|
||||
@ -488,27 +477,31 @@ static READ8_HANDLER( pteacher_keyboard_r )
|
||||
|
||||
static READ8_HANDLER( pteacher_upd7807_porta_r )
|
||||
{
|
||||
if (!BIT(upd7807_portc,6))
|
||||
upd7807_porta = from_cpu;
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
if (!BIT(state->upd7807_portc, 6))
|
||||
state->upd7807_porta = state->from_cpu;
|
||||
else
|
||||
logerror("%04x: read PA with PC *not* clear\n", cpu_get_pc(space->cpu));
|
||||
|
||||
return upd7807_porta;
|
||||
return state->upd7807_porta;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( pteacher_snd_answer_w )
|
||||
{
|
||||
to_cpu = data;
|
||||
//logerror("%04x: to_cpu = %02x\n",cpu_get_pc(space->cpu),to_cpu);
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
state->to_cpu = data;
|
||||
//logerror("%04x: to_cpu = %02x\n", cpu_get_pc(space->cpu), state->to_cpu);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( pteacher_upd7807_porta_w )
|
||||
{
|
||||
upd7807_porta = data;
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
state->upd7807_porta = data;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( pteacher_upd7807_portc_w )
|
||||
{
|
||||
homedata_state *state = (homedata_state *)space->machine->driver_data;
|
||||
/* port C layout:
|
||||
7 coin counter
|
||||
6 enable message from main CPU on port A
|
||||
@ -526,20 +519,12 @@ static WRITE8_HANDLER( pteacher_upd7807_portc_w )
|
||||
|
||||
coin_counter_w(space->machine, 0, ~data & 0x80);
|
||||
|
||||
if (BIT(upd7807_portc,5) && !BIT(data,5)) /* clock 1->0 */
|
||||
sn76496_w(devtag_get_device(space->machine, "snsnd"),0,upd7807_porta);
|
||||
if (BIT(state->upd7807_portc, 5) && !BIT(data, 5)) /* clock 1->0 */
|
||||
sn76496_w(state->sn, 0, state->upd7807_porta);
|
||||
|
||||
upd7807_portc = data;
|
||||
state->upd7807_portc = data;
|
||||
}
|
||||
|
||||
static MACHINE_RESET( pteacher_upd7807 )
|
||||
{
|
||||
const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
|
||||
/* on reset, ports are set as input (high impedance), therefore 0xff output */
|
||||
pteacher_upd7807_portc_w(space,0,0xff);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************************/
|
||||
|
||||
|
||||
@ -565,7 +550,7 @@ static WRITE8_HANDLER( bankswitch_w )
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( mrokumei_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x3fff) AM_RAM_WRITE(mrokumei_videoram_w) AM_BASE_GENERIC(videoram)
|
||||
AM_RANGE(0x0000, 0x3fff) AM_RAM_WRITE(mrokumei_videoram_w) AM_BASE_MEMBER(homedata_state, videoram)
|
||||
AM_RANGE(0x4000, 0x5fff) AM_RAM
|
||||
AM_RANGE(0x6000, 0x6fff) AM_RAM /* work ram */
|
||||
AM_RANGE(0x7000, 0x77ff) AM_RAM /* hourouki expects this to act as RAM */
|
||||
@ -574,7 +559,7 @@ static ADDRESS_MAP_START( mrokumei_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x7803, 0x7803) AM_READ_PORT("IN0") // coin, service
|
||||
AM_RANGE(0x7804, 0x7804) AM_READ_PORT("DSW1") // DSW1
|
||||
AM_RANGE(0x7805, 0x7805) AM_READ_PORT("DSW2") // DSW2
|
||||
AM_RANGE(0x7ff0, 0x7ffd) AM_WRITEONLY AM_BASE(&homedata_vreg)
|
||||
AM_RANGE(0x7ff0, 0x7ffd) AM_WRITEONLY AM_BASE_MEMBER(homedata_state, vreg)
|
||||
AM_RANGE(0x7ffe, 0x7ffe) AM_READNOP // ??? read every vblank, value discarded
|
||||
AM_RANGE(0x8000, 0x8000) AM_WRITE(mrokumei_blitter_start_w) // in some games also ROM bank switch to access service ROM
|
||||
AM_RANGE(0x8001, 0x8001) AM_WRITE(mrokumei_keyboard_select_w)
|
||||
@ -599,14 +584,14 @@ ADDRESS_MAP_END
|
||||
/********************************************************************************/
|
||||
|
||||
static ADDRESS_MAP_START( reikaids_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x3fff) AM_RAM_WRITE(reikaids_videoram_w) AM_BASE_GENERIC(videoram)
|
||||
AM_RANGE(0x0000, 0x3fff) AM_RAM_WRITE(reikaids_videoram_w) AM_BASE_MEMBER(homedata_state, videoram)
|
||||
AM_RANGE(0x4000, 0x5fff) AM_RAM
|
||||
AM_RANGE(0x6000, 0x6fff) AM_RAM /* work RAM */
|
||||
AM_RANGE(0x7800, 0x7800) AM_RAM /* behaves as normal RAM */
|
||||
AM_RANGE(0x7801, 0x7801) AM_READ_PORT("IN0")
|
||||
AM_RANGE(0x7802, 0x7802) AM_READ_PORT("IN1")
|
||||
AM_RANGE(0x7803, 0x7803) AM_READ(reikaids_io_r) // coin, blitter, upd7807
|
||||
AM_RANGE(0x7ff0, 0x7ffd) AM_WRITEONLY AM_BASE(&homedata_vreg)
|
||||
AM_RANGE(0x7ff0, 0x7ffd) AM_WRITEONLY AM_BASE_MEMBER(homedata_state, vreg)
|
||||
AM_RANGE(0x7ffe, 0x7ffe) AM_WRITE(reikaids_blitter_bank_w)
|
||||
AM_RANGE(0x7fff, 0x7fff) AM_WRITE(reikaids_blitter_start_w)
|
||||
AM_RANGE(0x8000, 0x8000) AM_WRITE(bankswitch_w)
|
||||
@ -633,14 +618,14 @@ ADDRESS_MAP_END
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( pteacher_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x3fff) AM_RAM_WRITE(pteacher_videoram_w) AM_BASE_GENERIC(videoram)
|
||||
AM_RANGE(0x0000, 0x3fff) AM_RAM_WRITE(pteacher_videoram_w) AM_BASE_MEMBER(homedata_state, videoram)
|
||||
AM_RANGE(0x4000, 0x5eff) AM_RAM
|
||||
AM_RANGE(0x5f00, 0x5fff) AM_RAM
|
||||
AM_RANGE(0x6000, 0x6fff) AM_RAM /* work ram */
|
||||
AM_RANGE(0x7800, 0x7800) AM_RAM /* behaves as normal RAM */
|
||||
AM_RANGE(0x7801, 0x7801) AM_READ(pteacher_io_r) // vblank, visible page
|
||||
AM_RANGE(0x7ff2, 0x7ff2) AM_READ(pteacher_snd_r)
|
||||
AM_RANGE(0x7ff0, 0x7ffd) AM_WRITEONLY AM_BASE(&homedata_vreg)
|
||||
AM_RANGE(0x7ff0, 0x7ffd) AM_WRITEONLY AM_BASE_MEMBER(homedata_state, vreg)
|
||||
AM_RANGE(0x7fff, 0x7fff) AM_WRITE(pteacher_blitter_start_w)
|
||||
AM_RANGE(0x8000, 0x8000) AM_WRITE(bankswitch_w)
|
||||
AM_RANGE(0x8002, 0x8002) AM_WRITE(pteacher_snd_command_w)
|
||||
@ -773,7 +758,7 @@ static INPUT_PORTS_START( mjhokite )
|
||||
INPUT_PORTS_END
|
||||
|
||||
static INPUT_PORTS_START( reikaids )
|
||||
PORT_START("IN0") // IN0 - 0x7801
|
||||
PORT_START("IN0") // 0x7801
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1)
|
||||
@ -783,7 +768,7 @@ static INPUT_PORTS_START( reikaids )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) /* jump */
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
|
||||
|
||||
PORT_START("IN1") // IN1 - 0x7802
|
||||
PORT_START("IN1") // 0x7802
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2)
|
||||
@ -793,7 +778,7 @@ static INPUT_PORTS_START( reikaids )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) /* jump */
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
|
||||
|
||||
PORT_START("IN2") // IN2 - 0x7803
|
||||
PORT_START("IN2") // 0x7803
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_SPECIAL ) /* coprocessor status */
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_SPECIAL ) /* coprocessor data */
|
||||
PORT_BIT( 0x04, IP_ACTIVE_HIGH,IPT_SPECIAL ) /* vblank */
|
||||
@ -803,7 +788,7 @@ static INPUT_PORTS_START( reikaids )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
|
||||
PORT_START("DSW1") // DSW1
|
||||
PORT_START("DSW1")
|
||||
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Allow_Continue ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x01, DEF_STR( On ) )
|
||||
@ -827,7 +812,7 @@ static INPUT_PORTS_START( reikaids )
|
||||
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
|
||||
PORT_START("DSW2") // DSW2
|
||||
PORT_START("DSW2")
|
||||
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
|
||||
PORT_DIPSETTING( 0x03, DEF_STR( Easy ) )
|
||||
PORT_DIPSETTING( 0x02, DEF_STR( Normal ) )
|
||||
@ -1167,8 +1152,110 @@ GFXDECODE_END
|
||||
|
||||
|
||||
|
||||
static MACHINE_START( homedata )
|
||||
{
|
||||
homedata_state *state = (homedata_state *)machine->driver_data;
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
state->audiocpu = devtag_get_device(machine, "audiocpu");
|
||||
state->ym = devtag_get_device(machine, "ymsnd");
|
||||
state->sn = devtag_get_device(machine, "snsnd");
|
||||
state->dac = devtag_get_device(machine, "dac");
|
||||
|
||||
state_save_register_global(machine, state->visible_page);
|
||||
state_save_register_global(machine, state->flipscreen);
|
||||
state_save_register_global(machine, state->blitter_bank);
|
||||
state_save_register_global(machine, state->blitter_param_count);
|
||||
state_save_register_global_array(machine, state->blitter_param);
|
||||
state_save_register_global(machine, state->vblank);
|
||||
state_save_register_global(machine, state->sndbank);
|
||||
state_save_register_global(machine, state->keyb);
|
||||
state_save_register_global(machine, state->snd_command);
|
||||
}
|
||||
|
||||
static MACHINE_START( reikaids )
|
||||
{
|
||||
homedata_state *state = (homedata_state *)machine->driver_data;
|
||||
|
||||
MACHINE_START_CALL(homedata);
|
||||
|
||||
state_save_register_global(machine, state->upd7807_porta);
|
||||
state_save_register_global(machine, state->upd7807_portc);
|
||||
|
||||
state_save_register_global(machine, state->reikaids_which);
|
||||
state_save_register_global_array(machine, state->gfx_bank);
|
||||
}
|
||||
|
||||
static MACHINE_START( pteacher )
|
||||
{
|
||||
homedata_state *state = (homedata_state *)machine->driver_data;
|
||||
|
||||
MACHINE_START_CALL(homedata);
|
||||
|
||||
state_save_register_global(machine, state->upd7807_porta);
|
||||
state_save_register_global(machine, state->upd7807_portc);
|
||||
|
||||
state_save_register_global_array(machine, state->gfx_bank);
|
||||
state_save_register_global(machine, state->to_cpu);
|
||||
state_save_register_global(machine, state->from_cpu);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( homedata )
|
||||
{
|
||||
homedata_state *state = (homedata_state *)machine->driver_data;
|
||||
|
||||
state->visible_page = 0;
|
||||
state->flipscreen = 0;
|
||||
state->blitter_bank = 0;
|
||||
state->blitter_param_count = 0;
|
||||
state->blitter_param[0] = 0;
|
||||
state->blitter_param[1] = 0;
|
||||
state->blitter_param[2] = 0;
|
||||
state->blitter_param[3] = 0;
|
||||
state->vblank = 0;
|
||||
state->sndbank = 0;
|
||||
state->keyb = 0;
|
||||
state->snd_command = 0;
|
||||
}
|
||||
|
||||
static MACHINE_RESET( pteacher )
|
||||
{
|
||||
homedata_state *state = (homedata_state *)machine->driver_data;
|
||||
const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
|
||||
|
||||
/* on reset, ports are set as input (high impedance), therefore 0xff output */
|
||||
pteacher_upd7807_portc_w(space, 0, 0xff);
|
||||
|
||||
MACHINE_RESET_CALL(homedata);
|
||||
|
||||
state->upd7807_porta = 0;
|
||||
state->gfx_bank[0] = 0;
|
||||
state->gfx_bank[1] = 0;
|
||||
state->to_cpu = 0;
|
||||
state->from_cpu = 0;
|
||||
}
|
||||
|
||||
static MACHINE_RESET( reikaids )
|
||||
{
|
||||
homedata_state *state = (homedata_state *)machine->driver_data;
|
||||
const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
|
||||
|
||||
/* on reset, ports are set as input (high impedance), therefore 0xff output */
|
||||
reikaids_upd7807_portc_w(space, 0, 0xff);
|
||||
|
||||
MACHINE_RESET_CALL(homedata);
|
||||
|
||||
state->reikaids_which = state->priority; // state->priority is set in DRIVER_INIT
|
||||
state->upd7807_porta = 0;
|
||||
state->gfx_bank[0] = 0;
|
||||
state->gfx_bank[1] = 0; // this is not used by reikaids
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( mrokumei )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(homedata_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M6809, 16000000/4) /* 4MHz ? */
|
||||
MDRV_CPU_PROGRAM_MAP(mrokumei_map)
|
||||
@ -1178,6 +1265,9 @@ static MACHINE_DRIVER_START( mrokumei )
|
||||
MDRV_CPU_PROGRAM_MAP(mrokumei_sound_map)
|
||||
MDRV_CPU_IO_MAP(mrokumei_sound_io_map)
|
||||
|
||||
MDRV_MACHINE_START(homedata)
|
||||
MDRV_MACHINE_RESET(homedata)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(59)
|
||||
@ -1232,6 +1322,9 @@ static const UPD7810_CONFIG upd_config =
|
||||
|
||||
static MACHINE_DRIVER_START( reikaids )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(homedata_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M6809, 16000000/4) /* 4MHz ? */
|
||||
MDRV_CPU_PROGRAM_MAP(reikaids_map)
|
||||
@ -1245,7 +1338,8 @@ static MACHINE_DRIVER_START( reikaids )
|
||||
|
||||
MDRV_QUANTUM_TIME(HZ(30000)) // very high interleave required to sync for startup tests
|
||||
|
||||
MDRV_MACHINE_RESET(reikaids_upd7807)
|
||||
MDRV_MACHINE_START(reikaids)
|
||||
MDRV_MACHINE_RESET(reikaids)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
@ -1282,6 +1376,9 @@ MACHINE_DRIVER_END
|
||||
|
||||
static MACHINE_DRIVER_START( pteacher )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(homedata_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M6809, 16000000/4) /* 4MHz ? */
|
||||
MDRV_CPU_PROGRAM_MAP(pteacher_map)
|
||||
@ -1295,7 +1392,8 @@ static MACHINE_DRIVER_START( pteacher )
|
||||
|
||||
MDRV_QUANTUM_TIME(HZ(6000)) // should be enough
|
||||
|
||||
MDRV_MACHINE_RESET(pteacher_upd7807)
|
||||
MDRV_MACHINE_START(pteacher)
|
||||
MDRV_MACHINE_RESET(pteacher)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
@ -1785,29 +1883,31 @@ static DRIVER_INIT( mjikaga )
|
||||
|
||||
static DRIVER_INIT( reikaids )
|
||||
{
|
||||
homedata_priority=0;
|
||||
homedata_state *state = (homedata_state *)machine->driver_data;
|
||||
state->priority = 0;
|
||||
}
|
||||
|
||||
static DRIVER_INIT( battlcry )
|
||||
{
|
||||
homedata_priority=1; /* priority and initial value for bank write */
|
||||
homedata_state *state = (homedata_state *)machine->driver_data;
|
||||
state->priority = 1; /* priority and initial value for bank write */
|
||||
}
|
||||
|
||||
GAME( 1987, hourouki, 0, mrokumei, mjhokite, 0, ROT0, "Home Data", "Mahjong Hourouki Part 1 - Seisyun Hen (Japan)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1987, mhgaiden, 0, mrokumei, mjhokite, 0, ROT0, "Home Data", "Mahjong Hourouki Gaiden (Japan)", 0 )
|
||||
GAME( 1988, mjhokite, 0, mrokumei, mjhokite, 0, ROT0, "Home Data", "Mahjong Hourouki Okite (Japan)", 0 )
|
||||
GAME( 1988, mjclinic, 0, mrokumei, mjhokite, 0, ROT0, "Home Data", "Mahjong Clinic (Japan)", 0 )
|
||||
GAME( 1988, mrokumei, 0, mrokumei, mjhokite, 0, ROT0, "Home Data", "Mahjong Rokumeikan (Japan)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1987, hourouki, 0, mrokumei, mjhokite, 0, ROT0, "Home Data", "Mahjong Hourouki Part 1 - Seisyun Hen (Japan)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1987, mhgaiden, 0, mrokumei, mjhokite, 0, ROT0, "Home Data", "Mahjong Hourouki Gaiden (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1988, mjhokite, 0, mrokumei, mjhokite, 0, ROT0, "Home Data", "Mahjong Hourouki Okite (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1988, mjclinic, 0, mrokumei, mjhokite, 0, ROT0, "Home Data", "Mahjong Clinic (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1988, mrokumei, 0, mrokumei, mjhokite, 0, ROT0, "Home Data", "Mahjong Rokumeikan (Japan)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
|
||||
|
||||
GAME( 1988, reikaids, 0, reikaids, reikaids, reikaids, ROT0, "Home Data", "Reikai Doushi (Japan)", 0 )
|
||||
GAME( 1991, battlcry, 0, reikaids, battlcry, battlcry, ROT0, "Home Data", "Battlecry", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1989, mjkojink, 0, pteacher, pteacher, 0, ROT0, "Home Data", "Mahjong Kojinkyouju (Private Teacher) (Japan)", 0 )
|
||||
GAME( 1989, vitaminc, 0, pteacher, pteacher, 0, ROT0, "Home Data", "Mahjong Vitamin C (Japan)", 0 )
|
||||
GAME( 1989, mjyougo, 0, pteacher, pteacher, 0, ROT0, "Home Data", "Mahjong-yougo no Kisotairyoku (Japan)", 0 )
|
||||
GAME( 1991, mjkinjas, 0, mjkinjas, pteacher, 0, ROT0, "Home Data", "Mahjong Kinjirareta Asobi (Japan)", 0 )
|
||||
GAME( 1992?,jogakuen, 0, pteacher, jogakuen, jogakuen, ROT0, "Windom", "Mahjong Jogakuen (Japan)", 0 )
|
||||
GAME( 1988, reikaids, 0, reikaids, reikaids, reikaids, ROT0, "Home Data", "Reikai Doushi (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1991, battlcry, 0, reikaids, battlcry, battlcry, ROT0, "Home Data", "Battlecry", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1989, mjkojink, 0, pteacher, pteacher, 0, ROT0, "Home Data", "Mahjong Kojinkyouju (Private Teacher) (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1989, vitaminc, 0, pteacher, pteacher, 0, ROT0, "Home Data", "Mahjong Vitamin C (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1989, mjyougo, 0, pteacher, pteacher, 0, ROT0, "Home Data", "Mahjong-yougo no Kisotairyoku (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1991, mjkinjas, 0, mjkinjas, pteacher, 0, ROT0, "Home Data", "Mahjong Kinjirareta Asobi (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1992?,jogakuen, 0, pteacher, jogakuen, jogakuen, ROT0, "Windom", "Mahjong Jogakuen (Japan)", GAME_SUPPORTS_SAVE )
|
||||
|
||||
GAME( 1990, lemnangl, 0, lemnangl, pteacher, 0, ROT0, "Home Data", "Mahjong Lemon Angel (Japan)", 0 )
|
||||
GAME( 1991, mjprivat, 0, lemnangl, pteacher, 0, ROT0, "Matoba", "Mahjong Private (Japan)", 0 )
|
||||
GAME( 1990, lemnangl, 0, lemnangl, pteacher, 0, ROT0, "Home Data", "Mahjong Lemon Angel (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1991, mjprivat, 0, lemnangl, pteacher, 0, ROT0, "Matoba", "Mahjong Private (Japan)", GAME_SUPPORTS_SAVE )
|
||||
|
||||
GAME( 1991?,mjikaga, 0, lemnangl, mjikaga, mjikaga, ROT0, "Mitchell", "Mahjong Ikaga Desu ka (Japan)", GAME_IMPERFECT_SOUND )
|
||||
GAME( 1991?,mjikaga, 0, lemnangl, mjikaga, mjikaga, ROT0, "Mitchell", "Mahjong Ikaga Desu ka (Japan)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
|
@ -42,64 +42,58 @@ fix comms so it boots, it's a bit of a hack for hyperduel at the moment ;-)
|
||||
#include "sound/2413intf.h"
|
||||
#include "includes/hyprduel.h"
|
||||
|
||||
|
||||
static int blitter_bit;
|
||||
static int requested_int;
|
||||
static UINT16 *hyprduel_irq_enable;
|
||||
static int subcpu_resetline;
|
||||
static int cpu_trigger;
|
||||
static int int_num;
|
||||
|
||||
static UINT16 *sharedram1;
|
||||
static UINT16 *sharedram3;
|
||||
|
||||
/***************************************************************************
|
||||
Interrupts
|
||||
***************************************************************************/
|
||||
|
||||
static void update_irq_state( running_machine *machine )
|
||||
{
|
||||
int irq = requested_int & ~*hyprduel_irq_enable;
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
int irq = state->requested_int & ~*state->irq_enable;
|
||||
|
||||
cputag_set_input_line(machine, "maincpu", 3, (irq & int_num) ? ASSERT_LINE : CLEAR_LINE);
|
||||
cpu_set_input_line(state->maincpu, 3, (irq & state->int_num) ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static TIMER_CALLBACK( vblank_end_callback )
|
||||
{
|
||||
requested_int &= ~param;
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
state->requested_int &= ~param;
|
||||
}
|
||||
|
||||
static INTERRUPT_GEN( hyprduel_interrupt )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)device->machine->driver_data;
|
||||
int line = RASTER_LINES - cpu_getiloops(device);
|
||||
|
||||
if (line == RASTER_LINES)
|
||||
{
|
||||
requested_int |= 0x01; /* vblank */
|
||||
requested_int |= 0x20;
|
||||
state->requested_int |= 0x01; /* vblank */
|
||||
state->requested_int |= 0x20;
|
||||
cpu_set_input_line(device, 2, HOLD_LINE);
|
||||
/* the duration is a guess */
|
||||
timer_set(device->machine, ATTOTIME_IN_USEC(2500), NULL, 0x20, vblank_end_callback);
|
||||
} else {
|
||||
requested_int |= 0x12; /* hsync */
|
||||
}
|
||||
else
|
||||
state->requested_int |= 0x12; /* hsync */
|
||||
|
||||
update_irq_state(device->machine);
|
||||
}
|
||||
|
||||
static READ16_HANDLER( hyprduel_irq_cause_r )
|
||||
{
|
||||
return requested_int;
|
||||
hyprduel_state *state = (hyprduel_state *)space->machine->driver_data;
|
||||
return state->requested_int;
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( hyprduel_irq_cause_w )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)space->machine->driver_data;
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
if (data == int_num)
|
||||
requested_int &= ~(int_num & ~*hyprduel_irq_enable);
|
||||
if (data == state->int_num)
|
||||
state->requested_int &= ~(state->int_num & ~*state->irq_enable);
|
||||
else
|
||||
requested_int &= ~(data & *hyprduel_irq_enable);
|
||||
state->requested_int &= ~(data & *state->irq_enable);
|
||||
|
||||
update_irq_state(space->machine);
|
||||
}
|
||||
@ -108,30 +102,32 @@ static WRITE16_HANDLER( hyprduel_irq_cause_w )
|
||||
|
||||
static WRITE16_HANDLER( hyprduel_subcpu_control_w )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)space->machine->driver_data;
|
||||
|
||||
switch (data)
|
||||
{
|
||||
case 0x0d:
|
||||
case 0x0f:
|
||||
case 0x01:
|
||||
if (!subcpu_resetline)
|
||||
if (!state->subcpu_resetline)
|
||||
{
|
||||
cputag_set_input_line(space->machine, "sub", INPUT_LINE_RESET, ASSERT_LINE);
|
||||
subcpu_resetline = 1;
|
||||
cpu_set_input_line(state->subcpu, INPUT_LINE_RESET, ASSERT_LINE);
|
||||
state->subcpu_resetline = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x00:
|
||||
if (subcpu_resetline)
|
||||
if (state->subcpu_resetline)
|
||||
{
|
||||
cputag_set_input_line(space->machine, "sub", INPUT_LINE_RESET, CLEAR_LINE);
|
||||
subcpu_resetline = 0;
|
||||
cpu_set_input_line(state->subcpu, INPUT_LINE_RESET, CLEAR_LINE);
|
||||
state->subcpu_resetline = 0;
|
||||
}
|
||||
cpu_spinuntil_int(space->cpu);
|
||||
break;
|
||||
|
||||
case 0x0c:
|
||||
case 0x80:
|
||||
cputag_set_input_line(space->machine, "sub", 2, HOLD_LINE);
|
||||
cpu_set_input_line(state->subcpu, 2, HOLD_LINE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -139,25 +135,27 @@ static WRITE16_HANDLER( hyprduel_subcpu_control_w )
|
||||
|
||||
static READ16_HANDLER( hyprduel_cpusync_trigger1_r )
|
||||
{
|
||||
if (cpu_trigger == 1001)
|
||||
hyprduel_state *state = (hyprduel_state *)space->machine->driver_data;
|
||||
if (state->cpu_trigger == 1001)
|
||||
{
|
||||
cpuexec_trigger(space->machine, 1001);
|
||||
cpu_trigger = 0;
|
||||
state->cpu_trigger = 0;
|
||||
}
|
||||
|
||||
return sharedram1[0x000408/2 + offset];
|
||||
return state->sharedram1[0x000408 / 2 + offset];
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( hyprduel_cpusync_trigger1_w )
|
||||
{
|
||||
COMBINE_DATA(&sharedram1[0x00040e/2 + offset]);
|
||||
hyprduel_state *state = (hyprduel_state *)space->machine->driver_data;
|
||||
COMBINE_DATA(&state->sharedram1[0x00040e / 2 + offset]);
|
||||
|
||||
if (((sharedram1[0x00040e/2]<<16) + sharedram1[0x000410/2]) != 0x00)
|
||||
if (((state->sharedram1[0x00040e / 2] << 16) + state->sharedram1[0x000410 / 2]) != 0x00)
|
||||
{
|
||||
if (!cpu_trigger && !subcpu_resetline)
|
||||
if (!state->cpu_trigger && !state->subcpu_resetline)
|
||||
{
|
||||
cpu_spinuntil_trigger(space->cpu, 1001);
|
||||
cpu_trigger = 1001;
|
||||
state->cpu_trigger = 1001;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -165,35 +163,36 @@ static WRITE16_HANDLER( hyprduel_cpusync_trigger1_w )
|
||||
|
||||
static READ16_HANDLER( hyprduel_cpusync_trigger2_r )
|
||||
{
|
||||
if (cpu_trigger == 1002)
|
||||
hyprduel_state *state = (hyprduel_state *)space->machine->driver_data;
|
||||
if (state->cpu_trigger == 1002)
|
||||
{
|
||||
cpuexec_trigger(space->machine, 1002);
|
||||
cpu_trigger = 0;
|
||||
state->cpu_trigger = 0;
|
||||
}
|
||||
|
||||
return sharedram3[(0xfff34c - 0xfe4000)/2 + offset];
|
||||
return state->sharedram3[(0xfff34c - 0xfe4000) / 2 + offset];
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( hyprduel_cpusync_trigger2_w )
|
||||
{
|
||||
COMBINE_DATA(&sharedram1[0x000408/2 + offset]);
|
||||
hyprduel_state *state = (hyprduel_state *)space->machine->driver_data;
|
||||
COMBINE_DATA(&state->sharedram1[0x000408 / 2 + offset]);
|
||||
|
||||
if (ACCESSING_BITS_8_15)
|
||||
{
|
||||
if (!cpu_trigger && !subcpu_resetline)
|
||||
if (!state->cpu_trigger && !state->subcpu_resetline)
|
||||
{
|
||||
cpu_spinuntil_trigger(space->cpu, 1002);
|
||||
cpu_trigger = 1002;
|
||||
state->cpu_trigger = 1002;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static emu_timer *magerror_irq_timer;
|
||||
|
||||
static TIMER_CALLBACK( magerror_irq_callback )
|
||||
{
|
||||
cputag_set_input_line(machine, "sub", 1, HOLD_LINE);
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
cpu_set_input_line(state->subcpu, 1, HOLD_LINE);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -208,17 +207,18 @@ static TIMER_CALLBACK( magerror_irq_callback )
|
||||
that the blitter can readily use (which is a form of compression)
|
||||
*/
|
||||
|
||||
static UINT16 *hyprduel_rombank;
|
||||
|
||||
static READ16_HANDLER( hyprduel_bankedrom_r )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)space->machine->driver_data;
|
||||
UINT8 *ROM = memory_region(space->machine, "gfx1");
|
||||
size_t len = memory_region_length(space->machine, "gfx1");
|
||||
|
||||
offset = offset * 2 + 0x10000 * (*hyprduel_rombank);
|
||||
offset = offset * 2 + 0x10000 * (*state->rombank);
|
||||
|
||||
if ( offset < len ) return ((ROM[offset+0]<<8)+ROM[offset+1]);
|
||||
else return 0xffff;
|
||||
if (offset < len)
|
||||
return ((ROM[offset + 0] << 8) + ROM[offset + 1]);
|
||||
else
|
||||
return 0xffff;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -265,11 +265,10 @@ static READ16_HANDLER( hyprduel_bankedrom_r )
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static UINT16 *hyprduel_blitter_regs;
|
||||
|
||||
static TIMER_CALLBACK( hyprduel_blit_done )
|
||||
{
|
||||
requested_int |= 1 << blitter_bit;
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
state->requested_int |= 1 << state->blitter_bit;
|
||||
update_irq_state(machine);
|
||||
}
|
||||
|
||||
@ -292,19 +291,17 @@ INLINE void blt_write(const address_space *space, const int tmap, const offs_t o
|
||||
|
||||
static WRITE16_HANDLER( hyprduel_blitter_w )
|
||||
{
|
||||
COMBINE_DATA( &hyprduel_blitter_regs[offset] );
|
||||
hyprduel_state *state = (hyprduel_state *)space->machine->driver_data;
|
||||
COMBINE_DATA(&state->blitter_regs[offset]);
|
||||
|
||||
if (offset == 0xC/2)
|
||||
if (offset == 0xc / 2)
|
||||
{
|
||||
UINT8 *src = memory_region(space->machine, "gfx1");
|
||||
size_t src_len = memory_region_length(space->machine, "gfx1");
|
||||
|
||||
UINT32 tmap = (hyprduel_blitter_regs[ 0x00 / 2 ] << 16 ) +
|
||||
hyprduel_blitter_regs[ 0x02 / 2 ];
|
||||
UINT32 src_offs = (hyprduel_blitter_regs[ 0x04 / 2 ] << 16 ) +
|
||||
hyprduel_blitter_regs[ 0x06 / 2 ];
|
||||
UINT32 dst_offs = (hyprduel_blitter_regs[ 0x08 / 2 ] << 16 ) +
|
||||
hyprduel_blitter_regs[ 0x0a / 2 ];
|
||||
UINT32 tmap = (state->blitter_regs[0x00 / 2] << 16) + state->blitter_regs[0x02 / 2];
|
||||
UINT32 src_offs = (state->blitter_regs[0x04 / 2] << 16) + state->blitter_regs[0x06 / 2];
|
||||
UINT32 dst_offs = (state->blitter_regs[0x08 / 2] << 16) + state->blitter_regs[0x0a / 2];
|
||||
|
||||
int shift = (dst_offs & 0x80) ? 0 : 8;
|
||||
UINT16 mask = (dst_offs & 0x80) ? 0x00ff : 0xff00;
|
||||
@ -403,7 +400,7 @@ static WRITE16_HANDLER( hyprduel_blitter_w )
|
||||
{
|
||||
dst_offs += 0x100;
|
||||
dst_offs &= ~(0x100 - 1);
|
||||
dst_offs |= (0x100-1) & (hyprduel_blitter_regs[ 0x0a / 2 ] >> (7+1));
|
||||
dst_offs |= (0x100 - 1) & (state->blitter_regs[0x0a / 2] >> (7 + 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -428,34 +425,34 @@ static WRITE16_HANDLER( hyprduel_blitter_w )
|
||||
|
||||
static ADDRESS_MAP_START( hyprduel_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x07ffff) AM_ROM
|
||||
AM_RANGE(0x400000, 0x41ffff) AM_RAM_WRITE(hyprduel_vram_0_w) AM_BASE(&hyprduel_vram_0) /* Layer 0 */
|
||||
AM_RANGE(0x420000, 0x43ffff) AM_RAM_WRITE(hyprduel_vram_1_w) AM_BASE(&hyprduel_vram_1) /* Layer 1 */
|
||||
AM_RANGE(0x440000, 0x45ffff) AM_RAM_WRITE(hyprduel_vram_2_w) AM_BASE(&hyprduel_vram_2) /* Layer 2 */
|
||||
AM_RANGE(0x400000, 0x41ffff) AM_RAM_WRITE(hyprduel_vram_0_w) AM_BASE_MEMBER(hyprduel_state, vram_0) /* Layer 0 */
|
||||
AM_RANGE(0x420000, 0x43ffff) AM_RAM_WRITE(hyprduel_vram_1_w) AM_BASE_MEMBER(hyprduel_state, vram_1) /* Layer 1 */
|
||||
AM_RANGE(0x440000, 0x45ffff) AM_RAM_WRITE(hyprduel_vram_2_w) AM_BASE_MEMBER(hyprduel_state, vram_2) /* Layer 2 */
|
||||
AM_RANGE(0x460000, 0x46ffff) AM_READ(hyprduel_bankedrom_r) /* Banked ROM */
|
||||
AM_RANGE(0x470000, 0x473fff) AM_RAM_WRITE(hyprduel_paletteram_w) AM_BASE_GENERIC(paletteram) /* Palette */
|
||||
AM_RANGE(0x474000, 0x474fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) /* Sprites */
|
||||
AM_RANGE(0x470000, 0x473fff) AM_RAM_WRITE(hyprduel_paletteram_w) AM_BASE_MEMBER(hyprduel_state, paletteram) /* Palette */
|
||||
AM_RANGE(0x474000, 0x474fff) AM_RAM AM_BASE_SIZE_MEMBER(hyprduel_state, spriteram, spriteram_size) /* Sprites */
|
||||
AM_RANGE(0x475000, 0x477fff) AM_RAM /* only used memory test */
|
||||
AM_RANGE(0x478000, 0x4787ff) AM_RAM AM_BASE(&hyprduel_tiletable) AM_SIZE(&hyprduel_tiletable_size) /* Tiles Set */
|
||||
AM_RANGE(0x478840, 0x47884d) AM_WRITE(hyprduel_blitter_w) AM_BASE(&hyprduel_blitter_regs) /* Tiles Blitter */
|
||||
AM_RANGE(0x478860, 0x47886b) AM_WRITE(hyprduel_window_w) AM_BASE(&hyprduel_window) /* Tilemap Window */
|
||||
AM_RANGE(0x478870, 0x47887b) AM_RAM_WRITE(hyprduel_scrollreg_w) AM_BASE(&hyprduel_scroll) /* Scroll Regs */
|
||||
AM_RANGE(0x478000, 0x4787ff) AM_RAM AM_BASE_SIZE_MEMBER(hyprduel_state, tiletable, tiletable_size) /* Tiles Set */
|
||||
AM_RANGE(0x478840, 0x47884d) AM_WRITE(hyprduel_blitter_w) AM_BASE_MEMBER(hyprduel_state, blitter_regs) /* Tiles Blitter */
|
||||
AM_RANGE(0x478860, 0x47886b) AM_WRITE(hyprduel_window_w) AM_BASE_MEMBER(hyprduel_state, window) /* Tilemap Window */
|
||||
AM_RANGE(0x478870, 0x47887b) AM_RAM_WRITE(hyprduel_scrollreg_w) AM_BASE_MEMBER(hyprduel_state, scroll) /* Scroll Regs */
|
||||
AM_RANGE(0x47887c, 0x47887d) AM_WRITE(hyprduel_scrollreg_init_w)
|
||||
AM_RANGE(0x478880, 0x478881) AM_WRITENOP
|
||||
AM_RANGE(0x478890, 0x478891) AM_WRITENOP
|
||||
AM_RANGE(0x4788a0, 0x4788a1) AM_WRITENOP
|
||||
AM_RANGE(0x4788a2, 0x4788a3) AM_READWRITE(hyprduel_irq_cause_r, hyprduel_irq_cause_w) /* IRQ Cause,Acknowledge */
|
||||
AM_RANGE(0x4788a4, 0x4788a5) AM_RAM AM_BASE(&hyprduel_irq_enable) /* IRQ Enable */
|
||||
AM_RANGE(0x4788aa, 0x4788ab) AM_RAM AM_BASE(&hyprduel_rombank) /* Rom Bank */
|
||||
AM_RANGE(0x4788ac, 0x4788ad) AM_RAM AM_BASE(&hyprduel_screenctrl) /* Screen Control */
|
||||
AM_RANGE(0x479700, 0x479713) AM_RAM AM_BASE(&hyprduel_videoregs) /* Video Registers */
|
||||
AM_RANGE(0x4788a4, 0x4788a5) AM_RAM AM_BASE_MEMBER(hyprduel_state, irq_enable) /* IRQ Enable */
|
||||
AM_RANGE(0x4788aa, 0x4788ab) AM_RAM AM_BASE_MEMBER(hyprduel_state, rombank) /* Rom Bank */
|
||||
AM_RANGE(0x4788ac, 0x4788ad) AM_RAM AM_BASE_MEMBER(hyprduel_state, screenctrl) /* Screen Control */
|
||||
AM_RANGE(0x479700, 0x479713) AM_RAM AM_BASE_MEMBER(hyprduel_state, videoregs) /* Video Registers */
|
||||
AM_RANGE(0x800000, 0x800001) AM_WRITE(hyprduel_subcpu_control_w)
|
||||
AM_RANGE(0xc00000, 0xc07fff) AM_RAM AM_SHARE("share1") AM_BASE(&sharedram1)
|
||||
AM_RANGE(0xc00000, 0xc07fff) AM_RAM AM_SHARE("share1") AM_BASE_MEMBER(hyprduel_state, sharedram1)
|
||||
AM_RANGE(0xe00000, 0xe00001) AM_READ_PORT("SERVICE") AM_WRITENOP
|
||||
AM_RANGE(0xe00002, 0xe00003) AM_READ_PORT("DSW")
|
||||
AM_RANGE(0xe00004, 0xe00005) AM_READ_PORT("P1_P2")
|
||||
AM_RANGE(0xe00006, 0xe00007) AM_READ_PORT("SYSTEM")
|
||||
AM_RANGE(0xfe0000, 0xfe3fff) AM_RAM AM_SHARE("share2")
|
||||
AM_RANGE(0xfe4000, 0xffffff) AM_RAM AM_SHARE("share3") AM_BASE(&sharedram3)
|
||||
AM_RANGE(0xfe4000, 0xffffff) AM_RAM AM_SHARE("share3") AM_BASE_MEMBER(hyprduel_state, sharedram3)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( hyprduel_map2, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
@ -475,33 +472,33 @@ ADDRESS_MAP_END
|
||||
static ADDRESS_MAP_START( magerror_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x07ffff) AM_ROM
|
||||
AM_RANGE(0x400000, 0x400001) AM_WRITE(hyprduel_subcpu_control_w)
|
||||
AM_RANGE(0x800000, 0x81ffff) AM_RAM_WRITE(hyprduel_vram_0_w) AM_BASE(&hyprduel_vram_0) /* Layer 0 */
|
||||
AM_RANGE(0x820000, 0x83ffff) AM_RAM_WRITE(hyprduel_vram_1_w) AM_BASE(&hyprduel_vram_1) /* Layer 1 */
|
||||
AM_RANGE(0x840000, 0x85ffff) AM_RAM_WRITE(hyprduel_vram_2_w) AM_BASE(&hyprduel_vram_2) /* Layer 2 */
|
||||
AM_RANGE(0x800000, 0x81ffff) AM_RAM_WRITE(hyprduel_vram_0_w) AM_BASE_MEMBER(hyprduel_state, vram_0) /* Layer 0 */
|
||||
AM_RANGE(0x820000, 0x83ffff) AM_RAM_WRITE(hyprduel_vram_1_w) AM_BASE_MEMBER(hyprduel_state, vram_1) /* Layer 1 */
|
||||
AM_RANGE(0x840000, 0x85ffff) AM_RAM_WRITE(hyprduel_vram_2_w) AM_BASE_MEMBER(hyprduel_state, vram_2) /* Layer 2 */
|
||||
AM_RANGE(0x860000, 0x86ffff) AM_READ(hyprduel_bankedrom_r) /* Banked ROM */
|
||||
AM_RANGE(0x870000, 0x873fff) AM_RAM_WRITE(hyprduel_paletteram_w) AM_BASE_GENERIC(paletteram) /* Palette */
|
||||
AM_RANGE(0x874000, 0x874fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) /* Sprites */
|
||||
AM_RANGE(0x870000, 0x873fff) AM_RAM_WRITE(hyprduel_paletteram_w) AM_BASE_MEMBER(hyprduel_state, paletteram) /* Palette */
|
||||
AM_RANGE(0x874000, 0x874fff) AM_RAM AM_BASE_SIZE_MEMBER(hyprduel_state, spriteram, spriteram_size) /* Sprites */
|
||||
AM_RANGE(0x875000, 0x877fff) AM_RAM /* only used memory test */
|
||||
AM_RANGE(0x878000, 0x8787ff) AM_RAM AM_BASE(&hyprduel_tiletable) AM_SIZE(&hyprduel_tiletable_size) /* Tiles Set */
|
||||
AM_RANGE(0x878840, 0x87884d) AM_WRITE(hyprduel_blitter_w) AM_BASE(&hyprduel_blitter_regs) /* Tiles Blitter */
|
||||
AM_RANGE(0x878860, 0x87886b) AM_WRITE(hyprduel_window_w) AM_BASE(&hyprduel_window) /* Tilemap Window */
|
||||
AM_RANGE(0x878870, 0x87887b) AM_RAM_WRITE(hyprduel_scrollreg_w) AM_BASE(&hyprduel_scroll) /* Scroll Regs */
|
||||
AM_RANGE(0x878000, 0x8787ff) AM_RAM AM_BASE_SIZE_MEMBER(hyprduel_state, tiletable, tiletable_size) /* Tiles Set */
|
||||
AM_RANGE(0x878840, 0x87884d) AM_WRITE(hyprduel_blitter_w) AM_BASE_MEMBER(hyprduel_state, blitter_regs) /* Tiles Blitter */
|
||||
AM_RANGE(0x878860, 0x87886b) AM_WRITE(hyprduel_window_w) AM_BASE_MEMBER(hyprduel_state, window) /* Tilemap Window */
|
||||
AM_RANGE(0x878870, 0x87887b) AM_RAM_WRITE(hyprduel_scrollreg_w) AM_BASE_MEMBER(hyprduel_state, scroll) /* Scroll Regs */
|
||||
AM_RANGE(0x87887c, 0x87887d) AM_WRITE(hyprduel_scrollreg_init_w)
|
||||
AM_RANGE(0x878880, 0x878881) AM_WRITENOP
|
||||
AM_RANGE(0x878890, 0x878891) AM_WRITENOP
|
||||
AM_RANGE(0x8788a0, 0x8788a1) AM_WRITENOP
|
||||
AM_RANGE(0x8788a2, 0x8788a3) AM_READWRITE(hyprduel_irq_cause_r, hyprduel_irq_cause_w) /* IRQ Cause, Acknowledge */
|
||||
AM_RANGE(0x8788a4, 0x8788a5) AM_RAM AM_BASE(&hyprduel_irq_enable) /* IRQ Enable */
|
||||
AM_RANGE(0x8788aa, 0x8788ab) AM_RAM AM_BASE(&hyprduel_rombank) /* Rom Bank */
|
||||
AM_RANGE(0x8788ac, 0x8788ad) AM_RAM AM_BASE(&hyprduel_screenctrl) /* Screen Control */
|
||||
AM_RANGE(0x879700, 0x879713) AM_RAM AM_BASE(&hyprduel_videoregs) /* Video Registers */
|
||||
AM_RANGE(0xc00000, 0xc1ffff) AM_RAM AM_SHARE("share1") AM_BASE(&sharedram1)
|
||||
AM_RANGE(0x8788a4, 0x8788a5) AM_RAM AM_BASE_MEMBER(hyprduel_state, irq_enable) /* IRQ Enable */
|
||||
AM_RANGE(0x8788aa, 0x8788ab) AM_RAM AM_BASE_MEMBER(hyprduel_state, rombank) /* Rom Bank */
|
||||
AM_RANGE(0x8788ac, 0x8788ad) AM_RAM AM_BASE_MEMBER(hyprduel_state, screenctrl) /* Screen Control */
|
||||
AM_RANGE(0x879700, 0x879713) AM_RAM AM_BASE_MEMBER(hyprduel_state, videoregs) /* Video Registers */
|
||||
AM_RANGE(0xc00000, 0xc1ffff) AM_RAM AM_SHARE("share1") AM_BASE_MEMBER(hyprduel_state, sharedram1)
|
||||
AM_RANGE(0xe00000, 0xe00001) AM_READ_PORT("SERVICE") AM_WRITENOP
|
||||
AM_RANGE(0xe00002, 0xe00003) AM_READ_PORT("DSW")
|
||||
AM_RANGE(0xe00004, 0xe00005) AM_READ_PORT("P1_P2")
|
||||
AM_RANGE(0xe00006, 0xe00007) AM_READ_PORT("SYSTEM")
|
||||
AM_RANGE(0xfe0000, 0xfe3fff) AM_RAM AM_SHARE("share2")
|
||||
AM_RANGE(0xfe4000, 0xffffff) AM_RAM AM_SHARE("share3") AM_BASE(&sharedram3)
|
||||
AM_RANGE(0xfe4000, 0xffffff) AM_RAM AM_SHARE("share3") AM_BASE_MEMBER(hyprduel_state, sharedram3)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( magerror_map2, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
@ -519,27 +516,6 @@ ADDRESS_MAP_END
|
||||
Input Ports
|
||||
***************************************************************************/
|
||||
|
||||
#define JOY_LSB(_n_, _b1_, _b2_, _b3_, _b4_) \
|
||||
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(_n_) \
|
||||
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(_n_) \
|
||||
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(_n_) \
|
||||
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(_n_) \
|
||||
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_##_b1_ ) PORT_PLAYER(_n_) \
|
||||
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_##_b2_ ) PORT_PLAYER(_n_) \
|
||||
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_##_b3_ ) PORT_PLAYER(_n_) \
|
||||
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_##_b4_ ) PORT_PLAYER(_n_) \
|
||||
|
||||
#define JOY_MSB(_n_, _b1_, _b2_, _b3_, _b4_) \
|
||||
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(_n_) \
|
||||
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(_n_) \
|
||||
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(_n_) \
|
||||
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(_n_) \
|
||||
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_##_b1_ ) PORT_PLAYER(_n_) \
|
||||
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_##_b2_ ) PORT_PLAYER(_n_) \
|
||||
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_##_b3_ ) PORT_PLAYER(_n_) \
|
||||
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_##_b4_ ) PORT_PLAYER(_n_) \
|
||||
|
||||
|
||||
static INPUT_PORTS_START( hyprduel )
|
||||
PORT_START("SERVICE")
|
||||
PORT_SERVICE_NO_TOGGLE( 0x8000, IP_ACTIVE_LOW )
|
||||
@ -590,8 +566,22 @@ static INPUT_PORTS_START( hyprduel )
|
||||
PORT_BIT( 0xc000, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
|
||||
PORT_START("P1_P2")
|
||||
JOY_LSB(1, BUTTON1, BUTTON2, BUTTON3, UNKNOWN)
|
||||
JOY_MSB(2, BUTTON1, BUTTON2, BUTTON3, UNKNOWN)
|
||||
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
|
||||
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
|
||||
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
|
||||
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
|
||||
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
|
||||
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
|
||||
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
|
||||
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_PLAYER(1)
|
||||
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_PLAYER(2)
|
||||
|
||||
PORT_START("SYSTEM")
|
||||
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
|
||||
@ -607,45 +597,9 @@ static INPUT_PORTS_START( magerror )
|
||||
PORT_INCLUDE( hyprduel )
|
||||
|
||||
PORT_MODIFY("DSW")
|
||||
PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )
|
||||
PORT_DIPSETTING( 0x0001, DEF_STR( 4C_1C ) )
|
||||
PORT_DIPSETTING( 0x0002, DEF_STR( 3C_1C ) )
|
||||
PORT_DIPSETTING( 0x0003, DEF_STR( 2C_1C ) )
|
||||
PORT_DIPSETTING( 0x0007, DEF_STR( 1C_1C ) )
|
||||
PORT_DIPSETTING( 0x0006, DEF_STR( 1C_2C ) )
|
||||
PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) )
|
||||
PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
|
||||
PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) )
|
||||
PORT_DIPSETTING( 0x0008, DEF_STR( 4C_1C ) )
|
||||
PORT_DIPSETTING( 0x0010, DEF_STR( 3C_1C ) )
|
||||
PORT_DIPSETTING( 0x0018, DEF_STR( 2C_1C ) )
|
||||
PORT_DIPSETTING( 0x0038, DEF_STR( 1C_1C ) )
|
||||
PORT_DIPSETTING( 0x0030, DEF_STR( 1C_2C ) )
|
||||
PORT_DIPSETTING( 0x0028, DEF_STR( 1C_3C ) )
|
||||
PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
|
||||
PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) )
|
||||
PORT_DIPSETTING( 0x0040, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0080, 0x0080, "Start Up Mode" )
|
||||
PORT_DIPSETTING( 0x0080, "Game Mode" )
|
||||
PORT_DIPSETTING( 0x0000, "Test Mode" )
|
||||
PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
|
||||
PORT_DIPSETTING( 0x0100, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) )
|
||||
PORT_DIPSETTING( 0x0800, DEF_STR( Easy ) )
|
||||
PORT_DIPSETTING( 0x0c00, DEF_STR( Normal ) )
|
||||
PORT_DIPSETTING( 0x0400, DEF_STR( Hard ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Very_Hard ) )
|
||||
PORT_DIPNAME( 0x3000, 0x3000, DEF_STR( Lives ) )
|
||||
PORT_DIPSETTING( 0x2000, "2" )
|
||||
PORT_DIPSETTING( 0x3000, "3" )
|
||||
PORT_DIPSETTING( 0x1000, "4" )
|
||||
PORT_DIPSETTING( 0x0000, "5" )
|
||||
PORT_BIT( 0xc000, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
INPUT_PORTS_END
|
||||
|
||||
/***************************************************************************
|
||||
@ -669,7 +623,8 @@ GFXDECODE_END
|
||||
|
||||
static void sound_irq( const device_config *device, int state )
|
||||
{
|
||||
cputag_set_input_line(device->machine, "sub", 1, HOLD_LINE);
|
||||
hyprduel_state *hyprduel = (hyprduel_state *)device->machine->driver_data;
|
||||
cpu_set_input_line(hyprduel->subcpu, 1, HOLD_LINE);
|
||||
}
|
||||
|
||||
static const ym2151_interface ym2151_config =
|
||||
@ -683,23 +638,44 @@ static const ym2151_interface ym2151_config =
|
||||
|
||||
static MACHINE_RESET( hyprduel )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
|
||||
/* start with cpu2 halted */
|
||||
cputag_set_input_line(machine, "sub", INPUT_LINE_RESET, ASSERT_LINE);
|
||||
subcpu_resetline = 1;
|
||||
cpu_trigger = 0;
|
||||
state->subcpu_resetline = 1;
|
||||
state->cpu_trigger = 0;
|
||||
|
||||
requested_int = 0x00;
|
||||
blitter_bit = 2;
|
||||
*hyprduel_irq_enable = 0xff;
|
||||
state->requested_int = 0x00;
|
||||
state->blitter_bit = 2;
|
||||
*state->irq_enable = 0xff;
|
||||
}
|
||||
|
||||
static MACHINE_START( hyprduel )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
state->subcpu = devtag_get_device(machine, "sub");
|
||||
|
||||
state_save_register_global(machine, state->blitter_bit);
|
||||
state_save_register_global(machine, state->requested_int);
|
||||
state_save_register_global(machine, state->subcpu_resetline);
|
||||
state_save_register_global(machine, state->cpu_trigger);
|
||||
}
|
||||
|
||||
static MACHINE_START( magerror )
|
||||
{
|
||||
timer_adjust_periodic(magerror_irq_timer, attotime_zero, 0, ATTOTIME_IN_HZ(968)); /* tempo? */
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
|
||||
MACHINE_START_CALL(hyprduel);
|
||||
timer_adjust_periodic(state->magerror_irq_timer, attotime_zero, 0, ATTOTIME_IN_HZ(968)); /* tempo? */
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( hyprduel )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(hyprduel_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M68000,20000000/2) /* 10MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(hyprduel_map)
|
||||
@ -708,6 +684,7 @@ static MACHINE_DRIVER_START( hyprduel )
|
||||
MDRV_CPU_ADD("sub", M68000,20000000/2) /* 10MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(hyprduel_map2)
|
||||
|
||||
MDRV_MACHINE_START(hyprduel)
|
||||
MDRV_MACHINE_RESET(hyprduel)
|
||||
|
||||
/* video hardware */
|
||||
@ -743,6 +720,9 @@ MACHINE_DRIVER_END
|
||||
|
||||
static MACHINE_DRIVER_START( magerror )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(hyprduel_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M68000,20000000/2) /* 10MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(magerror_map)
|
||||
@ -767,7 +747,7 @@ static MACHINE_DRIVER_START( magerror )
|
||||
MDRV_GFXDECODE(14220)
|
||||
MDRV_PALETTE_LENGTH(8192)
|
||||
|
||||
MDRV_VIDEO_START(hyprduel_14220)
|
||||
MDRV_VIDEO_START(magerror_14220)
|
||||
MDRV_VIDEO_UPDATE(hyprduel)
|
||||
|
||||
/* sound hardware */
|
||||
@ -833,20 +813,11 @@ ROM_START( magerror )
|
||||
ROM_END
|
||||
|
||||
|
||||
static void savestate(running_machine *machine)
|
||||
{
|
||||
/* Set up save state */
|
||||
state_save_register_global(machine, blitter_bit);
|
||||
state_save_register_global(machine, requested_int);
|
||||
state_save_register_global(machine, subcpu_resetline);
|
||||
state_save_register_global(machine, cpu_trigger);
|
||||
state_save_register_global(machine, int_num);
|
||||
}
|
||||
|
||||
static DRIVER_INIT( hyprduel )
|
||||
{
|
||||
int_num = 0x02;
|
||||
savestate(machine);
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
|
||||
state->int_num = 0x02;
|
||||
|
||||
/* cpu synchronization (severe timings) */
|
||||
memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xc0040e, 0xc00411, 0, 0, hyprduel_cpusync_trigger1_w);
|
||||
@ -857,10 +828,10 @@ static DRIVER_INIT( hyprduel )
|
||||
|
||||
static DRIVER_INIT( magerror )
|
||||
{
|
||||
int_num = 0x01;
|
||||
savestate(machine);
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
|
||||
magerror_irq_timer = timer_alloc(machine, magerror_irq_callback, NULL);
|
||||
state->int_num = 0x01;
|
||||
state->magerror_irq_timer = timer_alloc(machine, magerror_irq_callback, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
32
src/mame/includes/glass.h
Normal file
32
src/mame/includes/glass.h
Normal file
@ -0,0 +1,32 @@
|
||||
/*************************************************************************
|
||||
|
||||
Glass
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _glass_state glass_state;
|
||||
struct _glass_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT16 * videoram;
|
||||
UINT16 * vregs;
|
||||
UINT16 * spriteram;
|
||||
// UINT16 * paletteram; // currently this uses generic palette handling
|
||||
|
||||
/* video-related */
|
||||
tilemap *pant[2];
|
||||
bitmap_t *screen_bitmap;
|
||||
|
||||
/* misc */
|
||||
int current_bit, current_command, cause_interrupt;
|
||||
int blitter_serial_buffer[5];
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/glass.c -----------*/
|
||||
|
||||
WRITE16_HANDLER( glass_vram_w );
|
||||
WRITE16_HANDLER( glass_blitter_w );
|
||||
|
||||
VIDEO_START( glass );
|
||||
VIDEO_UPDATE( glass );
|
@ -1,9 +1,42 @@
|
||||
/*----------- defined in video/homedata.c -----------*/
|
||||
|
||||
extern UINT8 *homedata_vreg;
|
||||
extern int homedata_visible_page;
|
||||
extern int homedata_priority;
|
||||
extern UINT8 reikaids_which;
|
||||
typedef struct _homedata_state homedata_state;
|
||||
struct _homedata_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * vreg;
|
||||
UINT8 * videoram;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap[2][4];
|
||||
int visible_page;
|
||||
int priority;
|
||||
UINT8 reikaids_which;
|
||||
int flipscreen;
|
||||
UINT8 gfx_bank[2]; // pteacher only uses the first one
|
||||
UINT8 blitter_bank;
|
||||
int blitter_param_count;
|
||||
UINT8 blitter_param[4]; /* buffers last 4 writes to 0x8006 */
|
||||
|
||||
|
||||
/* misc */
|
||||
int vblank;
|
||||
int sndbank;
|
||||
int keyb;
|
||||
int snd_command;
|
||||
int upd7807_porta, upd7807_portc;
|
||||
int to_cpu, from_cpu;
|
||||
|
||||
/* device */
|
||||
const device_config *maincpu;
|
||||
const device_config *audiocpu;
|
||||
const device_config *dac;
|
||||
const device_config *ym;
|
||||
const device_config *sn;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*----------- defined in video/homedata.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( mrokumei_videoram_w );
|
||||
WRITE8_HANDLER( reikaids_videoram_w );
|
||||
|
@ -2,15 +2,52 @@
|
||||
#define FIRST_VISIBLE_LINE 0
|
||||
#define LAST_VISIBLE_LINE 223
|
||||
|
||||
typedef struct _hyprduel_state hyprduel_state;
|
||||
struct _hyprduel_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT16 * videoregs;
|
||||
UINT16 * screenctrl;
|
||||
UINT16 * tiletable_old;
|
||||
UINT16 * tiletable;
|
||||
UINT16 * vram_0;
|
||||
UINT16 * vram_1;
|
||||
UINT16 * vram_2;
|
||||
UINT16 * window;
|
||||
UINT16 * scroll;
|
||||
UINT16 * rombank;
|
||||
UINT16 * blitter_regs;
|
||||
UINT16 * irq_enable;
|
||||
UINT16 * sharedram1;
|
||||
UINT16 * sharedram3;
|
||||
UINT16 * spriteram;
|
||||
UINT16 * paletteram;
|
||||
size_t tiletable_size;
|
||||
size_t spriteram_size;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap[3];
|
||||
UINT8 *empty_tiles;
|
||||
UINT8 *dirtyindex;
|
||||
int sprite_xoffs, sprite_yoffs, sprite_yoffs_sub;
|
||||
|
||||
/* misc */
|
||||
emu_timer *magerror_irq_timer;
|
||||
int blitter_bit;
|
||||
int requested_int;
|
||||
int subcpu_resetline;
|
||||
int cpu_trigger;
|
||||
int int_num;
|
||||
|
||||
/* devices */
|
||||
const device_config *maincpu;
|
||||
const device_config *subcpu;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*----------- defined in video/hyprduel.c -----------*/
|
||||
|
||||
extern UINT16 *hyprduel_videoregs;
|
||||
extern UINT16 *hyprduel_screenctrl;
|
||||
extern UINT16 *hyprduel_tiletable;
|
||||
extern size_t hyprduel_tiletable_size;
|
||||
extern UINT16 *hyprduel_vram_0, *hyprduel_vram_1, *hyprduel_vram_2;
|
||||
extern UINT16 *hyprduel_window;
|
||||
extern UINT16 *hyprduel_scroll;
|
||||
|
||||
WRITE16_HANDLER( hyprduel_paletteram_w );
|
||||
WRITE16_HANDLER( hyprduel_window_w );
|
||||
@ -19,6 +56,7 @@ WRITE16_HANDLER( hyprduel_vram_1_w );
|
||||
WRITE16_HANDLER( hyprduel_vram_2_w );
|
||||
WRITE16_HANDLER( hyprduel_scrollreg_w );
|
||||
WRITE16_HANDLER( hyprduel_scrollreg_init_w );
|
||||
VIDEO_START( hyprduel_14220 );
|
||||
VIDEO_UPDATE( hyprduel );
|
||||
|
||||
VIDEO_START( hyprduel_14220 );
|
||||
VIDEO_START( magerror_14220 );
|
||||
VIDEO_UPDATE( hyprduel );
|
||||
|
@ -7,17 +7,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
|
||||
UINT16 *glass_spriteram;
|
||||
UINT16 *glass_vregs;
|
||||
UINT16 *glass_videoram;
|
||||
|
||||
static tilemap *pant[2];
|
||||
static bitmap_t *screen_bitmap;
|
||||
|
||||
static int glass_blitter_serial_buffer[5];
|
||||
static int current_command = 0;
|
||||
int glass_current_bit = 0;
|
||||
#include "includes/glass.h"
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -43,8 +33,9 @@ int glass_current_bit = 0;
|
||||
|
||||
static TILE_GET_INFO( get_tile_info_glass_screen0 )
|
||||
{
|
||||
int data = glass_videoram[tile_index << 1];
|
||||
int data2 = glass_videoram[(tile_index << 1) + 1];
|
||||
glass_state *state = (glass_state *)machine->driver_data;
|
||||
int data = state->videoram[tile_index << 1];
|
||||
int data2 = state->videoram[(tile_index << 1) + 1];
|
||||
int code = ((data & 0x03) << 14) | ((data & 0x0fffc) >> 2);
|
||||
|
||||
SET_TILE_INFO(0, code, 0x20 + (data2 & 0x1f), TILE_FLIPYX((data2 & 0xc0) >> 6));
|
||||
@ -53,8 +44,9 @@ static TILE_GET_INFO( get_tile_info_glass_screen0 )
|
||||
|
||||
static TILE_GET_INFO( get_tile_info_glass_screen1 )
|
||||
{
|
||||
int data = glass_videoram[(0x1000/2) + (tile_index << 1)];
|
||||
int data2 = glass_videoram[(0x1000/2) + (tile_index << 1) + 1];
|
||||
glass_state *state = (glass_state *)machine->driver_data;
|
||||
int data = state->videoram[(0x1000 / 2) + (tile_index << 1)];
|
||||
int data2 = state->videoram[(0x1000 / 2) + (tile_index << 1) + 1];
|
||||
int code = ((data & 0x03) << 14) | ((data & 0x0fffc) >> 2);
|
||||
|
||||
SET_TILE_INFO(0, code, 0x20 + (data2 & 0x1f), TILE_FLIPYX((data2 & 0xc0) >> 6));
|
||||
@ -77,35 +69,40 @@ static TILE_GET_INFO( get_tile_info_glass_screen1 )
|
||||
|
||||
WRITE16_HANDLER( glass_blitter_w )
|
||||
{
|
||||
glass_blitter_serial_buffer[glass_current_bit] = data & 0x01;
|
||||
glass_current_bit++;
|
||||
glass_state *state = (glass_state *)space->machine->driver_data;
|
||||
state->blitter_serial_buffer[state->current_bit] = data & 0x01;
|
||||
state->current_bit++;
|
||||
|
||||
if (glass_current_bit == 5){
|
||||
current_command = (glass_blitter_serial_buffer[0] << 4) |
|
||||
(glass_blitter_serial_buffer[1] << 3) |
|
||||
(glass_blitter_serial_buffer[2] << 2) |
|
||||
(glass_blitter_serial_buffer[3] << 1) |
|
||||
(glass_blitter_serial_buffer[4] << 0);
|
||||
glass_current_bit = 0;
|
||||
if (state->current_bit == 5)
|
||||
{
|
||||
state->current_command = (state->blitter_serial_buffer[0] << 4) |
|
||||
(state->blitter_serial_buffer[1] << 3) |
|
||||
(state->blitter_serial_buffer[2] << 2) |
|
||||
(state->blitter_serial_buffer[3] << 1) |
|
||||
(state->blitter_serial_buffer[4] << 0);
|
||||
state->current_bit = 0;
|
||||
|
||||
/* fill the screen bitmap with the current picture */
|
||||
{
|
||||
int i, j;
|
||||
UINT8 *gfx = (UINT8 *)memory_region(space->machine, "gfx3");
|
||||
|
||||
gfx = gfx + (current_command & 0x07)*0x10000 + (current_command & 0x08)*0x10000 + 0x140;
|
||||
gfx = gfx + (state->current_command & 0x07) * 0x10000 + (state->current_command & 0x08) * 0x10000 + 0x140;
|
||||
|
||||
if ((current_command & 0x18) != 0){
|
||||
for (j = 0; j < 200; j++){
|
||||
for (i = 0; i < 320; i++){
|
||||
if ((state->current_command & 0x18) != 0)
|
||||
{
|
||||
for (j = 0; j < 200; j++)
|
||||
{
|
||||
for (i = 0; i < 320; i++)
|
||||
{
|
||||
int color = *gfx;
|
||||
gfx++;
|
||||
*BITMAP_ADDR16(screen_bitmap, j, i) = color & 0xff;
|
||||
*BITMAP_ADDR16(state->screen_bitmap, j, i) = color & 0xff;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bitmap_fill(screen_bitmap, 0, 0);
|
||||
}
|
||||
else
|
||||
bitmap_fill(state->screen_bitmap, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -118,8 +115,9 @@ WRITE16_HANDLER( glass_blitter_w )
|
||||
|
||||
WRITE16_HANDLER( glass_vram_w )
|
||||
{
|
||||
COMBINE_DATA(&glass_videoram[offset]);
|
||||
tilemap_mark_tile_dirty(pant[offset >> 11],((offset << 1) & 0x0fff) >> 2);
|
||||
glass_state *state = (glass_state *)space->machine->driver_data;
|
||||
COMBINE_DATA(&state->videoram[offset]);
|
||||
tilemap_mark_tile_dirty(state->pant[offset >> 11], ((offset << 1) & 0x0fff) >> 2);
|
||||
}
|
||||
|
||||
|
||||
@ -131,12 +129,15 @@ WRITE16_HANDLER( glass_vram_w )
|
||||
|
||||
VIDEO_START( glass )
|
||||
{
|
||||
pant[0] = tilemap_create(machine, get_tile_info_glass_screen0,tilemap_scan_rows,16,16,32,32);
|
||||
pant[1] = tilemap_create(machine, get_tile_info_glass_screen1,tilemap_scan_rows,16,16,32,32);
|
||||
screen_bitmap = auto_bitmap_alloc (machine, 320, 200, video_screen_get_format(machine->primary_screen));
|
||||
glass_state *state = (glass_state *)machine->driver_data;
|
||||
state->pant[0] = tilemap_create(machine, get_tile_info_glass_screen0, tilemap_scan_rows, 16, 16, 32, 32);
|
||||
state->pant[1] = tilemap_create(machine, get_tile_info_glass_screen1, tilemap_scan_rows, 16, 16, 32, 32);
|
||||
state->screen_bitmap = auto_bitmap_alloc (machine, 320, 200, video_screen_get_format(machine->primary_screen));
|
||||
|
||||
tilemap_set_transparent_pen(pant[0],0);
|
||||
tilemap_set_transparent_pen(pant[1],0);
|
||||
state_save_register_global_bitmap(machine, state->screen_bitmap);
|
||||
|
||||
tilemap_set_transparent_pen(state->pant[0], 0);
|
||||
tilemap_set_transparent_pen(state->pant[1], 0);
|
||||
}
|
||||
|
||||
|
||||
@ -165,15 +166,17 @@ VIDEO_START( glass )
|
||||
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
glass_state *state = (glass_state *)machine->driver_data;
|
||||
int i;
|
||||
const gfx_element *gfx = machine->gfx[0];
|
||||
|
||||
for (i = 3; i < (0x1000 - 6)/2; i += 4){
|
||||
int sx = glass_spriteram[i+2] & 0x01ff;
|
||||
int sy = (240 - (glass_spriteram[i] & 0x00ff)) & 0x00ff;
|
||||
int number = glass_spriteram[i+3];
|
||||
int color = (glass_spriteram[i+2] & 0x1e00) >> 9;
|
||||
int attr = (glass_spriteram[i] & 0xfe00) >> 9;
|
||||
for (i = 3; i < (0x1000 - 6) / 2; i += 4)
|
||||
{
|
||||
int sx = state->spriteram[i + 2] & 0x01ff;
|
||||
int sy = (240 - (state->spriteram[i] & 0x00ff)) & 0x00ff;
|
||||
int number = state->spriteram[i + 3];
|
||||
int color = (state->spriteram[i + 2] & 0x1e00) >> 9;
|
||||
int attr = (state->spriteram[i] & 0xfe00) >> 9;
|
||||
|
||||
int xflip = attr & 0x20;
|
||||
int yflip = attr & 0x40;
|
||||
@ -194,17 +197,18 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
VIDEO_UPDATE( glass )
|
||||
{
|
||||
glass_state *state = (glass_state *)screen->machine->driver_data;
|
||||
/* set scroll registers */
|
||||
tilemap_set_scrolly(pant[0], 0, glass_vregs[0]);
|
||||
tilemap_set_scrollx(pant[0], 0, glass_vregs[1] + 0x04);
|
||||
tilemap_set_scrolly(pant[1], 0, glass_vregs[2]);
|
||||
tilemap_set_scrollx(pant[1], 0, glass_vregs[3]);
|
||||
tilemap_set_scrolly(state->pant[0], 0, state->vregs[0]);
|
||||
tilemap_set_scrollx(state->pant[0], 0, state->vregs[1] + 0x04);
|
||||
tilemap_set_scrolly(state->pant[1], 0, state->vregs[2]);
|
||||
tilemap_set_scrollx(state->pant[1], 0, state->vregs[3]);
|
||||
|
||||
/* draw layers + sprites */
|
||||
bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
|
||||
copybitmap(bitmap,screen_bitmap,0,0,0x18,0x24,cliprect);
|
||||
tilemap_draw(bitmap,cliprect,pant[1],0,0);
|
||||
tilemap_draw(bitmap,cliprect,pant[0],0,0);
|
||||
copybitmap(bitmap, state->screen_bitmap, 0, 0, 0x18, 0x24, cliprect);
|
||||
tilemap_draw(bitmap, cliprect, state->pant[1], 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->pant[0], 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -57,30 +57,14 @@ Note: if MAME_DEBUG is defined, pressing Z with:
|
||||
#include "driver.h"
|
||||
#include "includes/hyprduel.h"
|
||||
|
||||
|
||||
/* Variables that driver has access to: */
|
||||
UINT16 *hyprduel_videoregs;
|
||||
UINT16 *hyprduel_screenctrl;
|
||||
UINT16 *hyprduel_tiletable;
|
||||
size_t hyprduel_tiletable_size;
|
||||
UINT16 *hyprduel_vram_0,*hyprduel_vram_1,*hyprduel_vram_2;
|
||||
UINT16 *hyprduel_window;
|
||||
UINT16 *hyprduel_scroll;
|
||||
|
||||
static UINT16 *hyprduel_tiletable_old;
|
||||
static UINT8 *dirtyindex;
|
||||
|
||||
static int hyprduel_sprite_xoffs;
|
||||
static int hyprduel_sprite_yoffs;
|
||||
static int hyprduel_sprite_yoffs_sub;
|
||||
|
||||
/***************************************************************************
|
||||
Palette GGGGGRRRRRBBBBBx
|
||||
***************************************************************************/
|
||||
|
||||
WRITE16_HANDLER( hyprduel_paletteram_w )
|
||||
{
|
||||
data = COMBINE_DATA(&space->machine->generic.paletteram.u16[offset]);
|
||||
hyprduel_state *state = (hyprduel_state *)space->machine->driver_data;
|
||||
data = COMBINE_DATA(&state->paletteram[offset]);
|
||||
palette_set_color_rgb(space->machine, offset, pal5bit(data >> 6), pal5bit(data >> 11), pal5bit(data >> 1));
|
||||
}
|
||||
|
||||
@ -106,9 +90,6 @@ WRITE16_HANDLER( hyprduel_paletteram_w )
|
||||
Tilemaps: Rendering
|
||||
***************************************************************************/
|
||||
|
||||
static tilemap *bg_tilemap[3];
|
||||
static UINT8 *empty_tiles;
|
||||
|
||||
/* A 2048 x 2048 virtual tilemap */
|
||||
|
||||
#define BIG_NX (0x100)
|
||||
@ -125,26 +106,26 @@ static UINT8 *empty_tiles;
|
||||
/* 8x8x4 tiles only */
|
||||
INLINE void get_tile_info( running_machine *machine, tile_data *tileinfo, int tile_index, int layer, UINT16 *vram)
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
UINT16 code;
|
||||
int table_index;
|
||||
UINT32 tile;
|
||||
|
||||
/* The actual tile index depends on the window */
|
||||
tile_index = ((tile_index / WIN_NX + hyprduel_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX +
|
||||
((tile_index % WIN_NX + hyprduel_window[layer * 2 + 1] / 8) % BIG_NX);
|
||||
tile_index = ((tile_index / WIN_NX + state->window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX +
|
||||
((tile_index % WIN_NX + state->window[layer * 2 + 1] / 8) % BIG_NX);
|
||||
|
||||
/* Fetch the code */
|
||||
code = vram[tile_index];
|
||||
|
||||
/* Use it as an index into the tiles set table */
|
||||
table_index = ((code & 0x1ff0) >> 4 ) * 2;
|
||||
tile = (hyprduel_tiletable[table_index + 0] << 16 ) +
|
||||
hyprduel_tiletable[table_index + 1];
|
||||
tile = (state->tiletable[table_index + 0] << 16) + state->tiletable[table_index + 1];
|
||||
|
||||
if (code & 0x8000) /* Special: draw a tile of a single color (i.e. not from the gfx ROMs) */
|
||||
{
|
||||
int _code = code & 0x000f;
|
||||
tileinfo->pen_data = empty_tiles + _code*16*16;
|
||||
tileinfo->pen_data = state->empty_tiles + _code * 16 * 16;
|
||||
tileinfo->palette_base = ((code & 0x0ff0)) + 0x1000;
|
||||
tileinfo->flags = 0;
|
||||
tileinfo->group = 0;
|
||||
@ -164,26 +145,26 @@ INLINE void get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_
|
||||
bits are high ($f,$1f,$2f etc) the tile is 8bpp, otherwise it's 4bpp */
|
||||
INLINE void get_tile_info_8bit( running_machine *machine, tile_data *tileinfo, int tile_index, int layer, UINT16 *vram )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
UINT16 code;
|
||||
int table_index;
|
||||
UINT32 tile;
|
||||
|
||||
/* The actual tile index depends on the window */
|
||||
tile_index = ((tile_index / WIN_NX + hyprduel_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX +
|
||||
((tile_index % WIN_NX + hyprduel_window[layer * 2 + 1] / 8) % BIG_NX);
|
||||
tile_index = ((tile_index / WIN_NX + state->window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX +
|
||||
((tile_index % WIN_NX + state->window[layer * 2 + 1] / 8) % BIG_NX);
|
||||
|
||||
/* Fetch the code */
|
||||
code = vram[tile_index];
|
||||
|
||||
/* Use it as an index into the tiles set table */
|
||||
table_index = ((code & 0x1ff0) >> 4) * 2;
|
||||
tile = (hyprduel_tiletable[table_index + 0] << 16 ) +
|
||||
hyprduel_tiletable[table_index + 1];
|
||||
tile = (state->tiletable[table_index + 0] << 16) + state->tiletable[table_index + 1];
|
||||
|
||||
if (code & 0x8000) /* Special: draw a tile of a single color (i.e. not from the gfx ROMs) */
|
||||
{
|
||||
int _code = code & 0x000f;
|
||||
tileinfo->pen_data = empty_tiles + _code*16*16;
|
||||
tileinfo->pen_data = state->empty_tiles + _code * 16 * 16;
|
||||
tileinfo->palette_base = ((code & 0x0ff0)) + 0x1000;
|
||||
tileinfo->flags = 0;
|
||||
tileinfo->group = 0;
|
||||
@ -212,26 +193,26 @@ INLINE void get_tile_info_8bit(running_machine *machine,tile_data *tileinfo,int
|
||||
bits are high ($f,$1f,$2f etc) the tile is 8bpp, otherwise it's 4bpp */
|
||||
INLINE void get_tile_info_16x16_8bit( running_machine *machine, tile_data *tileinfo, int tile_index, int layer, UINT16 *vram )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
UINT16 code;
|
||||
int table_index;
|
||||
UINT32 tile;
|
||||
|
||||
/* The actual tile index depends on the window */
|
||||
tile_index = ((tile_index / WIN_NX + hyprduel_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX +
|
||||
((tile_index % WIN_NX + hyprduel_window[layer * 2 + 1] / 8) % BIG_NX);
|
||||
tile_index = ((tile_index / WIN_NX + state->window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX +
|
||||
((tile_index % WIN_NX + state->window[layer * 2 + 1] / 8) % BIG_NX);
|
||||
|
||||
/* Fetch the code */
|
||||
code = vram[tile_index];
|
||||
|
||||
/* Use it as an index into the tiles set table */
|
||||
table_index = ((code & 0x1ff0) >> 4) * 2;
|
||||
tile = (hyprduel_tiletable[table_index + 0] << 16 ) +
|
||||
hyprduel_tiletable[table_index + 1];
|
||||
tile = (state->tiletable[table_index + 0] << 16) + state->tiletable[table_index + 1];
|
||||
|
||||
if (code & 0x8000) /* Special: draw a tile of a single color (i.e. not from the gfx ROMs) */
|
||||
{
|
||||
int _code = code & 0x000f;
|
||||
tileinfo->pen_data = empty_tiles + _code*16*16;
|
||||
tileinfo->pen_data = state->empty_tiles + _code * 16 * 16;
|
||||
tileinfo->palette_base = ((code & 0x0ff0)) + 0x1000;
|
||||
tileinfo->flags = 0;
|
||||
tileinfo->group = 0;
|
||||
@ -257,43 +238,72 @@ INLINE void get_tile_info_16x16_8bit(running_machine *machine,tile_data *tileinf
|
||||
}
|
||||
}
|
||||
|
||||
INLINE void hyprduel_vram_w(offs_t offset,UINT16 data,UINT16 mem_mask,int layer,UINT16 *vram)
|
||||
INLINE void hyprduel_vram_w( running_machine *machine, offs_t offset, UINT16 data, UINT16 mem_mask, int layer, UINT16 *vram )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
COMBINE_DATA(&vram[offset]);
|
||||
{
|
||||
/* Account for the window */
|
||||
int col = (offset % BIG_NX) - ((hyprduel_window[layer * 2 + 1] / 8) % BIG_NX);
|
||||
int row = (offset / BIG_NX) - ((hyprduel_window[layer * 2 + 0] / 8) % BIG_NY);
|
||||
if (col < -(BIG_NX-WIN_NX)) col += (BIG_NX-WIN_NX) + WIN_NX;
|
||||
if (row < -(BIG_NY-WIN_NY)) row += (BIG_NY-WIN_NY) + WIN_NY;
|
||||
if ( (col >= 0) && (col < WIN_NX) &&
|
||||
(row >= 0) && (row < WIN_NY) )
|
||||
int col = (offset % BIG_NX) - ((state->window[layer * 2 + 1] / 8) % BIG_NX);
|
||||
int row = (offset / BIG_NX) - ((state->window[layer * 2 + 0] / 8) % BIG_NY);
|
||||
if (col < -(BIG_NX-WIN_NX))
|
||||
col += (BIG_NX-WIN_NX) + WIN_NX;
|
||||
if (row < -(BIG_NY-WIN_NY))
|
||||
row += (BIG_NY-WIN_NY) + WIN_NY;
|
||||
if ((col >= 0) && (col < WIN_NX) && (row >= 0) && (row < WIN_NY))
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap[layer], row * WIN_NX + col);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static TILE_GET_INFO( get_tile_info_0_8bit )
|
||||
{
|
||||
tilemap_mark_tile_dirty(bg_tilemap[layer], row * WIN_NX + col );
|
||||
}
|
||||
}
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
get_tile_info_8bit(machine, tileinfo, tile_index, 0, state->vram_0);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_tile_info_1_8bit )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
get_tile_info_8bit(machine, tileinfo, tile_index, 1, state->vram_1);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_tile_info_2_8bit )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
get_tile_info_8bit(machine, tileinfo, tile_index, 2, state->vram_2);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_tile_info_0_8bit ) { get_tile_info_8bit(machine,tileinfo,tile_index,0,hyprduel_vram_0); }
|
||||
static TILE_GET_INFO( get_tile_info_1_8bit ) { get_tile_info_8bit(machine,tileinfo,tile_index,1,hyprduel_vram_1); }
|
||||
static TILE_GET_INFO( get_tile_info_2_8bit ) { get_tile_info_8bit(machine,tileinfo,tile_index,2,hyprduel_vram_2); }
|
||||
WRITE16_HANDLER( hyprduel_vram_0_w )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)space->machine->driver_data;
|
||||
hyprduel_vram_w(space->machine, offset, data, mem_mask, 0, state->vram_0);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( hyprduel_vram_0_w ) { hyprduel_vram_w(offset,data,mem_mask,0,hyprduel_vram_0); }
|
||||
WRITE16_HANDLER( hyprduel_vram_1_w ) { hyprduel_vram_w(offset,data,mem_mask,1,hyprduel_vram_1); }
|
||||
WRITE16_HANDLER( hyprduel_vram_2_w ) { hyprduel_vram_w(offset,data,mem_mask,2,hyprduel_vram_2); }
|
||||
WRITE16_HANDLER( hyprduel_vram_1_w )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)space->machine->driver_data;
|
||||
hyprduel_vram_w(space->machine, offset, data, mem_mask, 1, state->vram_1);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( hyprduel_vram_2_w )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)space->machine->driver_data;
|
||||
hyprduel_vram_w(space->machine, offset, data, mem_mask, 2, state->vram_2);
|
||||
}
|
||||
|
||||
|
||||
/* Dirty the relevant tilemap when its window changes */
|
||||
WRITE16_HANDLER( hyprduel_window_w )
|
||||
{
|
||||
UINT16 olddata = hyprduel_window[offset];
|
||||
UINT16 newdata = COMBINE_DATA( &hyprduel_window[offset] );
|
||||
hyprduel_state *state = (hyprduel_state *)space->machine->driver_data;
|
||||
UINT16 olddata = state->window[offset];
|
||||
UINT16 newdata = COMBINE_DATA(&state->window[offset]);
|
||||
if (newdata != olddata)
|
||||
{
|
||||
offset /= 2;
|
||||
tilemap_mark_all_tiles_dirty(bg_tilemap[offset]);
|
||||
tilemap_mark_all_tiles_dirty(state->bg_tilemap[offset]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -311,66 +321,85 @@ WRITE16_HANDLER( hyprduel_window_w )
|
||||
|
||||
static void alloc_empty_tiles( running_machine *machine )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
int code,i;
|
||||
|
||||
empty_tiles = auto_alloc_array(machine, UINT8, 16*16*16);
|
||||
state->empty_tiles = auto_alloc_array(machine, UINT8, 16*16*16);
|
||||
state_save_register_global_pointer(machine, state->empty_tiles, 16*16*16);
|
||||
|
||||
for (code = 0; code < 0x10; code++)
|
||||
for (i = 0; i < 16 * 16; i++)
|
||||
empty_tiles[16*16*code + i] = code;
|
||||
state->empty_tiles[16 * 16 * code + i] = code;
|
||||
}
|
||||
|
||||
|
||||
static STATE_POSTLOAD( hyprduel_postload )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
UINT16 wx = hyprduel_window[i * 2 + 1];
|
||||
UINT16 wy = hyprduel_window[i * 2 + 0];
|
||||
UINT16 wx = state->window[i * 2 + 1];
|
||||
UINT16 wy = state->window[i * 2 + 0];
|
||||
|
||||
tilemap_set_scrollx(bg_tilemap[i], 0, hyprduel_scroll[i * 2 + 1] - wx - (wx & 7));
|
||||
tilemap_set_scrolly(bg_tilemap[i], 0, hyprduel_scroll[i * 2 + 0] - wy - (wy & 7));
|
||||
tilemap_set_scrollx(state->bg_tilemap[i], 0, state->scroll[i * 2 + 1] - wx - (wx & 7));
|
||||
tilemap_set_scrolly(state->bg_tilemap[i], 0, state->scroll[i * 2 + 0] - wy - (wy & 7));
|
||||
|
||||
tilemap_mark_all_tiles_dirty(bg_tilemap[i]);
|
||||
tilemap_mark_all_tiles_dirty(state->bg_tilemap[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( common_14220 )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
alloc_empty_tiles(machine);
|
||||
state->tiletable_old = auto_alloc_array(machine, UINT16, state->tiletable_size / 2);
|
||||
state->dirtyindex = auto_alloc_array(machine, UINT8, state->tiletable_size / 4);
|
||||
|
||||
state_save_register_global_pointer(machine, state->tiletable_old, state->tiletable_size / 2);
|
||||
state_save_register_global_pointer(machine, state->dirtyindex, state->tiletable_size / 4);
|
||||
|
||||
state->bg_tilemap[0] = tilemap_create(machine, get_tile_info_0_8bit, tilemap_scan_rows, 8, 8, WIN_NX, WIN_NY);
|
||||
state->bg_tilemap[1] = tilemap_create(machine, get_tile_info_1_8bit, tilemap_scan_rows, 8, 8, WIN_NX, WIN_NY);
|
||||
state->bg_tilemap[2] = tilemap_create(machine, get_tile_info_2_8bit, tilemap_scan_rows, 8, 8, WIN_NX, WIN_NY);
|
||||
|
||||
tilemap_map_pen_to_layer(state->bg_tilemap[0], 0, 15, TILEMAP_PIXEL_TRANSPARENT);
|
||||
tilemap_map_pen_to_layer(state->bg_tilemap[0], 1, 255, TILEMAP_PIXEL_TRANSPARENT);
|
||||
|
||||
tilemap_map_pen_to_layer(state->bg_tilemap[1], 0, 15, TILEMAP_PIXEL_TRANSPARENT);
|
||||
tilemap_map_pen_to_layer(state->bg_tilemap[1], 1, 255, TILEMAP_PIXEL_TRANSPARENT);
|
||||
|
||||
tilemap_map_pen_to_layer(state->bg_tilemap[2], 0, 15, TILEMAP_PIXEL_TRANSPARENT);
|
||||
tilemap_map_pen_to_layer(state->bg_tilemap[2], 1, 255, TILEMAP_PIXEL_TRANSPARENT);
|
||||
|
||||
tilemap_set_scrolldx(state->bg_tilemap[0], 0, 0);
|
||||
tilemap_set_scrolldx(state->bg_tilemap[1], 0, 0);
|
||||
tilemap_set_scrolldx(state->bg_tilemap[2], 0, 0);
|
||||
|
||||
/* Set up save state */
|
||||
state_save_register_global(machine, state->sprite_xoffs);
|
||||
state_save_register_global(machine, state->sprite_yoffs);
|
||||
state_save_register_postload(machine, hyprduel_postload, NULL);
|
||||
}
|
||||
|
||||
VIDEO_START( hyprduel_14220 )
|
||||
{
|
||||
alloc_empty_tiles(machine);
|
||||
hyprduel_tiletable_old = auto_alloc_array(machine, UINT16, hyprduel_tiletable_size/2);
|
||||
dirtyindex = auto_alloc_array(machine, UINT8, hyprduel_tiletable_size/4);
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
|
||||
bg_tilemap[0] = tilemap_create(machine, get_tile_info_0_8bit,tilemap_scan_rows,8,8,WIN_NX,WIN_NY);
|
||||
bg_tilemap[1] = tilemap_create(machine, get_tile_info_1_8bit,tilemap_scan_rows,8,8,WIN_NX,WIN_NY);
|
||||
bg_tilemap[2] = tilemap_create(machine, get_tile_info_2_8bit,tilemap_scan_rows,8,8,WIN_NX,WIN_NY);
|
||||
state->sprite_yoffs_sub = 2;
|
||||
|
||||
tilemap_map_pen_to_layer(bg_tilemap[0], 0, 15, TILEMAP_PIXEL_TRANSPARENT);
|
||||
tilemap_map_pen_to_layer(bg_tilemap[0], 1, 255, TILEMAP_PIXEL_TRANSPARENT);
|
||||
VIDEO_START_CALL(common_14220);
|
||||
}
|
||||
|
||||
tilemap_map_pen_to_layer(bg_tilemap[1], 0, 15, TILEMAP_PIXEL_TRANSPARENT);
|
||||
tilemap_map_pen_to_layer(bg_tilemap[1], 1, 255, TILEMAP_PIXEL_TRANSPARENT);
|
||||
VIDEO_START( magerror_14220 )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
|
||||
tilemap_map_pen_to_layer(bg_tilemap[2], 0, 15, TILEMAP_PIXEL_TRANSPARENT);
|
||||
tilemap_map_pen_to_layer(bg_tilemap[2], 1, 255, TILEMAP_PIXEL_TRANSPARENT);
|
||||
state->sprite_yoffs_sub = 0;
|
||||
|
||||
tilemap_set_scrolldx(bg_tilemap[0], 0, 0);
|
||||
tilemap_set_scrolldx(bg_tilemap[1], 0, 0);
|
||||
tilemap_set_scrolldx(bg_tilemap[2], 0, 0);
|
||||
|
||||
if (!strcmp(machine->gamedrv->name, "magerror"))
|
||||
hyprduel_sprite_yoffs_sub = 0;
|
||||
else
|
||||
hyprduel_sprite_yoffs_sub = 2;
|
||||
|
||||
/* Set up save state */
|
||||
state_save_register_global(machine, hyprduel_sprite_xoffs);
|
||||
state_save_register_global(machine, hyprduel_sprite_yoffs);
|
||||
state_save_register_global(machine, hyprduel_sprite_yoffs_sub);
|
||||
state_save_register_postload(machine, hyprduel_postload, NULL);
|
||||
VIDEO_START_CALL(common_14220);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -432,16 +461,17 @@ VIDEO_START( hyprduel_14220 )
|
||||
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
UINT8 *base_gfx = memory_region(machine, "gfx1");
|
||||
UINT8 *gfx_max = base_gfx + memory_region_length(machine, "gfx1");
|
||||
|
||||
int max_x = video_screen_get_width(machine->primary_screen);
|
||||
int max_y = video_screen_get_height(machine->primary_screen);
|
||||
|
||||
int max_sprites = machine->generic.spriteram_size / 8;
|
||||
int sprites = hyprduel_videoregs[0x00/2] % max_sprites;
|
||||
int max_sprites = state->spriteram_size / 8;
|
||||
int sprites = state->videoregs[0x00 / 2] % max_sprites;
|
||||
|
||||
int color_start = ((hyprduel_videoregs[0x08/2] & 0xf) << 4 ) + 0x100;
|
||||
int color_start = ((state->videoregs[0x08 / 2] & 0xf) << 4) + 0x100;
|
||||
|
||||
int i, j, pri;
|
||||
static const int primask[4] = { 0x0000, 0xff00, 0xff00|0xf0f0, 0xff00|0xf0f0|0xcccc };
|
||||
@ -456,12 +486,12 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
{
|
||||
gfx_element gfx;
|
||||
|
||||
if (!(hyprduel_videoregs[0x02/2] & 0x8000))
|
||||
if (!(state->videoregs[0x02 / 2] & 0x8000))
|
||||
{
|
||||
src = machine->generic.spriteram.u16 + (sprites - 1) * (8/2);
|
||||
src = state->spriteram + (sprites - 1) * (8 / 2);
|
||||
inc = -(8 / 2);
|
||||
} else {
|
||||
src = machine->generic.spriteram.u16;
|
||||
src = state->spriteram;
|
||||
inc = (8 / 2);
|
||||
}
|
||||
|
||||
@ -490,12 +520,12 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
continue;
|
||||
}
|
||||
|
||||
pri = (hyprduel_videoregs[0x02/2] & 0x0300) >> 8;
|
||||
pri = (state->videoregs[0x02 / 2] & 0x0300) >> 8;
|
||||
|
||||
if (!(hyprduel_videoregs[0x02/2] & 0x8000))
|
||||
if (!(state->videoregs[0x02 / 2] & 0x8000))
|
||||
{
|
||||
if (curr_pri > (hyprduel_videoregs[0x02/2] & 0x1f))
|
||||
pri = (hyprduel_videoregs[0x02/2] & 0x0c00) >> 10;
|
||||
if (curr_pri > (state->videoregs[0x02 / 2] & 0x1f))
|
||||
pri = (state->videoregs[0x02 / 2] & 0x0c00) >> 10;
|
||||
}
|
||||
|
||||
y = src[1];
|
||||
@ -508,8 +538,8 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
zoom = zoomtable[(y & 0xfc00) >> 10] << (16 - 8);
|
||||
|
||||
x = (x & 0x07ff) - hyprduel_sprite_xoffs;
|
||||
y = (y & 0x03ff) - hyprduel_sprite_yoffs;
|
||||
x = (x & 0x07ff) - state->sprite_xoffs;
|
||||
y = (y & 0x03ff) - state->sprite_yoffs;
|
||||
|
||||
width = (((attr >> 11) & 0x7) + 1) * 8;
|
||||
height = (((attr >> 8) & 0x7) + 1) * 8;
|
||||
@ -572,37 +602,40 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
WRITE16_HANDLER( hyprduel_scrollreg_w )
|
||||
{
|
||||
UINT16 window = hyprduel_window[offset];
|
||||
hyprduel_state *state = (hyprduel_state *)space->machine->driver_data;
|
||||
UINT16 window = state->window[offset];
|
||||
|
||||
COMBINE_DATA(&hyprduel_scroll[offset]);
|
||||
COMBINE_DATA(&state->scroll[offset]);
|
||||
|
||||
if (offset & 0x01)
|
||||
tilemap_set_scrollx(bg_tilemap[offset / 2], 0, hyprduel_scroll[offset] - window - (window & 7));
|
||||
tilemap_set_scrollx(state->bg_tilemap[offset / 2], 0, state->scroll[offset] - window - (window & 7));
|
||||
else
|
||||
tilemap_set_scrolly(bg_tilemap[offset / 2], 0, hyprduel_scroll[offset] - window - (window & 7));
|
||||
tilemap_set_scrolly(state->bg_tilemap[offset / 2], 0, state->scroll[offset] - window - (window & 7));
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( hyprduel_scrollreg_init_w )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)space->machine->driver_data;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
UINT16 wx = hyprduel_window[i * 2 + 1];
|
||||
UINT16 wy = hyprduel_window[i * 2 + 0];
|
||||
UINT16 wx = state->window[i * 2 + 1];
|
||||
UINT16 wy = state->window[i * 2 + 0];
|
||||
|
||||
hyprduel_scroll[i * 2 + 1] = data;
|
||||
hyprduel_scroll[i * 2 + 0] = data;
|
||||
state->scroll[i * 2 + 1] = data;
|
||||
state->scroll[i * 2 + 0] = data;
|
||||
|
||||
tilemap_set_scrollx(bg_tilemap[i], 0, data - wx - (wx & 7));
|
||||
tilemap_set_scrolly(bg_tilemap[i], 0, data - wy - (wy & 7));
|
||||
tilemap_set_scrollx(state->bg_tilemap[i], 0, data - wx - (wx & 7));
|
||||
tilemap_set_scrolly(state->bg_tilemap[i], 0, data - wy - (wy & 7));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void draw_layers(bitmap_t *bitmap, const rectangle *cliprect, int pri, int layers_ctrl)
|
||||
static void draw_layers( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri, int layers_ctrl )
|
||||
{
|
||||
UINT16 layers_pri = hyprduel_videoregs[0x10/2];
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
UINT16 layers_pri = state->videoregs[0x10/2];
|
||||
int layer;
|
||||
|
||||
/* Draw all the layers with priority == pri */
|
||||
@ -611,26 +644,26 @@ static void draw_layers(bitmap_t *bitmap, const rectangle *cliprect, int pri, in
|
||||
if ( pri == ((layers_pri >> (layer*2)) & 3) )
|
||||
{
|
||||
if (layers_ctrl & (1 << layer)) // for debug
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap[layer], 0, 1<<(3-pri));
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap[layer], 0, 1 << (3 - pri));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Dirty tilemaps when the tiles set changes */
|
||||
static void dirty_tiles(int layer,UINT16 *vram)
|
||||
static void dirty_tiles( running_machine *machine, int layer, UINT16 *vram )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)machine->driver_data;
|
||||
int col, row;
|
||||
|
||||
for (row = 0; row < WIN_NY; row++)
|
||||
{
|
||||
for (col = 0; col < WIN_NX; col++)
|
||||
{
|
||||
int offset = (col + hyprduel_window[layer * 2 + 1] / 8) % BIG_NX +
|
||||
((row + hyprduel_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX;
|
||||
int offset = (col + state->window[layer * 2 + 1] / 8) % BIG_NX + ((row + state->window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX;
|
||||
UINT16 code = vram[offset];
|
||||
|
||||
if (!(code & 0x8000) && dirtyindex[(code & 0x1ff0) >> 4])
|
||||
tilemap_mark_tile_dirty(bg_tilemap[layer], row * WIN_NX + col );
|
||||
if (!(code & 0x8000) && state->dirtyindex[(code & 0x1ff0) >> 4])
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap[layer], row * WIN_NX + col);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -638,40 +671,41 @@ static void dirty_tiles(int layer,UINT16 *vram)
|
||||
|
||||
VIDEO_UPDATE( hyprduel )
|
||||
{
|
||||
hyprduel_state *state = (hyprduel_state *)screen->machine->driver_data;
|
||||
int i, pri, layers_ctrl = -1;
|
||||
UINT16 screenctrl = *hyprduel_screenctrl;
|
||||
UINT16 screenctrl = *state->screenctrl;
|
||||
|
||||
{
|
||||
int dirty = 0;
|
||||
|
||||
memset(dirtyindex,0,hyprduel_tiletable_size/4);
|
||||
for (i = 0;i < hyprduel_tiletable_size/4;i++)
|
||||
memset(state->dirtyindex, 0, state->tiletable_size / 4);
|
||||
for (i = 0; i < state->tiletable_size / 4; i++)
|
||||
{
|
||||
UINT32 tile_new = (hyprduel_tiletable[2*i + 0] << 16 ) + hyprduel_tiletable[2*i + 1];
|
||||
UINT32 tile_old = (hyprduel_tiletable_old[2*i + 0] << 16 ) + hyprduel_tiletable_old[2*i + 1];
|
||||
UINT32 tile_new = (state->tiletable[2 * i + 0] << 16 ) + state->tiletable[2 * i + 1];
|
||||
UINT32 tile_old = (state->tiletable_old[2 * i + 0] << 16 ) + state->tiletable_old[2 * i + 1];
|
||||
|
||||
if ((tile_new ^ tile_old) & 0x0fffffff)
|
||||
{
|
||||
dirtyindex[i] = 1;
|
||||
state->dirtyindex[i] = 1;
|
||||
dirty = 1;
|
||||
}
|
||||
}
|
||||
memcpy(hyprduel_tiletable_old,hyprduel_tiletable,hyprduel_tiletable_size);
|
||||
memcpy(state->tiletable_old, state->tiletable, state->tiletable_size);
|
||||
|
||||
if (dirty)
|
||||
{
|
||||
dirty_tiles(0,hyprduel_vram_0);
|
||||
dirty_tiles(1,hyprduel_vram_1);
|
||||
dirty_tiles(2,hyprduel_vram_2);
|
||||
dirty_tiles(screen->machine, 0, state->vram_0);
|
||||
dirty_tiles(screen->machine, 1, state->vram_1);
|
||||
dirty_tiles(screen->machine, 2, state->vram_2);
|
||||
}
|
||||
}
|
||||
|
||||
hyprduel_sprite_xoffs = hyprduel_videoregs[0x06/2] - video_screen_get_width(screen) / 2;
|
||||
hyprduel_sprite_yoffs = hyprduel_videoregs[0x04/2] - video_screen_get_height(screen) / 2 - hyprduel_sprite_yoffs_sub;
|
||||
state->sprite_xoffs = state->videoregs[0x06 / 2] - video_screen_get_width(screen) / 2;
|
||||
state->sprite_yoffs = state->videoregs[0x04 / 2] - video_screen_get_height(screen) / 2 - state->sprite_yoffs_sub;
|
||||
|
||||
/* The background color is selected by a register */
|
||||
bitmap_fill(screen->machine->priority_bitmap, cliprect, 0);
|
||||
bitmap_fill(bitmap,cliprect,((hyprduel_videoregs[0x12/2] & 0x0fff)) + 0x1000);
|
||||
bitmap_fill(bitmap, cliprect, ((state->videoregs[0x12 / 2] & 0x0fff)) + 0x1000);
|
||||
|
||||
/* Screen Control Register:
|
||||
|
||||
@ -684,7 +718,8 @@ VIDEO_UPDATE( hyprduel )
|
||||
---- ---- ---4 32--
|
||||
---- ---- ---- --1- ? Blank Screen
|
||||
---- ---- ---- ---0 Flip Screen */
|
||||
if (screenctrl & 2) return 0;
|
||||
if (screenctrl & 2)
|
||||
return 0;
|
||||
flip_screen_set(screen->machine, screenctrl & 1);
|
||||
|
||||
#if 0
|
||||
@ -695,17 +730,19 @@ if (input_code_pressed(screen->machine, KEYCODE_Z))
|
||||
if (input_code_pressed(screen->machine, KEYCODE_E)) msk |= 0x04;
|
||||
if (input_code_pressed(screen->machine, KEYCODE_A)) msk |= 0x08;
|
||||
if (msk != 0)
|
||||
{ bitmap_fill(bitmap,cliprect,0);
|
||||
layers_ctrl &= msk; }
|
||||
{
|
||||
bitmap_fill(bitmap, cliprect,0);
|
||||
layers_ctrl &= msk;
|
||||
}
|
||||
|
||||
popmessage("%x-%x-%x:%04x %04x %04x",
|
||||
hyprduel_videoregs[0x10/2]&3,(hyprduel_videoregs[0x10/2]&0xc)>>2,(hyprduel_videoregs[0x10/2]&0x30)>>4,
|
||||
hyprduel_videoregs[0x02/2],hyprduel_videoregs[0x08/2],
|
||||
*hyprduel_screenctrl);}
|
||||
state->videoregs[0x10/2]&3,(state->videoregs[0x10/2] & 0xc) >> 2, (state->videoregs[0x10/2] & 0x30) >> 4,
|
||||
state->videoregs[0x02/2], state->videoregs[0x08/2],
|
||||
*state->screenctrl);}
|
||||
#endif
|
||||
|
||||
for (pri = 3; pri >= 0; pri--)
|
||||
draw_layers(bitmap,cliprect,pri,layers_ctrl);
|
||||
draw_layers(screen->machine, bitmap, cliprect, pri, layers_ctrl);
|
||||
|
||||
if (layers_ctrl & 0x08)
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
|
Loading…
Reference in New Issue
Block a user