preparing for some work on Tasman

yes, the filename is a bit ugly, but it's what it represents, I'll see if it can be further split into components later.

all users have been given a brief testing
This commit is contained in:
David Haywood 2013-07-09 17:59:28 +00:00
parent 308deb0fbe
commit 3ff7f06008
19 changed files with 2454 additions and 2533 deletions

4
.gitattributes vendored
View File

@ -5525,6 +5525,8 @@ src/mame/video/jalblend.c svneol=native#text/plain
src/mame/video/jalblend.h svneol=native#text/plain
src/mame/video/jedi.c svneol=native#text/plain
src/mame/video/jpmimpct.c svneol=native#text/plain
src/mame/video/k054156_k054157_k056832.c svneol=native#text/plain
src/mame/video/k054156_k054157_k056832.h svneol=native#text/plain
src/mame/video/kan_panb.c svneol=native#text/plain
src/mame/video/kan_panb.h svneol=native#text/plain
src/mame/video/kan_pand.c svneol=native#text/plain
@ -5543,6 +5545,8 @@ src/mame/video/kickgoal.c svneol=native#text/plain
src/mame/video/kingobox.c svneol=native#text/plain
src/mame/video/klax.c svneol=native#text/plain
src/mame/video/kncljoe.c svneol=native#text/plain
src/mame/video/konami_helper.c svneol=native#text/plain
src/mame/video/konami_helper.h svneol=native#text/plain
src/mame/video/konamigx.c svneol=native#text/plain
src/mame/video/konamiic.c svneol=native#text/plain
src/mame/video/konamiic.h svneol=native#text/plain

View File

@ -175,7 +175,7 @@ Check gticlub.c for details on the bottom board.
#include "sound/k054539.h"
#include "video/konicdev.h"
#include "video/gticlub.h"
#include "video/k054156_k054157_k056832.h"
class zr107_state : public driver_device
{

View File

@ -5,6 +5,7 @@
*************************************************************************/
#include "sound/k053260.h"
#include "video/konicdev.h"
#include "video/k054156_k054157_k056832.h"
class asterix_state : public driver_device
{

View File

@ -5,6 +5,7 @@
*************************************************************************/
#include "video/konicdev.h"
#include "video/k054156_k054157_k056832.h"
#define CPU_CLOCK (XTAL_24MHz / 2) /* 68000 clock */
#define SOUND_CLOCK XTAL_16_9344MHz /* YMZ280 clock */

View File

@ -5,6 +5,7 @@
*************************************************************************/
#include "video/konicdev.h"
#include "machine/k053252.h"
#include "video/k054156_k054157_k056832.h"
class dbz_state : public driver_device
{

View File

@ -1,5 +1,6 @@
#include "machine/ataintf.h"
#include "video/konicdev.h"
#include "video/k054156_k054157_k056832.h"
class djmain_state : public driver_device
{

View File

@ -5,6 +5,8 @@
*************************************************************************/
#include "sound/k054539.h"
#include "video/konicdev.h"
#include "video/k054156_k054157_k056832.h"
class gijoe_state : public driver_device
{

View File

@ -5,6 +5,8 @@
*************************************************************************/
#include "sound/k054539.h"
#include "video/konicdev.h"
#include "video/k054156_k054157_k056832.h"
class lethal_state : public driver_device
{

View File

@ -7,6 +7,7 @@
#include "sound/k054539.h"
#include "machine/k053252.h"
#include "video/konicdev.h"
#include "video/k054156_k054157_k056832.h"
class moo_state : public driver_device
{

View File

@ -2,6 +2,7 @@
#include "sound/k054539.h"
#include "machine/k053252.h"
#include "video/konicdev.h"
#include "video/k054156_k054157_k056832.h"
class qdrmfgp_state : public driver_device
{

View File

@ -9,6 +9,8 @@
#include "sound/k054539.h"
#include "machine/k053252.h"
#include "video/konicdev.h"
#include "video/k054156_k054157_k056832.h"
class xexex_state : public driver_device
{

View File

@ -1221,6 +1221,8 @@ $(MAMEOBJ)/konami.a: \
$(DRIVERS)/xmen.o $(VIDEO)/xmen.o \
$(DRIVERS)/yiear.o $(VIDEO)/yiear.o \
$(DRIVERS)/zr107.o \
$(VIDEO)/konami_helper.o \
$(VIDEO)/k054156_k054157_k056832.o \
$(VIDEO)/konamiic.o $(VIDEO)/konicdev.o \
$(MAMEOBJ)/maygay.a: \

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,186 @@
#pragma once
#ifndef __K056832_H__
#define __K056832_H__
typedef void (*k056832_callback)(running_machine &machine, int layer, int *code, int *color, int *flags);
struct k056832_interface
{
const char *m_gfx_memory_region;
int m_gfx_num;
int m_bpp;
int m_big;
int m_djmain_hack;
int m_deinterleave;
k056832_callback m_callback;
const char *m_k055555_tag; // tbyahhoo uses the k056832 together with a k055555
};
#define K056832_PAGE_COUNT 16
/* bit depths for the 56832 */
#define K056832_BPP_4 0
#define K056832_BPP_5 1
#define K056832_BPP_6 2
#define K056832_BPP_8 3
#define K056832_BPP_4dj 4
#define K056832_BPP_8LE 5
#define K056832_BPP_8TASMAN 6
#define K056832_DRAW_FLAG_MIRROR 0x00800000
class k056832_device : public device_t,
public k056832_interface
{
public:
k056832_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k056832_device() {}
void SetExtLinescroll(); /* Lethal Enforcers */
DECLARE_READ16_MEMBER( ram_word_r );
DECLARE_WRITE16_MEMBER( ram_word_w );
DECLARE_READ16_MEMBER( ram_half_word_r );
DECLARE_WRITE16_MEMBER( ram_half_word_w );
DECLARE_READ16_MEMBER( k_5bpp_rom_word_r );
DECLARE_READ32_MEMBER( k_5bpp_rom_long_r );
DECLARE_READ32_MEMBER( k_6bpp_rom_long_r );
DECLARE_READ16_MEMBER( rom_word_r );
DECLARE_READ16_MEMBER( mw_rom_word_r );
DECLARE_READ16_MEMBER( bishi_rom_word_r );
DECLARE_READ16_MEMBER( old_rom_word_r );
DECLARE_READ16_MEMBER( rom_word_8000_r );
DECLARE_WRITE16_MEMBER( word_w ); // "VRAM" registers
DECLARE_WRITE16_MEMBER( b_word_w );
DECLARE_READ8_MEMBER( ram_code_lo_r );
DECLARE_READ8_MEMBER( ram_code_hi_r );
DECLARE_READ8_MEMBER( ram_attr_lo_r );
DECLARE_READ8_MEMBER( ram_attr_hi_r );
DECLARE_WRITE8_MEMBER( ram_code_lo_w );
DECLARE_WRITE8_MEMBER( ram_code_hi_w );
DECLARE_WRITE8_MEMBER( ram_attr_lo_w );
DECLARE_WRITE8_MEMBER( ram_attr_hi_w );
DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE8_MEMBER( b_w );
void mark_plane_dirty(int num);
void mark_all_tmaps_dirty();
void tilemap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int num, UINT32 flags, UINT32 priority);
void tilemap_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, int num, UINT32 flags, UINT32 priority);
void tilemap_draw_dj(bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer, UINT32 flags, UINT32 priority);
void set_layer_association(int status);
int get_layer_association();
void set_layer_offs(int layer, int offsx, int offsy);
void set_lsram_page(int logical_page, int physical_page, int physical_offset);
void linemap_enable(int enable);
int is_irq_enabled(int irqline);
void read_avac(int *mode, int *data);
int read_register(int regnum);
int get_current_rambank();
int get_lookup(int bits); /* Asterix */
void set_tile_bank(int bank); /* Asterix */
DECLARE_READ32_MEMBER( ram_long_r );
DECLARE_READ32_MEMBER( rom_long_r );
DECLARE_WRITE32_MEMBER( ram_long_w );
DECLARE_READ32_MEMBER( unpaged_ram_long_r );
DECLARE_WRITE32_MEMBER( unpaged_ram_long_w );
DECLARE_WRITE32_MEMBER( long_w );
DECLARE_WRITE32_MEMBER( b_long_w );
DECLARE_READ16_MEMBER( word_r ); // VACSET
DECLARE_READ16_MEMBER( b_word_r ); // VSCCS (board dependent)
DECLARE_READ32_MEMBER( long_r ); // VACSET
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
private:
// internal state
tilemap_t *m_tilemap[K056832_PAGE_COUNT];
bitmap_ind16 *m_pixmap[K056832_PAGE_COUNT];
UINT16 m_regs[0x20]; // 157/832 regs group 1
UINT16 m_regsb[4]; // 157/832 regs group 2, board dependent
UINT8 * m_rombase; // pointer to tile gfx data
UINT16 * m_videoram;
int m_num_gfx_banks; // depends on size of graphics ROMs
int m_cur_gfx_banks; // cached info for K056832_regs[0x1a]
// ROM readback involves reading 2 halves of a word
// from the same location in a row. Reading the
// RAM window resets this state so you get the first half.
int m_rom_half;
// locally cached values
int m_layer_assoc_with_page[K056832_PAGE_COUNT];
int m_layer_offs[8][2];
int m_lsram_page[8][2];
INT32 m_x[8]; // 0..3 left
INT32 m_y[8]; // 0..3 top
INT32 m_w[8]; // 0..3 width -> 1..4 pages
INT32 m_h[8]; // 0..3 height -> 1..4 pages
INT32 m_dx[8]; // scroll
INT32 m_dy[8]; // scroll
UINT32 m_line_dirty[K056832_PAGE_COUNT][8];
UINT8 m_all_lines_dirty[K056832_PAGE_COUNT];
UINT8 m_page_tile_mode[K056832_PAGE_COUNT];
int m_last_colorbase[K056832_PAGE_COUNT];
UINT8 m_layer_tile_mode[8];
int m_default_layer_association;
int m_layer_association;
int m_active_layer;
int m_selected_page;
int m_selected_page_x4096;
int m_linemap_enabled;
int m_use_ext_linescroll;
int m_uses_tile_banks, m_cur_tile_bank;
device_t *m_k055555; /* used to choose colorbase */
void get_tile_info( tile_data &tileinfo, int tile_index, int pageIndex );
TILE_GET_INFO_MEMBER(get_tile_info0);
TILE_GET_INFO_MEMBER(get_tile_info1);
TILE_GET_INFO_MEMBER(get_tile_info2);
TILE_GET_INFO_MEMBER(get_tile_info3);
TILE_GET_INFO_MEMBER(get_tile_info4);
TILE_GET_INFO_MEMBER(get_tile_info5);
TILE_GET_INFO_MEMBER(get_tile_info6);
TILE_GET_INFO_MEMBER(get_tile_info7);
TILE_GET_INFO_MEMBER(get_tile_info8);
TILE_GET_INFO_MEMBER(get_tile_info9);
TILE_GET_INFO_MEMBER(get_tile_infoa);
TILE_GET_INFO_MEMBER(get_tile_infob);
TILE_GET_INFO_MEMBER(get_tile_infoc);
TILE_GET_INFO_MEMBER(get_tile_infod);
TILE_GET_INFO_MEMBER(get_tile_infoe);
TILE_GET_INFO_MEMBER(get_tile_infof);
void mark_page_dirty(int page);
void mark_all_tilemaps_dirty();
void update_page_layout();
void change_rambank();
void change_rombank();
void postload();
int rom_read_b(int offset, int blksize, int blksize2, int zerosec);
template<class _BitmapClass>
int update_linemap(_BitmapClass &bitmap, int page, int flags);
template<class _BitmapClass>
void tilemap_draw_common(_BitmapClass &bitmap, const rectangle &cliprect, int layer, UINT32 flags, UINT32 priority);
};
extern const device_type K056832;
#endif

View File

@ -0,0 +1,111 @@
/* Konami Video Helper functions */
#include "emu.h"
#include "konami_helper.h"
/*
This recursive function doesn't use additional memory
(it could be easily converted into an iterative one).
It's called shuffle because it mimics the shuffling of a deck of cards.
*/
static void konami_shuffle_16(UINT16 *buf,int len)
{
int i;
UINT16 t;
if (len == 2) return;
if (len % 4) fatalerror("shuffle() - not modulo 4\n"); /* must not happen */
len /= 2;
for (i = 0; i < len / 2; i++)
{
t = buf[len / 2 + i];
buf[len / 2 + i] = buf[len + i];
buf[len + i] = t;
}
konami_shuffle_16(buf,len);
konami_shuffle_16(buf + len,len);
}
static void konami_shuffle_8(UINT8 *buf,int len)
{
int i;
UINT8 t;
if (len == 2) return;
if (len % 4) fatalerror("shuffle() - not modulo 4\n"); /* must not happen */
len /= 2;
for (i = 0; i < len / 2; i++)
{
t = buf[len / 2 + i];
buf[len / 2 + i] = buf[len + i];
buf[len + i] = t;
}
konami_shuffle_8(buf,len);
konami_shuffle_8(buf + len,len);
}
/* helper function to join two 16-bit ROMs and form a 32-bit data stream */
void konamid_rom_deinterleave_2(running_machine &machine, const char *mem_region)
{
konami_shuffle_16((UINT16 *)machine.root_device().memregion(mem_region)->base(),machine.root_device().memregion(mem_region)->bytes()/2);
}
/* hacked version of rom_deinterleave_2_half for Lethal Enforcers */
void konamid_rom_deinterleave_2_half(running_machine &machine, const char *mem_region)
{
UINT8 *rgn = machine.root_device().memregion(mem_region)->base();
konami_shuffle_16((UINT16 *)rgn,machine.root_device().memregion(mem_region)->bytes()/4);
konami_shuffle_16((UINT16 *)(rgn+machine.root_device().memregion(mem_region)->bytes()/2),machine.root_device().memregion(mem_region)->bytes()/4);
}
/* helper function to join four 16-bit ROMs and form a 64-bit data stream */
void konamid_rom_deinterleave_4(running_machine &machine, const char *mem_region)
{
konamid_rom_deinterleave_2(machine, mem_region);
konamid_rom_deinterleave_2(machine, mem_region);
}
void konami_decode_gfx(running_machine &machine, int gfx_index, UINT8 *data, UINT32 total, const gfx_layout *layout, int bpp)
{
gfx_layout gl;
memcpy(&gl, layout, sizeof(gl));
gl.total = total;
machine.gfx[gfx_index] = auto_alloc(machine, gfx_element(machine, gl, data, machine.total_colors() >> bpp, 0));
}
void konami_deinterleave_gfx(running_machine &machine, const char *gfx_memory_region, int deinterleave)
{
switch (deinterleave)
{
case KONAMI_ROM_DEINTERLEAVE_NONE:
break;
case KONAMI_ROM_DEINTERLEAVE_2:
konamid_rom_deinterleave_2(machine, gfx_memory_region);
break;
case KONAMI_ROM_DEINTERLEAVE_2_HALF:
konamid_rom_deinterleave_2_half(machine, gfx_memory_region);
break;
case KONAMI_ROM_DEINTERLEAVE_4:
konamid_rom_deinterleave_4(machine, gfx_memory_region);
break;
case KONAMI_ROM_SHUFFLE8:
konami_shuffle_8(machine.root_device().memregion(gfx_memory_region)->base(), machine.root_device().memregion(gfx_memory_region)->bytes());
break;
}
}

View File

@ -0,0 +1,26 @@
/* Konami video helper functions */
#pragma once
#ifndef __KONAMI_HELPER_H__
#define __KONAMI_HELPER_H__
enum
{
KONAMI_ROM_DEINTERLEAVE_NONE = 0,
KONAMI_ROM_DEINTERLEAVE_2,
KONAMI_ROM_DEINTERLEAVE_2_HALF,
KONAMI_ROM_DEINTERLEAVE_4,
KONAMI_ROM_SHUFFLE8
};
/* helper function to join two 16-bit ROMs and form a 32-bit data stream */
void konamid_rom_deinterleave_2(running_machine &machine, const char *mem_region);
void konamid_rom_deinterleave_2_half(running_machine &machine, const char *mem_region);
/* helper function to join four 16-bit ROMs and form a 64-bit data stream */
void konamid_rom_deinterleave_4(running_machine &machine, const char *mem_region);
void konami_decode_gfx(running_machine &machine, int gfx_index, UINT8 *data, UINT32 total, const gfx_layout *layout, int bpp);
void konami_deinterleave_gfx(running_machine &machine, const char *gfx_memory_region, int deinterleave);
#endif

View File

@ -531,154 +531,6 @@ to through the chip.
054156/054157
054156/056832
-------------
[Except for tilemap sizes, all numbers are in hex]
These work in pairs. Similar in principle to the 052109/051962, they
manage 4 64x32 or 64x64 tilemaps. They also handle linescroll on each
layer, and optional tile banking. They use 4000 to 10000 bytes of
RAM, organized in 1000 or 2000 bytes banks.
The 56832 is a complete superset of the 54157 and supports higher color
depths (the 156/157 combo only goes to 5 bpp, the 156/832 combo goes to 8bpp).
These chips work in a fairly unusual way. There are 4, 8, or 16 pages of VRAM, arranged
conceptually in a 4x4 2 dimensional grid. Each page is a complete 64x32 tile tilemap.
The 4 physical tilemaps A, B, C, and, D are made up of these pages "glued together".
Each physical tilemap has an X and Y position in the 4x4 page grid indicating where
the page making up it's upper left corner is, as well as a width and height in pages.
If two tilemaps try to use the same page, the higher-letter one wins and the lower-letter
one is disabled completely. E.g. A > B > C > D, so if A and B both try to use the
same page only A will be displayed. Some games rely on this behavior to implicitly
disable tilemaps which otherwise should be displayed.
Tile encoding 2 bytes/tile (banks of 1000 bytes):
pppx bbcc cccc cccc
p = color palette
x = flip x
b = tile bank (0..3)
c = tile code (0..3ff)
Tile encoding 4 bytes/tile (banks of 2000 bytes):
---- ---- pppp --yx cccc cccc cccc cccc
p = color palette
x = flip x
y = flip y
b = tile bank (0..3)
c = tile code (0..3ff)
Communication with these ics go through 4 memory zones:
1000/2000 bytes: access to the currently selected ram bank
2000 bytes: readonly access the the currently select tile
rom bank for rom checksumming
40 bytes: writeonly access to the first register bank
8 bytes: writeonly access to the second register bank
One of the register banks is probably on the 054156, and the other on
the 054157.
First register bank map (offsets in bytes, '-' means unused):
00 ---- ---- ??yx ????
flip control
02 ---- ---- ???? ????
unknown
04 ---- ---- ???? ????
unknown (bit 1 may be bank count selection, 0 in xexex, 1 everywhere
else)
06 ---- ---- ???? ???e
enable irq
08 ---- ---- ???? ????
unknown
0a ---- ---- 3322 1100
linescroll control, each pair of bits indicates the mode for the
corresponding layer:
0: per-line linescroll
1: unused/unknown
2: per-8 lines linescroll
3: no linescroll
0c ---- ---- ???? ????
unknown (bit 1 may be bank size selection, 1 in asterix, 0 everywhere
else)
0e ---- ---- ---- ----
10-13 ---- ---- ---y y-hh
layer Y position in the VRAM grid and height in pages
14-17 ---- ---- ---x x-ww
layer X position in the VRAM grid and width in pages
18-1f ---- ---- ???? ????
20-27 yyyy yyyy yyyy yyyy
scroll y position for each layer
28-2f xxxx xxxx xxxx xxxx
scroll x position for each layer
30 ---- ---- ---b b--b
linescroll ram bank selection
32 ---- ---- ---b b--b
cpu-accessible ram bank selection
34 bbbb bbbb bbbb bbbb
rom bank selection for checksumming (each bank is 0x2000 bytes)
36 ---- ---- ---- bbbb
secondary rom bank selection for checksumming when tile banking is
used
38 3333 2222 1111 0000
tile banking look up table. 4 bits are looked up here for the two
bits in the tile data.
3a ???? ???? ???? ????
unknown
3c ???? ???? ???? ????
unknown
3e ---- ---- ---- ----
Second register bank map:
00 ---- ---- ???? ????
unknown
02-07 are copies of the 02-07 registers from the first bank.
Linescroll:
The linescroll is controlled by the register 0b, and uses the data in
the ram bank pointed by register 31. The data for tilemap <n> starts
at offset 400*n in the bank for 1000 bytes ram banks, and 800*n+2 for
2000 bytes ram banks. The scrolling information is a vector of half
words separated by 1 word padding for 2000 bytes banks.
This is a source-oriented linescroll, i.e. the first word is
associated to the first one of the tilemap, not matter what the
current scrolly position is.
In per-line mode, each word indicates the horizontal scroll of the
associated line. Global scrollx is ignored.
In per-8 lines mode, each word associated to a line multiple of 8
indicates the horizontal scroll for that line and the 7 following
ones. The other 7 words are ignored. Global scrollx is ignored.
051960/051937

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@
#define __KONICDEV_H__
#include "devlegcy.h"
#include "konami_helper.h"
/***************************************************************************
TYPE DEFINITIONS
@ -23,7 +23,6 @@ typedef void (*k052109_callback)(running_machine &machine, int layer, int bank,
typedef void (*k051960_callback)(running_machine &machine, int *code, int *color, int *priority, int *shadow);
typedef void (*k05324x_callback)(running_machine &machine, int *code, int *color, int *priority);
typedef void (*k051316_callback)(running_machine &machine, int *code, int *color, int *flags);
typedef void (*k056832_callback)(running_machine &machine, int layer, int *code, int *color, int *flags);
struct k007342_interface
@ -91,18 +90,6 @@ struct k053936_interface
int m_wrap, m_xoff, m_yoff;
};
struct k056832_interface
{
const char *m_gfx_memory_region;
int m_gfx_num;
int m_bpp;
int m_big;
int m_djmain_hack;
int m_deinterleave;
k056832_callback m_callback;
const char *m_k055555_tag; // tbyahhoo uses the k056832 together with a k055555
};
struct k054338_interface
{
@ -625,164 +612,6 @@ private:
extern const device_type K051733;
#define K056832_PAGE_COUNT 16
/* bit depths for the 56832 */
#define K056832_BPP_4 0
#define K056832_BPP_5 1
#define K056832_BPP_6 2
#define K056832_BPP_8 3
#define K056832_BPP_4dj 4
#define K056832_BPP_8LE 5
#define K056832_BPP_8TASMAN 6
class k056832_device : public device_t,
public k056832_interface
{
public:
k056832_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k056832_device() {}
void SetExtLinescroll(); /* Lethal Enforcers */
DECLARE_READ16_MEMBER( ram_word_r );
DECLARE_WRITE16_MEMBER( ram_word_w );
DECLARE_READ16_MEMBER( ram_half_word_r );
DECLARE_WRITE16_MEMBER( ram_half_word_w );
DECLARE_READ16_MEMBER( k_5bpp_rom_word_r );
DECLARE_READ32_MEMBER( k_5bpp_rom_long_r );
DECLARE_READ32_MEMBER( k_6bpp_rom_long_r );
DECLARE_READ16_MEMBER( rom_word_r );
DECLARE_READ16_MEMBER( mw_rom_word_r );
DECLARE_READ16_MEMBER( bishi_rom_word_r );
DECLARE_READ16_MEMBER( old_rom_word_r );
DECLARE_READ16_MEMBER( rom_word_8000_r );
DECLARE_WRITE16_MEMBER( word_w ); // "VRAM" registers
DECLARE_WRITE16_MEMBER( b_word_w );
DECLARE_READ8_MEMBER( ram_code_lo_r );
DECLARE_READ8_MEMBER( ram_code_hi_r );
DECLARE_READ8_MEMBER( ram_attr_lo_r );
DECLARE_READ8_MEMBER( ram_attr_hi_r );
DECLARE_WRITE8_MEMBER( ram_code_lo_w );
DECLARE_WRITE8_MEMBER( ram_code_hi_w );
DECLARE_WRITE8_MEMBER( ram_attr_lo_w );
DECLARE_WRITE8_MEMBER( ram_attr_hi_w );
DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE8_MEMBER( b_w );
void mark_plane_dirty(int num);
void mark_all_tmaps_dirty();
void tilemap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int num, UINT32 flags, UINT32 priority);
void tilemap_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, int num, UINT32 flags, UINT32 priority);
void tilemap_draw_dj(bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer, UINT32 flags, UINT32 priority);
void set_layer_association(int status);
int get_layer_association();
void set_layer_offs(int layer, int offsx, int offsy);
void set_lsram_page(int logical_page, int physical_page, int physical_offset);
void linemap_enable(int enable);
int is_irq_enabled(int irqline);
void read_avac(int *mode, int *data);
int read_register(int regnum);
int get_current_rambank();
int get_lookup(int bits); /* Asterix */
void set_tile_bank(int bank); /* Asterix */
DECLARE_READ32_MEMBER( ram_long_r );
DECLARE_READ32_MEMBER( rom_long_r );
DECLARE_WRITE32_MEMBER( ram_long_w );
DECLARE_READ32_MEMBER( unpaged_ram_long_r );
DECLARE_WRITE32_MEMBER( unpaged_ram_long_w );
DECLARE_WRITE32_MEMBER( long_w );
DECLARE_WRITE32_MEMBER( b_long_w );
DECLARE_READ16_MEMBER( word_r ); // VACSET
DECLARE_READ16_MEMBER( b_word_r ); // VSCCS (board dependent)
DECLARE_READ32_MEMBER( long_r ); // VACSET
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
private:
// internal state
tilemap_t *m_tilemap[K056832_PAGE_COUNT];
bitmap_ind16 *m_pixmap[K056832_PAGE_COUNT];
UINT16 m_regs[0x20]; // 157/832 regs group 1
UINT16 m_regsb[4]; // 157/832 regs group 2, board dependent
UINT8 * m_rombase; // pointer to tile gfx data
UINT16 * m_videoram;
int m_num_gfx_banks; // depends on size of graphics ROMs
int m_cur_gfx_banks; // cached info for K056832_regs[0x1a]
// ROM readback involves reading 2 halves of a word
// from the same location in a row. Reading the
// RAM window resets this state so you get the first half.
int m_rom_half;
// locally cached values
int m_layer_assoc_with_page[K056832_PAGE_COUNT];
int m_layer_offs[8][2];
int m_lsram_page[8][2];
INT32 m_x[8]; // 0..3 left
INT32 m_y[8]; // 0..3 top
INT32 m_w[8]; // 0..3 width -> 1..4 pages
INT32 m_h[8]; // 0..3 height -> 1..4 pages
INT32 m_dx[8]; // scroll
INT32 m_dy[8]; // scroll
UINT32 m_line_dirty[K056832_PAGE_COUNT][8];
UINT8 m_all_lines_dirty[K056832_PAGE_COUNT];
UINT8 m_page_tile_mode[K056832_PAGE_COUNT];
int m_last_colorbase[K056832_PAGE_COUNT];
UINT8 m_layer_tile_mode[8];
int m_default_layer_association;
int m_layer_association;
int m_active_layer;
int m_selected_page;
int m_selected_page_x4096;
int m_linemap_enabled;
int m_use_ext_linescroll;
int m_uses_tile_banks, m_cur_tile_bank;
device_t *m_k055555; /* used to choose colorbase */
void get_tile_info( tile_data &tileinfo, int tile_index, int pageIndex );
TILE_GET_INFO_MEMBER(get_tile_info0);
TILE_GET_INFO_MEMBER(get_tile_info1);
TILE_GET_INFO_MEMBER(get_tile_info2);
TILE_GET_INFO_MEMBER(get_tile_info3);
TILE_GET_INFO_MEMBER(get_tile_info4);
TILE_GET_INFO_MEMBER(get_tile_info5);
TILE_GET_INFO_MEMBER(get_tile_info6);
TILE_GET_INFO_MEMBER(get_tile_info7);
TILE_GET_INFO_MEMBER(get_tile_info8);
TILE_GET_INFO_MEMBER(get_tile_info9);
TILE_GET_INFO_MEMBER(get_tile_infoa);
TILE_GET_INFO_MEMBER(get_tile_infob);
TILE_GET_INFO_MEMBER(get_tile_infoc);
TILE_GET_INFO_MEMBER(get_tile_infod);
TILE_GET_INFO_MEMBER(get_tile_infoe);
TILE_GET_INFO_MEMBER(get_tile_infof);
void mark_page_dirty(int page);
void mark_all_tilemaps_dirty();
void update_page_layout();
void change_rambank();
void change_rombank();
void postload();
int rom_read_b(int offset, int blksize, int blksize2, int zerosec);
template<class _BitmapClass>
int update_linemap(_BitmapClass &bitmap, int page, int flags);
template<class _BitmapClass>
void tilemap_draw_common(_BitmapClass &bitmap, const rectangle &cliprect, int layer, UINT32 flags, UINT32 priority);
};
extern const device_type K056832;
class k055555_device : public device_t
{
@ -1028,20 +857,6 @@ extern const device_type K037122;
HELPERS FOR DRIVERS
***************************************************************************/
enum
{
KONAMI_ROM_DEINTERLEAVE_NONE = 0,
KONAMI_ROM_DEINTERLEAVE_2,
KONAMI_ROM_DEINTERLEAVE_2_HALF,
KONAMI_ROM_DEINTERLEAVE_4,
KONAMI_ROM_SHUFFLE8
};
/* helper function to join two 16-bit ROMs and form a 32-bit data stream */
void konamid_rom_deinterleave_2(running_machine &machine, const char *mem_region);
void konamid_rom_deinterleave_2_half(running_machine &machine, const char *mem_region);
/* helper function to join four 16-bit ROMs and form a 64-bit data stream */
void konamid_rom_deinterleave_4(running_machine &machine, const char *mem_region);
/* helper function to sort three tile layers by priority order */
void konami_sortlayers3(int *layer, int *pri);
@ -1254,8 +1069,6 @@ DECLARE_READ32_DEVICE_HANDLER( k001604_char_r );
DECLARE_WRITE32_DEVICE_HANDLER( k001604_reg_w );
DECLARE_READ32_DEVICE_HANDLER( k001604_reg_r );
#define K056832_DRAW_FLAG_MIRROR 0x00800000
// debug handlers
DECLARE_READ16_DEVICE_HANDLER( k053246_reg_word_r ); // OBJSET1
DECLARE_READ16_DEVICE_HANDLER( k053247_reg_word_r ); // OBJSET2