mirror of
https://github.com/holub/mame
synced 2025-05-25 07:15:25 +03:00
Added save states to the following drivers: ddayjlc.c, ddealer.c, deniam.c, discoboy.c, diverboy.c, dorachan.c, dragrace.c, dreamwld.c, dribling.c, drmicro.c, drtomy.c
This commit is contained in:
parent
3ac828ef36
commit
c2d537c3dd
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -2406,6 +2406,7 @@ src/mame/includes/deco16ic.h svneol=native#text/plain
|
||||
src/mame/includes/deco32.h svneol=native#text/plain
|
||||
src/mame/includes/decocrpt.h svneol=native#text/plain
|
||||
src/mame/includes/decoprot.h svneol=native#text/plain
|
||||
src/mame/includes/deniam.h svneol=native#text/plain
|
||||
src/mame/includes/dkong.h svneol=native#text/plain
|
||||
src/mame/includes/docastle.h svneol=native#text/plain
|
||||
src/mame/includes/dogfgt.h svneol=native#text/plain
|
||||
@ -2413,6 +2414,7 @@ src/mame/includes/dooyong.h svneol=native#text/plain
|
||||
src/mame/includes/dragrace.h svneol=native#text/plain
|
||||
src/mame/includes/drgnmst.h svneol=native#text/plain
|
||||
src/mame/includes/dribling.h svneol=native#text/plain
|
||||
src/mame/includes/drmicro.h svneol=native#text/plain
|
||||
src/mame/includes/dynax.h svneol=native#text/plain
|
||||
src/mame/includes/eolithsp.h svneol=native#text/plain
|
||||
src/mame/includes/epos.h svneol=native#text/plain
|
||||
@ -3145,7 +3147,6 @@ src/mame/video/decocass.c svneol=native#text/plain
|
||||
src/mame/video/deniam.c svneol=native#text/plain
|
||||
src/mame/video/dietgo.c svneol=native#text/plain
|
||||
src/mame/video/digdug.c svneol=native#text/plain
|
||||
src/mame/video/diverboy.c svneol=native#text/plain
|
||||
src/mame/video/djboy.c svneol=native#text/plain
|
||||
src/mame/video/djmain.c svneol=native#text/plain
|
||||
src/mame/video/dkong.c svneol=native#text/plain
|
||||
|
@ -55,19 +55,29 @@ $842f = lives
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/ay8910.h"
|
||||
|
||||
static INT32 char_bank = 0;
|
||||
static tilemap *bg_tilemap;
|
||||
static UINT8 *bgram;
|
||||
static UINT8 *mainram;
|
||||
static INT32 bgadr = 0;
|
||||
|
||||
static INT32 sound_nmi_enable = 0;
|
||||
static INT32 main_nmi_enable = 0;
|
||||
typedef struct _ddayjlc_state ddayjlc_state;
|
||||
struct _ddayjlc_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * bgram;
|
||||
UINT8 * mainram;
|
||||
UINT8 * videoram;
|
||||
UINT8 * spriteram;
|
||||
|
||||
static INT32 e00x_l[4];
|
||||
static INT32 e00x_d[4][2];
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap;
|
||||
INT32 char_bank;
|
||||
INT32 bgadr;
|
||||
|
||||
/* misc */
|
||||
INT32 sound_nmi_enable;
|
||||
INT32 main_nmi_enable;
|
||||
INT32 e00x_l[4];
|
||||
INT32 e00x_d[4][2];
|
||||
UINT8 prot_addr;
|
||||
};
|
||||
|
||||
static UINT8 protAdr;
|
||||
|
||||
|
||||
/*
|
||||
@ -104,7 +114,7 @@ static UINT8 protAdr;
|
||||
|
||||
*/
|
||||
|
||||
static const UINT8 protData[0x10] =
|
||||
static const UINT8 prot_data[0x10] =
|
||||
{
|
||||
0x02, 0x02, 0x02, 0x02,
|
||||
0x02, 0x00, 0x02, 0x00,
|
||||
@ -114,81 +124,98 @@ static const UINT8 protData[0x10] =
|
||||
|
||||
static CUSTOM_INPUT( prot_r )
|
||||
{
|
||||
return protData[protAdr];
|
||||
ddayjlc_state *state = (ddayjlc_state *)field->port->machine->driver_data;
|
||||
return prot_data[state->prot_addr];
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( prot_w )
|
||||
{
|
||||
protAdr = (protAdr & (~(1<<offset))) | ((data & 1)<<offset);
|
||||
ddayjlc_state *state = (ddayjlc_state *)space->machine->driver_data;
|
||||
state->prot_addr = (state->prot_addr & (~(1 << offset))) | ((data & 1) << offset);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( char_bank_w )
|
||||
{
|
||||
char_bank = data;
|
||||
ddayjlc_state *state = (ddayjlc_state *)space->machine->driver_data;
|
||||
state->char_bank = data;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( ddayjlc_bgram_w )
|
||||
{
|
||||
if(!offset)
|
||||
tilemap_set_scrollx(bg_tilemap, 0, data + 8);
|
||||
ddayjlc_state *state = (ddayjlc_state *)space->machine->driver_data;
|
||||
|
||||
bgram[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset & 0x3ff);
|
||||
if (!offset)
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, data + 8);
|
||||
|
||||
state->bgram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset & 0x3ff);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( ddayjlc_videoram_w )
|
||||
{
|
||||
videoram[offset] = data;
|
||||
ddayjlc_state *state = (ddayjlc_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data;
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER(sound_nmi_w)
|
||||
{
|
||||
sound_nmi_enable = data;
|
||||
ddayjlc_state *state = (ddayjlc_state *)space->machine->driver_data;
|
||||
state->sound_nmi_enable = data;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER(main_nmi_w)
|
||||
{
|
||||
main_nmi_enable = data;
|
||||
ddayjlc_state *state = (ddayjlc_state *)space->machine->driver_data;
|
||||
state->main_nmi_enable = data;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( bg0_w )
|
||||
{
|
||||
bgadr = (bgadr & 0xfe) | (data & 1);
|
||||
ddayjlc_state *state = (ddayjlc_state *)space->machine->driver_data;
|
||||
state->bgadr = (state->bgadr & 0xfe) | (data & 1);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( bg1_w )
|
||||
{
|
||||
bgadr = (bgadr & 0xfd) | ((data & 1)<<1);
|
||||
ddayjlc_state *state = (ddayjlc_state *)space->machine->driver_data;
|
||||
state->bgadr = (state->bgadr & 0xfd) | ((data & 1) << 1);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER(bg2_w)
|
||||
static WRITE8_HANDLER( bg2_w )
|
||||
{
|
||||
bgadr = (bgadr & 0xfb) | ((data & 1)<<2);
|
||||
if(bgadr > 2)
|
||||
bgadr = 0;
|
||||
memory_set_bankptr(space->machine, 1, memory_region(space->machine, "user1") + bgadr * 0x4000 );
|
||||
ddayjlc_state *state = (ddayjlc_state *)space->machine->driver_data;
|
||||
|
||||
state->bgadr = (state->bgadr & 0xfb) | ((data & 1) << 2);
|
||||
if (state->bgadr > 2)
|
||||
state->bgadr = 0;
|
||||
|
||||
memory_set_bank(space->machine, 1, state->bgadr);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( sound_w )
|
||||
{
|
||||
soundlatch_w(space,offset,data);
|
||||
soundlatch_w(space, offset, data);
|
||||
cputag_set_input_line_and_vector(space->machine, "audiocpu", 0, HOLD_LINE, 0xff);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( i8257_CH0_w )
|
||||
{
|
||||
e00x_d[offset][e00x_l[offset]] = data;
|
||||
e00x_l[offset] ^= 1;
|
||||
ddayjlc_state *state = (ddayjlc_state *)space->machine->driver_data;
|
||||
|
||||
state->e00x_d[offset][state->e00x_l[offset]] = data;
|
||||
state->e00x_l[offset] ^= 1;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( i8257_LMSR_w )
|
||||
{
|
||||
if(!data)
|
||||
ddayjlc_state *state = (ddayjlc_state *)space->machine->driver_data;
|
||||
|
||||
if (!data)
|
||||
{
|
||||
INT32 src = e00x_d[0][1] * 256 + e00x_d[0][0];
|
||||
INT32 dst = e00x_d[2][1] * 256 + e00x_d[2][0];
|
||||
INT32 size = (e00x_d[1][1] * 256 + e00x_d[1][0]) & 0x3ff;
|
||||
INT32 src = state->e00x_d[0][1] * 256 + state->e00x_d[0][0];
|
||||
INT32 dst = state->e00x_d[2][1] * 256 + state->e00x_d[2][0];
|
||||
INT32 size = (state->e00x_d[1][1] * 256 + state->e00x_d[1][0]) & 0x3ff;
|
||||
INT32 i;
|
||||
|
||||
size++; //??
|
||||
@ -198,19 +225,19 @@ static WRITE8_HANDLER( i8257_LMSR_w )
|
||||
memory_write_byte(space, dst++, memory_read_byte(space, src++));
|
||||
}
|
||||
|
||||
e00x_l[0] = 0;
|
||||
e00x_l[1] = 0;
|
||||
e00x_l[2] = 0;
|
||||
e00x_l[3] = 0;
|
||||
state->e00x_l[0] = 0;
|
||||
state->e00x_l[1] = 0;
|
||||
state->e00x_l[2] = 0;
|
||||
state->e00x_l[3] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( main_cpu, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x8fff) AM_RAM AM_BASE(&mainram)
|
||||
AM_RANGE(0x9000, 0x93ff) AM_RAM AM_BASE(&spriteram)
|
||||
AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(ddayjlc_videoram_w) AM_BASE(&videoram)
|
||||
AM_RANGE(0x9800, 0x9fff) AM_RAM_WRITE(ddayjlc_bgram_w) AM_BASE(&bgram) /* 9800-981f - videoregs */
|
||||
AM_RANGE(0x8000, 0x8fff) AM_RAM AM_BASE_MEMBER(ddayjlc_state, mainram)
|
||||
AM_RANGE(0x9000, 0x93ff) AM_RAM AM_BASE_MEMBER(ddayjlc_state, spriteram)
|
||||
AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(ddayjlc_videoram_w) AM_BASE_MEMBER(ddayjlc_state, videoram)
|
||||
AM_RANGE(0x9800, 0x9fff) AM_RAM_WRITE(ddayjlc_bgram_w) AM_BASE_MEMBER(ddayjlc_state, bgram) /* 9800-981f - videoregs */
|
||||
AM_RANGE(0xa000, 0xdfff) AM_ROMBANK(1) AM_WRITENOP
|
||||
AM_RANGE(0xe000, 0xe003) AM_WRITE(i8257_CH0_w)
|
||||
AM_RANGE(0xe008, 0xe008) AM_WRITENOP
|
||||
@ -234,13 +261,11 @@ ADDRESS_MAP_END
|
||||
static ADDRESS_MAP_START( sound_cpu, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x1fff) AM_ROM
|
||||
AM_RANGE(0x2000, 0x23ff) AM_RAM
|
||||
AM_RANGE(0x7000, 0x7000) AM_WRITE(sound_nmi_w)
|
||||
|
||||
AM_RANGE(0x3000, 0x3000) AM_DEVREADWRITE("ay1", ay8910_r, ay8910_data_w)
|
||||
AM_RANGE(0x4000, 0x4000) AM_DEVWRITE("ay1", ay8910_address_w)
|
||||
AM_RANGE(0x5000, 0x5000) AM_DEVREADWRITE("ay2", ay8910_r, ay8910_data_w)
|
||||
AM_RANGE(0x6000, 0x6000) AM_DEVWRITE("ay2", ay8910_address_w)
|
||||
|
||||
AM_RANGE(0x7000, 0x7000) AM_WRITE(sound_nmi_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static INPUT_PORTS_START( ddayjlc )
|
||||
@ -334,45 +359,48 @@ GFXDECODE_END
|
||||
|
||||
static TILE_GET_INFO( get_tile_info_bg )
|
||||
{
|
||||
int code = bgram[tile_index]+((bgram[tile_index+0x400]&(1<<3))<<(8-3));
|
||||
ddayjlc_state *state = (ddayjlc_state *)machine->driver_data;
|
||||
int code = state->bgram[tile_index] + ((state->bgram[tile_index + 0x400] & (1 << 3)) << (8 - 3));
|
||||
|
||||
SET_TILE_INFO(2, code, 0, 0);
|
||||
}
|
||||
|
||||
static VIDEO_START( ddayjlc )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_tile_info_bg,tilemap_scan_rows,8,8,32,32);
|
||||
ddayjlc_state *state = (ddayjlc_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create(machine, get_tile_info_bg, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
}
|
||||
|
||||
static VIDEO_UPDATE( ddayjlc )
|
||||
{
|
||||
ddayjlc_state *state = (ddayjlc_state *)screen->machine->driver_data;
|
||||
UINT32 i;
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
|
||||
for (i = 0; i < 0x400; i += 4)
|
||||
{
|
||||
INT32 flags = spriteram[i + 2];
|
||||
INT32 y = 256-spriteram[i + 0]-8;
|
||||
INT32 code = spriteram[i + 1];
|
||||
INT32 x = spriteram[i + 3]-16;
|
||||
INT32 xflip = flags&0x80;
|
||||
INT32 yflip = (code&0x80);
|
||||
INT32 flags = state->spriteram[i + 2];
|
||||
INT32 y = 256 - state->spriteram[i + 0] - 8;
|
||||
INT32 code = state->spriteram[i + 1];
|
||||
INT32 x = state->spriteram[i + 3] - 16;
|
||||
INT32 xflip = flags & 0x80;
|
||||
INT32 yflip = (code & 0x80);
|
||||
|
||||
code=(code&0x7f)|((flags&0x30)<<3);
|
||||
code = (code & 0x7f) | ((flags & 0x30) << 3);
|
||||
|
||||
drawgfx_transpen(bitmap, cliprect, screen->machine->gfx[0], code, 1, xflip, yflip, x, y, 0);
|
||||
}
|
||||
|
||||
{
|
||||
UINT32 x,y,c;
|
||||
for(y=0;y<32;y++)
|
||||
for(x=0;x<32;x++)
|
||||
UINT32 x, y, c;
|
||||
for (y = 0; y < 32; y++)
|
||||
for (x = 0; x < 32; x++)
|
||||
{
|
||||
c=videoram[y*32+x];
|
||||
if(x>1&&x<30)
|
||||
drawgfx_transpen(bitmap, cliprect, screen->machine->gfx[1], c+char_bank*0x100, 1, 0, 0, x*8, y*8, 0);
|
||||
c = state->videoram[y * 32 + x];
|
||||
if (x > 1 && x < 30)
|
||||
drawgfx_transpen(bitmap, cliprect, screen->machine->gfx[1], c + state->char_bank * 0x100, 1, 0, 0, x*8, y*8, 0);
|
||||
else
|
||||
drawgfx_opaque(bitmap, cliprect, screen->machine->gfx[1], c+char_bank*0x100, 1, 0, 0, x*8, y*8);
|
||||
drawgfx_opaque(bitmap, cliprect, screen->machine->gfx[1], c + state->char_bank * 0x100, 1, 0, 0, x*8, y*8);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -390,17 +418,61 @@ static const ay8910_interface ay8910_config =
|
||||
|
||||
static INTERRUPT_GEN( ddayjlc_interrupt )
|
||||
{
|
||||
if(main_nmi_enable)
|
||||
ddayjlc_state *state = (ddayjlc_state *)device->machine->driver_data;
|
||||
if(state->main_nmi_enable)
|
||||
cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
|
||||
static INTERRUPT_GEN( ddayjlc_snd_interrupt )
|
||||
{
|
||||
if(sound_nmi_enable)
|
||||
ddayjlc_state *state = (ddayjlc_state *)device->machine->driver_data;
|
||||
if(state->sound_nmi_enable)
|
||||
cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_START( ddayjlc )
|
||||
{
|
||||
ddayjlc_state *state = (ddayjlc_state *)machine->driver_data;
|
||||
|
||||
state_save_register_global(machine, state->char_bank);
|
||||
state_save_register_global(machine, state->bgadr);
|
||||
state_save_register_global(machine, state->sound_nmi_enable);
|
||||
state_save_register_global(machine, state->main_nmi_enable);
|
||||
state_save_register_global(machine, state->prot_addr);
|
||||
|
||||
state_save_register_global_array(machine, state->e00x_l);
|
||||
state_save_register_global_array(machine, state->e00x_d[0]);
|
||||
state_save_register_global_array(machine, state->e00x_d[1]);
|
||||
state_save_register_global_array(machine, state->e00x_d[2]);
|
||||
state_save_register_global_array(machine, state->e00x_d[3]);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( ddayjlc )
|
||||
{
|
||||
ddayjlc_state *state = (ddayjlc_state *)machine->driver_data;
|
||||
int i;
|
||||
|
||||
state->char_bank = 0;
|
||||
state->bgadr = 0;
|
||||
state->sound_nmi_enable = 0;
|
||||
state->main_nmi_enable = 0;
|
||||
state->prot_addr = 0;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
state->e00x_l[i] = 0;
|
||||
state->e00x_d[i][0] = 0;
|
||||
state->e00x_d[i][1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( ddayjlc )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(ddayjlc_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80,12000000/3)
|
||||
MDRV_CPU_PROGRAM_MAP(main_cpu)
|
||||
MDRV_CPU_VBLANK_INT("screen", ddayjlc_interrupt)
|
||||
@ -411,6 +483,9 @@ static MACHINE_DRIVER_START( ddayjlc )
|
||||
|
||||
MDRV_QUANTUM_TIME(HZ(6000))
|
||||
|
||||
MDRV_MACHINE_START(ddayjlc)
|
||||
MDRV_MACHINE_RESET(ddayjlc)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -561,21 +636,21 @@ static DRIVER_INIT( ddayjlc )
|
||||
dst = memory_region(machine, "gfx1");
|
||||
length = memory_region_length(machine, "gfx1");
|
||||
memcpy(src, dst, length);
|
||||
newadr=0;
|
||||
oldaddr=0;
|
||||
for (j = 0; j < length/2; j+=32)
|
||||
newadr = 0;
|
||||
oldaddr = 0;
|
||||
for (j = 0; j < length / 2; j += 32)
|
||||
{
|
||||
repack(0);
|
||||
repack(0x4000)
|
||||
newadr+=32;
|
||||
oldaddr+=16;
|
||||
newadr += 32;
|
||||
oldaddr += 16;
|
||||
}
|
||||
free(temp);
|
||||
}
|
||||
|
||||
memory_set_bankptr(machine, 1, memory_region(machine, "user1") );
|
||||
|
||||
memory_configure_bank(machine, 1, 0, 3, memory_region(machine, "user1"), 0x4000);
|
||||
memory_set_bank(machine, 1, 0);
|
||||
}
|
||||
|
||||
GAME( 1984, ddayjlc, 0, ddayjlc, ddayjlc, ddayjlc, ROT90, "Jaleco", "D-Day (Jaleco set 1)", GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
|
||||
GAME( 1984, ddayjlca, ddayjlc, ddayjlc, ddayjlc, ddayjlc, ROT90, "Jaleco", "D-Day (Jaleco set 2)", GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
|
||||
GAME( 1984, ddayjlc, 0, ddayjlc, ddayjlc, ddayjlc, ROT90, "Jaleco", "D-Day (Jaleco set 1)", GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, ddayjlca, ddayjlc, ddayjlc, ddayjlc, ddayjlc, ROT90, "Jaleco", "D-Day (Jaleco set 2)", GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
|
@ -113,21 +113,42 @@ Few words about protection:
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "sound/2203intf.h"
|
||||
|
||||
static UINT16 *mcu_shared_ram,*work_ram;
|
||||
static UINT16 *back_vram,*left_fg_vram_top, *right_fg_vram_top, *right_fg_vram_bottom, *left_fg_vram_bottom;
|
||||
static UINT16 *ddealer_vregs;
|
||||
static tilemap *back_tilemap;
|
||||
static int respcount;
|
||||
static int ddealer_flipscreen;
|
||||
typedef struct _ddealer_state ddealer_state;
|
||||
struct _ddealer_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT16 * mcu_shared_ram;
|
||||
UINT16 * work_ram;
|
||||
UINT16 * back_vram;
|
||||
UINT16 * left_fg_vram_top;
|
||||
UINT16 * right_fg_vram_top;
|
||||
UINT16 * left_fg_vram_bottom;
|
||||
UINT16 * right_fg_vram_bottom;
|
||||
UINT16 * vregs;
|
||||
// UINT16 * paletteram16; // currently this uses generic palette handling
|
||||
|
||||
/* video-related */
|
||||
tilemap *back_tilemap;
|
||||
int respcount;
|
||||
int flipscreen;
|
||||
|
||||
/* misc */
|
||||
UINT8 input_pressed;
|
||||
UINT16 coin_input;
|
||||
};
|
||||
|
||||
|
||||
|
||||
static WRITE16_HANDLER( ddealer_flipscreen_w )
|
||||
{
|
||||
ddealer_flipscreen = data & 0x01;
|
||||
ddealer_state *state = (ddealer_state *)space->machine->driver_data;
|
||||
state->flipscreen = data & 0x01;
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_back_tile_info )
|
||||
{
|
||||
int code = back_vram[tile_index];
|
||||
ddealer_state *state = (ddealer_state *)machine->driver_data;
|
||||
int code = state->back_vram[tile_index];
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
code & 0xfff,
|
||||
@ -137,91 +158,88 @@ static TILE_GET_INFO( get_back_tile_info )
|
||||
|
||||
static VIDEO_START( ddealer )
|
||||
{
|
||||
ddealer_flipscreen = 0;
|
||||
back_tilemap = tilemap_create(machine, get_back_tile_info,tilemap_scan_cols,8,8,64,32);
|
||||
ddealer_state *state = (ddealer_state *)machine->driver_data;
|
||||
state->flipscreen = 0;
|
||||
state->back_tilemap = tilemap_create(machine, get_back_tile_info, tilemap_scan_cols, 8, 8, 64, 32);
|
||||
}
|
||||
|
||||
static void ddealer_draw_video_layer( running_machine *machine, UINT16* vreg_base, UINT16* top, UINT16* bottom, bitmap_t* bitmap, const rectangle *cliprect, int flipy)
|
||||
{
|
||||
const gfx_element *gfx = machine->gfx[1];
|
||||
|
||||
INT16 sx, sy;
|
||||
int x,y, count;
|
||||
UINT16* src;
|
||||
|
||||
sx = ((vreg_base[0x4 / 2] & 0xff));
|
||||
sx |= ((vreg_base[0x2 / 2] & 0xff) << 8);
|
||||
|
||||
sx &= 0x7ff;
|
||||
if (sx & 0x400) sx -= 0x800;
|
||||
|
||||
sy = ((vreg_base[0x8 / 2] & 0xff));
|
||||
sy |= ((vreg_base[0x6 / 2] & 0xff) << 8);
|
||||
|
||||
if (!flipy)
|
||||
{
|
||||
INT16 sx, sy;
|
||||
int x,y, count;
|
||||
UINT16* src;
|
||||
sx -= 64; // video shift
|
||||
|
||||
sx = ((vreg_base[0x4/2] & 0xff));
|
||||
sx |= ((vreg_base[0x2/2] & 0xff) << 8);
|
||||
|
||||
sx &=0x7ff;
|
||||
if (sx & 0x400) sx-=0x800;
|
||||
|
||||
sy = ((vreg_base[0x8/2] & 0xff));
|
||||
sy |= ((vreg_base[0x6/2] & 0xff) << 8);
|
||||
|
||||
|
||||
if (!flipy)
|
||||
/* the tilemaps seems to be split into top / bottom pieces */
|
||||
count = 0;
|
||||
src = top;
|
||||
for (x = 0; x < 128; x++)
|
||||
{
|
||||
sx -= 64; // video shift
|
||||
|
||||
|
||||
/* the tilemaps seems to be split into top / bottom pieces */
|
||||
count = 0;
|
||||
src = top;
|
||||
for (x=0;x<128;x++)
|
||||
for (y = 0; y < 16; y++)
|
||||
{
|
||||
for (y=0;y<16;y++)
|
||||
{
|
||||
UINT16 tile = (src[count]&0x0fff);
|
||||
UINT16 colr = (src[count]&0xf000)>>12;
|
||||
count++;
|
||||
drawgfx_transpen(bitmap,cliprect,gfx,tile,colr,0,flipy,(x*16)-sx,(y*16)-sy,15);
|
||||
}
|
||||
}
|
||||
count = 0;
|
||||
src = bottom;
|
||||
sy -= 256;
|
||||
for (x=0;x<128;x++)
|
||||
{
|
||||
for (y=0;y<16;y++)
|
||||
{
|
||||
UINT16 tile = (src[count]&0x0fff);
|
||||
UINT16 colr = (src[count]&0xf000)>>12;
|
||||
count++;
|
||||
drawgfx_transpen(bitmap,cliprect,gfx,tile,colr,0,flipy,(x*16)-sx,(y*16)-sy,15);
|
||||
}
|
||||
UINT16 tile = (src[count] & 0x0fff);
|
||||
UINT16 colr = (src[count] & 0xf000) >> 12;
|
||||
count++;
|
||||
drawgfx_transpen(bitmap, cliprect, gfx, tile, colr, 0, flipy, (x * 16) - sx, (y * 16) - sy, 15);
|
||||
}
|
||||
}
|
||||
else
|
||||
count = 0;
|
||||
src = bottom;
|
||||
sy -= 256;
|
||||
for (x = 0; x < 128; x++)
|
||||
{
|
||||
sx -= 0x6d0;
|
||||
sy -= 16;
|
||||
|
||||
/* the tilemaps seems to be split into top / bottom pieces */
|
||||
count = 0;
|
||||
src = top;
|
||||
for (x=128;x>0;x--)
|
||||
for (y = 0; y < 16; y++)
|
||||
{
|
||||
for (y=16;y>0;y--)
|
||||
{
|
||||
UINT16 tile = (src[count]&0x0fff);
|
||||
UINT16 colr = (src[count]&0xf000)>>12;
|
||||
count++;
|
||||
drawgfx_transpen(bitmap,cliprect,gfx,tile,colr,flipy,flipy,(x*16)+sx,(y*16)+sy,15);
|
||||
}
|
||||
UINT16 tile = (src[count] & 0x0fff);
|
||||
UINT16 colr = (src[count] & 0xf000) >> 12;
|
||||
count++;
|
||||
drawgfx_transpen(bitmap, cliprect, gfx, tile, colr, 0, flipy, (x * 16) - sx, (y * 16) - sy, 15);
|
||||
}
|
||||
count = 0;
|
||||
src = bottom;
|
||||
sy -= 256;
|
||||
for (x=128;x>0;x--)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sx -= 0x6d0;
|
||||
sy -= 16;
|
||||
|
||||
/* the tilemaps seems to be split into top / bottom pieces */
|
||||
count = 0;
|
||||
src = top;
|
||||
for (x = 128; x > 0; x--)
|
||||
{
|
||||
for (y = 16; y > 0; y--)
|
||||
{
|
||||
for (y=16;y>0;y--)
|
||||
{
|
||||
UINT16 tile = (src[count]&0x0fff);
|
||||
UINT16 colr = (src[count]&0xf000)>>12;
|
||||
count++;
|
||||
drawgfx_transpen(bitmap,cliprect,gfx,tile,colr,flipy,flipy,(x*16)+sx,(y*16)+sy,15);
|
||||
}
|
||||
UINT16 tile = (src[count] & 0x0fff);
|
||||
UINT16 colr = (src[count] & 0xf000) >> 12;
|
||||
count++;
|
||||
drawgfx_transpen(bitmap, cliprect, gfx, tile, colr, flipy, flipy, (x * 16) + sx, (y * 16) + sy, 15);
|
||||
}
|
||||
}
|
||||
count = 0;
|
||||
src = bottom;
|
||||
sy -= 256;
|
||||
for (x = 128; x > 0; x--)
|
||||
{
|
||||
for (y = 16; y > 0; y--)
|
||||
{
|
||||
UINT16 tile = (src[count] & 0x0fff);
|
||||
UINT16 colr = (src[count] & 0xf000) >> 12;
|
||||
count++;
|
||||
drawgfx_transpen(bitmap, cliprect, gfx, tile, colr, flipy, flipy, (x * 16) + sx, (y * 16) + sy, 15);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -230,9 +248,10 @@ static void ddealer_draw_video_layer( running_machine *machine, UINT16* vreg_bas
|
||||
|
||||
static VIDEO_UPDATE( ddealer )
|
||||
{
|
||||
tilemap_set_scrollx( back_tilemap, 0, ddealer_flipscreen? -192: -64);
|
||||
tilemap_set_flip(back_tilemap, ddealer_flipscreen? TILEMAP_FLIPY|TILEMAP_FLIPX:0);
|
||||
tilemap_draw(bitmap,cliprect,back_tilemap,0,0);
|
||||
ddealer_state *state = (ddealer_state *)screen->machine->driver_data;
|
||||
tilemap_set_scrollx(state->back_tilemap, 0, state->flipscreen ? -192 : -64);
|
||||
tilemap_set_flip(state->back_tilemap, state->flipscreen ? TILEMAP_FLIPY | TILEMAP_FLIPX : 0);
|
||||
tilemap_draw(bitmap, cliprect, state->back_tilemap, 0, 0);
|
||||
|
||||
/* the fg tilemap handling is a little hacky right now,
|
||||
i'm not sure if it should be a single tilemap with
|
||||
@ -240,28 +259,28 @@ static VIDEO_UPDATE( ddealer )
|
||||
combined, the flipscreen case makes things more
|
||||
difficult to understand */
|
||||
|
||||
if (!ddealer_flipscreen)
|
||||
if (!state->flipscreen)
|
||||
{
|
||||
if (ddealer_vregs[0xcc/2] & 0x80)
|
||||
if (state->vregs[0xcc / 2] & 0x80)
|
||||
{
|
||||
ddealer_draw_video_layer(screen->machine, &ddealer_vregs[0x1e0/2], left_fg_vram_top, left_fg_vram_bottom, bitmap, cliprect, ddealer_flipscreen);
|
||||
ddealer_draw_video_layer(screen->machine, &ddealer_vregs[0xcc/2], right_fg_vram_top, right_fg_vram_bottom, bitmap, cliprect, ddealer_flipscreen);
|
||||
ddealer_draw_video_layer(screen->machine, &state->vregs[0x1e0 / 2], state->left_fg_vram_top, state->left_fg_vram_bottom, bitmap, cliprect, state->flipscreen);
|
||||
ddealer_draw_video_layer(screen->machine, &state->vregs[0xcc / 2], state->right_fg_vram_top, state->right_fg_vram_bottom, bitmap, cliprect, state->flipscreen);
|
||||
}
|
||||
else
|
||||
{
|
||||
ddealer_draw_video_layer(screen->machine, &ddealer_vregs[0x1e0/2], left_fg_vram_top, left_fg_vram_bottom, bitmap, cliprect, ddealer_flipscreen);
|
||||
ddealer_draw_video_layer(screen->machine, &state->vregs[0x1e0 / 2], state->left_fg_vram_top, state->left_fg_vram_bottom, bitmap, cliprect, state->flipscreen);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ddealer_vregs[0xcc/2] & 0x80)
|
||||
if (state->vregs[0xcc / 2] & 0x80)
|
||||
{
|
||||
ddealer_draw_video_layer(screen->machine, &ddealer_vregs[0xcc/2], left_fg_vram_top, left_fg_vram_bottom, bitmap, cliprect, ddealer_flipscreen);
|
||||
ddealer_draw_video_layer(screen->machine, &ddealer_vregs[0x1e0/2], right_fg_vram_top, right_fg_vram_bottom, bitmap, cliprect, ddealer_flipscreen);
|
||||
ddealer_draw_video_layer(screen->machine, &state->vregs[0xcc / 2], state->left_fg_vram_top, state->left_fg_vram_bottom, bitmap, cliprect, state->flipscreen);
|
||||
ddealer_draw_video_layer(screen->machine, &state->vregs[0x1e0 / 2], state->right_fg_vram_top, state->right_fg_vram_bottom, bitmap, cliprect, state->flipscreen);
|
||||
}
|
||||
else
|
||||
{
|
||||
ddealer_draw_video_layer(screen->machine, &ddealer_vregs[0x1e0/2], left_fg_vram_top, left_fg_vram_bottom, bitmap, cliprect, ddealer_flipscreen);
|
||||
ddealer_draw_video_layer(screen->machine, &state->vregs[0x1e0 / 2], state->left_fg_vram_top, state->left_fg_vram_bottom, bitmap, cliprect, state->flipscreen);
|
||||
}
|
||||
|
||||
}
|
||||
@ -271,82 +290,83 @@ static VIDEO_UPDATE( ddealer )
|
||||
|
||||
static TIMER_DEVICE_CALLBACK( ddealer_mcu_sim )
|
||||
{
|
||||
ddealer_state *state = (ddealer_state *)timer->machine->driver_data;
|
||||
|
||||
/*coin/credit simulation*/
|
||||
/*$fe002 is used,might be for multiple coins for one credit settings.*/
|
||||
static UINT8 input_pressed;
|
||||
static UINT16 coin_input;
|
||||
state->coin_input = (~(input_port_read(timer->machine, "IN0")));
|
||||
|
||||
coin_input = (~(input_port_read(timer->machine, "IN0")));
|
||||
|
||||
if(coin_input & 0x01)//coin 1
|
||||
if (state->coin_input & 0x01)//coin 1
|
||||
{
|
||||
if((input_pressed & 0x01) == 0)
|
||||
mcu_shared_ram[0x000/2]++;
|
||||
input_pressed = (input_pressed & 0xfe) | 1;
|
||||
if((state->input_pressed & 0x01) == 0)
|
||||
state->mcu_shared_ram[0x000 / 2]++;
|
||||
state->input_pressed = (state->input_pressed & 0xfe) | 1;
|
||||
}
|
||||
else
|
||||
input_pressed = (input_pressed & 0xfe);
|
||||
state->input_pressed = (state->input_pressed & 0xfe);
|
||||
|
||||
if(coin_input & 0x02)//coin 2
|
||||
if (state->coin_input & 0x02)//coin 2
|
||||
{
|
||||
if((input_pressed & 0x02) == 0)
|
||||
mcu_shared_ram[0x000/2]++;
|
||||
input_pressed = (input_pressed & 0xfd) | 2;
|
||||
if ((state->input_pressed & 0x02) == 0)
|
||||
state->mcu_shared_ram[0x000 / 2]++;
|
||||
state->input_pressed = (state->input_pressed & 0xfd) | 2;
|
||||
}
|
||||
else
|
||||
input_pressed = (input_pressed & 0xfd);
|
||||
state->input_pressed = (state->input_pressed & 0xfd);
|
||||
|
||||
if(coin_input & 0x04)//service 1
|
||||
if (state->coin_input & 0x04)//service 1
|
||||
{
|
||||
if((input_pressed & 0x04) == 0)
|
||||
mcu_shared_ram[0x000/2]++;
|
||||
input_pressed = (input_pressed & 0xfb) | 4;
|
||||
if ((state->input_pressed & 0x04) == 0)
|
||||
state->mcu_shared_ram[0x000 / 2]++;
|
||||
state->input_pressed = (state->input_pressed & 0xfb) | 4;
|
||||
}
|
||||
else
|
||||
input_pressed = (input_pressed & 0xfb);
|
||||
state->input_pressed = (state->input_pressed & 0xfb);
|
||||
|
||||
/*0x104/2 is some sort of "start-lock",i.e. used on the girl selection.
|
||||
Without it,the game "steals" one credit if you press the start button on that.*/
|
||||
if(mcu_shared_ram[0x000/2] > 0 && work_ram[0x104/2] & 1)
|
||||
if (state->mcu_shared_ram[0x000 / 2] > 0 && state->work_ram[0x104 / 2] & 1)
|
||||
{
|
||||
if(coin_input & 0x08)//start 1
|
||||
if (state->coin_input & 0x08)//start 1
|
||||
{
|
||||
if((input_pressed & 0x08) == 0 && (~(work_ram[0x100/2] & 1)))
|
||||
mcu_shared_ram[0x000/2]--;
|
||||
input_pressed = (input_pressed & 0xf7) | 8;
|
||||
if ((state->input_pressed & 0x08) == 0 && (~(state->work_ram[0x100 / 2] & 1)))
|
||||
state->mcu_shared_ram[0x000 / 2]--;
|
||||
state->input_pressed = (state->input_pressed & 0xf7) | 8;
|
||||
}
|
||||
else
|
||||
input_pressed = (input_pressed & 0xf7);
|
||||
state->input_pressed = (state->input_pressed & 0xf7);
|
||||
|
||||
if(coin_input & 0x10)//start 2
|
||||
if (state->coin_input & 0x10)//start 2
|
||||
{
|
||||
if((input_pressed & 0x10) == 0 && (~(work_ram[0x100/2] & 2)))
|
||||
mcu_shared_ram[0x000/2]--;
|
||||
input_pressed = (input_pressed & 0xef) | 0x10;
|
||||
if((state->input_pressed & 0x10) == 0 && (~(state->work_ram[0x100 / 2] & 2)))
|
||||
state->mcu_shared_ram[0x000 / 2]--;
|
||||
state->input_pressed = (state->input_pressed & 0xef) | 0x10;
|
||||
}
|
||||
else
|
||||
input_pressed = (input_pressed & 0xef);
|
||||
state->input_pressed = (state->input_pressed & 0xef);
|
||||
}
|
||||
|
||||
/*random number generators,controls order of cards*/
|
||||
mcu_shared_ram[0x10/2] = mame_rand(timer->machine) & 0xffff;
|
||||
mcu_shared_ram[0x12/2] = mame_rand(timer->machine) & 0xffff;
|
||||
mcu_shared_ram[0x14/2] = mame_rand(timer->machine) & 0xffff;
|
||||
mcu_shared_ram[0x16/2] = mame_rand(timer->machine) & 0xffff;
|
||||
state->mcu_shared_ram[0x10 / 2] = mame_rand(timer->machine) & 0xffff;
|
||||
state->mcu_shared_ram[0x12 / 2] = mame_rand(timer->machine) & 0xffff;
|
||||
state->mcu_shared_ram[0x14 / 2] = mame_rand(timer->machine) & 0xffff;
|
||||
state->mcu_shared_ram[0x16 / 2] = mame_rand(timer->machine) & 0xffff;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static WRITE16_HANDLER( back_vram_w )
|
||||
{
|
||||
COMBINE_DATA(&back_vram[offset]);
|
||||
tilemap_mark_tile_dirty(back_tilemap,offset);
|
||||
ddealer_state *state = (ddealer_state *)space->machine->driver_data;
|
||||
COMBINE_DATA(&state->back_vram[offset]);
|
||||
tilemap_mark_tile_dirty(state->back_tilemap, offset);
|
||||
}
|
||||
|
||||
|
||||
static WRITE16_HANDLER( ddealer_vregs_w )
|
||||
{
|
||||
COMBINE_DATA(&ddealer_vregs[offset]);
|
||||
ddealer_state *state = (ddealer_state *)space->machine->driver_data;
|
||||
COMBINE_DATA(&state->vregs[offset]);
|
||||
}
|
||||
|
||||
/******************************************************************************************************
|
||||
@ -356,24 +376,25 @@ Protection handling,identical to Hacha Mecha Fighter / Thunder Dragon with diffe
|
||||
******************************************************************************************************/
|
||||
|
||||
#define PROT_JSR(_offs_,_protvalue_,_pc_) \
|
||||
if(mcu_shared_ram[(_offs_)/2] == _protvalue_) \
|
||||
if(state->mcu_shared_ram[(_offs_)/2] == _protvalue_) \
|
||||
{ \
|
||||
mcu_shared_ram[(_offs_)/2] = 0xffff; /*(MCU job done)*/ \
|
||||
mcu_shared_ram[(_offs_+2-0x10)/2] = 0x4ef9;/*JMP*/\
|
||||
mcu_shared_ram[(_offs_+4-0x10)/2] = 0x0000;/*HI-DWORD*/\
|
||||
mcu_shared_ram[(_offs_+6-0x10)/2] = _pc_; /*LO-DWORD*/\
|
||||
state->mcu_shared_ram[(_offs_)/2] = 0xffff; /*(MCU job done)*/ \
|
||||
state->mcu_shared_ram[(_offs_+2-0x10)/2] = 0x4ef9;/*JMP*/\
|
||||
state->mcu_shared_ram[(_offs_+4-0x10)/2] = 0x0000;/*HI-DWORD*/\
|
||||
state->mcu_shared_ram[(_offs_+6-0x10)/2] = _pc_; /*LO-DWORD*/\
|
||||
} \
|
||||
|
||||
#define PROT_INPUT(_offs_,_protvalue_,_protinput_,_input_) \
|
||||
if(mcu_shared_ram[_offs_] == _protvalue_) \
|
||||
if(state->mcu_shared_ram[_offs_] == _protvalue_) \
|
||||
{\
|
||||
mcu_shared_ram[_protinput_] = ((_input_ & 0xffff0000)>>16);\
|
||||
mcu_shared_ram[_protinput_+1] = (_input_ & 0x0000ffff);\
|
||||
state->mcu_shared_ram[_protinput_] = ((_input_ & 0xffff0000)>>16);\
|
||||
state->mcu_shared_ram[_protinput_+1] = (_input_ & 0x0000ffff);\
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( ddealer_mcu_shared_w )
|
||||
{
|
||||
COMBINE_DATA(&mcu_shared_ram[offset]);
|
||||
ddealer_state *state = (ddealer_state *)space->machine->driver_data;
|
||||
COMBINE_DATA(&state->mcu_shared_ram[offset]);
|
||||
|
||||
switch(offset)
|
||||
{
|
||||
@ -405,25 +426,26 @@ static WRITE16_HANDLER( ddealer_mcu_shared_w )
|
||||
case 0x4fe/2: PROT_JSR(0x4fe,0x8018,0x9818); break;
|
||||
/*Start-up vector,I think that only the first ram address can be written by the main CPU,or it is a whole sequence.*/
|
||||
case 0x000/2:
|
||||
if(mcu_shared_ram[0x000/2] == 0x60fe)
|
||||
if (state->mcu_shared_ram[0x000 / 2] == 0x60fe)
|
||||
{
|
||||
mcu_shared_ram[0x000/2] = 0x0000;//coin counter
|
||||
mcu_shared_ram[0x002/2] = 0x0000;//coin counter "decimal point"
|
||||
mcu_shared_ram[0x004/2] = 0x4ef9;
|
||||
state->mcu_shared_ram[0x000 / 2] = 0x0000;//coin counter
|
||||
state->mcu_shared_ram[0x002 / 2] = 0x0000;//coin counter "decimal point"
|
||||
state->mcu_shared_ram[0x004 / 2] = 0x4ef9;
|
||||
}
|
||||
break;
|
||||
case 0x002/2:
|
||||
case 0x004/2:
|
||||
if(mcu_shared_ram[0x002/2] == 0x0000 && mcu_shared_ram[0x004/2] == 0x0214)
|
||||
mcu_shared_ram[0x004/2] = 0x4ef9;
|
||||
if (state->mcu_shared_ram[0x002 / 2] == 0x0000 && state->mcu_shared_ram[0x004 / 2] == 0x0214)
|
||||
state->mcu_shared_ram[0x004 / 2] = 0x4ef9;
|
||||
break;
|
||||
case 0x008/2:
|
||||
if(mcu_shared_ram[0x008/2] == 0x000f)
|
||||
mcu_shared_ram[0x008/2] = 0x0604;
|
||||
if (state->mcu_shared_ram[0x008 / 2] == 0x000f)
|
||||
state->mcu_shared_ram[0x008 / 2] = 0x0604;
|
||||
break;
|
||||
case 0x00c/2:
|
||||
if(mcu_shared_ram[0x00c/2] == 0x000f)
|
||||
mcu_shared_ram[0x00c/2] = 0x0000;
|
||||
if (state->mcu_shared_ram[0x00c / 2] == 0x000f)
|
||||
state->mcu_shared_ram[0x00c / 2] = 0x0000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -435,18 +457,18 @@ static ADDRESS_MAP_START( ddealer, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x08000a, 0x08000b) AM_READ_PORT("UNK")
|
||||
AM_RANGE(0x084000, 0x084003) AM_DEVWRITE8("ymsnd", ym2203_w, 0x00ff) // ym ?
|
||||
AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16) // palette ram
|
||||
AM_RANGE(0x08c000, 0x08cfff) AM_RAM_WRITE(ddealer_vregs_w) AM_BASE(&ddealer_vregs) // palette ram
|
||||
AM_RANGE(0x08c000, 0x08cfff) AM_RAM_WRITE(ddealer_vregs_w) AM_BASE_MEMBER(ddealer_state, vregs) // palette ram
|
||||
|
||||
/* this might actually be 1 tilemap with some funky rowscroll / columnscroll enabled, I'm not sure */
|
||||
AM_RANGE(0x090000, 0x090fff) AM_RAM AM_BASE(&left_fg_vram_top)
|
||||
AM_RANGE(0x091000, 0x091fff) AM_RAM AM_BASE(&right_fg_vram_top)
|
||||
AM_RANGE(0x092000, 0x092fff) AM_RAM AM_BASE(&left_fg_vram_bottom)
|
||||
AM_RANGE(0x093000, 0x093fff) AM_RAM AM_BASE(&right_fg_vram_bottom)
|
||||
AM_RANGE(0x090000, 0x090fff) AM_RAM AM_BASE_MEMBER(ddealer_state, left_fg_vram_top)
|
||||
AM_RANGE(0x091000, 0x091fff) AM_RAM AM_BASE_MEMBER(ddealer_state, right_fg_vram_top)
|
||||
AM_RANGE(0x092000, 0x092fff) AM_RAM AM_BASE_MEMBER(ddealer_state, left_fg_vram_bottom)
|
||||
AM_RANGE(0x093000, 0x093fff) AM_RAM AM_BASE_MEMBER(ddealer_state, right_fg_vram_bottom)
|
||||
//AM_RANGE(0x094000, 0x094001) AM_NOP // always 0?
|
||||
AM_RANGE(0x098000, 0x098001) AM_WRITE(ddealer_flipscreen_w)
|
||||
AM_RANGE(0x09c000, 0x09cfff) AM_RAM_WRITE(back_vram_w) AM_BASE(&back_vram) // bg tilemap
|
||||
AM_RANGE(0x0f0000, 0x0fdfff) AM_RAM AM_BASE(&work_ram)
|
||||
AM_RANGE(0x0fe000, 0x0fefff) AM_RAM_WRITE(ddealer_mcu_shared_w) AM_BASE(&mcu_shared_ram)
|
||||
AM_RANGE(0x09c000, 0x09cfff) AM_RAM_WRITE(back_vram_w) AM_BASE_MEMBER(ddealer_state, back_vram) // bg tilemap
|
||||
AM_RANGE(0x0f0000, 0x0fdfff) AM_RAM AM_BASE_MEMBER(ddealer_state, work_ram)
|
||||
AM_RANGE(0x0fe000, 0x0fefff) AM_RAM_WRITE(ddealer_mcu_shared_w) AM_BASE_MEMBER(ddealer_state, mcu_shared_ram)
|
||||
AM_RANGE(0x0ff000, 0x0fffff) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -563,9 +585,24 @@ static GFXDECODE_START( ddealer )
|
||||
GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 0x100, 16 )
|
||||
GFXDECODE_END
|
||||
|
||||
static MACHINE_START( ddealer )
|
||||
{
|
||||
ddealer_state *state = (ddealer_state *)machine->driver_data;
|
||||
|
||||
state_save_register_global(machine, state->respcount);
|
||||
state_save_register_global(machine, state->flipscreen);
|
||||
state_save_register_global(machine, state->input_pressed);
|
||||
state_save_register_global(machine, state->coin_input);
|
||||
}
|
||||
|
||||
static MACHINE_RESET (ddealer)
|
||||
{
|
||||
respcount = 0;
|
||||
ddealer_state *state = (ddealer_state *)machine->driver_data;
|
||||
|
||||
state->respcount = 0;
|
||||
state->flipscreen = 0;
|
||||
state->input_pressed = 0;
|
||||
state->coin_input = 0;
|
||||
}
|
||||
|
||||
static INTERRUPT_GEN( ddealer_interrupt )
|
||||
@ -574,6 +611,8 @@ static INTERRUPT_GEN( ddealer_interrupt )
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( ddealer )
|
||||
MDRV_DRIVER_DATA(ddealer_state)
|
||||
|
||||
MDRV_CPU_ADD("maincpu" , M68000, 10000000)
|
||||
MDRV_CPU_PROGRAM_MAP(ddealer)
|
||||
MDRV_CPU_VBLANK_INT("screen", ddealer_interrupt)
|
||||
@ -581,6 +620,9 @@ static MACHINE_DRIVER_START( ddealer )
|
||||
|
||||
// M50747 or NMK-110 8131 MCU
|
||||
|
||||
MDRV_MACHINE_START(ddealer)
|
||||
MDRV_MACHINE_RESET(ddealer)
|
||||
|
||||
MDRV_GFXDECODE(ddealer)
|
||||
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
@ -591,7 +633,6 @@ static MACHINE_DRIVER_START( ddealer )
|
||||
MDRV_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 2*8, 30*8-1)
|
||||
|
||||
MDRV_PALETTE_LENGTH(0x400)
|
||||
MDRV_MACHINE_RESET(ddealer)
|
||||
|
||||
MDRV_VIDEO_START(ddealer)
|
||||
MDRV_VIDEO_UPDATE(ddealer)
|
||||
@ -607,6 +648,7 @@ MACHINE_DRIVER_END
|
||||
|
||||
static READ16_HANDLER( ddealer_mcu_r )
|
||||
{
|
||||
ddealer_state *state = (ddealer_state *)space->machine->driver_data;
|
||||
static const int resp[] =
|
||||
{
|
||||
0x93, 0xc7, 0x00, 0x8000,
|
||||
@ -618,9 +660,9 @@ static READ16_HANDLER( ddealer_mcu_r )
|
||||
|
||||
int res;
|
||||
|
||||
res = resp[respcount++];
|
||||
if (resp[respcount]<0)
|
||||
respcount = 0;
|
||||
res = resp[state->respcount++];
|
||||
if (resp[state->respcount] < 0)
|
||||
state->respcount = 0;
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -649,5 +691,4 @@ ROM_START( ddealer )
|
||||
ROM_LOAD( "6.ic86", 0x100, 0x100, NO_DUMP )
|
||||
ROM_END
|
||||
|
||||
GAME( 1991, ddealer, 0, ddealer, ddealer, ddealer, ROT0, "NMK", "Double Dealer", 0 )
|
||||
|
||||
GAME( 1991, ddealer, 0, ddealer, ddealer, ddealer, ROT0, "NMK", "Double Dealer", GAME_SUPPORTS_SAVE )
|
||||
|
@ -47,55 +47,36 @@ Notes:
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/okim6295.h"
|
||||
#include "sound/3812intf.h"
|
||||
|
||||
extern UINT16 *deniam_videoram,*deniam_textram;
|
||||
|
||||
DRIVER_INIT( logicpro );
|
||||
DRIVER_INIT( karianx );
|
||||
WRITE16_HANDLER( deniam_videoram_w );
|
||||
WRITE16_HANDLER( deniam_textram_w );
|
||||
WRITE16_HANDLER( deniam_palette_w );
|
||||
READ16_HANDLER( deniam_coinctrl_r );
|
||||
WRITE16_HANDLER( deniam_coinctrl_w );
|
||||
VIDEO_START( deniam );
|
||||
VIDEO_UPDATE( deniam );
|
||||
|
||||
|
||||
#include "deniam.h"
|
||||
|
||||
|
||||
static WRITE16_HANDLER( sound_command_w )
|
||||
{
|
||||
if (ACCESSING_BITS_8_15)
|
||||
{
|
||||
soundlatch_w(space,offset,(data >> 8) & 0xff);
|
||||
soundlatch_w(space,offset, (data >> 8) & 0xff);
|
||||
cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( deniam16b_oki_rom_bank_w )
|
||||
{
|
||||
okim6295_set_bank_base(device,(data & 0x40) ? 0x40000 : 0x00000);
|
||||
okim6295_set_bank_base(device, (data & 0x40) ? 0x40000 : 0x00000);
|
||||
}
|
||||
|
||||
static WRITE16_DEVICE_HANDLER( deniam16c_oki_rom_bank_w )
|
||||
{
|
||||
if (ACCESSING_BITS_0_7)
|
||||
okim6295_set_bank_base(device,(data & 0x01) ? 0x40000 : 0x00000);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( deniam )
|
||||
{
|
||||
/* logicpr2 does not reset the bank base on startup */
|
||||
okim6295_set_bank_base(devtag_get_device(machine, "oki"),0x00000);
|
||||
okim6295_set_bank_base(device, (data & 0x01) ? 0x40000 : 0x00000);
|
||||
}
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( deniam16b_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x0fffff) AM_ROM
|
||||
AM_RANGE(0x400000, 0x40ffff) AM_RAM_WRITE(deniam_videoram_w) AM_BASE(&deniam_videoram)
|
||||
AM_RANGE(0x410000, 0x410fff) AM_RAM_WRITE(deniam_textram_w) AM_BASE(&deniam_textram)
|
||||
AM_RANGE(0x440000, 0x4407ff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
|
||||
AM_RANGE(0x840000, 0x840fff) AM_WRITE(deniam_palette_w) AM_BASE(&paletteram16)
|
||||
AM_RANGE(0x400000, 0x40ffff) AM_RAM_WRITE(deniam_videoram_w) AM_BASE_MEMBER(deniam_state, videoram)
|
||||
AM_RANGE(0x410000, 0x410fff) AM_RAM_WRITE(deniam_textram_w) AM_BASE_MEMBER(deniam_state, textram)
|
||||
AM_RANGE(0x440000, 0x4407ff) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(deniam_state, spriteram) AM_SIZE(&spriteram_size)
|
||||
AM_RANGE(0x840000, 0x840fff) AM_WRITE(deniam_palette_w) AM_BASE_MEMBER(deniam_state, paletteram)
|
||||
AM_RANGE(0xc40000, 0xc40001) AM_WRITE(sound_command_w)
|
||||
AM_RANGE(0xc40002, 0xc40003) AM_READWRITE(deniam_coinctrl_r, deniam_coinctrl_w)
|
||||
AM_RANGE(0xc44000, 0xc44001) AM_READ_PORT("SYSTEM")
|
||||
@ -122,10 +103,10 @@ ADDRESS_MAP_END
|
||||
/* identical to 16b, but handles sound directly */
|
||||
static ADDRESS_MAP_START( deniam16c_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x0fffff) AM_ROM
|
||||
AM_RANGE(0x400000, 0x40ffff) AM_RAM_WRITE(deniam_videoram_w) AM_BASE(&deniam_videoram)
|
||||
AM_RANGE(0x410000, 0x410fff) AM_RAM_WRITE(deniam_textram_w) AM_BASE(&deniam_textram)
|
||||
AM_RANGE(0x440000, 0x4407ff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
|
||||
AM_RANGE(0x840000, 0x840fff) AM_WRITE(deniam_palette_w) AM_BASE(&paletteram16)
|
||||
AM_RANGE(0x400000, 0x40ffff) AM_RAM_WRITE(deniam_videoram_w) AM_BASE_MEMBER(deniam_state, videoram)
|
||||
AM_RANGE(0x410000, 0x410fff) AM_RAM_WRITE(deniam_textram_w) AM_BASE_MEMBER(deniam_state, textram)
|
||||
AM_RANGE(0x440000, 0x4407ff) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(deniam_state, spriteram) AM_SIZE(&spriteram_size)
|
||||
AM_RANGE(0x840000, 0x840fff) AM_WRITE(deniam_palette_w) AM_BASE_MEMBER(deniam_state, paletteram)
|
||||
AM_RANGE(0xc40000, 0xc40001) AM_DEVREADWRITE8("oki", okim6295_r, okim6295_w, 0x00ff)
|
||||
AM_RANGE(0xc40002, 0xc40003) AM_READWRITE(deniam_coinctrl_r, deniam_coinctrl_w)
|
||||
AM_RANGE(0xc44000, 0xc44001) AM_READ_PORT("SYSTEM")
|
||||
@ -231,10 +212,12 @@ static GFXDECODE_START( deniam )
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
static void irqhandler(const device_config *device, int linestate)
|
||||
static void irqhandler( const device_config *device, int linestate )
|
||||
{
|
||||
deniam_state *state = (deniam_state *)device->machine->driver_data;
|
||||
|
||||
/* system 16c doesn't have the sound CPU */
|
||||
if (cputag_get_cpu(device->machine, "audiocpu") != NULL)
|
||||
if (state->audio_cpu != NULL)
|
||||
cputag_set_input_line(device->machine, "audiocpu", 0, linestate);
|
||||
}
|
||||
|
||||
@ -245,8 +228,41 @@ static const ym3812_interface ym3812_config =
|
||||
|
||||
|
||||
|
||||
static MACHINE_START( deniam )
|
||||
{
|
||||
deniam_state *state = (deniam_state *)machine->driver_data;
|
||||
|
||||
state->audio_cpu = devtag_get_device(machine, "audiocpu");
|
||||
|
||||
state_save_register_global(machine, state->display_enable);
|
||||
state_save_register_global(machine, state->coinctrl);
|
||||
|
||||
state_save_register_global(machine, state->bg_scrollx_offs);
|
||||
state_save_register_global(machine, state->bg_scrolly_offs);
|
||||
state_save_register_global(machine, state->fg_scrollx_offs);
|
||||
state_save_register_global(machine, state->fg_scrolly_offs);
|
||||
state_save_register_global(machine, state->bg_scrollx_reg);
|
||||
state_save_register_global(machine, state->bg_scrolly_reg);
|
||||
state_save_register_global(machine, state->fg_scrollx_reg);
|
||||
state_save_register_global(machine, state->fg_scrolly_reg);
|
||||
state_save_register_global(machine, state->bg_page_reg);
|
||||
state_save_register_global(machine, state->fg_page_reg);
|
||||
state_save_register_global_array(machine, state->bg_page);
|
||||
state_save_register_global_array(machine, state->fg_page);
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_RESET( deniam )
|
||||
{
|
||||
/* logicpr2 does not reset the bank base on startup */
|
||||
okim6295_set_bank_base(devtag_get_device(machine, "oki"), 0x00000);
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( deniam16b )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(deniam_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M68000,XTAL_25MHz/2) /* 12.5Mhz verified */
|
||||
MDRV_CPU_PROGRAM_MAP(deniam16b_map)
|
||||
@ -256,6 +272,7 @@ static MACHINE_DRIVER_START( deniam16b )
|
||||
MDRV_CPU_PROGRAM_MAP(sound_map)
|
||||
MDRV_CPU_IO_MAP(sound_io_map)
|
||||
|
||||
MDRV_MACHINE_START(deniam)
|
||||
MDRV_MACHINE_RESET(deniam)
|
||||
|
||||
/* video hardware */
|
||||
@ -287,11 +304,15 @@ MACHINE_DRIVER_END
|
||||
|
||||
static MACHINE_DRIVER_START( deniam16c )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(deniam_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M68000,XTAL_25MHz/2) /* 12.5Mhz verified */
|
||||
MDRV_CPU_PROGRAM_MAP(deniam16c_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", irq4_line_hold)
|
||||
|
||||
MDRV_MACHINE_START(deniam)
|
||||
MDRV_MACHINE_RESET(deniam)
|
||||
|
||||
/* video hardware */
|
||||
@ -415,7 +436,7 @@ ROM_END
|
||||
|
||||
|
||||
|
||||
GAME( 1996, logicpro, 0, deniam16b, logicpr2, logicpro, ROT0, "Deniam", "Logic Pro (Japan)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1996, croquis, logicpro, deniam16b, logicpr2, logicpro, ROT0, "Deniam", "Croquis (Germany)", 0 )
|
||||
GAME( 1996, karianx, 0, deniam16b, karianx, karianx, ROT0, "Deniam", "Karian Cross (Rev. 1.0)", 0 )
|
||||
GAME( 1997, logicpr2, 0, deniam16c, logicpr2, logicpro, ROT0, "Deniam", "Logic Pro 2 (Japan)", GAME_IMPERFECT_SOUND )
|
||||
GAME( 1996, logicpro, 0, deniam16b, logicpr2, logicpro, ROT0, "Deniam", "Logic Pro (Japan)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1996, croquis, logicpro, deniam16b, logicpr2, logicpro, ROT0, "Deniam", "Croquis (Germany)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1996, karianx, 0, deniam16b, karianx, karianx, ROT0, "Deniam", "Karian Cross (Rev. 1.0)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1997, logicpr2, 0, deniam16c, logicpr2, logicpro, ROT0, "Deniam", "Logic Pro 2 (Japan)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
|
@ -41,50 +41,61 @@ Notes:
|
||||
#include "sound/msm5205.h"
|
||||
#include "sound/3812intf.h"
|
||||
|
||||
static UINT8* discoboy_ram_part1;
|
||||
static UINT8* discoboy_ram_part2;
|
||||
static UINT8* discoboy_ram_part3;
|
||||
static UINT8* discoboy_ram_part4;
|
||||
static UINT8* discoboy_ram_att;
|
||||
|
||||
static UINT8 discoboy_ram_bank;
|
||||
static UINT8 port_00;
|
||||
static UINT8 discoboy_gfxbank;
|
||||
static int adpcm_data;
|
||||
|
||||
typedef struct _discoboy_state discoboy_state;
|
||||
struct _discoboy_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * ram_1;
|
||||
UINT8 * ram_2;
|
||||
UINT8 * ram_3;
|
||||
UINT8 * ram_4;
|
||||
UINT8 * ram_att;
|
||||
|
||||
/* video-related */
|
||||
UINT8 ram_bank;
|
||||
UINT8 gfxbank;
|
||||
UINT8 port_00;
|
||||
int adpcm_data;
|
||||
};
|
||||
|
||||
|
||||
|
||||
static VIDEO_START( discoboy )
|
||||
{
|
||||
}
|
||||
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
discoboy_state *state = (discoboy_state *)machine->driver_data;
|
||||
int flipscreen = 0;
|
||||
int offs,sx,sy;
|
||||
int offs, sx, sy;
|
||||
|
||||
for (offs = 0x1000-0x40;offs >= 0;offs -= 0x20)
|
||||
for (offs = 0x1000 - 0x40; offs >= 0; offs -= 0x20)
|
||||
{
|
||||
int code = discoboy_ram_part4[offs];
|
||||
int attr = discoboy_ram_part4[offs+1];
|
||||
int code = state->ram_4[offs];
|
||||
int attr = state->ram_4[offs + 1];
|
||||
int color = attr & 0x0f;
|
||||
sx = discoboy_ram_part4[offs+3] + ((attr & 0x10) << 4);
|
||||
sy = ((discoboy_ram_part4[offs+2] + 8) & 0xff) - 8;
|
||||
sx = state->ram_4[offs + 3] + ((attr & 0x10) << 4);
|
||||
sy = ((state->ram_4[offs + 2] + 8) & 0xff) - 8;
|
||||
code += (attr & 0xe0) << 3;
|
||||
|
||||
if (code>=0x400)
|
||||
if (code >= 0x400)
|
||||
{
|
||||
if ((discoboy_gfxbank&0x30) == 0x00)
|
||||
if ((state->gfxbank & 0x30) == 0x00)
|
||||
{
|
||||
code = 0x400 + (code & 0x3ff);
|
||||
}
|
||||
else if ((discoboy_gfxbank&0x30) == 0x10)
|
||||
else if ((state->gfxbank & 0x30) == 0x10)
|
||||
{
|
||||
code = 0x400 + (code & 0x3ff) + 0x400;
|
||||
}
|
||||
else if ((discoboy_gfxbank&0x30) == 0x20)
|
||||
else if ((state->gfxbank & 0x30) == 0x20)
|
||||
{
|
||||
code = 0x400 + (code & 0x3ff) + 0x800;
|
||||
}
|
||||
else if ((discoboy_gfxbank&0x30) == 0x30)
|
||||
else if ((state->gfxbank & 0x30) == 0x30)
|
||||
{
|
||||
code = 0x400 + (code & 0x3ff) + 0xc00;
|
||||
}
|
||||
@ -103,101 +114,98 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
|
||||
}
|
||||
|
||||
|
||||
|
||||
static VIDEO_UPDATE( discoboy )
|
||||
{
|
||||
UINT16 x,y;
|
||||
discoboy_state *state = (discoboy_state *)screen->machine->driver_data;
|
||||
UINT16 x, y;
|
||||
int i;
|
||||
int count;
|
||||
count = 0;
|
||||
int count = 0;
|
||||
|
||||
for (i=0;i<0x800;i+=2)
|
||||
for (i = 0; i < 0x800; i += 2)
|
||||
{
|
||||
UINT16 pal;
|
||||
int r,g,b;
|
||||
pal = discoboy_ram_part1[i] | (discoboy_ram_part1[i+1] << 8);
|
||||
int r, g, b;
|
||||
pal = state->ram_1[i] | (state->ram_1[i + 1] << 8);
|
||||
|
||||
b = ((pal >> 0) & 0xf) << 4;
|
||||
g = ((pal >> 4) & 0xf) << 4;
|
||||
r = ((pal >> 8) & 0xf) << 4;
|
||||
|
||||
palette_set_color(screen->machine, i/2, MAKE_RGB(r, g, b));
|
||||
palette_set_color(screen->machine, i / 2, MAKE_RGB(r, g, b));
|
||||
}
|
||||
|
||||
for (i=0;i<0x800;i+=2)
|
||||
for (i = 0; i < 0x800; i += 2)
|
||||
{
|
||||
UINT16 pal;
|
||||
int r,g,b;
|
||||
pal = discoboy_ram_part2[i] | (discoboy_ram_part2[i+1] << 8);
|
||||
pal = state->ram_2[i] | (state->ram_2[i + 1] << 8);
|
||||
|
||||
b = ((pal >> 0) & 0xf) << 4;
|
||||
g = ((pal >> 4) & 0xf) << 4;
|
||||
r = ((pal >> 8) & 0xf) << 4;
|
||||
|
||||
palette_set_color(screen->machine, (i/2)+0x400, MAKE_RGB(r, g, b));
|
||||
palette_set_color(screen->machine, (i / 2) + 0x400, MAKE_RGB(r, g, b));
|
||||
}
|
||||
|
||||
bitmap_fill(bitmap, cliprect, 0x3ff);
|
||||
|
||||
for (y=0;y<32;y++)
|
||||
for (y = 0; y < 32; y++)
|
||||
{
|
||||
for (x=0;x<64;x++)
|
||||
for (x = 0; x < 64; x++)
|
||||
{
|
||||
UINT16 tileno = discoboy_ram_part3[count]|(discoboy_ram_part3[count+1]<<8);
|
||||
UINT16 tileno = state->ram_3[count] | (state->ram_3[count + 1] << 8);
|
||||
|
||||
if (tileno>0x2000)
|
||||
if (tileno > 0x2000)
|
||||
{
|
||||
if ((discoboy_gfxbank & 0x40) == 0x40)
|
||||
tileno = 0x2000 + (tileno&0x1fff) + 0x2000;
|
||||
if ((state->gfxbank & 0x40) == 0x40)
|
||||
tileno = 0x2000 + (tileno & 0x1fff) + 0x2000;
|
||||
else
|
||||
tileno = 0x2000 + (tileno&0x1fff) + 0x0000;
|
||||
|
||||
|
||||
tileno = 0x2000 + (tileno & 0x1fff) + 0x0000;
|
||||
}
|
||||
|
||||
drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[1], tileno ,discoboy_ram_att[count/2],0,0,x*8,y*8);
|
||||
count+=2;
|
||||
drawgfx_opaque(bitmap, cliprect, screen->machine->gfx[1], tileno, state->ram_att[count / 2], 0, 0, x*8, y*8);
|
||||
count += 2;
|
||||
}
|
||||
}
|
||||
|
||||
draw_sprites(screen->machine,bitmap,cliprect);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
void discoboy_setrombank(UINT8 data)
|
||||
void discoboy_setrombank( running_machine *machine, UINT8 data )
|
||||
{
|
||||
UINT8 *ROM = memory_region(machine, "maincpu");
|
||||
data &=0x2f;
|
||||
memory_set_bankptr(space->machine, 1, &ROM[0x6000+(data*0x1000)] );
|
||||
data &= 0x2f;
|
||||
memory_set_bankptr(space->machine, 1, &ROM[0x6000 + (data * 0x1000)] );
|
||||
}
|
||||
#endif
|
||||
|
||||
static WRITE8_HANDLER( rambank_select_w )
|
||||
{
|
||||
discoboy_ram_bank = data;
|
||||
if (data&=0x83) logerror("rambank_select_w !!!!!");
|
||||
discoboy_state *state = (discoboy_state *)space->machine->driver_data;
|
||||
state->ram_bank = data;
|
||||
if (data &= 0x83) logerror("rambank_select_w !!!!!");
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( discoboy_port_00_w )
|
||||
{
|
||||
discoboy_state *state = (discoboy_state *)space->machine->driver_data;
|
||||
if (data & 0xfe) logerror("unk discoboy_port_00_w %02x\n",data);
|
||||
port_00 = data;
|
||||
state->port_00 = data;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( discoboy_port_01_w )
|
||||
{
|
||||
UINT8 *ROM = memory_region(space->machine, "maincpu");
|
||||
int rombank;
|
||||
discoboy_state *state = (discoboy_state *)space->machine->driver_data;
|
||||
|
||||
// 00 10 20 30 during gameplay 1,2,3 other times?? title screen bit 0x40 toggle
|
||||
//printf("unk discoboy_port_01_w %02x\n",data);
|
||||
// discoboy gfxbank
|
||||
discoboy_gfxbank = data&0xf0;
|
||||
rombank = data&0x07;
|
||||
state->gfxbank = data & 0xf0;
|
||||
|
||||
memory_set_bankptr(space->machine, 1, &ROM[0x10000 + rombank * 0x4000] );
|
||||
memory_set_bank(space->machine, 1, data & 0x07);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( discoboy_port_03_w ) // sfx? (to sound cpu)
|
||||
@ -211,77 +219,66 @@ static WRITE8_HANDLER( discoboy_port_03_w ) // sfx? (to sound cpu)
|
||||
static WRITE8_HANDLER( discoboy_port_06_w )
|
||||
{
|
||||
//printf("unk discoboy_port_06_w %02x\n",data);
|
||||
if (data!=0) logerror("port 06!!!! %02x\n",data);
|
||||
if (data != 0) logerror("port 06!!!! %02x\n",data);
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( rambank_w )
|
||||
{
|
||||
if (discoboy_ram_bank&0x20)
|
||||
{
|
||||
discoboy_ram_part2[offset] = data;
|
||||
}
|
||||
discoboy_state *state = (discoboy_state *)space->machine->driver_data;
|
||||
|
||||
if (state->ram_bank & 0x20)
|
||||
state->ram_2[offset] = data;
|
||||
else
|
||||
{
|
||||
discoboy_ram_part1[offset] = data;
|
||||
}
|
||||
state->ram_1[offset] = data;
|
||||
}
|
||||
|
||||
static READ8_HANDLER( rambank_r )
|
||||
{
|
||||
if (discoboy_ram_bank&0x20)
|
||||
{
|
||||
return discoboy_ram_part2[offset];
|
||||
}
|
||||
discoboy_state *state = (discoboy_state *)space->machine->driver_data;
|
||||
|
||||
if (state->ram_bank & 0x20)
|
||||
return state->ram_2[offset];
|
||||
else
|
||||
{
|
||||
return discoboy_ram_part1[offset];
|
||||
}
|
||||
return state->ram_1[offset];
|
||||
}
|
||||
|
||||
static READ8_HANDLER( rambank2_r )
|
||||
{
|
||||
if (port_00 == 0x00)
|
||||
{
|
||||
return discoboy_ram_part3[offset];
|
||||
}
|
||||
else if (port_00 == 0x01)
|
||||
{
|
||||
return discoboy_ram_part4[offset];
|
||||
}
|
||||
discoboy_state *state = (discoboy_state *)space->machine->driver_data;
|
||||
|
||||
if (state->port_00 == 0x00)
|
||||
return state->ram_3[offset];
|
||||
else if (state->port_00 == 0x01)
|
||||
return state->ram_4[offset];
|
||||
else
|
||||
{
|
||||
printf( "unk rb2_r\n");
|
||||
}
|
||||
printf("unk rb2_r\n");
|
||||
|
||||
return mame_rand(space->machine);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( rambank2_w )
|
||||
{
|
||||
discoboy_state *state = (discoboy_state *)space->machine->driver_data;
|
||||
|
||||
if (port_00 == 0x00)
|
||||
{
|
||||
discoboy_ram_part3[offset] = data;
|
||||
}
|
||||
else if (port_00 == 0x01)
|
||||
{
|
||||
discoboy_ram_part4[offset] = data;
|
||||
}
|
||||
if (state->port_00 == 0x00)
|
||||
state->ram_3[offset] = data;
|
||||
else if (state->port_00 == 0x01)
|
||||
state->ram_4[offset] = data;
|
||||
else
|
||||
{
|
||||
printf( "unk rb2_w\n");
|
||||
}
|
||||
printf("unk rb2_w\n");
|
||||
}
|
||||
|
||||
static READ8_HANDLER( discoboy_ram_att_r )
|
||||
{
|
||||
return discoboy_ram_att[offset];
|
||||
discoboy_state *state = (discoboy_state *)space->machine->driver_data;
|
||||
return state->ram_att[offset];
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( discoboy_ram_att_w )
|
||||
{
|
||||
discoboy_ram_att[offset] = data;
|
||||
discoboy_state *state = (discoboy_state *)space->machine->driver_data;
|
||||
state->ram_att[offset] = data;
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( discoboy_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
@ -314,13 +311,14 @@ ADDRESS_MAP_END
|
||||
/* Sound */
|
||||
|
||||
//static WRITE8_HANDLER( splash_adpcm_data_w ){
|
||||
// adpcm_data = data;
|
||||
// state->adpcm_data = data;
|
||||
//}
|
||||
|
||||
static void splash_msm5205_int(const device_config *device)
|
||||
static void splash_msm5205_int( const device_config *device )
|
||||
{
|
||||
msm5205_data_w(device,adpcm_data >> 4);
|
||||
// adpcm_data = (adpcm_data << 4) & 0xf0;
|
||||
discoboy_state *state = (discoboy_state *)device->machine->driver_data;
|
||||
msm5205_data_w(device, state->adpcm_data >> 4);
|
||||
// state->adpcm_data = (state->adpcm_data << 4) & 0xf0;
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
@ -434,15 +432,32 @@ static const msm5205_interface discoboy_msm5205_interface =
|
||||
MSM5205_S48_4B /* ??? unknown hz */
|
||||
};
|
||||
|
||||
|
||||
static MACHINE_START( discoboy )
|
||||
{
|
||||
discoboy_state *state = (discoboy_state *)machine->driver_data;
|
||||
|
||||
state_save_register_global(machine, state->ram_bank);
|
||||
state_save_register_global(machine, state->port_00);
|
||||
state_save_register_global(machine, state->gfxbank);
|
||||
state_save_register_global(machine, state->adpcm_data);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( discoboy )
|
||||
{
|
||||
discoboy_ram_bank = 0;
|
||||
port_00 = 0;
|
||||
discoboy_gfxbank = 0;
|
||||
adpcm_data = 0x80;
|
||||
discoboy_state *state = (discoboy_state *)machine->driver_data;
|
||||
|
||||
state->ram_bank = 0;
|
||||
state->port_00 = 0;
|
||||
state->gfxbank = 0;
|
||||
state->adpcm_data = 0x80;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( discoboy )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(discoboy_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80,12000000/2) /* 6 MHz? */
|
||||
MDRV_CPU_PROGRAM_MAP(discoboy_map)
|
||||
@ -455,6 +470,9 @@ static MACHINE_DRIVER_START( discoboy )
|
||||
// MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
|
||||
MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,32)
|
||||
|
||||
MDRV_MACHINE_START( discoboy )
|
||||
MDRV_MACHINE_RESET( discoboy )
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
||||
@ -469,8 +487,6 @@ static MACHINE_DRIVER_START( discoboy )
|
||||
MDRV_VIDEO_START(discoboy)
|
||||
MDRV_VIDEO_UPDATE(discoboy)
|
||||
|
||||
MDRV_MACHINE_RESET( discoboy )
|
||||
|
||||
/* sound hardware */
|
||||
MDRV_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
@ -481,37 +497,8 @@ static MACHINE_DRIVER_START( discoboy )
|
||||
MDRV_SOUND_ADD("msm", MSM5205, 384000) // ???? unknown
|
||||
MDRV_SOUND_CONFIG(discoboy_msm5205_interface)
|
||||
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
|
||||
|
||||
MACHINE_DRIVER_END
|
||||
|
||||
static DRIVER_INIT( discoboy )
|
||||
{
|
||||
UINT8 *ROM = memory_region(machine, "maincpu");
|
||||
|
||||
discoboy_ram_part1 = auto_alloc_array(machine, UINT8, 0x800);
|
||||
discoboy_ram_part2 = auto_alloc_array(machine, UINT8, 0x800);
|
||||
discoboy_ram_att = auto_alloc_array(machine, UINT8, 0x800);
|
||||
|
||||
discoboy_ram_part3 = auto_alloc_array(machine, UINT8, 0x1000);
|
||||
discoboy_ram_part4 = auto_alloc_array(machine, UINT8, 0x1000);
|
||||
|
||||
memset(discoboy_ram_part1,0,0x800);
|
||||
memset(discoboy_ram_part2,0,0x800);
|
||||
memset(discoboy_ram_att,0,0x800);
|
||||
memset(discoboy_ram_part3,0,0x1000);
|
||||
memset(discoboy_ram_part4,0,0x1000);
|
||||
|
||||
|
||||
state_save_register_global_pointer(machine, discoboy_ram_part1, 0x800);
|
||||
state_save_register_global_pointer(machine, discoboy_ram_part2, 0x800);
|
||||
state_save_register_global_pointer(machine, discoboy_ram_att, 0x800);
|
||||
state_save_register_global_pointer(machine, discoboy_ram_part3, 0x1000);
|
||||
state_save_register_global_pointer(machine, discoboy_ram_part4, 0x1000);
|
||||
|
||||
discoboy_ram_bank = 0;
|
||||
|
||||
memory_set_bankptr(machine, 1, &ROM[0x10000] );
|
||||
}
|
||||
|
||||
ROM_START( discoboy )
|
||||
ROM_REGION( 0x30000, "maincpu", 0 )
|
||||
@ -540,4 +527,33 @@ ROM_START( discoboy )
|
||||
ROM_END
|
||||
|
||||
|
||||
GAME( 1993, discoboy, 0, discoboy, discoboy, discoboy, ROT270, "Soft Art Co.", "Disco Boy", 0 )
|
||||
static DRIVER_INIT( discoboy )
|
||||
{
|
||||
discoboy_state *state = (discoboy_state *)machine->driver_data;
|
||||
UINT8 *ROM = memory_region(machine, "maincpu");
|
||||
|
||||
state->ram_1 = auto_alloc_array(machine, UINT8, 0x800);
|
||||
state->ram_2 = auto_alloc_array(machine, UINT8, 0x800);
|
||||
state->ram_att = auto_alloc_array(machine, UINT8, 0x800);
|
||||
|
||||
state->ram_3 = auto_alloc_array(machine, UINT8, 0x1000);
|
||||
state->ram_4 = auto_alloc_array(machine, UINT8, 0x1000);
|
||||
|
||||
memset(state->ram_1, 0, 0x800);
|
||||
memset(state->ram_2, 0, 0x800);
|
||||
memset(state->ram_att,0, 0x800);
|
||||
memset(state->ram_3, 0, 0x1000);
|
||||
memset(state->ram_4, 0, 0x1000);
|
||||
|
||||
state_save_register_global_pointer(machine, state->ram_1, 0x800);
|
||||
state_save_register_global_pointer(machine, state->ram_2, 0x800);
|
||||
state_save_register_global_pointer(machine, state->ram_att, 0x800);
|
||||
state_save_register_global_pointer(machine, state->ram_3, 0x1000);
|
||||
state_save_register_global_pointer(machine, state->ram_4, 0x1000);
|
||||
|
||||
memory_configure_bank(machine, 1, 0, 8, &ROM[0x10000], 0x4000);
|
||||
memory_set_bank(machine, 1, 0);
|
||||
}
|
||||
|
||||
|
||||
GAME( 1993, discoboy, 0, discoboy, discoboy, discoboy, ROT270, "Soft Art Co.", "Disco Boy", GAME_SUPPORTS_SAVE )
|
||||
|
@ -51,18 +51,70 @@
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "sound/okim6295.h"
|
||||
|
||||
extern UINT16 *diverboy_spriteram;
|
||||
extern size_t diverboy_spriteram_size;
|
||||
|
||||
VIDEO_START(diverboy);
|
||||
VIDEO_UPDATE(diverboy);
|
||||
|
||||
typedef struct _diverboy_state diverboy_state;
|
||||
struct _diverboy_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT16 * spriteram;
|
||||
// UINT16 * paletteram16; // currently this uses generic palette handling
|
||||
};
|
||||
|
||||
|
||||
VIDEO_START(diverboy)
|
||||
{
|
||||
}
|
||||
|
||||
static void draw_sprites( running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
diverboy_state *state = (diverboy_state *)machine->driver_data;
|
||||
UINT16 *source = state->spriteram;
|
||||
UINT16 *finish = source + (spriteram_size / 2);
|
||||
|
||||
while (source < finish)
|
||||
{
|
||||
INT16 xpos, ypos, number, colr, bank, flash;
|
||||
|
||||
ypos = source[4];
|
||||
xpos = source[0];
|
||||
colr = (source[1] & 0x00f0) >> 4;
|
||||
number = source[3];
|
||||
flash = source[1] & 0x1000;
|
||||
|
||||
colr |= ((source[1] & 0x000c) << 2);
|
||||
|
||||
ypos = 0x100 - ypos;
|
||||
|
||||
bank = (source[1] & 0x0002) >> 1;
|
||||
|
||||
if (!flash || (video_screen_get_frame_number(machine->primary_screen) & 1))
|
||||
{
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[bank],
|
||||
number,
|
||||
colr,
|
||||
0,0,
|
||||
xpos,ypos,
|
||||
(source[1] & 0x0008) ? -1 : 0);
|
||||
}
|
||||
|
||||
source += 8;
|
||||
}
|
||||
}
|
||||
|
||||
VIDEO_UPDATE(diverboy)
|
||||
{
|
||||
// bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine));
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static WRITE16_HANDLER( soundcmd_w )
|
||||
{
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
soundlatch_w(space,0,data & 0xff);
|
||||
soundlatch_w(space, 0, data & 0xff);
|
||||
cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE);
|
||||
}
|
||||
}
|
||||
@ -72,7 +124,7 @@ static WRITE8_DEVICE_HANDLER( okibank_w )
|
||||
/* bit 2 might be reset */
|
||||
// popmessage("%02x",data);
|
||||
|
||||
okim6295_set_bank_base(device,(data & 3) * 0x40000);
|
||||
okim6295_set_bank_base(device, (data & 3) * 0x40000);
|
||||
}
|
||||
|
||||
|
||||
@ -80,7 +132,7 @@ static WRITE8_DEVICE_HANDLER( okibank_w )
|
||||
static ADDRESS_MAP_START( diverboy_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x03ffff) AM_ROM
|
||||
AM_RANGE(0x040000, 0x04ffff) AM_RAM
|
||||
AM_RANGE(0x080000, 0x083fff) AM_RAM AM_BASE(&diverboy_spriteram) AM_SIZE(&diverboy_spriteram_size)
|
||||
AM_RANGE(0x080000, 0x083fff) AM_RAM AM_BASE_MEMBER(diverboy_state, spriteram) AM_SIZE(&spriteram_size)
|
||||
AM_RANGE(0x100000, 0x100001) AM_WRITE(soundcmd_w)
|
||||
AM_RANGE(0x140000, 0x1407ff) AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16)
|
||||
AM_RANGE(0x180000, 0x180001) AM_READ_PORT("P1_P2")
|
||||
@ -182,6 +234,8 @@ GFXDECODE_END
|
||||
|
||||
|
||||
static MACHINE_DRIVER_START( diverboy )
|
||||
MDRV_DRIVER_DATA(diverboy_state)
|
||||
|
||||
MDRV_CPU_ADD("maincpu", M68000, 12000000) /* guess */
|
||||
MDRV_CPU_PROGRAM_MAP(diverboy_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", irq6_line_hold)
|
||||
@ -245,4 +299,4 @@ ROM_END
|
||||
|
||||
|
||||
|
||||
GAME( 1992, diverboy, 0, diverboy, diverboy, 0, ORIENTATION_FLIP_X, "Electronic Devices Italy", "Diver Boy", 0 )
|
||||
GAME( 1992, diverboy, 0, diverboy, diverboy, 0, ORIENTATION_FLIP_X, "Electronic Devices Italy", "Diver Boy", GAME_SUPPORTS_SAVE )
|
||||
|
@ -16,10 +16,18 @@ Todo:
|
||||
#define NUM_PENS (8)
|
||||
|
||||
|
||||
static UINT8 *dorachan_videoram;
|
||||
static size_t dorachan_videoram_size;
|
||||
static UINT8 dorachan_flip_screen;
|
||||
typedef struct _dorachan_state dorachan_state;
|
||||
struct _dorachan_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
|
||||
/* video-related */
|
||||
UINT8 flip_screen;
|
||||
|
||||
/* devices */
|
||||
const device_config *main_cpu;
|
||||
};
|
||||
|
||||
|
||||
/*************************************
|
||||
@ -30,16 +38,17 @@ static UINT8 dorachan_flip_screen;
|
||||
|
||||
static CUSTOM_INPUT( dorachan_protection_r )
|
||||
{
|
||||
dorachan_state *state = (dorachan_state *)field->port->machine->driver_data;
|
||||
UINT8 ret = 0;
|
||||
|
||||
switch (cpu_get_previouspc(cputag_get_cpu(field->port->machine, "maincpu")))
|
||||
switch (cpu_get_previouspc(state->main_cpu))
|
||||
{
|
||||
case 0x70ce: ret = 0xf2; break;
|
||||
case 0x72a2: ret = 0xd5; break;
|
||||
case 0x72b5: ret = 0xcb; break;
|
||||
|
||||
default:
|
||||
mame_printf_debug("unhandled $2400 read @ %x\n", cpu_get_previouspc(cputag_get_cpu(field->port->machine, "maincpu")));
|
||||
mame_printf_debug("unhandled $2400 read @ %x\n", cpu_get_previouspc(state->main_cpu));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -67,6 +76,7 @@ static void get_pens(pen_t *pens)
|
||||
|
||||
static VIDEO_UPDATE( dorachan )
|
||||
{
|
||||
dorachan_state *state = (dorachan_state *)screen->machine->driver_data;
|
||||
pen_t pens[NUM_PENS];
|
||||
offs_t offs;
|
||||
const UINT8 *color_map_base;
|
||||
@ -75,7 +85,7 @@ static VIDEO_UPDATE( dorachan )
|
||||
|
||||
color_map_base = memory_region(screen->machine, "proms");
|
||||
|
||||
for (offs = 0; offs < dorachan_videoram_size; offs++)
|
||||
for (offs = 0; offs < videoram_size; offs++)
|
||||
{
|
||||
int i;
|
||||
UINT8 fore_color;
|
||||
@ -86,9 +96,9 @@ static VIDEO_UPDATE( dorachan )
|
||||
/* the need for +1 is extremely unusual, but definetely correct */
|
||||
offs_t color_address = ((((offs << 2) & 0x03e0) | (offs >> 8)) + 1) & 0x03ff;
|
||||
|
||||
UINT8 data = dorachan_videoram[offs];
|
||||
UINT8 data = state->videoram[offs];
|
||||
|
||||
if (dorachan_flip_screen)
|
||||
if (state->flip_screen)
|
||||
fore_color = (color_map_base[color_address] >> 3) & 0x07;
|
||||
else
|
||||
fore_color = (color_map_base[color_address] >> 0) & 0x07;
|
||||
@ -109,15 +119,17 @@ static VIDEO_UPDATE( dorachan )
|
||||
|
||||
static WRITE8_HANDLER(dorachan_ctrl_w)
|
||||
{
|
||||
dorachan_flip_screen = (data >> 6) & 0x01;
|
||||
dorachan_state *state = (dorachan_state *)space->machine->driver_data;
|
||||
state->flip_screen = (data >> 6) & 0x01;
|
||||
}
|
||||
|
||||
|
||||
static CUSTOM_INPUT( dorachan_v128_r )
|
||||
{
|
||||
/* to avoid resetting (when player 2 starts) bit 0 need to be
|
||||
inverted when screen is flipped */
|
||||
return ((video_screen_get_vpos(field->port->machine->primary_screen) >> 7) & 0x01) ^ dorachan_flip_screen;
|
||||
dorachan_state *state = (dorachan_state *)field->port->machine->driver_data;
|
||||
|
||||
/* to avoid resetting (when player 2 starts) bit 0 need to be inverted when screen is flipped */
|
||||
return ((video_screen_get_vpos(field->port->machine->primary_screen) >> 7) & 0x01) ^ state->flip_screen;
|
||||
}
|
||||
|
||||
|
||||
@ -136,7 +148,7 @@ static ADDRESS_MAP_START( dorachan_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x2800, 0x2800) AM_MIRROR(0x03ff) AM_READ_PORT("SYSTEM")
|
||||
AM_RANGE(0x2c00, 0x2c00) AM_MIRROR(0x03ff) AM_READ_PORT("JOY")
|
||||
AM_RANGE(0x3800, 0x3800) AM_MIRROR(0x03ff) AM_READ_PORT("V128")
|
||||
AM_RANGE(0x4000, 0x5fff) AM_RAM AM_BASE(&dorachan_videoram) AM_SIZE(&dorachan_videoram_size)
|
||||
AM_RANGE(0x4000, 0x5fff) AM_RAM AM_BASE_MEMBER(dorachan_state, videoram) AM_SIZE(&videoram_size)
|
||||
AM_RANGE(0x6000, 0x77ff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -206,14 +218,36 @@ INPUT_PORTS_END
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( dorachan )
|
||||
{
|
||||
dorachan_state *state = (dorachan_state *)machine->driver_data;
|
||||
|
||||
state->main_cpu = devtag_get_device(machine, "maincpu");
|
||||
|
||||
state_save_register_global(machine, state->flip_screen);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( dorachan )
|
||||
{
|
||||
dorachan_state *state = (dorachan_state *)machine->driver_data;
|
||||
|
||||
state->flip_screen = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( dorachan )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(dorachan_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, 2000000)
|
||||
MDRV_CPU_PROGRAM_MAP(dorachan_map)
|
||||
MDRV_CPU_IO_MAP(dorachan_io_map)
|
||||
MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
|
||||
|
||||
MDRV_MACHINE_START(dorachan)
|
||||
MDRV_MACHINE_RESET(dorachan)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_VIDEO_UPDATE(dorachan)
|
||||
|
||||
@ -261,4 +295,4 @@ ROM_END
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1980, dorachan, 0, dorachan, dorachan, 0, ROT270, "Craul Denshi", "Dorachan", GAME_NO_SOUND)
|
||||
GAME( 1980, dorachan, 0, dorachan, dorachan, 0, ROT270, "Craul Denshi", "Dorachan", GAME_NO_SOUND | GAME_SUPPORTS_SAVE )
|
||||
|
@ -11,12 +11,9 @@ Atari Drag Race Driver
|
||||
#include "sound/discrete.h"
|
||||
|
||||
|
||||
static unsigned dragrace_misc_flags = 0;
|
||||
|
||||
static int dragrace_gear[2];
|
||||
|
||||
static TIMER_CALLBACK( dragrace_frame_callback )
|
||||
{
|
||||
dragrace_state *state = (dragrace_state *)machine->driver_data;
|
||||
int i;
|
||||
static const char *const portnames[] = { "P1", "P2" };
|
||||
|
||||
@ -24,11 +21,11 @@ static TIMER_CALLBACK( dragrace_frame_callback )
|
||||
{
|
||||
switch (input_port_read(machine, portnames[i]))
|
||||
{
|
||||
case 0x01: dragrace_gear[i] = 1; break;
|
||||
case 0x02: dragrace_gear[i] = 2; break;
|
||||
case 0x04: dragrace_gear[i] = 3; break;
|
||||
case 0x08: dragrace_gear[i] = 4; break;
|
||||
case 0x10: dragrace_gear[i] = 0; break;
|
||||
case 0x01: state->gear[i] = 1; break;
|
||||
case 0x02: state->gear[i] = 2; break;
|
||||
case 0x04: state->gear[i] = 3; break;
|
||||
case 0x08: state->gear[i] = 4; break;
|
||||
case 0x10: state->gear[i] = 0; break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,15 +34,9 @@ static TIMER_CALLBACK( dragrace_frame_callback )
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_RESET( dragrace )
|
||||
static void dragrace_update_misc_flags( running_machine *machine )
|
||||
{
|
||||
timer_pulse(machine, video_screen_get_frame_period(machine->primary_screen), NULL, 0, dragrace_frame_callback);
|
||||
}
|
||||
|
||||
static void dragrace_update_misc_flags(const address_space *space)
|
||||
{
|
||||
const device_config *discrete = devtag_get_device(space->machine, "discrete");
|
||||
|
||||
dragrace_state *state = (dragrace_state *)machine->driver_data;
|
||||
/* 0x0900 = set 3SPEED1 0x00000001
|
||||
* 0x0901 = set 4SPEED1 0x00000002
|
||||
* 0x0902 = set 5SPEED1 0x00000004
|
||||
@ -77,49 +68,54 @@ static void dragrace_update_misc_flags(const address_space *space)
|
||||
* 0x091f = set Player 2 Start Lamp 0x80000000
|
||||
* 0x0938 = clear 0x0918 - 0x091f
|
||||
*/
|
||||
set_led_status(0, dragrace_misc_flags & 0x00008000);
|
||||
set_led_status(1, dragrace_misc_flags & 0x80000000);
|
||||
set_led_status(0, state->misc_flags & 0x00008000);
|
||||
set_led_status(1, state->misc_flags & 0x80000000);
|
||||
|
||||
discrete_sound_w(discrete, DRAGRACE_MOTOR1_DATA, ~dragrace_misc_flags & 0x0000001f); // Speed1 data*
|
||||
discrete_sound_w(discrete, DRAGRACE_EXPLODE1_EN, (dragrace_misc_flags & 0x00000020) ? 1: 0); // Explosion1 enable
|
||||
discrete_sound_w(discrete, DRAGRACE_SCREECH1_EN, (dragrace_misc_flags & 0x00000040) ? 1: 0); // Screech1 enable
|
||||
discrete_sound_w(discrete, DRAGRACE_KLEXPL1_EN, (dragrace_misc_flags & 0x00000200) ? 1: 0); // KLEXPL1 enable
|
||||
discrete_sound_w(discrete, DRAGRACE_MOTOR1_EN, (dragrace_misc_flags & 0x00000800) ? 1: 0); // Motor1 enable
|
||||
discrete_sound_w(state->discrete, DRAGRACE_MOTOR1_DATA, ~state->misc_flags & 0x0000001f); // Speed1 data*
|
||||
discrete_sound_w(state->discrete, DRAGRACE_EXPLODE1_EN, (state->misc_flags & 0x00000020) ? 1: 0); // Explosion1 enable
|
||||
discrete_sound_w(state->discrete, DRAGRACE_SCREECH1_EN, (state->misc_flags & 0x00000040) ? 1: 0); // Screech1 enable
|
||||
discrete_sound_w(state->discrete, DRAGRACE_KLEXPL1_EN, (state->misc_flags & 0x00000200) ? 1: 0); // KLEXPL1 enable
|
||||
discrete_sound_w(state->discrete, DRAGRACE_MOTOR1_EN, (state->misc_flags & 0x00000800) ? 1: 0); // Motor1 enable
|
||||
|
||||
discrete_sound_w(discrete, DRAGRACE_MOTOR2_DATA, (~dragrace_misc_flags & 0x001f0000) >> 0x10); // Speed2 data*
|
||||
discrete_sound_w(discrete, DRAGRACE_EXPLODE2_EN, (dragrace_misc_flags & 0x00200000) ? 1: 0); // Explosion2 enable
|
||||
discrete_sound_w(discrete, DRAGRACE_SCREECH2_EN, (dragrace_misc_flags & 0x00400000) ? 1: 0); // Screech2 enable
|
||||
discrete_sound_w(discrete, DRAGRACE_KLEXPL2_EN, (dragrace_misc_flags & 0x02000000) ? 1: 0); // KLEXPL2 enable
|
||||
discrete_sound_w(discrete, DRAGRACE_MOTOR2_EN, (dragrace_misc_flags & 0x08000000) ? 1: 0); // Motor2 enable
|
||||
discrete_sound_w(state->discrete, DRAGRACE_MOTOR2_DATA, (~state->misc_flags & 0x001f0000) >> 0x10); // Speed2 data*
|
||||
discrete_sound_w(state->discrete, DRAGRACE_EXPLODE2_EN, (state->misc_flags & 0x00200000) ? 1: 0); // Explosion2 enable
|
||||
discrete_sound_w(state->discrete, DRAGRACE_SCREECH2_EN, (state->misc_flags & 0x00400000) ? 1: 0); // Screech2 enable
|
||||
discrete_sound_w(state->discrete, DRAGRACE_KLEXPL2_EN, (state->misc_flags & 0x02000000) ? 1: 0); // KLEXPL2 enable
|
||||
discrete_sound_w(state->discrete, DRAGRACE_MOTOR2_EN, (state->misc_flags & 0x08000000) ? 1: 0); // Motor2 enable
|
||||
|
||||
discrete_sound_w(discrete, DRAGRACE_ATTRACT_EN, (dragrace_misc_flags & 0x00001000) ? 1: 0); // Attract enable
|
||||
discrete_sound_w(discrete, DRAGRACE_LOTONE_EN, (dragrace_misc_flags & 0x00002000) ? 1: 0); // LoTone enable
|
||||
discrete_sound_w(discrete, DRAGRACE_HITONE_EN, (dragrace_misc_flags & 0x20000000) ? 1: 0); // HiTone enable
|
||||
discrete_sound_w(state->discrete, DRAGRACE_ATTRACT_EN, (state->misc_flags & 0x00001000) ? 1: 0); // Attract enable
|
||||
discrete_sound_w(state->discrete, DRAGRACE_LOTONE_EN, (state->misc_flags & 0x00002000) ? 1: 0); // LoTone enable
|
||||
discrete_sound_w(state->discrete, DRAGRACE_HITONE_EN, (state->misc_flags & 0x20000000) ? 1: 0); // HiTone enable
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( dragrace_misc_w )
|
||||
{
|
||||
dragrace_state *state = (dragrace_state *)space->machine->driver_data;
|
||||
|
||||
/* Set/clear individual bit */
|
||||
UINT32 mask = 1 << offset;
|
||||
if (data & 0x01)
|
||||
dragrace_misc_flags |= mask;
|
||||
state->misc_flags |= mask;
|
||||
else
|
||||
dragrace_misc_flags &= (~mask);
|
||||
logerror("Set %#6x, Mask=%#10x, Flag=%#10x, Data=%x\n", 0x0900+offset, mask, dragrace_misc_flags, data & 0x01);
|
||||
dragrace_update_misc_flags(space);
|
||||
state->misc_flags &= (~mask);
|
||||
logerror("Set %#6x, Mask=%#10x, Flag=%#10x, Data=%x\n", 0x0900 + offset, mask, state->misc_flags, data & 0x01);
|
||||
dragrace_update_misc_flags(space->machine);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( dragrace_misc_clear_w )
|
||||
{
|
||||
dragrace_state *state = (dragrace_state *)space->machine->driver_data;
|
||||
|
||||
/* Clear 8 bits */
|
||||
UINT32 mask = 0xff << (((offset >> 3) & 0x03) * 8);
|
||||
dragrace_misc_flags &= (~mask);
|
||||
logerror("Clear %#6x, Mask=%#10x, Flag=%#10x, Data=%x\n", 0x0920+offset, mask, dragrace_misc_flags, data & 0x01);
|
||||
dragrace_update_misc_flags(space);
|
||||
state->misc_flags &= (~mask);
|
||||
logerror("Clear %#6x, Mask=%#10x, Flag=%#10x, Data=%x\n", 0x0920 + offset, mask, state->misc_flags, data & 0x01);
|
||||
dragrace_update_misc_flags(space->machine);
|
||||
}
|
||||
|
||||
static READ8_HANDLER( dragrace_input_r )
|
||||
{
|
||||
dragrace_state *state = (dragrace_state *)space->machine->driver_data;
|
||||
int val = input_port_read(space->machine, "IN2");
|
||||
static const char *const portnames[] = { "IN0", "IN1" };
|
||||
|
||||
@ -132,18 +128,14 @@ static READ8_HANDLER( dragrace_input_r )
|
||||
{
|
||||
int in = input_port_read(space->machine, portnames[i]);
|
||||
|
||||
if (dragrace_gear[i] != 0)
|
||||
{
|
||||
in &= ~(1 << dragrace_gear[i]);
|
||||
}
|
||||
if (state->gear[i] != 0)
|
||||
in &= ~(1 << state->gear[i]);
|
||||
|
||||
if (in & maskA)
|
||||
{
|
||||
val |= 1 << i;
|
||||
}
|
||||
}
|
||||
|
||||
return (val & maskB) ? 0xFF : 0x7F;
|
||||
return (val & maskB) ? 0xff : 0x7f;
|
||||
}
|
||||
|
||||
|
||||
@ -180,8 +172,8 @@ static ADDRESS_MAP_START( dragrace_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0800, 0x083f) AM_READ(dragrace_input_r)
|
||||
AM_RANGE(0x0900, 0x091f) AM_WRITE(dragrace_misc_w)
|
||||
AM_RANGE(0x0920, 0x093f) AM_WRITE(dragrace_misc_clear_w)
|
||||
AM_RANGE(0x0a00, 0x0aff) AM_WRITE(SMH_RAM) AM_BASE(&dragrace_playfield_ram)
|
||||
AM_RANGE(0x0b00, 0x0bff) AM_WRITE(SMH_RAM) AM_BASE(&dragrace_position_ram)
|
||||
AM_RANGE(0x0a00, 0x0aff) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(dragrace_state, playfield_ram)
|
||||
AM_RANGE(0x0b00, 0x0bff) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(dragrace_state, position_ram)
|
||||
AM_RANGE(0x0c00, 0x0c00) AM_READ(dragrace_steering_r)
|
||||
AM_RANGE(0x0d00, 0x0d00) AM_READ(dragrace_scanline_r)
|
||||
AM_RANGE(0x0e00, 0x0eff) AM_WRITE(watchdog_reset_w)
|
||||
@ -191,7 +183,7 @@ ADDRESS_MAP_END
|
||||
|
||||
|
||||
static INPUT_PORTS_START( dragrace )
|
||||
PORT_START("IN0") /* IN0 */
|
||||
PORT_START("IN0")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 1 Gas") PORT_PLAYER(1)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) /* player 1 gear 1 */
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) /* player 1 gear 2 */
|
||||
@ -204,7 +196,7 @@ static INPUT_PORTS_START( dragrace )
|
||||
PORT_DIPSETTING( 0x40, "4.9 seconds" )
|
||||
PORT_DIPSETTING( 0xc0, "Never" )
|
||||
|
||||
PORT_START("IN1") /* IN1 */
|
||||
PORT_START("IN1")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 2 Gas") PORT_PLAYER(2)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) /* player 2 gear 1 */
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) /* player 2 gear 2 */
|
||||
@ -216,7 +208,7 @@ static INPUT_PORTS_START( dragrace )
|
||||
PORT_DIPSETTING( 0x80, "4" )
|
||||
PORT_DIPSETTING( 0x00, "5" )
|
||||
|
||||
PORT_START("IN2") /* IN2 */
|
||||
PORT_START("IN2")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) /* IN0 connects here */
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) /* IN1 connects here */
|
||||
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 )
|
||||
@ -229,20 +221,20 @@ static INPUT_PORTS_START( dragrace )
|
||||
PORT_DIPSETTING( 0x80, DEF_STR( 1C_2C ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
|
||||
|
||||
PORT_START("DIAL1") /* IN3 */
|
||||
PORT_START("DIAL1")
|
||||
PORT_BIT( 0xff, 0x00, IPT_DIAL_V ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(1)
|
||||
|
||||
PORT_START("DIAL2") /* IN4 */
|
||||
PORT_START("DIAL2")
|
||||
PORT_BIT( 0xff, 0x00, IPT_DIAL_V ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(2)
|
||||
|
||||
PORT_START("P1") /* IN5 */
|
||||
PORT_START("P1")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Player 1 Gear 1") PORT_PLAYER(1)
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Player 1 Gear 2") PORT_PLAYER(1)
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Player 1 Gear 3") PORT_PLAYER(1)
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Player 1 Gear 4") PORT_PLAYER(1)
|
||||
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Player 1 Neutral") PORT_PLAYER(1)
|
||||
|
||||
PORT_START("P2") /* IN6 */
|
||||
PORT_START("P2")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Player 2 Gear 1") PORT_PLAYER(2)
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Player 2 Gear 2") PORT_PLAYER(2)
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Player 2 Gear 3") PORT_PLAYER(2)
|
||||
@ -322,14 +314,39 @@ static PALETTE_INIT( dragrace )
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_START( dragrace )
|
||||
{
|
||||
dragrace_state *state = (dragrace_state *)machine->driver_data;
|
||||
|
||||
state->discrete = devtag_get_device(machine, "discrete");
|
||||
|
||||
state_save_register_global(machine, state->misc_flags);
|
||||
state_save_register_global_array(machine, state->gear);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( dragrace )
|
||||
{
|
||||
dragrace_state *state = (dragrace_state *)machine->driver_data;
|
||||
|
||||
timer_pulse(machine, video_screen_get_frame_period(machine->primary_screen), NULL, 0, dragrace_frame_callback);
|
||||
|
||||
state->misc_flags = 0;
|
||||
state->gear[0] = 0;
|
||||
state->gear[1] = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( dragrace )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(dragrace_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M6800, 12096000 / 12)
|
||||
MDRV_CPU_PROGRAM_MAP(dragrace_map)
|
||||
MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 4)
|
||||
MDRV_WATCHDOG_VBLANK_INIT(8)
|
||||
|
||||
MDRV_MACHINE_START(dragrace)
|
||||
MDRV_MACHINE_RESET(dragrace)
|
||||
|
||||
/* video hardware */
|
||||
@ -374,4 +391,4 @@ ROM_START( dragrace )
|
||||
ROM_END
|
||||
|
||||
|
||||
GAME( 1977, dragrace, 0, dragrace, dragrace, 0, 0, "Atari", "Drag Race", 0 )
|
||||
GAME( 1977, dragrace, 0, dragrace, dragrace, 0, 0, "Atari", "Drag Race", GAME_SUPPORTS_SAVE )
|
||||
|
@ -87,23 +87,35 @@ Stephh's notes (based on the game M68EC020 code and some tests) :
|
||||
|
||||
#define MASTER_CLOCK 32000000
|
||||
|
||||
|
||||
static UINT32*dreamwld_bg_videoram;
|
||||
static UINT32*dreamwld_bg2_videoram;
|
||||
static UINT32*dreamwld_bg_scroll;
|
||||
static int dreamwld_tilebank[2], dreamwld_tilebankold[2];
|
||||
|
||||
static tilemap *dreamwld_bg_tilemap;
|
||||
static tilemap *dreamwld_bg2_tilemap;
|
||||
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
typedef struct _dreamwld_state dreamwld_state;
|
||||
struct _dreamwld_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT32 * bg_videoram;
|
||||
UINT32 * bg2_videoram;
|
||||
UINT32 * bg_scroll;
|
||||
UINT32 * paletteram;
|
||||
UINT32 * spriteram;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap,*bg2_tilemap;
|
||||
int tilebank[2], tilebankold[2];
|
||||
|
||||
/* misc */
|
||||
int protindex;
|
||||
};
|
||||
|
||||
|
||||
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
dreamwld_state *state = (dreamwld_state *)machine->driver_data;
|
||||
const gfx_element *gfx = machine->gfx[0];
|
||||
UINT32 *source = spriteram32;
|
||||
UINT32 *finish = spriteram32 + 0x1000/4;
|
||||
UINT32 *source = state->spriteram;
|
||||
UINT32 *finish = state->spriteram + 0x1000 / 4;
|
||||
UINT16 *redirect = (UINT16 *)memory_region(machine, "gfx3");
|
||||
|
||||
while( source<finish )
|
||||
while (source < finish)
|
||||
{
|
||||
int xpos, ypos, tileno;
|
||||
int xsize, ysize, xinc;
|
||||
@ -111,116 +123,120 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
int xflip;
|
||||
int colour;
|
||||
|
||||
xpos = (source[0]&0x000001ff) >> 0;
|
||||
ypos = (source[0]&0x01ff0000) >> 16;
|
||||
xsize = (source[0]&0x00000e00) >> 9;
|
||||
ysize = (source[0]&0x0e000000) >> 25;
|
||||
xpos = (source[0] & 0x000001ff) >> 0;
|
||||
ypos = (source[0] & 0x01ff0000) >> 16;
|
||||
xsize = (source[0] & 0x00000e00) >> 9;
|
||||
ysize = (source[0] & 0x0e000000) >> 25;
|
||||
|
||||
|
||||
tileno = (source[1]&0x0000ffff) >>0;
|
||||
colour = (source[1]&0x3f000000) >>24;
|
||||
xflip = (source[1]&0x40000000);
|
||||
tileno = (source[1] & 0x0000ffff) >>0;
|
||||
colour = (source[1] & 0x3f000000) >>24;
|
||||
xflip = (source[1] & 0x40000000);
|
||||
|
||||
xinc = 16;
|
||||
|
||||
if (xflip)
|
||||
{
|
||||
xinc = -16;
|
||||
xpos+=16*xsize;
|
||||
xpos += 16 * xsize;
|
||||
}
|
||||
|
||||
ysize++;xsize++; // size 0 = 1 tile
|
||||
ysize++; xsize++; // size 0 = 1 tile
|
||||
|
||||
xpos -=16;
|
||||
|
||||
|
||||
for (yct=0;yct<ysize;yct++)
|
||||
for (yct = 0; yct < ysize; yct++)
|
||||
{
|
||||
for (xct=0;xct<xsize;xct++)
|
||||
for (xct = 0; xct < xsize; xct++)
|
||||
{
|
||||
drawgfx_transpen(bitmap,cliprect,gfx,redirect[tileno],colour,xflip,0,xpos+xct*xinc,ypos+yct*16,0);
|
||||
drawgfx_transpen(bitmap,cliprect,gfx,redirect[tileno],colour,xflip,0,(xpos+xct*xinc)-0x200,ypos+yct*16,0);
|
||||
drawgfx_transpen(bitmap,cliprect,gfx,redirect[tileno],colour,xflip,0,(xpos+xct*xinc)-0x200,(ypos+yct*16)-0x200,0);
|
||||
drawgfx_transpen(bitmap,cliprect,gfx,redirect[tileno],colour,xflip,0,xpos+xct*xinc,(ypos+yct*16)-0x200,0);
|
||||
drawgfx_transpen(bitmap, cliprect, gfx, redirect[tileno], colour, xflip, 0, xpos + xct * xinc, ypos + yct * 16, 0);
|
||||
drawgfx_transpen(bitmap, cliprect, gfx, redirect[tileno], colour, xflip, 0, (xpos + xct * xinc) - 0x200, ypos + yct * 16, 0);
|
||||
drawgfx_transpen(bitmap, cliprect, gfx, redirect[tileno], colour, xflip, 0, (xpos + xct * xinc) - 0x200, (ypos + yct * 16) - 0x200, 0);
|
||||
drawgfx_transpen(bitmap, cliprect, gfx, redirect[tileno], colour, xflip, 0, xpos + xct * xinc, (ypos + yct * 16) - 0x200 , 0);
|
||||
|
||||
tileno++;
|
||||
}
|
||||
}
|
||||
|
||||
source+=2;
|
||||
source += 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static WRITE32_HANDLER( dreamwld_bg_videoram_w )
|
||||
{
|
||||
COMBINE_DATA(&dreamwld_bg_videoram[offset]);
|
||||
tilemap_mark_tile_dirty(dreamwld_bg_tilemap,offset*2);
|
||||
tilemap_mark_tile_dirty(dreamwld_bg_tilemap,offset*2+1);
|
||||
|
||||
dreamwld_state *state = (dreamwld_state *)space->machine->driver_data;
|
||||
COMBINE_DATA(&state->bg_videoram[offset]);
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset * 2);
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset * 2 + 1);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_dreamwld_bg_tile_info )
|
||||
{
|
||||
int tileno,colour;
|
||||
tileno = (tile_index&1)?(dreamwld_bg_videoram[tile_index>>1]&0xffff):((dreamwld_bg_videoram[tile_index>>1]>>16)&0xffff);
|
||||
dreamwld_state *state = (dreamwld_state *)machine->driver_data;
|
||||
int tileno, colour;
|
||||
tileno = (tile_index & 1) ? (state->bg_videoram[tile_index >> 1] & 0xffff) : ((state->bg_videoram[tile_index >> 1] >> 16) & 0xffff);
|
||||
colour = tileno >> 13;
|
||||
tileno &=0x1fff;
|
||||
SET_TILE_INFO(1,tileno+dreamwld_tilebank[0]*0x2000,0x80+colour,0);
|
||||
tileno &= 0x1fff;
|
||||
SET_TILE_INFO(1, tileno + state->tilebank[0] * 0x2000, 0x80 + colour, 0);
|
||||
}
|
||||
|
||||
|
||||
static WRITE32_HANDLER( dreamwld_bg2_videoram_w )
|
||||
{
|
||||
COMBINE_DATA(&dreamwld_bg2_videoram[offset]);
|
||||
tilemap_mark_tile_dirty(dreamwld_bg2_tilemap,offset*2);
|
||||
tilemap_mark_tile_dirty(dreamwld_bg2_tilemap,offset*2+1);
|
||||
dreamwld_state *state = (dreamwld_state *)space->machine->driver_data;
|
||||
COMBINE_DATA(&state->bg2_videoram[offset]);
|
||||
tilemap_mark_tile_dirty(state->bg2_tilemap, offset * 2);
|
||||
tilemap_mark_tile_dirty(state->bg2_tilemap, offset * 2 + 1);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_dreamwld_bg2_tile_info )
|
||||
{
|
||||
UINT16 tileno,colour;
|
||||
tileno = (tile_index&1)?(dreamwld_bg2_videoram[tile_index>>1]&0xffff):((dreamwld_bg2_videoram[tile_index>>1]>>16)&0xffff);
|
||||
dreamwld_state *state = (dreamwld_state *)machine->driver_data;
|
||||
UINT16 tileno, colour;
|
||||
tileno = (tile_index & 1) ? (state->bg2_videoram[tile_index >> 1] & 0xffff) : ((state->bg2_videoram[tile_index >> 1] >> 16) & 0xffff);
|
||||
colour = tileno >> 13;
|
||||
tileno &=0x1fff;
|
||||
SET_TILE_INFO(1,tileno+dreamwld_tilebank[1]*0x2000,0xc0+colour,0);
|
||||
tileno &= 0x1fff;
|
||||
SET_TILE_INFO(1, tileno + state->tilebank[1] * 0x2000, 0xc0 + colour, 0);
|
||||
}
|
||||
|
||||
static VIDEO_START( dreamwld )
|
||||
{
|
||||
dreamwld_bg_tilemap = tilemap_create(machine, get_dreamwld_bg_tile_info,tilemap_scan_rows, 16, 16, 64,32);
|
||||
dreamwld_bg2_tilemap = tilemap_create(machine, get_dreamwld_bg2_tile_info,tilemap_scan_rows, 16, 16, 64,32);
|
||||
tilemap_set_transparent_pen(dreamwld_bg2_tilemap,0);
|
||||
dreamwld_tilebankold[0] = dreamwld_tilebankold[1] = -1;
|
||||
dreamwld_tilebank[0] = dreamwld_tilebank[1] = 0;
|
||||
dreamwld_state *state = (dreamwld_state *)machine->driver_data;
|
||||
|
||||
state->bg_tilemap = tilemap_create(machine, get_dreamwld_bg_tile_info,tilemap_scan_rows, 16, 16, 64,32);
|
||||
state->bg2_tilemap = tilemap_create(machine, get_dreamwld_bg2_tile_info,tilemap_scan_rows, 16, 16, 64,32);
|
||||
tilemap_set_transparent_pen(state->bg2_tilemap,0);
|
||||
}
|
||||
|
||||
static VIDEO_UPDATE( dreamwld )
|
||||
{
|
||||
tilemap_set_scrolly( dreamwld_bg_tilemap,0, dreamwld_bg_scroll[(0x400/4)]+32 );
|
||||
tilemap_set_scrolly( dreamwld_bg2_tilemap,0, dreamwld_bg_scroll[(0x400/4)+2]+32 );
|
||||
tilemap_set_scrollx( dreamwld_bg_tilemap,0, dreamwld_bg_scroll[(0x400/4)+1]+3 );
|
||||
tilemap_set_scrollx( dreamwld_bg2_tilemap,0, dreamwld_bg_scroll[(0x400/4)+3]+5 );
|
||||
dreamwld_state *state = (dreamwld_state *)screen->machine->driver_data;
|
||||
|
||||
dreamwld_tilebank[0] = (dreamwld_bg_scroll[(0x400/4)+4]>>6)&1;
|
||||
dreamwld_tilebank[1] = (dreamwld_bg_scroll[(0x400/4)+5]>>6)&1;
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, state->bg_scroll[(0x400 / 4)] + 32);
|
||||
tilemap_set_scrolly(state->bg2_tilemap, 0, state->bg_scroll[(0x400 / 4) + 2] + 32);
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, state->bg_scroll[(0x400 / 4) + 1] + 3);
|
||||
tilemap_set_scrollx(state->bg2_tilemap, 0, state->bg_scroll[(0x400 / 4) + 3] + 5);
|
||||
|
||||
if (dreamwld_tilebank[0] != dreamwld_tilebankold[0])
|
||||
state->tilebank[0] = (state->bg_scroll[(0x400 / 4) + 4] >> 6) & 1;
|
||||
state->tilebank[1] = (state->bg_scroll[(0x400 / 4) + 5] >> 6) & 1;
|
||||
|
||||
if (state->tilebank[0] != state->tilebankold[0])
|
||||
{
|
||||
dreamwld_tilebankold[0] = dreamwld_tilebank[0];
|
||||
tilemap_mark_all_tiles_dirty (dreamwld_bg_tilemap);
|
||||
state->tilebankold[0] = state->tilebank[0];
|
||||
tilemap_mark_all_tiles_dirty(state->bg_tilemap);
|
||||
}
|
||||
|
||||
if (dreamwld_tilebank[1] != dreamwld_tilebankold[1])
|
||||
if (state->tilebank[1] != state->tilebankold[1])
|
||||
{
|
||||
dreamwld_tilebankold[1] = dreamwld_tilebank[1];
|
||||
tilemap_mark_all_tiles_dirty (dreamwld_bg2_tilemap);
|
||||
state->tilebankold[1] = state->tilebank[1];
|
||||
tilemap_mark_all_tiles_dirty(state->bg2_tilemap);
|
||||
}
|
||||
|
||||
tilemap_draw(bitmap,cliprect,dreamwld_bg_tilemap,0,0);
|
||||
tilemap_draw(bitmap,cliprect,dreamwld_bg2_tilemap,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg2_tilemap, 0, 0);
|
||||
|
||||
draw_sprites(screen->machine,bitmap,cliprect);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -228,26 +244,28 @@ static VIDEO_UPDATE( dreamwld )
|
||||
|
||||
static READ32_HANDLER( dreamwld_protdata_r )
|
||||
{
|
||||
static int protindex = 0;
|
||||
UINT8 *protdata = memory_region( space->machine, "user1" );
|
||||
size_t protsize = memory_region_length( space->machine, "user1" );
|
||||
UINT8 dat = protdata[(protindex++)%protsize];
|
||||
return dat<<24;
|
||||
dreamwld_state *state = (dreamwld_state *)space->machine->driver_data;
|
||||
|
||||
UINT8 *protdata = memory_region(space->machine, "user1");
|
||||
size_t protsize = memory_region_length(space->machine, "user1");
|
||||
UINT8 dat = protdata[(state->protindex++) % protsize];
|
||||
return dat << 24;
|
||||
}
|
||||
|
||||
|
||||
static WRITE32_HANDLER( dreamwld_palette_w )
|
||||
{
|
||||
dreamwld_state *state = (dreamwld_state *)space->machine->driver_data;
|
||||
UINT16 dat;
|
||||
int color;
|
||||
|
||||
COMBINE_DATA(&paletteram32[offset]);
|
||||
COMBINE_DATA(&state->paletteram[offset]);
|
||||
color = offset * 2;
|
||||
|
||||
dat = paletteram32[offset] & 0x7fff;
|
||||
dat = state->paletteram[offset] & 0x7fff;
|
||||
palette_set_color_rgb(space->machine, color + 1, pal5bit(dat >> 10), pal5bit(dat >> 5), pal5bit(dat >> 0));
|
||||
|
||||
dat = (paletteram32[offset] >> 16) & 0x7fff;
|
||||
dat = (state->paletteram[offset] >> 16) & 0x7fff;
|
||||
palette_set_color_rgb(space->machine, color, pal5bit(dat >> 10), pal5bit(dat >> 5), pal5bit(dat >> 0));
|
||||
}
|
||||
|
||||
@ -256,52 +274,44 @@ static void dreamwld_oki_setbank( running_machine *machine, UINT8 chip, UINT8 ba
|
||||
/* 0x30000-0x3ffff is banked.
|
||||
banks are at 0x30000,0x40000,0x50000 and 0x60000 in rom */
|
||||
UINT8 *sound = memory_region(machine, chip ? "oki1" : "oki2");
|
||||
logerror("OKI%d: set bank %02x\n",chip,bank);
|
||||
memcpy(sound+0x30000, sound+0xb0000+0x10000*bank, 0x10000);
|
||||
logerror("OKI%d: set bank %02x\n", chip, bank);
|
||||
memcpy(sound + 0x30000, sound + 0xb0000 + 0x10000 * bank, 0x10000);
|
||||
}
|
||||
|
||||
|
||||
static WRITE32_HANDLER( dreamwld_6295_0_bank_w )
|
||||
{
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
dreamwld_oki_setbank(space->machine,0,data&0x3);
|
||||
}
|
||||
dreamwld_oki_setbank(space->machine, 0, data & 0x3);
|
||||
else
|
||||
{
|
||||
logerror("OKI0: unk bank write %x mem_mask %8x\n", data, mem_mask);
|
||||
}
|
||||
}
|
||||
|
||||
static WRITE32_HANDLER( dreamwld_6295_1_bank_w )
|
||||
{
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
dreamwld_oki_setbank(space->machine,1,data&0x3);
|
||||
}
|
||||
dreamwld_oki_setbank(space->machine, 1, data & 0x3);
|
||||
else
|
||||
{
|
||||
logerror("OKI1: unk bank write %x mem_mask %8x\n", data, mem_mask);
|
||||
}
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( dreamwld_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x000000, 0x0fffff) AM_ROM AM_WRITENOP
|
||||
|
||||
AM_RANGE(0x400000, 0x401fff) AM_RAM AM_BASE( &spriteram32 )
|
||||
AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(dreamwld_palette_w) AM_BASE(&paletteram32) // real palette?
|
||||
AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(dreamwld_bg_videoram_w ) AM_BASE( &dreamwld_bg_videoram )
|
||||
AM_RANGE(0x802000, 0x803fff) AM_RAM_WRITE(dreamwld_bg2_videoram_w ) AM_BASE( &dreamwld_bg2_videoram )
|
||||
AM_RANGE(0x804000, 0x805fff) AM_RAM AM_BASE( &dreamwld_bg_scroll ) // scroll regs etc.
|
||||
AM_RANGE(0x400000, 0x401fff) AM_RAM AM_BASE_MEMBER(dreamwld_state, spriteram)
|
||||
AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(dreamwld_palette_w) AM_BASE_MEMBER(dreamwld_state, paletteram) // real palette?
|
||||
AM_RANGE(0x800000, 0x801fff) AM_RAM_WRITE(dreamwld_bg_videoram_w ) AM_BASE_MEMBER(dreamwld_state, bg_videoram)
|
||||
AM_RANGE(0x802000, 0x803fff) AM_RAM_WRITE(dreamwld_bg2_videoram_w ) AM_BASE_MEMBER(dreamwld_state, bg2_videoram)
|
||||
AM_RANGE(0x804000, 0x805fff) AM_RAM AM_BASE_MEMBER(dreamwld_state, bg_scroll) // scroll regs etc.
|
||||
|
||||
AM_RANGE(0xc00000, 0xc00003) AM_READ_PORT("INPUTS")
|
||||
AM_RANGE(0xc00004, 0xc00007) AM_READ_PORT("c00004")
|
||||
|
||||
AM_RANGE(0xc0000c, 0xc0000f) AM_WRITE( dreamwld_6295_0_bank_w ) // sfx
|
||||
AM_RANGE(0xc00018, 0xc0001b) AM_DEVREADWRITE8( "oki1", okim6295_r, okim6295_w, 0xff000000 ) // sfx
|
||||
AM_RANGE(0xc0000c, 0xc0000f) AM_WRITE(dreamwld_6295_0_bank_w) // sfx
|
||||
AM_RANGE(0xc00018, 0xc0001b) AM_DEVREADWRITE8("oki1", okim6295_r, okim6295_w, 0xff000000) // sfx
|
||||
|
||||
AM_RANGE(0xc0002c, 0xc0002f) AM_WRITE( dreamwld_6295_1_bank_w ) // sfx
|
||||
AM_RANGE(0xc00028, 0xc0002b) AM_DEVREADWRITE8( "oki2", okim6295_r, okim6295_w, 0xff000000 ) // sfx
|
||||
AM_RANGE(0xc0002c, 0xc0002f) AM_WRITE(dreamwld_6295_1_bank_w) // sfx
|
||||
AM_RANGE(0xc00028, 0xc0002b) AM_DEVREADWRITE8("oki2", okim6295_r, okim6295_w, 0xff000000) // sfx
|
||||
|
||||
AM_RANGE(0xc00030, 0xc00033) AM_READ(dreamwld_protdata_r) // it reads protection data (irq code) from here and puts it at ffd000
|
||||
|
||||
@ -310,7 +320,7 @@ ADDRESS_MAP_END
|
||||
|
||||
|
||||
static INPUT_PORTS_START( dreamwld )
|
||||
PORT_START("INPUTS") /* 32bit */
|
||||
PORT_START("INPUTS")
|
||||
PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_COIN1 )
|
||||
PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_COIN2 )
|
||||
PORT_BIT( 0x0000fffc, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
@ -331,11 +341,11 @@ static INPUT_PORTS_START( dreamwld )
|
||||
PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
|
||||
PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
|
||||
|
||||
PORT_START("c00004") /* 32bit */
|
||||
PORT_START("c00004")
|
||||
PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "DSW")
|
||||
PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "DSW")
|
||||
|
||||
PORT_START("DSW") /* 16bit */
|
||||
PORT_START("DSW")
|
||||
PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2")
|
||||
PORT_DIPSETTING( 0x0002, "2" )
|
||||
PORT_DIPSETTING( 0x0003, "3" )
|
||||
@ -383,12 +393,38 @@ static GFXDECODE_START( dreamwld )
|
||||
GFXDECODE_ENTRY( "gfx2", 0, tiles16x16_layout, 0, 0x100 )
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
static MACHINE_START( dreamwld )
|
||||
{
|
||||
dreamwld_state *state = (dreamwld_state *)machine->driver_data;
|
||||
|
||||
state_save_register_global(machine, state->protindex);
|
||||
state_save_register_global_array(machine, state->tilebank);
|
||||
state_save_register_global_array(machine, state->tilebankold);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( dreamwld )
|
||||
{
|
||||
dreamwld_state *state = (dreamwld_state *)machine->driver_data;
|
||||
|
||||
state->tilebankold[0] = state->tilebankold[1] = -1;
|
||||
state->tilebank[0] = state->tilebank[1] = 0;
|
||||
state->protindex = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( dreamwld )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(dreamwld_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M68EC020, MASTER_CLOCK/2)
|
||||
MDRV_CPU_PROGRAM_MAP(dreamwld_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", irq4_line_hold) // 4, 5, or 6, all point to the same place
|
||||
|
||||
MDRV_MACHINE_START(dreamwld)
|
||||
MDRV_MACHINE_RESET(dreamwld)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(58)
|
||||
@ -436,7 +472,6 @@ ROM_START( dreamwld )
|
||||
ram. The interrupt vectors point at the code placed in RAM. */
|
||||
ROM_LOAD( "protdata.bin", 0x000, 0x6c9 , CRC(f284b2fd) SHA1(9e8096c8aa8a288683f002311b38787b120748d1) ) /* extracted */
|
||||
|
||||
|
||||
ROM_REGION( 0x100000, "oki1", 0 ) /* OKI Samples - 1st chip*/
|
||||
ROM_LOAD( "5.bin", 0x000000, 0x80000, CRC(9689570a) SHA1(4414233da8f46214ca7e9022df70953922a63aa4) )
|
||||
ROM_RELOAD(0x80000,0x80000) // fot the banks
|
||||
@ -460,4 +495,4 @@ ROM_START( dreamwld )
|
||||
ROM_END
|
||||
|
||||
|
||||
GAME( 2000, dreamwld, 0, dreamwld, dreamwld, 0, ROT0, "SemiCom", "Dream World", 0 )
|
||||
GAME( 2000, dreamwld, 0, dreamwld, dreamwld, 0, ROT0, "SemiCom", "Dream World", GAME_SUPPORTS_SAVE )
|
||||
|
@ -32,21 +32,6 @@
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Global variables
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/* referenced by the video hardware */
|
||||
UINT8 dribling_abca;
|
||||
|
||||
static UINT8 dr, ds, sh;
|
||||
static UINT8 input_mux;
|
||||
static UINT8 di;
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Interrupt generation
|
||||
@ -55,7 +40,8 @@ static UINT8 di;
|
||||
|
||||
static INTERRUPT_GEN( dribling_irq_gen )
|
||||
{
|
||||
if (di)
|
||||
dribling_state *state = (dribling_state *)device->machine->driver_data;
|
||||
if (state->di)
|
||||
cpu_set_input_line(device, 0, ASSERT_LINE);
|
||||
}
|
||||
|
||||
@ -69,19 +55,23 @@ static INTERRUPT_GEN( dribling_irq_gen )
|
||||
|
||||
static READ8_DEVICE_HANDLER( dsr_r )
|
||||
{
|
||||
dribling_state *state = (dribling_state *)device->machine->driver_data;
|
||||
|
||||
/* return DSR0-7 */
|
||||
return (ds << sh) | (dr >> (8 - sh));
|
||||
return (state->ds << state->sh) | (state->dr >> (8 - state->sh));
|
||||
}
|
||||
|
||||
|
||||
static READ8_DEVICE_HANDLER( input_mux0_r )
|
||||
{
|
||||
dribling_state *state = (dribling_state *)device->machine->driver_data;
|
||||
|
||||
/* low value in the given bit selects */
|
||||
if (!(input_mux & 0x01))
|
||||
if (!(state->input_mux & 0x01))
|
||||
return input_port_read(device->machine, "MUX0");
|
||||
else if (!(input_mux & 0x02))
|
||||
else if (!(state->input_mux & 0x02))
|
||||
return input_port_read(device->machine, "MUX1");
|
||||
else if (!(input_mux & 0x04))
|
||||
else if (!(state->input_mux & 0x04))
|
||||
return input_port_read(device->machine, "MUX2");
|
||||
return 0xff;
|
||||
}
|
||||
@ -96,15 +86,17 @@ static READ8_DEVICE_HANDLER( input_mux0_r )
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( misc_w )
|
||||
{
|
||||
dribling_state *state = (dribling_state *)device->machine->driver_data;
|
||||
|
||||
/* bit 7 = di */
|
||||
di = (data >> 7) & 1;
|
||||
if (!di)
|
||||
state->di = (data >> 7) & 1;
|
||||
if (!state->di)
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, CLEAR_LINE);
|
||||
|
||||
/* bit 6 = parata */
|
||||
|
||||
/* bit 5 = ab. campo */
|
||||
dribling_abca = (data >> 5) & 1;
|
||||
state->abca = (data >> 5) & 1;
|
||||
|
||||
/* bit 4 = ab. a.b.f. */
|
||||
/* bit 3 = n/c */
|
||||
@ -112,7 +104,7 @@ static WRITE8_DEVICE_HANDLER( misc_w )
|
||||
/* bit 2 = (9) = PC2 */
|
||||
/* bit 1 = (10) = PC1 */
|
||||
/* bit 0 = (32) = PC0 */
|
||||
input_mux = data & 7;
|
||||
state->input_mux = data & 7;
|
||||
logerror("%s:misc_w(%02X)\n", cpuexec_describe_context(device->machine), data);
|
||||
}
|
||||
|
||||
@ -121,7 +113,7 @@ static WRITE8_DEVICE_HANDLER( sound_w )
|
||||
{
|
||||
/* bit 7 = stop palla */
|
||||
/* bit 6 = contrasto */
|
||||
/* bit 5 = calgio a */
|
||||
/* bit 5 = calcio a */
|
||||
/* bit 4 = fischio */
|
||||
/* bit 3 = calcio b */
|
||||
/* bit 2 = folla a */
|
||||
@ -140,12 +132,14 @@ static WRITE8_DEVICE_HANDLER( pb_w )
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( shr_w )
|
||||
{
|
||||
dribling_state *state = (dribling_state *)device->machine->driver_data;
|
||||
|
||||
/* bit 3 = watchdog */
|
||||
if (data & 0x08)
|
||||
watchdog_reset(device->machine);
|
||||
|
||||
/* bit 2-0 = SH0-2 */
|
||||
sh = data & 0x07;
|
||||
state->sh = data & 0x07;
|
||||
}
|
||||
|
||||
|
||||
@ -158,24 +152,28 @@ static WRITE8_DEVICE_HANDLER( shr_w )
|
||||
|
||||
static READ8_HANDLER( ioread )
|
||||
{
|
||||
dribling_state *state = (dribling_state *)space->machine->driver_data;
|
||||
|
||||
if (offset & 0x08)
|
||||
return ppi8255_r(devtag_get_device(space->machine, "ppi8255_0"), offset & 3);
|
||||
return ppi8255_r(state->ppi_0, offset & 3);
|
||||
else if (offset & 0x10)
|
||||
return ppi8255_r(devtag_get_device(space->machine, "ppi8255_1"), offset & 3);
|
||||
return ppi8255_r(state->ppi_1, offset & 3);
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( iowrite )
|
||||
{
|
||||
dribling_state *state = (dribling_state *)space->machine->driver_data;
|
||||
|
||||
if (offset & 0x08)
|
||||
ppi8255_w(devtag_get_device(space->machine, "ppi8255_0"), offset & 3, data);
|
||||
ppi8255_w(state->ppi_0, offset & 3, data);
|
||||
else if (offset & 0x10)
|
||||
ppi8255_w(devtag_get_device(space->machine, "ppi8255_1"), offset & 3, data);
|
||||
ppi8255_w(state->ppi_1, offset & 3, data);
|
||||
else if (offset & 0x40)
|
||||
{
|
||||
dr = ds;
|
||||
ds = data;
|
||||
state->dr = state->ds;
|
||||
state->ds = data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -217,9 +215,9 @@ static const ppi8255_interface ppi8255_intf[2] =
|
||||
|
||||
static ADDRESS_MAP_START( dribling_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x1fff) AM_ROM
|
||||
AM_RANGE(0x2000, 0x3fff) AM_RAM AM_BASE(&videoram)
|
||||
AM_RANGE(0x2000, 0x3fff) AM_RAM AM_BASE_MEMBER(dribling_state, videoram)
|
||||
AM_RANGE(0x4000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0xc000, 0xdfff) AM_RAM_WRITE(dribling_colorram_w) AM_BASE(&colorram)
|
||||
AM_RANGE(0xc000, 0xdfff) AM_RAM_WRITE(dribling_colorram_w) AM_BASE_MEMBER(dribling_state, colorram)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
@ -237,7 +235,7 @@ ADDRESS_MAP_END
|
||||
*************************************/
|
||||
|
||||
static INPUT_PORTS_START( dribling )
|
||||
PORT_START("MUX0") /* IN0 (mux 0) */
|
||||
PORT_START("MUX0")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1)
|
||||
@ -247,7 +245,7 @@ static INPUT_PORTS_START( dribling )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(1)
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(1)
|
||||
|
||||
PORT_START("MUX1") /* IN0 (mux 1) */
|
||||
PORT_START("MUX1")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(2)
|
||||
@ -257,7 +255,7 @@ static INPUT_PORTS_START( dribling )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(2)
|
||||
|
||||
PORT_START("MUX2") /* IN0 (mux 2) */
|
||||
PORT_START("MUX2")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
|
||||
PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
@ -265,7 +263,7 @@ static INPUT_PORTS_START( dribling )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
|
||||
PORT_START("IN0") /* IN0 */
|
||||
PORT_START("IN0")
|
||||
PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
|
||||
@ -285,8 +283,39 @@ INPUT_PORTS_END
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( dribling )
|
||||
{
|
||||
dribling_state *state = (dribling_state *)machine->driver_data;
|
||||
|
||||
state->ppi_0 = devtag_get_device(machine, "ppi8255_0");
|
||||
state->ppi_1 = devtag_get_device(machine, "ppi8255_1");
|
||||
|
||||
state_save_register_global(machine, state->abca);
|
||||
state_save_register_global(machine, state->di);
|
||||
state_save_register_global(machine, state->dr);
|
||||
state_save_register_global(machine, state->ds);
|
||||
state_save_register_global(machine, state->sh);
|
||||
state_save_register_global(machine, state->input_mux);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( dribling )
|
||||
{
|
||||
dribling_state *state = (dribling_state *)machine->driver_data;
|
||||
|
||||
state->abca = 0;
|
||||
state->di = 0;
|
||||
state->dr = 0;
|
||||
state->ds = 0;
|
||||
state->sh = 0;
|
||||
state->input_mux = 0;
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_DRIVER_START( dribling )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(dribling_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, 5000000)
|
||||
MDRV_CPU_PROGRAM_MAP(dribling_map)
|
||||
@ -296,6 +325,9 @@ static MACHINE_DRIVER_START( dribling )
|
||||
MDRV_PPI8255_ADD( "ppi8255_0", ppi8255_intf[0] )
|
||||
MDRV_PPI8255_ADD( "ppi8255_1", ppi8255_intf[1] )
|
||||
|
||||
MDRV_MACHINE_START(dribling)
|
||||
MDRV_MACHINE_RESET(dribling)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
|
||||
|
||||
@ -367,5 +399,5 @@ ROM_END
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1983, dribling, 0, dribling, dribling, 0, ROT0, "Model Racing", "Dribbling", GAME_NO_SOUND )
|
||||
GAME( 1983, driblingo,dribling, dribling, dribling, 0, ROT0, "Model Racing (Olympia license)", "Dribbling (Olympia)", GAME_NO_SOUND )
|
||||
GAME( 1983, dribling, 0, dribling, dribling, 0, ROT0, "Model Racing", "Dribbling", GAME_NO_SOUND | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1983, driblingo,dribling, dribling, dribling, 0, ROT0, "Model Racing (Olympia license)", "Dribbling (Olympia)", GAME_NO_SOUND | GAME_SUPPORTS_SAVE )
|
||||
|
@ -12,52 +12,53 @@ Quite similar to Appoooh
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/msm5205.h"
|
||||
#include "sound/sn76496.h"
|
||||
#include "drmicro.h"
|
||||
|
||||
#define MCLK 18432000
|
||||
|
||||
PALETTE_INIT( drmicro );
|
||||
VIDEO_START( drmicro );
|
||||
VIDEO_UPDATE( drmicro );
|
||||
|
||||
WRITE8_HANDLER( drmicro_videoram_w );
|
||||
|
||||
extern void drmicro_flip_w( running_machine *machine, int flip );
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
static int drmicro_nmi_enable;
|
||||
/*************************************
|
||||
*
|
||||
* Memory handlers
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static INTERRUPT_GEN( drmicro_interrupt )
|
||||
{
|
||||
if (drmicro_nmi_enable)
|
||||
drmicro_state *state = (drmicro_state *)device->machine->driver_data;
|
||||
|
||||
if (state->nmi_enable)
|
||||
cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( nmi_enable_w )
|
||||
{ // bit2,3 unknown
|
||||
drmicro_nmi_enable = data & 1;
|
||||
drmicro_flip_w(space->machine, data & 2);
|
||||
{
|
||||
drmicro_state *state = (drmicro_state *)space->machine->driver_data;
|
||||
|
||||
state->nmi_enable = data & 1;
|
||||
state->flipscreen = (data & 2) ? 1 : 0;
|
||||
flip_screen_set(space->machine, data & 2);
|
||||
|
||||
// bit2,3 unknown
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
static int pcm_adr;
|
||||
|
||||
static void pcm_w(const device_config *device)
|
||||
{
|
||||
drmicro_state *state = (drmicro_state *)device->machine->driver_data;
|
||||
UINT8 *PCM = memory_region(device->machine, "adpcm");
|
||||
|
||||
int data = PCM[pcm_adr / 2];
|
||||
int data = PCM[state->pcm_adr / 2];
|
||||
|
||||
if (data != 0x70) // ??
|
||||
{
|
||||
if (~pcm_adr & 1)
|
||||
if (~state->pcm_adr & 1)
|
||||
data >>= 4;
|
||||
|
||||
msm5205_data_w(device, data & 0x0f);
|
||||
msm5205_reset_w(device, 0);
|
||||
|
||||
pcm_adr = (pcm_adr + 1) & 0x7fff;
|
||||
state->pcm_adr = (state->pcm_adr + 1) & 0x7fff;
|
||||
}
|
||||
else
|
||||
msm5205_reset_w(device, 1);
|
||||
@ -65,11 +66,16 @@ static void pcm_w(const device_config *device)
|
||||
|
||||
static WRITE8_HANDLER( pcm_set_w )
|
||||
{
|
||||
pcm_adr = ((data & 0x3f) << 9);
|
||||
pcm_w(devtag_get_device(space->machine, "msm"));
|
||||
drmicro_state *state = (drmicro_state *)space->machine->driver_data;
|
||||
state->pcm_adr = ((data & 0x3f) << 9);
|
||||
pcm_w(state->msm);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/*************************************
|
||||
*
|
||||
* Address maps
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static ADDRESS_MAP_START( drmicro_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0xbfff) AM_ROM
|
||||
@ -88,7 +94,11 @@ static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
|
||||
AM_RANGE(0x05, 0x05) AM_READWRITE(SMH_NOP, SMH_NOP) // unused? / watchdog?
|
||||
ADDRESS_MAP_END
|
||||
|
||||
/****************************************************************************/
|
||||
/*************************************
|
||||
*
|
||||
* Input ports
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static INPUT_PORTS_START( drmicro )
|
||||
PORT_START("P1")
|
||||
@ -146,7 +156,11 @@ static INPUT_PORTS_START( drmicro )
|
||||
PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // 4-8
|
||||
INPUT_PORTS_END
|
||||
|
||||
/****************************************************************************/
|
||||
/*************************************
|
||||
*
|
||||
* Graphics definitions
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static const gfx_layout spritelayout4 =
|
||||
{
|
||||
@ -205,10 +219,39 @@ static const msm5205_interface msm5205_config =
|
||||
MSM5205_S64_4B /* 6 KHz */
|
||||
};
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Machine driver
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( drmicro )
|
||||
{
|
||||
drmicro_state *state = (drmicro_state *)machine->driver_data;
|
||||
|
||||
state->msm = devtag_get_device(machine, "msm");
|
||||
|
||||
state_save_register_global(machine, state->nmi_enable);
|
||||
state_save_register_global(machine, state->pcm_adr);
|
||||
state_save_register_global(machine, state->flipscreen);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( drmicro )
|
||||
{
|
||||
drmicro_state *state = (drmicro_state *)machine->driver_data;
|
||||
|
||||
state->nmi_enable = 0;
|
||||
state->pcm_adr = 0;
|
||||
state->flipscreen = 0;
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_DRIVER_START( drmicro )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(drmicro_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80,MCLK/6) /* 3.072MHz? */
|
||||
MDRV_CPU_PROGRAM_MAP(drmicro_map)
|
||||
@ -217,6 +260,9 @@ static MACHINE_DRIVER_START( drmicro )
|
||||
|
||||
MDRV_QUANTUM_TIME(HZ(60))
|
||||
|
||||
MDRV_MACHINE_START(drmicro)
|
||||
MDRV_MACHINE_RESET(drmicro)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -249,7 +295,11 @@ static MACHINE_DRIVER_START( drmicro )
|
||||
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
|
||||
MACHINE_DRIVER_END
|
||||
|
||||
/****************************************************************************/
|
||||
/*************************************
|
||||
*
|
||||
* ROM definition(s)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
ROM_START( drmicro )
|
||||
ROM_REGION( 0x10000, "maincpu", 0 ) // CPU
|
||||
@ -279,5 +329,12 @@ ROM_START( drmicro )
|
||||
ROM_LOAD( "dm-60.6e", 0x0120, 0x0100, CRC(540a3953) SHA1(bc65388a1019dadf8c71705e234763f5c735e282) )
|
||||
ROM_END
|
||||
|
||||
GAME( 1983, drmicro, 0, drmicro, drmicro, 0, ROT270, "Sanritsu", "Dr. Micro", 0 )
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Game driver(s)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1983, drmicro, 0, drmicro, drmicro, 0, ROT270, "Sanritsu", "Dr. Micro", GAME_SUPPORTS_SAVE )
|
||||
|
||||
|
@ -11,22 +11,38 @@ similar hardware.
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "sound/okim6295.h"
|
||||
|
||||
static UINT16 *drtomy_spriteram;
|
||||
static UINT16 *drtomy_videoram_bg, *drtomy_videoram_fg;
|
||||
static tilemap *tilemap_bg, *tilemap_fg;
|
||||
typedef struct _drtomy_state drtomy_state;
|
||||
struct _drtomy_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT16 * spriteram;
|
||||
UINT16 * videoram_bg;
|
||||
UINT16 * videoram_fg;
|
||||
// UINT16 * paletteram16; // currently this uses generic palette handling
|
||||
|
||||
/* video-related */
|
||||
tilemap *tilemap_bg,*tilemap_fg;
|
||||
|
||||
/* misc */
|
||||
int oki_bank;
|
||||
};
|
||||
|
||||
|
||||
|
||||
static TILE_GET_INFO( get_tile_info_fg )
|
||||
{
|
||||
int code = drtomy_videoram_fg[tile_index] & 0xfff;
|
||||
int color = (drtomy_videoram_fg[tile_index] & 0xf000) >> 12;
|
||||
drtomy_state *state = (drtomy_state *)machine->driver_data;
|
||||
int code = state->videoram_fg[tile_index] & 0xfff;
|
||||
int color = (state->videoram_fg[tile_index] & 0xf000) >> 12;
|
||||
SET_TILE_INFO(2, code, color, 0);
|
||||
}
|
||||
|
||||
|
||||
static TILE_GET_INFO( get_tile_info_bg )
|
||||
{
|
||||
int code = drtomy_videoram_bg[tile_index] & 0xfff;
|
||||
int color = (drtomy_videoram_bg[tile_index] & 0xf000) >> 12;
|
||||
drtomy_state *state = (drtomy_state *)machine->driver_data;
|
||||
int code = state->videoram_bg[tile_index] & 0xfff;
|
||||
int color = (state->videoram_bg[tile_index] & 0xf000) >> 12;
|
||||
SET_TILE_INFO(1, code, color, 0);
|
||||
}
|
||||
|
||||
@ -48,38 +64,42 @@ static TILE_GET_INFO( get_tile_info_bg )
|
||||
3 | xxxxxxxx xxxxxx-- | sprite code
|
||||
*/
|
||||
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
drtomy_state *state = (drtomy_state *)machine->driver_data;
|
||||
int i, x, y, ex, ey;
|
||||
const gfx_element *gfx = machine->gfx[0];
|
||||
|
||||
static const int x_offset[2] = {0x0,0x2};
|
||||
static const int y_offset[2] = {0x0,0x1};
|
||||
static const int x_offset[2] = {0x0, 0x2};
|
||||
static const int y_offset[2] = {0x0, 0x1};
|
||||
|
||||
for (i = 3; i < 0x1000/2; i+=4){
|
||||
int sx = drtomy_spriteram[i+2] & 0x01ff;
|
||||
int sy = (240 - (drtomy_spriteram[i] & 0x00ff)) & 0x00ff;
|
||||
int number = drtomy_spriteram[i+3];
|
||||
int color = (drtomy_spriteram[i+2] & 0x1e00) >> 9;
|
||||
int attr = (drtomy_spriteram[i] & 0xfe00) >> 9;
|
||||
for (i = 3; i < 0x1000 / 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;
|
||||
int spr_size;
|
||||
|
||||
if (attr & 0x04){
|
||||
if (attr & 0x04)
|
||||
spr_size = 1;
|
||||
}
|
||||
else{
|
||||
else
|
||||
{
|
||||
spr_size = 2;
|
||||
number &= (~3);
|
||||
}
|
||||
|
||||
for (y = 0; y < spr_size; y++){
|
||||
for (x = 0; x < spr_size; x++){
|
||||
for (y = 0; y < spr_size; y++)
|
||||
{
|
||||
for (x = 0; x < spr_size; x++)
|
||||
{
|
||||
|
||||
ex = xflip ? (spr_size-1-x) : x;
|
||||
ey = yflip ? (spr_size-1-y) : y;
|
||||
ex = xflip ? (spr_size - 1 - x) : x;
|
||||
ey = yflip ? (spr_size - 1 - y) : y;
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,gfx,number + x_offset[ex] + y_offset[ey],
|
||||
color,xflip,yflip,
|
||||
@ -91,40 +111,45 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
static VIDEO_START( drtomy )
|
||||
{
|
||||
tilemap_bg = tilemap_create(machine, get_tile_info_bg,tilemap_scan_rows,16,16,32,32);
|
||||
tilemap_fg = tilemap_create(machine, get_tile_info_fg,tilemap_scan_rows,16,16,32,32);
|
||||
drtomy_state *state = (drtomy_state *)machine->driver_data;
|
||||
|
||||
tilemap_set_transparent_pen(tilemap_fg,0);
|
||||
state->tilemap_bg = tilemap_create(machine, get_tile_info_bg, tilemap_scan_rows, 16, 16, 32, 32);
|
||||
state->tilemap_fg = tilemap_create(machine, get_tile_info_fg, tilemap_scan_rows, 16, 16, 32, 32);
|
||||
|
||||
tilemap_set_transparent_pen(state->tilemap_fg, 0);
|
||||
}
|
||||
|
||||
static VIDEO_UPDATE( drtomy )
|
||||
{
|
||||
tilemap_draw(bitmap,cliprect,tilemap_bg,0,0);
|
||||
tilemap_draw(bitmap,cliprect,tilemap_fg,0,0);
|
||||
draw_sprites(screen->machine,bitmap,cliprect);
|
||||
drtomy_state *state = (drtomy_state *)screen->machine->driver_data;
|
||||
|
||||
tilemap_draw(bitmap, cliprect, state->tilemap_bg, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->tilemap_fg, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( drtomy_vram_fg_w )
|
||||
{
|
||||
COMBINE_DATA(&drtomy_videoram_fg[offset]);
|
||||
tilemap_mark_tile_dirty(tilemap_fg,offset);
|
||||
drtomy_state *state = (drtomy_state *)space->machine->driver_data;
|
||||
COMBINE_DATA(&state->videoram_fg[offset]);
|
||||
tilemap_mark_tile_dirty(state->tilemap_fg, offset);
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( drtomy_vram_bg_w )
|
||||
{
|
||||
COMBINE_DATA(&drtomy_videoram_bg[offset]);
|
||||
tilemap_mark_tile_dirty(tilemap_bg,offset);
|
||||
drtomy_state *state = (drtomy_state *)space->machine->driver_data;
|
||||
COMBINE_DATA(&state->videoram_bg[offset]);
|
||||
tilemap_mark_tile_dirty(state->tilemap_bg, offset);
|
||||
}
|
||||
|
||||
static WRITE16_DEVICE_HANDLER( drtomy_okibank_w )
|
||||
{
|
||||
static int oki_bank;
|
||||
|
||||
if(oki_bank != (data & 3))
|
||||
drtomy_state *state = (drtomy_state *)device->machine->driver_data;
|
||||
if (state->oki_bank != (data & 3))
|
||||
{
|
||||
oki_bank = data & 3;
|
||||
okim6295_set_bank_base(device, oki_bank * 0x40000);
|
||||
state->oki_bank = data & 3;
|
||||
okim6295_set_bank_base(device, state->oki_bank * 0x40000);
|
||||
}
|
||||
|
||||
/* unknown bit 2 -> (data & 4) */
|
||||
@ -132,10 +157,10 @@ static WRITE16_DEVICE_HANDLER( drtomy_okibank_w )
|
||||
|
||||
static ADDRESS_MAP_START( drtomy_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x03ffff) AM_ROM /* ROM */
|
||||
AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(drtomy_vram_fg_w) AM_BASE(&drtomy_videoram_fg) /* Video RAM FG */
|
||||
AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(drtomy_vram_bg_w) AM_BASE(&drtomy_videoram_bg) /* Video RAM BG */
|
||||
AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(drtomy_vram_fg_w) AM_BASE_MEMBER(drtomy_state, videoram_fg) /* Video RAM FG */
|
||||
AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(drtomy_vram_bg_w) AM_BASE_MEMBER(drtomy_state, videoram_bg) /* Video RAM BG */
|
||||
AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16) /* Palette */
|
||||
AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(&drtomy_spriteram) /* Sprite RAM */
|
||||
AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE_MEMBER(drtomy_state, spriteram) /* Sprite RAM */
|
||||
AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW1")
|
||||
AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW2")
|
||||
AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1")
|
||||
@ -247,13 +272,33 @@ static INPUT_PORTS_START( drtomy )
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
static MACHINE_START( drtomy )
|
||||
{
|
||||
drtomy_state *state = (drtomy_state *)machine->driver_data;
|
||||
|
||||
state_save_register_global(machine, state->oki_bank);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( drtomy )
|
||||
{
|
||||
drtomy_state *state = (drtomy_state *)machine->driver_data;
|
||||
|
||||
state->oki_bank = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( drtomy )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(drtomy_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M68000,24000000/2) /* ? MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(drtomy_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", irq6_line_hold)
|
||||
|
||||
MDRV_MACHINE_START(drtomy)
|
||||
MDRV_MACHINE_RESET(drtomy)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -303,4 +348,4 @@ ROM_START( drtomy )
|
||||
ROM_END
|
||||
|
||||
|
||||
GAME( 1993, drtomy, 0, drtomy, drtomy, 0, ROT0, "Playmark", "Dr. Tomy", 0 )
|
||||
GAME( 1993, drtomy, 0, drtomy, drtomy, 0, ROT0, "Playmark", "Dr. Tomy", GAME_SUPPORTS_SAVE )
|
||||
|
44
src/mame/includes/deniam.h
Normal file
44
src/mame/includes/deniam.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*************************************************************************
|
||||
|
||||
Deniam games
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
|
||||
typedef struct _deniam_state deniam_state;
|
||||
struct _deniam_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT16 * videoram;
|
||||
UINT16 * textram;
|
||||
UINT16 * spriteram;
|
||||
UINT16 * paletteram;
|
||||
|
||||
/* video-related */
|
||||
tilemap *fg_tilemap, *bg_tilemap, *tx_tilemap;
|
||||
int display_enable;
|
||||
int bg_scrollx_offs, bg_scrolly_offs;
|
||||
int fg_scrollx_offs, fg_scrolly_offs;
|
||||
int bg_scrollx_reg, bg_scrolly_reg, bg_page_reg;
|
||||
int fg_scrollx_reg, fg_scrolly_reg, fg_page_reg;
|
||||
int bg_page[4], fg_page[4];
|
||||
UINT16 coinctrl;
|
||||
|
||||
/* devices */
|
||||
const device_config *audio_cpu; // system 16c does not have sound CPU
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/deniam.c -----------*/
|
||||
|
||||
WRITE16_HANDLER( deniam_videoram_w );
|
||||
WRITE16_HANDLER( deniam_textram_w );
|
||||
WRITE16_HANDLER( deniam_palette_w );
|
||||
READ16_HANDLER( deniam_coinctrl_r );
|
||||
WRITE16_HANDLER( deniam_coinctrl_w );
|
||||
|
||||
VIDEO_START( deniam );
|
||||
VIDEO_UPDATE( deniam );
|
||||
|
||||
DRIVER_INIT( logicpro );
|
||||
DRIVER_INIT( karianx );
|
@ -7,19 +7,38 @@
|
||||
#include "sound/discrete.h"
|
||||
|
||||
/* Discrete Sound Input Nodes */
|
||||
#define DRAGRACE_SCREECH1_EN NODE_01
|
||||
#define DRAGRACE_SCREECH2_EN NODE_02
|
||||
#define DRAGRACE_LOTONE_EN NODE_03
|
||||
#define DRAGRACE_HITONE_EN NODE_04
|
||||
#define DRAGRACE_EXPLODE1_EN NODE_05
|
||||
#define DRAGRACE_EXPLODE2_EN NODE_06
|
||||
#define DRAGRACE_MOTOR1_DATA NODE_07
|
||||
#define DRAGRACE_MOTOR2_DATA NODE_08
|
||||
#define DRAGRACE_MOTOR1_EN NODE_80
|
||||
#define DRAGRACE_MOTOR2_EN NODE_81
|
||||
#define DRAGRACE_KLEXPL1_EN NODE_82
|
||||
#define DRAGRACE_KLEXPL2_EN NODE_83
|
||||
#define DRAGRACE_ATTRACT_EN NODE_09
|
||||
#define DRAGRACE_SCREECH1_EN NODE_01
|
||||
#define DRAGRACE_SCREECH2_EN NODE_02
|
||||
#define DRAGRACE_LOTONE_EN NODE_03
|
||||
#define DRAGRACE_HITONE_EN NODE_04
|
||||
#define DRAGRACE_EXPLODE1_EN NODE_05
|
||||
#define DRAGRACE_EXPLODE2_EN NODE_06
|
||||
#define DRAGRACE_MOTOR1_DATA NODE_07
|
||||
#define DRAGRACE_MOTOR2_DATA NODE_08
|
||||
#define DRAGRACE_MOTOR1_EN NODE_80
|
||||
#define DRAGRACE_MOTOR2_EN NODE_81
|
||||
#define DRAGRACE_KLEXPL1_EN NODE_82
|
||||
#define DRAGRACE_KLEXPL2_EN NODE_83
|
||||
#define DRAGRACE_ATTRACT_EN NODE_09
|
||||
|
||||
|
||||
typedef struct _dragrace_state dragrace_state;
|
||||
struct _dragrace_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * playfield_ram;
|
||||
UINT8 * position_ram;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap;
|
||||
|
||||
/* misc */
|
||||
unsigned misc_flags;
|
||||
int gear[2];
|
||||
|
||||
/* devices */
|
||||
const device_config *discrete;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in audio/dragrace.c -----------*/
|
||||
@ -30,7 +49,3 @@ DISCRETE_SOUND_EXTERN( dragrace );
|
||||
|
||||
VIDEO_START( dragrace );
|
||||
VIDEO_UPDATE( dragrace );
|
||||
|
||||
extern UINT8* dragrace_playfield_ram;
|
||||
extern UINT8* dragrace_position_ram;
|
||||
|
||||
|
@ -4,9 +4,26 @@
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
/*----------- defined in drivers/dribling.c -----------*/
|
||||
|
||||
extern UINT8 dribling_abca;
|
||||
|
||||
typedef struct _dribling_state dribling_state;
|
||||
struct _dribling_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
UINT8 * colorram;
|
||||
|
||||
/* misc */
|
||||
UINT8 abca;
|
||||
UINT8 dr, ds, sh;
|
||||
UINT8 input_mux;
|
||||
UINT8 di;
|
||||
|
||||
|
||||
/* devices */
|
||||
const device_config *ppi_0;
|
||||
const device_config *ppi_1;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/dribling.c -----------*/
|
||||
|
33
src/mame/includes/drmicro.h
Normal file
33
src/mame/includes/drmicro.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*************************************************************************
|
||||
|
||||
Dr. Micro
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
|
||||
typedef struct _drmicro_state drmicro_state;
|
||||
struct _drmicro_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg1, *bg2;
|
||||
int flipscreen;
|
||||
|
||||
/* misc */
|
||||
int nmi_enable;
|
||||
int pcm_adr;
|
||||
|
||||
/* devices */
|
||||
const device_config *msm;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/drmicro.c -----------*/
|
||||
|
||||
PALETTE_INIT( drmicro );
|
||||
VIDEO_START( drmicro );
|
||||
VIDEO_UPDATE( drmicro );
|
||||
|
||||
WRITE8_HANDLER( drmicro_videoram_w );
|
@ -603,7 +603,7 @@ $(MAMEOBJ)/dynax.a: \
|
||||
$(DRIVERS)/royalmah.o \
|
||||
|
||||
$(MAMEOBJ)/edevices.a: \
|
||||
$(DRIVERS)/diverboy.o $(VIDEO)/diverboy.o \
|
||||
$(DRIVERS)/diverboy.o \
|
||||
$(DRIVERS)/fantland.o $(VIDEO)/fantland.o \
|
||||
$(DRIVERS)/mwarr.o \
|
||||
$(DRIVERS)/mugsmash.o $(VIDEO)/mugsmash.o \
|
||||
|
@ -1,44 +1,51 @@
|
||||
#include "driver.h"
|
||||
#include "deniam.h"
|
||||
|
||||
|
||||
UINT16 *deniam_videoram,*deniam_textram;
|
||||
static int display_enable;
|
||||
static int bg_scrollx_offs,bg_scrolly_offs,fg_scrollx_offs,fg_scrolly_offs;
|
||||
static int bg_scrollx_reg,bg_scrolly_reg,bg_page_reg;
|
||||
static int fg_scrollx_reg,fg_scrolly_reg,fg_page_reg;
|
||||
static int bg_page[4],fg_page[4];
|
||||
static void deniam_common_init( running_machine *machine )
|
||||
{
|
||||
deniam_state *state = (deniam_state *)machine->driver_data;
|
||||
int i;
|
||||
|
||||
static tilemap *bg_tilemap,*fg_tilemap,*tx_tilemap;
|
||||
state->bg_scrollx_reg = 0x00a4/2;
|
||||
state->bg_scrolly_reg = 0x00a8/2;
|
||||
state->bg_page_reg = 0x00ac/2;
|
||||
state->fg_scrollx_reg = 0x00a2/2;
|
||||
state->fg_scrolly_reg = 0x00a6/2;
|
||||
state->fg_page_reg = 0x00aa/2;
|
||||
|
||||
state->display_enable = 0;
|
||||
state->coinctrl = 0;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
state->bg_page[i] = 0;
|
||||
state->fg_page[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
DRIVER_INIT( logicpro )
|
||||
{
|
||||
bg_scrollx_reg = 0x00a4/2;
|
||||
bg_scrolly_reg = 0x00a8/2;
|
||||
bg_page_reg = 0x00ac/2;
|
||||
fg_scrollx_reg = 0x00a2/2;
|
||||
fg_scrolly_reg = 0x00a6/2;
|
||||
fg_page_reg = 0x00aa/2;
|
||||
deniam_state *state = (deniam_state *)machine->driver_data;
|
||||
|
||||
bg_scrollx_offs = 0x00d;
|
||||
bg_scrolly_offs = 0x000;
|
||||
fg_scrollx_offs = 0x009;
|
||||
fg_scrolly_offs = 0x000;
|
||||
deniam_common_init(machine);
|
||||
|
||||
state->bg_scrollx_offs = 0x00d;
|
||||
state->bg_scrolly_offs = 0x000;
|
||||
state->fg_scrollx_offs = 0x009;
|
||||
state->fg_scrolly_offs = 0x000;
|
||||
}
|
||||
|
||||
DRIVER_INIT( karianx )
|
||||
{
|
||||
bg_scrollx_reg = 0x00a4/2;
|
||||
bg_scrolly_reg = 0x00a8/2;
|
||||
bg_page_reg = 0x00ac/2;
|
||||
fg_scrollx_reg = 0x00a2/2;
|
||||
fg_scrolly_reg = 0x00a6/2;
|
||||
fg_page_reg = 0x00aa/2;
|
||||
deniam_state *state = (deniam_state *)machine->driver_data;
|
||||
|
||||
bg_scrollx_offs = 0x10d;
|
||||
bg_scrolly_offs = 0x080;
|
||||
fg_scrollx_offs = 0x109;
|
||||
fg_scrolly_offs = 0x080;
|
||||
deniam_common_init(machine);
|
||||
|
||||
state->bg_scrollx_offs = 0x10d;
|
||||
state->bg_scrolly_offs = 0x080;
|
||||
state->fg_scrollx_offs = 0x109;
|
||||
state->fg_scrolly_offs = 0x080;
|
||||
}
|
||||
|
||||
|
||||
@ -57,8 +64,9 @@ static TILEMAP_MAPPER( scan_pages )
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
deniam_state *state = (deniam_state *)machine->driver_data;
|
||||
int page = tile_index >> 11;
|
||||
UINT16 attr = deniam_videoram[bg_page[page] * 0x0800 + (tile_index & 0x7ff)];
|
||||
UINT16 attr = state->videoram[state->bg_page[page] * 0x0800 + (tile_index & 0x7ff)];
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
attr,
|
||||
@ -68,8 +76,9 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
static TILE_GET_INFO( get_fg_tile_info )
|
||||
{
|
||||
deniam_state *state = (deniam_state *)machine->driver_data;
|
||||
int page = tile_index >> 11;
|
||||
UINT16 attr = deniam_videoram[fg_page[page] * 0x0800 + (tile_index & 0x7ff)];
|
||||
UINT16 attr = state->videoram[state->fg_page[page] * 0x0800 + (tile_index & 0x7ff)];
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
attr,
|
||||
@ -79,7 +88,8 @@ static TILE_GET_INFO( get_fg_tile_info )
|
||||
|
||||
static TILE_GET_INFO( get_tx_tile_info )
|
||||
{
|
||||
UINT16 attr = deniam_textram[tile_index];
|
||||
deniam_state *state = (deniam_state *)machine->driver_data;
|
||||
UINT16 attr = state->textram[tile_index];
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
attr & 0xf1ff,
|
||||
@ -97,12 +107,13 @@ static TILE_GET_INFO( get_tx_tile_info )
|
||||
|
||||
VIDEO_START( deniam )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info,scan_pages, 8,8,128,64);
|
||||
fg_tilemap = tilemap_create(machine, get_fg_tile_info,scan_pages, 8,8,128,64);
|
||||
tx_tilemap = tilemap_create(machine, get_tx_tile_info,tilemap_scan_rows,8,8, 64,32);
|
||||
deniam_state *state = (deniam_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, scan_pages, 8, 8, 128, 64);
|
||||
state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, scan_pages, 8, 8, 128, 64);
|
||||
state->tx_tilemap = tilemap_create(machine, get_tx_tile_info, tilemap_scan_rows, 8, 8, 64, 32);
|
||||
|
||||
tilemap_set_transparent_pen(fg_tilemap,0);
|
||||
tilemap_set_transparent_pen(tx_tilemap,0);
|
||||
tilemap_set_transparent_pen(state->fg_tilemap, 0);
|
||||
tilemap_set_transparent_pen(state->tx_tilemap, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -115,56 +126,58 @@ VIDEO_START( deniam )
|
||||
|
||||
WRITE16_HANDLER( deniam_videoram_w )
|
||||
{
|
||||
int page,i;
|
||||
COMBINE_DATA(&deniam_videoram[offset]);
|
||||
deniam_state *state = (deniam_state *)space->machine->driver_data;
|
||||
int page, i;
|
||||
COMBINE_DATA(&state->videoram[offset]);
|
||||
|
||||
page = offset >> 11;
|
||||
for (i = 0;i < 4;i++)
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (bg_page[i] == page)
|
||||
tilemap_mark_tile_dirty(bg_tilemap,i * 0x800 + (offset & 0x7ff));
|
||||
if (fg_page[i] == page)
|
||||
tilemap_mark_tile_dirty(fg_tilemap,i * 0x800 + (offset & 0x7ff));
|
||||
if (state->bg_page[i] == page)
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, i * 0x800 + (offset & 0x7ff));
|
||||
if (state->fg_page[i] == page)
|
||||
tilemap_mark_tile_dirty(state->fg_tilemap, i * 0x800 + (offset & 0x7ff));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WRITE16_HANDLER( deniam_textram_w )
|
||||
{
|
||||
COMBINE_DATA(&deniam_textram[offset]);
|
||||
tilemap_mark_tile_dirty(tx_tilemap,offset);
|
||||
deniam_state *state = (deniam_state *)space->machine->driver_data;
|
||||
COMBINE_DATA(&state->textram[offset]);
|
||||
tilemap_mark_tile_dirty(state->tx_tilemap, offset);
|
||||
}
|
||||
|
||||
|
||||
WRITE16_HANDLER( deniam_palette_w )
|
||||
{
|
||||
int r,g,b;
|
||||
deniam_state *state = (deniam_state *)space->machine->driver_data;
|
||||
int r, g, b;
|
||||
|
||||
data = COMBINE_DATA(&paletteram16[offset]);
|
||||
data = COMBINE_DATA(&state->paletteram[offset]);
|
||||
|
||||
r = ((data << 1) & 0x1e) | ((data >> 12) & 0x01);
|
||||
g = ((data >> 3) & 0x1e) | ((data >> 13) & 0x01);
|
||||
b = ((data >> 7) & 0x1e) | ((data >> 14) & 0x01);
|
||||
palette_set_color_rgb(space->machine,offset,pal5bit(r),pal5bit(g),pal5bit(b));
|
||||
palette_set_color_rgb(space->machine, offset, pal5bit(r), pal5bit(g), pal5bit(b));
|
||||
}
|
||||
|
||||
|
||||
static UINT16 coinctrl;
|
||||
|
||||
READ16_HANDLER( deniam_coinctrl_r )
|
||||
{
|
||||
return coinctrl;
|
||||
deniam_state *state = (deniam_state *)space->machine->driver_data;
|
||||
return state->coinctrl;
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( deniam_coinctrl_w )
|
||||
{
|
||||
COMBINE_DATA(&coinctrl);
|
||||
deniam_state *state = (deniam_state *)space->machine->driver_data;
|
||||
COMBINE_DATA(&state->coinctrl);
|
||||
|
||||
/* bit 0 is coin counter */
|
||||
coin_counter_w(0,coinctrl & 0x01);
|
||||
coin_counter_w(0, state->coinctrl & 0x01);
|
||||
|
||||
/* bit 6 is display enable (0 freezes screen) */
|
||||
display_enable = coinctrl & 0x20;
|
||||
state->display_enable = state->coinctrl & 0x20;
|
||||
|
||||
/* other bits unknown (unused?) */
|
||||
}
|
||||
@ -201,46 +214,47 @@ WRITE16_HANDLER( deniam_coinctrl_w )
|
||||
* c | ---------------- | zoomy like in System 16?
|
||||
* e | ---------------- |
|
||||
*/
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
deniam_state *state = (deniam_state *)machine->driver_data;
|
||||
int offs;
|
||||
UINT8 *gfx = memory_region(machine, "gfx2");
|
||||
|
||||
for (offs = spriteram_size/2-8;offs >= 0;offs -= 8)
|
||||
for (offs = spriteram_size / 2 - 8; offs >= 0; offs -= 8)
|
||||
{
|
||||
int sx,starty,endy,x,y,start,color,width,flipx,primask;
|
||||
int sx, starty, endy, x, y, start, color, width, flipx, primask;
|
||||
UINT8 *rom = gfx;
|
||||
|
||||
sx = (spriteram16[offs+1] & 0x01ff) + 16*8 - 1;
|
||||
sx = (state->spriteram[offs + 1] & 0x01ff) + 16 * 8 - 1;
|
||||
if (sx >= 512) sx -= 512;
|
||||
starty = spriteram16[offs+0] & 0xff;
|
||||
endy = spriteram16[offs+0] >> 8;
|
||||
starty = state->spriteram[offs + 0] & 0xff;
|
||||
endy = state->spriteram[offs + 0] >> 8;
|
||||
|
||||
width = spriteram16[offs+2] & 0x007f;
|
||||
flipx = spriteram16[offs+2] & 0x0100;
|
||||
width = state->spriteram[offs + 2] & 0x007f;
|
||||
flipx = state->spriteram[offs + 2] & 0x0100;
|
||||
if (flipx) sx++;
|
||||
|
||||
color = 0x40 + (spriteram16[offs+4] & 0x3f);
|
||||
color = 0x40 + (state->spriteram[offs + 4] & 0x3f);
|
||||
|
||||
primask = 8;
|
||||
switch (spriteram16[offs+4] & 0xc0)
|
||||
switch (state->spriteram[offs + 4] & 0xc0)
|
||||
{
|
||||
case 0x00: primask |= 4|2|1; break; /* below everything */
|
||||
case 0x40: primask |= 4|2; break; /* below fg and tx */
|
||||
case 0x80: primask |= 4; break; /* below tx */
|
||||
case 0xc0: break; /* above everything */
|
||||
case 0x00: primask |= 4 | 2 | 1; break; /* below everything */
|
||||
case 0x40: primask |= 4 | 2; break; /* below fg and tx */
|
||||
case 0x80: primask |= 4; break; /* below tx */
|
||||
case 0xc0: break; /* above everything */
|
||||
}
|
||||
|
||||
|
||||
start = spriteram16[offs+3] + ((spriteram16[offs+4] & 0x1f00) << 8);
|
||||
rom += 2*start;
|
||||
start = state->spriteram[offs + 3] + ((state->spriteram[offs + 4] & 0x1f00) << 8);
|
||||
rom += 2 * start;
|
||||
|
||||
for (y = starty+1;y <= endy;y++)
|
||||
for (y = starty + 1; y <= endy; y++)
|
||||
{
|
||||
int drawing = 0;
|
||||
int i=0;
|
||||
int i = 0;
|
||||
|
||||
rom += 2*width; /* note that the first line is skipped */
|
||||
rom += 2 * width; /* note that the first line is skipped */
|
||||
x = 0;
|
||||
while (i < 512) /* safety check */
|
||||
{
|
||||
@ -255,12 +269,12 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
{
|
||||
if (rom[i] & 0x0f)
|
||||
{
|
||||
if (sx+x >= cliprect->min_x && sx+x <= cliprect->max_x &&
|
||||
if (sx + x >= cliprect->min_x && sx + x <= cliprect->max_x &&
|
||||
y >= cliprect->min_y && y <= cliprect->max_y)
|
||||
{
|
||||
if ((*BITMAP_ADDR8(machine->priority_bitmap, y, sx+x) & primask) == 0)
|
||||
*BITMAP_ADDR16(bitmap, y, sx+x) = color*16+(rom[i]&0x0f);
|
||||
*BITMAP_ADDR8(machine->priority_bitmap, y, sx+x) = 8;
|
||||
if ((*BITMAP_ADDR8(machine->priority_bitmap, y, sx + x) & primask) == 0)
|
||||
*BITMAP_ADDR16(bitmap, y, sx + x) = color * 16 + (rom[i] & 0x0f);
|
||||
*BITMAP_ADDR8(machine->priority_bitmap, y, sx + x) = 8;
|
||||
}
|
||||
}
|
||||
x++;
|
||||
@ -275,12 +289,12 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
{
|
||||
if (rom[i] & 0xf0)
|
||||
{
|
||||
if (sx+x >= cliprect->min_x && sx+x <= cliprect->max_x &&
|
||||
if (sx + x >= cliprect->min_x && sx + x <= cliprect->max_x &&
|
||||
y >= cliprect->min_y && y <= cliprect->max_y)
|
||||
{
|
||||
if ((*BITMAP_ADDR8(machine->priority_bitmap, y, sx+x) & primask) == 0)
|
||||
*BITMAP_ADDR16(bitmap, y, sx+x) = color*16+(rom[i]>>4);
|
||||
*BITMAP_ADDR8(machine->priority_bitmap, y, sx+x) = 8;
|
||||
if ((*BITMAP_ADDR8(machine->priority_bitmap, y, sx + x) & primask) == 0)
|
||||
*BITMAP_ADDR16(bitmap, y, sx + x) = color * 16+(rom[i] >> 4);
|
||||
*BITMAP_ADDR8(machine->priority_bitmap, y, sx + x) = 8;
|
||||
}
|
||||
}
|
||||
x++;
|
||||
@ -299,12 +313,12 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
{
|
||||
if (rom[i] & 0xf0)
|
||||
{
|
||||
if (sx+x >= cliprect->min_x && sx+x <= cliprect->max_x &&
|
||||
if (sx + x >= cliprect->min_x && sx + x <= cliprect->max_x &&
|
||||
y >= cliprect->min_y && y <= cliprect->max_y)
|
||||
{
|
||||
if ((*BITMAP_ADDR8(machine->priority_bitmap, y, sx+x) & primask) == 0)
|
||||
*BITMAP_ADDR16(bitmap, y, sx+x) = color*16+(rom[i]>>4);
|
||||
*BITMAP_ADDR8(machine->priority_bitmap, y, sx+x) = 8;
|
||||
if ((*BITMAP_ADDR8(machine->priority_bitmap, y, sx + x) & primask) == 0)
|
||||
*BITMAP_ADDR16(bitmap, y, sx + x) = color * 16 + (rom[i] >> 4);
|
||||
*BITMAP_ADDR8(machine->priority_bitmap, y, sx + x) = 8;
|
||||
}
|
||||
}
|
||||
x++;
|
||||
@ -319,12 +333,12 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
{
|
||||
if (rom[i] & 0x0f)
|
||||
{
|
||||
if (sx+x >= cliprect->min_x && sx+x <= cliprect->max_x &&
|
||||
if (sx + x >= cliprect->min_x && sx + x <= cliprect->max_x &&
|
||||
y >= cliprect->min_y && y <= cliprect->max_y)
|
||||
{
|
||||
if ((*BITMAP_ADDR8(machine->priority_bitmap, y, sx+x) & primask) == 0)
|
||||
*BITMAP_ADDR16(bitmap, y, sx+x) = color*16+(rom[i]&0x0f);
|
||||
*BITMAP_ADDR8(machine->priority_bitmap, y, sx+x) = 8;
|
||||
if ((*BITMAP_ADDR8(machine->priority_bitmap, y, sx + x) & primask) == 0)
|
||||
*BITMAP_ADDR16(bitmap, y, sx + x) = color * 16 + (rom[i] & 0x0f);
|
||||
*BITMAP_ADDR8(machine->priority_bitmap, y, sx + x) = 8;
|
||||
}
|
||||
}
|
||||
x++;
|
||||
@ -337,65 +351,68 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
}
|
||||
}
|
||||
|
||||
static void set_bg_page(int page,int value)
|
||||
static void set_bg_page( running_machine *machine, int page, int value )
|
||||
{
|
||||
deniam_state *state = (deniam_state *)machine->driver_data;
|
||||
int tile_index;
|
||||
|
||||
if (bg_page[page] != value)
|
||||
if (state->bg_page[page] != value)
|
||||
{
|
||||
bg_page[page] = value;
|
||||
for (tile_index = page * 0x800;tile_index < (page+1)*0x800;tile_index++)
|
||||
tilemap_mark_tile_dirty(bg_tilemap,tile_index);
|
||||
state->bg_page[page] = value;
|
||||
for (tile_index = page * 0x800; tile_index < (page + 1) * 0x800; tile_index++)
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, tile_index);
|
||||
}
|
||||
}
|
||||
|
||||
static void set_fg_page(int page,int value)
|
||||
static void set_fg_page( running_machine *machine, int page, int value )
|
||||
{
|
||||
deniam_state *state = (deniam_state *)machine->driver_data;
|
||||
int tile_index;
|
||||
|
||||
if (fg_page[page] != value)
|
||||
if (state->fg_page[page] != value)
|
||||
{
|
||||
fg_page[page] = value;
|
||||
for (tile_index = page * 0x800;tile_index < (page+1)*0x800;tile_index++)
|
||||
tilemap_mark_tile_dirty(fg_tilemap,tile_index);
|
||||
state->fg_page[page] = value;
|
||||
for (tile_index = page * 0x800; tile_index < (page + 1) * 0x800; tile_index++)
|
||||
tilemap_mark_tile_dirty(state->fg_tilemap, tile_index);
|
||||
}
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( deniam )
|
||||
{
|
||||
int bg_scrollx,bg_scrolly,fg_scrollx,fg_scrolly;
|
||||
deniam_state *state = (deniam_state *)screen->machine->driver_data;
|
||||
int bg_scrollx, bg_scrolly, fg_scrollx, fg_scrolly;
|
||||
int page;
|
||||
|
||||
if (!state->display_enable)
|
||||
return 0; /* don't update (freeze display) */
|
||||
|
||||
if (!display_enable) return 0; /* don't update (freeze display) */
|
||||
bg_scrollx = state->textram[state->bg_scrollx_reg] - state->bg_scrollx_offs;
|
||||
bg_scrolly = (state->textram[state->bg_scrolly_reg] & 0xff) - state->bg_scrolly_offs;
|
||||
page = state->textram[state->bg_page_reg];
|
||||
set_bg_page(screen->machine, 3, (page >>12) & 0x0f);
|
||||
set_bg_page(screen->machine, 2, (page >> 8) & 0x0f);
|
||||
set_bg_page(screen->machine, 1, (page >> 4) & 0x0f);
|
||||
set_bg_page(screen->machine, 0, (page >> 0) & 0x0f);
|
||||
|
||||
bg_scrollx = deniam_textram[bg_scrollx_reg] - bg_scrollx_offs;
|
||||
bg_scrolly = (deniam_textram[bg_scrolly_reg] & 0xff) - bg_scrolly_offs;
|
||||
page = deniam_textram[bg_page_reg];
|
||||
set_bg_page(3,(page >>12) & 0x0f);
|
||||
set_bg_page(2,(page >> 8) & 0x0f);
|
||||
set_bg_page(1,(page >> 4) & 0x0f);
|
||||
set_bg_page(0,(page >> 0) & 0x0f);
|
||||
fg_scrollx = state->textram[state->fg_scrollx_reg] - state->fg_scrollx_offs;
|
||||
fg_scrolly = (state->textram[state->fg_scrolly_reg] & 0xff) - state->fg_scrolly_offs;
|
||||
page = state->textram[state->fg_page_reg];
|
||||
set_fg_page(screen->machine, 3, (page >>12) & 0x0f);
|
||||
set_fg_page(screen->machine, 2, (page >> 8) & 0x0f);
|
||||
set_fg_page(screen->machine, 1, (page >> 4) & 0x0f);
|
||||
set_fg_page(screen->machine, 0, (page >> 0) & 0x0f);
|
||||
|
||||
fg_scrollx = deniam_textram[fg_scrollx_reg] - fg_scrollx_offs;
|
||||
fg_scrolly = (deniam_textram[fg_scrolly_reg] & 0xff) - fg_scrolly_offs;
|
||||
page = deniam_textram[fg_page_reg];
|
||||
set_fg_page(3,(page >>12) & 0x0f);
|
||||
set_fg_page(2,(page >> 8) & 0x0f);
|
||||
set_fg_page(1,(page >> 4) & 0x0f);
|
||||
set_fg_page(0,(page >> 0) & 0x0f);
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, bg_scrollx & 0x1ff);
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, bg_scrolly & 0x0ff);
|
||||
tilemap_set_scrollx(state->fg_tilemap, 0, fg_scrollx & 0x1ff);
|
||||
tilemap_set_scrolly(state->fg_tilemap, 0, fg_scrolly & 0x0ff);
|
||||
|
||||
tilemap_set_scrollx(bg_tilemap,0,bg_scrollx & 0x1ff);
|
||||
tilemap_set_scrolly(bg_tilemap,0,bg_scrolly & 0x0ff);
|
||||
tilemap_set_scrollx(fg_tilemap,0,fg_scrollx & 0x1ff);
|
||||
tilemap_set_scrolly(fg_tilemap,0,fg_scrolly & 0x0ff);
|
||||
bitmap_fill(screen->machine->priority_bitmap, cliprect, 0);
|
||||
|
||||
bitmap_fill(screen->machine->priority_bitmap,cliprect,0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 1);
|
||||
tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 2);
|
||||
tilemap_draw(bitmap, cliprect, state->tx_tilemap, 0, 4);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,1);
|
||||
tilemap_draw(bitmap,cliprect,fg_tilemap,0,2);
|
||||
tilemap_draw(bitmap,cliprect,tx_tilemap,0,4);
|
||||
|
||||
draw_sprites(screen->machine,bitmap,cliprect);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,53 +0,0 @@
|
||||
/* Diver Boy - Video Hardware */
|
||||
|
||||
#include "driver.h"
|
||||
|
||||
UINT16 *diverboy_spriteram;
|
||||
size_t diverboy_spriteram_size;
|
||||
|
||||
|
||||
VIDEO_START(diverboy)
|
||||
{
|
||||
}
|
||||
|
||||
static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
UINT16 *source = diverboy_spriteram;
|
||||
UINT16 *finish = source + (diverboy_spriteram_size/2);
|
||||
|
||||
while (source < finish)
|
||||
{
|
||||
INT16 xpos,ypos,number,colr,bank,flash;
|
||||
|
||||
ypos = source[4];
|
||||
xpos = source[0];
|
||||
colr = (source[1]& 0x00f0) >> 4;
|
||||
number = source[3];
|
||||
flash = source[1] & 0x1000;
|
||||
|
||||
colr |= ((source[1] & 0x000c) << 2);
|
||||
|
||||
ypos = 0x100 - ypos;
|
||||
|
||||
bank = (source[1]&0x0002) >> 1;
|
||||
|
||||
if (!flash || (video_screen_get_frame_number(machine->primary_screen) & 1))
|
||||
{
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[bank],
|
||||
number,
|
||||
colr,
|
||||
0,0,
|
||||
xpos,ypos,
|
||||
(source[1] & 0x0008) ? -1 : 0);
|
||||
}
|
||||
|
||||
source+=8;
|
||||
}
|
||||
}
|
||||
|
||||
VIDEO_UPDATE(diverboy)
|
||||
{
|
||||
// bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine));
|
||||
draw_sprites(screen->machine,bitmap,cliprect);
|
||||
return 0;
|
||||
}
|
@ -7,25 +7,18 @@ Atari Drag Race video emulation
|
||||
#include "driver.h"
|
||||
#include "includes/dragrace.h"
|
||||
|
||||
UINT8* dragrace_playfield_ram;
|
||||
UINT8* dragrace_position_ram;
|
||||
|
||||
static tilemap* bg_tilemap;
|
||||
|
||||
|
||||
static TILE_GET_INFO( get_tile_info )
|
||||
{
|
||||
UINT8 code = dragrace_playfield_ram[tile_index];
|
||||
|
||||
dragrace_state *state = (dragrace_state *)machine->driver_data;
|
||||
UINT8 code = state->playfield_ram[tile_index];
|
||||
int num = 0;
|
||||
int col = 0;
|
||||
|
||||
num = code & 0x1f;
|
||||
|
||||
if ((code & 0xc0) == 0x40)
|
||||
{
|
||||
num |= 0x20;
|
||||
}
|
||||
|
||||
switch (code & 0xA0)
|
||||
{
|
||||
@ -49,33 +42,34 @@ static TILE_GET_INFO( get_tile_info )
|
||||
|
||||
VIDEO_START( dragrace )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine,
|
||||
get_tile_info, tilemap_scan_rows, 16, 16, 16, 16);
|
||||
dragrace_state *state = (dragrace_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_rows, 16, 16, 16, 16);
|
||||
}
|
||||
|
||||
|
||||
VIDEO_UPDATE( dragrace )
|
||||
{
|
||||
dragrace_state *state = (dragrace_state *)screen->machine->driver_data;
|
||||
int y;
|
||||
|
||||
tilemap_mark_all_tiles_dirty(bg_tilemap);
|
||||
tilemap_mark_all_tiles_dirty(state->bg_tilemap);
|
||||
|
||||
for (y = 0; y < 256; y += 4)
|
||||
{
|
||||
rectangle rect = *cliprect;
|
||||
|
||||
int xl = dragrace_position_ram[y + 0] & 15;
|
||||
int xh = dragrace_position_ram[y + 1] & 15;
|
||||
int yl = dragrace_position_ram[y + 2] & 15;
|
||||
int yh = dragrace_position_ram[y + 3] & 15;
|
||||
int xl = state->position_ram[y + 0] & 15;
|
||||
int xh = state->position_ram[y + 1] & 15;
|
||||
int yl = state->position_ram[y + 2] & 15;
|
||||
int yh = state->position_ram[y + 3] & 15;
|
||||
|
||||
tilemap_set_scrollx(bg_tilemap, 0, 16 * xh + xl - 8);
|
||||
tilemap_set_scrolly(bg_tilemap, 0, 16 * yh + yl);
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, 16 * xh + xl - 8);
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, 16 * yh + yl);
|
||||
|
||||
if (rect.min_y < y + 0) rect.min_y = y + 0;
|
||||
if (rect.max_y > y + 3) rect.max_y = y + 3;
|
||||
|
||||
tilemap_draw(bitmap, &rect, bg_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap, &rect, state->bg_tilemap, 0, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ PALETTE_INIT( dribling )
|
||||
g *= 0x55;
|
||||
b *= 0xff;
|
||||
|
||||
palette_set_color(machine,i,MAKE_RGB(r,g,b));
|
||||
palette_set_color(machine, i, MAKE_RGB(r,g,b));
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,8 +44,10 @@ PALETTE_INIT( dribling )
|
||||
|
||||
WRITE8_HANDLER( dribling_colorram_w )
|
||||
{
|
||||
dribling_state *state = (dribling_state *)space->machine->driver_data;
|
||||
|
||||
/* it is very important that we mask off the two bits here */
|
||||
colorram[offset & 0x1f9f] = data;
|
||||
state->colorram[offset & 0x1f9f] = data;
|
||||
}
|
||||
|
||||
|
||||
@ -58,6 +60,7 @@ WRITE8_HANDLER( dribling_colorram_w )
|
||||
|
||||
VIDEO_UPDATE( dribling )
|
||||
{
|
||||
dribling_state *state = (dribling_state *)screen->machine->driver_data;
|
||||
UINT8 *prombase = memory_region(screen->machine, "proms");
|
||||
UINT8 *gfxbase = memory_region(screen->machine, "gfx1");
|
||||
int x, y;
|
||||
@ -71,11 +74,11 @@ VIDEO_UPDATE( dribling )
|
||||
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
|
||||
{
|
||||
int b7 = prombase[(x >> 3) | ((y >> 3) << 5)] & 1;
|
||||
int b6 = dribling_abca;
|
||||
int b6 = state->abca;
|
||||
int b5 = (x >> 3) & 1;
|
||||
int b4 = (gfxbase[(x >> 3) | (y << 5)] >> (x & 7)) & 1;
|
||||
int b3 = (videoram[(x >> 3) | (y << 5)] >> (x & 7)) & 1;
|
||||
int b2_0 = colorram[(x >> 3) | ((y >> 2) << 7)] & 7;
|
||||
int b3 = (state->videoram[(x >> 3) | (y << 5)] >> (x & 7)) & 1;
|
||||
int b2_0 = state->colorram[(x >> 3) | ((y >> 2) << 7)] & 7;
|
||||
|
||||
/* assemble the various bits into a palette PROM index */
|
||||
dst[x] = (b7 << 7) | (b6 << 6) | (b5 << 5) | (b4 << 4) | (b3 << 3) | b2_0;
|
||||
|
@ -8,29 +8,20 @@ Video hardware
|
||||
*******************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "drmicro.h"
|
||||
|
||||
static int flipscreen;
|
||||
|
||||
static UINT8 *drmicro_videoram;
|
||||
static tilemap *drmicro_bg1;
|
||||
static tilemap *drmicro_bg2;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void drmicro_flip_w( running_machine *machine, int flip )
|
||||
{
|
||||
flipscreen = flip ? 1 : 0;
|
||||
flip_screen_set(machine, flip);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( drmicro_videoram_w )
|
||||
{
|
||||
drmicro_videoram[offset] = data;
|
||||
drmicro_state *state = (drmicro_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data;
|
||||
|
||||
if (offset<0x800)
|
||||
tilemap_mark_tile_dirty(drmicro_bg2,(offset & 0x3ff));
|
||||
if (offset < 0x800)
|
||||
tilemap_mark_tile_dirty(state->bg2, (offset & 0x3ff));
|
||||
else
|
||||
tilemap_mark_tile_dirty(drmicro_bg1,(offset & 0x3ff));
|
||||
tilemap_mark_tile_dirty(state->bg1, (offset & 0x3ff));
|
||||
}
|
||||
|
||||
|
||||
@ -38,10 +29,11 @@ WRITE8_HANDLER( drmicro_videoram_w )
|
||||
|
||||
static TILE_GET_INFO( get_bg1_tile_info )
|
||||
{
|
||||
int code,col,flags;
|
||||
drmicro_state *state = (drmicro_state *)machine->driver_data;
|
||||
int code, col, flags;
|
||||
|
||||
code = drmicro_videoram[tile_index + 0x0800];
|
||||
col = drmicro_videoram[tile_index + 0x0c00];
|
||||
code = state->videoram[tile_index + 0x0800];
|
||||
col = state->videoram[tile_index + 0x0c00];
|
||||
|
||||
code += (col & 0xc0) << 2;
|
||||
flags = ((col & 0x20) ? TILEMAP_FLIPY : 0) | ((col & 0x10) ? TILEMAP_FLIPX : 0);
|
||||
@ -52,10 +44,11 @@ static TILE_GET_INFO( get_bg1_tile_info )
|
||||
|
||||
static TILE_GET_INFO( get_bg2_tile_info )
|
||||
{
|
||||
int code,col,flags;
|
||||
drmicro_state *state = (drmicro_state *)machine->driver_data;
|
||||
int code, col, flags;
|
||||
|
||||
code = drmicro_videoram[tile_index + 0x0000];
|
||||
col = drmicro_videoram[tile_index + 0x0400];
|
||||
code = state->videoram[tile_index + 0x0000];
|
||||
col = state->videoram[tile_index + 0x0400];
|
||||
|
||||
code += (col & 0xc0) << 2;
|
||||
flags = ((col & 0x20) ? TILEMAP_FLIPY : 0) | ((col & 0x10) ? TILEMAP_FLIPX : 0);
|
||||
@ -112,47 +105,50 @@ PALETTE_INIT( drmicro )
|
||||
|
||||
VIDEO_START( drmicro)
|
||||
{
|
||||
drmicro_videoram = auto_alloc_array(machine, UINT8, 0x1000);
|
||||
drmicro_state *state = (drmicro_state *)machine->driver_data;
|
||||
|
||||
drmicro_bg1 = tilemap_create(machine, get_bg1_tile_info, tilemap_scan_rows, 8,8,32,32);
|
||||
drmicro_bg2 = tilemap_create(machine, get_bg2_tile_info, tilemap_scan_rows, 8,8,32,32);
|
||||
state->videoram = auto_alloc_array(machine, UINT8, 0x1000);
|
||||
state_save_register_global_pointer(machine, state->videoram, 0x1000);
|
||||
|
||||
tilemap_set_transparent_pen(drmicro_bg2,0);
|
||||
state->bg1 = tilemap_create(machine, get_bg1_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
state->bg2 = tilemap_create(machine, get_bg2_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
|
||||
tilemap_set_transparent_pen(state->bg2, 0);
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( drmicro )
|
||||
{
|
||||
int offs,adr,g;
|
||||
int chr,col,attr;
|
||||
int x,y,fx,fy;
|
||||
drmicro_state *state = (drmicro_state *)screen->machine->driver_data;
|
||||
int offs, adr, g;
|
||||
int chr, col, attr;
|
||||
int x, y, fx, fy;
|
||||
|
||||
tilemap_draw(bitmap, cliprect, drmicro_bg1, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, drmicro_bg2, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg1, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg2, 0, 0);
|
||||
|
||||
/* draw sprites */
|
||||
|
||||
for (g=0;g<2;g++)
|
||||
for (g = 0; g < 2; g++)
|
||||
{
|
||||
adr = 0x800*g;
|
||||
adr = 0x800 * g;
|
||||
|
||||
for (offs=0x00; offs<0x20; offs +=4)
|
||||
for (offs = 0x00; offs < 0x20; offs += 4)
|
||||
{
|
||||
x = drmicro_videoram[offs + adr + 3];
|
||||
y = drmicro_videoram[offs + adr + 0];
|
||||
attr = drmicro_videoram[offs + adr + 2];
|
||||
chr = drmicro_videoram[offs + adr + 1];
|
||||
x = state->videoram[offs + adr + 3];
|
||||
y = state->videoram[offs + adr + 0];
|
||||
attr = state->videoram[offs + adr + 2];
|
||||
chr = state->videoram[offs + adr + 1];
|
||||
|
||||
fx = (chr & 0x01) ^ flipscreen;
|
||||
fy = ((chr & 0x02) >> 1) ^ flipscreen;
|
||||
fx = (chr & 0x01) ^ state->flipscreen;
|
||||
fy = ((chr & 0x02) >> 1) ^ state->flipscreen;
|
||||
|
||||
chr = (chr >> 2) | (attr & 0xc0);
|
||||
chr = (chr >> 2) | (attr & 0xc0);
|
||||
|
||||
col = (attr & 0x0f) + 0x00;
|
||||
|
||||
if (!flipscreen)
|
||||
y = (240-y) & 0xff;
|
||||
if (!state->flipscreen)
|
||||
y = (240 - y) & 0xff;
|
||||
else
|
||||
x = (240-x) & 0xff;
|
||||
x = (240 - x) & 0xff;
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[3-g],
|
||||
chr,
|
||||
@ -160,7 +156,7 @@ VIDEO_UPDATE( drmicro )
|
||||
fx,fy,
|
||||
x,y,0);
|
||||
|
||||
if (x>240)
|
||||
if (x > 240)
|
||||
{
|
||||
drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[3-g],
|
||||
chr,
|
||||
@ -172,4 +168,3 @@ VIDEO_UPDATE( drmicro )
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user