Merge pull request #47 from cuavas/master

tilemap.c internal documentation update; dooyong.c cleanups; prehisle.c pdrawgfx conversion
This commit is contained in:
Alex W. Jackson 2014-11-15 20:37:32 -05:00
commit 02fc842fe9
7 changed files with 635 additions and 606 deletions

View File

@ -36,7 +36,7 @@
category (optional): specifies one of 16 categories for the category (optional): specifies one of 16 categories for the
pixels in the tile; the category controls which tiles are pixels in the tile; the category controls which tiles are
rendered during a tilemap_draw() call rendered during a tilemap::draw() call
group (optional): specifies one of 256 groups for pen mapping; group (optional): specifies one of 256 groups for pen mapping;
each pen in the tile is looked up in a table to determine each pen in the tile is looked up in a table to determine
@ -81,24 +81,26 @@
all tiles rendered. all tiles rendered.
Flagsmap = an 8bpp bitmap containing per-pixel flags, Flagsmap = an 8bpp bitmap containing per-pixel flags,
specifically the category (specified in bits 0-3) and specifically the category (specified in bits 0-3) and the
the layer (specified in bits 4-6). layer (specified in bits 4-6).
**************************************************************************** ****************************************************************************
How to use a tilemap: How to use a tilemap:
1. First create a new tilemap by calling tilemap_create(). The 1. First create a new tilemap by calling tilemap_manager::create().
parameters are as follows: The parameters are as follows:
tile_get_info = pointer to a callback function which accepts a decoder = reference to your device_gfx_interface
memory index and in return fills in a tile_info structure
that describes the characteristics of a tile; this function
will be called whenever a dirty tile needs to be rendered
mapper = pointer to a callback function which maps the logical tile_get_info = callback function which accepts a memory index
column and row to a memory index; several standard mappers and in return fills in a tile_data structure that describes
are provided, with tilemap_scan_rows being the most common the characteristics of a tile; this function will be called
whenever a dirty tile needs to be rendered
mapper = callback function which maps the logical column and row
to a memory index; several standard mappers are provided,
with TILEMAP_SCAN_ROWS being the most common
tilewidth = the width, in pixels, of each individual tile tilewidth = the width, in pixels, of each individual tile
@ -112,39 +114,40 @@
Common configuration tasks include: Common configuration tasks include:
* marking one of the pens as transparent via * marking one of the pens as transparent via
tilemap_set_transparent_pen() tilemap_t::set_transparent_pen()
* performing more complex pen-to-layer mapping via * performing more complex pen-to-layer mapping via
tilemap_map_pen_to_layer() or tilemap_t::map_pen_to_layer() or
tilemap_map_pens_to_layer() tilemap_t::map_pens_to_layer()
* configuring global scroll offsets via * configuring global scroll offsets via
tilemap_set_scrolldx() and tilemap_set_scrolldy() tilemap_t::set_scrolldx() and tilemap_t::set_scrolldy()
* specifying a pointer that is passed to your tile_get_info * specifying a pointer that can be read back later (e.g. in
callback via tilemap_set_user_data() your tile_get_info callback) via
tilemap_t::set_user_data()
* setting a global palette offset via * setting a global palette offset via
tilemap_set_palette_offset() tilemap_t::set_palette_offset()
3. In your memory write handlers for the tile memory, anytime tile 3. In your memory write handlers for the tile memory, anytime tile
data is modified, you need to mark the tile dirty so that it is data is modified, you need to mark the tile dirty so that it is
re-rendered with the new data the next time the tilemap is drawn. re-rendered with the new data the next time the tilemap is drawn.
Use tilemap_mark_tile_dirty() and pass in the memory index. Use tilemap_t::mark_tile_dirty() and pass in the memory index.
4. In your handlers for scrolling, update the scroll values for the 4. In your handlers for scrolling, update the scroll values for the
tilemap via tilemap_set_scrollx() and tilemap_set_scrolly(). tilemap via tilemap_t::set_scrollx() and tilemap_t::set_scrolly().
5. If any other major characteristics of the tilemap change (generally 5. If any other major characteristics of the tilemap change (generally
any global state that is used by the tile_get_info callback but any global state that is used by the tile_get_info callback but
which is not reported via other calls to the tilemap code), you which is not reported via other calls to the tilemap code), you
should invalidate the entire tilemap. You can do this by calling should invalidate the entire tilemap. You can do this by calling
tilemap_mark_all_tiles_dirty(). tilemap_t::mark_all_dirty().
6. In your VIDEO_UPDATE callback, render the tiles by calling 6. In your VIDEO_UPDATE callback, render the tiles by calling
tilemap_draw() or tilemap_draw_roz(). If you need to do custom tilemap_t::draw() or tilemap_t::draw_roz(). If you need to do
rendering and want access to the raw pixels, call custom rendering and want access to the raw pixels, call
tilemap_get_pixmap() to get a pointer to the updated bitmap_ind16 tilemap_t::pixmap() to get a reference to the updated bitmap_ind16
containing the tilemap graphics. containing the tilemap graphics.
**************************************************************************** ****************************************************************************
@ -157,10 +160,11 @@
tilemap_t *tmap; tilemap_t *tmap;
UINT16 *my_tmap_memory; UINT16 *my_tmap_memory;
required_device<gfxdecode_device> gfxdecode;
TILE_GET_INFO( my_get_info ) TILE_GET_INFO_MEMBER( my_state::my_get_info )
{ {
UINT8 tiledata = my_tmap_memory[tile_index]; UINT16 tiledata = my_tmap_memory[tile_index];
UINT8 code = tiledata & 0xff; UINT8 code = tiledata & 0xff;
UINT8 color = (tiledata >> 8) & 0x1f; UINT8 color = (tiledata >> 8) & 0x1f;
UINT8 flipx = (tiledata >> 13) & 1; UINT8 flipx = (tiledata >> 13) & 1;
@ -168,12 +172,12 @@
UINT8 category = (tiledata >> 15) & 1; UINT8 category = (tiledata >> 15) & 1;
// set the common info for the tile // set the common info for the tile
SET_TILE_INFO( tileinfo.set(
1, // use m_gfxdecode->gfx(1) for tile graphics 1, // use gfxdecode->gfx(1) for tile graphics
code, // the index of the graphics for this tile code, // the index of the graphics for this tile
color, // the color to use for this tile color, // the color to use for this tile
(flipx ? TILE_FLIPX : 0) | // flags for this tile; also (flipx ? TILE_FLIPX : 0) | // flags for this tile; also
(flipy ? TILE_FLIPY : 0); // see the FLIP_YX macro (flipy ? TILE_FLIPY : 0) // see the FLIP_YX macro
); );
// set the category of each tile based on the high bit; this // set the category of each tile based on the high bit; this
@ -181,41 +185,43 @@
tileinfo.category = category; tileinfo.category = category;
} }
VIDEO_START( mydriver ) VIDEO_START_MEMBER( my_state, my_driver )
{ {
// first create the tilemap // first create the tilemap
tmap = tilemap_create(machine, tmap = &machine().tilemap().create(
my_get_info, // pointer to your get_info gfxdecode,
tilemap_scan_rows, // standard row-major mapper tilemap_get_info_delegate(FUNC(my_state::my_get_info), this),
TILEMAP_SCAN_ROWS, // standard row-major mapper
8,8, // 8x8 tiles 8,8, // 8x8 tiles
64,32); // 64 columns, 32 rows 64,32); // 64 columns, 32 rows
// then set the transparent pen; all other pens will default // then set the transparent pen; all other pens will default
// to being part of layer 0 // to being part of layer 0
tilemap_set_transparent_pen(tmap, 0); tmap.set_transparent_pen(0);
} }
SCREEN_UPDATE( mydriver ) UINT32 my_state::screen_update_mydriver(
screen_device &screen,
bitmap_ind16 &bitmap,
const rectangle &cliprect)
{ {
// draw the tilemap first, fully opaque since it needs to // draw the tilemap first, fully opaque since it needs to
// erase all previous pixels // erase all previous pixels
tilemap_draw( tmap->draw(
screen, // destination screen
bitmap, // destination bitmap bitmap, // destination bitmap
cliprect, // clipping rectangle cliprect, // clipping rectangle
tmap, // tilemap to draw TILEMAP_DRAW_OPAQUE); // flags
TILEMAP_DRAW_OPAQUE, // flags
0); // don't use priority_bitmap
// next draw the sprites // next draw the sprites
my_draw_sprites(); my_draw_sprites();
// then draw the tiles which have priority over sprites // then draw the tiles which have priority over sprites
tilemap_draw( tmap->draw(
screen, // destination screen
bitmap, // destination bitmap bitmap, // destination bitmap
cliprect, // clipping rectangle cliprect, // clipping rectangle
tmap, // tilemap to draw TILEMAP_DRAW_CATEGORY(1));// flags: draw category 1
TILEMAP_DRAW_CATEGORY(1),// flags: draw category 1
0); // don't use priority_bitmap
return 0; return 0;
} }
@ -237,7 +243,7 @@
TILEMAP_TRANSPARENT: This described a tilemap with a single TILEMAP_TRANSPARENT: This described a tilemap with a single
transparent pen. To create the same effect, call transparent pen. To create the same effect, call
tilemap_set_transparent_pen() to specify which pen is tilemap_t::set_transparent_pen() to specify which pen is
transparent; all other pens will map to layer 0. transparent; all other pens will map to layer 0.
TILEMAP_BITMASK: This type is no longer special; with the new TILEMAP_BITMASK: This type is no longer special; with the new
@ -250,7 +256,7 @@
also allowed for you to choose one of 4 mappings on a per-tile also allowed for you to choose one of 4 mappings on a per-tile
basis. All of this functionality is now expanded: you can basis. All of this functionality is now expanded: you can
specify one of 3 layers and can choose from one of 256 mappings specify one of 3 layers and can choose from one of 256 mappings
on a per-tile basis. You just call tilemap_set_transmask(), on a per-tile basis. You just call tilemap_t::set_transmask(),
which still exists but maps onto the new behavior. The "front" which still exists but maps onto the new behavior. The "front"
layer is now "layer 0" and the "back" layer is now "layer 1". layer is now "layer 0" and the "back" layer is now "layer 1".
@ -275,16 +281,16 @@
TILEMAP_DRAW_LAYER0 is assumed. TILEMAP_DRAW_LAYER0 is assumed.
* If you want to render with alpha blending, you can call * If you want to render with alpha blending, you can call
tilemap_draw() with the TILEMAP_DRAW_ALPHA flag. tilemap_t::draw() with the TILEMAP_DRAW_ALPHA flag.
* To configure more complex pen-to-layer mapping, use the * To configure more complex pen-to-layer mapping, use the
tilemap_map_pens_to_layer() call. This call takes a group number tilemap_t::map_pens_to_layer() call. This call takes a group
so that you can configure 1 of the 256 groups independently. number so that you can configure 1 of the 256 groups
It also takes a pen and a mask; the mapping is updated for all independently. It also takes a pen and a mask; the mapping is
pens where ((pennum & mask) == pen). To set all the pens in a updated for all pens where ((pennum & mask) == pen). To set all
group to the same value, pass a mask of 0. To set a single pen in the pens in a group to the same value, pass a mask of 0. To set
a group, pass a mask of ~0. The helper function a single pen in a group, pass a mask of ~0. The helper function
tilemap_map_pen_to_layer() does this for you. tilemap_t::map_pen_to_layer() does this for you.
***************************************************************************/ ***************************************************************************/
@ -306,7 +312,7 @@
#define TILEMAP_NUM_GROUPS 256 #define TILEMAP_NUM_GROUPS 256
// these flags control tilemap_draw() behavior // these flags control tilemap_t::draw() behavior
const UINT32 TILEMAP_DRAW_CATEGORY_MASK = 0x0f; // specify the category to draw const UINT32 TILEMAP_DRAW_CATEGORY_MASK = 0x0f; // specify the category to draw
const UINT32 TILEMAP_DRAW_LAYER0 = 0x10; // draw layer 0 const UINT32 TILEMAP_DRAW_LAYER0 = 0x10; // draw layer 0
const UINT32 TILEMAP_DRAW_LAYER1 = 0x20; // draw layer 1 const UINT32 TILEMAP_DRAW_LAYER1 = 0x20; // draw layer 1
@ -329,7 +335,7 @@ const UINT8 TILE_FORCE_LAYER0 = TILEMAP_PIXEL_LAYER0; // force all pixels to be
const UINT8 TILE_FORCE_LAYER1 = TILEMAP_PIXEL_LAYER1; // force all pixels to be layer 1 (no transparency) const UINT8 TILE_FORCE_LAYER1 = TILEMAP_PIXEL_LAYER1; // force all pixels to be layer 1 (no transparency)
const UINT8 TILE_FORCE_LAYER2 = TILEMAP_PIXEL_LAYER2; // force all pixels to be layer 2 (no transparency) const UINT8 TILE_FORCE_LAYER2 = TILEMAP_PIXEL_LAYER2; // force all pixels to be layer 2 (no transparency)
// tilemap global flags, used by tilemap_set_flip() // tilemap global flags, used by tilemap_t::set_flip()
const UINT32 TILEMAP_FLIPX = TILE_FLIPX; // draw the tilemap horizontally flipped const UINT32 TILEMAP_FLIPX = TILE_FLIPX; // draw the tilemap horizontally flipped
const UINT32 TILEMAP_FLIPY = TILE_FLIPY; // draw the tilemap vertically flipped const UINT32 TILEMAP_FLIPY = TILE_FLIPY; // draw the tilemap vertically flipped
@ -767,7 +773,7 @@ private:
// MACROS // MACROS
//************************************************************************** //**************************************************************************
// macros to help form flags for tilemap_draw // macros to help form flags for tilemap_t::draw
#define TILEMAP_DRAW_CATEGORY(x) (x) // specify category to draw #define TILEMAP_DRAW_CATEGORY(x) (x) // specify category to draw
#define TILEMAP_DRAW_ALPHA(x) (TILEMAP_DRAW_ALPHA_FLAG | (rgb_t::clamp(x) << 24)) #define TILEMAP_DRAW_ALPHA(x) (TILEMAP_DRAW_ALPHA_FLAG | (rgb_t::clamp(x) << 24))

View File

@ -84,27 +84,27 @@ be verified on real PCB.
#include "sound/okim6295.h" #include "sound/okim6295.h"
#include "includes/dooyong.h" #include "includes/dooyong.h"
WRITE8_MEMBER(dooyong_state::lastday_bankswitch_w) WRITE8_MEMBER(dooyong_z80_state::bankswitch_w)
{ {
membank("bank1")->set_entry(data & 0x07); membank("bank1")->set_entry(data & 0x07);
if (data & 0xf8) popmessage("bankswitch %02x",data); if (data & 0xf8) popmessage("bankswitch %02x",data);
} }
MACHINE_START_MEMBER(dooyong_state,lastday) MACHINE_START_MEMBER(dooyong_z80_state, cpu_z80)
{ {
membank("bank1")->configure_entries(0, 8, memregion("maincpu")->base() + 0x10000, 0x4000); membank("bank1")->configure_entries(0, 8, memregion("maincpu")->base() + 0x10000, 0x4000);
} }
WRITE8_MEMBER(dooyong_state::flip_screen_w) WRITE8_MEMBER(dooyong_z80_state::flip_screen_w)
{ {
flip_screen_set(data); flip_screen_set(data);
} }
MACHINE_RESET_MEMBER(dooyong_state,sound_ym2203) MACHINE_RESET_MEMBER(dooyong_z80_ym2203_state, sound_ym2203)
{ {
m_interrupt_line_1=0; m_interrupt_line_1 = 0;
m_interrupt_line_2=0; m_interrupt_line_2 = 0;
} }
/*************************************************************************** /***************************************************************************
@ -113,63 +113,63 @@ MACHINE_RESET_MEMBER(dooyong_state,sound_ym2203)
***************************************************************************/ ***************************************************************************/
static ADDRESS_MAP_START( lastday_map, AS_PROGRAM, 8, dooyong_state ) static ADDRESS_MAP_START( lastday_map, AS_PROGRAM, 8, dooyong_z80_ym2203_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
AM_RANGE(0xc000, 0xc007) AM_WRITE(dooyong_bgscroll8_w) AM_RANGE(0xc000, 0xc007) AM_WRITE(bgscroll_w)
AM_RANGE(0xc008, 0xc00f) AM_WRITE(dooyong_fgscroll8_w) AM_RANGE(0xc008, 0xc00f) AM_WRITE(fgscroll_w)
AM_RANGE(0xc010, 0xc010) AM_READ_PORT("SYSTEM") AM_RANGE(0xc010, 0xc010) AM_READ_PORT("SYSTEM")
AM_RANGE(0xc010, 0xc010) AM_WRITE(lastday_ctrl_w) /* coin counter, flip screen */ AM_RANGE(0xc010, 0xc010) AM_WRITE(lastday_ctrl_w) /* coin counter, flip screen */
AM_RANGE(0xc011, 0xc011) AM_READ_PORT("P1") AM_RANGE(0xc011, 0xc011) AM_READ_PORT("P1")
AM_RANGE(0xc011, 0xc011) AM_WRITE(lastday_bankswitch_w) AM_RANGE(0xc011, 0xc011) AM_WRITE(bankswitch_w)
AM_RANGE(0xc012, 0xc012) AM_READ_PORT("P2") AM_RANGE(0xc012, 0xc012) AM_READ_PORT("P2")
AM_RANGE(0xc012, 0xc012) AM_WRITE(soundlatch_byte_w) AM_RANGE(0xc012, 0xc012) AM_WRITE(soundlatch_byte_w)
AM_RANGE(0xc013, 0xc013) AM_READ_PORT("DSWA") AM_RANGE(0xc013, 0xc013) AM_READ_PORT("DSWA")
AM_RANGE(0xc014, 0xc014) AM_READ_PORT("DSWB") AM_RANGE(0xc014, 0xc014) AM_READ_PORT("DSWB")
AM_RANGE(0xc800, 0xcfff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0xc800, 0xcfff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(dooyong_txvideoram8_w) AM_SHARE("txvideoram") AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(txvideoram_w) AM_SHARE("txvideoram")
AM_RANGE(0xe000, 0xefff) AM_RAM AM_RANGE(0xe000, 0xefff) AM_RAM
AM_RANGE(0xf000, 0xffff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0xf000, 0xffff) AM_RAM AM_SHARE("spriteram")
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( pollux_map, AS_PROGRAM, 8, dooyong_state ) static ADDRESS_MAP_START( pollux_map, AS_PROGRAM, 8, dooyong_z80_ym2203_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
AM_RANGE(0xc000, 0xcfff) AM_RAM AM_RANGE(0xc000, 0xcfff) AM_RAM
AM_RANGE(0xd000, 0xdfff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0xd000, 0xdfff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(dooyong_txvideoram8_w) AM_SHARE("txvideoram") AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(txvideoram_w) AM_SHARE("txvideoram")
AM_RANGE(0xf000, 0xf000) AM_READ_PORT("DSWA") AM_WRITE(lastday_bankswitch_w) AM_RANGE(0xf000, 0xf000) AM_READ_PORT("DSWA") AM_WRITE(bankswitch_w)
AM_RANGE(0xf001, 0xf001) AM_READ_PORT("DSWB") AM_RANGE(0xf001, 0xf001) AM_READ_PORT("DSWB")
AM_RANGE(0xf002, 0xf002) AM_READ_PORT("P1") AM_RANGE(0xf002, 0xf002) AM_READ_PORT("P1")
AM_RANGE(0xf003, 0xf003) AM_READ_PORT("P2") AM_RANGE(0xf003, 0xf003) AM_READ_PORT("P2")
AM_RANGE(0xf004, 0xf004) AM_READ_PORT("SYSTEM") AM_RANGE(0xf004, 0xf004) AM_READ_PORT("SYSTEM")
AM_RANGE(0xf008, 0xf008) AM_WRITE(pollux_ctrl_w) /* coin counter, flip screen */ AM_RANGE(0xf008, 0xf008) AM_WRITE(pollux_ctrl_w) /* coin counter, flip screen */
AM_RANGE(0xf010, 0xf010) AM_WRITE(soundlatch_byte_w) AM_RANGE(0xf010, 0xf010) AM_WRITE(soundlatch_byte_w)
AM_RANGE(0xf018, 0xf01f) AM_WRITE(dooyong_bgscroll8_w) AM_RANGE(0xf018, 0xf01f) AM_WRITE(bgscroll_w)
AM_RANGE(0xf020, 0xf027) AM_WRITE(dooyong_fgscroll8_w) AM_RANGE(0xf020, 0xf027) AM_WRITE(fgscroll_w)
AM_RANGE(0xf800, 0xffff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0xf800, 0xffff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( gulfstrm_map, AS_PROGRAM, 8, dooyong_state ) static ADDRESS_MAP_START( gulfstrm_map, AS_PROGRAM, 8, dooyong_z80_ym2203_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
AM_RANGE(0xc000, 0xcfff) AM_RAM AM_RANGE(0xc000, 0xcfff) AM_RAM
AM_RANGE(0xd000, 0xdfff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0xd000, 0xdfff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(dooyong_txvideoram8_w) AM_SHARE("txvideoram") AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(txvideoram_w) AM_SHARE("txvideoram")
AM_RANGE(0xf000, 0xf000) AM_READ_PORT("DSWA") AM_RANGE(0xf000, 0xf000) AM_READ_PORT("DSWA")
AM_RANGE(0xf000, 0xf000) AM_WRITE(lastday_bankswitch_w) AM_RANGE(0xf000, 0xf000) AM_WRITE(bankswitch_w)
AM_RANGE(0xf001, 0xf001) AM_READ_PORT("DSWB") AM_RANGE(0xf001, 0xf001) AM_READ_PORT("DSWB")
AM_RANGE(0xf002, 0xf002) AM_READ_PORT("P2") AM_RANGE(0xf002, 0xf002) AM_READ_PORT("P2")
AM_RANGE(0xf003, 0xf003) AM_READ_PORT("P1") AM_RANGE(0xf003, 0xf003) AM_READ_PORT("P1")
AM_RANGE(0xf004, 0xf004) AM_READ_PORT("SYSTEM") AM_RANGE(0xf004, 0xf004) AM_READ_PORT("SYSTEM")
AM_RANGE(0xf008, 0xf008) AM_WRITE(pollux_ctrl_w) /* coin counter, flip screen */ AM_RANGE(0xf008, 0xf008) AM_WRITE(pollux_ctrl_w) /* coin counter, flip screen */
AM_RANGE(0xf010, 0xf010) AM_WRITE(soundlatch_byte_w) AM_RANGE(0xf010, 0xf010) AM_WRITE(soundlatch_byte_w)
AM_RANGE(0xf018, 0xf01f) AM_WRITE(dooyong_bgscroll8_w) AM_RANGE(0xf018, 0xf01f) AM_WRITE(bgscroll_w)
AM_RANGE(0xf020, 0xf027) AM_WRITE(dooyong_fgscroll8_w) AM_RANGE(0xf020, 0xf027) AM_WRITE(fgscroll_w)
AM_RANGE(0xf800, 0xffff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0xf800, 0xffff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( bluehawk_map, AS_PROGRAM, 8, dooyong_state ) static ADDRESS_MAP_START( bluehawk_map, AS_PROGRAM, 8, dooyong_z80_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
AM_RANGE(0xc000, 0xc000) AM_READ_PORT("DSWA") AM_RANGE(0xc000, 0xc000) AM_READ_PORT("DSWA")
@ -178,42 +178,42 @@ static ADDRESS_MAP_START( bluehawk_map, AS_PROGRAM, 8, dooyong_state )
AM_RANGE(0xc002, 0xc002) AM_READ_PORT("P1") AM_RANGE(0xc002, 0xc002) AM_READ_PORT("P1")
AM_RANGE(0xc003, 0xc003) AM_READ_PORT("P2") AM_RANGE(0xc003, 0xc003) AM_READ_PORT("P2")
AM_RANGE(0xc004, 0xc004) AM_READ_PORT("SYSTEM") AM_RANGE(0xc004, 0xc004) AM_READ_PORT("SYSTEM")
AM_RANGE(0xc008, 0xc008) AM_WRITE(lastday_bankswitch_w) AM_RANGE(0xc008, 0xc008) AM_WRITE(bankswitch_w)
AM_RANGE(0xc010, 0xc010) AM_WRITE(soundlatch_byte_w) AM_RANGE(0xc010, 0xc010) AM_WRITE(soundlatch_byte_w)
AM_RANGE(0xc018, 0xc01f) AM_WRITE(dooyong_fg2scroll8_w) AM_RANGE(0xc018, 0xc01f) AM_WRITE(fg2scroll_w)
AM_RANGE(0xc040, 0xc047) AM_WRITE(dooyong_bgscroll8_w) AM_RANGE(0xc040, 0xc047) AM_WRITE(bgscroll_w)
AM_RANGE(0xc048, 0xc04f) AM_WRITE(dooyong_fgscroll8_w) AM_RANGE(0xc048, 0xc04f) AM_WRITE(fgscroll_w)
AM_RANGE(0xc800, 0xcfff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0xc800, 0xcfff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(dooyong_txvideoram8_w) AM_SHARE("txvideoram") AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(txvideoram_w) AM_SHARE("txvideoram")
AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0xf000, 0xffff) AM_RAM AM_RANGE(0xf000, 0xffff) AM_RAM
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( flytiger_map, AS_PROGRAM, 8, dooyong_state ) static ADDRESS_MAP_START( flytiger_map, AS_PROGRAM, 8, dooyong_z80_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
AM_RANGE(0xc000, 0xcfff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0xc000, 0xcfff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0xd000, 0xdfff) AM_RAM AM_RANGE(0xd000, 0xdfff) AM_RAM
AM_RANGE(0xe000, 0xe000) AM_READ_PORT("P1") AM_RANGE(0xe000, 0xe000) AM_READ_PORT("P1")
AM_RANGE(0xe000, 0xe000) AM_WRITE(lastday_bankswitch_w) AM_RANGE(0xe000, 0xe000) AM_WRITE(bankswitch_w)
AM_RANGE(0xe002, 0xe002) AM_READ_PORT("P2") AM_RANGE(0xe002, 0xe002) AM_READ_PORT("P2")
AM_RANGE(0xe004, 0xe004) AM_READ_PORT("SYSTEM") AM_RANGE(0xe004, 0xe004) AM_READ_PORT("SYSTEM")
AM_RANGE(0xe006, 0xe006) AM_READ_PORT("DSWA") AM_RANGE(0xe006, 0xe006) AM_READ_PORT("DSWA")
AM_RANGE(0xe008, 0xe008) AM_READ_PORT("DSWB") AM_RANGE(0xe008, 0xe008) AM_READ_PORT("DSWB")
AM_RANGE(0xe010, 0xe010) AM_WRITE(flytiger_ctrl_w) /* coin counter, flip screen */ AM_RANGE(0xe010, 0xe010) AM_WRITE(flytiger_ctrl_w) /* coin counter, flip screen */
AM_RANGE(0xe020, 0xe020) AM_WRITE(soundlatch_byte_w) AM_RANGE(0xe020, 0xe020) AM_WRITE(soundlatch_byte_w)
AM_RANGE(0xe030, 0xe037) AM_WRITE(dooyong_bgscroll8_w) AM_RANGE(0xe030, 0xe037) AM_WRITE(bgscroll_w)
AM_RANGE(0xe040, 0xe047) AM_WRITE(dooyong_fgscroll8_w) AM_RANGE(0xe040, 0xe047) AM_WRITE(fgscroll_w)
AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(paletteram_flytiger_w) AM_SHARE("flytiger_palram") AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(paletteram_flytiger_w) AM_SHARE("flytiger_palram")
AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(dooyong_txvideoram8_w) AM_SHARE("txvideoram") AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(txvideoram_w) AM_SHARE("txvideoram")
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( primella_map, AS_PROGRAM, 8, dooyong_state ) static ADDRESS_MAP_START( primella_map, AS_PROGRAM, 8, dooyong_z80_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
AM_RANGE(0xc000, 0xcfff) AM_RAM AM_RANGE(0xc000, 0xcfff) AM_RAM
AM_RANGE(0xd000, 0xd3ff) AM_RAM /* what is this? looks like a palette? scratchpad RAM maybe? */ AM_RANGE(0xd000, 0xd3ff) AM_RAM /* what is this? looks like a palette? scratchpad RAM maybe? */
AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(dooyong_txvideoram8_w) AM_SHARE("txvideoram") AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(txvideoram_w) AM_SHARE("txvideoram")
AM_RANGE(0xf000, 0xf7ff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0xf000, 0xf7ff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0xf800, 0xf800) AM_READ_PORT("DSWA") AM_RANGE(0xf800, 0xf800) AM_READ_PORT("DSWA")
AM_RANGE(0xf800, 0xf800) AM_WRITE(primella_ctrl_w) /* bank switch, flip screen etc */ AM_RANGE(0xf800, 0xf800) AM_WRITE(primella_ctrl_w) /* bank switch, flip screen etc */
@ -222,67 +222,67 @@ static ADDRESS_MAP_START( primella_map, AS_PROGRAM, 8, dooyong_state )
AM_RANGE(0xf820, 0xf820) AM_READ_PORT("P1") AM_RANGE(0xf820, 0xf820) AM_READ_PORT("P1")
AM_RANGE(0xf830, 0xf830) AM_READ_PORT("P2") AM_RANGE(0xf830, 0xf830) AM_READ_PORT("P2")
AM_RANGE(0xf840, 0xf840) AM_READ_PORT("SYSTEM") AM_RANGE(0xf840, 0xf840) AM_READ_PORT("SYSTEM")
AM_RANGE(0xfc00, 0xfc07) AM_WRITE(dooyong_bgscroll8_w) AM_RANGE(0xfc00, 0xfc07) AM_WRITE(bgscroll_w)
AM_RANGE(0xfc08, 0xfc0f) AM_WRITE(dooyong_fgscroll8_w) AM_RANGE(0xfc08, 0xfc0f) AM_WRITE(fgscroll_w)
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( rshark_map, AS_PROGRAM, 16, dooyong_state ) static ADDRESS_MAP_START( rshark_map, AS_PROGRAM, 16, dooyong_68k_state )
ADDRESS_MAP_GLOBAL_MASK(0xfffff) /* super-x needs this and is similar */ ADDRESS_MAP_GLOBAL_MASK(0xfffff) /* super-x needs this and is similar */
AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x000000, 0x03ffff) AM_ROM
AM_RANGE(0x040000, 0x04cfff) AM_RAM AM_RANGE(0x040000, 0x04cfff) AM_RAM
AM_RANGE(0x04d000, 0x04dfff) AM_RAM AM_SHARE("spriteram16") AM_RANGE(0x04d000, 0x04dfff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0x04e000, 0x04ffff) AM_RAM AM_RANGE(0x04e000, 0x04ffff) AM_RAM
AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("DSW") AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("DSW")
AM_RANGE(0x0c0004, 0x0c0005) AM_READ_PORT("P1_P2") AM_RANGE(0x0c0004, 0x0c0005) AM_READ_PORT("P1_P2")
AM_RANGE(0x0c0006, 0x0c0007) AM_READ_PORT("SYSTEM") AM_RANGE(0x0c0006, 0x0c0007) AM_READ_PORT("SYSTEM")
AM_RANGE(0x0c4000, 0x0c400f) AM_WRITE(dooyong_bgscroll16_w) AM_RANGE(0x0c4000, 0x0c400f) AM_WRITE8(bgscroll_w, 0x00ff)
AM_RANGE(0x0c4010, 0x0c401f) AM_WRITE(dooyong_bg2scroll16_w) AM_RANGE(0x0c4010, 0x0c401f) AM_WRITE8(bg2scroll_w, 0x00ff)
AM_RANGE(0x0c8000, 0x0c8fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x0c8000, 0x0c8fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x0c0012, 0x0c0013) AM_WRITE(soundlatch_word_w) AM_RANGE(0x0c0012, 0x0c0013) AM_WRITE(soundlatch_word_w)
AM_RANGE(0x0c0014, 0x0c0015) AM_WRITE(rshark_ctrl_w) /* flip screen + unknown stuff */ AM_RANGE(0x0c0014, 0x0c0015) AM_WRITE(ctrl_w) /* flip screen + unknown stuff */
AM_RANGE(0x0cc000, 0x0cc00f) AM_WRITE(dooyong_fgscroll16_w) AM_RANGE(0x0cc000, 0x0cc00f) AM_WRITE8(fgscroll_w, 0x00ff)
AM_RANGE(0x0cc010, 0x0cc01f) AM_WRITE(dooyong_fg2scroll16_w) AM_RANGE(0x0cc010, 0x0cc01f) AM_WRITE8(fg2scroll_w, 0x00ff)
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( superx_map, AS_PROGRAM, 16, dooyong_state ) static ADDRESS_MAP_START( superx_map, AS_PROGRAM, 16, dooyong_68k_state )
ADDRESS_MAP_GLOBAL_MASK(0xfffff) ADDRESS_MAP_GLOBAL_MASK(0xfffff)
AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x000000, 0x03ffff) AM_ROM
AM_RANGE(0x0d0000, 0x0dcfff) AM_RAM AM_RANGE(0x0d0000, 0x0dcfff) AM_RAM
AM_RANGE(0x0dd000, 0x0ddfff) AM_RAM AM_SHARE("spriteram16") AM_RANGE(0x0dd000, 0x0ddfff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0x0de000, 0x0dffff) AM_RAM AM_RANGE(0x0de000, 0x0dffff) AM_RAM
AM_RANGE(0x080002, 0x080003) AM_READ_PORT("DSW") AM_RANGE(0x080002, 0x080003) AM_READ_PORT("DSW")
AM_RANGE(0x080004, 0x080005) AM_READ_PORT("P1_P2") AM_RANGE(0x080004, 0x080005) AM_READ_PORT("P1_P2")
AM_RANGE(0x080006, 0x080007) AM_READ_PORT("SYSTEM") AM_RANGE(0x080006, 0x080007) AM_READ_PORT("SYSTEM")
AM_RANGE(0x084000, 0x08400f) AM_WRITE(dooyong_bgscroll16_w) AM_RANGE(0x084000, 0x08400f) AM_WRITE8(bgscroll_w, 0x00ff)
AM_RANGE(0x084010, 0x08401f) AM_WRITE(dooyong_bg2scroll16_w) AM_RANGE(0x084010, 0x08401f) AM_WRITE8(bg2scroll_w, 0x00ff)
AM_RANGE(0x088000, 0x088fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x088000, 0x088fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x080012, 0x080013) AM_WRITE(soundlatch_word_w) AM_RANGE(0x080012, 0x080013) AM_WRITE(soundlatch_word_w)
AM_RANGE(0x080014, 0x080015) AM_WRITE(rshark_ctrl_w) /* flip screen + unknown stuff */ AM_RANGE(0x080014, 0x080015) AM_WRITE(ctrl_w) /* flip screen + unknown stuff */
AM_RANGE(0x08c000, 0x08c00f) AM_WRITE(dooyong_fgscroll16_w) AM_RANGE(0x08c000, 0x08c00f) AM_WRITE8(fgscroll_w, 0x00ff)
AM_RANGE(0x08c010, 0x08c01f) AM_WRITE(dooyong_fg2scroll16_w) AM_RANGE(0x08c010, 0x08c01f) AM_WRITE8(fg2scroll_w, 0x00ff)
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( popbingo_map, AS_PROGRAM, 16, dooyong_state ) static ADDRESS_MAP_START( popbingo_map, AS_PROGRAM, 16, dooyong_68k_state )
ADDRESS_MAP_GLOBAL_MASK(0xfffff) ADDRESS_MAP_GLOBAL_MASK(0xfffff)
AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x000000, 0x03ffff) AM_ROM
AM_RANGE(0x040000, 0x04cfff) AM_RAM AM_RANGE(0x040000, 0x04cfff) AM_RAM
AM_RANGE(0x04d000, 0x04dfff) AM_RAM AM_SHARE("spriteram16") AM_RANGE(0x04d000, 0x04dfff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0x04e000, 0x04ffff) AM_RAM AM_RANGE(0x04e000, 0x04ffff) AM_RAM
AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("DSW") AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("DSW")
AM_RANGE(0x0c0004, 0x0c0005) AM_READ_PORT("P1_P2") AM_RANGE(0x0c0004, 0x0c0005) AM_READ_PORT("P1_P2")
AM_RANGE(0x0c0006, 0x0c0007) AM_READ_PORT("SYSTEM") AM_RANGE(0x0c0006, 0x0c0007) AM_READ_PORT("SYSTEM")
AM_RANGE(0x0c0012, 0x0c0013) AM_WRITE(soundlatch_word_w) AM_RANGE(0x0c0012, 0x0c0013) AM_WRITE(soundlatch_word_w)
AM_RANGE(0x0c0014, 0x0c0015) AM_WRITE(rshark_ctrl_w) AM_RANGE(0x0c0014, 0x0c0015) AM_WRITE(ctrl_w)
AM_RANGE(0x0c0018, 0x0c001b) AM_WRITENOP // ? AM_RANGE(0x0c0018, 0x0c001b) AM_WRITENOP // ?
AM_RANGE(0x0c4000, 0x0c400f) AM_WRITE(dooyong_bgscroll16_w) AM_RANGE(0x0c4000, 0x0c400f) AM_WRITE8(bgscroll_w, 0x00ff)
AM_RANGE(0x0c4010, 0x0c401f) AM_WRITE(dooyong_bg2scroll16_w) // not used atm AM_RANGE(0x0c4010, 0x0c401f) AM_WRITE8(bg2scroll_w, 0x00ff) // not used atm
AM_RANGE(0x0c8000, 0x0c8fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x0c8000, 0x0c8fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x0cc000, 0x0cc00f) AM_WRITE(dooyong_fgscroll16_w) // not used atm AM_RANGE(0x0cc000, 0x0cc00f) AM_WRITE8(fgscroll_w, 0x00ff) // not used atm
AM_RANGE(0x0cc010, 0x0cc01f) AM_WRITE(dooyong_fg2scroll16_w) // not used atm AM_RANGE(0x0cc010, 0x0cc01f) AM_WRITE8(fg2scroll_w, 0x00ff) // not used atm
AM_RANGE(0x0dc000, 0x0dc01f) AM_RAM // registers of some kind? AM_RANGE(0x0dc000, 0x0dc01f) AM_RAM // registers of some kind?
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( lastday_sound_map, AS_PROGRAM, 8, dooyong_state ) static ADDRESS_MAP_START( lastday_sound_map, AS_PROGRAM, 8, dooyong_z80_ym2203_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0xc000, 0xc7ff) AM_RAM AM_RANGE(0xc000, 0xc7ff) AM_RAM
AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_byte_r) AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_byte_r)
@ -290,7 +290,7 @@ static ADDRESS_MAP_START( lastday_sound_map, AS_PROGRAM, 8, dooyong_state )
AM_RANGE(0xf002, 0xf003) AM_DEVREADWRITE("ym2", ym2203_device, read, write) AM_RANGE(0xf002, 0xf003) AM_DEVREADWRITE("ym2", ym2203_device, read, write)
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( pollux_sound_map, AS_PROGRAM, 8, dooyong_state ) static ADDRESS_MAP_START( pollux_sound_map, AS_PROGRAM, 8, dooyong_z80_ym2203_state )
AM_RANGE(0x0000, 0xefff) AM_ROM AM_RANGE(0x0000, 0xefff) AM_ROM
AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_RANGE(0xf000, 0xf7ff) AM_RAM
AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r) AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r)
@ -772,18 +772,18 @@ static GFXDECODE_START( popbingo )
GFXDECODE_ENTRY( "gfx2", 0, popbingo_tilelayout, 256, 1 ) GFXDECODE_ENTRY( "gfx2", 0, popbingo_tilelayout, 256, 1 )
GFXDECODE_END GFXDECODE_END
READ8_MEMBER(dooyong_state::unk_r) READ8_MEMBER(dooyong_z80_ym2203_state::unk_r)
{ {
return 0; return 0;
} }
WRITE_LINE_MEMBER(dooyong_state::irqhandler_2203_1) WRITE_LINE_MEMBER(dooyong_z80_ym2203_state::irqhandler_2203_1)
{ {
m_interrupt_line_1=state; m_interrupt_line_1=state;
m_audiocpu->set_input_line(0, (m_interrupt_line_1 | m_interrupt_line_2) ? ASSERT_LINE : CLEAR_LINE); m_audiocpu->set_input_line(0, (m_interrupt_line_1 | m_interrupt_line_2) ? ASSERT_LINE : CLEAR_LINE);
} }
WRITE_LINE_MEMBER(dooyong_state::irqhandler_2203_2) WRITE_LINE_MEMBER(dooyong_z80_ym2203_state::irqhandler_2203_2)
{ {
m_interrupt_line_2=state; m_interrupt_line_2=state;
m_audiocpu->set_input_line(0, (m_interrupt_line_1 | m_interrupt_line_2) ? ASSERT_LINE : CLEAR_LINE); m_audiocpu->set_input_line(0, (m_interrupt_line_1 | m_interrupt_line_2) ? ASSERT_LINE : CLEAR_LINE);
@ -800,13 +800,13 @@ static MACHINE_CONFIG_FRAGMENT( sound_2203 )
MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("ym1", YM2203, 1500000) MCFG_SOUND_ADD("ym1", YM2203, 1500000)
MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_state,irqhandler_2203_1)) MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_z80_ym2203_state, irqhandler_2203_1))
MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_state, unk_r)) MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_z80_ym2203_state, unk_r))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
MCFG_SOUND_ADD("ym2", YM2203, 1500000) MCFG_SOUND_ADD("ym2", YM2203, 1500000)
MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_state, irqhandler_2203_2)) MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_z80_ym2203_state, irqhandler_2203_2))
MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_state, unk_r)) MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_z80_ym2203_state, unk_r))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
MACHINE_CONFIG_END MACHINE_CONFIG_END
@ -834,7 +834,7 @@ static MACHINE_CONFIG_FRAGMENT( sound_2151_m68k )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
MACHINE_CONFIG_END MACHINE_CONFIG_END
static MACHINE_CONFIG_START( lastday, dooyong_state ) static MACHINE_CONFIG_START( lastday, dooyong_z80_ym2203_state )
/* basic machine hardware */ /* basic machine hardware */
MCFG_CPU_ADD("maincpu", Z80, 8000000) /* ??? */ MCFG_CPU_ADD("maincpu", Z80, 8000000) /* ??? */
@ -844,8 +844,8 @@ static MACHINE_CONFIG_START( lastday, dooyong_state )
MCFG_CPU_ADD("audiocpu", Z80, 8000000) /* ??? */ MCFG_CPU_ADD("audiocpu", Z80, 8000000) /* ??? */
MCFG_CPU_PROGRAM_MAP(lastday_sound_map) MCFG_CPU_PROGRAM_MAP(lastday_sound_map)
MCFG_MACHINE_START_OVERRIDE(dooyong_state,lastday) MCFG_MACHINE_START_OVERRIDE(dooyong_z80_state, cpu_z80)
MCFG_MACHINE_RESET_OVERRIDE(dooyong_state,sound_ym2203) MCFG_MACHINE_RESET_OVERRIDE(dooyong_z80_ym2203_state, sound_ym2203)
/* video hardware */ /* video hardware */
@ -856,7 +856,7 @@ static MACHINE_CONFIG_START( lastday, dooyong_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 ) MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(dooyong_state, screen_update_lastday) MCFG_SCREEN_UPDATE_DRIVER(dooyong_z80_ym2203_state, screen_update_lastday)
MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram8_device, vblank_copy_rising) MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram8_device, vblank_copy_rising)
MCFG_SCREEN_PALETTE("palette") MCFG_SCREEN_PALETTE("palette")
@ -864,24 +864,24 @@ static MACHINE_CONFIG_START( lastday, dooyong_state )
MCFG_PALETTE_ADD("palette", 1024) MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR) MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
MCFG_VIDEO_START_OVERRIDE(dooyong_state,lastday) MCFG_VIDEO_START_OVERRIDE(dooyong_z80_ym2203_state, lastday)
/* sound hardware */ /* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("ym1", YM2203, 4000000) MCFG_SOUND_ADD("ym1", YM2203, 4000000)
MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_state,irqhandler_2203_1)) MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_z80_ym2203_state, irqhandler_2203_1))
MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_state, unk_r)) MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_z80_ym2203_state, unk_r))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
MCFG_SOUND_ADD("ym2", YM2203, 4000000) MCFG_SOUND_ADD("ym2", YM2203, 4000000)
MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_state, irqhandler_2203_2)) MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_z80_ym2203_state, irqhandler_2203_2))
MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_state, unk_r)) MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_z80_ym2203_state, unk_r))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
MACHINE_CONFIG_END MACHINE_CONFIG_END
static MACHINE_CONFIG_START( gulfstrm, dooyong_state ) static MACHINE_CONFIG_START( gulfstrm, dooyong_z80_ym2203_state )
/* basic machine hardware */ /* basic machine hardware */
MCFG_CPU_ADD("maincpu", Z80, 8000000) /* ??? */ MCFG_CPU_ADD("maincpu", Z80, 8000000) /* ??? */
@ -891,8 +891,8 @@ static MACHINE_CONFIG_START( gulfstrm, dooyong_state )
MCFG_CPU_ADD("audiocpu", Z80, 8000000) /* ??? */ MCFG_CPU_ADD("audiocpu", Z80, 8000000) /* ??? */
MCFG_CPU_PROGRAM_MAP(lastday_sound_map) MCFG_CPU_PROGRAM_MAP(lastday_sound_map)
MCFG_MACHINE_START_OVERRIDE(dooyong_state,lastday) MCFG_MACHINE_START_OVERRIDE(dooyong_z80_state, cpu_z80)
MCFG_MACHINE_RESET_OVERRIDE(dooyong_state,sound_ym2203) MCFG_MACHINE_RESET_OVERRIDE(dooyong_z80_ym2203_state, sound_ym2203)
/* video hardware */ /* video hardware */
MCFG_BUFFERED_SPRITERAM8_ADD("spriteram") MCFG_BUFFERED_SPRITERAM8_ADD("spriteram")
@ -902,7 +902,7 @@ static MACHINE_CONFIG_START( gulfstrm, dooyong_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 ) MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(dooyong_state, screen_update_gulfstrm) MCFG_SCREEN_UPDATE_DRIVER(dooyong_z80_ym2203_state, screen_update_gulfstrm)
MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram8_device, vblank_copy_rising) MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram8_device, vblank_copy_rising)
MCFG_SCREEN_PALETTE("palette") MCFG_SCREEN_PALETTE("palette")
@ -910,13 +910,13 @@ static MACHINE_CONFIG_START( gulfstrm, dooyong_state )
MCFG_PALETTE_ADD("palette", 1024) MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_VIDEO_START_OVERRIDE(dooyong_state,gulfstrm) MCFG_VIDEO_START_OVERRIDE(dooyong_z80_ym2203_state, gulfstrm)
/* sound hardware */ /* sound hardware */
MCFG_FRAGMENT_ADD( sound_2203 ) MCFG_FRAGMENT_ADD( sound_2203 )
MACHINE_CONFIG_END MACHINE_CONFIG_END
static MACHINE_CONFIG_START( pollux, dooyong_state ) static MACHINE_CONFIG_START( pollux, dooyong_z80_ym2203_state )
/* basic machine hardware */ /* basic machine hardware */
MCFG_CPU_ADD("maincpu", Z80, 8000000) /* ??? */ MCFG_CPU_ADD("maincpu", Z80, 8000000) /* ??? */
@ -926,8 +926,8 @@ static MACHINE_CONFIG_START( pollux, dooyong_state )
MCFG_CPU_ADD("audiocpu", Z80, 8000000) /* ??? */ MCFG_CPU_ADD("audiocpu", Z80, 8000000) /* ??? */
MCFG_CPU_PROGRAM_MAP(pollux_sound_map) MCFG_CPU_PROGRAM_MAP(pollux_sound_map)
MCFG_MACHINE_START_OVERRIDE(dooyong_state,lastday) MCFG_MACHINE_START_OVERRIDE(dooyong_z80_state, cpu_z80)
MCFG_MACHINE_RESET_OVERRIDE(dooyong_state,sound_ym2203) MCFG_MACHINE_RESET_OVERRIDE(dooyong_z80_ym2203_state, sound_ym2203)
/* video hardware */ /* video hardware */
MCFG_BUFFERED_SPRITERAM8_ADD("spriteram") MCFG_BUFFERED_SPRITERAM8_ADD("spriteram")
@ -937,7 +937,7 @@ static MACHINE_CONFIG_START( pollux, dooyong_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 ) MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(dooyong_state, screen_update_pollux) MCFG_SCREEN_UPDATE_DRIVER(dooyong_z80_ym2203_state, screen_update_pollux)
MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram8_device, vblank_copy_rising) MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram8_device, vblank_copy_rising)
MCFG_SCREEN_PALETTE("palette") MCFG_SCREEN_PALETTE("palette")
@ -945,13 +945,13 @@ static MACHINE_CONFIG_START( pollux, dooyong_state )
MCFG_PALETTE_ADD("palette", 1024) MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_VIDEO_START_OVERRIDE(dooyong_state,pollux) MCFG_VIDEO_START_OVERRIDE(dooyong_z80_ym2203_state, pollux)
/* sound hardware */ /* sound hardware */
MCFG_FRAGMENT_ADD( sound_2203 ) MCFG_FRAGMENT_ADD( sound_2203 )
MACHINE_CONFIG_END MACHINE_CONFIG_END
static MACHINE_CONFIG_START( bluehawk, dooyong_state ) static MACHINE_CONFIG_START( bluehawk, dooyong_z80_state )
/* basic machine hardware */ /* basic machine hardware */
MCFG_CPU_ADD("maincpu", Z80, 8000000) /* ??? */ MCFG_CPU_ADD("maincpu", Z80, 8000000) /* ??? */
@ -961,7 +961,7 @@ static MACHINE_CONFIG_START( bluehawk, dooyong_state )
MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* ??? */ MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* ??? */
MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map) MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map)
MCFG_MACHINE_START_OVERRIDE(dooyong_state,lastday) MCFG_MACHINE_START_OVERRIDE(dooyong_z80_state, cpu_z80)
/* video hardware */ /* video hardware */
MCFG_BUFFERED_SPRITERAM8_ADD("spriteram") MCFG_BUFFERED_SPRITERAM8_ADD("spriteram")
@ -971,7 +971,7 @@ static MACHINE_CONFIG_START( bluehawk, dooyong_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 ) MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(dooyong_state, screen_update_bluehawk) MCFG_SCREEN_UPDATE_DRIVER(dooyong_z80_state, screen_update_bluehawk)
MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram8_device, vblank_copy_rising) MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram8_device, vblank_copy_rising)
MCFG_SCREEN_PALETTE("palette") MCFG_SCREEN_PALETTE("palette")
@ -979,13 +979,13 @@ static MACHINE_CONFIG_START( bluehawk, dooyong_state )
MCFG_PALETTE_ADD("palette", 1024) MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_VIDEO_START_OVERRIDE(dooyong_state,bluehawk) MCFG_VIDEO_START_OVERRIDE(dooyong_z80_state, bluehawk)
/* sound hardware */ /* sound hardware */
MCFG_FRAGMENT_ADD( sound_2151 ) MCFG_FRAGMENT_ADD( sound_2151 )
MACHINE_CONFIG_END MACHINE_CONFIG_END
static MACHINE_CONFIG_START( flytiger, dooyong_state ) static MACHINE_CONFIG_START( flytiger, dooyong_z80_state )
/* basic machine hardware */ /* basic machine hardware */
MCFG_CPU_ADD("maincpu", Z80, 8000000) /* ??? */ MCFG_CPU_ADD("maincpu", Z80, 8000000) /* ??? */
@ -995,7 +995,7 @@ static MACHINE_CONFIG_START( flytiger, dooyong_state )
MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* ??? */ MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* ??? */
MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map) MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map)
MCFG_MACHINE_START_OVERRIDE(dooyong_state,lastday) MCFG_MACHINE_START_OVERRIDE(dooyong_z80_state, cpu_z80)
/* video hardware */ /* video hardware */
MCFG_BUFFERED_SPRITERAM8_ADD("spriteram") MCFG_BUFFERED_SPRITERAM8_ADD("spriteram")
@ -1005,7 +1005,7 @@ static MACHINE_CONFIG_START( flytiger, dooyong_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 ) MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(dooyong_state, screen_update_flytiger) MCFG_SCREEN_UPDATE_DRIVER(dooyong_z80_state, screen_update_flytiger)
MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram8_device, vblank_copy_rising) MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram8_device, vblank_copy_rising)
MCFG_SCREEN_PALETTE("palette") MCFG_SCREEN_PALETTE("palette")
@ -1013,13 +1013,13 @@ static MACHINE_CONFIG_START( flytiger, dooyong_state )
MCFG_PALETTE_ADD("palette", 1024) MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_VIDEO_START_OVERRIDE(dooyong_state,flytiger) MCFG_VIDEO_START_OVERRIDE(dooyong_z80_state, flytiger)
/* sound hardware */ /* sound hardware */
MCFG_FRAGMENT_ADD( sound_2151 ) MCFG_FRAGMENT_ADD( sound_2151 )
MACHINE_CONFIG_END MACHINE_CONFIG_END
static MACHINE_CONFIG_START( primella, dooyong_state ) static MACHINE_CONFIG_START( primella, dooyong_z80_state )
/* basic machine hardware */ /* basic machine hardware */
MCFG_CPU_ADD("maincpu", Z80, 8000000) /* ??? */ MCFG_CPU_ADD("maincpu", Z80, 8000000) /* ??? */
@ -1029,7 +1029,7 @@ static MACHINE_CONFIG_START( primella, dooyong_state )
MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* ??? */ MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* ??? */
MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map) MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map)
MCFG_MACHINE_START_OVERRIDE(dooyong_state,lastday) MCFG_MACHINE_START_OVERRIDE(dooyong_z80_state, cpu_z80)
/* video hardware */ /* video hardware */
MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_ADD("screen", RASTER)
@ -1037,122 +1037,123 @@ static MACHINE_CONFIG_START( primella, dooyong_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 0*8, 32*8-1 ) MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 0*8, 32*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(dooyong_state, screen_update_primella) MCFG_SCREEN_UPDATE_DRIVER(dooyong_z80_state, screen_update_primella)
MCFG_SCREEN_PALETTE("palette") MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", primella) MCFG_GFXDECODE_ADD("gfxdecode", "palette", primella)
MCFG_PALETTE_ADD("palette", 1024) MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_VIDEO_START_OVERRIDE(dooyong_state,primella) MCFG_VIDEO_START_OVERRIDE(dooyong_z80_state, primella)
/* sound hardware */ /* sound hardware */
MCFG_FRAGMENT_ADD( sound_2151 ) MCFG_FRAGMENT_ADD( sound_2151 )
MACHINE_CONFIG_END MACHINE_CONFIG_END
TIMER_DEVICE_CALLBACK_MEMBER(dooyong_state::rshark_scanline)
TIMER_DEVICE_CALLBACK_MEMBER(dooyong_68k_state::scanline)
{ {
int scanline = param; int scanline = param;
if(scanline == 248) // vblank-out irq if (scanline == 248) // vblank-out irq
m_maincpu->set_input_line(5, HOLD_LINE); m_maincpu->set_input_line(5, HOLD_LINE);
if(scanline == 120) // timer irq? if (scanline == 120) // timer irq?
m_maincpu->set_input_line(6, HOLD_LINE); m_maincpu->set_input_line(6, HOLD_LINE);
} }
static MACHINE_CONFIG_START( rshark, dooyong_state ) static MACHINE_CONFIG_START( rshark, dooyong_68k_state )
/* basic machine hardware */ /* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, 8000000) /* measured on super-x */ MCFG_CPU_ADD("maincpu", M68000, 8000000) /* measured on super-x */
MCFG_CPU_PROGRAM_MAP(rshark_map) MCFG_CPU_PROGRAM_MAP(rshark_map)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dooyong_state, rshark_scanline, "screen", 0, 1) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dooyong_68k_state, scanline, "screen", 0, 1)
MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* measured on super-x */ MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* measured on super-x */
MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map) MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map)
/* video hardware */ /* video hardware */
MCFG_BUFFERED_SPRITERAM16_ADD("spriteram16") MCFG_BUFFERED_SPRITERAM16_ADD("spriteram")
MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 ) MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(dooyong_state, screen_update_rshark) MCFG_SCREEN_UPDATE_DRIVER(dooyong_68k_state, screen_update_rshark)
MCFG_SCREEN_VBLANK_DEVICE("spriteram16", buffered_spriteram16_device, vblank_copy_rising) MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram16_device, vblank_copy_rising)
MCFG_SCREEN_PALETTE("palette") MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", rshark) MCFG_GFXDECODE_ADD("gfxdecode", "palette", rshark)
MCFG_PALETTE_ADD("palette", 2048) MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_VIDEO_START_OVERRIDE(dooyong_state,rshark) MCFG_VIDEO_START_OVERRIDE(dooyong_68k_state, rshark)
/* sound hardware */ /* sound hardware */
MCFG_FRAGMENT_ADD( sound_2151_m68k ) MCFG_FRAGMENT_ADD( sound_2151_m68k )
MACHINE_CONFIG_END MACHINE_CONFIG_END
static MACHINE_CONFIG_START( superx, dooyong_state ) // dif mem map static MACHINE_CONFIG_START( superx, dooyong_68k_state ) // dif mem map
/* basic machine hardware */ /* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, 8000000) /* measured on super-x */ MCFG_CPU_ADD("maincpu", M68000, 8000000) /* measured on super-x */
MCFG_CPU_PROGRAM_MAP(superx_map) MCFG_CPU_PROGRAM_MAP(superx_map)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dooyong_state, rshark_scanline, "screen", 0, 1) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dooyong_68k_state, scanline, "screen", 0, 1)
MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* measured on super-x */ MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* measured on super-x */
MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map) MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map)
/* video hardware */ /* video hardware */
MCFG_BUFFERED_SPRITERAM16_ADD("spriteram16") MCFG_BUFFERED_SPRITERAM16_ADD("spriteram")
MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 ) MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(dooyong_state, screen_update_rshark) MCFG_SCREEN_UPDATE_DRIVER(dooyong_68k_state, screen_update_rshark)
MCFG_SCREEN_VBLANK_DEVICE("spriteram16", buffered_spriteram16_device, vblank_copy_rising) MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram16_device, vblank_copy_rising)
MCFG_SCREEN_PALETTE("palette") MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", rshark) MCFG_GFXDECODE_ADD("gfxdecode", "palette", rshark)
MCFG_PALETTE_ADD("palette", 2048) MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_VIDEO_START_OVERRIDE(dooyong_state,rshark) MCFG_VIDEO_START_OVERRIDE(dooyong_68k_state, rshark)
/* sound hardware */ /* sound hardware */
MCFG_FRAGMENT_ADD( sound_2151_m68k ) MCFG_FRAGMENT_ADD( sound_2151_m68k )
MACHINE_CONFIG_END MACHINE_CONFIG_END
static MACHINE_CONFIG_START( popbingo, dooyong_state ) static MACHINE_CONFIG_START( popbingo, dooyong_68k_state )
/* basic machine hardware */ /* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, 10000000) MCFG_CPU_ADD("maincpu", M68000, 10000000)
MCFG_CPU_PROGRAM_MAP(popbingo_map) MCFG_CPU_PROGRAM_MAP(popbingo_map)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dooyong_state, rshark_scanline, "screen", 0, 1) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dooyong_68k_state, scanline, "screen", 0, 1)
MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* measured on super-x */ MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* measured on super-x */
MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map) MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map)
/* video hardware */ /* video hardware */
MCFG_BUFFERED_SPRITERAM16_ADD("spriteram16") MCFG_BUFFERED_SPRITERAM16_ADD("spriteram")
MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 ) MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(dooyong_state, screen_update_popbingo) MCFG_SCREEN_UPDATE_DRIVER(dooyong_68k_state, screen_update_popbingo)
MCFG_SCREEN_VBLANK_DEVICE("spriteram16", buffered_spriteram16_device, vblank_copy_rising) MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram16_device, vblank_copy_rising)
MCFG_SCREEN_PALETTE("palette") MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", popbingo) MCFG_GFXDECODE_ADD("gfxdecode", "palette", popbingo)
MCFG_PALETTE_ADD("palette", 2048) MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_VIDEO_START_OVERRIDE(dooyong_state,popbingo) MCFG_VIDEO_START_OVERRIDE(dooyong_68k_state, popbingo)
/* sound hardware */ /* sound hardware */
MCFG_FRAGMENT_ADD( sound_2151_m68k ) MCFG_FRAGMENT_ADD( sound_2151_m68k )

View File

@ -100,7 +100,7 @@ static INPUT_PORTS_START( prehisle )
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:1") PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:1")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Level_Select ) ) PORT_DIPLOCATION("SW1:2") PORT_DIPNAME( 0x02, 0x02, DEF_STR( Level_Select ) ) PORT_DIPLOCATION("SW1:2")
PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x04, 0x04, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:3") PORT_DIPNAME( 0x04, 0x04, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:3")
@ -126,7 +126,7 @@ static INPUT_PORTS_START( prehisle )
PORT_DIPSETTING( 0x03, DEF_STR( Standard ) ) PORT_DIPSETTING( 0x03, DEF_STR( Standard ) )
PORT_DIPSETTING( 0x01, "Middle" ) PORT_DIPSETTING( 0x01, "Middle" )
PORT_DIPSETTING( 0x00, DEF_STR( Difficult ) ) PORT_DIPSETTING( 0x00, DEF_STR( Difficult ) )
PORT_DIPNAME( 0x0c, 0x0c, "Game Mode" ) PORT_DIPLOCATION("SW2:3,4") PORT_DIPNAME( 0x0c, 0x0c, "Game Mode" ) PORT_DIPLOCATION("SW2:3,4")
PORT_DIPSETTING( 0x08, "Demo Sounds Off" ) PORT_DIPSETTING( 0x08, "Demo Sounds Off" )
PORT_DIPSETTING( 0x0c, "Demo Sounds On" ) PORT_DIPSETTING( 0x0c, "Demo Sounds On" )
PORT_DIPSETTING( 0x00, "Freeze" ) PORT_DIPSETTING( 0x00, "Freeze" )
@ -136,7 +136,7 @@ static INPUT_PORTS_START( prehisle )
PORT_DIPSETTING( 0x20, "150K 300K" ) PORT_DIPSETTING( 0x20, "150K 300K" )
PORT_DIPSETTING( 0x10, "300K 500K" ) PORT_DIPSETTING( 0x10, "300K 500K" )
PORT_DIPSETTING( 0x00, DEF_STR( None ) ) PORT_DIPSETTING( 0x00, DEF_STR( None ) )
PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:7") PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x00, DEF_STR( No ) )
PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) PORT_DIPSETTING( 0x40, DEF_STR( Yes ) )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")

View File

@ -5,24 +5,23 @@ class dooyong_state : public driver_device
public: public:
dooyong_state(const machine_config &mconfig, device_type type, const char *tag) dooyong_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag), : driver_device(mconfig, type, tag),
m_spriteram(*this, "spriteram"),
m_spriteram16(*this, "spriteram16") ,
m_txvideoram(*this, "txvideoram"),
m_paletteram_flytiger(*this, "flytiger_palram"),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"), m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"), m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette") { } m_palette(*this, "palette")
{ }
DECLARE_WRITE8_MEMBER(bgscroll_w);
DECLARE_WRITE8_MEMBER(bg2scroll_w);
DECLARE_WRITE8_MEMBER(fgscroll_w);
DECLARE_WRITE8_MEMBER(fg2scroll_w);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_bg2_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
TILE_GET_INFO_MEMBER(get_fg2_tile_info);
inline void get_tile_info(tile_data &tileinfo, int tile_index, UINT8 const *tilerom, UINT8 const *scroll, int graphics);
inline void scroll8_w(offs_t offset, UINT8 data, UINT8 *scroll, tilemap_t *map);
optional_device<buffered_spriteram8_device> m_spriteram;
optional_device<buffered_spriteram16_device> m_spriteram16;
optional_shared_ptr<UINT8> m_txvideoram;
optional_shared_ptr<UINT8> m_paletteram_flytiger;
UINT8 m_sprites_disabled;
UINT8 m_flytiger_palette_bank;
UINT8 m_flytiger_pri;
UINT8 m_tx_pri;
UINT16 m_rshark_pri;
tilemap_t *m_bg_tilemap; tilemap_t *m_bg_tilemap;
tilemap_t *m_bg2_tilemap; tilemap_t *m_bg2_tilemap;
tilemap_t *m_fg_tilemap; tilemap_t *m_fg_tilemap;
@ -36,71 +35,112 @@ public:
UINT8 *m_bg2_tilerom; UINT8 *m_bg2_tilerom;
UINT8 *m_fg_tilerom; UINT8 *m_fg_tilerom;
UINT8 *m_fg2_tilerom; UINT8 *m_fg2_tilerom;
UINT8 *m_bg_tilerom2;
UINT8 *m_bg2_tilerom2;
UINT8 *m_fg_tilerom2;
UINT8 *m_fg2_tilerom2;
int m_bg_gfx; int m_bg_gfx;
int m_bg2_gfx; int m_bg2_gfx;
int m_fg_gfx; int m_fg_gfx;
int m_fg2_gfx; int m_fg2_gfx;
int m_tx_tilemap_mode;
int m_interrupt_line_1;
int m_interrupt_line_2;
DECLARE_WRITE8_MEMBER(lastday_bankswitch_w);
DECLARE_WRITE8_MEMBER(flip_screen_w);
DECLARE_WRITE8_MEMBER(dooyong_bgscroll8_w);
DECLARE_WRITE8_MEMBER(dooyong_bg2scroll8_w);
DECLARE_WRITE8_MEMBER(dooyong_fgscroll8_w);
DECLARE_WRITE8_MEMBER(dooyong_fg2scroll8_w);
DECLARE_WRITE16_MEMBER(dooyong_bgscroll16_w);
DECLARE_WRITE16_MEMBER(dooyong_bg2scroll16_w);
DECLARE_WRITE16_MEMBER(dooyong_fgscroll16_w);
DECLARE_WRITE16_MEMBER(dooyong_fg2scroll16_w);
DECLARE_WRITE8_MEMBER(dooyong_txvideoram8_w);
DECLARE_WRITE8_MEMBER(lastday_ctrl_w);
DECLARE_WRITE8_MEMBER(pollux_ctrl_w);
DECLARE_WRITE8_MEMBER(primella_ctrl_w);
DECLARE_WRITE8_MEMBER(paletteram_flytiger_w);
DECLARE_WRITE8_MEMBER(flytiger_ctrl_w);
DECLARE_WRITE16_MEMBER(rshark_ctrl_w);
DECLARE_READ8_MEMBER(unk_r);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_bg2_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
TILE_GET_INFO_MEMBER(get_fg2_tile_info);
TILE_GET_INFO_MEMBER(flytiger_get_fg_tile_info);
TILE_GET_INFO_MEMBER(get_tx_tile_info);
inline void lastday_get_tile_info(tile_data &tileinfo, int tile_index, const UINT8 *tilerom, UINT8 *scroll, int graphics);
inline void rshark_get_tile_info(tile_data &tileinfo, int tile_index, const UINT8 *tilerom1, const UINT8 *tilerom2, UINT8 *scroll, int graphics);
DECLARE_MACHINE_START(lastday);
DECLARE_MACHINE_RESET(sound_ym2203);
DECLARE_VIDEO_START(lastday);
DECLARE_VIDEO_START(gulfstrm);
DECLARE_VIDEO_START(pollux);
DECLARE_VIDEO_START(bluehawk);
DECLARE_VIDEO_START(flytiger);
DECLARE_VIDEO_START(primella);
DECLARE_VIDEO_START(rshark);
DECLARE_VIDEO_START(popbingo);
UINT32 screen_update_lastday(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_gulfstrm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_pollux(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_bluehawk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_flytiger(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_primella(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_rshark(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_popbingo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(rshark_scanline);
inline void dooyong_scroll8_w(offs_t offset, UINT8 data, UINT8 *scroll, tilemap_t *map);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pollux_extensions);
void rshark_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(irqhandler_2203_1);
DECLARE_WRITE_LINE_MEMBER(irqhandler_2203_2);
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu; required_device<cpu_device> m_audiocpu;
required_device<gfxdecode_device> m_gfxdecode; required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette; required_device<palette_device> m_palette;
}; };
class dooyong_z80_state : public dooyong_state
{
public:
dooyong_z80_state(const machine_config &mconfig, device_type type, const char *tag)
: dooyong_state(mconfig, type, tag),
m_txvideoram(*this, "txvideoram"),
m_paletteram_flytiger(*this, "flytiger_palram"),
m_spriteram(*this, "spriteram")
{ }
enum
{
SPRITE_12BIT = 0x01,
SPRITE_HEIGHT = 0x02,
SPRITE_YSHIFT_BLUEHAWK = 0x04,
SPRITE_YSHIFT_FLYTIGER = 0x08
};
DECLARE_WRITE8_MEMBER(flip_screen_w);
DECLARE_WRITE8_MEMBER(bankswitch_w);
DECLARE_WRITE8_MEMBER(txvideoram_w);
DECLARE_WRITE8_MEMBER(primella_ctrl_w);
DECLARE_WRITE8_MEMBER(paletteram_flytiger_w);
DECLARE_WRITE8_MEMBER(flytiger_ctrl_w);
TILE_GET_INFO_MEMBER(get_tx_tile_info);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, unsigned extensions = 0);
UINT32 screen_update_bluehawk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_flytiger(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_primella(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_MACHINE_START(cpu_z80);
DECLARE_VIDEO_START(bluehawk);
DECLARE_VIDEO_START(flytiger);
DECLARE_VIDEO_START(primella);
required_shared_ptr<UINT8> m_txvideoram;
optional_shared_ptr<UINT8> m_paletteram_flytiger;
UINT8 m_sprites_disabled;
UINT8 m_flytiger_palette_bank;
UINT8 m_flytiger_pri;
UINT8 m_tx_pri;
int m_tx_tilemap_mode;
optional_device<buffered_spriteram8_device> m_spriteram;
};
class dooyong_z80_ym2203_state : public dooyong_z80_state
{
public:
dooyong_z80_ym2203_state(const machine_config &mconfig, device_type type, const char *tag)
: dooyong_z80_state(mconfig, type, tag)
{ }
DECLARE_WRITE8_MEMBER(lastday_ctrl_w);
DECLARE_WRITE8_MEMBER(pollux_ctrl_w);
DECLARE_WRITE_LINE_MEMBER(irqhandler_2203_1);
DECLARE_WRITE_LINE_MEMBER(irqhandler_2203_2);
DECLARE_READ8_MEMBER(unk_r);
DECLARE_MACHINE_RESET(sound_ym2203);
UINT32 screen_update_lastday(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_gulfstrm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_pollux(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_VIDEO_START(lastday);
DECLARE_VIDEO_START(gulfstrm);
DECLARE_VIDEO_START(pollux);
int m_interrupt_line_1;
int m_interrupt_line_2;
};
class dooyong_68k_state : public dooyong_state
{
public:
dooyong_68k_state(const machine_config &mconfig, device_type type, const char *tag)
: dooyong_state(mconfig, type, tag),
m_spriteram(*this, "spriteram")
{ }
DECLARE_WRITE16_MEMBER(ctrl_w);
TIMER_DEVICE_CALLBACK_MEMBER(scanline);
TILE_GET_INFO_MEMBER(rshark_get_bg_tile_info);
TILE_GET_INFO_MEMBER(rshark_get_bg2_tile_info);
TILE_GET_INFO_MEMBER(rshark_get_fg_tile_info);
TILE_GET_INFO_MEMBER(rshark_get_fg2_tile_info);
inline void rshark_get_tile_info(tile_data &tileinfo, int tile_index, UINT8 const *tilerom1, UINT8 const *tilerom2, UINT8 const *scroll, int graphics);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_rshark(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_popbingo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_VIDEO_START(rshark);
DECLARE_VIDEO_START(popbingo);
UINT8 *m_bg_tilerom2;
UINT8 *m_bg2_tilerom2;
UINT8 *m_fg_tilerom2;
UINT8 *m_fg2_tilerom2;
UINT16 m_bg2_priority;
required_device<buffered_spriteram16_device> m_spriteram;
};

View File

@ -23,6 +23,7 @@ public:
tilemap_t *m_bg2_tilemap; tilemap_t *m_bg2_tilemap;
tilemap_t *m_bg_tilemap; tilemap_t *m_bg_tilemap;
tilemap_t *m_fg_tilemap; tilemap_t *m_fg_tilemap;
DECLARE_WRITE16_MEMBER(prehisle_sound16_w); DECLARE_WRITE16_MEMBER(prehisle_sound16_w);
DECLARE_WRITE16_MEMBER(prehisle_bg_videoram16_w); DECLARE_WRITE16_MEMBER(prehisle_bg_videoram16_w);
DECLARE_WRITE16_MEMBER(prehisle_fg_videoram16_w); DECLARE_WRITE16_MEMBER(prehisle_fg_videoram16_w);
@ -35,8 +36,9 @@ public:
TILE_GET_INFO_MEMBER(get_fg_tile_info); TILE_GET_INFO_MEMBER(get_fg_tile_info);
virtual void video_start(); virtual void video_start();
UINT32 screen_update_prehisle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_prehisle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int foreground ); void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(irqhandler); DECLARE_WRITE_LINE_MEMBER(irqhandler);
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu; required_device<cpu_device> m_audiocpu;
required_device<upd7759_device> m_upd7759; required_device<upd7759_device> m_upd7759;

View File

@ -2,7 +2,7 @@
#include "includes/dooyong.h" #include "includes/dooyong.h"
inline void dooyong_state::dooyong_scroll8_w(offs_t offset, UINT8 data, UINT8 *scroll, tilemap_t *map) inline void dooyong_state::scroll8_w(offs_t offset, UINT8 data, UINT8 *scroll, tilemap_t *map)
{ {
UINT8 old = scroll[offset]; UINT8 old = scroll[offset];
if (old != data) if (old != data)
@ -18,7 +18,7 @@ inline void dooyong_state::dooyong_scroll8_w(offs_t offset, UINT8 data, UINT8 *s
break; break;
case 3: /* Low byte of y scroll */ case 3: /* Low byte of y scroll */
case 4: /* High byte of y scroll */ case 4: /* High byte of y scroll */
map->set_scrolly(0, (int)scroll[3] | ((int)scroll[4] << 8)); map->set_scrolly(0, (unsigned)scroll[3] | ((unsigned)scroll[4] << 8));
break; break;
case 6: /* Tilemap enable and mode control */ case 6: /* Tilemap enable and mode control */
map->enable(!(data & 0x10)); map->enable(!(data & 0x10));
@ -43,55 +43,31 @@ inline void dooyong_state::dooyong_scroll8_w(offs_t offset, UINT8 data, UINT8 *s
} }
/* These handle writes to the tilemap scroll registers in 8-bit machines. /* These handle writes to the tilemap scroll registers.
There is one per tilemap, wrapping the above function that does the work. */ There is one per tilemap, wrapping the above function that does the work. */
WRITE8_MEMBER(dooyong_state::dooyong_bgscroll8_w) WRITE8_MEMBER(dooyong_state::bgscroll_w)
{ {
dooyong_scroll8_w(offset, data, m_bgscroll8, m_bg_tilemap); scroll8_w(offset, data, m_bgscroll8, m_bg_tilemap);
} }
WRITE8_MEMBER(dooyong_state::dooyong_bg2scroll8_w) WRITE8_MEMBER(dooyong_state::bg2scroll_w)
{ {
dooyong_scroll8_w(offset, data, m_bg2scroll8, m_bg2_tilemap); scroll8_w(offset, data, m_bg2scroll8, m_bg2_tilemap);
} }
WRITE8_MEMBER(dooyong_state::dooyong_fgscroll8_w) WRITE8_MEMBER(dooyong_state::fgscroll_w)
{ {
dooyong_scroll8_w(offset, data, m_fgscroll8, m_fg_tilemap); scroll8_w(offset, data, m_fgscroll8, m_fg_tilemap);
} }
WRITE8_MEMBER(dooyong_state::dooyong_fg2scroll8_w) WRITE8_MEMBER(dooyong_state::fg2scroll_w)
{ {
dooyong_scroll8_w(offset, data, m_fg2scroll8, m_fg2_tilemap); scroll8_w(offset, data, m_fg2scroll8, m_fg2_tilemap);
} }
/* These handle writes to the tilemap scroll registers in 16-bit machines. WRITE8_MEMBER(dooyong_z80_state::txvideoram_w)
This is just an 8-bit peripheral in a 16-bit machine. */
WRITE16_MEMBER(dooyong_state::dooyong_bgscroll16_w)
{
if (ACCESSING_BITS_0_7) dooyong_bgscroll8_w(space, offset, data & 0x00ff);
}
WRITE16_MEMBER(dooyong_state::dooyong_bg2scroll16_w)
{
if (ACCESSING_BITS_0_7) dooyong_bg2scroll8_w(space, offset, data & 0x00ff);
}
WRITE16_MEMBER(dooyong_state::dooyong_fgscroll16_w)
{
if (ACCESSING_BITS_0_7) dooyong_fgscroll8_w(space, offset, data & 0x00ff);
}
WRITE16_MEMBER(dooyong_state::dooyong_fg2scroll16_w)
{
if (ACCESSING_BITS_0_7) dooyong_fg2scroll8_w(space, offset, data & 0x00ff);
}
WRITE8_MEMBER(dooyong_state::dooyong_txvideoram8_w)
{ {
if (m_txvideoram[offset] != data) if (m_txvideoram[offset] != data)
{ {
@ -106,7 +82,7 @@ WRITE8_MEMBER(dooyong_state::dooyong_txvideoram8_w)
/* Control registers seem to be different on every game */ /* Control registers seem to be different on every game */
WRITE8_MEMBER(dooyong_state::lastday_ctrl_w) WRITE8_MEMBER(dooyong_z80_ym2203_state::lastday_ctrl_w)
{ {
/* bits 0 and 1 are coin counters */ /* bits 0 and 1 are coin counters */
coin_counter_w(machine(), 0, data & 0x01); coin_counter_w(machine(), 0, data & 0x01);
@ -121,7 +97,7 @@ WRITE8_MEMBER(dooyong_state::lastday_ctrl_w)
flip_screen_set(data & 0x40); flip_screen_set(data & 0x40);
} }
WRITE8_MEMBER(dooyong_state::pollux_ctrl_w) WRITE8_MEMBER(dooyong_z80_ym2203_state::pollux_ctrl_w)
{ {
/* bit 0 is flip screen */ /* bit 0 is flip screen */
flip_screen_set(data & 0x01); flip_screen_set(data & 0x01);
@ -136,7 +112,7 @@ WRITE8_MEMBER(dooyong_state::pollux_ctrl_w)
/* bit 4 is used but unknown */ /* bit 4 is used but unknown */
} }
WRITE8_MEMBER(dooyong_state::primella_ctrl_w) WRITE8_MEMBER(dooyong_z80_state::primella_ctrl_w)
{ {
/* bits 0-2 select ROM bank */ /* bits 0-2 select ROM bank */
membank("bank1")->set_entry(data & 0x07); membank("bank1")->set_entry(data & 0x07);
@ -152,7 +128,7 @@ WRITE8_MEMBER(dooyong_state::primella_ctrl_w)
// logerror("%04x: bankswitch = %02x\n",space.device().safe_pc(),data&0xe0); // logerror("%04x: bankswitch = %02x\n",space.device().safe_pc(),data&0xe0);
} }
WRITE8_MEMBER(dooyong_state::paletteram_flytiger_w) WRITE8_MEMBER(dooyong_z80_state::paletteram_flytiger_w)
{ {
if (m_flytiger_palette_bank) if (m_flytiger_palette_bank)
{ {
@ -163,7 +139,7 @@ WRITE8_MEMBER(dooyong_state::paletteram_flytiger_w)
} }
} }
WRITE8_MEMBER(dooyong_state::flytiger_ctrl_w) WRITE8_MEMBER(dooyong_z80_state::flytiger_ctrl_w)
{ {
/* bit 0 is flip screen */ /* bit 0 is flip screen */
flip_screen_set(data & 0x01); flip_screen_set(data & 0x01);
@ -177,21 +153,6 @@ WRITE8_MEMBER(dooyong_state::flytiger_ctrl_w)
m_flytiger_pri = data & 0x10; m_flytiger_pri = data & 0x10;
} }
WRITE16_MEMBER(dooyong_state::rshark_ctrl_w)
{
if (ACCESSING_BITS_0_7)
{
/* bit 0 flips screen */
flip_screen_set(data & 0x0001);
/* bit 4 changes tilemaps priority */
m_rshark_pri = data & 0x0010;
/* bit 5 used but unknown */
}
}
/* These games all have ROM-based tilemaps for the backgrounds, title /* These games all have ROM-based tilemaps for the backgrounds, title
screens and sometimes "bosses" and special attacks. There are three screens and sometimes "bosses" and special attacks. There are three
@ -203,11 +164,11 @@ WRITE16_MEMBER(dooyong_state::rshark_ctrl_w)
when the x scroll moves out of range (trying to decode the whole lot when the x scroll moves out of range (trying to decode the whole lot
at once uses hundreds of megabytes of RAM). */ at once uses hundreds of megabytes of RAM). */
inline void dooyong_state::lastday_get_tile_info(tile_data &tileinfo, int tile_index, inline void dooyong_state::get_tile_info(tile_data &tileinfo, int tile_index,
const UINT8 *tilerom, UINT8 *scroll, int graphics) UINT8 const *tilerom, UINT8 const *scroll, int graphics)
{ {
int offs = (tile_index + ((int)scroll[1] << 6)) * 2; int const offs = (tile_index + ((int)scroll[1] << 6)) * 2;
int attr = tilerom[offs]; int const attr = tilerom[offs];
int code, color, flags; int code, color, flags;
if (scroll[6] & 0x20) if (scroll[6] & 0x20)
{ /* lastday/gulfstrm/pollux/flytiger */ { /* lastday/gulfstrm/pollux/flytiger */
@ -221,11 +182,10 @@ inline void dooyong_state::lastday_get_tile_info(tile_data &tileinfo, int tile_i
Y = y flip */ Y = y flip */
code = tilerom[offs + 1] | ((attr & 0x01) << 8) | ((attr & 0x80) << 2); code = tilerom[offs + 1] | ((attr & 0x01) << 8) | ((attr & 0x80) << 2);
color = (attr & 0x78) >> 3; color = (attr & 0x78) >> 3;
flags = ((attr & 0x02) ? TILE_FLIPX : 0) | ((attr & 0x04) ? TILE_FLIPY : 0); flags = TILE_FLIPYX((attr & 0x06) >> 1);
} }
else else
{ { /* primella/popbingo */
/* primella */
/* Tiles take two bytes in ROM: /* Tiles take two bytes in ROM:
MSB LSB MSB LSB
[offs + 0x00] YXCC CCcc (Y flip, X flip, bits 3-0 of color code, bits 9-8 of gfx code) [offs + 0x00] YXCC CCcc (Y flip, X flip, bits 3-0 of color code, bits 9-8 of gfx code)
@ -245,80 +205,33 @@ inline void dooyong_state::lastday_get_tile_info(tile_data &tileinfo, int tile_i
code = tilerom[offs + 1] | ((attr & codemask) << 8); code = tilerom[offs + 1] | ((attr & codemask) << 8);
color = (attr & palmask) >> 2; color = (attr & palmask) >> 2;
flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x80) ? TILE_FLIPY : 0); flags = TILE_FLIPYX((attr & 0xC0) >> 6);
} }
SET_TILE_INFO_MEMBER(graphics, code, color, flags); tileinfo.set(graphics, code, color, flags);
}
inline void dooyong_state::rshark_get_tile_info(tile_data &tileinfo, int tile_index,
const UINT8 *tilerom1, const UINT8 *tilerom2, UINT8 *scroll, int graphics)
{
/* Tiles take two bytes in tile ROM 1:
MSB LSB
[offs + 0x00] YX?c cccc (Y flip, X flip, bits 12-8 of gfx code)
[offs + 0x01] cccc cccc (bits 7-0 of gfx code)
? = unused/unknown
c = gfx code
X = x flip
Y = y flip */
int offs = tile_index + ((int)scroll[1] << 9);
int attr = tilerom1[offs * 2];
int code = tilerom1[(offs * 2) + 1] | ((attr & 0x1f) << 8);
int color = tilerom2[offs] & 0x0f;
int flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x80) ? TILE_FLIPY : 0);
SET_TILE_INFO_MEMBER(graphics, code, color, flags);
} }
TILE_GET_INFO_MEMBER(dooyong_state::get_bg_tile_info) TILE_GET_INFO_MEMBER(dooyong_state::get_bg_tile_info)
{ {
if (m_bg_tilerom2 != NULL) get_tile_info(tileinfo, tile_index, m_bg_tilerom, m_bgscroll8, m_bg_gfx);
rshark_get_tile_info(tileinfo, tile_index, m_bg_tilerom, m_bg_tilerom2, m_bgscroll8, m_bg_gfx);
else
lastday_get_tile_info(tileinfo, tile_index, m_bg_tilerom, m_bgscroll8, m_bg_gfx);
} }
TILE_GET_INFO_MEMBER(dooyong_state::get_bg2_tile_info) TILE_GET_INFO_MEMBER(dooyong_state::get_bg2_tile_info)
{ {
if (m_bg2_tilerom2 != NULL) get_tile_info(tileinfo, tile_index, m_bg2_tilerom, m_bg2scroll8, m_bg2_gfx);
rshark_get_tile_info(tileinfo, tile_index, m_bg2_tilerom, m_bg2_tilerom2, m_bg2scroll8, m_bg2_gfx);
else
lastday_get_tile_info(tileinfo, tile_index, m_bg2_tilerom, m_bg2scroll8, m_bg2_gfx);
} }
TILE_GET_INFO_MEMBER(dooyong_state::get_fg_tile_info) TILE_GET_INFO_MEMBER(dooyong_state::get_fg_tile_info)
{ {
if (m_fg_tilerom2 != NULL) get_tile_info(tileinfo, tile_index, m_fg_tilerom, m_fgscroll8, m_fg_gfx);
rshark_get_tile_info(tileinfo, tile_index, m_fg_tilerom, m_fg_tilerom2, m_fgscroll8, m_fg_gfx);
else
lastday_get_tile_info(tileinfo, tile_index, m_fg_tilerom, m_fgscroll8, m_fg_gfx);
} }
TILE_GET_INFO_MEMBER(dooyong_state::get_fg2_tile_info) TILE_GET_INFO_MEMBER(dooyong_state::get_fg2_tile_info)
{ {
if (m_fg2_tilerom2 != NULL) get_tile_info(tileinfo, tile_index, m_fg2_tilerom, m_fg2scroll8, m_fg2_gfx);
rshark_get_tile_info(tileinfo, tile_index, m_fg2_tilerom, m_fg2_tilerom2, m_fg2scroll8, m_fg2_gfx);
else
lastday_get_tile_info(tileinfo, tile_index, m_fg2_tilerom, m_fg2scroll8, m_fg2_gfx);
} }
/* flytiger uses some palette banking technique or something maybe a trash protection */ TILE_GET_INFO_MEMBER(dooyong_z80_state::get_tx_tile_info)
TILE_GET_INFO_MEMBER(dooyong_state::flytiger_get_fg_tile_info)
{
const UINT8 *tilerom = m_fg_tilerom;
int offs = (tile_index + (m_fgscroll8[1] << 6)) * 2;
int attr = tilerom[offs];
int code = tilerom[offs + 1] | ((attr & 0x01) << 8) | ((attr & 0x80) << 2);
int color = (attr & 0x78) >> 3;
int flags = ((attr & 0x02) ? TILE_FLIPX : 0) | ((attr & 0x04) ? TILE_FLIPY : 0);
SET_TILE_INFO_MEMBER(m_fg_gfx, code, color, flags);
}
TILE_GET_INFO_MEMBER(dooyong_state::get_tx_tile_info)
{ {
/* Each tile takes two bytes of memory: /* Each tile takes two bytes of memory:
MSB LSB MSB LSB
@ -326,7 +239,7 @@ TILE_GET_INFO_MEMBER(dooyong_state::get_tx_tile_info)
[offs + 0x01] CCCC cccc (bits 3-0 of color code, bits 11-8 of gfx code) [offs + 0x01] CCCC cccc (bits 3-0 of color code, bits 11-8 of gfx code)
c = gfx code c = gfx code
C = color code */ C = color code */
int offs, attr, code, color; unsigned offs, attr;
if (m_tx_tilemap_mode == 0) if (m_tx_tilemap_mode == 0)
{ /* lastday/gulfstrm/pollux/flytiger */ { /* lastday/gulfstrm/pollux/flytiger */
offs = tile_index; offs = tile_index;
@ -337,14 +250,14 @@ TILE_GET_INFO_MEMBER(dooyong_state::get_tx_tile_info)
offs = tile_index * 2; offs = tile_index * 2;
attr = m_txvideoram[offs + 1]; attr = m_txvideoram[offs + 1];
} }
code = m_txvideoram[offs] | ((attr & 0x0f) << 8); int const code = m_txvideoram[offs] | ((attr & 0x0f) << 8);
color = (attr & 0xf0) >> 4; int const color = (attr & 0xf0) >> 4;
SET_TILE_INFO_MEMBER(0, code, color, 0); tileinfo.set(0, code, color, 0);
} }
void dooyong_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pollux_extensions) void dooyong_z80_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, unsigned extensions)
{ {
/* Sprites take 32 bytes each in memory: /* Sprites take 32 bytes each in memory:
MSB LSB MSB LSB
@ -364,53 +277,45 @@ void dooyong_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co
w = width w = width
X = x flip X = x flip
Y = y flip Y = y flip
* = alters y position in pollux and flytiger - see code below * = alters y position in bluehawk and flytiger - see code below
bit 11 of gfx code only used by gulfstrm, pollux, bluehawk and flytiger bit 11 of gfx code only used by gulfstrm, pollux, bluehawk and flytiger
height only used by pollux, bluehawk and flytiger height only used by pollux, bluehawk and flytiger
x flip and y flip only used by pollux and flytiger */ x flip and y flip only used by pollux and flytiger */
UINT8 *buffered_spriteram = m_spriteram->buffer(); UINT8 const *const buffered_spriteram = m_spriteram->buffer();
int offs; for (int offs = 0; offs < m_spriteram->bytes(); offs += 32)
for (offs = 0; offs < m_spriteram->bytes(); offs += 32)
{ {
int sx, sy, code, color, pri; int sx = buffered_spriteram[offs+3] | ((buffered_spriteram[offs+1] & 0x10) << 4);
int flipx = 0, flipy = 0, height = 0, y; int sy = buffered_spriteram[offs+2];
int code = buffered_spriteram[offs] | ((buffered_spriteram[offs+1] & 0xe0) << 3);
sx = buffered_spriteram[offs+3] | ((buffered_spriteram[offs+1] & 0x10) << 4); int const color = buffered_spriteram[offs+1] & 0x0f;
sy = buffered_spriteram[offs+2];
code = buffered_spriteram[offs] | ((buffered_spriteram[offs+1] & 0xe0) << 3);
color = buffered_spriteram[offs+1] & 0x0f;
//TODO: This priority mechanism works for known games, but seems a bit strange. //TODO: This priority mechanism works for known games, but seems a bit strange.
//Are we missing something? (The obvious spare palette bit isn't it.) //Are we missing something? (The obvious spare palette bit isn't it.)
pri = (((color == 0x00) || (color == 0x0f)) ? 0xfc : 0xf0); int const pri = (((color == 0x00) || (color == 0x0f)) ? 0xfc : 0xf0);
if (pollux_extensions) bool flipx = false, flipy = false;
int height = 0;
if (extensions)
{ {
/* gulfstrm, pollux, bluehawk, flytiger */ UINT8 const ext = buffered_spriteram[offs+0x1c];
code |= ((buffered_spriteram[offs+0x1c] & 0x01) << 11);
if (pollux_extensions >= 2) if (extensions & SPRITE_12BIT)
code |= ((ext & 0x01) << 11);
if (extensions & SPRITE_HEIGHT)
{ {
/* pollux, bluehawk, flytiger */ height = (ext & 0x70) >> 4;
height = (buffered_spriteram[offs+0x1c] & 0x70) >> 4;
code &= ~height; code &= ~height;
flipx = buffered_spriteram[offs+0x1c] & 0x08; flipx = ext & 0x08;
flipy = buffered_spriteram[offs+0x1c] & 0x04; flipy = ext & 0x04;
if (pollux_extensions == 3)
{
/* bluehawk */
sy += 6 - ((~buffered_spriteram[offs+0x1c] & 0x02) << 7);
}
if (pollux_extensions == 4)
{
/* flytiger */
sy -=(buffered_spriteram[offs+0x1c] & 0x02) << 7;
}
} }
if (extensions & SPRITE_YSHIFT_BLUEHAWK)
sy += 6 - ((~ext & 0x02) << 7);
if (extensions & SPRITE_YSHIFT_FLYTIGER)
sy -=(ext & 0x02) << 7;
} }
if (flip_screen()) if (flip_screen())
@ -421,7 +326,7 @@ void dooyong_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co
flipy = !flipy; flipy = !flipy;
} }
for (y = 0; y <= height; y++) for (int y = 0; y <= height; y++)
{ {
m_gfxdecode->gfx(1)->prio_transpen(bitmap,cliprect, m_gfxdecode->gfx(1)->prio_transpen(bitmap,cliprect,
code + y, code + y,
@ -434,79 +339,8 @@ void dooyong_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co
} }
} }
void dooyong_state::rshark_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
UINT16 *buffered_spriteram16 = m_spriteram16->buffer();
/* Sprites take 8 16-bit words each in memory: UINT32 dooyong_z80_ym2203_state::screen_update_lastday(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
MSB LSB
[offs + 0] ???? ???? ???? ???E
[offs + 1] ???? ???? hhhh wwww
[offs + 2] ???? ???? ???? ????
[offs + 3] cccc cccc cccc cccc
[offs + 4] ???? ???x xxxx xxxx
[offs + 5] ???? ???? ???? ????
[offs + 6] ???? ???y yyyy yyyy
[offs + 7] ???? ???? ???? CCCC
? = unused/unknown
E = enable
c = gfx code
x = x offset
y = y offset (signed)
C = color code
w = width
h = height */
int offs;
for (offs = (m_spriteram16->bytes() / 2) - 8; offs >= 0; offs -= 8)
{
if (buffered_spriteram16[offs] & 0x0001) /* enable */
{
int sx, sy, code, color, pri;
int flipx = 0, flipy = 0, width, height, x, y;
sx = buffered_spriteram16[offs+4] & 0x01ff;
sy = (INT16)buffered_spriteram16[offs+6] & 0x01ff;
if (sy & 0x0100) sy |= ~(int)0x01ff; // Correctly sign-extend 9-bit number
code = buffered_spriteram16[offs+3];
color = buffered_spriteram16[offs+7] & 0x000f;
//TODO: This priority mechanism works for known games, but seems a bit strange.
//Are we missing something? (The obvious spare palette bit isn't it.)
pri = (((color == 0x00) || (color == 0x0f)) ? 0xfc : 0xf0);
width = buffered_spriteram16[offs+1] & 0x000f;
height = (buffered_spriteram16[offs+1] & 0x00f0) >> 4;
if (flip_screen())
{
sx = 498 - (16 * width) - sx;
sy = 240 - (16 * height) - sy;
flipx = !flipx;
flipy = !flipy;
}
for (y = 0; y <= height; y++)
{
int _y = sy + (16 * (flipy ? (height - y) : y));
for (x = 0; x <= width; x++)
{
int _x = sx + (16 * (flipx ? (width - x) : x));
m_gfxdecode->gfx(0)->prio_transpen(bitmap,cliprect,
code,
color,
flipx, flipy,
_x, _y,
screen.priority(),
pri, 15);
code++;
}
}
}
}
}
UINT32 dooyong_state::screen_update_lastday(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
bitmap.fill(m_palette->black_pen(), cliprect); bitmap.fill(m_palette->black_pen(), cliprect);
screen.priority().fill(0, cliprect); screen.priority().fill(0, cliprect);
@ -516,11 +350,12 @@ UINT32 dooyong_state::screen_update_lastday(screen_device &screen, bitmap_ind16
m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4); m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4);
if (!m_sprites_disabled) if (!m_sprites_disabled)
draw_sprites(screen, bitmap, cliprect, 0); draw_sprites(screen, bitmap, cliprect);
return 0; return 0;
} }
UINT32 dooyong_state::screen_update_gulfstrm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 dooyong_z80_ym2203_state::screen_update_gulfstrm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
bitmap.fill(m_palette->black_pen(), cliprect); bitmap.fill(m_palette->black_pen(), cliprect);
screen.priority().fill(0, cliprect); screen.priority().fill(0, cliprect);
@ -529,11 +364,12 @@ UINT32 dooyong_state::screen_update_gulfstrm(screen_device &screen, bitmap_ind16
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2); m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2);
m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4); m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4);
draw_sprites(screen, bitmap, cliprect, 1); draw_sprites(screen, bitmap, cliprect, SPRITE_12BIT);
return 0; return 0;
} }
UINT32 dooyong_state::screen_update_pollux(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 dooyong_z80_ym2203_state::screen_update_pollux(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
bitmap.fill(m_palette->black_pen(), cliprect); bitmap.fill(m_palette->black_pen(), cliprect);
screen.priority().fill(0, cliprect); screen.priority().fill(0, cliprect);
@ -542,11 +378,12 @@ UINT32 dooyong_state::screen_update_pollux(screen_device &screen, bitmap_ind16 &
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2); m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2);
m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4); m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4);
draw_sprites(screen, bitmap, cliprect, 2); draw_sprites(screen, bitmap, cliprect, SPRITE_12BIT | SPRITE_HEIGHT);
return 0; return 0;
} }
UINT32 dooyong_state::screen_update_flytiger(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 dooyong_z80_state::screen_update_flytiger(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
bitmap.fill(m_palette->black_pen(), cliprect); bitmap.fill(m_palette->black_pen(), cliprect);
screen.priority().fill(0, cliprect); screen.priority().fill(0, cliprect);
@ -563,12 +400,13 @@ UINT32 dooyong_state::screen_update_flytiger(screen_device &screen, bitmap_ind16
} }
m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4); m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4);
draw_sprites(screen, bitmap, cliprect, 4); draw_sprites(screen, bitmap, cliprect, SPRITE_12BIT | SPRITE_HEIGHT | SPRITE_YSHIFT_FLYTIGER);
return 0; return 0;
} }
UINT32 dooyong_state::screen_update_bluehawk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 dooyong_z80_state::screen_update_bluehawk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
bitmap.fill(m_palette->black_pen(), cliprect); bitmap.fill(m_palette->black_pen(), cliprect);
screen.priority().fill(0, cliprect); screen.priority().fill(0, cliprect);
@ -578,11 +416,12 @@ UINT32 dooyong_state::screen_update_bluehawk(screen_device &screen, bitmap_ind16
m_fg2_tilemap->draw(screen, bitmap, cliprect, 0, 4); m_fg2_tilemap->draw(screen, bitmap, cliprect, 0, 4);
m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4); m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4);
draw_sprites(screen, bitmap, cliprect, 3); draw_sprites(screen, bitmap, cliprect, SPRITE_12BIT | SPRITE_HEIGHT | SPRITE_YSHIFT_BLUEHAWK);
return 0; return 0;
} }
UINT32 dooyong_state::screen_update_primella(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 dooyong_z80_state::screen_update_primella(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
bitmap.fill(m_palette->black_pen(), cliprect); bitmap.fill(m_palette->black_pen(), cliprect);
@ -590,42 +429,15 @@ UINT32 dooyong_state::screen_update_primella(screen_device &screen, bitmap_ind16
if (m_tx_pri) m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); if (m_tx_pri) m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0);
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
if (!m_tx_pri) m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); if (!m_tx_pri) m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0);
return 0; return 0;
} }
UINT32 dooyong_state::screen_update_rshark(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) VIDEO_START_MEMBER(dooyong_z80_ym2203_state, lastday)
{
bitmap.fill(m_palette->black_pen(), cliprect);
screen.priority().fill(0, cliprect);
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 1);
m_bg2_tilemap->draw(screen, bitmap, cliprect, 0, (m_rshark_pri ? 2 : 1));
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2);
m_fg2_tilemap->draw(screen, bitmap, cliprect, 0, 2);
rshark_draw_sprites(screen, bitmap, cliprect);
return 0;
}
UINT32 dooyong_state::screen_update_popbingo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
bitmap.fill(m_palette->black_pen(), cliprect);
screen.priority().fill(0, cliprect);
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 1);
rshark_draw_sprites(screen, bitmap, cliprect);
return 0;
}
VIDEO_START_MEMBER(dooyong_state,lastday)
{ {
/* Configure tilemap callbacks */ /* Configure tilemap callbacks */
m_bg_tilerom = memregion("gfx5")->base(); m_bg_tilerom = memregion("gfx5")->base();
m_fg_tilerom = memregion("gfx6")->base(); m_fg_tilerom = memregion("gfx6")->base();
m_bg_tilerom2 = NULL;
m_fg_tilerom2 = NULL;
m_bg_gfx = 2; m_bg_gfx = 2;
m_fg_gfx = 3; m_fg_gfx = 3;
m_tx_tilemap_mode = 0; m_tx_tilemap_mode = 0;
@ -635,7 +447,7 @@ VIDEO_START_MEMBER(dooyong_state,lastday)
32, 32, 32, 8); 32, 32, 32, 8);
m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS, m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,
32, 32, 32, 8); 32, 32, 32, 8);
m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS, m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS,
8, 8, 64, 32); 8, 8, 64, 32);
/* Configure tilemap transparency */ /* Configure tilemap transparency */
@ -658,13 +470,11 @@ VIDEO_START_MEMBER(dooyong_state,lastday)
save_item(NAME(m_interrupt_line_2)); save_item(NAME(m_interrupt_line_2));
} }
VIDEO_START_MEMBER(dooyong_state,gulfstrm) VIDEO_START_MEMBER(dooyong_z80_ym2203_state, gulfstrm)
{ {
/* Configure tilemap callbacks */ /* Configure tilemap callbacks */
m_bg_tilerom = memregion("gfx5")->base(); m_bg_tilerom = memregion("gfx5")->base();
m_fg_tilerom = memregion("gfx6")->base(); m_fg_tilerom = memregion("gfx6")->base();
m_bg_tilerom2 = NULL;
m_fg_tilerom2 = NULL;
m_bg_gfx = 2; m_bg_gfx = 2;
m_fg_gfx = 3; m_fg_gfx = 3;
m_tx_tilemap_mode = 0; m_tx_tilemap_mode = 0;
@ -674,7 +484,7 @@ VIDEO_START_MEMBER(dooyong_state,gulfstrm)
32, 32, 32, 8); 32, 32, 32, 8);
m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS, m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,
32, 32, 32, 8); 32, 32, 32, 8);
m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS, m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS,
8, 8, 64, 32); 8, 8, 64, 32);
/* Configure tilemap transparency */ /* Configure tilemap transparency */
@ -696,13 +506,11 @@ VIDEO_START_MEMBER(dooyong_state,gulfstrm)
save_item(NAME(m_interrupt_line_2)); save_item(NAME(m_interrupt_line_2));
} }
VIDEO_START_MEMBER(dooyong_state,pollux) VIDEO_START_MEMBER(dooyong_z80_ym2203_state, pollux)
{ {
/* Configure tilemap callbacks */ /* Configure tilemap callbacks */
m_bg_tilerom = memregion("gfx5")->base(); m_bg_tilerom = memregion("gfx5")->base();
m_fg_tilerom = memregion("gfx6")->base(); m_fg_tilerom = memregion("gfx6")->base();
m_bg_tilerom2 = NULL;
m_fg_tilerom2 = NULL;
m_bg_gfx = 2; m_bg_gfx = 2;
m_fg_gfx = 3; m_fg_gfx = 3;
m_tx_tilemap_mode = 0; m_tx_tilemap_mode = 0;
@ -712,7 +520,7 @@ VIDEO_START_MEMBER(dooyong_state,pollux)
32, 32, 32, 8); 32, 32, 32, 8);
m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS, m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,
32, 32, 32, 8); 32, 32, 32, 8);
m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS, m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS,
8, 8, 64, 32); 8, 8, 64, 32);
/* Configure tilemap transparency */ /* Configure tilemap transparency */
@ -731,15 +539,12 @@ VIDEO_START_MEMBER(dooyong_state,pollux)
save_item(NAME(m_interrupt_line_2)); save_item(NAME(m_interrupt_line_2));
} }
VIDEO_START_MEMBER(dooyong_state,bluehawk) VIDEO_START_MEMBER(dooyong_z80_state, bluehawk)
{ {
/* Configure tilemap callbacks */ /* Configure tilemap callbacks */
m_bg_tilerom = memregion("gfx3")->base() + 0x78000; m_bg_tilerom = memregion("gfx3")->base() + 0x78000;
m_fg_tilerom = memregion("gfx4")->base() + 0x78000; m_fg_tilerom = memregion("gfx4")->base() + 0x78000;
m_fg2_tilerom = memregion("gfx5")->base() + 0x38000; m_fg2_tilerom = memregion("gfx5")->base() + 0x38000;
m_bg_tilerom2 = NULL;
m_fg_tilerom2 = NULL;
m_fg2_tilerom2 = NULL;
m_bg_gfx = 2; m_bg_gfx = 2;
m_fg_gfx = 3; m_fg_gfx = 3;
m_fg2_gfx = 4; m_fg2_gfx = 4;
@ -752,7 +557,7 @@ VIDEO_START_MEMBER(dooyong_state,bluehawk)
32, 32, 32, 8); 32, 32, 32, 8);
m_fg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg2_tile_info),this), TILEMAP_SCAN_COLS, m_fg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg2_tile_info),this), TILEMAP_SCAN_COLS,
32, 32, 32, 8); 32, 32, 32, 8);
m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS, m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS,
8, 8, 64, 32); 8, 8, 64, 32);
/* Configure tilemap transparency */ /* Configure tilemap transparency */
@ -771,13 +576,11 @@ VIDEO_START_MEMBER(dooyong_state,bluehawk)
save_item(NAME(m_fg2scroll8)); save_item(NAME(m_fg2scroll8));
} }
VIDEO_START_MEMBER(dooyong_state,flytiger) VIDEO_START_MEMBER(dooyong_z80_state, flytiger)
{ {
/* Configure tilemap callbacks */ /* Configure tilemap callbacks */
m_bg_tilerom = memregion("gfx3")->base() + 0x78000; m_bg_tilerom = memregion("gfx3")->base() + 0x78000;
m_fg_tilerom = memregion("gfx4")->base() + 0x78000; m_fg_tilerom = memregion("gfx4")->base() + 0x78000;
m_bg_tilerom2 = NULL;
m_fg_tilerom2 = NULL;
m_bg_gfx = 2; m_bg_gfx = 2;
m_fg_gfx = 3; m_fg_gfx = 3;
m_tx_tilemap_mode = 0; m_tx_tilemap_mode = 0;
@ -785,9 +588,9 @@ VIDEO_START_MEMBER(dooyong_state,flytiger)
/* Create tilemaps */ /* Create tilemaps */
m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS, m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS,
32, 32, 32, 8); 32, 32, 32, 8);
m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::flytiger_get_fg_tile_info),this), TILEMAP_SCAN_COLS, m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,
32, 32, 32, 8); 32, 32, 32, 8);
m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS, m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS,
8, 8, 64, 32); 8, 8, 64, 32);
/* Configure tilemap transparency */ /* Configure tilemap transparency */
@ -806,13 +609,11 @@ VIDEO_START_MEMBER(dooyong_state,flytiger)
save_item(NAME(m_flytiger_pri)); save_item(NAME(m_flytiger_pri));
} }
VIDEO_START_MEMBER(dooyong_state,primella) VIDEO_START_MEMBER(dooyong_z80_state, primella)
{ {
/* Configure tilemap callbacks */ /* Configure tilemap callbacks */
m_bg_tilerom = memregion("gfx2")->base() + memregion("gfx2")->bytes() - 0x8000; m_bg_tilerom = memregion("gfx2")->base() + memregion("gfx2")->bytes() - 0x8000;
m_fg_tilerom = memregion("gfx3")->base() + memregion("gfx3")->bytes() - 0x8000; m_fg_tilerom = memregion("gfx3")->base() + memregion("gfx3")->bytes() - 0x8000;
m_bg_tilerom2 = NULL;
m_fg_tilerom2 = NULL;
m_bg_gfx = 1; m_bg_gfx = 1;
m_fg_gfx = 2; m_fg_gfx = 2;
m_tx_tilemap_mode = 1; m_tx_tilemap_mode = 1;
@ -822,7 +623,7 @@ VIDEO_START_MEMBER(dooyong_state,primella)
32, 32, 32, 8); 32, 32, 32, 8);
m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS, m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,
32, 32, 32, 8); 32, 32, 32, 8);
m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS, m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS,
8, 8, 64, 32); 8, 8, 64, 32);
/* Configure tilemap transparency */ /* Configure tilemap transparency */
@ -840,7 +641,156 @@ VIDEO_START_MEMBER(dooyong_state,primella)
save_item(NAME(m_tx_pri)); save_item(NAME(m_tx_pri));
} }
VIDEO_START_MEMBER(dooyong_state,rshark)
WRITE16_MEMBER(dooyong_68k_state::ctrl_w)
{
if (ACCESSING_BITS_0_7)
{
/* bit 0 flips screen */
flip_screen_set(data & 0x0001);
/* bit 4 changes tilemaps priority */
m_bg2_priority = data & 0x0010;
/* bit 5 used but unknown */
}
}
inline void dooyong_68k_state::rshark_get_tile_info(tile_data &tileinfo, int tile_index,
UINT8 const *tilerom1, UINT8 const *tilerom2, UINT8 const *scroll, int graphics)
{
/* Tiles take two bytes in tile ROM 1:
MSB LSB
[offs + 0x00] YX?c cccc (Y flip, X flip, bits 12-8 of gfx code)
[offs + 0x01] cccc cccc (bits 7-0 of gfx code)
? = unused/unknown
c = gfx code
X = x flip
Y = y flip */
int const offs = tile_index + ((int)scroll[1] << 9);
int const attr = tilerom1[offs * 2];
int const code = tilerom1[(offs * 2) + 1] | ((attr & 0x1f) << 8);
int const color = tilerom2[offs] & 0x0f;
int const flags = TILE_FLIPYX((attr & 0xC0) >> 6);
tileinfo.set(graphics, code, color, flags);
}
TILE_GET_INFO_MEMBER(dooyong_68k_state::rshark_get_bg_tile_info)
{
rshark_get_tile_info(tileinfo, tile_index, m_bg_tilerom, m_bg_tilerom2, m_bgscroll8, m_bg_gfx);
}
TILE_GET_INFO_MEMBER(dooyong_68k_state::rshark_get_bg2_tile_info)
{
rshark_get_tile_info(tileinfo, tile_index, m_bg2_tilerom, m_bg2_tilerom2, m_bg2scroll8, m_bg2_gfx);
}
TILE_GET_INFO_MEMBER(dooyong_68k_state::rshark_get_fg_tile_info)
{
rshark_get_tile_info(tileinfo, tile_index, m_fg_tilerom, m_fg_tilerom2, m_fgscroll8, m_fg_gfx);
}
TILE_GET_INFO_MEMBER(dooyong_68k_state::rshark_get_fg2_tile_info)
{
rshark_get_tile_info(tileinfo, tile_index, m_fg2_tilerom, m_fg2_tilerom2, m_fg2scroll8, m_fg2_gfx);
}
void dooyong_68k_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
/* Sprites take 8 16-bit words each in memory:
MSB LSB
[offs + 0] ???? ???? ???? ???E
[offs + 1] ???? ???? hhhh wwww
[offs + 2] ???? ???? ???? ????
[offs + 3] cccc cccc cccc cccc
[offs + 4] ???? ???x xxxx xxxx
[offs + 5] ???? ???? ???? ????
[offs + 6] ???? ???y yyyy yyyy
[offs + 7] ???? ???? ???? CCCC
? = unused/unknown
E = enable
c = gfx code
x = x offset
y = y offset (signed)
C = color code
w = width
h = height */
UINT16 const *const buffered_spriteram = m_spriteram->buffer();
for (int offs = (m_spriteram->bytes() / 2) - 8; offs >= 0; offs -= 8)
{
if (buffered_spriteram[offs] & 0x0001) /* enable */
{
int code = buffered_spriteram[offs+3];
int const color = buffered_spriteram[offs+7] & 0x000f;
//TODO: This priority mechanism works for known games, but seems a bit strange.
//Are we missing something? (The obvious spare palette bit isn't it.)
int const pri = (((color == 0x00) || (color == 0x0f)) ? 0xfc : 0xf0);
int const width = buffered_spriteram[offs+1] & 0x000f;
int const height = (buffered_spriteram[offs+1] & 0x00f0) >> 4;
bool const flip = flip_screen();
int sx = buffered_spriteram[offs+4] & 0x01ff;
int sy = (INT16)buffered_spriteram[offs+6] & 0x01ff;
if (sy & 0x0100) sy |= ~(int)0x01ff; // Correctly sign-extend 9-bit number
if (flip)
{
sx = 498 - (16 * width) - sx;
sy = 240 - (16 * height) - sy;
}
for (int y = 0; y <= height; y++)
{
int const _y = sy + (16 * (flip ? (height - y) : y));
for (int x = 0; x <= width; x++)
{
int const _x = sx + (16 * (flip ? (width - x) : x));
m_gfxdecode->gfx(0)->prio_transpen(bitmap,cliprect,
code,
color,
flip, flip,
_x, _y,
screen.priority(),
pri, 15);
code++;
}
}
}
}
}
UINT32 dooyong_68k_state::screen_update_rshark(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
bitmap.fill(m_palette->black_pen(), cliprect);
screen.priority().fill(0, cliprect);
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 1);
m_bg2_tilemap->draw(screen, bitmap, cliprect, 0, (m_bg2_priority ? 2 : 1));
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2);
m_fg2_tilemap->draw(screen, bitmap, cliprect, 0, 2);
draw_sprites(screen, bitmap, cliprect);
return 0;
}
UINT32 dooyong_68k_state::screen_update_popbingo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
bitmap.fill(m_palette->black_pen(), cliprect);
screen.priority().fill(0, cliprect);
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 1);
draw_sprites(screen, bitmap, cliprect);
return 0;
}
VIDEO_START_MEMBER(dooyong_68k_state, rshark)
{ {
/* Configure tilemap callbacks */ /* Configure tilemap callbacks */
m_bg_tilerom = memregion("gfx5")->base(); m_bg_tilerom = memregion("gfx5")->base();
@ -857,13 +807,13 @@ VIDEO_START_MEMBER(dooyong_state,rshark)
m_fg2_gfx = 1; m_fg2_gfx = 1;
/* Create tilemaps */ /* Create tilemaps */
m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS, m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::rshark_get_bg_tile_info),this), TILEMAP_SCAN_COLS,
16, 16, 64, 32); 16, 16, 64, 32);
m_bg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_bg2_tile_info),this), TILEMAP_SCAN_COLS, m_bg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::rshark_get_bg2_tile_info),this), TILEMAP_SCAN_COLS,
16, 16, 64, 32); 16, 16, 64, 32);
m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS, m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::rshark_get_fg_tile_info),this), TILEMAP_SCAN_COLS,
16, 16, 64, 32); 16, 16, 64, 32);
m_fg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg2_tile_info),this), TILEMAP_SCAN_COLS, m_fg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::rshark_get_fg2_tile_info),this), TILEMAP_SCAN_COLS,
16, 16, 64, 32); 16, 16, 64, 32);
/* Configure tilemap transparency */ /* Configure tilemap transparency */
@ -881,10 +831,10 @@ VIDEO_START_MEMBER(dooyong_state,rshark)
save_item(NAME(m_bg2scroll8)); save_item(NAME(m_bg2scroll8));
save_item(NAME(m_fgscroll8)); save_item(NAME(m_fgscroll8));
save_item(NAME(m_fg2scroll8)); save_item(NAME(m_fg2scroll8));
save_item(NAME(m_rshark_pri)); save_item(NAME(m_bg2_priority));
} }
VIDEO_START_MEMBER(dooyong_state,popbingo) VIDEO_START_MEMBER(dooyong_68k_state, popbingo)
{ {
/* Configure tilemap callbacks */ /* Configure tilemap callbacks */
m_bg_tilerom = memregion("gfx2")->base(); m_bg_tilerom = memregion("gfx2")->base();
@ -905,5 +855,5 @@ VIDEO_START_MEMBER(dooyong_state,popbingo)
save_item(NAME(m_bg2scroll8)); // Not used atm save_item(NAME(m_bg2scroll8)); // Not used atm
save_item(NAME(m_fgscroll8)); // Not used atm save_item(NAME(m_fgscroll8)); // Not used atm
save_item(NAME(m_fg2scroll8)); // Not used atm save_item(NAME(m_fg2scroll8)); // Not used atm
save_item(NAME(m_rshark_pri)); save_item(NAME(m_bg2_priority));
} }

View File

@ -27,10 +27,10 @@ READ16_MEMBER(prehisle_state::prehisle_control16_r)
switch (offset) switch (offset)
{ {
case 0x08: return ioport("P2")->read(); // Player 2 case 0x08: return ioport("P2")->read(); // Player 2
case 0x10: return ioport("COIN")->read(); // Coins, Tilt, Service case 0x10: return ioport("COIN")->read(); // Coins, Tilt, Service
case 0x20: return ioport("P1")->read() ^ m_invert_controls; // Player 1 case 0x20: return ioport("P1")->read() ^ m_invert_controls; // Player 1
case 0x21: return ioport("DSW0")->read(); // DIPs case 0x21: return ioport("DSW0")->read(); // DIPs
case 0x22: return ioport("DSW1")->read(); // DIPs + VBLANK case 0x22: return ioport("DSW1")->read(); // DIPs + VBLANK
default: return 0; default: return 0;
} }
} }
@ -54,50 +54,79 @@ WRITE16_MEMBER(prehisle_state::prehisle_control16_w)
} }
} }
/* tile layout
0 xxxx.... color
0 ....x... flip x
0 .....xxx gfx code high bits
1 xxxxxxxx gfx code low bits
*/
TILE_GET_INFO_MEMBER(prehisle_state::get_bg2_tile_info) TILE_GET_INFO_MEMBER(prehisle_state::get_bg2_tile_info)
{ {
UINT8 *tilerom = memregion("gfx5")->base(); UINT8 const *const tilerom = memregion("gfx5")->base();
int offs = tile_index * 2; int const offs = tile_index * 2;
int attr = tilerom[offs + 1] + (tilerom[offs] << 8); int const attr = tilerom[offs + 1] + (tilerom[offs] << 8);
int code = (attr & 0x7ff) | 0x800; int const code = (attr & 0x7ff) | 0x800;
int color = attr >> 12; int const color = attr >> 12;
int flags = (attr & 0x800) ? TILE_FLIPX : 0; int const flags = (attr & 0x800) ? TILE_FLIPX : 0;
SET_TILE_INFO_MEMBER(1, code, color, flags); SET_TILE_INFO_MEMBER(1, code, color, flags);
} }
/* tile layout
0 xxxx.... ........ color
0 ....x... ........ flip y
0 .....xxx xxxxxxxx gfx code
*/
TILE_GET_INFO_MEMBER(prehisle_state::get_bg_tile_info) TILE_GET_INFO_MEMBER(prehisle_state::get_bg_tile_info)
{ {
int attr = m_bg_videoram16[tile_index]; int const attr = m_bg_videoram16[tile_index];
int code = attr & 0x7ff; int const code = attr & 0x7ff;
int color = attr >> 12; int const color = attr >> 12;
int flags = (attr & 0x800) ? TILE_FLIPY : 0; int const flags = (attr & 0x800) ? TILE_FLIPY : 0;
SET_TILE_INFO_MEMBER(2, code, color, flags); SET_TILE_INFO_MEMBER(2, code, color, flags);
} }
/* tile layout
0 xxxx.... ........ color
0 ....xxxx xxxxxxxx gfx code
*/
TILE_GET_INFO_MEMBER(prehisle_state::get_fg_tile_info) TILE_GET_INFO_MEMBER(prehisle_state::get_fg_tile_info)
{ {
int attr = m_videoram[tile_index]; int const attr = m_videoram[tile_index];
int code = attr & 0xfff; int const code = attr & 0xfff;
int color = attr >> 12; int const color = attr >> 12;
SET_TILE_INFO_MEMBER(0, code, color, 0); SET_TILE_INFO_MEMBER(0, code, color, 0);
} }
void prehisle_state::video_start() void prehisle_state::video_start()
{ {
m_bg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(prehisle_state::get_bg2_tile_info),this), TILEMAP_SCAN_COLS, // ROM-based background layer
16, 16, 1024, 32); m_bg2_tilemap = &machine().tilemap().create(
m_gfxdecode,
m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(prehisle_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS, tilemap_get_info_delegate(FUNC(prehisle_state::get_bg2_tile_info), this),
16, 16, 256, 32); TILEMAP_SCAN_COLS, // scan order
16, 16, // tile size
m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(prehisle_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 1024, 32); // tilemap size
8, 8, 32, 32);
// RAM-based background layer (overlays most sprites)
m_bg_tilemap = &machine().tilemap().create(
m_gfxdecode,
tilemap_get_info_delegate(FUNC(prehisle_state::get_bg_tile_info), this),
TILEMAP_SCAN_COLS, // scan order
16, 16, // tile size
256, 32); // tilemap size
m_bg_tilemap->set_transparent_pen(15); m_bg_tilemap->set_transparent_pen(15);
// text layer
m_fg_tilemap = &machine().tilemap().create(
m_gfxdecode,
tilemap_get_info_delegate(FUNC(prehisle_state::get_fg_tile_info), this),
TILEMAP_SCAN_ROWS, // scan order
8, 8, // tile size
32, 32); // tilemap size
m_fg_tilemap->set_transparent_pen(15); m_fg_tilemap->set_transparent_pen(15);
/* register for saving */ /* register for saving */
@ -105,37 +134,33 @@ void prehisle_state::video_start()
} }
/* sprite layout /* sprite layout
o fedcba9876543210
0 .......xxxxxxxxx y, other bits unused? 0 .......x xxxxxxxx y, other bits unused?
1 .......xxxxxxxxx x, other bits unused? 1 .......x xxxxxxxx x, other bits unused?
2 x....... ........ flip y
2 ...xxxxxxxxxxxxx code 2 .x...... ........ flip x
2 ..x............. ? 2 ..x..... ........ ?
2 .x.............. flipx 2 ...xxxxx xxxxxxxx gfx code
2 x............... flipy 3 xxxx.... ........ color+priority, other bits unknown
3 xxxx............ color+priority, other bits unknown
*/ */
void prehisle_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int foreground ) void prehisle_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
UINT16 *spriteram16 = m_spriteram; UINT16 const *const spriteram16 = m_spriteram;
int offs;
for (offs = 0; offs < 1024; offs += 4) for (int offs = 0; offs < 1024; offs += 4)
{ {
int attr = spriteram16[offs + 2]; int const attr = spriteram16[offs + 2];
int code = attr & 0x1fff; int const code = attr & 0x1fff;
int color = spriteram16[offs + 3] >> 12; int const color = spriteram16[offs + 3] >> 12;
int priority = (color < 0x4); // correct? int const priority = (color < 0x4) ? 0x04 : 0x06;
int flipx = attr & 0x4000; bool flipx = attr & 0x4000;
int flipy = attr & 0x8000; bool flipy = attr & 0x8000;
int sx = spriteram16[offs + 1]&0x1ff; int sx = spriteram16[offs + 1] & 0x1ff;
int sy = spriteram16[offs]&0x1ff; int sy = spriteram16[offs] & 0x1ff;
// coordinates are 9-bit signed // coordinates are 9-bit signed
if (sx&0x100) sx=-0x100+(sx&0xff); if (sx & 0x100) sx = -0x100 + (sx & 0xff);
if (sy&0x100) sy=-0x100+(sy&0xff); if (sy & 0x100) sy = -0x100 + (sy & 0xff);
if (flip_screen()) if (flip_screen())
{ {
@ -145,19 +170,24 @@ void prehisle_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
flipy = !flipy; flipy = !flipy;
} }
if ((foreground && priority) || (!foreground && !priority)) m_gfxdecode->gfx(3)->prio_transpen(
{ bitmap, cliprect,
m_gfxdecode->gfx(3)->transpen(bitmap,cliprect, code, color, flipx, flipy, sx, sy, 15); code, color,
} flipx, flipy,
sx, sy,
screen.priority(), priority,
15); // transparent pen
} }
} }
UINT32 prehisle_state::screen_update_prehisle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 prehisle_state::screen_update_prehisle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
screen.priority().fill(0, cliprect);
m_bg2_tilemap->draw(screen, bitmap, cliprect, 0, 0); m_bg2_tilemap->draw(screen, bitmap, cliprect, 0, 0);
draw_sprites(bitmap, cliprect, 0); m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 1);
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2);
draw_sprites(bitmap, cliprect, 1); draw_sprites(screen, bitmap, cliprect);
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
return 0; return 0;
} }