mirror of
https://github.com/holub/mame
synced 2025-05-29 00:53:09 +03:00
Not worth credit: added as complete as possible driver data struct to 1945kiii.c, actfancr.c, aquarium.c and ccastles.c.
some palette/sprite/nvram regions require generic handlers, and are commented out
This commit is contained in:
parent
3045188af1
commit
db53fd5203
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -2294,6 +2294,7 @@ src/mame/includes/1943.h svneol=native#text/plain
|
||||
src/mame/includes/20pacgal.h svneol=native#text/plain
|
||||
src/mame/includes/4enraya.h svneol=native#text/plain
|
||||
src/mame/includes/8080bw.h svneol=native#text/plain
|
||||
src/mame/includes/actfancr.h svneol=native#text/plain
|
||||
src/mame/includes/aeroboto.h svneol=native#text/plain
|
||||
src/mame/includes/aerofgt.h svneol=native#text/plain
|
||||
src/mame/includes/ajax.h svneol=native#text/plain
|
||||
|
@ -59,37 +59,54 @@ There are no static local variables.
|
||||
|
||||
#define MASTER_CLOCK XTAL_16MHz
|
||||
|
||||
static UINT16* k3_spriteram_1;
|
||||
static UINT16* k3_spriteram_2;
|
||||
static UINT16* k3_bgram;
|
||||
static tilemap *k3_bg_tilemap;
|
||||
|
||||
typedef struct _k3_state k3_state;
|
||||
struct _k3_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT16 * spriteram_1;
|
||||
UINT16 * spriteram_2;
|
||||
UINT16 * bgram;
|
||||
// UINT16 * paletteram16; // currently this uses generic palette handling
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap;
|
||||
|
||||
/* devices */
|
||||
const device_config *oki1;
|
||||
const device_config *oki2;
|
||||
};
|
||||
|
||||
|
||||
static WRITE16_HANDLER( k3_bgram_w )
|
||||
{
|
||||
COMBINE_DATA(&k3_bgram[offset]);
|
||||
tilemap_mark_tile_dirty(k3_bg_tilemap,offset);
|
||||
k3_state *state = (k3_state *)space->machine->driver_data;
|
||||
COMBINE_DATA(&state->bgram[offset]);
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_k3_bg_tile_info )
|
||||
{
|
||||
int tileno;
|
||||
tileno = k3_bgram[tile_index];
|
||||
SET_TILE_INFO(1,tileno,0,0);
|
||||
k3_state *state = (k3_state *)machine->driver_data;
|
||||
int tileno = state->bgram[tile_index];
|
||||
SET_TILE_INFO(1, tileno, 0, 0);
|
||||
}
|
||||
|
||||
static VIDEO_START(k3)
|
||||
{
|
||||
k3_bg_tilemap = tilemap_create(machine, get_k3_bg_tile_info,tilemap_scan_rows,16, 16, 32,64);
|
||||
k3_state *state = (k3_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create(machine, get_k3_bg_tile_info, tilemap_scan_rows, 16, 16, 32, 64);
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
k3_state *state = (k3_state *)machine->driver_data;
|
||||
const gfx_element *gfx = machine->gfx[0];
|
||||
UINT16 *source = k3_spriteram_1;
|
||||
UINT16 *source2 = k3_spriteram_2;
|
||||
UINT16 *finish = source + 0x1000/2;
|
||||
UINT16 *source = state->spriteram_1;
|
||||
UINT16 *source2 = state->spriteram_2;
|
||||
UINT16 *finish = source + 0x1000 / 2;
|
||||
|
||||
while( source<finish )
|
||||
while (source < finish)
|
||||
{
|
||||
int xpos, ypos;
|
||||
int tileno;
|
||||
@ -97,41 +114,44 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
ypos = (source[0] & 0x00ff) >> 0;
|
||||
tileno = (source2[0] & 0x7ffe) >> 1;
|
||||
xpos |= (source2[0] & 0x0001) << 8;
|
||||
drawgfx_transpen(bitmap,cliprect,gfx, tileno,1,0,0,xpos,ypos,0);
|
||||
drawgfx_transpen(bitmap,cliprect,gfx, tileno,1,0,0,xpos,ypos-0x100,0); // wrap
|
||||
drawgfx_transpen(bitmap,cliprect,gfx, tileno,1,0,0,xpos-0x200,ypos,0); // wrap
|
||||
drawgfx_transpen(bitmap,cliprect,gfx, tileno,1,0,0,xpos-0x200,ypos-0x100,0); // wrap
|
||||
drawgfx_transpen(bitmap, cliprect, gfx, tileno, 1, 0, 0, xpos, ypos, 0);
|
||||
drawgfx_transpen(bitmap, cliprect, gfx, tileno, 1, 0, 0, xpos, ypos - 0x100, 0); // wrap
|
||||
drawgfx_transpen(bitmap, cliprect, gfx, tileno, 1, 0, 0, xpos - 0x200, ypos, 0); // wrap
|
||||
drawgfx_transpen(bitmap, cliprect, gfx, tileno, 1, 0, 0, xpos - 0x200, ypos - 0x100, 0); // wrap
|
||||
|
||||
source++;source2++;
|
||||
source++;
|
||||
source2++;
|
||||
}
|
||||
}
|
||||
|
||||
static VIDEO_UPDATE(k3)
|
||||
{
|
||||
tilemap_draw(bitmap,cliprect,k3_bg_tilemap,0,0);
|
||||
draw_sprites(screen->machine,bitmap,cliprect);
|
||||
k3_state *state = (k3_state *)screen->machine->driver_data;
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static WRITE16_HANDLER( k3_scrollx_w )
|
||||
{
|
||||
tilemap_set_scrollx( k3_bg_tilemap,0, data);
|
||||
k3_state *state = (k3_state *)space->machine->driver_data;
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, data);
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( k3_scrolly_w )
|
||||
{
|
||||
tilemap_set_scrolly( k3_bg_tilemap,0, data);
|
||||
k3_state *state = (k3_state *)space->machine->driver_data;
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, data);
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( k3_soundbanks_w )
|
||||
{
|
||||
okim6295_set_bank_base(devtag_get_device(space->machine, "oki1"), (data & 4) ? 0x40000 : 0);
|
||||
okim6295_set_bank_base(devtag_get_device(space->machine, "oki2"), (data & 2) ? 0x40000 : 0);
|
||||
k3_state *state = (k3_state *)space->machine->driver_data;
|
||||
okim6295_set_bank_base(state->oki1, (data & 4) ? 0x40000 : 0);
|
||||
okim6295_set_bank_base(state->oki2, (data & 2) ? 0x40000 : 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( k3_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x0009ce, 0x0009cf) AM_WRITENOP // bug in code? (clean up log)
|
||||
AM_RANGE(0x0009d2, 0x0009d3) AM_WRITENOP // bug in code? (clean up log)
|
||||
@ -139,9 +159,9 @@ static ADDRESS_MAP_START( k3_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x0fffff) AM_ROM // ROM
|
||||
AM_RANGE(0x100000, 0x10ffff) AM_RAM // Main Ram
|
||||
AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16) // palette
|
||||
AM_RANGE(0x240000, 0x240fff) AM_RAM AM_BASE(&k3_spriteram_1)
|
||||
AM_RANGE(0x280000, 0x280fff) AM_RAM AM_BASE(&k3_spriteram_2)
|
||||
AM_RANGE(0x2c0000, 0x2c0fff) AM_RAM_WRITE(k3_bgram_w) AM_BASE(&k3_bgram)
|
||||
AM_RANGE(0x240000, 0x240fff) AM_RAM AM_BASE_MEMBER(k3_state, spriteram_1)
|
||||
AM_RANGE(0x280000, 0x280fff) AM_RAM AM_BASE_MEMBER(k3_state, spriteram_2)
|
||||
AM_RANGE(0x2c0000, 0x2c0fff) AM_RAM_WRITE(k3_bgram_w) AM_BASE_MEMBER(k3_state, bgram)
|
||||
AM_RANGE(0x340000, 0x340001) AM_WRITE(k3_scrollx_w)
|
||||
AM_RANGE(0x380000, 0x380001) AM_WRITE(k3_scrolly_w)
|
||||
AM_RANGE(0x3c0000, 0x3c0001) AM_WRITE(k3_soundbanks_w)
|
||||
@ -179,7 +199,6 @@ static INPUT_PORTS_START( k3 )
|
||||
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START2 )
|
||||
PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Are these used at all? */
|
||||
|
||||
|
||||
PORT_START("DSW")
|
||||
PORT_DIPNAME( 0x007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3")
|
||||
PORT_DIPSETTING( 0x0002, DEF_STR( 5C_1C ) )
|
||||
@ -234,13 +253,26 @@ static GFXDECODE_START( 1945kiii )
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
static MACHINE_START( 1945kiii )
|
||||
{
|
||||
k3_state *state = (k3_state *)machine->driver_data;
|
||||
|
||||
state->oki1 = devtag_get_device(machine, "oki1");
|
||||
state->oki2 = devtag_get_device(machine, "oki2");
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( k3 )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(k3_state)
|
||||
|
||||
MDRV_CPU_ADD("maincpu", M68000, MASTER_CLOCK)
|
||||
MDRV_CPU_PROGRAM_MAP(k3_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", irq4_line_hold)
|
||||
|
||||
MDRV_GFXDECODE(1945kiii)
|
||||
MDRV_MACHINE_START(1945kiii)
|
||||
|
||||
MDRV_GFXDECODE(1945kiii)
|
||||
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
|
@ -28,33 +28,21 @@
|
||||
#include "sound/2203intf.h"
|
||||
#include "sound/3812intf.h"
|
||||
#include "sound/okim6295.h"
|
||||
#include "actfancr.h"
|
||||
|
||||
VIDEO_UPDATE( actfancr );
|
||||
VIDEO_UPDATE( triothep );
|
||||
WRITE8_HANDLER( actfancr_pf1_data_w );
|
||||
READ8_HANDLER( actfancr_pf1_data_r );
|
||||
WRITE8_HANDLER( actfancr_pf1_control_w );
|
||||
WRITE8_HANDLER( actfancr_pf2_data_w );
|
||||
READ8_HANDLER( actfancr_pf2_data_r );
|
||||
WRITE8_HANDLER( actfancr_pf2_control_w );
|
||||
VIDEO_START( actfancr );
|
||||
VIDEO_START( triothep );
|
||||
|
||||
extern UINT8 *actfancr_pf1_data,*actfancr_pf2_data,*actfancr_pf1_rowscroll_data;
|
||||
static UINT8 *actfancr_ram;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static int trio_control_select;
|
||||
|
||||
static WRITE8_HANDLER( triothep_control_select_w )
|
||||
{
|
||||
trio_control_select=data;
|
||||
actfancr_state *state = (actfancr_state *)space->machine->driver_data;
|
||||
state->trio_control_select = data;
|
||||
}
|
||||
|
||||
static READ8_HANDLER( triothep_control_r )
|
||||
{
|
||||
switch (trio_control_select)
|
||||
actfancr_state *state = (actfancr_state *)space->machine->driver_data;
|
||||
switch (state->trio_control_select)
|
||||
{
|
||||
case 0: return input_port_read(space->machine, "P1");
|
||||
case 1: return input_port_read(space->machine, "P2");
|
||||
@ -68,7 +56,7 @@ static READ8_HANDLER( triothep_control_r )
|
||||
|
||||
static WRITE8_HANDLER( actfancr_sound_w )
|
||||
{
|
||||
soundlatch_w(space,0,data & 0xff);
|
||||
soundlatch_w(space, 0, data & 0xff);
|
||||
cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
|
||||
@ -77,9 +65,9 @@ static WRITE8_HANDLER( actfancr_sound_w )
|
||||
static ADDRESS_MAP_START( actfan_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x000000, 0x02ffff) AM_ROM
|
||||
AM_RANGE(0x060000, 0x06001f) AM_WRITE(actfancr_pf1_control_w)
|
||||
AM_RANGE(0x062000, 0x063fff) AM_READWRITE(actfancr_pf1_data_r, actfancr_pf1_data_w) AM_BASE(&actfancr_pf1_data)
|
||||
AM_RANGE(0x062000, 0x063fff) AM_READWRITE(actfancr_pf1_data_r, actfancr_pf1_data_w) AM_BASE_MEMBER(actfancr_state, pf1_data)
|
||||
AM_RANGE(0x070000, 0x07001f) AM_WRITE(actfancr_pf2_control_w)
|
||||
AM_RANGE(0x072000, 0x0727ff) AM_READWRITE(actfancr_pf2_data_r, actfancr_pf2_data_w) AM_BASE(&actfancr_pf2_data)
|
||||
AM_RANGE(0x072000, 0x0727ff) AM_READWRITE(actfancr_pf2_data_r, actfancr_pf2_data_w) AM_BASE_MEMBER(actfancr_state, pf2_data)
|
||||
AM_RANGE(0x100000, 0x1007ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
|
||||
AM_RANGE(0x110000, 0x110001) AM_WRITE(buffer_spriteram_w)
|
||||
AM_RANGE(0x120000, 0x1205ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_le_w) AM_BASE(&paletteram)
|
||||
@ -89,23 +77,23 @@ static ADDRESS_MAP_START( actfan_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x130003, 0x130003) AM_READ_PORT("DSW2")
|
||||
AM_RANGE(0x140000, 0x140001) AM_READ_PORT("SYSTEM") /* VBL */
|
||||
AM_RANGE(0x150000, 0x150001) AM_WRITE(actfancr_sound_w)
|
||||
AM_RANGE(0x1f0000, 0x1f3fff) AM_RAM AM_BASE(&actfancr_ram) /* Main ram */
|
||||
AM_RANGE(0x1f0000, 0x1f3fff) AM_RAM AM_BASE_MEMBER(actfancr_state, main_ram) /* Main ram */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( triothep_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x000000, 0x03ffff) AM_ROM
|
||||
AM_RANGE(0x040000, 0x04001f) AM_WRITE(actfancr_pf2_control_w)
|
||||
AM_RANGE(0x044000, 0x045fff) AM_READWRITE(actfancr_pf2_data_r, actfancr_pf2_data_w) AM_BASE(&actfancr_pf2_data)
|
||||
AM_RANGE(0x044000, 0x045fff) AM_READWRITE(actfancr_pf2_data_r, actfancr_pf2_data_w) AM_BASE_MEMBER(actfancr_state, pf2_data)
|
||||
AM_RANGE(0x046400, 0x0467ff) AM_WRITENOP /* Pf2 rowscroll - is it used? */
|
||||
AM_RANGE(0x060000, 0x06001f) AM_WRITE(actfancr_pf1_control_w)
|
||||
AM_RANGE(0x064000, 0x0647ff) AM_READWRITE(actfancr_pf1_data_r, actfancr_pf1_data_w) AM_BASE(&actfancr_pf1_data)
|
||||
AM_RANGE(0x066400, 0x0667ff) AM_WRITEONLY AM_BASE(&actfancr_pf1_rowscroll_data)
|
||||
AM_RANGE(0x064000, 0x0647ff) AM_READWRITE(actfancr_pf1_data_r, actfancr_pf1_data_w) AM_BASE_MEMBER(actfancr_state, pf1_data)
|
||||
AM_RANGE(0x066400, 0x0667ff) AM_WRITEONLY AM_BASE_MEMBER(actfancr_state, pf1_rowscroll_data)
|
||||
AM_RANGE(0x100000, 0x100001) AM_WRITE(actfancr_sound_w)
|
||||
AM_RANGE(0x110000, 0x110001) AM_WRITE(buffer_spriteram_w)
|
||||
AM_RANGE(0x120000, 0x1207ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
|
||||
AM_RANGE(0x130000, 0x1305ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_le_w) AM_BASE(&paletteram)
|
||||
AM_RANGE(0x140000, 0x140001) AM_READNOP /* Value doesn't matter */
|
||||
AM_RANGE(0x1f0000, 0x1f3fff) AM_RAM AM_BASE(&actfancr_ram) /* Main ram */
|
||||
AM_RANGE(0x1f0000, 0x1f3fff) AM_RAM AM_BASE_MEMBER(actfancr_state, main_ram) /* Main ram */
|
||||
AM_RANGE(0x1ff000, 0x1ff001) AM_READWRITE(triothep_control_r, triothep_control_select_w)
|
||||
AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w)
|
||||
ADDRESS_MAP_END
|
||||
@ -288,13 +276,38 @@ static const ym3812_interface ym3812_config =
|
||||
|
||||
static MACHINE_START( triothep )
|
||||
{
|
||||
state_save_register_global(machine, trio_control_select);
|
||||
actfancr_state *state = (actfancr_state *)machine->driver_data;
|
||||
state_save_register_global(machine, state->trio_control_select);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( actfancr )
|
||||
{
|
||||
actfancr_state *state = (actfancr_state *)machine->driver_data;
|
||||
int i;
|
||||
|
||||
state->flipscreen = 0;
|
||||
for (i = 0; i < 0x20; i++)
|
||||
{
|
||||
state->control_1[i] = 0;
|
||||
state->control_2[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static MACHINE_RESET( triothep )
|
||||
{
|
||||
actfancr_state *state = (actfancr_state *)machine->driver_data;
|
||||
|
||||
MACHINE_RESET_CALL(actfancr);
|
||||
state->trio_control_select = 0;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static MACHINE_DRIVER_START( actfancr )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(actfancr_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu",H6280,21477200/3) /* Should be accurate */
|
||||
MDRV_CPU_PROGRAM_MAP(actfan_map)
|
||||
@ -303,6 +316,8 @@ static MACHINE_DRIVER_START( actfancr )
|
||||
MDRV_CPU_ADD("audiocpu",M6502, 1500000) /* Should be accurate */
|
||||
MDRV_CPU_PROGRAM_MAP(dec0_s_map)
|
||||
|
||||
MDRV_MACHINE_RESET(actfancr)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
|
||||
|
||||
@ -338,6 +353,9 @@ MACHINE_DRIVER_END
|
||||
|
||||
static MACHINE_DRIVER_START( triothep )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(actfancr_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu",H6280,XTAL_21_4772MHz/3) /* XIN=21.4772Mhz, verified on pcb */
|
||||
MDRV_CPU_PROGRAM_MAP(triothep_map)
|
||||
@ -346,7 +364,8 @@ static MACHINE_DRIVER_START( triothep )
|
||||
MDRV_CPU_ADD("audiocpu",M6502, XTAL_12MHz/8) /* verified on pcb */
|
||||
MDRV_CPU_PROGRAM_MAP(dec0_s_map)
|
||||
|
||||
MDRV_MACHINE_START(triothep)
|
||||
MDRV_MACHINE_START(triothep)
|
||||
MDRV_MACHINE_RESET(triothep)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
|
||||
@ -553,12 +572,15 @@ ROM_END
|
||||
|
||||
static READ8_HANDLER( cycle_r )
|
||||
{
|
||||
int pc=cpu_get_pc(space->cpu);
|
||||
int ret=actfancr_ram[0x26];
|
||||
actfancr_state *state = (actfancr_state *)space->machine->driver_data;
|
||||
int pc = cpu_get_pc(space->cpu);
|
||||
int ret = state->main_ram[0x26];
|
||||
|
||||
if (offset==1) return actfancr_ram[0x27];
|
||||
if (offset == 1)
|
||||
return state->main_ram[0x27];
|
||||
|
||||
if (pc==0xe29a && ret==0) {
|
||||
if (pc == 0xe29a && ret == 0)
|
||||
{
|
||||
cpu_spinuntil_int(space->cpu);
|
||||
return 1;
|
||||
}
|
||||
@ -568,12 +590,15 @@ static READ8_HANDLER( cycle_r )
|
||||
|
||||
static READ8_HANDLER( cyclej_r )
|
||||
{
|
||||
int pc=cpu_get_pc(space->cpu);
|
||||
int ret=actfancr_ram[0x26];
|
||||
actfancr_state *state = (actfancr_state *)space->machine->driver_data;
|
||||
int pc = cpu_get_pc(space->cpu);
|
||||
int ret = state->main_ram[0x26];
|
||||
|
||||
if (offset==1) return actfancr_ram[0x27];
|
||||
if (offset == 1)
|
||||
return state->main_ram[0x27];
|
||||
|
||||
if (pc==0xe2b1 && ret==0) {
|
||||
if (pc == 0xe2b1 && ret == 0)
|
||||
{
|
||||
cpu_spinuntil_int(space->cpu);
|
||||
return 1;
|
||||
}
|
||||
@ -592,7 +617,6 @@ static DRIVER_INIT( actfancj )
|
||||
}
|
||||
|
||||
|
||||
|
||||
GAME( 1989, actfancr, 0, actfancr, actfancr, actfancr, ROT0, "Data East Corporation", "Act-Fancer Cybernetick Hyper Weapon (World revision 2)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1989, actfancr1,actfancr, actfancr, actfancr, actfancr, ROT0, "Data East Corporation", "Act-Fancer Cybernetick Hyper Weapon (World revision 1)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1989, actfancrj,actfancr, actfancr, actfancr, actfancj, ROT0, "Data East Corporation", "Act-Fancer Cybernetick Hyper Weapon (Japan revision 1)", GAME_SUPPORTS_SAVE )
|
||||
|
@ -58,58 +58,52 @@ Stephh's notes (based on the game M68000 code and some tests) :
|
||||
|
||||
#define AQUARIUS_HACK 0
|
||||
|
||||
static int aquarium_snd_ack;
|
||||
|
||||
UINT16 *aquarium_scroll;
|
||||
//UINT16 *aquarium_priority;
|
||||
UINT16 *aquarium_txt_videoram;
|
||||
UINT16 *aquarium_mid_videoram;
|
||||
UINT16 *aquarium_bak_videoram;
|
||||
|
||||
#if AQUARIUS_HACK
|
||||
static MACHINE_RESET( aquarium )
|
||||
static MACHINE_RESET( aquarium_hack )
|
||||
{
|
||||
UINT16 *RAM = (UINT16 *)memory_region(machine, "maincpu");
|
||||
int data = input_port_read(machine, "FAKE");
|
||||
|
||||
/* Language : 0x0000 = Japanese - Other value = English */
|
||||
|
||||
RAM[0x000a5c/2] = data;
|
||||
RAM[0x000a5c / 2] = data;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
static READ16_HANDLER( aquarium_coins_r )
|
||||
{
|
||||
aquarium_state *state = (aquarium_state *)space->machine->driver_data;
|
||||
|
||||
int data;
|
||||
data = (input_port_read(space->machine, "SYSTEM") & 0x7fff);
|
||||
data |= aquarium_snd_ack;
|
||||
aquarium_snd_ack = 0;
|
||||
data |= state->aquarium_snd_ack;
|
||||
state->aquarium_snd_ack = 0;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( aquarium_snd_ack_w )
|
||||
{
|
||||
aquarium_snd_ack = 0x8000;
|
||||
aquarium_state *state = (aquarium_state *)space->machine->driver_data;
|
||||
state->aquarium_snd_ack = 0x8000;
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( aquarium_sound_w )
|
||||
{
|
||||
// popmessage("sound write %04x",data);
|
||||
|
||||
soundlatch_w(space,1,data&0xff);
|
||||
soundlatch_w(space, 1, data & 0xff);
|
||||
cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE );
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( aquarium_z80_bank_w )
|
||||
{
|
||||
int soundbank = ((data & 0x7) + 1) * 0x8000;
|
||||
UINT8 *Z80 = (UINT8 *)memory_region(space->machine, "audiocpu");
|
||||
|
||||
memory_set_bankptr(space->machine, 1, &Z80[soundbank + 0x10000]);
|
||||
memory_set_bank(space->machine, 1, data & 0x07);
|
||||
}
|
||||
|
||||
static UINT8 aquarium_snd_bitswap(UINT8 scrambled_data)
|
||||
static UINT8 aquarium_snd_bitswap( UINT8 scrambled_data )
|
||||
{
|
||||
UINT8 data = 0;
|
||||
|
||||
@ -127,13 +121,13 @@ static UINT8 aquarium_snd_bitswap(UINT8 scrambled_data)
|
||||
|
||||
static READ8_DEVICE_HANDLER( aquarium_oki_r )
|
||||
{
|
||||
return (aquarium_snd_bitswap(okim6295_r(device,0)) );
|
||||
return aquarium_snd_bitswap(okim6295_r(device, 0));
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( aquarium_oki_w )
|
||||
{
|
||||
logerror("%s:Writing %04x to the OKI M6295\n",cpuexec_describe_context(device->machine),aquarium_snd_bitswap(data));
|
||||
okim6295_w( device, 0, (aquarium_snd_bitswap(data)) );
|
||||
logerror("%s:Writing %04x to the OKI M6295\n", cpuexec_describe_context(device->machine), aquarium_snd_bitswap(data));
|
||||
okim6295_w(device, 0, (aquarium_snd_bitswap(data)));
|
||||
}
|
||||
|
||||
|
||||
@ -141,12 +135,12 @@ static WRITE8_DEVICE_HANDLER( aquarium_oki_w )
|
||||
|
||||
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x07ffff) AM_ROM
|
||||
AM_RANGE(0xc00000, 0xc00fff) AM_RAM_WRITE(aquarium_mid_videoram_w) AM_BASE(&aquarium_mid_videoram)
|
||||
AM_RANGE(0xc01000, 0xc01fff) AM_RAM_WRITE(aquarium_bak_videoram_w) AM_BASE(&aquarium_bak_videoram)
|
||||
AM_RANGE(0xc02000, 0xc03fff) AM_RAM_WRITE(aquarium_txt_videoram_w) AM_BASE(&aquarium_txt_videoram)
|
||||
AM_RANGE(0xc80000, 0xc81fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
|
||||
AM_RANGE(0xc00000, 0xc00fff) AM_RAM_WRITE(aquarium_mid_videoram_w) AM_BASE_MEMBER(aquarium_state, mid_videoram)
|
||||
AM_RANGE(0xc01000, 0xc01fff) AM_RAM_WRITE(aquarium_bak_videoram_w) AM_BASE_MEMBER(aquarium_state, bak_videoram)
|
||||
AM_RANGE(0xc02000, 0xc03fff) AM_RAM_WRITE(aquarium_txt_videoram_w) AM_BASE_MEMBER(aquarium_state, txt_videoram)
|
||||
AM_RANGE(0xc80000, 0xc81fff) AM_RAM AM_BASE_MEMBER(aquarium_state, spriteram) AM_SIZE(&spriteram_size)
|
||||
AM_RANGE(0xd00000, 0xd00fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16)
|
||||
AM_RANGE(0xd80014, 0xd8001f) AM_WRITEONLY AM_BASE(&aquarium_scroll)
|
||||
AM_RANGE(0xd80014, 0xd8001f) AM_WRITEONLY AM_BASE_MEMBER(aquarium_state, scroll)
|
||||
AM_RANGE(0xd80068, 0xd80069) AM_WRITENOP /* probably not used */
|
||||
AM_RANGE(0xd80080, 0xd80081) AM_READ_PORT("DSW")
|
||||
AM_RANGE(0xd80082, 0xd80083) AM_READNOP /* stored but not read back ? check code at 0x01f440 */
|
||||
@ -282,43 +276,45 @@ static const gfx_layout tilelayout =
|
||||
|
||||
static DRIVER_INIT( aquarium )
|
||||
{
|
||||
UINT8 *Z80 = memory_region(machine, "audiocpu");
|
||||
|
||||
/* The BG tiles are 5bpp, this rearranges the data from
|
||||
the roms containing the 1bpp data so we can decode it
|
||||
correctly */
|
||||
|
||||
UINT8 *DAT2 = memory_region(machine, "gfx1")+0x080000;
|
||||
UINT8 *DAT2 = memory_region(machine, "gfx1") + 0x080000;
|
||||
UINT8 *DAT = memory_region(machine, "user1");
|
||||
int len = 0x0200000;
|
||||
|
||||
for (len = 0 ; len < 0x020000 ; len ++ )
|
||||
for (len = 0; len < 0x020000; len++)
|
||||
{
|
||||
DAT2[len*4+1] = (DAT[len] & 0x80) << 0;
|
||||
DAT2[len*4+1] |= (DAT[len] & 0x40) >> 3;
|
||||
DAT2[len*4+0] = (DAT[len] & 0x20) << 2;
|
||||
DAT2[len*4+0] |= (DAT[len] & 0x10) >> 1;
|
||||
DAT2[len*4+3] = (DAT[len] & 0x08) << 4;
|
||||
DAT2[len*4+3] |= (DAT[len] & 0x04) << 1;
|
||||
DAT2[len*4+2] = (DAT[len] & 0x02) << 6;
|
||||
DAT2[len*4+2] |= (DAT[len] & 0x01) << 3;
|
||||
DAT2[len * 4 + 1] = (DAT[len] & 0x80) << 0;
|
||||
DAT2[len * 4 + 1] |= (DAT[len] & 0x40) >> 3;
|
||||
DAT2[len * 4 + 0] = (DAT[len] & 0x20) << 2;
|
||||
DAT2[len * 4 + 0] |= (DAT[len] & 0x10) >> 1;
|
||||
DAT2[len * 4 + 3] = (DAT[len] & 0x08) << 4;
|
||||
DAT2[len * 4 + 3] |= (DAT[len] & 0x04) << 1;
|
||||
DAT2[len * 4 + 2] = (DAT[len] & 0x02) << 6;
|
||||
DAT2[len * 4 + 2] |= (DAT[len] & 0x01) << 3;
|
||||
}
|
||||
|
||||
DAT2 = memory_region(machine, "gfx4")+0x080000;
|
||||
DAT2 = memory_region(machine, "gfx4") + 0x080000;
|
||||
DAT = memory_region(machine, "user2");
|
||||
|
||||
for (len = 0 ; len < 0x020000 ; len ++ )
|
||||
for (len = 0; len < 0x020000; len++)
|
||||
{
|
||||
DAT2[len*4+1] = (DAT[len] & 0x80) << 0;
|
||||
DAT2[len*4+1] |= (DAT[len] & 0x40) >> 3;
|
||||
DAT2[len*4+0] = (DAT[len] & 0x20) << 2;
|
||||
DAT2[len*4+0] |= (DAT[len] & 0x10) >> 1;
|
||||
DAT2[len*4+3] = (DAT[len] & 0x08) << 4;
|
||||
DAT2[len*4+3] |= (DAT[len] & 0x04) << 1;
|
||||
DAT2[len*4+2] = (DAT[len] & 0x02) << 6;
|
||||
DAT2[len*4+2] |= (DAT[len] & 0x01) << 3;
|
||||
DAT2[len * 4 + 1] = (DAT[len] & 0x80) << 0;
|
||||
DAT2[len * 4 + 1] |= (DAT[len] & 0x40) >> 3;
|
||||
DAT2[len * 4 + 0] = (DAT[len] & 0x20) << 2;
|
||||
DAT2[len * 4 + 0] |= (DAT[len] & 0x10) >> 1;
|
||||
DAT2[len * 4 + 3] = (DAT[len] & 0x08) << 4;
|
||||
DAT2[len * 4 + 3] |= (DAT[len] & 0x04) << 1;
|
||||
DAT2[len * 4 + 2] = (DAT[len] & 0x02) << 6;
|
||||
DAT2[len * 4 + 2] |= (DAT[len] & 0x01) << 3;
|
||||
}
|
||||
|
||||
/* reset the sound bank */
|
||||
aquarium_z80_bank_w(cputag_get_address_space(machine, "audiocpu", ADDRESS_SPACE_IO), 0, 0);
|
||||
/* configure and set up the sound bank */
|
||||
memory_configure_bank(machine, 1, 0, 7, &Z80[0x18000], 0x8000);
|
||||
memory_set_bank(machine, 1, 1);
|
||||
}
|
||||
|
||||
|
||||
@ -329,9 +325,9 @@ static GFXDECODE_START( aquarium )
|
||||
GFXDECODE_ENTRY( "gfx4", 0, char5bpplayout, 0x400, 32 )
|
||||
GFXDECODE_END
|
||||
|
||||
static void irq_handler(const device_config *device, int irq)
|
||||
static void irq_handler( const device_config *device, int irq )
|
||||
{
|
||||
cputag_set_input_line(device->machine, "audiocpu", 0 , irq ? ASSERT_LINE : CLEAR_LINE );
|
||||
cputag_set_input_line(device->machine, "audiocpu", 0 , irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static const ym2151_interface ym2151_config =
|
||||
@ -342,11 +338,25 @@ static const ym2151_interface ym2151_config =
|
||||
|
||||
static MACHINE_START( aquarium )
|
||||
{
|
||||
state_save_register_global(machine, aquarium_snd_ack);
|
||||
aquarium_state *state = (aquarium_state *)machine->driver_data;
|
||||
state_save_register_global(machine, state->aquarium_snd_ack);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( aquarium )
|
||||
{
|
||||
aquarium_state *state = (aquarium_state *)machine->driver_data;
|
||||
state->aquarium_snd_ack = 0;
|
||||
|
||||
#if AQUARIUS_HACK
|
||||
MACHINE_RESET_CALL(aquarium_hack);
|
||||
#endif
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( aquarium )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(aquarium_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M68000, 32000000/2)
|
||||
MDRV_CPU_PROGRAM_MAP(main_map)
|
||||
@ -356,10 +366,8 @@ static MACHINE_DRIVER_START( aquarium )
|
||||
MDRV_CPU_PROGRAM_MAP(snd_map)
|
||||
MDRV_CPU_IO_MAP(snd_portmap)
|
||||
|
||||
MDRV_MACHINE_START(aquarium)
|
||||
#if AQUARIUS_HACK
|
||||
MDRV_MACHINE_START(aquarium)
|
||||
MDRV_MACHINE_RESET(aquarium)
|
||||
#endif
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
|
@ -139,43 +139,37 @@
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static const UINT8 *syncprom;
|
||||
static emu_timer *irq_timer;
|
||||
|
||||
static UINT8 irq_state;
|
||||
static UINT8 *nvram_stage;
|
||||
static UINT8 nvram_store[2];
|
||||
|
||||
int ccastles_vblank_start;
|
||||
int ccastles_vblank_end;
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
/************************************* *
|
||||
* VBLANK and IRQ generation
|
||||
*
|
||||
*************************************/
|
||||
|
||||
INLINE void schedule_next_irq(running_machine *machine, int curscanline)
|
||||
INLINE void schedule_next_irq( running_machine *machine, int curscanline )
|
||||
{
|
||||
ccastles_state *state = (ccastles_state *)machine->driver_data;
|
||||
|
||||
/* scan for a rising edge on the IRQCK signal */
|
||||
for (curscanline++; ; curscanline = (curscanline + 1) & 0xff)
|
||||
if ((syncprom[(curscanline - 1) & 0xff] & 8) == 0 && (syncprom[curscanline] & 8) != 0)
|
||||
if ((state->syncprom[(curscanline - 1) & 0xff] & 8) == 0 && (state->syncprom[curscanline] & 8) != 0)
|
||||
break;
|
||||
|
||||
/* next one at the start of this scanline */
|
||||
timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(machine->primary_screen, curscanline, 0), curscanline);
|
||||
timer_adjust_oneshot(state->irq_timer, video_screen_get_time_until_pos(machine->primary_screen, curscanline, 0), curscanline);
|
||||
}
|
||||
|
||||
|
||||
static TIMER_CALLBACK( clock_irq )
|
||||
{
|
||||
ccastles_state *state = (ccastles_state *)machine->driver_data;
|
||||
|
||||
/* assert the IRQ if not already asserted */
|
||||
if (!irq_state)
|
||||
if (!state->irq_state)
|
||||
{
|
||||
cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
|
||||
irq_state = 1;
|
||||
state->irq_state = 1;
|
||||
}
|
||||
|
||||
/* force an update now */
|
||||
@ -188,8 +182,9 @@ static TIMER_CALLBACK( clock_irq )
|
||||
|
||||
static CUSTOM_INPUT( get_vblank )
|
||||
{
|
||||
ccastles_state *state = (ccastles_state *)field->port->machine->driver_data;
|
||||
int scanline = video_screen_get_vpos(field->port->machine->primary_screen);
|
||||
return syncprom[scanline & 0xff] & 1;
|
||||
return state->syncprom[scanline & 0xff] & 1;
|
||||
}
|
||||
|
||||
|
||||
@ -202,55 +197,57 @@ static CUSTOM_INPUT( get_vblank )
|
||||
|
||||
static MACHINE_START( ccastles )
|
||||
{
|
||||
ccastles_state *state = (ccastles_state *)machine->driver_data;
|
||||
rectangle visarea;
|
||||
|
||||
/* initialize globals */
|
||||
syncprom = memory_region(machine, "proms") + 0x000;
|
||||
state->syncprom = memory_region(machine, "proms") + 0x000;
|
||||
|
||||
/* find the start of VBLANK in the SYNC PROM */
|
||||
for (ccastles_vblank_start = 0; ccastles_vblank_start < 256; ccastles_vblank_start++)
|
||||
if ((syncprom[(ccastles_vblank_start - 1) & 0xff] & 1) == 0 && (syncprom[ccastles_vblank_start] & 1) != 0)
|
||||
for (state->vblank_start = 0; state->vblank_start < 256; state->vblank_start++)
|
||||
if ((state->syncprom[(state->vblank_start - 1) & 0xff] & 1) == 0 && (state->syncprom[state->vblank_start] & 1) != 0)
|
||||
break;
|
||||
if (ccastles_vblank_start == 0)
|
||||
ccastles_vblank_start = 256;
|
||||
if (state->vblank_start == 0)
|
||||
state->vblank_start = 256;
|
||||
|
||||
/* find the end of VBLANK in the SYNC PROM */
|
||||
for (ccastles_vblank_end = 0; ccastles_vblank_end < 256; ccastles_vblank_end++)
|
||||
if ((syncprom[(ccastles_vblank_end - 1) & 0xff] & 1) != 0 && (syncprom[ccastles_vblank_end] & 1) == 0)
|
||||
for (state->vblank_end = 0; state->vblank_end < 256; state->vblank_end++)
|
||||
if ((state->syncprom[(state->vblank_end - 1) & 0xff] & 1) != 0 && (state->syncprom[state->vblank_end] & 1) == 0)
|
||||
break;
|
||||
|
||||
/* can't handle the wrapping case */
|
||||
assert(ccastles_vblank_end < ccastles_vblank_start);
|
||||
assert(state->vblank_end < state->vblank_start);
|
||||
|
||||
/* reconfigure the visible area to match */
|
||||
visarea.min_x = 0;
|
||||
visarea.max_x = 255;
|
||||
visarea.min_y = ccastles_vblank_end;
|
||||
visarea.max_y = ccastles_vblank_start - 1;
|
||||
visarea.min_y = state->vblank_end;
|
||||
visarea.max_y = state->vblank_start - 1;
|
||||
video_screen_configure(machine->primary_screen, 320, 256, &visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL);
|
||||
|
||||
/* configure the ROM banking */
|
||||
memory_configure_bank(machine, 1, 0, 2, memory_region(machine, "maincpu") + 0xa000, 0x6000);
|
||||
|
||||
/* create a timer for IRQs and set up the first callback */
|
||||
irq_timer = timer_alloc(machine, clock_irq, NULL);
|
||||
irq_state = 0;
|
||||
state->irq_timer = timer_alloc(machine, clock_irq, NULL);
|
||||
state->irq_state = 0;
|
||||
schedule_next_irq(machine, 0);
|
||||
|
||||
/* allocate backing memory for the NVRAM */
|
||||
generic_nvram = auto_alloc_array(machine, UINT8, generic_nvram_size);
|
||||
|
||||
/* setup for save states */
|
||||
state_save_register_global(machine, irq_state);
|
||||
state_save_register_global_array(machine, nvram_store);
|
||||
state_save_register_global(machine, state->irq_state);
|
||||
state_save_register_global_array(machine, state->nvram_store);
|
||||
state_save_register_global_pointer(machine, generic_nvram, generic_nvram_size);
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_RESET( ccastles )
|
||||
{
|
||||
ccastles_state *state = (ccastles_state *)machine->driver_data;
|
||||
cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE);
|
||||
irq_state = 0;
|
||||
state->irq_state = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -263,10 +260,11 @@ static MACHINE_RESET( ccastles )
|
||||
|
||||
static WRITE8_HANDLER( irq_ack_w )
|
||||
{
|
||||
if (irq_state)
|
||||
ccastles_state *state = (ccastles_state *)space->machine->driver_data;
|
||||
if (state->irq_state)
|
||||
{
|
||||
cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
|
||||
irq_state = 0;
|
||||
state->irq_state = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -327,8 +325,10 @@ static WRITE8_HANDLER( nvram_recall_w )
|
||||
|
||||
static WRITE8_HANDLER( nvram_store_w )
|
||||
{
|
||||
nvram_store[offset] = data & 1;
|
||||
if (!nvram_store[0] && nvram_store[1])
|
||||
ccastles_state *state = (ccastles_state *)space->machine->driver_data;
|
||||
|
||||
state->nvram_store[offset] = data & 1;
|
||||
if (!state->nvram_store[0] && state->nvram_store[1])
|
||||
memcpy(generic_nvram, nvram_stage, generic_nvram_size);
|
||||
}
|
||||
|
||||
@ -344,9 +344,9 @@ static WRITE8_HANDLER( nvram_store_w )
|
||||
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x0001) AM_WRITE(ccastles_bitmode_addr_w)
|
||||
AM_RANGE(0x0002, 0x0002) AM_READWRITE(ccastles_bitmode_r, ccastles_bitmode_w)
|
||||
AM_RANGE(0x0000, 0x7fff) AM_RAM_WRITE(ccastles_videoram_w) AM_BASE(&videoram)
|
||||
AM_RANGE(0x0000, 0x7fff) AM_RAM_WRITE(ccastles_videoram_w) AM_BASE_MEMBER(ccastles_state, videoram)
|
||||
AM_RANGE(0x8000, 0x8fff) AM_RAM
|
||||
AM_RANGE(0x8e00, 0x8fff) AM_BASE(&spriteram)
|
||||
AM_RANGE(0x8e00, 0x8fff) AM_BASE_MEMBER(ccastles_state, spriteram)
|
||||
AM_RANGE(0x9000, 0x90ff) AM_MIRROR(0x0300) AM_RAM AM_BASE(&nvram_stage) AM_SIZE(&generic_nvram_size)
|
||||
AM_RANGE(0x9400, 0x9403) AM_MIRROR(0x01fc) AM_READ(leta_r)
|
||||
AM_RANGE(0x9600, 0x97ff) AM_READ_PORT("IN0")
|
||||
@ -488,6 +488,9 @@ static const pokey_interface pokey_config =
|
||||
|
||||
static MACHINE_DRIVER_START( ccastles )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(ccastles_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M6502, MASTER_CLOCK/8)
|
||||
MDRV_CPU_PROGRAM_MAP(main_map)
|
||||
|
41
src/mame/includes/actfancr.h
Normal file
41
src/mame/includes/actfancr.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*************************************************************************
|
||||
|
||||
Act Fancer
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _actfancr_state actfancr_state;
|
||||
struct _actfancr_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * pf1_data;
|
||||
UINT8 * pf2_data;
|
||||
UINT8 * pf1_rowscroll_data;
|
||||
UINT8 * main_ram;
|
||||
// UINT8 * spriteram; // currently this uses buffered_spriteram
|
||||
// UINT8 * paletteram; // currently this uses generic palette handling
|
||||
|
||||
/* video-related */
|
||||
tilemap *pf1_tilemap, *pf1_alt_tilemap, *pf2_tilemap;
|
||||
UINT8 control_1[0x20], control_2[0x20];
|
||||
int flipscreen;
|
||||
|
||||
/* misc */
|
||||
int trio_control_select;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/actfancr.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( actfancr_pf1_data_w );
|
||||
READ8_HANDLER( actfancr_pf1_data_r );
|
||||
WRITE8_HANDLER( actfancr_pf1_control_w );
|
||||
WRITE8_HANDLER( actfancr_pf2_data_w );
|
||||
READ8_HANDLER( actfancr_pf2_data_r );
|
||||
WRITE8_HANDLER( actfancr_pf2_control_w );
|
||||
|
||||
VIDEO_START( actfancr );
|
||||
VIDEO_START( triothep );
|
||||
|
||||
VIDEO_UPDATE( actfancr );
|
||||
VIDEO_UPDATE( triothep );
|
@ -1,10 +1,23 @@
|
||||
/*----------- defined in drivers/aquarium.c -----------*/
|
||||
|
||||
extern UINT16 *aquarium_scroll;
|
||||
|
||||
extern UINT16 *aquarium_txt_videoram;
|
||||
extern UINT16 *aquarium_mid_videoram;
|
||||
extern UINT16 *aquarium_bak_videoram;
|
||||
|
||||
typedef struct _aquarium_state aquarium_state;
|
||||
struct _aquarium_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT16 * scroll;
|
||||
UINT16 * txt_videoram;
|
||||
UINT16 * mid_videoram;
|
||||
UINT16 * bak_videoram;
|
||||
UINT16 * spriteram;
|
||||
// UINT16 * paletteram16; // currently this uses generic palette handling
|
||||
|
||||
/* video-related */
|
||||
tilemap *txt_tilemap, *mid_tilemap, *bak_tilemap;
|
||||
|
||||
/* misc */
|
||||
int aquarium_snd_ack;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/aquarium.c -----------*/
|
||||
|
@ -4,10 +4,34 @@
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
/*----------- defined in drivers/ccastles.c -----------*/
|
||||
typedef struct _ccastles_state ccastles_state;
|
||||
struct _ccastles_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
UINT8 * spriteram;
|
||||
// UINT8 * nvram_stage; // currently this uses generic nvram handlers
|
||||
// UINT8 * nvram; // currently this uses generic nvram handlers
|
||||
|
||||
/* video-related */
|
||||
const UINT8 *syncprom;
|
||||
const UINT8 *wpprom;
|
||||
const UINT8 *priprom;
|
||||
bitmap_t *spritebitmap;
|
||||
double rweights[3], gweights[3], bweights[3];
|
||||
UINT8 video_control[8];
|
||||
UINT8 bitmode_addr[2];
|
||||
UINT8 hscroll;
|
||||
UINT8 vscroll;
|
||||
|
||||
/* misc */
|
||||
int vblank_start;
|
||||
int vblank_end;
|
||||
emu_timer *irq_timer;
|
||||
UINT8 irq_state;
|
||||
UINT8 nvram_store[2];
|
||||
};
|
||||
|
||||
extern int ccastles_vblank_start;
|
||||
extern int ccastles_vblank_end;
|
||||
|
||||
/*----------- defined in video/ccastles.c -----------*/
|
||||
|
||||
|
@ -5,13 +5,9 @@
|
||||
*******************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "actfancr.h"
|
||||
|
||||
|
||||
static UINT8 actfancr_control_1[0x20],actfancr_control_2[0x20];
|
||||
UINT8 *actfancr_pf1_data,*actfancr_pf2_data,*actfancr_pf1_rowscroll_data;
|
||||
static tilemap *pf1_tilemap,*pf1_alt_tilemap,*pf2_tilemap;
|
||||
static int flipscreen;
|
||||
|
||||
static TILEMAP_MAPPER( actfancr_scan )
|
||||
{
|
||||
/* logical (col,row) -> memory offset */
|
||||
@ -26,11 +22,11 @@ static TILEMAP_MAPPER( actfancr_scan2 )
|
||||
|
||||
static TILE_GET_INFO( get_tile_info )
|
||||
{
|
||||
int tile,color;
|
||||
actfancr_state *state = (actfancr_state *)machine->driver_data;
|
||||
int tile = state->pf1_data[2 * tile_index] + (state->pf1_data[2 * tile_index + 1] << 8);
|
||||
int color = tile >> 12;
|
||||
|
||||
tile=actfancr_pf1_data[2*tile_index]+(actfancr_pf1_data[2*tile_index+1]<<8);
|
||||
color=tile >> 12;
|
||||
tile=tile&0xfff;
|
||||
tile = tile & 0xfff;
|
||||
|
||||
SET_TILE_INFO(
|
||||
2,
|
||||
@ -47,11 +43,11 @@ static TILEMAP_MAPPER( triothep_scan )
|
||||
|
||||
static TILE_GET_INFO( get_trio_tile_info )
|
||||
{
|
||||
int tile,color;
|
||||
actfancr_state *state = (actfancr_state *)machine->driver_data;
|
||||
int tile = state->pf1_data[2 * tile_index] + (state->pf1_data[2 * tile_index + 1] << 8);
|
||||
int color = tile >> 12;
|
||||
|
||||
tile=actfancr_pf1_data[2*tile_index]+(actfancr_pf1_data[2*tile_index+1]<<8);
|
||||
color=tile >> 12;
|
||||
tile=tile&0xfff;
|
||||
tile = tile & 0xfff;
|
||||
|
||||
SET_TILE_INFO(
|
||||
2,
|
||||
@ -62,12 +58,12 @@ static TILE_GET_INFO( get_trio_tile_info )
|
||||
|
||||
static TILE_GET_INFO( get_pf2_tile_info )
|
||||
{
|
||||
int tile,color;
|
||||
actfancr_state *state = (actfancr_state *)machine->driver_data;
|
||||
int tile = state->pf2_data[2 * tile_index] + (state->pf2_data[2 * tile_index + 1] << 8);
|
||||
int color = tile >> 12;
|
||||
|
||||
tile=actfancr_pf2_data[2*tile_index]+(actfancr_pf2_data[2*tile_index+1]<<8);
|
||||
color=tile>>12;
|
||||
tile = tile & 0xfff;
|
||||
|
||||
tile=tile&0xfff;
|
||||
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
@ -78,31 +74,34 @@ static TILE_GET_INFO( get_pf2_tile_info )
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static void register_savestate(running_machine *machine)
|
||||
static void register_savestate( running_machine *machine )
|
||||
{
|
||||
state_save_register_global_array(machine, actfancr_control_1);
|
||||
state_save_register_global_array(machine, actfancr_control_2);
|
||||
actfancr_state *state = (actfancr_state *)machine->driver_data;
|
||||
state_save_register_global_array(machine, state->control_1);
|
||||
state_save_register_global_array(machine, state->control_2);
|
||||
state_save_register_global(machine, state->flipscreen);
|
||||
}
|
||||
|
||||
VIDEO_START( actfancr )
|
||||
{
|
||||
pf1_tilemap = tilemap_create(machine, get_tile_info,actfancr_scan,16,16,256,16);
|
||||
pf1_alt_tilemap = tilemap_create(machine, get_tile_info,actfancr_scan2,16,16,128,32);
|
||||
pf2_tilemap = tilemap_create(machine, get_pf2_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
actfancr_state *state = (actfancr_state *)machine->driver_data;
|
||||
state->pf1_tilemap = tilemap_create(machine, get_tile_info, actfancr_scan, 16, 16, 256, 16);
|
||||
state->pf1_alt_tilemap = tilemap_create(machine, get_tile_info, actfancr_scan2, 16, 16, 128, 32);
|
||||
state->pf2_tilemap = tilemap_create(machine, get_pf2_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
|
||||
tilemap_set_transparent_pen(pf2_tilemap,0);
|
||||
tilemap_set_transparent_pen(state->pf2_tilemap, 0);
|
||||
|
||||
register_savestate(machine);
|
||||
}
|
||||
|
||||
VIDEO_START( triothep )
|
||||
{
|
||||
pf1_tilemap = tilemap_create(machine, get_trio_tile_info,triothep_scan,16,16,32,32);
|
||||
pf2_tilemap = tilemap_create(machine, get_pf2_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
actfancr_state *state = (actfancr_state *)machine->driver_data;
|
||||
state->pf1_tilemap = tilemap_create(machine, get_trio_tile_info, triothep_scan, 16, 16, 32, 32);
|
||||
state->pf2_tilemap = tilemap_create(machine, get_pf2_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
state->pf1_alt_tilemap = NULL;
|
||||
|
||||
tilemap_set_transparent_pen(pf2_tilemap,0);
|
||||
|
||||
pf1_alt_tilemap=NULL;
|
||||
tilemap_set_transparent_pen(state->pf2_tilemap, 0);
|
||||
|
||||
register_savestate(machine);
|
||||
}
|
||||
@ -111,77 +110,88 @@ VIDEO_START( triothep )
|
||||
|
||||
WRITE8_HANDLER( actfancr_pf1_control_w )
|
||||
{
|
||||
actfancr_control_1[offset]=data;
|
||||
actfancr_state *state = (actfancr_state *)space->machine->driver_data;
|
||||
state->control_1[offset] = data;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( actfancr_pf2_control_w )
|
||||
{
|
||||
actfancr_control_2[offset]=data;
|
||||
actfancr_state *state = (actfancr_state *)space->machine->driver_data;
|
||||
state->control_2[offset] = data;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( actfancr_pf1_data_w )
|
||||
{
|
||||
actfancr_pf1_data[offset]=data;
|
||||
tilemap_mark_tile_dirty(pf1_tilemap,offset/2);
|
||||
if (pf1_alt_tilemap) tilemap_mark_tile_dirty(pf1_alt_tilemap,offset/2);
|
||||
actfancr_state *state = (actfancr_state *)space->machine->driver_data;
|
||||
state->pf1_data[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->pf1_tilemap, offset / 2);
|
||||
if (state->pf1_alt_tilemap)
|
||||
tilemap_mark_tile_dirty(state->pf1_alt_tilemap, offset / 2);
|
||||
}
|
||||
|
||||
READ8_HANDLER( actfancr_pf1_data_r )
|
||||
{
|
||||
return actfancr_pf1_data[offset];
|
||||
actfancr_state *state = (actfancr_state *)space->machine->driver_data;
|
||||
return state->pf1_data[offset];
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( actfancr_pf2_data_w )
|
||||
{
|
||||
actfancr_pf2_data[offset]=data;
|
||||
tilemap_mark_tile_dirty(pf2_tilemap,offset/2);
|
||||
actfancr_state *state = (actfancr_state *)space->machine->driver_data;
|
||||
state->pf2_data[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->pf2_tilemap, offset / 2);
|
||||
}
|
||||
|
||||
READ8_HANDLER( actfancr_pf2_data_r )
|
||||
{
|
||||
return actfancr_pf2_data[offset];
|
||||
actfancr_state *state = (actfancr_state *)space->machine->driver_data;
|
||||
return state->pf2_data[offset];
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
VIDEO_UPDATE( actfancr )
|
||||
{
|
||||
int offs,mult;
|
||||
int scrollx=(actfancr_control_1[0x10]+(actfancr_control_1[0x11]<<8));
|
||||
int scrolly=(actfancr_control_1[0x12]+(actfancr_control_1[0x13]<<8));
|
||||
actfancr_state *state = (actfancr_state *)screen->machine->driver_data;
|
||||
int offs, mult;
|
||||
int scrollx = (state->control_1[0x10] + (state->control_1[0x11] << 8));
|
||||
int scrolly = (state->control_1[0x12] + (state->control_1[0x13] << 8));
|
||||
|
||||
/* Draw playfield */
|
||||
flipscreen=actfancr_control_2[0]&0x80;
|
||||
tilemap_set_flip_all(screen->machine,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
state->flipscreen = state->control_2[0] & 0x80;
|
||||
tilemap_set_flip_all(screen->machine, state->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
|
||||
tilemap_set_scrollx( pf1_tilemap,0, scrollx );
|
||||
tilemap_set_scrolly( pf1_tilemap,0, scrolly );
|
||||
tilemap_set_scrollx( pf1_alt_tilemap,0, scrollx );
|
||||
tilemap_set_scrolly( pf1_alt_tilemap,0, scrolly );
|
||||
tilemap_set_scrollx(state->pf1_tilemap,0, scrollx );
|
||||
tilemap_set_scrolly(state->pf1_tilemap,0, scrolly );
|
||||
tilemap_set_scrollx(state->pf1_alt_tilemap, 0, scrollx );
|
||||
tilemap_set_scrolly(state->pf1_alt_tilemap, 0, scrolly );
|
||||
|
||||
if (actfancr_control_1[6]==1)
|
||||
tilemap_draw(bitmap,cliprect,pf1_alt_tilemap,0,0);
|
||||
if (state->control_1[6] == 1)
|
||||
tilemap_draw(bitmap, cliprect, state->pf1_alt_tilemap, 0, 0);
|
||||
else
|
||||
tilemap_draw(bitmap,cliprect,pf1_tilemap,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->pf1_tilemap, 0, 0);
|
||||
|
||||
/* Sprites */
|
||||
for (offs = 0;offs < 0x800;offs += 8)
|
||||
for (offs = 0; offs < 0x800; offs += 8)
|
||||
{
|
||||
int x,y,sprite,colour,multi,fx,fy,inc,flash;
|
||||
int x, y, sprite, colour, multi, fx, fy, inc, flash;
|
||||
|
||||
y=buffered_spriteram[offs]+(buffered_spriteram[offs+1]<<8);
|
||||
if ((y&0x8000) == 0) continue;
|
||||
x = buffered_spriteram[offs+4]+(buffered_spriteram[offs+5]<<8);
|
||||
y = buffered_spriteram[offs] + (buffered_spriteram[offs + 1] << 8);
|
||||
if ((y & 0x8000) == 0)
|
||||
continue;
|
||||
|
||||
x = buffered_spriteram[offs + 4] + (buffered_spriteram[offs + 5] << 8);
|
||||
colour = ((x & 0xf000) >> 12);
|
||||
flash=x&0x800;
|
||||
if (flash && (video_screen_get_frame_number(screen) & 1)) continue;
|
||||
flash = x & 0x800;
|
||||
if (flash && (video_screen_get_frame_number(screen) & 1))
|
||||
continue;
|
||||
|
||||
fx = y & 0x2000;
|
||||
fy = y & 0x4000;
|
||||
multi = (1 << ((y & 0x1800) >> 11)) - 1; /* 1x, 2x, 4x, 8x height */
|
||||
/* multi = 0 1 3 7 */
|
||||
|
||||
/* multi = 0 1 3 7 */
|
||||
sprite = buffered_spriteram[offs+2]+(buffered_spriteram[offs+3]<<8);
|
||||
sprite = buffered_spriteram[offs + 2] + (buffered_spriteram[offs + 3] << 8);
|
||||
sprite &= 0x0fff;
|
||||
|
||||
x = x & 0x01ff;
|
||||
@ -200,14 +210,15 @@ VIDEO_UPDATE( actfancr )
|
||||
inc = 1;
|
||||
}
|
||||
|
||||
if (flipscreen) {
|
||||
y=240-y;
|
||||
x=240-x;
|
||||
if (fx) fx=0; else fx=1;
|
||||
if (fy) fy=0; else fy=1;
|
||||
mult=16;
|
||||
if (state->flipscreen)
|
||||
{
|
||||
y = 240 - y;
|
||||
x = 240 - x;
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
mult = 16;
|
||||
}
|
||||
else mult=-16;
|
||||
else mult = -16;
|
||||
|
||||
while (multi >= 0)
|
||||
{
|
||||
@ -220,52 +231,58 @@ VIDEO_UPDATE( actfancr )
|
||||
}
|
||||
}
|
||||
|
||||
tilemap_draw(bitmap,cliprect,pf2_tilemap,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->pf2_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( triothep )
|
||||
{
|
||||
int offs,i,mult;
|
||||
int scrollx=(actfancr_control_1[0x10]+(actfancr_control_1[0x11]<<8));
|
||||
int scrolly=(actfancr_control_1[0x12]+(actfancr_control_1[0x13]<<8));
|
||||
actfancr_state *state = (actfancr_state *)screen->machine->driver_data;
|
||||
int offs, i, mult;
|
||||
int scrollx = (state->control_1[0x10] + (state->control_1[0x11] << 8));
|
||||
int scrolly = (state->control_1[0x12] + (state->control_1[0x13] << 8));
|
||||
|
||||
/* Draw playfield */
|
||||
flipscreen=actfancr_control_2[0]&0x80;
|
||||
tilemap_set_flip_all(screen->machine,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
state->flipscreen = state->control_2[0] & 0x80;
|
||||
tilemap_set_flip_all(screen->machine, state->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
|
||||
if (actfancr_control_2[0]&0x4) {
|
||||
tilemap_set_scroll_rows(pf1_tilemap,32);
|
||||
tilemap_set_scrolly( pf1_tilemap,0, scrolly );
|
||||
for (i=0; i<32; i++)
|
||||
tilemap_set_scrollx( pf1_tilemap,i, scrollx+(actfancr_pf1_rowscroll_data[i*2] | actfancr_pf1_rowscroll_data[i*2+1]<<8) );
|
||||
if (state->control_2[0] & 0x4)
|
||||
{
|
||||
tilemap_set_scroll_rows(state->pf1_tilemap, 32);
|
||||
tilemap_set_scrolly(state->pf1_tilemap, 0, scrolly);
|
||||
for (i = 0; i < 32; i++)
|
||||
tilemap_set_scrollx(state->pf1_tilemap, i, scrollx + (state->pf1_rowscroll_data[i * 2] | state->pf1_rowscroll_data[i * 2 + 1] << 8) );
|
||||
}
|
||||
else {
|
||||
tilemap_set_scroll_rows(pf1_tilemap,1);
|
||||
tilemap_set_scrollx( pf1_tilemap,0, scrollx );
|
||||
tilemap_set_scrolly( pf1_tilemap,0, scrolly );
|
||||
else
|
||||
{
|
||||
tilemap_set_scroll_rows(state->pf1_tilemap, 1);
|
||||
tilemap_set_scrollx(state->pf1_tilemap, 0, scrollx);
|
||||
tilemap_set_scrolly(state->pf1_tilemap, 0, scrolly);
|
||||
}
|
||||
|
||||
tilemap_draw(bitmap,cliprect,pf1_tilemap,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->pf1_tilemap, 0, 0);
|
||||
|
||||
/* Sprites */
|
||||
for (offs = 0;offs < 0x800;offs += 8)
|
||||
for (offs = 0; offs < 0x800; offs += 8)
|
||||
{
|
||||
int x,y,sprite,colour,multi,fx,fy,inc,flash;
|
||||
int x, y, sprite, colour, multi, fx, fy, inc, flash;
|
||||
|
||||
y=buffered_spriteram[offs]+(buffered_spriteram[offs+1]<<8);
|
||||
if ((y&0x8000) == 0) continue;
|
||||
x = buffered_spriteram[offs+4]+(buffered_spriteram[offs+5]<<8);
|
||||
y = buffered_spriteram[offs] + (buffered_spriteram[offs + 1] << 8);
|
||||
if ((y & 0x8000) == 0)
|
||||
continue;
|
||||
|
||||
x = buffered_spriteram[offs + 4] + (buffered_spriteram[offs + 5] << 8);
|
||||
colour = ((x & 0xf000) >> 12);
|
||||
flash=x&0x800;
|
||||
if (flash && (video_screen_get_frame_number(screen) & 1)) continue;
|
||||
flash = x & 0x800;
|
||||
if (flash && (video_screen_get_frame_number(screen) & 1))
|
||||
continue;
|
||||
|
||||
fx = y & 0x2000;
|
||||
fy = y & 0x4000;
|
||||
multi = (1 << ((y & 0x1800) >> 11)) - 1; /* 1x, 2x, 4x, 8x height */
|
||||
|
||||
/* multi = 0 1 3 7 */
|
||||
sprite = buffered_spriteram[offs+2]+(buffered_spriteram[offs+3]<<8);
|
||||
|
||||
sprite = buffered_spriteram[offs + 2] + (buffered_spriteram[offs + 3] << 8);
|
||||
sprite &= 0x0fff;
|
||||
|
||||
x = x & 0x01ff;
|
||||
@ -284,14 +301,15 @@ VIDEO_UPDATE( triothep )
|
||||
inc = 1;
|
||||
}
|
||||
|
||||
if (flipscreen) {
|
||||
y=240-y;
|
||||
x=240-x;
|
||||
if (fx) fx=0; else fx=1;
|
||||
if (fy) fy=0; else fy=1;
|
||||
mult=16;
|
||||
if (state->flipscreen)
|
||||
{
|
||||
y = 240 - y;
|
||||
x = 240 - x;
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
mult = 16;
|
||||
}
|
||||
else mult=-16;
|
||||
else mult = -16;
|
||||
|
||||
while (multi >= 0)
|
||||
{
|
||||
@ -304,6 +322,6 @@ VIDEO_UPDATE( triothep )
|
||||
}
|
||||
}
|
||||
|
||||
tilemap_draw(bitmap,cliprect,pf2_tilemap,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->pf2_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -3,48 +3,45 @@
|
||||
#include "driver.h"
|
||||
#include "includes/aquarium.h"
|
||||
|
||||
static tilemap *aquarium_txt_tilemap;
|
||||
static tilemap *aquarium_mid_tilemap;
|
||||
static tilemap *aquarium_bak_tilemap;
|
||||
|
||||
/* gcpinbal.c modified */
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int y_offs)
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int y_offs )
|
||||
{
|
||||
int offs,chain_pos;
|
||||
int x,y,curx,cury;
|
||||
UINT8 col,flipx,flipy,chain;
|
||||
aquarium_state *state = (aquarium_state *)machine->driver_data;
|
||||
int offs, chain_pos;
|
||||
int x, y, curx, cury;
|
||||
UINT8 col, flipx, flipy, chain;
|
||||
UINT16 code;
|
||||
|
||||
for (offs = 0;offs < spriteram_size/2;offs += 8)
|
||||
for (offs = 0; offs < spriteram_size / 2; offs += 8)
|
||||
{
|
||||
code = ((spriteram16[offs+5])&0xff) + (((spriteram16[offs+6]) &0xff) << 8);
|
||||
code = ((state->spriteram[offs + 5]) & 0xff) + (((state->spriteram[offs + 6]) & 0xff) << 8);
|
||||
code &= 0x3fff;
|
||||
|
||||
if (!(spriteram16[offs+4] &0x80)) /* active sprite ? */
|
||||
if (!(state->spriteram[offs + 4] &0x80)) /* active sprite ? */
|
||||
{
|
||||
x = ((spriteram16[offs+0]) &0xff) + (((spriteram16[offs+1]) &0xff) << 8);
|
||||
y = ((spriteram16[offs+2]) &0xff) + (((spriteram16[offs+3]) &0xff) << 8);
|
||||
x = ((state->spriteram[offs + 0]) &0xff) + (((state->spriteram[offs + 1]) & 0xff) << 8);
|
||||
y = ((state->spriteram[offs + 2]) &0xff) + (((state->spriteram[offs + 3]) & 0xff) << 8);
|
||||
|
||||
/* Treat coords as signed */
|
||||
if (x & 0x8000) x -= 0x10000;
|
||||
if (y & 0x8000) y -= 0x10000;
|
||||
|
||||
col = ((spriteram16[offs+7]) &0x0f);
|
||||
chain = (spriteram16[offs+4]) &0x07;
|
||||
flipy = (spriteram16[offs+4]) &0x10;
|
||||
flipx = (spriteram16[offs+4]) &0x20;
|
||||
col = ((state->spriteram[offs + 7]) & 0x0f);
|
||||
chain = (state->spriteram[offs + 4]) & 0x07;
|
||||
flipy = (state->spriteram[offs + 4]) & 0x10;
|
||||
flipx = (state->spriteram[offs + 4]) & 0x20;
|
||||
|
||||
curx = x;
|
||||
cury = y;
|
||||
|
||||
if (((spriteram16[offs+4]) &0x08) && flipy)
|
||||
if (((state->spriteram[offs + 4]) & 0x08) && flipy)
|
||||
cury += (chain * 16);
|
||||
|
||||
if (!(((spriteram16[offs+4]) &0x08)) && flipx)
|
||||
if (!(((state->spriteram[offs + 4]) & 0x08)) && flipx)
|
||||
curx += (chain * 16);
|
||||
|
||||
|
||||
for (chain_pos = chain;chain_pos >= 0;chain_pos--)
|
||||
for (chain_pos = chain; chain_pos >= 0; chain_pos--)
|
||||
{
|
||||
drawgfx_transpen(bitmap, cliprect,machine->gfx[0],
|
||||
code,
|
||||
@ -57,19 +54,23 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
|
||||
code,
|
||||
col,
|
||||
flipx, flipy,
|
||||
curx,cury+256,0);
|
||||
curx,cury + 256,0);
|
||||
|
||||
code++;
|
||||
|
||||
if ((spriteram16[offs+4]) &0x08) /* Y chain */
|
||||
if ((state->spriteram[offs + 4]) &0x08) /* Y chain */
|
||||
{
|
||||
if (flipy) cury -= 16;
|
||||
else cury += 16;
|
||||
if (flipy)
|
||||
cury -= 16;
|
||||
else
|
||||
cury += 16;
|
||||
}
|
||||
else /* X chain */
|
||||
{
|
||||
if (flipx) curx -= 16;
|
||||
else curx += 16;
|
||||
if (flipx)
|
||||
curx -= 16;
|
||||
else
|
||||
curx += 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -78,98 +79,102 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
|
||||
if (rotate)
|
||||
{
|
||||
char buf[80];
|
||||
sprintf(buf,"sprite rotate offs %04x ?",rotate);
|
||||
sprintf(buf, "sprite rotate offs %04x ?", rotate);
|
||||
popmessage(buf);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* TXT Layer */
|
||||
|
||||
static TILE_GET_INFO( get_aquarium_txt_tile_info )
|
||||
{
|
||||
int tileno,colour;
|
||||
aquarium_state *state = (aquarium_state *)machine->driver_data;
|
||||
int tileno, colour;
|
||||
|
||||
tileno = (aquarium_txt_videoram[tile_index] & 0x0fff);
|
||||
colour = (aquarium_txt_videoram[tile_index] & 0xf000) >> 12;
|
||||
SET_TILE_INFO(2,tileno,colour,0);
|
||||
tileno = (state->txt_videoram[tile_index] & 0x0fff);
|
||||
colour = (state->txt_videoram[tile_index] & 0xf000) >> 12;
|
||||
SET_TILE_INFO(2, tileno, colour, 0);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( aquarium_txt_videoram_w )
|
||||
{
|
||||
aquarium_txt_videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(aquarium_txt_tilemap,offset);
|
||||
aquarium_state *state = (aquarium_state *)space->machine->driver_data;
|
||||
state->txt_videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->txt_tilemap, offset);
|
||||
}
|
||||
|
||||
/* MID Layer */
|
||||
|
||||
static TILE_GET_INFO( get_aquarium_mid_tile_info )
|
||||
{
|
||||
int tileno,colour,flag;
|
||||
aquarium_state *state = (aquarium_state *)machine->driver_data;
|
||||
int tileno, colour, flag;
|
||||
|
||||
tileno = (aquarium_mid_videoram[tile_index*2] & 0x0fff);
|
||||
colour = (aquarium_mid_videoram[tile_index*2+1] & 0x001f);
|
||||
flag = TILE_FLIPYX((aquarium_mid_videoram[tile_index*2+1] & 0x300) >> 8);
|
||||
tileno = (state->mid_videoram[tile_index * 2] & 0x0fff);
|
||||
colour = (state->mid_videoram[tile_index * 2 + 1] & 0x001f);
|
||||
flag = TILE_FLIPYX((state->mid_videoram[tile_index * 2 + 1] & 0x300) >> 8);
|
||||
|
||||
SET_TILE_INFO(1,tileno,colour,flag);
|
||||
SET_TILE_INFO(1, tileno, colour, flag);
|
||||
|
||||
tileinfo->category = (aquarium_mid_videoram[tile_index*2+1] & 0x20) >> 5;
|
||||
tileinfo->category = (state->mid_videoram[tile_index * 2 + 1] & 0x20) >> 5;
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( aquarium_mid_videoram_w )
|
||||
{
|
||||
aquarium_mid_videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(aquarium_mid_tilemap,offset/2);
|
||||
aquarium_state *state = (aquarium_state *)space->machine->driver_data;
|
||||
state->mid_videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->mid_tilemap, offset / 2);
|
||||
}
|
||||
|
||||
/* BAK Layer */
|
||||
static TILE_GET_INFO( get_aquarium_bak_tile_info )
|
||||
|
||||
{
|
||||
int tileno,colour,flag;
|
||||
aquarium_state *state = (aquarium_state *)machine->driver_data;
|
||||
int tileno, colour, flag;
|
||||
|
||||
tileno = (aquarium_bak_videoram[tile_index*2] & 0x0fff);
|
||||
colour = (aquarium_bak_videoram[tile_index*2+1] & 0x001f);
|
||||
flag = TILE_FLIPYX((aquarium_bak_videoram[tile_index*2+1] & 0x300) >> 8);
|
||||
tileno = (state->bak_videoram[tile_index * 2] & 0x0fff);
|
||||
colour = (state->bak_videoram[tile_index * 2 + 1] & 0x001f);
|
||||
flag = TILE_FLIPYX((state->bak_videoram[tile_index * 2 + 1] & 0x300) >> 8);
|
||||
|
||||
SET_TILE_INFO(3,tileno,colour,flag);
|
||||
SET_TILE_INFO(3, tileno, colour, flag);
|
||||
|
||||
tileinfo->category = (aquarium_bak_videoram[tile_index*2+1] & 0x20) >> 5;
|
||||
tileinfo->category = (state->bak_videoram[tile_index * 2 + 1] & 0x20) >> 5;
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( aquarium_bak_videoram_w )
|
||||
{
|
||||
aquarium_bak_videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(aquarium_bak_tilemap,offset/2);
|
||||
aquarium_state *state = (aquarium_state *)space->machine->driver_data;
|
||||
state->bak_videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bak_tilemap, offset / 2);
|
||||
}
|
||||
|
||||
VIDEO_START(aquarium)
|
||||
{
|
||||
aquarium_txt_tilemap = tilemap_create(machine, get_aquarium_txt_tile_info,tilemap_scan_rows, 8, 8,64,64);
|
||||
tilemap_set_transparent_pen(aquarium_txt_tilemap,0);
|
||||
aquarium_state *state = (aquarium_state *)machine->driver_data;
|
||||
state->txt_tilemap = tilemap_create(machine, get_aquarium_txt_tile_info, tilemap_scan_rows, 8, 8, 64, 64);
|
||||
state->bak_tilemap = tilemap_create(machine, get_aquarium_bak_tile_info, tilemap_scan_rows, 16, 16, 32, 32);
|
||||
state->mid_tilemap = tilemap_create(machine, get_aquarium_mid_tile_info, tilemap_scan_rows, 16, 16, 32, 32);
|
||||
|
||||
aquarium_bak_tilemap = tilemap_create(machine, get_aquarium_bak_tile_info,tilemap_scan_rows, 16, 16,32,32);
|
||||
aquarium_mid_tilemap = tilemap_create(machine, get_aquarium_mid_tile_info,tilemap_scan_rows, 16, 16,32,32);
|
||||
tilemap_set_transparent_pen(aquarium_mid_tilemap,0);
|
||||
tilemap_set_transparent_pen(state->txt_tilemap, 0);
|
||||
tilemap_set_transparent_pen(state->mid_tilemap, 0);
|
||||
}
|
||||
|
||||
VIDEO_UPDATE(aquarium)
|
||||
{
|
||||
tilemap_set_scrollx(aquarium_mid_tilemap, 0, aquarium_scroll[0]);
|
||||
tilemap_set_scrolly(aquarium_mid_tilemap, 0, aquarium_scroll[1]);
|
||||
tilemap_set_scrollx(aquarium_bak_tilemap, 0, aquarium_scroll[2]);
|
||||
tilemap_set_scrolly(aquarium_bak_tilemap, 0, aquarium_scroll[3]);
|
||||
tilemap_set_scrollx(aquarium_txt_tilemap, 0, aquarium_scroll[4]);
|
||||
tilemap_set_scrolly(aquarium_txt_tilemap, 0, aquarium_scroll[5]);
|
||||
aquarium_state *state = (aquarium_state *)screen->machine->driver_data;
|
||||
tilemap_set_scrollx(state->mid_tilemap, 0, state->scroll[0]);
|
||||
tilemap_set_scrolly(state->mid_tilemap, 0, state->scroll[1]);
|
||||
tilemap_set_scrollx(state->bak_tilemap, 0, state->scroll[2]);
|
||||
tilemap_set_scrolly(state->bak_tilemap, 0, state->scroll[3]);
|
||||
tilemap_set_scrollx(state->txt_tilemap, 0, state->scroll[4]);
|
||||
tilemap_set_scrolly(state->txt_tilemap, 0, state->scroll[5]);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,aquarium_bak_tilemap,0,0);
|
||||
tilemap_draw(bitmap,cliprect,aquarium_mid_tilemap,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->bak_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->mid_tilemap, 0, 0);
|
||||
|
||||
draw_sprites(screen->machine, bitmap,cliprect,16);
|
||||
draw_sprites(screen->machine, bitmap, cliprect, 16);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,aquarium_bak_tilemap,1,0);
|
||||
tilemap_draw(bitmap,cliprect,aquarium_mid_tilemap,1,0);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,aquarium_txt_tilemap,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->bak_tilemap, 1, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->mid_tilemap, 1, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->txt_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -9,27 +9,6 @@
|
||||
#include "video/resnet.h"
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Globals
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static double rweights[3], gweights[3], bweights[3];
|
||||
static bitmap_t *spritebitmap;
|
||||
|
||||
static UINT8 video_control[8];
|
||||
static UINT8 bitmode_addr[2];
|
||||
static UINT8 hscroll;
|
||||
static UINT8 vscroll;
|
||||
|
||||
static const UINT8 *syncprom;
|
||||
static const UINT8 *wpprom;
|
||||
static const UINT8 *priprom;
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Video startup
|
||||
@ -38,27 +17,28 @@ static const UINT8 *priprom;
|
||||
|
||||
VIDEO_START( ccastles )
|
||||
{
|
||||
ccastles_state *state = (ccastles_state *)machine->driver_data;
|
||||
static const int resistances[3] = { 22000, 10000, 4700 };
|
||||
|
||||
/* get pointers to our PROMs */
|
||||
syncprom = memory_region(machine, "proms") + 0x000;
|
||||
wpprom = memory_region(machine, "proms") + 0x200;
|
||||
priprom = memory_region(machine, "proms") + 0x300;
|
||||
state->syncprom = memory_region(machine, "proms") + 0x000;
|
||||
state->wpprom = memory_region(machine, "proms") + 0x200;
|
||||
state->priprom = memory_region(machine, "proms") + 0x300;
|
||||
|
||||
/* compute the color output resistor weights at startup */
|
||||
compute_resistor_weights(0, 255, -1.0,
|
||||
3, resistances, rweights, 1000, 0,
|
||||
3, resistances, gweights, 1000, 0,
|
||||
3, resistances, bweights, 1000, 0);
|
||||
3, resistances, state->rweights, 1000, 0,
|
||||
3, resistances, state->gweights, 1000, 0,
|
||||
3, resistances, state->bweights, 1000, 0);
|
||||
|
||||
/* allocate a bitmap for drawing sprites */
|
||||
spritebitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
|
||||
state->spritebitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
|
||||
|
||||
/* register for savestates */
|
||||
state_save_register_global_array(machine, video_control);
|
||||
state_save_register_global_array(machine, bitmode_addr);
|
||||
state_save_register_global(machine, hscroll);
|
||||
state_save_register_global(machine, vscroll);
|
||||
state_save_register_global_array(machine, state->video_control);
|
||||
state_save_register_global_array(machine, state->bitmode_addr);
|
||||
state_save_register_global(machine, state->hscroll);
|
||||
state_save_register_global(machine, state->vscroll);
|
||||
}
|
||||
|
||||
|
||||
@ -71,21 +51,24 @@ VIDEO_START( ccastles )
|
||||
|
||||
WRITE8_HANDLER( ccastles_hscroll_w )
|
||||
{
|
||||
ccastles_state *state = (ccastles_state *)space->machine->driver_data;
|
||||
video_screen_update_partial(space->machine->primary_screen, video_screen_get_vpos(space->machine->primary_screen));
|
||||
hscroll = data;
|
||||
state->hscroll = data;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( ccastles_vscroll_w )
|
||||
{
|
||||
vscroll = data;
|
||||
ccastles_state *state = (ccastles_state *)space->machine->driver_data;
|
||||
state->vscroll = data;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( ccastles_video_control_w )
|
||||
{
|
||||
ccastles_state *state = (ccastles_state *)space->machine->driver_data;
|
||||
/* only D3 matters */
|
||||
video_control[offset] = (data >> 3) & 1;
|
||||
state->video_control[offset] = (data >> 3) & 1;
|
||||
}
|
||||
|
||||
|
||||
@ -98,6 +81,7 @@ WRITE8_HANDLER( ccastles_video_control_w )
|
||||
|
||||
WRITE8_HANDLER( ccastles_paletteram_w )
|
||||
{
|
||||
ccastles_state *state = (ccastles_state *)space->machine->driver_data;
|
||||
int bit0, bit1, bit2;
|
||||
int r, g, b;
|
||||
|
||||
@ -110,19 +94,19 @@ WRITE8_HANDLER( ccastles_paletteram_w )
|
||||
bit0 = (~r >> 0) & 0x01;
|
||||
bit1 = (~r >> 1) & 0x01;
|
||||
bit2 = (~r >> 2) & 0x01;
|
||||
r = combine_3_weights(rweights, bit0, bit1, bit2);
|
||||
r = combine_3_weights(state->rweights, bit0, bit1, bit2);
|
||||
|
||||
/* green component (inverted) */
|
||||
bit0 = (~g >> 0) & 0x01;
|
||||
bit1 = (~g >> 1) & 0x01;
|
||||
bit2 = (~g >> 2) & 0x01;
|
||||
g = combine_3_weights(gweights, bit0, bit1, bit2);
|
||||
g = combine_3_weights(state->gweights, bit0, bit1, bit2);
|
||||
|
||||
/* blue component (inverted) */
|
||||
bit0 = (~b >> 0) & 0x01;
|
||||
bit1 = (~b >> 1) & 0x01;
|
||||
bit2 = (~b >> 2) & 0x01;
|
||||
b = combine_3_weights(bweights, bit0, bit1, bit2);
|
||||
b = combine_3_weights(state->bweights, bit0, bit1, bit2);
|
||||
|
||||
palette_set_color(space->machine, offset & 0x1f, MAKE_RGB(r, g, b));
|
||||
}
|
||||
@ -136,9 +120,10 @@ WRITE8_HANDLER( ccastles_paletteram_w )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
INLINE void ccastles_write_vram(UINT16 addr, UINT8 data, UINT8 bitmd, UINT8 pixba)
|
||||
INLINE void ccastles_write_vram( running_machine *machine, UINT16 addr, UINT8 data, UINT8 bitmd, UINT8 pixba )
|
||||
{
|
||||
UINT8 *dest = &videoram[addr & 0x7ffe];
|
||||
ccastles_state *state = (ccastles_state *)machine->driver_data;
|
||||
UINT8 *dest = &state->videoram[addr & 0x7ffe];
|
||||
UINT8 promaddr = 0;
|
||||
UINT8 wpbits;
|
||||
|
||||
@ -161,7 +146,7 @@ INLINE void ccastles_write_vram(UINT16 addr, UINT8 data, UINT8 bitmd, UINT8 pixb
|
||||
promaddr |= (pixba << 0);
|
||||
|
||||
/* look up the PROM result */
|
||||
wpbits = wpprom[promaddr];
|
||||
wpbits = state->wpprom[promaddr];
|
||||
|
||||
/* write to the appropriate parts of VRAM depending on the result */
|
||||
if (!(wpbits & 1))
|
||||
@ -182,24 +167,26 @@ INLINE void ccastles_write_vram(UINT16 addr, UINT8 data, UINT8 bitmd, UINT8 pixb
|
||||
*
|
||||
*************************************/
|
||||
|
||||
INLINE void bitmode_autoinc(void)
|
||||
INLINE void bitmode_autoinc( running_machine *machine )
|
||||
{
|
||||
ccastles_state *state = (ccastles_state *)machine->driver_data;
|
||||
|
||||
/* auto increment in the x-direction if it's enabled */
|
||||
if (!video_control[0]) /* /AX */
|
||||
if (!state->video_control[0]) /* /AX */
|
||||
{
|
||||
if (!video_control[2]) /* /XINC */
|
||||
bitmode_addr[0]++;
|
||||
if (!state->video_control[2]) /* /XINC */
|
||||
state->bitmode_addr[0]++;
|
||||
else
|
||||
bitmode_addr[0]--;
|
||||
state->bitmode_addr[0]--;
|
||||
}
|
||||
|
||||
/* auto increment in the y-direction if it's enabled */
|
||||
if (!video_control[1]) /* /AY */
|
||||
if (!state->video_control[1]) /* /AY */
|
||||
{
|
||||
if (!video_control[3]) /* /YINC */
|
||||
bitmode_addr[1]++;
|
||||
if (!state->video_control[3]) /* /YINC */
|
||||
state->bitmode_addr[1]++;
|
||||
else
|
||||
bitmode_addr[1]--;
|
||||
state->bitmode_addr[1]--;
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,7 +201,7 @@ INLINE void bitmode_autoinc(void)
|
||||
WRITE8_HANDLER( ccastles_videoram_w )
|
||||
{
|
||||
/* direct writes to VRAM go through the write protect PROM as well */
|
||||
ccastles_write_vram(offset, data, 0, 0);
|
||||
ccastles_write_vram(space->machine, offset, data, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -227,14 +214,16 @@ WRITE8_HANDLER( ccastles_videoram_w )
|
||||
|
||||
READ8_HANDLER( ccastles_bitmode_r )
|
||||
{
|
||||
ccastles_state *state = (ccastles_state *)space->machine->driver_data;
|
||||
|
||||
/* in bitmode, the address comes from the autoincrement latches */
|
||||
UINT16 addr = (bitmode_addr[1] << 7) | (bitmode_addr[0] >> 1);
|
||||
UINT16 addr = (state->bitmode_addr[1] << 7) | (state->bitmode_addr[0] >> 1);
|
||||
|
||||
/* the appropriate pixel is selected into the upper 4 bits */
|
||||
UINT8 result = videoram[addr] << ((~bitmode_addr[0] & 1) * 4);
|
||||
UINT8 result = state->videoram[addr] << ((~state->bitmode_addr[0] & 1) * 4);
|
||||
|
||||
/* autoincrement because /BITMD was selected */
|
||||
bitmode_autoinc();
|
||||
bitmode_autoinc(space->machine);
|
||||
|
||||
/* the low 4 bits of the data lines are not driven so make them all 1's */
|
||||
return result | 0x0f;
|
||||
@ -243,25 +232,29 @@ READ8_HANDLER( ccastles_bitmode_r )
|
||||
|
||||
WRITE8_HANDLER( ccastles_bitmode_w )
|
||||
{
|
||||
ccastles_state *state = (ccastles_state *)space->machine->driver_data;
|
||||
|
||||
/* in bitmode, the address comes from the autoincrement latches */
|
||||
UINT16 addr = (bitmode_addr[1] << 7) | (bitmode_addr[0] >> 1);
|
||||
UINT16 addr = (state->bitmode_addr[1] << 7) | (state->bitmode_addr[0] >> 1);
|
||||
|
||||
/* the upper 4 bits of data are replicated to the lower 4 bits */
|
||||
data = (data & 0xf0) | (data >> 4);
|
||||
|
||||
/* write through the generic VRAM routine, passing the low 2 X bits as PIXB/PIXA */
|
||||
ccastles_write_vram(addr, data, 1, bitmode_addr[0] & 3);
|
||||
ccastles_write_vram(space->machine, addr, data, 1, state->bitmode_addr[0] & 3);
|
||||
|
||||
/* autoincrement because /BITMD was selected */
|
||||
bitmode_autoinc();
|
||||
bitmode_autoinc(space->machine);
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( ccastles_bitmode_addr_w )
|
||||
{
|
||||
ccastles_state *state = (ccastles_state *)space->machine->driver_data;
|
||||
|
||||
/* write through to video RAM and also to the addressing latches */
|
||||
ccastles_write_vram(offset, data, 0, 0);
|
||||
bitmode_addr[offset] = data;
|
||||
ccastles_write_vram(space->machine, offset, data, 0, 0);
|
||||
state->bitmode_addr[offset] = data;
|
||||
}
|
||||
|
||||
|
||||
@ -274,21 +267,22 @@ WRITE8_HANDLER( ccastles_bitmode_addr_w )
|
||||
|
||||
VIDEO_UPDATE( ccastles )
|
||||
{
|
||||
UINT8 *spriteaddr = &spriteram[video_control[7] * 0x100]; /* BUF1/BUF2 */
|
||||
int flip = video_control[4] ? 0xff : 0x00; /* PLAYER2 */
|
||||
ccastles_state *state = (ccastles_state *)screen->machine->driver_data;
|
||||
UINT8 *spriteaddr = &state->spriteram[state->video_control[7] * 0x100]; /* BUF1/BUF2 */
|
||||
int flip = state->video_control[4] ? 0xff : 0x00; /* PLAYER2 */
|
||||
pen_t black = get_black_pen(screen->machine);
|
||||
int x, y, offs;
|
||||
|
||||
/* draw the sprites */
|
||||
bitmap_fill(spritebitmap, cliprect, 0x0f);
|
||||
bitmap_fill(state->spritebitmap, cliprect, 0x0f);
|
||||
for (offs = 0; offs < 320/2; offs += 4)
|
||||
{
|
||||
int x = spriteaddr[offs+3];
|
||||
int y = 256 - 16 - spriteaddr[offs+1];
|
||||
int x = spriteaddr[offs + 3];
|
||||
int y = 256 - 16 - spriteaddr[offs + 1];
|
||||
int which = spriteaddr[offs];
|
||||
int color = spriteaddr[offs+2] >> 7;
|
||||
int color = spriteaddr[offs + 2] >> 7;
|
||||
|
||||
drawgfx_transpen(spritebitmap, cliprect, screen->machine->gfx[0], which, color, flip, flip, x, y, 7);
|
||||
drawgfx_transpen(state->spritebitmap, cliprect, screen->machine->gfx[0], which, color, flip, flip, x, y, 7);
|
||||
}
|
||||
|
||||
/* draw the bitmap to the screen, looping over Y */
|
||||
@ -297,7 +291,7 @@ VIDEO_UPDATE( ccastles )
|
||||
UINT16 *dst = (UINT16 *)bitmap->base + y * bitmap->rowpixels;
|
||||
|
||||
/* if we're in the VBLANK region, just fill with black */
|
||||
if (syncprom[y] & 1)
|
||||
if (state->syncprom[y] & 1)
|
||||
{
|
||||
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
|
||||
dst[x] = black;
|
||||
@ -306,14 +300,14 @@ VIDEO_UPDATE( ccastles )
|
||||
/* non-VBLANK region: merge the sprites and the bitmap */
|
||||
else
|
||||
{
|
||||
UINT16 *mosrc = (UINT16 *)spritebitmap->base + y * spritebitmap->rowpixels;
|
||||
int effy = (((y - ccastles_vblank_end) + (flip ? 0 : vscroll)) ^ flip) & 0xff;
|
||||
UINT16 *mosrc = (UINT16 *)state->spritebitmap->base + y * state->spritebitmap->rowpixels;
|
||||
int effy = (((y - state->vblank_end) + (flip ? 0 : state->vscroll)) ^ flip) & 0xff;
|
||||
UINT8 *src;
|
||||
|
||||
/* the "POTATO" chip does some magic here; this is just a guess */
|
||||
if (effy < 24)
|
||||
effy = 24;
|
||||
src = &videoram[effy * 128];
|
||||
src = &state->videoram[effy * 128];
|
||||
|
||||
/* loop over X */
|
||||
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
|
||||
@ -325,7 +319,7 @@ VIDEO_UPDATE( ccastles )
|
||||
/* otherwise, process normally */
|
||||
else
|
||||
{
|
||||
int effx = (hscroll + (x ^ flip)) & 255;
|
||||
int effx = (state->hscroll + (x ^ flip)) & 255;
|
||||
|
||||
/* low 4 bits = left pixel, high 4 bits = right pixel */
|
||||
UINT8 pix = (src[effx / 2] >> ((effx & 1) * 4)) & 0x0f;
|
||||
@ -347,7 +341,7 @@ VIDEO_UPDATE( ccastles )
|
||||
prindex |= (mopix & 7) << 2;
|
||||
prindex |= (mopix & 8) >> 2;
|
||||
prindex |= (pix & 8) >> 3;
|
||||
prvalue = priprom[prindex];
|
||||
prvalue = state->priprom[prindex];
|
||||
|
||||
/* Bit 1 of prvalue selects the low 4 bits of the final pixel */
|
||||
if (prvalue & 2)
|
||||
|
Loading…
Reference in New Issue
Block a user