Added driver_data struct and save states to the following drivers: madmotor.c, mazerbla.c, mikie.c, mjsister.c, mogura.c, mole.c and momoko.c

This commit is contained in:
Fabio Priuli 2010-02-20 17:44:46 +00:00
parent 667c09cd28
commit c34df5727c
17 changed files with 1484 additions and 982 deletions

5
.gitattributes vendored
View File

@ -2625,6 +2625,7 @@ src/mame/includes/m79amb.h svneol=native#text/plain
src/mame/includes/m92.h svneol=native#text/plain
src/mame/includes/macrossp.h svneol=native#text/plain
src/mame/includes/madalien.h svneol=native#text/plain
src/mame/includes/madmotor.h svneol=native#text/plain
src/mame/includes/mainevt.h svneol=native#text/plain
src/mame/includes/malzak.h svneol=native#text/plain
src/mame/includes/mappy.h svneol=native#text/plain
@ -2645,11 +2646,13 @@ src/mame/includes/midvunit.h svneol=native#text/plain
src/mame/includes/midwunit.h svneol=native#text/plain
src/mame/includes/midyunit.h svneol=native#text/plain
src/mame/includes/midzeus.h svneol=native#text/plain
src/mame/includes/mikie.h svneol=native#text/plain
src/mame/includes/mitchell.h svneol=native#text/plain
src/mame/includes/mjkjidai.h svneol=native#text/plain
src/mame/includes/model1.h svneol=native#text/plain
src/mame/includes/model2.h svneol=native#text/plain
src/mame/includes/model3.h svneol=native#text/plain
src/mame/includes/momoko.h svneol=native#text/plain
src/mame/includes/moo.h svneol=native#text/plain
src/mame/includes/ms32.h svneol=native#text/plain
src/mame/includes/mugsmash.h svneol=native#text/plain
@ -3553,12 +3556,10 @@ src/mame/video/midzeus2.c svneol=native#text/plain
src/mame/video/mikie.c svneol=native#text/plain
src/mame/video/mitchell.c svneol=native#text/plain
src/mame/video/mjkjidai.c svneol=native#text/plain
src/mame/video/mjsister.c svneol=native#text/plain
src/mame/video/model1.c svneol=native#text/plain
src/mame/video/model2.c svneol=native#text/plain
src/mame/video/model2rd.c svneol=native#text/plain
src/mame/video/model3.c svneol=native#text/plain
src/mame/video/mole.c svneol=native#text/plain
src/mame/video/momoko.c svneol=native#text/plain
src/mame/video/moo.c svneol=native#text/plain
src/mame/video/mosaic.c svneol=native#text/plain

View File

@ -18,25 +18,18 @@
#include "sound/2203intf.h"
#include "sound/2151intf.h"
#include "sound/okim6295.h"
VIDEO_START( madmotor );
VIDEO_UPDATE( madmotor );
WRITE16_HANDLER( madmotor_pf1_data_w );
WRITE16_HANDLER( madmotor_pf2_data_w );
WRITE16_HANDLER( madmotor_pf3_data_w );
extern UINT16 *madmotor_pf1_rowscroll;
extern UINT16 *madmotor_pf1_data,*madmotor_pf2_data,*madmotor_pf3_data;
extern UINT16 *madmotor_pf1_control,*madmotor_pf2_control,*madmotor_pf3_control;
#include "includes/madmotor.h"
/******************************************************************************/
static WRITE16_HANDLER( madmotor_sound_w )
{
madmotor_state *state = (madmotor_state *)space->machine->driver_data;
if (ACCESSING_BITS_0_7)
{
soundlatch_w(space, 0, data & 0xff);
cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE);
cpu_set_input_line(state->audiocpu, 0, HOLD_LINE);
}
}
@ -45,17 +38,17 @@ static WRITE16_HANDLER( madmotor_sound_w )
static ADDRESS_MAP_START( madmotor_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_ROM
AM_RANGE(0x180000, 0x18001f) AM_WRITEONLY AM_BASE(&madmotor_pf1_control)
AM_RANGE(0x184000, 0x1847ff) AM_RAM AM_BASE(&madmotor_pf1_rowscroll)
AM_RANGE(0x188000, 0x189fff) AM_RAM_WRITE(madmotor_pf1_data_w) AM_BASE(&madmotor_pf1_data)
AM_RANGE(0x180000, 0x18001f) AM_WRITEONLY AM_BASE_MEMBER(madmotor_state, pf1_control)
AM_RANGE(0x184000, 0x1847ff) AM_RAM AM_BASE_MEMBER(madmotor_state, pf1_rowscroll)
AM_RANGE(0x188000, 0x189fff) AM_RAM_WRITE(madmotor_pf1_data_w) AM_BASE_MEMBER(madmotor_state, pf1_data)
AM_RANGE(0x18c000, 0x18c001) AM_NOP
AM_RANGE(0x190000, 0x19001f) AM_WRITEONLY AM_BASE(&madmotor_pf2_control)
AM_RANGE(0x198000, 0x1987ff) AM_RAM_WRITE(madmotor_pf2_data_w) AM_BASE(&madmotor_pf2_data)
AM_RANGE(0x190000, 0x19001f) AM_WRITEONLY AM_BASE_MEMBER(madmotor_state, pf2_control)
AM_RANGE(0x198000, 0x1987ff) AM_RAM_WRITE(madmotor_pf2_data_w) AM_BASE_MEMBER(madmotor_state, pf2_data)
AM_RANGE(0x19c000, 0x19c001) AM_READNOP
AM_RANGE(0x1a0000, 0x1a001f) AM_WRITEONLY AM_BASE(&madmotor_pf3_control)
AM_RANGE(0x1a4000, 0x1a4fff) AM_RAM_WRITE(madmotor_pf3_data_w) AM_BASE(&madmotor_pf3_data)
AM_RANGE(0x1a0000, 0x1a001f) AM_WRITEONLY AM_BASE_MEMBER(madmotor_state, pf3_control)
AM_RANGE(0x1a4000, 0x1a4fff) AM_RAM_WRITE(madmotor_pf3_data_w) AM_BASE_MEMBER(madmotor_state, pf3_data)
AM_RANGE(0x3e0000, 0x3e3fff) AM_RAM
AM_RANGE(0x3e8000, 0x3e87ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
AM_RANGE(0x3e8000, 0x3e87ff) AM_RAM AM_BASE_SIZE_MEMBER(madmotor_state, spriteram, spriteram_size)
AM_RANGE(0x3f0000, 0x3f07ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE_GENERIC(paletteram)
AM_RANGE(0x3f8002, 0x3f8003) AM_READ_PORT("P1_P2")
AM_RANGE(0x3f8004, 0x3f8005) AM_READ_PORT("DSW")
@ -221,7 +214,8 @@ GFXDECODE_END
static void sound_irq(running_device *device, int state)
{
cputag_set_input_line(device->machine, "audiocpu", 1, state); /* IRQ 2 */
madmotor_state *driver_state = (madmotor_state *)device->machine->driver_data;
cpu_set_input_line(driver_state->audiocpu, 1, state); /* IRQ 2 */
}
static const ym2151_interface ym2151_config =
@ -229,8 +223,28 @@ static const ym2151_interface ym2151_config =
sound_irq
};
static MACHINE_START( madmotor )
{
madmotor_state *state = (madmotor_state *)machine->driver_data;
state->maincpu = devtag_get_device(machine, "maincpu");
state->audiocpu = devtag_get_device(machine, "audiocpu");
state_save_register_global(machine, state->flipscreen);
}
static MACHINE_RESET( madmotor )
{
madmotor_state *state = (madmotor_state *)machine->driver_data;
state->flipscreen = 0;
}
static MACHINE_DRIVER_START( madmotor )
/* driver data */
MDRV_DRIVER_DATA(madmotor_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 12000000) /* Custom chip 59, 24 MHz crystal */
MDRV_CPU_PROGRAM_MAP(madmotor_map)
@ -239,6 +253,9 @@ static MACHINE_DRIVER_START( madmotor )
MDRV_CPU_ADD("audiocpu", H6280, 8053000/2) /* Custom chip 45, Crystal near CPU is 8.053 MHz */
MDRV_CPU_PROGRAM_MAP(sound_map)
MDRV_MACHINE_START(madmotor)
MDRV_MACHINE_RESET(madmotor)
/* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
@ -334,4 +351,4 @@ static DRIVER_INIT( madmotor )
/* The title screen is undated, but it's (c) 1989 Data East at 0xefa0 */
GAME( 1989, madmotor, 0, madmotor, madmotor, madmotor, ROT0, "Mitchell", "Mad Motor", 0 )
GAME( 1989, madmotor, 0, madmotor, madmotor, madmotor, ROT0, "Mitchell", "Mad Motor", GAME_SUPPORTS_SAVE )

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +1,17 @@
/***************************************************************************
Mikie memory map (preliminary)
Mikie memory map (preliminary)
driver by Allard Van Der Bas
driver by Allard Van Der Bas
MAIN BOARD:
2800-288f Sprite RAM (288f, not 287f - quite unusual)
3800-3bff Color RAM
3c00-3fff Video RAM
4000-5fff ROM (?)
5ff0 Watchdog (?)
6000-ffff ROM
MAIN BOARD:
2800-288f Sprite RAM (288f, not 287f - quite unusual)
3800-3bff Color RAM
3c00-3fff Video RAM
4000-5fff ROM (?)
5ff0 Watchdog (?)
6000-ffff ROM
***************************************************************************/
@ -21,43 +21,40 @@ MAIN BOARD:
#include "cpu/m6809/m6809.h"
#include "sound/sn76496.h"
#include "includes/konamipt.h"
#include "includes/mikie.h"
extern UINT8 *mikie_videoram;
extern UINT8 *mikie_colorram;
extern WRITE8_HANDLER( mikie_videoram_w );
extern WRITE8_HANDLER( mikie_colorram_w );
extern WRITE8_HANDLER( mikie_palettebank_w );
extern WRITE8_HANDLER( mikie_flipscreen_w );
#define MIKIE_TIMER_RATE 512
extern PALETTE_INIT( mikie );
extern VIDEO_START( mikie );
extern VIDEO_UPDATE( mikie );
#define XTAL 14318180
#define OSC 18432000
#define CLK XTAL/4
/* Read/Write Handlers */
/*************************************
*
* Memory handlers
*
*************************************/
static READ8_HANDLER( mikie_sh_timer_r )
{
int clock;
#define TIMER_RATE 512
clock = cpu_get_total_cycles(space->cpu) / TIMER_RATE;
int clock = cpu_get_total_cycles(space->cpu) / MIKIE_TIMER_RATE;
return clock;
}
static WRITE8_HANDLER( mikie_sh_irqtrigger_w )
{
static int last;
mikie_state *state = (mikie_state *)space->machine->driver_data;
if (last == 0 && data == 1)
if (state->last_irq == 0 && data == 1)
{
// setting bit 0 low then high triggers IRQ on the sound CPU
cputag_set_input_line_and_vector(space->machine, "audiocpu", 0, HOLD_LINE, 0xff);
cpu_set_input_line_and_vector(state->audiocpu, 0, HOLD_LINE, 0xff);
}
last = data;
state->last_irq = data;
}
static WRITE8_HANDLER( mikie_coin_counter_w )
@ -65,7 +62,11 @@ static WRITE8_HANDLER( mikie_coin_counter_w )
coin_counter_w(space->machine, offset, data);
}
/* Memory Maps */
/*************************************
*
* Address maps
*
*************************************/
static ADDRESS_MAP_START( mikie_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x00ff) AM_RAM
@ -82,10 +83,10 @@ static ADDRESS_MAP_START( mikie_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2403, 0x2403) AM_READ_PORT("DSW2")
AM_RANGE(0x2500, 0x2500) AM_READ_PORT("DSW0")
AM_RANGE(0x2501, 0x2501) AM_READ_PORT("DSW1")
AM_RANGE(0x2800, 0x288f) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
AM_RANGE(0x2800, 0x288f) AM_RAM AM_BASE_SIZE_MEMBER(mikie_state, spriteram, spriteram_size)
AM_RANGE(0x2890, 0x37ff) AM_RAM
AM_RANGE(0x3800, 0x3bff) AM_RAM_WRITE(mikie_colorram_w) AM_BASE(&mikie_colorram)
AM_RANGE(0x3c00, 0x3fff) AM_RAM_WRITE(mikie_videoram_w) AM_BASE(&mikie_videoram)
AM_RANGE(0x3800, 0x3bff) AM_RAM_WRITE(mikie_colorram_w) AM_BASE_MEMBER(mikie_state, colorram)
AM_RANGE(0x3c00, 0x3fff) AM_RAM_WRITE(mikie_videoram_w) AM_BASE_MEMBER(mikie_state, videoram)
AM_RANGE(0x4000, 0x5fff) AM_ROM // Machine checks for extra rom
AM_RANGE(0x6000, 0xffff) AM_ROM
ADDRESS_MAP_END
@ -103,7 +104,11 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xa003, 0xa003) AM_WRITENOP // ???
ADDRESS_MAP_END
/* Input Ports */
/*************************************
*
* Input ports
*
*************************************/
static INPUT_PORTS_START( mikie )
PORT_START("SYSTEM")
@ -152,7 +157,12 @@ static INPUT_PORTS_START( mikie )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
INPUT_PORTS_END
/* Graphics Layouts */
/*************************************
*
* Graphics definitions
*
*************************************/
static const gfx_layout charlayout =
{
@ -178,24 +188,44 @@ static const gfx_layout spritelayout =
128*8 /* every sprite takes 64 bytes */
};
/* Graphics Decode Information */
static GFXDECODE_START( mikie )
GFXDECODE_ENTRY( "gfx1", 0x0000, charlayout, 0, 16*8 )
GFXDECODE_ENTRY( "gfx2", 0x0000, spritelayout, 16*8*16, 16*8 )
GFXDECODE_ENTRY( "gfx2", 0x0001, spritelayout, 16*8*16, 16*8 )
GFXDECODE_END
/* Sound Interface */
#define XTAL 14318180
#define OSC 18432000
#define CLK XTAL/4
/*************************************
*
* Machine driver
*
*************************************/
/* Machine Driver */
static MACHINE_START( mikie )
{
mikie_state *state = (mikie_state *)machine->driver_data;
state->maincpu = devtag_get_device(machine, "maincpu");
state->audiocpu = devtag_get_device(machine, "audiocpu");
state_save_register_global(machine, state->palettebank);
state_save_register_global(machine, state->last_irq);
}
static MACHINE_RESET( mikie )
{
mikie_state *state = (mikie_state *)machine->driver_data;
state->palettebank = 0;
state->last_irq = 0;
}
static MACHINE_DRIVER_START( mikie )
// basic machine hardware
/* driver data */
MDRV_DRIVER_DATA(mikie_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M6809, OSC/12)
MDRV_CPU_PROGRAM_MAP(mikie_map)
MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
@ -203,8 +233,10 @@ static MACHINE_DRIVER_START( mikie )
MDRV_CPU_ADD("audiocpu", Z80, CLK)
MDRV_CPU_PROGRAM_MAP(sound_map)
// video hardware
MDRV_MACHINE_START(mikie)
MDRV_MACHINE_RESET(mikie)
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60.59)
MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
@ -219,7 +251,7 @@ static MACHINE_DRIVER_START( mikie )
MDRV_VIDEO_START(mikie)
MDRV_VIDEO_UPDATE(mikie)
// sound hardware
/* sound hardware */
// on the pcb there are 2x76489AN but SN76489 sounds correct in the locker room level (sound test 24)
MDRV_SPEAKER_STANDARD_MONO("mono")
@ -230,7 +262,11 @@ static MACHINE_DRIVER_START( mikie )
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
MACHINE_DRIVER_END
/* ROMs */
/*************************************
*
* ROM definition(s)
*
*************************************/
ROM_START( mikie )
ROM_REGION( 0x10000, "maincpu", 0 )
@ -310,8 +346,12 @@ ROM_START( mikiehs )
ROM_LOAD( "d18.f9", 0x0400, 0x0100, CRC(7396b374) SHA1(fedcc421a61d6623dc9c41b0a3e164efeb50ec7c) ) // sprite lookup table
ROM_END
/* Game Drivers */
/*************************************
*
* Game driver(s)
*
*************************************/
GAME( 1984, mikie, 0, mikie, mikie, 0, ROT270, "Konami", "Mikie", 0 )
GAME( 1984, mikiej, mikie, mikie, mikie, 0, ROT270, "Konami", "Shinnyuushain Tooru-kun", 0 )
GAME( 1984, mikiehs, mikie, mikie, mikie, 0, ROT270, "Konami", "Mikie (High School Graffiti)", 0 )
GAME( 1984, mikie, 0, mikie, mikie, 0, ROT270, "Konami", "Mikie", GAME_SUPPORTS_SAVE )
GAME( 1984, mikiej, mikie, mikie, mikie, 0, ROT270, "Konami", "Shinnyuushain Tooru-kun", GAME_SUPPORTS_SAVE )
GAME( 1984, mikiehs, mikie, mikie, mikie, 0, ROT270, "Konami", "Mikie (High School Graffiti)", GAME_SUPPORTS_SAVE )

View File

@ -1,6 +1,6 @@
/*****************************************************************************
Mahjong Sisters (c) 1986 Toa Plan
Mahjong Sisters (c) 1986 Toa Plan
Driver by Uki
@ -14,142 +14,262 @@ Mahjong Sisters (c) 1986 Toa Plan
#define MCLK 12000000
extern int mjsister_flip_screen;
extern int mjsister_video_enable;
extern int mjsister_screen_redraw;
extern int mjsister_vrambank;
extern int mjsister_colorbank;
typedef struct _mjsister_state mjsister_state;
struct _mjsister_state
{
/* memory pointers */
UINT8 * videoram0, *videoram1;
VIDEO_START( mjsister );
VIDEO_UPDATE( mjsister );
WRITE8_HANDLER( mjsister_videoram_w );
/* video-related */
bitmap_t *tmpbitmap0, *tmpbitmap1;
int flip_screen;
int video_enable;
int screen_redraw;
int vrambank;
int colorbank;
static int mjsister_input_sel1;
static int mjsister_input_sel2;
/* misc */
int input_sel1;
int input_sel2;
static int rombank0,rombank1;
int rombank0,rombank1;
static UINT32 dac_adr,dac_bank,dac_adr_s,dac_adr_e,dac_busy;
UINT32 dac_adr, dac_bank, dac_adr_s, dac_adr_e, dac_busy;
/****************************************************************************/
/* devices */
running_device *maincpu;
running_device *dac;
};
/*************************************
*
* Video emulation
*
*************************************/
static VIDEO_START( mjsister )
{
mjsister_state *state = (mjsister_state *)machine->driver_data;
state->tmpbitmap0 = auto_bitmap_alloc(machine, 256, 256, video_screen_get_format(machine->primary_screen));
state->tmpbitmap1 = auto_bitmap_alloc(machine, 256, 256, video_screen_get_format(machine->primary_screen));
state->videoram0 = auto_alloc_array(machine, UINT8, 0x8000);
state->videoram1 = auto_alloc_array(machine, UINT8, 0x8000);
state_save_register_global_pointer(machine, state->videoram0, 0x8000);
state_save_register_global_pointer(machine, state->videoram1, 0x8000);
}
static void mjsister_plot0( running_machine *machine, int offset, UINT8 data )
{
mjsister_state *state = (mjsister_state *)machine->driver_data;
int x, y, c1, c2;
x = offset & 0x7f;
y = offset / 0x80;
c1 = (data & 0x0f) + state->colorbank * 0x20;
c2 = ((data & 0xf0) >> 4) + state->colorbank * 0x20;
*BITMAP_ADDR16(state->tmpbitmap0, y, x * 2 + 0) = c1;
*BITMAP_ADDR16(state->tmpbitmap0, y, x * 2 + 1) = c2;
}
static void mjsister_plot1( running_machine *machine, int offset, UINT8 data )
{
mjsister_state *state = (mjsister_state *)machine->driver_data;
int x, y, c1, c2;
x = offset & 0x7f;
y = offset / 0x80;
c1 = data & 0x0f;
c2 = (data & 0xf0) >> 4;
if (c1)
c1 += state->colorbank * 0x20 + 0x10;
if (c2)
c2 += state->colorbank * 0x20 + 0x10;
*BITMAP_ADDR16(state->tmpbitmap1, y, x * 2 + 0) = c1;
*BITMAP_ADDR16(state->tmpbitmap1, y, x * 2 + 1) = c2;
}
static WRITE8_HANDLER( mjsister_videoram_w )
{
mjsister_state *state = (mjsister_state *)space->machine->driver_data;
if (state->vrambank)
{
state->videoram1[offset] = data;
mjsister_plot1(space->machine, offset, data);
}
else
{
state->videoram0[offset] = data;
mjsister_plot0(space->machine, offset, data);
}
}
static VIDEO_UPDATE( mjsister )
{
mjsister_state *state = (mjsister_state *)screen->machine->driver_data;
int flip = state->flip_screen;
int i, j;
if (state->screen_redraw)
{
int offs;
for (offs = 0; offs < 0x8000; offs++)
{
mjsister_plot0(screen->machine, offs, state->videoram0[offs]);
mjsister_plot1(screen->machine, offs, state->videoram1[offs]);
}
state->screen_redraw = 0;
}
if (state->video_enable)
{
for (i = 0; i < 256; i++)
for (j = 0; j < 4; j++)
*BITMAP_ADDR16(bitmap, i, 256 + j) = state->colorbank * 0x20;
copybitmap(bitmap, state->tmpbitmap0, flip, flip, 0, 0, cliprect);
copybitmap_trans(bitmap, state->tmpbitmap1, flip, flip, 2, 0, cliprect, 0);
}
else
bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
return 0;
}
/*************************************
*
* Memory handlers
*
*************************************/
static TIMER_CALLBACK( dac_callback )
{
mjsister_state *state = (mjsister_state *)machine->driver_data;
UINT8 *DACROM = memory_region(machine, "samples");
dac_data_w(devtag_get_device(machine, "dac"),DACROM[(dac_bank * 0x10000 + dac_adr++) & 0x1ffff]);
dac_data_w(state->dac, DACROM[(state->dac_bank * 0x10000 + state->dac_adr++) & 0x1ffff]);
if (((dac_adr & 0xff00 ) >> 8) != dac_adr_e )
if (((state->dac_adr & 0xff00 ) >> 8) != state->dac_adr_e)
timer_set(machine, attotime_mul(ATTOTIME_IN_HZ(MCLK), 1024), NULL, 0, dac_callback);
else
dac_busy = 0;
state->dac_busy = 0;
}
static WRITE8_HANDLER( mjsister_dac_adr_s_w )
{
dac_adr_s = data;
mjsister_state *state = (mjsister_state *)space->machine->driver_data;
state->dac_adr_s = data;
}
static WRITE8_HANDLER( mjsister_dac_adr_e_w )
{
dac_adr_e = data;
dac_adr = dac_adr_s << 8;
mjsister_state *state = (mjsister_state *)space->machine->driver_data;
state->dac_adr_e = data;
state->dac_adr = state->dac_adr_s << 8;
if (dac_busy == 0)
timer_call_after_resynch(space->machine, NULL, 0,dac_callback);
if (state->dac_busy == 0)
timer_call_after_resynch(space->machine, NULL, 0, dac_callback);
dac_busy = 1;
}
static MACHINE_RESET( mjsister )
{
dac_busy = 0;
state->dac_busy = 1;
}
static WRITE8_HANDLER( mjsister_banksel1_w )
{
UINT8 *BANKROM = memory_region(space->machine, "maincpu");
int tmp = mjsister_colorbank;
mjsister_state *state = (mjsister_state *)space->machine->driver_data;
int tmp = state->colorbank;
switch (data)
{
case 0x0: rombank0 = 0 ; break;
case 0x1: rombank0 = 1 ; break;
case 0x0: state->rombank0 = 0 ; break;
case 0x1: state->rombank0 = 1 ; break;
case 0x2: mjsister_flip_screen = 0 ; break;
case 0x3: mjsister_flip_screen = 1 ; break;
case 0x2: state->flip_screen = 0 ; break;
case 0x3: state->flip_screen = 1 ; break;
case 0x4: mjsister_colorbank &=0xfe; break;
case 0x5: mjsister_colorbank |=0x01; break;
case 0x6: mjsister_colorbank &=0xfd; break;
case 0x7: mjsister_colorbank |=0x02; break;
case 0x8: mjsister_colorbank &=0xfb; break;
case 0x9: mjsister_colorbank |=0x04; break;
case 0x4: state->colorbank &= 0xfe; break;
case 0x5: state->colorbank |= 0x01; break;
case 0x6: state->colorbank &= 0xfd; break;
case 0x7: state->colorbank |= 0x02; break;
case 0x8: state->colorbank &= 0xfb; break;
case 0x9: state->colorbank |= 0x04; break;
case 0xa: mjsister_video_enable = 0 ; break;
case 0xb: mjsister_video_enable = 1 ; break;
case 0xa: state->video_enable = 0 ; break;
case 0xb: state->video_enable = 1 ; break;
case 0xe: mjsister_vrambank = 0 ; break;
case 0xf: mjsister_vrambank = 1 ; break;
case 0xe: state->vrambank = 0 ; break;
case 0xf: state->vrambank = 1 ; break;
default:
logerror("%04x p30_w:%02x\n",cpu_get_pc(space->cpu),data);
logerror("%04x p30_w:%02x\n", cpu_get_pc(space->cpu), data);
}
if (tmp != mjsister_colorbank)
mjsister_screen_redraw = 1;
if (tmp != state->colorbank)
state->screen_redraw = 1;
memory_set_bankptr(space->machine, "bank1",&BANKROM[rombank0*0x10000+rombank1*0x8000]+0x10000);
memory_set_bank(space->machine, "bank1", state->rombank0 * 2 + state->rombank1);
}
static WRITE8_HANDLER( mjsister_banksel2_w )
{
UINT8 *BANKROM = memory_region(space->machine, "maincpu");
mjsister_state *state = (mjsister_state *)space->machine->driver_data;
switch (data)
{
case 0xa: dac_bank = 0; break;
case 0xb: dac_bank = 1; break;
case 0xa: state->dac_bank = 0; break;
case 0xb: state->dac_bank = 1; break;
case 0xc: rombank1 = 0; break;
case 0xd: rombank1 = 1; break;
case 0xc: state->rombank1 = 0; break;
case 0xd: state->rombank1 = 1; break;
default:
logerror("%04x p31_w:%02x\n",cpu_get_pc(space->cpu),data);
logerror("%04x p31_w:%02x\n", cpu_get_pc(space->cpu), data);
}
memory_set_bankptr(space->machine, "bank1",&BANKROM[rombank0*0x10000+rombank1*0x8000]+0x10000);
memory_set_bank(space->machine, "bank1", state->rombank0 * 2 + state->rombank1);
}
static WRITE8_HANDLER( mjsister_input_sel1_w )
{
mjsister_input_sel1 = data;
mjsister_state *state = (mjsister_state *)space->machine->driver_data;
state->input_sel1 = data;
}
static WRITE8_HANDLER( mjsister_input_sel2_w )
{
mjsister_input_sel2 = data;
mjsister_state *state = (mjsister_state *)space->machine->driver_data;
state->input_sel2 = data;
}
static READ8_HANDLER( mjsister_keys_r )
{
int p,i,ret = 0;
mjsister_state *state = (mjsister_state *)space->machine->driver_data;
int p, i, ret = 0;
static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5" };
p = mjsister_input_sel1 & 0x3f;
// p |= ((mjsister_input_sel2 & 8) << 4) | ((mjsister_input_sel2 & 0x20) << 1);
p = state->input_sel1 & 0x3f;
// p |= ((state->input_sel2 & 8) << 4) | ((state->input_sel2 & 0x20) << 1);
for (i=0; i<6; i++)
for (i = 0; i < 6; i++)
{
if (p & (1 << i))
if (BIT(p, i))
ret |= input_port_read(space->machine, keynames[i]);
}
return ret;
}
/****************************************************************************/
/*************************************
*
* Address maps
*
*************************************/
static ADDRESS_MAP_START( mjsister_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x77ff) AM_ROM
@ -174,11 +294,14 @@ static ADDRESS_MAP_START( mjsister_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_END
/****************************************************************************/
/*************************************
*
* Input ports
*
*************************************/
static INPUT_PORTS_START( mjsister )
PORT_START("DSW1") /* DSW1 (0) */
PORT_START("DSW1")
PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
PORT_DIPSETTING( 0x03, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) )
@ -202,7 +325,7 @@ static INPUT_PORTS_START( mjsister )
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("DSW2") /* DSW2 (1) */
PORT_START("DSW2")
PORT_DIPNAME( 0x01, 0x01, "Unknown 2-1" )
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
@ -228,7 +351,7 @@ static INPUT_PORTS_START( mjsister )
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("IN0") /* (2) */
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN2 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* memory reset 1 */
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* analyzer */
@ -238,57 +361,61 @@ static INPUT_PORTS_START( mjsister )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* hopper */
PORT_START("KEY0") /* (3) PORT 1-0 */
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_MAHJONG_A )
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_B )
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_C )
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_D )
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_LAST_CHANCE )
PORT_START("KEY0")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_MAHJONG_A )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_B )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_C )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_D )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_LAST_CHANCE )
PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START("KEY1") /* (4) PORT 1-1 */
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_MAHJONG_E )
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_F )
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_G )
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_H )
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_SCORE )
PORT_START("KEY1")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_MAHJONG_E )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_F )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_G )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_H )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_SCORE )
PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START("KEY2") /* (5) PORT 1-2 */
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_MAHJONG_I )
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_J )
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_K )
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_L )
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_DOUBLE_UP )
PORT_START("KEY2")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_MAHJONG_I )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_J )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_K )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_L )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_DOUBLE_UP )
PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START("KEY3") /* (6) PORT 1-3 */
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_MAHJONG_M )
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_N )
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_CHI )
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_PON )
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_FLIP_FLOP )
PORT_START("KEY3")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_MAHJONG_M )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_N )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_CHI )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_PON )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_FLIP_FLOP )
PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START("KEY4") /* (7) PORT 1-4 */
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_MAHJONG_KAN )
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_REACH )
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_RON )
PORT_START("KEY4")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_MAHJONG_KAN )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_REACH )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_RON )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_BIG )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_BIG )
PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START("KEY5") /* (8) PORT 1-5 */
PORT_START("KEY5")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_BET )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_BET )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_SMALL )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_SMALL )
PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED )
INPUT_PORTS_END
/****************************************************************************/
/*************************************
*
* Sound interface
*
*************************************/
static const ay8910_interface ay8910_config =
{
@ -300,14 +427,79 @@ static const ay8910_interface ay8910_config =
DEVCB_NULL
};
/*************************************
*
* Machine driver
*
*************************************/
static STATE_POSTLOAD( mjsister_redraw )
{
mjsister_state *state = (mjsister_state *)machine->driver_data;
/* we can skip saving tmpbitmaps because we can redraw them from vram */
state->screen_redraw = 1;
}
static MACHINE_START( mjsister )
{
mjsister_state *state = (mjsister_state *)machine->driver_data;
UINT8 *ROM = memory_region(machine, "maincpu");
memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x8000);
state->maincpu = devtag_get_device(machine, "maincpu");
state->dac = devtag_get_device(machine, "dac");
state_save_register_global(machine, state->dac_busy);
state_save_register_global(machine, state->flip_screen);
state_save_register_global(machine, state->video_enable);
state_save_register_global(machine, state->vrambank);
state_save_register_global(machine, state->colorbank);
state_save_register_global(machine, state->input_sel1);
state_save_register_global(machine, state->input_sel2);
state_save_register_global(machine, state->rombank0);
state_save_register_global(machine, state->rombank1);
state_save_register_global(machine, state->dac_adr);
state_save_register_global(machine, state->dac_bank);
state_save_register_global(machine, state->dac_adr_s);
state_save_register_global(machine, state->dac_adr_e);
state_save_register_postload(machine, mjsister_redraw, 0);
}
static MACHINE_RESET( mjsister )
{
mjsister_state *state = (mjsister_state *)machine->driver_data;
state->dac_busy = 0;
state->flip_screen = 0;
state->video_enable = 0;
state->screen_redraw = 0;
state->vrambank = 0;
state->colorbank = 0;
state->input_sel1 = 0;
state->input_sel2 = 0;
state->rombank0 = 0;
state->rombank1 = 0;
state->dac_adr = 0;
state->dac_bank = 0;
state->dac_adr_s = 0;
state->dac_adr_e = 0;
}
static MACHINE_DRIVER_START( mjsister )
/* driver data */
MDRV_DRIVER_DATA(mjsister_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", Z80, MCLK/2) /* 6.000 MHz */
MDRV_CPU_PROGRAM_MAP(mjsister_map)
MDRV_CPU_IO_MAP(mjsister_io_map)
MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
MDRV_MACHINE_START(mjsister)
MDRV_MACHINE_RESET(mjsister)
/* video hardware */
@ -335,11 +527,11 @@ static MACHINE_DRIVER_START( mjsister )
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
/***************************************************************************
Game driver(s)
***************************************************************************/
/*************************************
*
* ROM definition(s)
*
*************************************/
ROM_START( mjsister )
ROM_REGION( 0x30000, "maincpu", 0 ) /* CPU */
@ -358,5 +550,11 @@ ROM_START( mjsister )
ROM_LOAD( "ms08.bpr", 0x0300, 0x0100, CRC(da2b3b38) SHA1(4de99c17b227653bc1b904f1309f447f5a0ab516) ) // ?
ROM_END
GAME( 1986, mjsister, 0, mjsister, mjsister, 0, ROT0, "Toaplan", "Mahjong Sisters (Japan)", 0 )
/*************************************
*
* Game driver(s)
*
*************************************/
GAME( 1986, mjsister, 0, mjsister, mjsister, 0, ROT0, "Toaplan", "Mahjong Sisters (Japan)", GAME_SUPPORTS_SAVE )

View File

@ -5,112 +5,129 @@
#include "sound/dac.h"
#include "includes/konamipt.h"
static UINT8 *mogura_tileram;
static UINT8* mogura_gfxram;
static tilemap_t *mogura_tilemap;
typedef struct _mogura_state mogura_state;
struct _mogura_state
{
/* memory pointers */
UINT8 * tileram;
UINT8 * gfxram;
/* video-related */
tilemap_t *tilemap;
/* devices */
running_device *maincpu;
running_device *dac1;
running_device *dac2;
};
static PALETTE_INIT( mogura )
{
int i,j;
int i, j;
j = 0;
for (i = 0;i < 0x20;i++)
for (i = 0; i < 0x20; i++)
{
int bit0,bit1,bit2,r,g,b;
int bit0, bit1, bit2, r, g, b;
/* red component */
bit0 = (color_prom[i] >> 0) & 0x01;
bit1 = (color_prom[i] >> 1) & 0x01;
bit2 = (color_prom[i] >> 2) & 0x01;
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
/* green component */
bit0 = (color_prom[i] >> 3) & 0x01;
bit1 = (color_prom[i] >> 4) & 0x01;
bit2 = (color_prom[i] >> 5) & 0x01;
bit0 = BIT(color_prom[i], 3);
bit1 = BIT(color_prom[i], 4);
bit2 = BIT(color_prom[i], 5);
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
/* blue component */
bit0 = 0;
bit1 = (color_prom[i] >> 6) & 0x01;
bit2 = (color_prom[i] >> 7) & 0x01;
bit1 = BIT(color_prom[i], 6);
bit2 = BIT(color_prom[i], 7);
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette_set_color(machine,j,MAKE_RGB(r,g,b));
j+=4;
if (j>31) j-=31;
palette_set_color(machine, j, MAKE_RGB(r, g, b));
j += 4;
if (j > 31) j -= 31;
}
}
static TILE_GET_INFO( get_mogura_tile_info )
{
int code = mogura_tileram[tile_index];
int attr = mogura_tileram[tile_index+0x800];
mogura_state *state = (mogura_state *)machine->driver_data;
int code = state->tileram[tile_index];
int attr = state->tileram[tile_index + 0x800];
SET_TILE_INFO(
0,
code,
(attr>>1)&7,
(attr >> 1) & 7,
0);
}
static VIDEO_START( mogura )
{
gfx_element_set_source(machine->gfx[0], mogura_gfxram);
mogura_tilemap = tilemap_create(machine, get_mogura_tile_info,tilemap_scan_rows,8,8,64, 32);
mogura_state *state = (mogura_state *)machine->driver_data;
gfx_element_set_source(machine->gfx[0], state->gfxram);
state->tilemap = tilemap_create(machine, get_mogura_tile_info, tilemap_scan_rows, 8, 8, 64, 32);
}
static VIDEO_UPDATE( mogura )
{
mogura_state *state = (mogura_state *)screen->machine->driver_data;
const rectangle *visarea = video_screen_get_visible_area(screen);
/* tilemap layout is a bit strange ... */
rectangle clip;
clip.min_x = visarea->min_x;
clip.max_x = 256-1;
clip.max_x = 256 - 1;
clip.min_y = visarea->min_y;
clip.max_y = visarea->max_y;
tilemap_set_scrollx(mogura_tilemap,0, 256);
tilemap_draw(bitmap,&clip,mogura_tilemap,0,0);
tilemap_set_scrollx(state->tilemap, 0, 256);
tilemap_draw(bitmap, &clip, state->tilemap, 0, 0);
clip.min_x = 256;
clip.max_x = 512-1;
clip.max_x = 512 - 1;
clip.min_y = visarea->min_y;
clip.max_y = visarea->max_y;
tilemap_set_scrollx(mogura_tilemap,0, -128);
tilemap_draw(bitmap,&clip,mogura_tilemap,0,0);
tilemap_set_scrollx(state->tilemap, 0, -128);
tilemap_draw(bitmap, &clip, state->tilemap, 0, 0);
return 0;
}
static WRITE8_HANDLER( mogura_tileram_w )
{
mogura_tileram[offset] = data;
tilemap_mark_tile_dirty(mogura_tilemap,offset&0x7ff);
mogura_state *state = (mogura_state *)space->machine->driver_data;
state->tileram[offset] = data;
tilemap_mark_tile_dirty(state->tilemap, offset & 0x7ff);
}
static WRITE8_HANDLER(mogura_dac_w)
{
dac_data_w(devtag_get_device(space->machine, "dac1"), data & 0xf0 ); /* left */
dac_data_w(devtag_get_device(space->machine, "dac2"), (data & 0x0f)<<4 ); /* right */
mogura_state *state = (mogura_state *)space->machine->driver_data;
dac_data_w(state->dac1, data & 0xf0); /* left */
dac_data_w(state->dac2, (data & 0x0f) << 4); /* right */
}
static WRITE8_HANDLER ( mogura_gfxram_w )
{
mogura_gfxram[offset] = data ;
mogura_state *state = (mogura_state *)space->machine->driver_data;
state->gfxram[offset] = data ;
gfx_element_mark_dirty(space->machine->gfx[0], offset/16);
gfx_element_mark_dirty(space->machine->gfx[0], offset / 16);
}
static ADDRESS_MAP_START( mogura_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0xc000, 0xdfff) AM_RAM // main ram
AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(mogura_gfxram_w) AM_BASE(&mogura_gfxram) // ram based characters
AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(mogura_tileram_w) AM_BASE(&mogura_tileram) // tilemap
AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(mogura_gfxram_w) AM_BASE_MEMBER(mogura_state, gfxram) // ram based characters
AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(mogura_tileram_w) AM_BASE_MEMBER(mogura_state, tileram) // tilemap
ADDRESS_MAP_END
static ADDRESS_MAP_START( mogura_io_map, ADDRESS_SPACE_IO, 8 )
@ -170,13 +187,28 @@ static GFXDECODE_START( mogura )
GFXDECODE_ENTRY( NULL, 0, tiles8x8_layout, 0, 8 )
GFXDECODE_END
static MACHINE_START( mogura )
{
mogura_state *state = (mogura_state *)machine->driver_data;
state->maincpu = devtag_get_device(machine, "maincpu");
state->dac1 = devtag_get_device(machine, "dac1");
state->dac2 = devtag_get_device(machine, "dac2");
}
static MACHINE_DRIVER_START( mogura )
/* driver data */
MDRV_DRIVER_DATA(mogura_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", Z80,3000000) /* 3 MHz */
MDRV_CPU_PROGRAM_MAP(mogura_map)
MDRV_CPU_IO_MAP(mogura_io_map)
MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
MDRV_MACHINE_START(mogura)
MDRV_GFXDECODE(mogura)
/* video hardware */
@ -211,4 +243,4 @@ ROM_START( mogura )
ROM_LOAD( "gx141.7j", 0x00, 0x20, CRC(b21c5d5f) SHA1(6913c840dd69a7d4687f4c4cbe3ff12300f62bc2) )
ROM_END
GAME( 1991, mogura, 0, mogura, mogura, 0, ROT0, "Konami", "Mogura Desse (Japan)", 0 )
GAME( 1991, mogura, 0, mogura, mogura, 0, ROT0, "Konami", "Mogura Desse (Japan)", GAME_SUPPORTS_SAVE )

View File

@ -1,4 +1,6 @@
/* MOLE ATTACK by Yachiyo Electronics Co.,LTD. 1982
/*****************************************************************************
MOLE ATTACK by Yachiyo Electronics Co.,LTD. 1982
Known Clones:
"Holey Moley", from tai (Thomas Automatics, Inc.)
@ -43,21 +45,93 @@
0x3DC affects mole popmessage
0x3E5 round point/passing point control?
0x3E7 round point/passing point control?
*/
******************************************************************************/
#include "emu.h"
#include "cpu/m6502/m6502.h"
#include "sound/ay8910.h"
WRITE8_HANDLER(mole_videoram_w);
WRITE8_HANDLER(mole_tilebank_w);
WRITE8_HANDLER(mole_flipscreen_w);
PALETTE_INIT(mole);
VIDEO_START(mole);
VIDEO_UPDATE(mole);
typedef struct _mole_state mole_state;
struct _mole_state
{
/* memory pointers */
UINT16 * tileram;
/* video-related */
tilemap_t *bg_tilemap;
int tile_bank;
};
/*************************************
*
* Video emulation
*
*************************************/
static PALETTE_INIT( mole )
{
int i;
for (i = 0; i < 8; i++)
palette_set_color_rgb(machine, i, pal1bit(i >> 0), pal1bit(i >> 2), pal1bit(i >> 1));
}
static TILE_GET_INFO( get_bg_tile_info )
{
mole_state *state = (mole_state *)machine->driver_data;
UINT16 code = state->tileram[tile_index];
SET_TILE_INFO((code & 0x200) ? 1 : 0, code & 0x1ff, 0, 0);
}
static VIDEO_START( mole )
{
mole_state *state = (mole_state *)machine->driver_data;
state->tileram = auto_alloc_array_clear(machine, UINT16, 0x400);
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 40, 25);
state_save_register_global_pointer(machine, state->tileram, 0x400);
}
static WRITE8_HANDLER( mole_videoram_w )
{
mole_state *state = (mole_state *)space->machine->driver_data;
state->tileram[offset] = data | (state->tile_bank << 8);
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
}
static WRITE8_HANDLER( mole_tilebank_w )
{
mole_state *state = (mole_state *)space->machine->driver_data;
state->tile_bank = data;
tilemap_mark_all_tiles_dirty(state->bg_tilemap);
}
static WRITE8_HANDLER( mole_flipscreen_w )
{
flip_screen_set(space->machine, data & 0x01);
}
static VIDEO_UPDATE( mole )
{
mole_state *state = (mole_state *)screen->machine->driver_data;
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
return 0;
}
/*************************************
*
* Memory handlers
*
*************************************/
static READ8_HANDLER( mole_protection_r )
{
@ -109,6 +183,12 @@ static READ8_HANDLER( mole_protection_r )
}
/*************************************
*
* Address maps
*
*************************************/
static ADDRESS_MAP_START( mole_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x03ff) AM_RAM
AM_RANGE(0x0800, 0x08ff) AM_READ(mole_protection_r)
@ -128,6 +208,12 @@ static ADDRESS_MAP_START( mole_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
/*************************************
*
* Input ports
*
*************************************/
static INPUT_PORTS_START( mole )
PORT_START("DSW") /* 0x8d00 */
PORT_DIPNAME( 0x01, 0x00, "Round Points" )
@ -181,6 +267,12 @@ static INPUT_PORTS_START( mole )
INPUT_PORTS_END
/*************************************
*
* Graphics definitions
*
*************************************/
static const gfx_layout tile_layout =
{
8,8, /* character size */
@ -199,14 +291,40 @@ static GFXDECODE_START( mole )
GFXDECODE_END
/*************************************
*
* Machine driver
*
*************************************/
static MACHINE_START( mole )
{
mole_state *state = (mole_state *)machine->driver_data;
state_save_register_global(machine, state->tile_bank);
}
static MACHINE_RESET( mole )
{
mole_state *state = (mole_state *)machine->driver_data;
state->tile_bank = 0;
}
static MACHINE_DRIVER_START( mole )
// basic machine hardware
/* driver data */
MDRV_DRIVER_DATA(mole_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M6502, 4000000) // ???
MDRV_CPU_PROGRAM_MAP(mole_map)
MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
// video hardware
MDRV_MACHINE_START(mole)
MDRV_MACHINE_RESET(mole)
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60)
MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
@ -221,7 +339,7 @@ static MACHINE_DRIVER_START( mole )
MDRV_VIDEO_START(mole)
MDRV_VIDEO_UPDATE(mole)
// sound hardware
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
MDRV_SOUND_ADD("aysnd", AY8910, 2000000)
@ -229,6 +347,12 @@ static MACHINE_DRIVER_START( mole )
MACHINE_DRIVER_END
/*************************************
*
* ROM definition(s)
*
*************************************/
ROM_START( mole ) // ALL ROMS ARE 2732
ROM_REGION( 0x10000, "maincpu", 0 ) // 64k for 6502 code
ROM_LOAD( "m3a.5h", 0x5000, 0x1000, CRC(5fbbdfef) SHA1(8129e90a05b3ca50f47f7610eec51c16c8609590) )
@ -245,4 +369,10 @@ ROM_START( mole ) // ALL ROMS ARE 2732
ROM_END
GAME( 1982, mole, 0, mole, mole, 0, ROT0, "Yachiyo Electronics, Ltd.", "Mole Attack", 0 )
/*************************************
*
* Game driver(s)
*
*************************************/
GAME( 1982, mole, 0, mole, mole, 0, ROT0, "Yachiyo Electronics, Ltd.", "Mole Attack", GAME_SUPPORTS_SAVE )

View File

@ -1,6 +1,6 @@
/*****************************************************************************
Momoko 120% (c) 1986 Jaleco
Momoko 120% (c) 1986 Jaleco
Driver by Uki
@ -44,28 +44,12 @@ Stephh's notes (based on the game Z80 code and some tests) :
#include "emu.h"
#include "cpu/z80/z80.h"
#include "sound/2203intf.h"
#include "includes/momoko.h"
extern UINT8 *momoko_bg_scrollx;
extern UINT8 *momoko_bg_scrolly;
VIDEO_UPDATE( momoko );
WRITE8_HANDLER( momoko_fg_scrollx_w );
WRITE8_HANDLER( momoko_fg_scrolly_w );
WRITE8_HANDLER( momoko_text_scrolly_w );
WRITE8_HANDLER( momoko_text_mode_w );
WRITE8_HANDLER( momoko_bg_scrollx_w );
WRITE8_HANDLER( momoko_bg_scrolly_w );
WRITE8_HANDLER( momoko_flipscreen_w );
WRITE8_HANDLER( momoko_fg_select_w);
WRITE8_HANDLER( momoko_bg_select_w);
WRITE8_HANDLER( momoko_bg_priority_w);
static WRITE8_HANDLER( momoko_bg_read_bank_w )
{
UINT8 *BG_MAP = memory_region(space->machine, "user1");
int bank_address = (data & 0x1f) * 0x1000;
memory_set_bankptr(space->machine, "bank1", &BG_MAP[bank_address]);
memory_set_bank(space->machine, "bank1", data & 0x1f);
}
/****************************************************************************/
@ -73,7 +57,7 @@ static WRITE8_HANDLER( momoko_bg_read_bank_w )
static ADDRESS_MAP_START( momoko_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xcfff) AM_RAM
AM_RANGE(0xd064, 0xd0ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
AM_RANGE(0xd064, 0xd0ff) AM_RAM AM_BASE_SIZE_MEMBER(momoko_state, spriteram, spriteram_size)
AM_RANGE(0xd400, 0xd400) AM_READ_PORT("IN0") AM_WRITENOP /* interrupt ack? */
AM_RANGE(0xd402, 0xd402) AM_READ_PORT("IN1") AM_WRITE(momoko_flipscreen_w)
AM_RANGE(0xd404, 0xd404) AM_WRITE(watchdog_reset_w)
@ -83,12 +67,12 @@ static ADDRESS_MAP_START( momoko_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xdc00, 0xdc00) AM_WRITE(momoko_fg_scrolly_w)
AM_RANGE(0xdc01, 0xdc01) AM_WRITE(momoko_fg_scrollx_w)
AM_RANGE(0xdc02, 0xdc02) AM_WRITE(momoko_fg_select_w)
AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_BASE_GENERIC(videoram) AM_SIZE_GENERIC(videoram)
AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_BASE_SIZE_MEMBER(momoko_state, videoram, videoram_size)
AM_RANGE(0xe800, 0xe800) AM_WRITE(momoko_text_scrolly_w)
AM_RANGE(0xe801, 0xe801) AM_WRITE(momoko_text_mode_w)
AM_RANGE(0xf000, 0xffff) AM_ROMBANK("bank1")
AM_RANGE(0xf000, 0xf001) AM_WRITE(momoko_bg_scrolly_w) AM_BASE(&momoko_bg_scrolly)
AM_RANGE(0xf002, 0xf003) AM_WRITE(momoko_bg_scrollx_w) AM_BASE(&momoko_bg_scrollx)
AM_RANGE(0xf000, 0xf001) AM_WRITE(momoko_bg_scrolly_w) AM_BASE_MEMBER(momoko_state, bg_scrolly)
AM_RANGE(0xf002, 0xf003) AM_WRITE(momoko_bg_scrollx_w) AM_BASE_MEMBER(momoko_state, bg_scrollx)
AM_RANGE(0xf004, 0xf004) AM_WRITE(momoko_bg_read_bank_w)
AM_RANGE(0xf006, 0xf006) AM_WRITE(momoko_bg_select_w)
AM_RANGE(0xf007, 0xf007) AM_WRITE(momoko_bg_priority_w)
@ -241,8 +225,46 @@ static const ym2203_interface ym2203_config =
NULL
};
static MACHINE_START( momoko )
{
momoko_state *state = (momoko_state *)machine->driver_data;
UINT8 *BG_MAP = memory_region(machine, "user1");
memory_configure_bank(machine, "bank1", 0, 32, &BG_MAP[0x0000], 0x1000);
state_save_register_global(machine, state->fg_scrollx);
state_save_register_global(machine, state->fg_scrolly);
state_save_register_global(machine, state->fg_select);
state_save_register_global(machine, state->text_scrolly);
state_save_register_global(machine, state->text_mode);
state_save_register_global(machine, state->bg_select);
state_save_register_global(machine, state->bg_priority);
state_save_register_global(machine, state->bg_mask);
state_save_register_global(machine, state->fg_mask);
state_save_register_global(machine, state->flipscreen);
}
static MACHINE_RESET( momoko )
{
momoko_state *state = (momoko_state *)machine->driver_data;
state->fg_scrollx = 0;
state->fg_scrolly = 0;
state->fg_select = 0;
state->text_scrolly = 0;
state->text_mode = 0;
state->bg_select = 0;
state->bg_priority = 0;
state->bg_mask = 0;
state->fg_mask = 0;
state->flipscreen = 0;
}
static MACHINE_DRIVER_START( momoko )
/* driver data */
MDRV_DRIVER_DATA(momoko_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", Z80, 5000000) /* 5.0MHz */
MDRV_CPU_PROGRAM_MAP(momoko_map)
@ -251,6 +273,9 @@ static MACHINE_DRIVER_START( momoko )
MDRV_CPU_ADD("audiocpu", Z80, 2500000) /* 2.5MHz */
MDRV_CPU_PROGRAM_MAP(momoko_sound_map)
MDRV_MACHINE_START(momoko)
MDRV_MACHINE_RESET(momoko)
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60)
@ -324,4 +349,4 @@ ROM_START( momoko )
ROM_LOAD( "momoko-b.bin", 0x0100, 0x0020, CRC(427b0e5c) SHA1(aa2797b899571527cc96013fd3420b841954ee67) )
ROM_END
GAME( 1986, momoko, 0, momoko, momoko, 0, ROT0, "Jaleco", "Momoko 120%", 0 )
GAME( 1986, momoko, 0, momoko, momoko, 0, ROT0, "Jaleco", "Momoko 120%", GAME_SUPPORTS_SAVE )

View File

@ -0,0 +1,39 @@
/*************************************************************************
Mad Motor
*************************************************************************/
typedef struct _madmotor_state madmotor_state;
struct _madmotor_state
{
/* memory pointers */
UINT16 * pf1_rowscroll;
UINT16 * pf1_data;
UINT16 * pf2_data;
UINT16 * pf3_data;
UINT16 * pf1_control;
UINT16 * pf2_control;
UINT16 * pf3_control;
UINT16 * spriteram;
// UINT16 * paletteram; // this currently uses generic palette handlers
size_t spriteram_size;
/* video-related */
tilemap_t *pf1_tilemap, *pf2_tilemap, *pf3_tilemap, *pf3a_tilemap;
int flipscreen;
/* devices */
running_device *maincpu;
running_device *audiocpu;
};
/*----------- defined in video/madmotor.c -----------*/
WRITE16_HANDLER( madmotor_pf1_data_w );
WRITE16_HANDLER( madmotor_pf2_data_w );
WRITE16_HANDLER( madmotor_pf3_data_w );
VIDEO_START( madmotor );
VIDEO_UPDATE( madmotor );

38
src/mame/includes/mikie.h Normal file
View File

@ -0,0 +1,38 @@
/*************************************************************************
Mikie
*************************************************************************/
typedef struct _mikie_state mikie_state;
struct _mikie_state
{
/* memory pointers */
UINT8 * videoram;
UINT8 * colorram;
UINT8 * spriteram;
size_t spriteram_size;
/* video-related */
tilemap_t *bg_tilemap;
int palettebank;
/* misc */
int last_irq;
/* devices */
running_device *maincpu;
running_device *audiocpu;
};
/*----------- defined in video/mikie.c -----------*/
WRITE8_HANDLER( mikie_videoram_w );
WRITE8_HANDLER( mikie_colorram_w );
WRITE8_HANDLER( mikie_palettebank_w );
WRITE8_HANDLER( mikie_flipscreen_w );
PALETTE_INIT( mikie );
VIDEO_START( mikie );
VIDEO_UPDATE( mikie );

View File

@ -0,0 +1,46 @@
/*************************************************************************
Momoko 120%
*************************************************************************/
typedef struct _momoko_state momoko_state;
struct _momoko_state
{
/* memory pointers */
UINT8 * bg_scrollx;
UINT8 * bg_scrolly;
UINT8 * videoram;
UINT8 * spriteram;
// UINT8 * paletteram; // currently this uses generic palette handling
size_t spriteram_size;
size_t videoram_size;
/* video-related */
UINT8 fg_scrollx;
UINT8 fg_scrolly;
UINT8 fg_select;
UINT8 text_scrolly;
UINT8 text_mode;
UINT8 bg_select;
UINT8 bg_priority;
UINT8 bg_mask;
UINT8 fg_mask;
UINT8 flipscreen;
};
/*----------- defined in video/momoko.c -----------*/
WRITE8_HANDLER( momoko_fg_scrollx_w );
WRITE8_HANDLER( momoko_fg_scrolly_w );
WRITE8_HANDLER( momoko_text_scrolly_w );
WRITE8_HANDLER( momoko_text_mode_w );
WRITE8_HANDLER( momoko_bg_scrollx_w );
WRITE8_HANDLER( momoko_bg_scrolly_w );
WRITE8_HANDLER( momoko_flipscreen_w );
WRITE8_HANDLER( momoko_fg_select_w);
WRITE8_HANDLER( momoko_bg_select_w);
WRITE8_HANDLER( momoko_bg_priority_w);
VIDEO_UPDATE( momoko );

View File

@ -1394,7 +1394,7 @@ $(MAMEOBJ)/thepit.a: \
$(DRIVERS)/timelimt.o $(VIDEO)/timelimt.o \
$(MAMEOBJ)/toaplan.a: \
$(DRIVERS)/mjsister.o $(VIDEO)/mjsister.o \
$(DRIVERS)/mjsister.o \
$(DRIVERS)/slapfght.o $(MACHINE)/slapfght.o $(VIDEO)/slapfght.o \
$(DRIVERS)/snowbros.o $(VIDEO)/kan_pand.o $(VIDEO)/kan_panb.o \
$(DRIVERS)/toaplan1.o $(MACHINE)/toaplan1.o $(VIDEO)/toaplan1.o \
@ -1576,7 +1576,7 @@ $(MAMEOBJ)/misc.a: \
$(DRIVERS)/mirage.o \
$(DRIVERS)/mirax.o \
$(DRIVERS)/mirderby.o \
$(DRIVERS)/mole.o $(VIDEO)/mole.o \
$(DRIVERS)/mole.o \
$(DRIVERS)/mosaic.o $(VIDEO)/mosaic.o \
$(DRIVERS)/mrjong.o $(VIDEO)/mrjong.o \
$(DRIVERS)/multfish.o \

View File

@ -7,18 +7,7 @@
***************************************************************************/
#include "emu.h"
UINT16 *madmotor_pf1_rowscroll;
UINT16 *madmotor_pf1_data,*madmotor_pf2_data,*madmotor_pf3_data;
UINT16 *madmotor_pf1_control;
UINT16 *madmotor_pf2_control;
UINT16 *madmotor_pf3_control;
static int flipscreen;
static tilemap_t *madmotor_pf1_tilemap,*madmotor_pf2_tilemap,*madmotor_pf3_tilemap,*madmotor_pf3a_tilemap;
#include "includes/madmotor.h"
/* 512 by 512 playfield, 8 by 8 tiles */
@ -30,11 +19,11 @@ static TILEMAP_MAPPER( pf1_scan )
static TILE_GET_INFO( get_pf1_tile_info )
{
int tile,color;
madmotor_state *state = (madmotor_state *)machine->driver_data;
int tile = state->pf1_data[tile_index];
int color = tile >> 12;
tile=madmotor_pf1_data[tile_index];
color=tile >> 12;
tile=tile&0xfff;
tile = tile & 0xfff;
SET_TILE_INFO(
0,
@ -52,11 +41,11 @@ static TILEMAP_MAPPER( pf2_scan )
static TILE_GET_INFO( get_pf2_tile_info )
{
int tile,color;
madmotor_state *state = (madmotor_state *)machine->driver_data;
int tile = state->pf2_data[tile_index];
int color = tile >> 12;
tile=madmotor_pf2_data[tile_index];
color=tile >> 12;
tile=tile&0xfff;
tile = tile & 0xfff;
SET_TILE_INFO(
1,
@ -74,11 +63,11 @@ static TILEMAP_MAPPER( pf3_scan )
static TILE_GET_INFO( get_pf3_tile_info )
{
int tile,color;
madmotor_state *state = (madmotor_state *)machine->driver_data;
int tile = state->pf3_data[tile_index];
int color = tile >> 12;
tile=madmotor_pf3_data[tile_index];
color=tile >> 12;
tile=tile&0xfff;
tile = tile & 0xfff;
SET_TILE_INFO(
2,
@ -96,11 +85,11 @@ static TILEMAP_MAPPER( pf3a_scan )
static TILE_GET_INFO( get_pf3a_tile_info )
{
int tile,color;
madmotor_state *state = (madmotor_state *)machine->driver_data;
int tile = state->pf3_data[tile_index];
int color = tile >> 12;
tile=madmotor_pf3_data[tile_index];
color=tile >> 12;
tile=tile&0xfff;
tile = tile & 0xfff;
SET_TILE_INFO(
2,
@ -113,58 +102,67 @@ static TILE_GET_INFO( get_pf3a_tile_info )
VIDEO_START( madmotor )
{
madmotor_pf1_tilemap = tilemap_create(machine, get_pf1_tile_info, pf1_scan, 8, 8, 64,64);
madmotor_pf2_tilemap = tilemap_create(machine, get_pf2_tile_info, pf2_scan, 16,16, 32,32);
madmotor_pf3_tilemap = tilemap_create(machine, get_pf3_tile_info, pf3_scan, 16,16, 32,64);
madmotor_pf3a_tilemap= tilemap_create(machine, get_pf3a_tile_info,pf3a_scan, 16,16,128,16);
madmotor_state *state = (madmotor_state *)machine->driver_data;
tilemap_set_transparent_pen(madmotor_pf1_tilemap,0);
tilemap_set_transparent_pen(madmotor_pf2_tilemap,0);
tilemap_set_scroll_rows(madmotor_pf1_tilemap,512);
state->pf1_tilemap = tilemap_create(machine, get_pf1_tile_info, pf1_scan, 8, 8, 64, 64);
state->pf2_tilemap = tilemap_create(machine, get_pf2_tile_info, pf2_scan, 16, 16, 32, 32);
state->pf3_tilemap = tilemap_create(machine, get_pf3_tile_info, pf3_scan, 16, 16, 32, 64);
state->pf3a_tilemap= tilemap_create(machine, get_pf3a_tile_info, pf3a_scan, 16, 16, 128, 16);
tilemap_set_transparent_pen(state->pf1_tilemap, 0);
tilemap_set_transparent_pen(state->pf2_tilemap, 0);
tilemap_set_scroll_rows(state->pf1_tilemap, 512);
}
/******************************************************************************/
WRITE16_HANDLER( madmotor_pf1_data_w )
{
COMBINE_DATA(&madmotor_pf1_data[offset]);
tilemap_mark_tile_dirty(madmotor_pf1_tilemap,offset);
madmotor_state *state = (madmotor_state *)space->machine->driver_data;
COMBINE_DATA(&state->pf1_data[offset]);
tilemap_mark_tile_dirty(state->pf1_tilemap, offset);
}
WRITE16_HANDLER( madmotor_pf2_data_w )
{
COMBINE_DATA(&madmotor_pf2_data[offset]);
tilemap_mark_tile_dirty(madmotor_pf2_tilemap,offset);
madmotor_state *state = (madmotor_state *)space->machine->driver_data;
COMBINE_DATA(&state->pf2_data[offset]);
tilemap_mark_tile_dirty(state->pf2_tilemap, offset);
}
WRITE16_HANDLER( madmotor_pf3_data_w )
{
COMBINE_DATA(&madmotor_pf3_data[offset]);
madmotor_state *state = (madmotor_state *)space->machine->driver_data;
COMBINE_DATA(&state->pf3_data[offset]);
/* Mark the dirty position on the 512 x 1024 version */
tilemap_mark_tile_dirty(madmotor_pf3_tilemap,offset);
tilemap_mark_tile_dirty(state->pf3_tilemap, offset);
/* Mark the dirty position on the 2048 x 256 version */
tilemap_mark_tile_dirty(madmotor_pf3a_tilemap,offset);
tilemap_mark_tile_dirty(state->pf3a_tilemap, offset);
}
/******************************************************************************/
static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri_mask,int pri_val)
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri_mask, int pri_val )
{
UINT16 *spriteram16 = machine->generic.spriteram.u16;
madmotor_state *state = (madmotor_state *)machine->driver_data;
UINT16 *spriteram = state->spriteram;
int offs;
offs = 0;
while (offs < machine->generic.spriteram_size/2)
while (offs < state->spriteram_size / 2)
{
int sx,sy,code,color,w,h,flipx,flipy,incy,flash,mult,x,y;
int sx, sy, code, color, w, h, flipx, flipy, incy, flash, mult, x, y;
sy = spriteram16[offs];
sx = spriteram16[offs+2];
sy = spriteram[offs];
sx = spriteram[offs + 2];
color = sx >> 12;
flash=sx&0x800;
flash = sx & 0x800;
flipx = sy & 0x2000;
flipy = sy & 0x4000;
@ -172,7 +170,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
w = (1 << ((sy & 0x0600) >> 9)); /* 1x, 2x, 4x, 8x width */
/* multi width used only on the title screen? */
code = spriteram16[offs+1] & 0x1fff;
code = spriteram[offs + 1] & 0x1fff;
sx = sx & 0x01ff;
sy = sy & 0x01ff;
@ -190,18 +188,20 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
incy = 1;
}
if (flipscreen) {
sy=240-sy;
sx=240-sx;
if (flipx) flipx=0; else flipx=1;
if (flipy) flipy=0; else flipy=1;
mult=16;
}
else mult=-16;
for (x = 0;x < w;x++)
if (state->flipscreen)
{
for (y = 0;y < h;y++)
sy = 240 - sy;
sx = 240 - sx;
if (flipx) flipx = 0; else flipx = 1;
if (flipy) flipy = 0; else flipy = 1;
mult = 16;
}
else
mult = -16;
for (x = 0; x < w; x++)
{
for (y = 0; y < h; y++)
{
if ((color & pri_mask) == pri_val &&
(!flash || (video_screen_get_frame_number(machine->primary_screen) & 1)))
@ -213,8 +213,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
}
offs += 4;
if (offs >= machine->generic.spriteram_size/2 ||
spriteram16[offs] & 0x8000) // seems the expected behaviour on the title screen
if (offs >= state->spriteram_size / 2 || spriteram[offs] & 0x8000) // seems the expected behaviour on the title screen
break;
}
}
@ -225,33 +224,37 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
VIDEO_UPDATE( madmotor )
{
madmotor_state *state = (madmotor_state *)screen->machine->driver_data;
int offs;
/* Update flipscreen */
if (madmotor_pf1_control[0]&0x80)
flipscreen=1;
if (state->pf1_control[0] & 0x80)
state->flipscreen = 1;
else
flipscreen=0;
tilemap_set_flip_all(screen->machine,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
state->flipscreen = 0;
tilemap_set_flip_all(screen->machine, state->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
/* Setup scroll registers */
for (offs = 0;offs < 512;offs++)
tilemap_set_scrollx( madmotor_pf1_tilemap,offs, madmotor_pf1_control[0x08] + madmotor_pf1_rowscroll[0x200+offs] );
tilemap_set_scrolly( madmotor_pf1_tilemap,0, madmotor_pf1_control[0x09] );
tilemap_set_scrollx( madmotor_pf2_tilemap,0, madmotor_pf2_control[0x08] );
tilemap_set_scrolly( madmotor_pf2_tilemap,0, madmotor_pf2_control[0x09] );
tilemap_set_scrollx( madmotor_pf3_tilemap,0, madmotor_pf3_control[0x08] );
tilemap_set_scrolly( madmotor_pf3_tilemap,0, madmotor_pf3_control[0x09] );
tilemap_set_scrollx( madmotor_pf3a_tilemap,0, madmotor_pf3_control[0x08] );
tilemap_set_scrolly( madmotor_pf3a_tilemap,0, madmotor_pf3_control[0x09] );
for (offs = 0; offs < 512; offs++)
tilemap_set_scrollx(state->pf1_tilemap, offs, state->pf1_control[0x08] + state->pf1_rowscroll[0x200 + offs]);
tilemap_set_scrolly(state->pf1_tilemap, 0, state->pf1_control[0x09]);
tilemap_set_scrollx(state->pf2_tilemap, 0, state->pf2_control[0x08]);
tilemap_set_scrolly(state->pf2_tilemap, 0, state->pf2_control[0x09]);
tilemap_set_scrollx(state->pf3_tilemap, 0, state->pf3_control[0x08]);
tilemap_set_scrolly(state->pf3_tilemap, 0, state->pf3_control[0x09]);
tilemap_set_scrollx(state->pf3a_tilemap, 0, state->pf3_control[0x08]);
tilemap_set_scrolly(state->pf3a_tilemap, 0, state->pf3_control[0x09]);
/* Draw playfields & sprites */
if (madmotor_pf3_control[0x03]==2)
tilemap_draw(bitmap,cliprect,madmotor_pf3_tilemap,0,0);
if (state->pf3_control[0x03] == 2)
tilemap_draw(bitmap, cliprect, state->pf3_tilemap, 0, 0);
else
tilemap_draw(bitmap,cliprect,madmotor_pf3a_tilemap,0,0);
tilemap_draw(bitmap,cliprect,madmotor_pf2_tilemap,0,0);
draw_sprites(screen->machine,bitmap,cliprect,0x00,0x00);
tilemap_draw(bitmap,cliprect,madmotor_pf1_tilemap,0,0);
tilemap_draw(bitmap, cliprect, state->pf3a_tilemap, 0, 0);
tilemap_draw(bitmap, cliprect, state->pf2_tilemap, 0, 0);
draw_sprites(screen->machine, bitmap, cliprect, 0x00, 0x00);
tilemap_draw(bitmap, cliprect, state->pf1_tilemap, 0, 0);
return 0;
}

View File

@ -8,12 +8,7 @@
#include "emu.h"
#include "video/resnet.h"
static int palettebank;
UINT8 *mikie_videoram;
UINT8 *mikie_colorram;
static tilemap_t *bg_tilemap;
#include "includes/mikie.h"
/***************************************************************************
@ -30,6 +25,7 @@ static tilemap_t *bg_tilemap;
bit 0 -- 2.2kohm resistor -- RED/GREEN/BLUE
***************************************************************************/
PALETTE_INIT( mikie )
{
static const int resistances[4] = { 2200, 1000, 470, 220 };
@ -78,8 +74,7 @@ PALETTE_INIT( mikie )
/* color_prom now points to the beginning of the lookup table,*/
color_prom += 0x300;
/* characters use colors 0x10-0x1f of each 0x20 color bank,
while sprites use colors 0-0x0f */
/* characters use colors 0x10-0x1f of each 0x20 color bank, while sprites use colors 0-0x0f */
for (i = 0; i < 0x200; i++)
{
int j;
@ -94,21 +89,27 @@ PALETTE_INIT( mikie )
WRITE8_HANDLER( mikie_videoram_w )
{
mikie_videoram[offset] = data;
tilemap_mark_tile_dirty(bg_tilemap, offset);
mikie_state *state = (mikie_state *)space->machine->driver_data;
state->videoram[offset] = data;
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
}
WRITE8_HANDLER( mikie_colorram_w )
{
mikie_colorram[offset] = data;
tilemap_mark_tile_dirty(bg_tilemap, offset);
mikie_state *state = (mikie_state *)space->machine->driver_data;
state->colorram[offset] = data;
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
}
WRITE8_HANDLER( mikie_palettebank_w )
{
if (palettebank != (data & 0x07))
mikie_state *state = (mikie_state *)space->machine->driver_data;
if (state->palettebank != (data & 0x07))
{
palettebank = data & 0x07;
state->palettebank = data & 0x07;
tilemap_mark_all_tiles_dirty_all(space->machine);
}
}
@ -124,13 +125,15 @@ WRITE8_HANDLER( mikie_flipscreen_w )
static TILE_GET_INFO( get_bg_tile_info )
{
int code = mikie_videoram[tile_index] + ((mikie_colorram[tile_index] & 0x20) << 3);
int color = (mikie_colorram[tile_index] & 0x0f) + 16 * palettebank;
int flags = ((mikie_colorram[tile_index] & 0x40) ? TILE_FLIPX : 0) | ((mikie_colorram[tile_index] & 0x80) ? TILE_FLIPY : 0);
if (mikie_colorram[tile_index] & 0x10)
mikie_state *state = (mikie_state *)machine->driver_data;
int code = state->videoram[tile_index] + ((state->colorram[tile_index] & 0x20) << 3);
int color = (state->colorram[tile_index] & 0x0f) + 16 * state->palettebank;
int flags = ((state->colorram[tile_index] & 0x40) ? TILE_FLIPX : 0) | ((state->colorram[tile_index] & 0x80) ? TILE_FLIPY : 0);
if (state->colorram[tile_index] & 0x10)
tileinfo->category = 1;
else
tileinfo->category = 0;
SET_TILE_INFO(0, code, color, flags);
@ -138,20 +141,21 @@ static TILE_GET_INFO( get_bg_tile_info )
VIDEO_START( mikie )
{
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
8, 8, 32, 32);
mikie_state *state = (mikie_state *)machine->driver_data;
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
}
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
{
UINT8 *spriteram = machine->generic.spriteram.u8;
mikie_state *state = (mikie_state *)machine->driver_data;
UINT8 *spriteram = state->spriteram;
int offs;
for (offs = 0;offs < machine->generic.spriteram_size;offs += 4)
for (offs = 0; offs < state->spriteram_size; offs += 4)
{
int gfxbank = (spriteram[offs+2] & 0x40) ? 2 : 1;
int gfxbank = (spriteram[offs + 2] & 0x40) ? 2 : 1;
int code = (spriteram[offs + 2] & 0x3f) + ((spriteram[offs + 2] & 0x80) >> 1) + ((spriteram[offs] & 0x40) << 1);
int color = (spriteram[offs] & 0x0f) + 16 * palettebank;
int color = (spriteram[offs] & 0x0f) + 16 * state->palettebank;
int sx = spriteram[offs + 3];
int sy = 244 - spriteram[offs + 1];
int flipx = ~spriteram[offs] & 0x10;
@ -173,8 +177,9 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
VIDEO_UPDATE( mikie )
{
tilemap_draw(bitmap, cliprect, bg_tilemap, TILEMAP_DRAW_CATEGORY(0), 0);
mikie_state *state = (mikie_state *)screen->machine->driver_data;
tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_CATEGORY(0), 0);
draw_sprites(screen->machine, bitmap, cliprect);
tilemap_draw(bitmap, cliprect, bg_tilemap, TILEMAP_DRAW_CATEGORY(1), 0);
tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_CATEGORY(1), 0);
return 0;
}

View File

@ -1,109 +0,0 @@
/*****************************************************************************
Mahjong Sisters (c) 1986 Toa Plan
Video hardware
driver by Uki
*****************************************************************************/
#include "emu.h"
int mjsister_screen_redraw;
int mjsister_flip_screen;
int mjsister_video_enable;
int mjsister_vrambank;
int mjsister_colorbank;
static bitmap_t *mjsister_tmpbitmap0, *mjsister_tmpbitmap1;
static UINT8 *mjsister_videoram0, *mjsister_videoram1;
/****************************************************************************/
VIDEO_START( mjsister )
{
mjsister_tmpbitmap0 = auto_bitmap_alloc(machine,256,256,video_screen_get_format(machine->primary_screen));
mjsister_tmpbitmap1 = auto_bitmap_alloc(machine,256,256,video_screen_get_format(machine->primary_screen));
mjsister_videoram0 = auto_alloc_array(machine, UINT8, 0x8000);
mjsister_videoram1 = auto_alloc_array(machine, UINT8, 0x8000);
}
static void mjsister_plot0(int offset,UINT8 data)
{
int x,y,c1,c2;
x = offset & 0x7f;
y = offset / 0x80;
c1 = (data & 0x0f) + mjsister_colorbank * 0x20;
c2 = ((data & 0xf0) >> 4) + mjsister_colorbank * 0x20;
*BITMAP_ADDR16(mjsister_tmpbitmap0, y, x*2+0) = c1;
*BITMAP_ADDR16(mjsister_tmpbitmap0, y, x*2+1) = c2;
}
static void mjsister_plot1(int offset,UINT8 data)
{
int x,y,c1,c2;
x = offset & 0x7f;
y = offset / 0x80;
c1 = data & 0x0f;
c2 = (data & 0xf0) >> 4;
if (c1)
c1 += mjsister_colorbank * 0x20 + 0x10;
if (c2)
c2 += mjsister_colorbank * 0x20 + 0x10;
*BITMAP_ADDR16(mjsister_tmpbitmap1, y, x*2+0) = c1;
*BITMAP_ADDR16(mjsister_tmpbitmap1, y, x*2+1) = c2;
}
WRITE8_HANDLER( mjsister_videoram_w )
{
if (mjsister_vrambank)
{
mjsister_videoram1[offset] = data;
mjsister_plot1(offset,data);
}
else
{
mjsister_videoram0[offset] = data;
mjsister_plot0(offset,data);
}
}
VIDEO_UPDATE( mjsister )
{
int f = mjsister_flip_screen;
int i,j;
if (mjsister_screen_redraw)
{
int offs;
for (offs=0; offs<0x8000; offs++)
{
mjsister_plot0(offs,mjsister_videoram0[offs]);
mjsister_plot1(offs,mjsister_videoram1[offs]);
}
mjsister_screen_redraw = 0;
}
if (mjsister_video_enable)
{
for (i=0; i<256; i++)
for (j=0; j<4; j++)
*BITMAP_ADDR16(bitmap, i, 256+j) = mjsister_colorbank * 0x20;
copybitmap (bitmap,mjsister_tmpbitmap0,f,f,0,0,cliprect);
copybitmap_trans(bitmap,mjsister_tmpbitmap1,f,f,2,0,cliprect,0);
}
else
bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
return 0;
}

View File

@ -1,58 +0,0 @@
/***************************************************************************
video/mole.c
Functions to emulate the video hardware of Mole Attack!.
Mole Attack's Video hardware is essentially two banks of 512 characters.
The program uses a single byte to indicate which character goes in each location,
and uses a control location (0x8400) to select the character sets
***************************************************************************/
#include "emu.h"
static int tile_bank;
static UINT16 *tileram;
static tilemap_t *bg_tilemap;
PALETTE_INIT( mole )
{
int i;
for (i = 0; i < 8; i++) {
palette_set_color_rgb(machine, i, pal1bit(i >> 0), pal1bit(i >> 2), pal1bit(i >> 1));
}
}
static TILE_GET_INFO( get_bg_tile_info )
{
UINT16 code = tileram[tile_index];
SET_TILE_INFO((code & 0x200) ? 1 : 0, code & 0x1ff, 0, 0);
}
VIDEO_START( mole )
{
tileram = auto_alloc_array(machine, UINT16, 0x400);
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 40, 25);
}
WRITE8_HANDLER( mole_videoram_w )
{
tileram[offset] = data | (tile_bank << 8);
tilemap_mark_tile_dirty(bg_tilemap, offset);
}
WRITE8_HANDLER( mole_tilebank_w )
{
tile_bank = data;
tilemap_mark_all_tiles_dirty(bg_tilemap);
}
WRITE8_HANDLER( mole_flipscreen_w )
{
flip_screen_set(space->machine, data & 0x01);
}
VIDEO_UPDATE( mole )
{
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
return 0;
}

View File

@ -1,97 +1,107 @@
/*******************************************************************************
Momoko 120% (c) 1986 Jaleco
Momoko 120% (c) 1986 Jaleco
Video hardware driver by Uki
Video hardware driver by Uki
02/Mar/2001 -
*******************************************************************************/
#include "emu.h"
#include "includes/momoko.h"
UINT8 *momoko_bg_scrollx;
UINT8 *momoko_bg_scrolly;
static UINT8 momoko_fg_scrollx;
static UINT8 momoko_fg_scrolly;
static UINT8 momoko_fg_select;
static UINT8 momoko_text_scrolly;
static UINT8 momoko_text_mode;
static UINT8 momoko_bg_select;
static UINT8 momoko_bg_priority;
static UINT8 momoko_bg_mask;
static UINT8 momoko_fg_mask;
static UINT8 momoko_flipscreen;
/****************************************************************************/
WRITE8_HANDLER ( momoko_fg_scrollx_w )
{
momoko_fg_scrollx = data;
momoko_state *state = (momoko_state *)space->machine->driver_data;
state->fg_scrollx = data;
}
WRITE8_HANDLER ( momoko_fg_scrolly_w )
{
momoko_fg_scrolly = data;
momoko_state *state = (momoko_state *)space->machine->driver_data;
state->fg_scrolly = data;
}
WRITE8_HANDLER ( momoko_fg_select_w )
{
momoko_fg_select = data & 0x0f;
momoko_fg_mask = data & 0x10;
momoko_state *state = (momoko_state *)space->machine->driver_data;
state->fg_select = data & 0x0f;
state->fg_mask = data & 0x10;
}
WRITE8_HANDLER ( momoko_text_scrolly_w )
{
momoko_text_scrolly = data;
momoko_state *state = (momoko_state *)space->machine->driver_data;
state->text_scrolly = data;
}
WRITE8_HANDLER ( momoko_text_mode_w )
{
momoko_text_mode = data;
momoko_state *state = (momoko_state *)space->machine->driver_data;
state->text_mode = data;
}
WRITE8_HANDLER ( momoko_bg_scrollx_w )
{
momoko_bg_scrollx[ offset ] = data;
momoko_state *state = (momoko_state *)space->machine->driver_data;
state->bg_scrollx[offset] = data;
}
WRITE8_HANDLER ( momoko_bg_scrolly_w )
{
momoko_bg_scrolly[ offset ] = data;
momoko_state *state = (momoko_state *)space->machine->driver_data;
state->bg_scrolly[offset] = data;
}
WRITE8_HANDLER( momoko_bg_select_w )
{
momoko_bg_select = data & 0x0f;
momoko_bg_mask = data & 0x10;
momoko_state *state = (momoko_state *)space->machine->driver_data;
state->bg_select = data & 0x0f;
state->bg_mask = data & 0x10;
}
WRITE8_HANDLER( momoko_bg_priority_w )
{
momoko_bg_priority = data & 0x01;
momoko_state *state = (momoko_state *)space->machine->driver_data;
state->bg_priority = data & 0x01;
}
WRITE8_HANDLER( momoko_flipscreen_w )
{
momoko_flipscreen = data & 0x01;
momoko_state *state = (momoko_state *)space->machine->driver_data;
state->flipscreen = data & 0x01;
}
/****************************************************************************/
static void momoko_draw_bg_pri(running_machine *machine, bitmap_t *bitmap, int chr, int col, int flipx, int flipy, int x,int y, int pri)
static void momoko_draw_bg_pri( running_machine *machine, bitmap_t *bitmap, int chr, int col, int flipx, int flipy, int x, int y, int pri )
{
int xx,sx,sy,px,py,dot;
int xx, sx, sy, px, py, dot;
UINT32 gfxadr;
UINT8 d0, d1;
UINT8 *BG_GFX = memory_region( machine, "gfx2" );
for (sy=0; sy<8; sy++)
UINT8 *BG_GFX = memory_region(machine, "gfx2");
for (sy = 0; sy < 8; sy++)
{
gfxadr = chr*16 + sy*2;
for (xx=0; xx<2; xx++)
gfxadr = chr * 16 + sy * 2;
for (xx = 0; xx < 2; xx++)
{
d0 = BG_GFX[gfxadr + xx*4096];
d1 = BG_GFX[gfxadr + xx*4096+1];
for (sx=0; sx<4; sx++)
d0 = BG_GFX[gfxadr + xx * 4096];
d1 = BG_GFX[gfxadr + xx * 4096 + 1];
for (sx = 0; sx < 4; sx++)
{
dot = (d0 & 0x08) | ((d0 & 0x80) >>5) | ((d1 & 0x08) >>2) | ((d1 & 0x80) >>7);
if (flipx==0) px=sx+xx*4 + x;
else px=7-sx-xx*4 + x;
if (flipy==0) py=sy + y;
else py=7-sy + y;
if (flipx == 0) px = sx + xx * 4 + x;
else px = 7 - sx - xx * 4 + x;
if (flipy == 0) py = sy + y;
else py = 7 - sy + y;
if (dot >= pri)
*BITMAP_ADDR16(bitmap, py, px) = col * 16 + dot + 256;
if (dot>=pri)
*BITMAP_ADDR16(bitmap, py, px) = col*16+dot+256;
d0 = d0 << 1;
d1 = d1 << 1;
}
@ -103,44 +113,44 @@ static void momoko_draw_bg_pri(running_machine *machine, bitmap_t *bitmap, int c
VIDEO_UPDATE( momoko )
{
momoko_state *state = (momoko_state *)screen->machine->driver_data;
int x, y, dx, dy, rx, ry, radr, chr, sy, fx, fy, px, py, offs, col, pri, flip ;
UINT8 *spriteram = screen->machine->generic.spriteram.u8;
UINT8 *spriteram = state->spriteram;
UINT8 *BG_MAP = memory_region( screen->machine, "user1" );
UINT8 *BG_COL_MAP = memory_region( screen->machine, "user2" );
UINT8 *FG_MAP = memory_region( screen->machine, "user3" );
UINT8 *TEXT_COLOR = memory_region( screen->machine, "proms" );
UINT8 *BG_MAP = memory_region(screen->machine, "user1");
UINT8 *BG_COL_MAP = memory_region(screen->machine, "user2");
UINT8 *FG_MAP = memory_region(screen->machine, "user3");
UINT8 *TEXT_COLOR = memory_region(screen->machine, "proms");
flip = momoko_flipscreen ^ (input_port_read(screen->machine, "FAKE") & 0x01);
flip = state->flipscreen ^ (input_port_read(screen->machine, "FAKE") & 0x01);
/* draw BG layer */
/* draw BG layer */
dx = (7 - state->bg_scrollx[0]) & 7;
dy = (7 - state->bg_scrolly[0]) & 7;
rx = (state->bg_scrollx[0] + state->bg_scrollx[1] * 256) >> 3;
ry = (state->bg_scrolly[0] + state->bg_scrolly[1] * 256) >> 3;
dx = ( 7 - momoko_bg_scrollx[0] ) & 7 ;
dy = ( 7 - momoko_bg_scrolly[0] ) & 7 ;
rx = (momoko_bg_scrollx[0] + momoko_bg_scrollx[1]*256) >> 3 ;
ry = (momoko_bg_scrolly[0] + momoko_bg_scrolly[1]*256) >> 3 ;
if (momoko_bg_mask == 0)
if (state->bg_mask == 0)
{
for (y=0; y<29; y++)
for (y = 0; y < 29; y++)
{
for (x=0; x<32; x++)
for (x = 0; x < 32; x++)
{
radr = ( (ry + y +2 ) & 0x3ff ) * 128 + ( (rx + x) & 0x7f ) ;
chr = BG_MAP[ radr ] ;
col = BG_COL_MAP[ chr+momoko_bg_select*512+momoko_bg_priority*256] & 0x0f;
chr = chr + momoko_bg_select * 512;
radr = ((ry + y + 2) & 0x3ff) * 128 + ((rx + x) & 0x7f);
chr = BG_MAP[radr];
col = BG_COL_MAP[chr + state->bg_select * 512 + state->bg_priority * 256] & 0x0f;
chr = chr + state->bg_select * 512;
if (flip==0)
if (flip == 0)
{
px = 8*x+dx-6;
py = 8*y+dy+9;
px = 8 * x + dx - 6;
py = 8 * y + dy + 9;
}
else
{
px = 248-(8*x+dx-8);
py = 248-(8*y+dy+9);
px = 248 - (8 * x + dx - 8);
py = 248 - (8 * y + dy + 9);
}
drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[1],
@ -155,26 +165,26 @@ VIDEO_UPDATE( momoko )
bitmap_fill(bitmap, cliprect, 256);
/* draw sprites (momoko) */
for (offs=0; offs<9*4; offs +=4)
/* draw sprites (momoko) */
for (offs = 0; offs < 9 * 4; offs +=4)
{
chr = spriteram[offs+1] | ((spriteram[offs+2]&0x60)<<3);
chr = spriteram[offs + 1] | ((spriteram[offs + 2] & 0x60) << 3);
chr = ((chr & 0x380) << 1) | (chr & 0x7f);
col = spriteram[offs+2] & 0x07;
fx = ((spriteram[offs+2] & 0x10) >> 4) ^ flip;
fy = ((spriteram[offs+2] & 0x08) >> 3) ^ flip; /* ??? */
x = spriteram[offs+3];
y = spriteram[offs+0];
if (flip==0)
col = spriteram[offs + 2] & 0x07;
fx = ((spriteram[offs + 2] & 0x10) >> 4) ^ flip;
fy = ((spriteram[offs + 2] & 0x08) >> 3) ^ flip; /* ??? */
x = spriteram[offs + 3];
y = spriteram[offs + 0];
if (flip == 0)
{
px = x;
py = 239-y;
py = 239 - y;
}
else
{
px = 248-x;
py = y+1;
px = 248 - x;
py = y + 1;
}
drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[3],
@ -185,60 +195,59 @@ VIDEO_UPDATE( momoko )
}
/* draw BG layer */
if (momoko_bg_mask ==0)
/* draw BG layer */
if (state->bg_mask ==0)
{
for (y=0; y<29; y++)
for (y = 0; y < 29; y++)
{
for (x=0; x<32; x++)
for (x = 0; x < 32; x++)
{
radr = ( (ry + y +2 ) & 0x3ff ) * 128 + ( (rx + x) & 0x7f ) ;
chr = BG_MAP[ radr ] ;
col = BG_COL_MAP[ chr+momoko_bg_select*512+momoko_bg_priority*256 ];
radr = ((ry + y + 2) & 0x3ff) * 128 + ((rx + x) & 0x7f) ;
chr = BG_MAP[radr] ;
col = BG_COL_MAP[chr + state->bg_select * 512 + state->bg_priority * 256];
pri = (col & 0x10) >> 1;
if (flip==0)
if (flip == 0)
{
px = 8*x+dx-6;
py = 8*y+dy+9;
}
px = 8 * x + dx - 6;
py = 8 * y + dy + 9;
}
else
{
px = 248-(8*x+dx-8);
py = 248-(8*y+dy+9);
px = 248 - (8 * x + dx - 8);
py = 248 - (8 * y + dy + 9);
}
if (pri != 0)
{
col = col & 0x0f;
chr = chr + momoko_bg_select * 512;
momoko_draw_bg_pri(screen->machine,bitmap,chr,col,flip,flip,px,py,pri);
chr = chr + state->bg_select * 512;
momoko_draw_bg_pri(screen->machine, bitmap, chr, col, flip, flip, px, py, pri);
}
}
}
}
/* draw sprites (others) */
for (offs=9*4; offs<screen->machine->generic.spriteram_size; offs +=4)
/* draw sprites (others) */
for (offs = 9 * 4; offs < state->spriteram_size; offs += 4)
{
chr = spriteram[offs+1] | ((spriteram[offs+2]&0x60)<<3);
chr = spriteram[offs + 1] | ((spriteram[offs + 2] & 0x60) << 3);
chr = ((chr & 0x380) << 1) | (chr & 0x7f);
col = spriteram[offs+2] & 0x07;
fx = ((spriteram[offs+2] & 0x10) >> 4) ^ flip;
fy = ((spriteram[offs+2] & 0x08) >> 3) ^ flip; /* ??? */
x = spriteram[offs+3];
y = spriteram[offs+0];
if (flip==0)
col = spriteram[offs + 2] & 0x07;
fx = ((spriteram[offs + 2] & 0x10) >> 4) ^ flip;
fy = ((spriteram[offs + 2] & 0x08) >> 3) ^ flip; /* ??? */
x = spriteram[offs + 3];
y = spriteram[offs + 0];
if (flip == 0)
{
px = x;
py = 239-y;
py = 239 - y;
}
else
{
px = 248-x;
py = y+1;
px = 248 - x;
py = y + 1;
}
drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[3],
chr,
@ -248,34 +257,33 @@ VIDEO_UPDATE( momoko )
}
/* draw text layer */
for (y=16; y<240; y++)
/* draw text layer */
for (y = 16; y < 240; y++)
{
for (x=0; x<32; x++)
for (x = 0; x < 32; x++)
{
sy = y;
if (momoko_text_mode == 0)
col = TEXT_COLOR[ (sy >> 3) + 0x100 ] & 0x0f;
if (state->text_mode == 0)
col = TEXT_COLOR[(sy >> 3) + 0x100] & 0x0f;
else
{
if (TEXT_COLOR[ y ] < 0x08)
sy += momoko_text_scrolly;
col = (TEXT_COLOR[ y ] & 0x07) + 0x10;
if (TEXT_COLOR[y] < 0x08)
sy += state->text_scrolly;
col = (TEXT_COLOR[y] & 0x07) + 0x10;
}
dy=sy & 7;
if (flip==0)
dy = sy & 7;
if (flip == 0)
{
px = x*8;
px = x * 8;
py = y;
}
else
{
px = 248-x*8;
py = 255-y;
px = 248 - x * 8;
py = 255 - y;
}
drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],
screen->machine->generic.videoram.u8[(sy>>3)*32+x]*8+dy,
state->videoram[(sy >> 3) * 32 + x] * 8 + dy,
col,
flip,0,
px,py,0);
@ -283,30 +291,29 @@ VIDEO_UPDATE( momoko )
}
/* draw FG layer */
if (momoko_fg_mask==0)
/* draw FG layer */
if (state->fg_mask == 0)
{
dx = ( 7 - momoko_fg_scrollx ) & 7 ;
dy = ( 7 - momoko_fg_scrolly ) & 7 ;
rx = momoko_fg_scrollx >> 3 ;
ry = momoko_fg_scrolly >> 3 ;
dx = (7 - state->fg_scrollx) & 7;
dy = (7 - state->fg_scrolly) & 7;
rx = state->fg_scrollx >> 3;
ry = state->fg_scrolly >> 3;
for (y=0; y<29; y++)
for (y = 0; y < 29; y++)
{
for (x=0; x<32; x++)
for (x = 0; x < 32; x++)
{
radr = ((ry + y +34) & 0x3f) *0x20 + ((rx + x) & 0x1f) + (momoko_fg_select & 3) *0x800;
chr = FG_MAP[ radr ] ;
if (flip==0)
radr = ((ry + y + 34) & 0x3f) * 0x20 + ((rx + x) & 0x1f) + (state->fg_select & 3) * 0x800;
chr = FG_MAP[radr] ;
if (flip == 0)
{
px = 8*x+dx-6;
py = 8*y+dy+9;
px = 8 * x + dx - 6;
py = 8 * y + dy + 9;
}
else
{
px = 248-(8*x+dx-8);
py = 248-(8*y+dy+9);
px = 248 - (8 * x + dx - 8);
py = 248 - (8 * y + dy + 9);
}
drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[2],
chr,