summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Alex W. Jackson <alex.w.jackson@gmail.com>2014-11-15 20:37:32 -0500
committer Alex W. Jackson <alex.w.jackson@gmail.com>2014-11-15 20:37:32 -0500
commit02fc842fe94008da4d821f84a70507fa46ed8f25 (patch)
treedb04ce35131fd1adec7f9b46f9ecdbfce0e7ba20
parent2a1eb5b49067788c74be1a6a862638e6550a7aea (diff)
parent052948b554c15bd0af34219b8a9f816a038ebda3 (diff)
Merge pull request #47 from cuavas/master
tilemap.c internal documentation update; dooyong.c cleanups; prehisle.c pdrawgfx conversion
-rw-r--r--src/emu/tilemap.h120
-rw-r--r--src/mame/drivers/dooyong.c237
-rw-r--r--src/mame/drivers/prehisle.c6
-rw-r--r--src/mame/includes/dooyong.h164
-rw-r--r--src/mame/includes/prehisle.h4
-rw-r--r--src/mame/video/dooyong.c542
-rw-r--r--src/mame/video/prehisle.c146
7 files changed, 624 insertions, 595 deletions
diff --git a/src/emu/tilemap.h b/src/emu/tilemap.h
index eb27398724f..a0051139e9c 100644
--- a/src/emu/tilemap.h
+++ b/src/emu/tilemap.h
@@ -36,7 +36,7 @@
category (optional): specifies one of 16 categories for the
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;
each pen in the tile is looked up in a table to determine
@@ -81,24 +81,26 @@
all tiles rendered.
Flagsmap = an 8bpp bitmap containing per-pixel flags,
- specifically the category (specified in bits 0-3) and
- the layer (specified in bits 4-6).
+ specifically the category (specified in bits 0-3) and the
+ layer (specified in bits 4-6).
****************************************************************************
How to use a tilemap:
- 1. First create a new tilemap by calling tilemap_create(). The
- parameters are as follows:
+ 1. First create a new tilemap by calling tilemap_manager::create().
+ The parameters are as follows:
- tile_get_info = pointer to a callback function which accepts a
- 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
+ decoder = reference to your device_gfx_interface
- mapper = pointer to a 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
+ tile_get_info = callback function which accepts a memory index
+ and in return fills in a tile_data structure that describes
+ 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
@@ -112,39 +114,40 @@
Common configuration tasks include:
* 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
- tilemap_map_pen_to_layer() or
- tilemap_map_pens_to_layer()
+ tilemap_t::map_pen_to_layer() or
+ tilemap_t::map_pens_to_layer()
* 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
- callback via tilemap_set_user_data()
+ * specifying a pointer that can be read back later (e.g. in
+ your tile_get_info callback) via
+ tilemap_t::set_user_data()
* 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
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.
- 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
- 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
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
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
- tilemap_draw() or tilemap_draw_roz(). If you need to do custom
- rendering and want access to the raw pixels, call
- tilemap_get_pixmap() to get a pointer to the updated bitmap_ind16
+ tilemap_t::draw() or tilemap_t::draw_roz(). If you need to do
+ custom rendering and want access to the raw pixels, call
+ tilemap_t::pixmap() to get a reference to the updated bitmap_ind16
containing the tilemap graphics.
****************************************************************************
@@ -157,10 +160,11 @@
tilemap_t *tmap;
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 color = (tiledata >> 8) & 0x1f;
UINT8 flipx = (tiledata >> 13) & 1;
@@ -168,12 +172,12 @@
UINT8 category = (tiledata >> 15) & 1;
// set the common info for the tile
- SET_TILE_INFO(
- 1, // use m_gfxdecode->gfx(1) for tile graphics
+ tileinfo.set(
+ 1, // use gfxdecode->gfx(1) for tile graphics
code, // the index of the graphics for this tile
color, // the color to use for this tile
(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
@@ -181,41 +185,43 @@
tileinfo.category = category;
}
- VIDEO_START( mydriver )
+ VIDEO_START_MEMBER( my_state, my_driver )
{
// first create the tilemap
- tmap = tilemap_create(machine,
- my_get_info, // pointer to your get_info
- tilemap_scan_rows, // standard row-major mapper
+ tmap = &machine().tilemap().create(
+ gfxdecode,
+ tilemap_get_info_delegate(FUNC(my_state::my_get_info), this),
+ TILEMAP_SCAN_ROWS, // standard row-major mapper
8,8, // 8x8 tiles
64,32); // 64 columns, 32 rows
// then set the transparent pen; all other pens will default
// 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
// erase all previous pixels
- tilemap_draw(
+ tmap->draw(
+ screen, // destination screen
bitmap, // destination bitmap
cliprect, // clipping rectangle
- tmap, // tilemap to draw
- TILEMAP_DRAW_OPAQUE, // flags
- 0); // don't use priority_bitmap
+ TILEMAP_DRAW_OPAQUE); // flags
// next draw the sprites
my_draw_sprites();
// then draw the tiles which have priority over sprites
- tilemap_draw(
+ tmap->draw(
+ screen, // destination screen
bitmap, // destination bitmap
cliprect, // clipping rectangle
- tmap, // tilemap to draw
- TILEMAP_DRAW_CATEGORY(1),// flags: draw category 1
- 0); // don't use priority_bitmap
+ TILEMAP_DRAW_CATEGORY(1));// flags: draw category 1
return 0;
}
@@ -237,7 +243,7 @@
TILEMAP_TRANSPARENT: This described a tilemap with a single
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.
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
basis. All of this functionality is now expanded: you can
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"
layer is now "layer 0" and the "back" layer is now "layer 1".
@@ -275,16 +281,16 @@
TILEMAP_DRAW_LAYER0 is assumed.
* 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
- tilemap_map_pens_to_layer() call. This call takes a group number
- so that you can configure 1 of the 256 groups independently.
- It also takes a pen and a mask; the mapping is updated for all
- pens where ((pennum & mask) == pen). To set all the pens in a
- group to the same value, pass a mask of 0. To set 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_pens_to_layer() call. This call takes a group
+ number so that you can configure 1 of the 256 groups
+ independently. It also takes a pen and a mask; the mapping is
+ updated for all pens where ((pennum & mask) == pen). To set all
+ the pens in a group to the same value, pass a mask of 0. To set
+ a single pen in a group, pass a mask of ~0. The helper function
+ tilemap_t::map_pen_to_layer() does this for you.
***************************************************************************/
@@ -306,7 +312,7 @@
#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_LAYER0 = 0x10; // draw layer 0
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_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_FLIPY = TILE_FLIPY; // draw the tilemap vertically flipped
@@ -767,7 +773,7 @@ private:
// 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_ALPHA(x) (TILEMAP_DRAW_ALPHA_FLAG | (rgb_t::clamp(x) << 24))
diff --git a/src/mame/drivers/dooyong.c b/src/mame/drivers/dooyong.c
index b3d90b13dc1..fbbcc7c29d6 100644
--- a/src/mame/drivers/dooyong.c
+++ b/src/mame/drivers/dooyong.c
@@ -84,27 +84,27 @@ be verified on real PCB.
#include "sound/okim6295.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);
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);
}
-WRITE8_MEMBER(dooyong_state::flip_screen_w)
+WRITE8_MEMBER(dooyong_z80_state::flip_screen_w)
{
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_2=0;
+ m_interrupt_line_1 = 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(0x8000, 0xbfff) AM_ROMBANK("bank1")
- AM_RANGE(0xc000, 0xc007) AM_WRITE(dooyong_bgscroll8_w)
- AM_RANGE(0xc008, 0xc00f) AM_WRITE(dooyong_fgscroll8_w)
+ AM_RANGE(0xc000, 0xc007) AM_WRITE(bgscroll_w)
+ AM_RANGE(0xc008, 0xc00f) AM_WRITE(fgscroll_w)
AM_RANGE(0xc010, 0xc010) AM_READ_PORT("SYSTEM")
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_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_WRITE(soundlatch_byte_w)
AM_RANGE(0xc013, 0xc013) AM_READ_PORT("DSWA")
AM_RANGE(0xc014, 0xc014) AM_READ_PORT("DSWB")
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(0xf000, 0xffff) AM_RAM AM_SHARE("spriteram")
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(0x8000, 0xbfff) AM_ROMBANK("bank1")
AM_RANGE(0xc000, 0xcfff) AM_RAM
AM_RANGE(0xd000, 0xdfff) AM_RAM AM_SHARE("spriteram")
- AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(dooyong_txvideoram8_w) AM_SHARE("txvideoram")
- AM_RANGE(0xf000, 0xf000) AM_READ_PORT("DSWA") AM_WRITE(lastday_bankswitch_w)
+ AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(txvideoram_w) AM_SHARE("txvideoram")
+ AM_RANGE(0xf000, 0xf000) AM_READ_PORT("DSWA") AM_WRITE(bankswitch_w)
AM_RANGE(0xf001, 0xf001) AM_READ_PORT("DSWB")
AM_RANGE(0xf002, 0xf002) AM_READ_PORT("P1")
AM_RANGE(0xf003, 0xf003) AM_READ_PORT("P2")
AM_RANGE(0xf004, 0xf004) AM_READ_PORT("SYSTEM")
AM_RANGE(0xf008, 0xf008) AM_WRITE(pollux_ctrl_w) /* coin counter, flip screen */
AM_RANGE(0xf010, 0xf010) AM_WRITE(soundlatch_byte_w)
- AM_RANGE(0xf018, 0xf01f) AM_WRITE(dooyong_bgscroll8_w)
- AM_RANGE(0xf020, 0xf027) AM_WRITE(dooyong_fgscroll8_w)
+ AM_RANGE(0xf018, 0xf01f) AM_WRITE(bgscroll_w)
+ AM_RANGE(0xf020, 0xf027) AM_WRITE(fgscroll_w)
AM_RANGE(0xf800, 0xffff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
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(0x8000, 0xbfff) AM_ROMBANK("bank1")
AM_RANGE(0xc000, 0xcfff) AM_RAM
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_WRITE(lastday_bankswitch_w)
+ AM_RANGE(0xf000, 0xf000) AM_WRITE(bankswitch_w)
AM_RANGE(0xf001, 0xf001) AM_READ_PORT("DSWB")
AM_RANGE(0xf002, 0xf002) AM_READ_PORT("P2")
AM_RANGE(0xf003, 0xf003) AM_READ_PORT("P1")
AM_RANGE(0xf004, 0xf004) AM_READ_PORT("SYSTEM")
AM_RANGE(0xf008, 0xf008) AM_WRITE(pollux_ctrl_w) /* coin counter, flip screen */
AM_RANGE(0xf010, 0xf010) AM_WRITE(soundlatch_byte_w)
- AM_RANGE(0xf018, 0xf01f) AM_WRITE(dooyong_bgscroll8_w)
- AM_RANGE(0xf020, 0xf027) AM_WRITE(dooyong_fgscroll8_w)
+ AM_RANGE(0xf018, 0xf01f) AM_WRITE(bgscroll_w)
+ AM_RANGE(0xf020, 0xf027) AM_WRITE(fgscroll_w)
AM_RANGE(0xf800, 0xffff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
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(0x8000, 0xbfff) AM_ROMBANK("bank1")
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(0xc003, 0xc003) AM_READ_PORT("P2")
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(0xc018, 0xc01f) AM_WRITE(dooyong_fg2scroll8_w)
- AM_RANGE(0xc040, 0xc047) AM_WRITE(dooyong_bgscroll8_w)
- AM_RANGE(0xc048, 0xc04f) AM_WRITE(dooyong_fgscroll8_w)
+ AM_RANGE(0xc018, 0xc01f) AM_WRITE(fg2scroll_w)
+ AM_RANGE(0xc040, 0xc047) AM_WRITE(bgscroll_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(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(0xf000, 0xffff) AM_RAM
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(0x8000, 0xbfff) AM_ROMBANK("bank1")
AM_RANGE(0xc000, 0xcfff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0xd000, 0xdfff) AM_RAM
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(0xe004, 0xe004) AM_READ_PORT("SYSTEM")
AM_RANGE(0xe006, 0xe006) AM_READ_PORT("DSWA")
AM_RANGE(0xe008, 0xe008) AM_READ_PORT("DSWB")
AM_RANGE(0xe010, 0xe010) AM_WRITE(flytiger_ctrl_w) /* coin counter, flip screen */
AM_RANGE(0xe020, 0xe020) AM_WRITE(soundlatch_byte_w)
- AM_RANGE(0xe030, 0xe037) AM_WRITE(dooyong_bgscroll8_w)
- AM_RANGE(0xe040, 0xe047) AM_WRITE(dooyong_fgscroll8_w)
+ AM_RANGE(0xe030, 0xe037) AM_WRITE(bgscroll_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(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
-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(0x8000, 0xbfff) AM_ROMBANK("bank1")
AM_RANGE(0xc000, 0xcfff) AM_RAM
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(0xf800, 0xf800) AM_READ_PORT("DSWA")
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(0xf830, 0xf830) AM_READ_PORT("P2")
AM_RANGE(0xf840, 0xf840) AM_READ_PORT("SYSTEM")
- AM_RANGE(0xfc00, 0xfc07) AM_WRITE(dooyong_bgscroll8_w)
- AM_RANGE(0xfc08, 0xfc0f) AM_WRITE(dooyong_fgscroll8_w)
+ AM_RANGE(0xfc00, 0xfc07) AM_WRITE(bgscroll_w)
+ AM_RANGE(0xfc08, 0xfc0f) AM_WRITE(fgscroll_w)
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 */
AM_RANGE(0x000000, 0x03ffff) AM_ROM
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(0x0c0002, 0x0c0003) AM_READ_PORT("DSW")
AM_RANGE(0x0c0004, 0x0c0005) AM_READ_PORT("P1_P2")
AM_RANGE(0x0c0006, 0x0c0007) AM_READ_PORT("SYSTEM")
- AM_RANGE(0x0c4000, 0x0c400f) AM_WRITE(dooyong_bgscroll16_w)
- AM_RANGE(0x0c4010, 0x0c401f) AM_WRITE(dooyong_bg2scroll16_w)
+ AM_RANGE(0x0c4000, 0x0c400f) AM_WRITE8(bgscroll_w, 0x00ff)
+ AM_RANGE(0x0c4010, 0x0c401f) AM_WRITE8(bg2scroll_w, 0x00ff)
AM_RANGE(0x0c8000, 0x0c8fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x0c0012, 0x0c0013) AM_WRITE(soundlatch_word_w)
- AM_RANGE(0x0c0014, 0x0c0015) AM_WRITE(rshark_ctrl_w) /* flip screen + unknown stuff */
- AM_RANGE(0x0cc000, 0x0cc00f) AM_WRITE(dooyong_fgscroll16_w)
- AM_RANGE(0x0cc010, 0x0cc01f) AM_WRITE(dooyong_fg2scroll16_w)
+ AM_RANGE(0x0c0014, 0x0c0015) AM_WRITE(ctrl_w) /* flip screen + unknown stuff */
+ AM_RANGE(0x0cc000, 0x0cc00f) AM_WRITE8(fgscroll_w, 0x00ff)
+ AM_RANGE(0x0cc010, 0x0cc01f) AM_WRITE8(fg2scroll_w, 0x00ff)
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)
AM_RANGE(0x000000, 0x03ffff) AM_ROM
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(0x080002, 0x080003) AM_READ_PORT("DSW")
AM_RANGE(0x080004, 0x080005) AM_READ_PORT("P1_P2")
AM_RANGE(0x080006, 0x080007) AM_READ_PORT("SYSTEM")
- AM_RANGE(0x084000, 0x08400f) AM_WRITE(dooyong_bgscroll16_w)
- AM_RANGE(0x084010, 0x08401f) AM_WRITE(dooyong_bg2scroll16_w)
+ AM_RANGE(0x084000, 0x08400f) AM_WRITE8(bgscroll_w, 0x00ff)
+ AM_RANGE(0x084010, 0x08401f) AM_WRITE8(bg2scroll_w, 0x00ff)
AM_RANGE(0x088000, 0x088fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x080012, 0x080013) AM_WRITE(soundlatch_word_w)
- AM_RANGE(0x080014, 0x080015) AM_WRITE(rshark_ctrl_w) /* flip screen + unknown stuff */
- AM_RANGE(0x08c000, 0x08c00f) AM_WRITE(dooyong_fgscroll16_w)
- AM_RANGE(0x08c010, 0x08c01f) AM_WRITE(dooyong_fg2scroll16_w)
+ AM_RANGE(0x080014, 0x080015) AM_WRITE(ctrl_w) /* flip screen + unknown stuff */
+ AM_RANGE(0x08c000, 0x08c00f) AM_WRITE8(fgscroll_w, 0x00ff)
+ AM_RANGE(0x08c010, 0x08c01f) AM_WRITE8(fg2scroll_w, 0x00ff)
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)
AM_RANGE(0x000000, 0x03ffff) AM_ROM
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(0x0c0002, 0x0c0003) AM_READ_PORT("DSW")
AM_RANGE(0x0c0004, 0x0c0005) AM_READ_PORT("P1_P2")
AM_RANGE(0x0c0006, 0x0c0007) AM_READ_PORT("SYSTEM")
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(0x0c4000, 0x0c400f) AM_WRITE(dooyong_bgscroll16_w)
- AM_RANGE(0x0c4010, 0x0c401f) AM_WRITE(dooyong_bg2scroll16_w) // not used atm
+ AM_RANGE(0x0c4000, 0x0c400f) AM_WRITE8(bgscroll_w, 0x00ff)
+ 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(0x0cc000, 0x0cc00f) AM_WRITE(dooyong_fgscroll16_w) // not used atm
- AM_RANGE(0x0cc010, 0x0cc01f) AM_WRITE(dooyong_fg2scroll16_w) // not used atm
+ AM_RANGE(0x0cc000, 0x0cc00f) AM_WRITE8(fgscroll_w, 0x00ff) // 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?
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(0xc000, 0xc7ff) AM_RAM
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)
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(0xf000, 0xf7ff) AM_RAM
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_END
-READ8_MEMBER(dooyong_state::unk_r)
+READ8_MEMBER(dooyong_z80_ym2203_state::unk_r)
{
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_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_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_SOUND_ADD("ym1", YM2203, 1500000)
- MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_state,irqhandler_2203_1))
- MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_state, unk_r))
+ MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_z80_ym2203_state, irqhandler_2203_1))
+ MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_z80_ym2203_state, unk_r))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
MCFG_SOUND_ADD("ym2", YM2203, 1500000)
- MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_state, irqhandler_2203_2))
- MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_state, unk_r))
+ MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_z80_ym2203_state, irqhandler_2203_2))
+ MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_z80_ym2203_state, unk_r))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
MACHINE_CONFIG_END
@@ -834,7 +834,7 @@ static MACHINE_CONFIG_FRAGMENT( sound_2151_m68k )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
MACHINE_CONFIG_END
-static MACHINE_CONFIG_START( lastday, dooyong_state )
+static MACHINE_CONFIG_START( lastday, dooyong_z80_ym2203_state )
/* basic machine hardware */
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_PROGRAM_MAP(lastday_sound_map)
- MCFG_MACHINE_START_OVERRIDE(dooyong_state,lastday)
- MCFG_MACHINE_RESET_OVERRIDE(dooyong_state,sound_ym2203)
+ MCFG_MACHINE_START_OVERRIDE(dooyong_z80_state, cpu_z80)
+ MCFG_MACHINE_RESET_OVERRIDE(dooyong_z80_ym2203_state, sound_ym2203)
/* video hardware */
@@ -856,7 +856,7 @@ static MACHINE_CONFIG_START( lastday, dooyong_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(64*8, 32*8)
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_PALETTE("palette")
@@ -864,24 +864,24 @@ static MACHINE_CONFIG_START( lastday, dooyong_state )
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
- MCFG_VIDEO_START_OVERRIDE(dooyong_state,lastday)
+ MCFG_VIDEO_START_OVERRIDE(dooyong_z80_ym2203_state, lastday)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("ym1", YM2203, 4000000)
- MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_state,irqhandler_2203_1))
- MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_state, unk_r))
+ MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_z80_ym2203_state, irqhandler_2203_1))
+ MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_z80_ym2203_state, unk_r))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
MCFG_SOUND_ADD("ym2", YM2203, 4000000)
- MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_state, irqhandler_2203_2))
- MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_state, unk_r))
+ MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_z80_ym2203_state, irqhandler_2203_2))
+ MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_z80_ym2203_state, unk_r))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
MACHINE_CONFIG_END
-static MACHINE_CONFIG_START( gulfstrm, dooyong_state )
+static MACHINE_CONFIG_START( gulfstrm, dooyong_z80_ym2203_state )
/* basic machine hardware */
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_PROGRAM_MAP(lastday_sound_map)
- MCFG_MACHINE_START_OVERRIDE(dooyong_state,lastday)
- MCFG_MACHINE_RESET_OVERRIDE(dooyong_state,sound_ym2203)
+ MCFG_MACHINE_START_OVERRIDE(dooyong_z80_state, cpu_z80)
+ MCFG_MACHINE_RESET_OVERRIDE(dooyong_z80_ym2203_state, sound_ym2203)
/* video hardware */
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_SIZE(64*8, 32*8)
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_PALETTE("palette")
@@ -910,13 +910,13 @@ static MACHINE_CONFIG_START( gulfstrm, dooyong_state )
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_VIDEO_START_OVERRIDE(dooyong_state,gulfstrm)
+ MCFG_VIDEO_START_OVERRIDE(dooyong_z80_ym2203_state, gulfstrm)
/* sound hardware */
MCFG_FRAGMENT_ADD( sound_2203 )
MACHINE_CONFIG_END
-static MACHINE_CONFIG_START( pollux, dooyong_state )
+static MACHINE_CONFIG_START( pollux, dooyong_z80_ym2203_state )
/* basic machine hardware */
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_PROGRAM_MAP(pollux_sound_map)
- MCFG_MACHINE_START_OVERRIDE(dooyong_state,lastday)
- MCFG_MACHINE_RESET_OVERRIDE(dooyong_state,sound_ym2203)
+ MCFG_MACHINE_START_OVERRIDE(dooyong_z80_state, cpu_z80)
+ MCFG_MACHINE_RESET_OVERRIDE(dooyong_z80_ym2203_state, sound_ym2203)
/* video hardware */
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_SIZE(64*8, 32*8)
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_PALETTE("palette")
@@ -945,13 +945,13 @@ static MACHINE_CONFIG_START( pollux, dooyong_state )
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_VIDEO_START_OVERRIDE(dooyong_state,pollux)
+ MCFG_VIDEO_START_OVERRIDE(dooyong_z80_ym2203_state, pollux)
/* sound hardware */
MCFG_FRAGMENT_ADD( sound_2203 )
MACHINE_CONFIG_END
-static MACHINE_CONFIG_START( bluehawk, dooyong_state )
+static MACHINE_CONFIG_START( bluehawk, dooyong_z80_state )
/* basic machine hardware */
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_PROGRAM_MAP(bluehawk_sound_map)
- MCFG_MACHINE_START_OVERRIDE(dooyong_state,lastday)
+ MCFG_MACHINE_START_OVERRIDE(dooyong_z80_state, cpu_z80)
/* video hardware */
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_SIZE(64*8, 32*8)
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_PALETTE("palette")
@@ -979,13 +979,13 @@ static MACHINE_CONFIG_START( bluehawk, dooyong_state )
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_VIDEO_START_OVERRIDE(dooyong_state,bluehawk)
+ MCFG_VIDEO_START_OVERRIDE(dooyong_z80_state, bluehawk)
/* sound hardware */
MCFG_FRAGMENT_ADD( sound_2151 )
MACHINE_CONFIG_END
-static MACHINE_CONFIG_START( flytiger, dooyong_state )
+static MACHINE_CONFIG_START( flytiger, dooyong_z80_state )
/* basic machine hardware */
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_PROGRAM_MAP(bluehawk_sound_map)
- MCFG_MACHINE_START_OVERRIDE(dooyong_state,lastday)
+ MCFG_MACHINE_START_OVERRIDE(dooyong_z80_state, cpu_z80)
/* video hardware */
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_SIZE(64*8, 32*8)
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_PALETTE("palette")
@@ -1013,13 +1013,13 @@ static MACHINE_CONFIG_START( flytiger, dooyong_state )
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_VIDEO_START_OVERRIDE(dooyong_state,flytiger)
+ MCFG_VIDEO_START_OVERRIDE(dooyong_z80_state, flytiger)
/* sound hardware */
MCFG_FRAGMENT_ADD( sound_2151 )
MACHINE_CONFIG_END
-static MACHINE_CONFIG_START( primella, dooyong_state )
+static MACHINE_CONFIG_START( primella, dooyong_z80_state )
/* basic machine hardware */
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_PROGRAM_MAP(bluehawk_sound_map)
- MCFG_MACHINE_START_OVERRIDE(dooyong_state,lastday)
+ MCFG_MACHINE_START_OVERRIDE(dooyong_z80_state, cpu_z80)
/* video hardware */
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_SIZE(64*8, 32*8)
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_GFXDECODE_ADD("gfxdecode", "palette", primella)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_VIDEO_START_OVERRIDE(dooyong_state,primella)
+ MCFG_VIDEO_START_OVERRIDE(dooyong_z80_state, primella)
/* sound hardware */
MCFG_FRAGMENT_ADD( sound_2151 )
MACHINE_CONFIG_END
-TIMER_DEVICE_CALLBACK_MEMBER(dooyong_state::rshark_scanline)
+
+TIMER_DEVICE_CALLBACK_MEMBER(dooyong_68k_state::scanline)
{
int scanline = param;
- if(scanline == 248) // vblank-out irq
+ if (scanline == 248) // vblank-out irq
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);
}
-static MACHINE_CONFIG_START( rshark, dooyong_state )
+static MACHINE_CONFIG_START( rshark, dooyong_68k_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, 8000000) /* measured on super-x */
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_PROGRAM_MAP(bluehawk_sound_map)
/* video hardware */
- MCFG_BUFFERED_SPRITERAM16_ADD("spriteram16")
+ MCFG_BUFFERED_SPRITERAM16_ADD("spriteram")
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(64*8, 32*8)
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_VBLANK_DEVICE("spriteram16", buffered_spriteram16_device, vblank_copy_rising)
+ MCFG_SCREEN_UPDATE_DRIVER(dooyong_68k_state, screen_update_rshark)
+ MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram16_device, vblank_copy_rising)
MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", rshark)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_VIDEO_START_OVERRIDE(dooyong_state,rshark)
+ MCFG_VIDEO_START_OVERRIDE(dooyong_68k_state, rshark)
/* sound hardware */
MCFG_FRAGMENT_ADD( sound_2151_m68k )
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 */
MCFG_CPU_ADD("maincpu", M68000, 8000000) /* measured on super-x */
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_PROGRAM_MAP(bluehawk_sound_map)
/* video hardware */
- MCFG_BUFFERED_SPRITERAM16_ADD("spriteram16")
+ MCFG_BUFFERED_SPRITERAM16_ADD("spriteram")
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(64*8, 32*8)
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_VBLANK_DEVICE("spriteram16", buffered_spriteram16_device, vblank_copy_rising)
+ MCFG_SCREEN_UPDATE_DRIVER(dooyong_68k_state, screen_update_rshark)
+ MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram16_device, vblank_copy_rising)
MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", rshark)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_VIDEO_START_OVERRIDE(dooyong_state,rshark)
+ MCFG_VIDEO_START_OVERRIDE(dooyong_68k_state, rshark)
/* sound hardware */
MCFG_FRAGMENT_ADD( sound_2151_m68k )
MACHINE_CONFIG_END
-static MACHINE_CONFIG_START( popbingo, dooyong_state )
+static MACHINE_CONFIG_START( popbingo, dooyong_68k_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, 10000000)
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_PROGRAM_MAP(bluehawk_sound_map)
/* video hardware */
- MCFG_BUFFERED_SPRITERAM16_ADD("spriteram16")
+ MCFG_BUFFERED_SPRITERAM16_ADD("spriteram")
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(64*8, 32*8)
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_VBLANK_DEVICE("spriteram16", buffered_spriteram16_device, vblank_copy_rising)
+ MCFG_SCREEN_UPDATE_DRIVER(dooyong_68k_state, screen_update_popbingo)
+ MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram16_device, vblank_copy_rising)
MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", popbingo)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_VIDEO_START_OVERRIDE(dooyong_state,popbingo)
+ MCFG_VIDEO_START_OVERRIDE(dooyong_68k_state, popbingo)
/* sound hardware */
MCFG_FRAGMENT_ADD( sound_2151_m68k )
diff --git a/src/mame/drivers/prehisle.c b/src/mame/drivers/prehisle.c
index df852f90d2f..dc8c08b6252 100644
--- a/src/mame/drivers/prehisle.c
+++ b/src/mame/drivers/prehisle.c
@@ -100,7 +100,7 @@ static INPUT_PORTS_START( prehisle )
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:1")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
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( 0x00, DEF_STR( On ) )
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( 0x01, "Middle" )
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( 0x0c, "Demo Sounds On" )
PORT_DIPSETTING( 0x00, "Freeze" )
@@ -136,7 +136,7 @@ static INPUT_PORTS_START( prehisle )
PORT_DIPSETTING( 0x20, "150K 300K" )
PORT_DIPSETTING( 0x10, "300K 500K" )
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( 0x40, DEF_STR( Yes ) )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")
diff --git a/src/mame/includes/dooyong.h b/src/mame/includes/dooyong.h
index a4b519c4413..bd198227d45 100644
--- a/src/mame/includes/dooyong.h
+++ b/src/mame/includes/dooyong.h
@@ -5,24 +5,23 @@ class dooyong_state : public driver_device
public:
dooyong_state(const machine_config &mconfig, device_type type, const char *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_audiocpu(*this, "audiocpu"),
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_bg2_tilemap;
tilemap_t *m_fg_tilemap;
@@ -36,71 +35,112 @@ public:
UINT8 *m_bg2_tilerom;
UINT8 *m_fg_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_bg2_gfx;
int m_fg_gfx;
int m_fg2_gfx;
- int m_tx_tilemap_mode;
- int m_interrupt_line_1;
- int m_interrupt_line_2;
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_audiocpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ 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(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(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);
- 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);
+ 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);
- DECLARE_VIDEO_START(rshark);
- DECLARE_VIDEO_START(popbingo);
+
+ 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);
- 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_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);
- 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_audiocpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
+ 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;
};
diff --git a/src/mame/includes/prehisle.h b/src/mame/includes/prehisle.h
index 73810aeaae8..987b6b13e2a 100644
--- a/src/mame/includes/prehisle.h
+++ b/src/mame/includes/prehisle.h
@@ -23,6 +23,7 @@ public:
tilemap_t *m_bg2_tilemap;
tilemap_t *m_bg_tilemap;
tilemap_t *m_fg_tilemap;
+
DECLARE_WRITE16_MEMBER(prehisle_sound16_w);
DECLARE_WRITE16_MEMBER(prehisle_bg_videoram16_w);
DECLARE_WRITE16_MEMBER(prehisle_fg_videoram16_w);
@@ -35,8 +36,9 @@ public:
TILE_GET_INFO_MEMBER(get_fg_tile_info);
virtual void video_start();
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);
+
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<upd7759_device> m_upd7759;
diff --git a/src/mame/video/dooyong.c b/src/mame/video/dooyong.c
index 96c913041dd..3f6c14b5a49 100644
--- a/src/mame/video/dooyong.c
+++ b/src/mame/video/dooyong.c
@@ -2,7 +2,7 @@
#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];
if (old != data)
@@ -18,7 +18,7 @@ inline void dooyong_state::dooyong_scroll8_w(offs_t offset, UINT8 data, UINT8 *s
break;
case 3: /* Low 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;
case 6: /* Tilemap enable and mode control */
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. */
-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.
- 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)
+WRITE8_MEMBER(dooyong_z80_state::txvideoram_w)
{
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 */
-WRITE8_MEMBER(dooyong_state::lastday_ctrl_w)
+WRITE8_MEMBER(dooyong_z80_ym2203_state::lastday_ctrl_w)
{
/* bits 0 and 1 are coin counters */
coin_counter_w(machine(), 0, data & 0x01);
@@ -121,7 +97,7 @@ WRITE8_MEMBER(dooyong_state::lastday_ctrl_w)
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 */
flip_screen_set(data & 0x01);
@@ -136,7 +112,7 @@ WRITE8_MEMBER(dooyong_state::pollux_ctrl_w)
/* 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 */
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);
}
-WRITE8_MEMBER(dooyong_state::paletteram_flytiger_w)
+WRITE8_MEMBER(dooyong_z80_state::paletteram_flytiger_w)
{
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 */
flip_screen_set(data & 0x01);
@@ -177,21 +153,6 @@ WRITE8_MEMBER(dooyong_state::flytiger_ctrl_w)
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
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
at once uses hundreds of megabytes of RAM). */
-inline void dooyong_state::lastday_get_tile_info(tile_data &tileinfo, int tile_index,
- const UINT8 *tilerom, UINT8 *scroll, int graphics)
+inline void dooyong_state::get_tile_info(tile_data &tileinfo, int tile_index,
+ UINT8 const *tilerom, UINT8 const *scroll, int graphics)
{
- int offs = (tile_index + ((int)scroll[1] << 6)) * 2;
- int attr = tilerom[offs];
+ int const offs = (tile_index + ((int)scroll[1] << 6)) * 2;
+ int const attr = tilerom[offs];
int code, color, flags;
if (scroll[6] & 0x20)
{ /* 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 */
code = tilerom[offs + 1] | ((attr & 0x01) << 8) | ((attr & 0x80) << 2);
color = (attr & 0x78) >> 3;
- flags = ((attr & 0x02) ? TILE_FLIPX : 0) | ((attr & 0x04) ? TILE_FLIPY : 0);
+ flags = TILE_FLIPYX((attr & 0x06) >> 1);
}
else
- {
- /* primella */
+ { /* primella/popbingo */
/* Tiles take two bytes in ROM:
MSB LSB
[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);
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);
-}
-
-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);
+ tileinfo.set(graphics, code, color, flags);
}
TILE_GET_INFO_MEMBER(dooyong_state::get_bg_tile_info)
{
- if (m_bg_tilerom2 != NULL)
- 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);
+ get_tile_info(tileinfo, tile_index, m_bg_tilerom, m_bgscroll8, m_bg_gfx);
}
TILE_GET_INFO_MEMBER(dooyong_state::get_bg2_tile_info)
{
- if (m_bg2_tilerom2 != NULL)
- 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);
+ get_tile_info(tileinfo, tile_index, m_bg2_tilerom, m_bg2scroll8, m_bg2_gfx);
}
TILE_GET_INFO_MEMBER(dooyong_state::get_fg_tile_info)
{
- if (m_fg_tilerom2 != NULL)
- 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);
+ get_tile_info(tileinfo, tile_index, m_fg_tilerom, m_fgscroll8, m_fg_gfx);
}
TILE_GET_INFO_MEMBER(dooyong_state::get_fg2_tile_info)
{
- if (m_fg2_tilerom2 != NULL)
- 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);
+ 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_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)
+TILE_GET_INFO_MEMBER(dooyong_z80_state::get_tx_tile_info)
{
/* Each tile takes two bytes of memory:
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)
c = gfx code
C = color code */
- int offs, attr, code, color;
+ unsigned offs, attr;
if (m_tx_tilemap_mode == 0)
{ /* lastday/gulfstrm/pollux/flytiger */
offs = tile_index;
@@ -337,14 +250,14 @@ TILE_GET_INFO_MEMBER(dooyong_state::get_tx_tile_info)
offs = tile_index * 2;
attr = m_txvideoram[offs + 1];
}
- code = m_txvideoram[offs] | ((attr & 0x0f) << 8);
- color = (attr & 0xf0) >> 4;
+ int const code = m_txvideoram[offs] | ((attr & 0x0f) << 8);
+ 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:
MSB LSB
@@ -364,53 +277,45 @@ void dooyong_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co
w = width
X = x 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
height only used by pollux, bluehawk and flytiger
x flip and y flip only used by pollux and flytiger */
- UINT8 *buffered_spriteram = m_spriteram->buffer();
- int offs;
-
- for (offs = 0; offs < m_spriteram->bytes(); offs += 32)
+ UINT8 const *const buffered_spriteram = m_spriteram->buffer();
+ for (int offs = 0; offs < m_spriteram->bytes(); offs += 32)
{
- int sx, sy, code, color, pri;
- int flipx = 0, flipy = 0, height = 0, y;
-
- sx = buffered_spriteram[offs+3] | ((buffered_spriteram[offs+1] & 0x10) << 4);
- sy = buffered_spriteram[offs+2];
- code = buffered_spriteram[offs] | ((buffered_spriteram[offs+1] & 0xe0) << 3);
- color = buffered_spriteram[offs+1] & 0x0f;
+ int sx = buffered_spriteram[offs+3] | ((buffered_spriteram[offs+1] & 0x10) << 4);
+ int sy = buffered_spriteram[offs+2];
+ int code = buffered_spriteram[offs] | ((buffered_spriteram[offs+1] & 0xe0) << 3);
+ int const color = buffered_spriteram[offs+1] & 0x0f;
//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);
+ 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 */
- code |= ((buffered_spriteram[offs+0x1c] & 0x01) << 11);
+ UINT8 const ext = buffered_spriteram[offs+0x1c];
+
+ if (extensions & SPRITE_12BIT)
+ code |= ((ext & 0x01) << 11);
- if (pollux_extensions >= 2)
+ if (extensions & SPRITE_HEIGHT)
{
- /* pollux, bluehawk, flytiger */
- height = (buffered_spriteram[offs+0x1c] & 0x70) >> 4;
+ height = (ext & 0x70) >> 4;
code &= ~height;
- flipx = buffered_spriteram[offs+0x1c] & 0x08;
- flipy = buffered_spriteram[offs+0x1c] & 0x04;
+ flipx = ext & 0x08;
+ flipy = ext & 0x04;
+ }
- if (pollux_extensions == 3)
- {
- /* bluehawk */
- sy += 6 - ((~buffered_spriteram[offs+0x1c] & 0x02) << 7);
- }
+ if (extensions & SPRITE_YSHIFT_BLUEHAWK)
+ sy += 6 - ((~ext & 0x02) << 7);
- if (pollux_extensions == 4)
- {
- /* flytiger */
- sy -=(buffered_spriteram[offs+0x1c] & 0x02) << 7;
- }
- }
+ if (extensions & SPRITE_YSHIFT_FLYTIGER)
+ sy -=(ext & 0x02) << 7;
}
if (flip_screen())
@@ -421,7 +326,7 @@ void dooyong_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co
flipy = !flipy;
}
- for (y = 0; y <= height; y++)
+ for (int y = 0; y <= height; y++)
{
m_gfxdecode->gfx(1)->prio_transpen(bitmap,cliprect,
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:
- 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)
+UINT32 dooyong_z80_ym2203_state::screen_update_lastday(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
bitmap.fill(m_palette->black_pen(), 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);
if (!m_sprites_disabled)
- draw_sprites(screen, bitmap, cliprect, 0);
+ draw_sprites(screen, bitmap, cliprect);
+
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);
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_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4);
- draw_sprites(screen, bitmap, cliprect, 1);
+ draw_sprites(screen, bitmap, cliprect, SPRITE_12BIT);
+
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);
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_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;
}
-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);
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);
- draw_sprites(screen, bitmap, cliprect, 4);
+ draw_sprites(screen, bitmap, cliprect, SPRITE_12BIT | SPRITE_HEIGHT | SPRITE_YSHIFT_FLYTIGER);
+
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);
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_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;
}
-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);
@@ -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);
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
if (!m_tx_pri) m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- return 0;
-}
-
-UINT32 dooyong_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_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)
+VIDEO_START_MEMBER(dooyong_z80_ym2203_state, lastday)
{
/* Configure tilemap callbacks */
m_bg_tilerom = memregion("gfx5")->base();
m_fg_tilerom = memregion("gfx6")->base();
- m_bg_tilerom2 = NULL;
- m_fg_tilerom2 = NULL;
m_bg_gfx = 2;
m_fg_gfx = 3;
m_tx_tilemap_mode = 0;
@@ -635,7 +447,7 @@ VIDEO_START_MEMBER(dooyong_state,lastday)
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,
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);
/* Configure tilemap transparency */
@@ -658,13 +470,11 @@ VIDEO_START_MEMBER(dooyong_state,lastday)
save_item(NAME(m_interrupt_line_2));
}
-VIDEO_START_MEMBER(dooyong_state,gulfstrm)
+VIDEO_START_MEMBER(dooyong_z80_ym2203_state, gulfstrm)
{
/* Configure tilemap callbacks */
m_bg_tilerom = memregion("gfx5")->base();
m_fg_tilerom = memregion("gfx6")->base();
- m_bg_tilerom2 = NULL;
- m_fg_tilerom2 = NULL;
m_bg_gfx = 2;
m_fg_gfx = 3;
m_tx_tilemap_mode = 0;
@@ -674,7 +484,7 @@ VIDEO_START_MEMBER(dooyong_state,gulfstrm)
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,
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);
/* Configure tilemap transparency */
@@ -696,13 +506,11 @@ VIDEO_START_MEMBER(dooyong_state,gulfstrm)
save_item(NAME(m_interrupt_line_2));
}
-VIDEO_START_MEMBER(dooyong_state,pollux)
+VIDEO_START_MEMBER(dooyong_z80_ym2203_state, pollux)
{
/* Configure tilemap callbacks */
m_bg_tilerom = memregion("gfx5")->base();
m_fg_tilerom = memregion("gfx6")->base();
- m_bg_tilerom2 = NULL;
- m_fg_tilerom2 = NULL;
m_bg_gfx = 2;
m_fg_gfx = 3;
m_tx_tilemap_mode = 0;
@@ -712,7 +520,7 @@ VIDEO_START_MEMBER(dooyong_state,pollux)
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,
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);
/* Configure tilemap transparency */
@@ -731,15 +539,12 @@ VIDEO_START_MEMBER(dooyong_state,pollux)
save_item(NAME(m_interrupt_line_2));
}
-VIDEO_START_MEMBER(dooyong_state,bluehawk)
+VIDEO_START_MEMBER(dooyong_z80_state, bluehawk)
{
/* Configure tilemap callbacks */
m_bg_tilerom = memregion("gfx3")->base() + 0x78000;
m_fg_tilerom = memregion("gfx4")->base() + 0x78000;
m_fg2_tilerom = memregion("gfx5")->base() + 0x38000;
- m_bg_tilerom2 = NULL;
- m_fg_tilerom2 = NULL;
- m_fg2_tilerom2 = NULL;
m_bg_gfx = 2;
m_fg_gfx = 3;
m_fg2_gfx = 4;
@@ -752,7 +557,7 @@ VIDEO_START_MEMBER(dooyong_state,bluehawk)
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,
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);
/* Configure tilemap transparency */
@@ -771,13 +576,11 @@ VIDEO_START_MEMBER(dooyong_state,bluehawk)
save_item(NAME(m_fg2scroll8));
}
-VIDEO_START_MEMBER(dooyong_state,flytiger)
+VIDEO_START_MEMBER(dooyong_z80_state, flytiger)
{
/* Configure tilemap callbacks */
m_bg_tilerom = memregion("gfx3")->base() + 0x78000;
m_fg_tilerom = memregion("gfx4")->base() + 0x78000;
- m_bg_tilerom2 = NULL;
- m_fg_tilerom2 = NULL;
m_bg_gfx = 2;
m_fg_gfx = 3;
m_tx_tilemap_mode = 0;
@@ -785,9 +588,9 @@ VIDEO_START_MEMBER(dooyong_state,flytiger)
/* 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,
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);
- 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);
/* Configure tilemap transparency */
@@ -806,13 +609,11 @@ VIDEO_START_MEMBER(dooyong_state,flytiger)
save_item(NAME(m_flytiger_pri));
}
-VIDEO_START_MEMBER(dooyong_state,primella)
+VIDEO_START_MEMBER(dooyong_z80_state, primella)
{
/* Configure tilemap callbacks */
m_bg_tilerom = memregion("gfx2")->base() + memregion("gfx2")->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_fg_gfx = 2;
m_tx_tilemap_mode = 1;
@@ -822,7 +623,7 @@ VIDEO_START_MEMBER(dooyong_state,primella)
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,
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);
/* Configure tilemap transparency */
@@ -840,7 +641,156 @@ VIDEO_START_MEMBER(dooyong_state,primella)
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 */
m_bg_tilerom = memregion("gfx5")->base();
@@ -857,13 +807,13 @@ VIDEO_START_MEMBER(dooyong_state,rshark)
m_fg2_gfx = 1;
/* 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);
- 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);
- 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);
- 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);
/* Configure tilemap transparency */
@@ -881,10 +831,10 @@ VIDEO_START_MEMBER(dooyong_state,rshark)
save_item(NAME(m_bg2scroll8));
save_item(NAME(m_fgscroll8));
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 */
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_fgscroll8)); // Not used atm
save_item(NAME(m_fg2scroll8)); // Not used atm
- save_item(NAME(m_rshark_pri));
+ save_item(NAME(m_bg2_priority));
}
diff --git a/src/mame/video/prehisle.c b/src/mame/video/prehisle.c
index 48120d95a14..85fd22caa98 100644
--- a/src/mame/video/prehisle.c
+++ b/src/mame/video/prehisle.c
@@ -27,10 +27,10 @@ READ16_MEMBER(prehisle_state::prehisle_control16_r)
switch (offset)
{
case 0x08: return ioport("P2")->read(); // Player 2
- case 0x10: return ioport("COIN")->read(); // Coins, Tilt, Service
- case 0x20: return ioport("P1")->read() ^ m_invert_controls; // Player 1
- case 0x21: return ioport("DSW0")->read(); // DIPs
- case 0x22: return ioport("DSW1")->read(); // DIPs + VBLANK
+ case 0x10: return ioport("COIN")->read(); // Coins, Tilt, Service
+ case 0x20: return ioport("P1")->read() ^ m_invert_controls; // Player 1
+ case 0x21: return ioport("DSW0")->read(); // DIPs
+ case 0x22: return ioport("DSW1")->read(); // DIPs + VBLANK
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)
{
- UINT8 *tilerom = memregion("gfx5")->base();
+ UINT8 const *const tilerom = memregion("gfx5")->base();
- int offs = tile_index * 2;
- int attr = tilerom[offs + 1] + (tilerom[offs] << 8);
- int code = (attr & 0x7ff) | 0x800;
- int color = attr >> 12;
- int flags = (attr & 0x800) ? TILE_FLIPX : 0;
+ int const offs = tile_index * 2;
+ int const attr = tilerom[offs + 1] + (tilerom[offs] << 8);
+ int const code = (attr & 0x7ff) | 0x800;
+ int const color = attr >> 12;
+ int const flags = (attr & 0x800) ? TILE_FLIPX : 0;
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)
{
- int attr = m_bg_videoram16[tile_index];
- int code = attr & 0x7ff;
- int color = attr >> 12;
- int flags = (attr & 0x800) ? TILE_FLIPY : 0;
+ int const attr = m_bg_videoram16[tile_index];
+ int const code = attr & 0x7ff;
+ int const color = attr >> 12;
+ int const flags = (attr & 0x800) ? TILE_FLIPY : 0;
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)
{
- int attr = m_videoram[tile_index];
- int code = attr & 0xfff;
- int color = attr >> 12;
+ int const attr = m_videoram[tile_index];
+ int const code = attr & 0xfff;
+ int const color = attr >> 12;
SET_TILE_INFO_MEMBER(0, code, color, 0);
}
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,
- 16, 16, 1024, 32);
-
- m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(prehisle_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS,
- 16, 16, 256, 32);
-
- m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(prehisle_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS,
- 8, 8, 32, 32);
-
+ // ROM-based background layer
+ m_bg2_tilemap = &machine().tilemap().create(
+ m_gfxdecode,
+ tilemap_get_info_delegate(FUNC(prehisle_state::get_bg2_tile_info), this),
+ TILEMAP_SCAN_COLS, // scan order
+ 16, 16, // tile size
+ 1024, 32); // tilemap size
+
+ // 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);
+
+ // 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);
/* register for saving */
@@ -105,37 +134,33 @@ void prehisle_state::video_start()
}
/* sprite layout
-o fedcba9876543210
-0 .......xxxxxxxxx y, other bits unused?
-1 .......xxxxxxxxx x, other bits unused?
-
-2 ...xxxxxxxxxxxxx code
-2 ..x............. ?
-2 .x.............. flipx
-2 x............... flipy
-
-3 xxxx............ color+priority, other bits unknown
+0 .......x xxxxxxxx y, other bits unused?
+1 .......x xxxxxxxx x, other bits unused?
+2 x....... ........ flip y
+2 .x...... ........ flip x
+2 ..x..... ........ ?
+2 ...xxxxx xxxxxxxx gfx code
+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;
- int offs;
+ UINT16 const *const spriteram16 = m_spriteram;
- for (offs = 0; offs < 1024; offs += 4)
+ for (int offs = 0; offs < 1024; offs += 4)
{
- int attr = spriteram16[offs + 2];
- int code = attr & 0x1fff;
- int color = spriteram16[offs + 3] >> 12;
- int priority = (color < 0x4); // correct?
- int flipx = attr & 0x4000;
- int flipy = attr & 0x8000;
- int sx = spriteram16[offs + 1]&0x1ff;
- int sy = spriteram16[offs]&0x1ff;
+ int const attr = spriteram16[offs + 2];
+ int const code = attr & 0x1fff;
+ int const color = spriteram16[offs + 3] >> 12;
+ int const priority = (color < 0x4) ? 0x04 : 0x06;
+ bool flipx = attr & 0x4000;
+ bool flipy = attr & 0x8000;
+ int sx = spriteram16[offs + 1] & 0x1ff;
+ int sy = spriteram16[offs] & 0x1ff;
// coordinates are 9-bit signed
- if (sx&0x100) sx=-0x100+(sx&0xff);
- if (sy&0x100) sy=-0x100+(sy&0xff);
+ if (sx & 0x100) sx = -0x100 + (sx & 0xff);
+ if (sy & 0x100) sy = -0x100 + (sy & 0xff);
if (flip_screen())
{
@@ -145,19 +170,24 @@ void prehisle_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
flipy = !flipy;
}
- if ((foreground && priority) || (!foreground && !priority))
- {
- m_gfxdecode->gfx(3)->transpen(bitmap,cliprect, code, color, flipx, flipy, sx, sy, 15);
- }
+ m_gfxdecode->gfx(3)->prio_transpen(
+ bitmap, cliprect,
+ 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)
{
+ screen.priority().fill(0, cliprect);
+
m_bg2_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- draw_sprites(bitmap, cliprect, 0);
- m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- draw_sprites(bitmap, cliprect, 1);
- m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+ m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 1);
+ m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2);
+ draw_sprites(screen, bitmap, cliprect);
+
return 0;
}