Split up in their own files the remaining modernized devices contained in konicdev.c. [Osso]

This commit is contained in:
Scott Stone 2013-07-11 17:11:27 +00:00
parent 79a5c8c150
commit 17f7b70131
109 changed files with 3212 additions and 4197 deletions

15
.gitattributes vendored
View File

@ -5525,8 +5525,23 @@ 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/k007121.h svneol=native#text/plain
src/mame/video/k007342.c svneol=native#text/plain
src/mame/video/k007342.h svneol=native#text/plain
src/mame/video/k007420.c svneol=native#text/plain
src/mame/video/k007420.h svneol=native#text/plain
src/mame/video/k037122.c svneol=native#text/plain
src/mame/video/k037122.h svneol=native#text/plain
src/mame/video/k051316.c svneol=native#text/plain
src/mame/video/k051316.h svneol=native#text/plain
src/mame/video/k051733.c svneol=native#text/plain
src/mame/video/k051733.h svneol=native#text/plain
src/mame/video/k051960.h svneol=native#text/plain
src/mame/video/k052109.c svneol=native#text/plain
src/mame/video/k052109.h svneol=native#text/plain
src/mame/video/k05324x.c svneol=native#text/plain
src/mame/video/k05324x.h svneol=native#text/plain
src/mame/video/k053251.c svneol=native#text/plain
src/mame/video/k053936.c svneol=native#text/plain
src/mame/video/k053936.h svneol=native#text/plain
src/mame/video/k054000.c svneol=native#text/plain

View File

@ -11,7 +11,6 @@ Preliminary driver by:
#include "cpu/z80/z80.h"
#include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */
#include "sound/2151intf.h"
#include "video/konicdev.h"
#include "includes/konamipt.h"
#include "includes/aliens.h"

View File

@ -22,7 +22,6 @@
#include "emu.h"
#include "cpu/z80/z80.h"
#include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */
#include "video/konicdev.h"
#include "sound/2151intf.h"
#include "includes/konamipt.h"
#include "includes/blockhl.h"

View File

@ -18,7 +18,6 @@
#include "sound/2151intf.h"
#include "includes/chqflag.h"
#include "includes/konamipt.h"
#include "chqflag.lh"

View File

@ -14,7 +14,7 @@
#include "emu.h"
#include "cpu/z80/z80.h"
#include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */
#include "video/konicdev.h"
#include "sound/2151intf.h"
#include "includes/konamipt.h"
#include "includes/crimfght.h"

View File

@ -129,7 +129,7 @@ Dip locations verified with Service Mode.
#include "emu.h"
#include "cpu/m68000/m68000.h"
#include "sound/2610intf.h"
#include "video/konicdev.h"
#include "includes/crshrace.h"

View File

@ -25,7 +25,7 @@
#include "emu.h"
#include "cpu/z80/z80.h"
#include "cpu/m68000/m68000.h"
#include "video/konicdev.h"
#include "sound/2610intf.h"
#include "sound/okim6295.h"
#include "includes/f1gp.h"

View File

@ -10,7 +10,7 @@
#include "emu.h"
#include "cpu/z80/z80.h"
#include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */
#include "video/konicdev.h"
#include "sound/2151intf.h"
#include "includes/konamipt.h"
#include "includes/gbusters.h"

View File

@ -19,7 +19,7 @@
***************************************************************************/
#include "emu.h"
#include "video/konicdev.h"
#include "cpu/m68000/m68000.h"
#include "cpu/z80/z80.h"
#include "sound/2151intf.h"

View File

@ -320,7 +320,7 @@
#include "sound/rf5c400.h"
#include "sound/k056800.h"
#include "video/voodoo.h"
#include "video/konicdev.h"
#include "video/k037122.h"
#include "rendlay.h"

View File

@ -11,7 +11,7 @@
#include "emu.h"
#include "cpu/m6809/hd6309.h"
#include "sound/2203intf.h"
#include "video/konicdev.h"
#include "includes/konamipt.h"
#include "includes/labyrunr.h"

View File

@ -105,7 +105,7 @@ driver modified by Eisuke Watanabe
#include "sound/es8712.h"
#include "sound/okim6295.h"
#include "sound/ymf278b.h"
#include "video/konicdev.h"
/***************************************************************************

View File

@ -9,7 +9,7 @@
#include "emu.h"
#include "cpu/z80/z80.h"
#include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */
#include "video/konicdev.h"
#include "sound/2151intf.h"
#include "sound/k053260.h"
#include "includes/konamipt.h"

View File

@ -62,7 +62,7 @@
*/
#include "emu.h"
#include "video/konicdev.h"
#include "cpu/m68000/m68000.h"
#include "cpu/z80/z80.h"
#include "cpu/dsp56k/dsp56k.h"

View File

@ -42,7 +42,7 @@
#include "emu.h"
#include "video/konicdev.h"
#include "cpu/m68000/m68000.h"
#include "cpu/z80/z80.h"
#include "machine/eeprom.h"

View File

@ -69,7 +69,7 @@ Custom ICs - 053260 - sound chip (QFP80)
#include "emu.h"
#include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */
#include "cpu/z80/z80.h"
#include "video/konicdev.h"
#include "machine/eeprom.h"
#include "sound/2151intf.h"
#include "sound/k053260.h"

View File

@ -20,7 +20,7 @@
#include "emu.h"
#include "cpu/z80/z80.h"
#include "cpu/m6809/m6809.h"
#include "video/konicdev.h"
#include "sound/3812intf.h"
#include "includes/konamipt.h"
#include "includes/spy.h"

View File

@ -83,7 +83,7 @@ EB26IC73.BIN 27C240 / Main Program
#include "emu.h"
#include "cpu/z80/z80.h"
#include "cpu/m68000/m68000.h"
#include "video/konicdev.h"
#include "sound/2610intf.h"
#include "video/vsystem_spr.h"
#include "includes/suprslam.h"

View File

@ -10,7 +10,7 @@
#include "emu.h"
#include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */
#include "video/konicdev.h"
#include "sound/2151intf.h"
#include "includes/konamipt.h"
#include "includes/surpratk.h"

View File

@ -15,7 +15,7 @@
*/
#include "emu.h"
#include "video/konicdev.h"
#include "video/konami_helper.h"
#include "includes/konamigx.h"
#include "cpu/m68000/m68000.h"
#include "machine/eeprom.h"

View File

@ -15,7 +15,7 @@
#include "emu.h"
#include "cpu/z80/z80.h"
#include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */
#include "video/konicdev.h"
#include "sound/2151intf.h"
#include "includes/konamipt.h"
#include "includes/thunderx.h"

View File

@ -88,7 +88,7 @@
#include "emu.h"
#include "cpu/z80/z80.h"
#include "video/konicdev.h"
#include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */
#include "machine/eeprom.h"
#include "sound/2151intf.h"

View File

@ -15,7 +15,7 @@ likewise be a 2 screen game
***************************************************************************/
#include "emu.h"
#include "cpu/m68000/m68000.h"
#include "video/konicdev.h"
#include "machine/eeprom.h"
#include "cpu/z80/z80.h"
#include "sound/2151intf.h"

View File

@ -4,7 +4,10 @@
*************************************************************************/
#include "sound/upd7759.h"
#include "video/konicdev.h"
#include "video/k052109.h"
#include "video/k051960.h"
#include "video/k051316.h"
#include "video/konami_helper.h"
class _88games_state : public driver_device
{

View File

@ -1,5 +1,8 @@
#include "sound/k007232.h"
#include "video/konicdev.h"
#include "video/k052109.h"
#include "video/k051960.h"
#include "video/k051316.h"
#include "video/konami_helper.h"
class ajax_state : public driver_device
{

View File

@ -4,6 +4,9 @@
*************************************************************************/
#include "sound/k007232.h"
#include "video/k052109.h"
#include "video/k051960.h"
#include "video/konami_helper.h"
class aliens_state : public driver_device
{

View File

@ -4,9 +4,10 @@
*************************************************************************/
#include "sound/k053260.h"
#include "video/konicdev.h"
#include "video/k053251.h"
#include "video/k054156_k054157_k056832.h"
#include "video/k05324x.h"
#include "video/konami_helper.h"
class asterix_state : public driver_device
{

View File

@ -4,7 +4,8 @@
*************************************************************************/
#include "video/konicdev.h"
#include "video/k007342.h"
#include "video/k007420.h"
class battlnts_state : public driver_device
{

View File

@ -4,10 +4,11 @@
*************************************************************************/
#include "video/konicdev.h"
#include "video/k054156_k054157_k056832.h"
#include "video/k055555.h"
#include "video/k054338.h"
#include "video/konami_helper.h"
#define CPU_CLOCK (XTAL_24MHz / 2) /* 68000 clock */
#define SOUND_CLOCK XTAL_16_9344MHz /* YMZ280 clock */

View File

@ -4,7 +4,9 @@
*************************************************************************/
#include "sound/upd7759.h"
#include "video/konicdev.h"
#include "video/k007342.h"
#include "video/k007420.h"
#include "video/k051733.h"
class bladestl_state : public driver_device
{

View File

@ -4,6 +4,10 @@
*************************************************************************/
#include "video/k052109.h"
#include "video/k051960.h"
#include "video/konami_helper.h"
class blockhl_state : public driver_device
{
public:

View File

@ -4,7 +4,10 @@
*************************************************************************/
#include "sound/k007232.h"
#include "video/konicdev.h"
#include "video/k052109.h"
#include "video/k051960.h"
#include "video/k051316.h"
#include "video/konami_helper.h"
class bottom9_state : public driver_device
{

View File

@ -4,7 +4,10 @@
*************************************************************************/
#include "sound/k007232.h"
#include "video/konicdev.h"
#include "video/k051960.h"
#include "video/k051316.h"
#include "video/k051733.h"
#include "video/konami_helper.h"
class chqflag_state : public driver_device
{

View File

@ -5,7 +5,7 @@
*************************************************************************/
#include "sound/upd7759.h"
#include "sound/msm5205.h"
#include "video/konicdev.h"
#include "video/k007121.h"
class combatsc_state : public driver_device
{

View File

@ -4,7 +4,7 @@
*************************************************************************/
#include "video/konicdev.h"
#include "video/k007121.h"
class contra_state : public driver_device
{

View File

@ -4,6 +4,9 @@
*************************************************************************/
#include "sound/k007232.h"
#include "video/k052109.h"
#include "video/k051960.h"
#include "video/konami_helper.h"
class crimfght_state : public driver_device
{

View File

@ -3,11 +3,13 @@
Dragonball Z
*************************************************************************/
#include "video/konicdev.h"
#include "machine/k053252.h"
#include "video/k054156_k054157_k056832.h"
#include "video/k05324x.h"
#include "video/k053936.h"
#include "video/k053251.h"
#include "video/konami_helper.h"
class dbz_state : public driver_device
{

View File

@ -1,5 +1,5 @@
#include "machine/ataintf.h"
#include "video/konicdev.h"
#include "video/konami_helper.h"
#include "video/k054156_k054157_k056832.h"
#include "video/k055555.h"

View File

@ -4,7 +4,8 @@
*************************************************************************/
#include "sound/k007232.h"
#include "video/konicdev.h"
#include "video/k007121.h"
#include "video/k051733.h"
class fastlane_state : public driver_device
{

View File

@ -4,7 +4,7 @@
*************************************************************************/
#include "sound/k007232.h"
#include "video/konicdev.h"
#include "video/k007121.h"
class flkatck_state : public driver_device
{

View File

@ -5,6 +5,9 @@
*************************************************************************/
#include "sound/k007232.h"
#include "video/k052109.h"
#include "video/k051960.h"
#include "video/konami_helper.h"
class gbusters_state : public driver_device
{

View File

@ -4,9 +4,10 @@
*************************************************************************/
#include "sound/k054539.h"
#include "video/konicdev.h"
#include "video/k053251.h"
#include "video/k054156_k054157_k056832.h"
#include "video/k05324x.h"
#include "video/konami_helper.h"
class gijoe_state : public driver_device
{

View File

@ -4,6 +4,9 @@
*************************************************************************/
#include "sound/k007232.h"
#include "video/k052109.h"
#include "video/k051960.h"
#include "video/konami_helper.h"
class gradius3_state : public driver_device
{

View File

@ -6,7 +6,7 @@
#include "video/bufsprite.h"
#include "sound/k007232.h"
#include "video/konicdev.h"
#include "video/k007121.h"
class hcastle_state : public driver_device
{

View File

@ -4,6 +4,9 @@
*************************************************************************/
#include "video/k007121.h"
#include "video/k051733.h"
class labyrunr_state : public driver_device
{
public:

View File

@ -4,7 +4,7 @@
*************************************************************************/
#include "sound/k054539.h"
#include "video/konicdev.h"
#include "video/konami_helper.h"
#include "video/k054156_k054157_k056832.h"
#include "video/k05324x.h"
#include "video/k054000.h"

View File

@ -5,7 +5,10 @@
*************************************************************************/
#include "sound/upd7759.h"
#include "sound/k007232.h"
#include "video/konicdev.h"
#include "video/k052109.h"
#include "video/k051960.h"
#include "video/k051733.h"
#include "video/konami_helper.h"
class mainevt_state : public driver_device
{

View File

@ -6,12 +6,12 @@
#include "sound/okim6295.h"
#include "sound/k054539.h"
#include "machine/k053252.h"
#include "video/konicdev.h"
#include "video/k053251.h"
#include "video/k054156_k054157_k056832.h"
#include "video/k05324x.h"
#include "video/k054000.h"
#include "video/k054338.h"
#include "video/konami_helper.h"
class moo_state : public driver_device
{

View File

@ -5,8 +5,10 @@
*************************************************************************/
#include "sound/k053260.h"
#include "machine/k053252.h"
#include "video/konicdev.h"
#include "video/k051316.h"
#include "video/k05324x.h"
#include "video/k053251.h"
#include "video/konami_helper.h"
class overdriv_state : public driver_device
{

View File

@ -5,6 +5,9 @@
*************************************************************************/
#include "sound/k053260.h"
#include "video/k05324x.h"
#include "video/k052109.h"
#include "video/k053251.h"
#include "video/konami_helper.h"
class parodius_state : public driver_device
{

View File

@ -1,7 +1,7 @@
#include "machine/ataintf.h"
#include "sound/k054539.h"
#include "machine/k053252.h"
#include "video/konicdev.h"
#include "video/konami_helper.h"
#include "video/k054156_k054157_k056832.h"
class qdrmfgp_state : public driver_device

View File

@ -4,7 +4,8 @@
*************************************************************************/
#include "video/konicdev.h"
#include "video/k007342.h"
#include "video/k007420.h"
class rockrage_state : public driver_device
{

View File

@ -5,7 +5,8 @@
*************************************************************************/
#include "sound/k053260.h"
#include "machine/k053252.h"
#include "video/konicdev.h"
#include "video/k051316.h"
#include "video/konami_helper.h"
#include "video/k05324x.h"
class rollerg_state : public driver_device

View File

@ -7,7 +7,7 @@
#include "machine/k053252.h"
#include "video/k05324x.h"
#include "video/k053936.h"
#include "video/konami_helper.h"
class rungun_state : public driver_device
{

View File

@ -1,5 +1,8 @@
#include "sound/k053260.h"
#include "video/k05324x.h"
#include "video/k052109.h"
#include "video/k053251.h"
#include "video/konami_helper.h"
class simpsons_state : public driver_device
{

View File

@ -4,6 +4,9 @@
*************************************************************************/
#include "sound/k007232.h"
#include "video/k052109.h"
#include "video/k051960.h"
#include "video/konami_helper.h"
class spy_state : public driver_device
{

View File

@ -5,6 +5,9 @@
*************************************************************************/
#include "video/k05324x.h"
#include "video/k052109.h"
#include "video/k053251.h"
#include "video/konami_helper.h"
class surpratk_state : public driver_device
{

View File

@ -4,7 +4,7 @@
*************************************************************************/
#include "video/konicdev.h"
#include "video/k051316.h"
class tail2nos_state : public driver_device
{

View File

@ -4,6 +4,9 @@
*************************************************************************/
#include "sound/k007232.h"
#include "video/k052109.h"
#include "video/k051960.h"
#include "video/konami_helper.h"
class thunderx_state : public driver_device
{

View File

@ -4,9 +4,12 @@
#include "sound/k053260.h"
#include "sound/k054539.h"
#include "video/k05324x.h"
#include "video/konicdev.h"
#include "video/k052109.h"
#include "video/k051960.h"
#include "video/k053251.h"
#include "video/k053936.h"
#include "video/k054000.h"
#include "video/konami_helper.h"
class tmnt_state : public driver_device
{

View File

@ -4,7 +4,9 @@
*************************************************************************/
#include "video/konicdev.h"
#include "video/k051960.h"
#include "video/k051316.h"
#include "video/konami_helper.h"
class ultraman_state : public driver_device
{

View File

@ -7,7 +7,9 @@
#include "machine/k053252.h"
#include "video/k05324x.h"
#include "video/k054000.h"
#include "video/k052109.h"
#include "video/k053251.h"
#include "video/konami_helper.h"
class vendetta_state : public driver_device
{

View File

@ -1,5 +1,5 @@
#include "sound/k007232.h"
#include "video/konicdev.h"
#include "video/k051316.h"
class wecleman_state : public driver_device
{

View File

@ -8,11 +8,11 @@
#include "sound/flt_vol.h"
#include "sound/k054539.h"
#include "machine/k053252.h"
#include "video/konicdev.h"
#include "video/k054156_k054157_k056832.h"
#include "video/k05324x.h"
#include "video/k054338.h"
#include "video/k053251.h"
#include "video/konami_helper.h"
class xexex_state : public driver_device
{

View File

@ -1,5 +1,8 @@
#include "sound/k054539.h"
#include "video/k05324x.h"
#include "video/k053251.h"
#include "video/k052109.h"
#include "video/konami_helper.h"
class xmen_state : public driver_device
{

View File

@ -11,7 +11,7 @@
#include "cpu/m6809/m6809.h"
#include "cpu/z80/z80.h"
#include "cpu/m6809/konami.h"
#include "video/konicdev.h"
#include "includes/ajax.h"
/* ajax_bankswitch_w:

View File

@ -1,5 +1,5 @@
#include "emu.h"
#include "video/konicdev.h"
#include "cpu/m6809/konami.h"
#include "machine/eeprom.h"
#include "sound/k053260.h"

View File

@ -1222,6 +1222,15 @@ $(MAMEOBJ)/konami.a: \
$(DRIVERS)/yiear.o $(VIDEO)/yiear.o \
$(DRIVERS)/zr107.o \
$(VIDEO)/konami_helper.o \
$(VIDEO)/k007121.o \
$(VIDEO)/k007342.o \
$(VIDEO)/k007420.o \
$(VIDEO)/k037122.o \
$(VIDEO)/k051316.o \
$(VIDEO)/k051733.o \
$(VIDEO)/k051960.o \
$(VIDEO)/k052109.o \
$(VIDEO)/k053251.o \
$(VIDEO)/k054156_k054157_k056832.o \
$(VIDEO)/k05324x.o \
$(VIDEO)/k055555.o \

View File

@ -1,5 +1,5 @@
#include "emu.h"
#include "video/konicdev.h"
#include "includes/aliens.h"
/***************************************************************************

View File

@ -1,5 +1,5 @@
#include "emu.h"
#include "video/konicdev.h"
#include "includes/blockhl.h"

View File

@ -7,7 +7,7 @@
***************************************************************************/
#include "emu.h"
#include "video/konicdev.h"
#include "includes/combatsc.h"
PALETTE_INIT_MEMBER(combatsc_state,combatsc)

View File

@ -1,5 +1,5 @@
#include "emu.h"
#include "video/konicdev.h"
#include "includes/crimfght.h"

View File

@ -1,5 +1,5 @@
#include "emu.h"
#include "video/konicdev.h"
#include "includes/crshrace.h"

View File

@ -1,5 +1,5 @@
#include "emu.h"
#include "video/konicdev.h"
#include "includes/f1gp.h"

View File

@ -1,5 +1,5 @@
#include "emu.h"
#include "video/konicdev.h"
#include "includes/gbusters.h"

View File

@ -1,5 +1,5 @@
#include "emu.h"
#include "video/konicdev.h"
#include "includes/gradius3.h"

35
src/mame/video/k007121.h Normal file
View File

@ -0,0 +1,35 @@
#pragma once
#ifndef __K007121_H__
#define __K007121_H__
class k007121_device : public device_t
{
public:
k007121_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k007121_device() {}
DECLARE_READ8_MEMBER( ctrlram_r );
DECLARE_WRITE8_MEMBER( ctrl_w );
/* shall we move source in the interface? */
/* also notice that now we directly pass *gfx[chip] instead of **gfx !! */
void sprites_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, colortable_t *ctable, const UINT8 *source, int base_color, int global_x_offset, int bank_base, UINT32 pri_mask );
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
UINT8 m_ctrlram[8];
int m_flipscreen;
};
extern const device_type K007121;
#define MCFG_K007121_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, K007121, 0)
#endif

307
src/mame/video/k007342.c Normal file
View File

@ -0,0 +1,307 @@
/*
Konami 007342
------
The 007342 manages 2 64x32 scrolling tilemaps with 8x8 characters, and
optionally generates timing clocks and interrupt signals. It uses 0x2000
bytes of RAM, plus 0x0200 bytes for scrolling, and a variable amount of ROM.
It cannot read the ROMs.
control registers
000: ------x- INT control
---x---- flip screen (TODO: doesn't work with thehustl)
001: Used for banking in Rock'n'Rage
002: -------x MSB of x scroll 1
------x- MSB of x scroll 2
---xxx-- layer 1 row/column scroll control
000 = disabled
010 = unknown (bladestl shootout between periods)
011 = 32 columns (Blades of Steel)
101 = 256 rows (Battlantis, Rock 'n Rage)
x------- enable sprite wraparound from bottom to top (see Blades of Steel
high score table)
003: x scroll 1
004: y scroll 1
005: x scroll 2
006: y scroll 2
007: not used
*/
#include "emu.h"
#include "k007342.h"
#include "konami_helper.h"
#define VERBOSE 0
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
const device_type K007342 = &device_creator<k007342_device>;
k007342_device::k007342_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, K007342, "Konami 007342", tag, owner, clock, "k007342", __FILE__),
m_ram(NULL),
m_scroll_ram(NULL),
m_videoram_0(NULL),
m_videoram_1(NULL),
m_colorram_0(NULL),
m_colorram_1(NULL),
//m_tilemap[2];
m_flipscreen(0),
m_int_enabled(0)
//m_regs[8],
//m_scrollx[2],
//m_scrolly[2]
{
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void k007342_device::device_config_complete()
{
// inherit a copy of the static data
const k007342_interface *intf = reinterpret_cast<const k007342_interface *>(static_config());
if (intf != NULL)
*static_cast<k007342_interface *>(this) = *intf;
// or initialize to defaults if none provided
else
{
m_gfxnum = 0;
m_callback = NULL;
}
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void k007342_device::device_start()
{
m_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k007342_device::get_tile_info0),this), tilemap_mapper_delegate(FUNC(k007342_device::scan),this), 8, 8, 64, 32);
m_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k007342_device::get_tile_info1),this), tilemap_mapper_delegate(FUNC(k007342_device::scan),this), 8, 8, 64, 32);
m_ram = auto_alloc_array_clear(machine(), UINT8, 0x2000);
m_scroll_ram = auto_alloc_array_clear(machine(), UINT8, 0x0200);
m_colorram_0 = &m_ram[0x0000];
m_colorram_1 = &m_ram[0x1000];
m_videoram_0 = &m_ram[0x0800];
m_videoram_1 = &m_ram[0x1800];
m_tilemap[0]->set_transparent_pen(0);
m_tilemap[1]->set_transparent_pen(0);
save_pointer(NAME(m_ram), 0x2000);
save_pointer(NAME(m_scroll_ram), 0x0200);
save_item(NAME(m_int_enabled));
save_item(NAME(m_flipscreen));
save_item(NAME(m_scrollx));
save_item(NAME(m_scrolly));
save_item(NAME(m_regs));
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void k007342_device::device_reset()
{
int i;
m_int_enabled = 0;
m_flipscreen = 0;
m_scrollx[0] = 0;
m_scrollx[1] = 0;
m_scrolly[0] = 0;
m_scrolly[1] = 0;
for (i = 0; i < 8; i++)
m_regs[i] = 0;
}
/*****************************************************************************
DEVICE HANDLERS
*****************************************************************************/
READ8_MEMBER( k007342_device::read )
{
return m_ram[offset];
}
WRITE8_MEMBER( k007342_device::write )
{
m_ram[offset] = data;
if (offset < 0x1000) /* layer 0 */
m_tilemap[0]->mark_tile_dirty(offset & 0x7ff);
else /* layer 1 */
m_tilemap[1]->mark_tile_dirty(offset & 0x7ff);
}
READ8_MEMBER( k007342_device::scroll_r )
{
return m_scroll_ram[offset];
}
WRITE8_MEMBER( k007342_device::scroll_w )
{
m_scroll_ram[offset] = data;
}
WRITE8_MEMBER( k007342_device::vreg_w )
{
switch(offset)
{
case 0x00:
/* bit 1: INT control */
m_int_enabled = data & 0x02;
m_flipscreen = data & 0x10;
m_tilemap[0]->set_flip(m_flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
m_tilemap[1]->set_flip(m_flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
break;
case 0x01: /* used for banking in Rock'n'Rage */
if (data != m_regs[1])
space.machine().tilemap().mark_all_dirty();
case 0x02:
m_scrollx[0] = (m_scrollx[0] & 0xff) | ((data & 0x01) << 8);
m_scrollx[1] = (m_scrollx[1] & 0xff) | ((data & 0x02) << 7);
break;
case 0x03: /* scroll x (register 0) */
m_scrollx[0] = (m_scrollx[0] & 0x100) | data;
break;
case 0x04: /* scroll y (register 0) */
m_scrolly[0] = data;
break;
case 0x05: /* scroll x (register 1) */
m_scrollx[1] = (m_scrollx[1] & 0x100) | data;
break;
case 0x06: /* scroll y (register 1) */
m_scrolly[1] = data;
case 0x07: /* unused */
break;
}
m_regs[offset] = data;
}
void k007342_device::tilemap_update( )
{
int offs;
/* update scroll */
switch (m_regs[2] & 0x1c)
{
case 0x00:
case 0x08: /* unknown, blades of steel shootout between periods */
m_tilemap[0]->set_scroll_rows(1);
m_tilemap[0]->set_scroll_cols(1);
m_tilemap[0]->set_scrollx(0, m_scrollx[0]);
m_tilemap[0]->set_scrolly(0, m_scrolly[0]);
break;
case 0x0c: /* 32 columns */
m_tilemap[0]->set_scroll_rows(1);
m_tilemap[0]->set_scroll_cols(512);
m_tilemap[0]->set_scrollx(0, m_scrollx[0]);
for (offs = 0; offs < 256; offs++)
m_tilemap[0]->set_scrolly((offs + m_scrollx[0]) & 0x1ff,
m_scroll_ram[2 * (offs / 8)] + 256 * m_scroll_ram[2 * (offs / 8) + 1]);
break;
case 0x14: /* 256 rows */
m_tilemap[0]->set_scroll_rows(256);
m_tilemap[0]->set_scroll_cols(1);
m_tilemap[0]->set_scrolly(0, m_scrolly[0]);
for (offs = 0; offs < 256; offs++)
m_tilemap[0]->set_scrollx((offs + m_scrolly[0]) & 0xff,
m_scroll_ram[2 * offs] + 256 * m_scroll_ram[2 * offs + 1]);
break;
default:
// popmessage("unknown scroll ctrl %02x", m_regs[2] & 0x1c);
break;
}
m_tilemap[1]->set_scrollx(0, m_scrollx[1]);
m_tilemap[1]->set_scrolly(0, m_scrolly[1]);
#if 0
{
static int current_layer = 0;
if (machine.input().code_pressed_once(KEYCODE_Z)) current_layer = !current_layer;
m_tilemap[current_layer]->enable(1);
m_tilemap[!current_layer]->enable(0);
popmessage("regs:%02x %02x %02x %02x-%02x %02x %02x %02x:%02x",
m_regs[0], m_regs[1], m_regs[2], m_regs[3],
m_regs[4], m_regs[5], m_regs[6], m_regs[7],
current_layer);
}
#endif
}
void k007342_device::tilemap_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, int num, int flags, UINT32 priority )
{
m_tilemap[num]->draw(bitmap, cliprect, flags, priority);
}
int k007342_device::is_int_enabled( )
{
return m_int_enabled;
}
/***************************************************************************
Callbacks for the TileMap code
***************************************************************************/
/*
data format:
video RAM xxxxxxxx tile number (bits 0-7)
color RAM x------- tiles with priority over the sprites
color RAM -x------ depends on external conections
color RAM --x----- flip Y
color RAM ---x---- flip X
color RAM ----xxxx depends on external connections (usually color and banking)
*/
TILEMAP_MAPPER_MEMBER(k007342_device::scan)
{
/* logical (col,row) -> memory offset */
return (col & 0x1f) + ((row & 0x1f) << 5) + ((col & 0x20) << 5);
}
void k007342_device::get_tile_info( tile_data &tileinfo, int tile_index, int layer, UINT8 *cram, UINT8 *vram )
{
int color, code, flags;
color = cram[tile_index];
code = vram[tile_index];
flags = TILE_FLIPYX((color & 0x30) >> 4);
tileinfo.category = (color & 0x80) >> 7;
m_callback(machine(), layer, m_regs[1], &code, &color, &flags);
SET_TILE_INFO_MEMBER(
m_gfxnum,
code,
color,
flags);
}
TILE_GET_INFO_MEMBER(k007342_device::get_tile_info0)
{
get_tile_info(tileinfo, tile_index, 0, m_colorram_0, m_videoram_0);
}
TILE_GET_INFO_MEMBER(k007342_device::get_tile_info1)
{
get_tile_info(tileinfo, tile_index, 1, m_colorram_1, m_videoram_1);
}

62
src/mame/video/k007342.h Normal file
View File

@ -0,0 +1,62 @@
#pragma once
#ifndef __K007342_H__
#define __K007342_H__
typedef void (*k007342_callback)(running_machine &machine, int tmap, int bank, int *code, int *color, int *flags);
struct k007342_interface
{
int m_gfxnum;
k007342_callback m_callback;
};
class k007342_device : public device_t,
public k007342_interface
{
public:
k007342_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k007342_device() {}
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
DECLARE_READ8_MEMBER( scroll_r );
DECLARE_WRITE8_MEMBER( scroll_w );
DECLARE_WRITE8_MEMBER( vreg_w );
void tilemap_update();
void tilemap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int num, int flags, UINT32 priority);
int is_int_enabled();
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
UINT8 *m_ram;
UINT8 *m_scroll_ram;
UINT8 *m_videoram_0;
UINT8 *m_videoram_1;
UINT8 *m_colorram_0;
UINT8 *m_colorram_1;
tilemap_t *m_tilemap[2];
int m_flipscreen, m_int_enabled;
UINT8 m_regs[8];
UINT16 m_scrollx[2];
UINT8 m_scrolly[2];
TILEMAP_MAPPER_MEMBER(scan);
TILE_GET_INFO_MEMBER(get_tile_info0);
TILE_GET_INFO_MEMBER(get_tile_info1);
void get_tile_info( tile_data &tileinfo, int tile_index, int layer, UINT8 *cram, UINT8 *vram );
};
extern const device_type K007342;
#define MCFG_K007342_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K007342, 0) \
MCFG_DEVICE_CONFIG(_interface)
#endif

261
src/mame/video/k007420.c Normal file
View File

@ -0,0 +1,261 @@
/*
Konami 007420
------
Sprite generator. 8 bytes per sprite with zoom. It uses 0x200 bytes of RAM,
and a variable amount of ROM. Nothing is known about its external interface.
*/
#include "emu.h"
#include "k007420.h"
#include "konami_helper.h"
#define VERBOSE 0
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
#define K007420_SPRITERAM_SIZE 0x200
const device_type K007420 = &device_creator<k007420_device>;
k007420_device::k007420_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, K007420, "Konami 007420", tag, owner, clock, "k007420", __FILE__),
m_ram(NULL),
m_flipscreen(0)
//m_regs[8],
{
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void k007420_device::device_config_complete()
{
// inherit a copy of the static data
const k007420_interface *intf = reinterpret_cast<const k007420_interface *>(static_config());
if (intf != NULL)
*static_cast<k007420_interface *>(this) = *intf;
// or initialize to defaults if none provided
else
{
m_banklimit = 0;
m_callback = NULL;
}
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void k007420_device::device_start()
{
m_ram = auto_alloc_array_clear(machine(), UINT8, 0x200);
save_pointer(NAME(m_ram), 0x200);
save_item(NAME(m_flipscreen)); // current one uses 7342 one
save_item(NAME(m_regs)); // current one uses 7342 ones
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void k007420_device::device_reset()
{
int i;
m_flipscreen = 0;
for (i = 0; i < 8; i++)
m_regs[i] = 0;
}
/*****************************************************************************
DEVICE HANDLERS
*****************************************************************************/
READ8_MEMBER( k007420_device::read )
{
return m_ram[offset];
}
WRITE8_MEMBER( k007420_device::write )
{
m_ram[offset] = data;
}
/*
* Sprite Format
* ------------------
*
* Byte | Bit(s) | Use
* -----+-76543210-+----------------
* 0 | xxxxxxxx | y position
* 1 | xxxxxxxx | sprite code (low 8 bits)
* 2 | xxxxxxxx | depends on external conections. Usually banking
* 3 | xxxxxxxx | x position (low 8 bits)
* 4 | x------- | x position (high bit)
* 4 | -xxx---- | sprite size 000=16x16 001=8x16 010=16x8 011=8x8 100=32x32
* 4 | ----x--- | flip y
* 4 | -----x-- | flip x
* 4 | ------xx | zoom (bits 8 & 9)
* 5 | xxxxxxxx | zoom (low 8 bits) 0x080 = normal, < 0x80 enlarge, > 0x80 reduce
* 6 | xxxxxxxx | unused
* 7 | xxxxxxxx | unused
*/
void k007420_device::sprites_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx )
{
int offs;
int codemask = m_banklimit;
int bankmask = ~m_banklimit;
for (offs = K007420_SPRITERAM_SIZE - 8; offs >= 0; offs -= 8)
{
int ox, oy, code, color, flipx, flipy, zoom, w, h, x, y, bank;
static const int xoffset[4] = { 0, 1, 4, 5 };
static const int yoffset[4] = { 0, 2, 8, 10 };
code = m_ram[offs + 1];
color = m_ram[offs + 2];
ox = m_ram[offs + 3] - ((m_ram[offs + 4] & 0x80) << 1);
oy = 256 - m_ram[offs + 0];
flipx = m_ram[offs + 4] & 0x04;
flipy = m_ram[offs + 4] & 0x08;
m_callback(machine(), &code, &color);
bank = code & bankmask;
code &= codemask;
/* 0x080 = normal scale, 0x040 = double size, 0x100 half size */
zoom = m_ram[offs + 5] | ((m_ram[offs + 4] & 0x03) << 8);
if (!zoom)
continue;
zoom = 0x10000 * 128 / zoom;
switch (m_ram[offs + 4] & 0x70)
{
case 0x30: w = h = 1; break;
case 0x20: w = 2; h = 1; code &= (~1); break;
case 0x10: w = 1; h = 2; code &= (~2); break;
case 0x00: w = h = 2; code &= (~3); break;
case 0x40: w = h = 4; code &= (~3); break;
default: w = 1; h = 1;
//logerror("Unknown sprite size %02x\n",(m_ram[offs + 4] & 0x70) >> 4);
}
if (m_flipscreen)
{
ox = 256 - ox - ((zoom * w + (1 << 12)) >> 13);
oy = 256 - oy - ((zoom * h + (1 << 12)) >> 13);
flipx = !flipx;
flipy = !flipy;
}
if (zoom == 0x10000)
{
int sx, sy;
for (y = 0; y < h; y++)
{
sy = oy + 8 * y;
for (x = 0; x < w; x++)
{
int c = code;
sx = ox + 8 * x;
if (flipx)
c += xoffset[(w - 1 - x)];
else
c += xoffset[x];
if (flipy)
c += yoffset[(h - 1 - y)];
else
c += yoffset[y];
if (c & bankmask)
continue;
else
c += bank;
drawgfx_transpen(bitmap,cliprect,gfx,
c,
color,
flipx,flipy,
sx,sy,0);
if (m_regs[2] & 0x80)
drawgfx_transpen(bitmap,cliprect,gfx,
c,
color,
flipx,flipy,
sx,sy-256,0);
}
}
}
else
{
int sx, sy, zw, zh;
for (y = 0; y < h; y++)
{
sy = oy + ((zoom * y + (1 << 12)) >> 13);
zh = (oy + ((zoom * (y + 1) + (1 << 12)) >> 13)) - sy;
for (x = 0; x < w; x++)
{
int c = code;
sx = ox + ((zoom * x + (1<<12)) >> 13);
zw = (ox + ((zoom * (x + 1) + (1 << 12)) >> 13)) - sx;
if (flipx)
c += xoffset[(w - 1 - x)];
else
c += xoffset[x];
if (flipy)
c += yoffset[(h - 1 - y)];
else
c += yoffset[y];
if (c & bankmask)
continue;
else
c += bank;
drawgfxzoom_transpen(bitmap,cliprect,gfx,
c,
color,
flipx,flipy,
sx,sy,
(zw << 16) / 8,(zh << 16) / 8,0);
if (m_regs[2] & 0x80)
drawgfxzoom_transpen(bitmap,cliprect,gfx,
c,
color,
flipx,flipy,
sx,sy-256,
(zw << 16) / 8,(zh << 16) / 8,0);
}
}
}
}
#if 0
{
static int current_sprite = 0;
if (machine().input().code_pressed_once(KEYCODE_Z)) current_sprite = (current_sprite+1) & ((K007420_SPRITERAM_SIZE/8)-1);
if (machine().input().code_pressed_once(KEYCODE_X)) current_sprite = (current_sprite-1) & ((K007420_SPRITERAM_SIZE/8)-1);
popmessage("%02x:%02x %02x %02x %02x %02x %02x %02x %02x", current_sprite,
m_ram[(current_sprite*8)+0], m_ram[(current_sprite*8)+1],
m_ram[(current_sprite*8)+2], m_ram[(current_sprite*8)+3],
m_ram[(current_sprite*8)+4], m_ram[(current_sprite*8)+5],
m_ram[(current_sprite*8)+6], m_ram[(current_sprite*8)+7]);
}
#endif
}

43
src/mame/video/k007420.h Normal file
View File

@ -0,0 +1,43 @@
#pragma once
#ifndef __K007420_H__
#define __K007420_H__
typedef void (*k007420_callback)(running_machine &machine, int *code, int *color);
struct k007420_interface
{
int m_banklimit;
k007420_callback m_callback;
};
class k007420_device : public device_t,
public k007420_interface
{
public:
k007420_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k007420_device() {}
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
void sprites_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx);
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
UINT8 *m_ram;
int m_flipscreen; // current code uses the 7342 flipscreen!!
UINT8 m_regs[8]; // current code uses the 7342 regs!! (only [2])
};
extern const device_type K007420;
#define MCFG_K007420_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K007420, 0) \
MCFG_DEVICE_CONFIG(_interface)
#endif

227
src/mame/video/k037122.c Normal file
View File

@ -0,0 +1,227 @@
/*
Konami 037122
*/
#include "emu.h"
#include "k037122.h"
#include "konami_helper.h"
#define VERBOSE 0
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
#define K037122_NUM_TILES 16384
const device_type K037122 = &device_creator<k037122_device>;
k037122_device::k037122_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, K037122, "Konami 0371222", tag, owner, clock, "k037122", __FILE__),
m_screen(NULL),
m_tile_ram(NULL),
m_char_ram(NULL),
m_reg(NULL)
{
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void k037122_device::device_config_complete()
{
// inherit a copy of the static data
const k037122_interface *intf = reinterpret_cast<const k037122_interface *>(static_config());
if (intf != NULL)
*static_cast<k037122_interface *>(this) = *intf;
// or initialize to defaults if none provided
else
{
m_screen_tag = "";
m_gfx_index = 0;
}
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void k037122_device::device_start()
{
static const gfx_layout k037122_char_layout =
{
8, 8,
K037122_NUM_TILES,
8,
{ 0,1,2,3,4,5,6,7 },
{ 1*16, 0*16, 3*16, 2*16, 5*16, 4*16, 7*16, 6*16 },
{ 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128 },
8*128
};
m_screen = machine().device<screen_device>(m_screen_tag);
m_char_ram = auto_alloc_array_clear(machine(), UINT32, 0x200000 / 4);
m_tile_ram = auto_alloc_array_clear(machine(), UINT32, 0x20000 / 4);
m_reg = auto_alloc_array_clear(machine(), UINT32, 0x400 / 4);
m_layer[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k037122_device::tile_info_layer0),this), TILEMAP_SCAN_ROWS, 8, 8, 256, 64);
m_layer[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k037122_device::tile_info_layer1),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 64);
m_layer[0]->set_transparent_pen(0);
m_layer[1]->set_transparent_pen(0);
machine().gfx[m_gfx_index] = auto_alloc_clear(machine(), gfx_element(machine(), k037122_char_layout, (UINT8*)m_char_ram, machine().total_colors() / 16, 0));
save_pointer(NAME(m_reg), 0x400 / 4);
save_pointer(NAME(m_char_ram), 0x200000 / 4);
save_pointer(NAME(m_tile_ram), 0x20000 / 4);
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void k037122_device::device_reset()
{
memset(m_char_ram, 0, 0x200000);
memset(m_tile_ram, 0, 0x20000);
memset(m_reg, 0, 0x400);
}
/*****************************************************************************
DEVICE HANDLERS
*****************************************************************************/
TILE_GET_INFO_MEMBER(k037122_device::tile_info_layer0)
{
UINT32 val = m_tile_ram[tile_index + (0x8000/4)];
int color = (val >> 17) & 0x1f;
int tile = val & 0x3fff;
int flags = 0;
if (val & 0x400000)
flags |= TILE_FLIPX;
if (val & 0x800000)
flags |= TILE_FLIPY;
SET_TILE_INFO_MEMBER(m_gfx_index, tile, color, flags);
}
TILE_GET_INFO_MEMBER(k037122_device::tile_info_layer1)
{
UINT32 val = m_tile_ram[tile_index];
int color = (val >> 17) & 0x1f;
int tile = val & 0x3fff;
int flags = 0;
if (val & 0x400000)
flags |= TILE_FLIPX;
if (val & 0x800000)
flags |= TILE_FLIPY;
SET_TILE_INFO_MEMBER(m_gfx_index, tile, color, flags);
}
void k037122_device::tile_draw( bitmap_rgb32 &bitmap, const rectangle &cliprect )
{
const rectangle &visarea = m_screen->visible_area();
if (m_reg[0xc] & 0x10000)
{
m_layer[1]->set_scrolldx(visarea.min_x, visarea.min_x);
m_layer[1]->set_scrolldy(visarea.min_y, visarea.min_y);
m_layer[1]->draw(bitmap, cliprect, 0, 0);
}
else
{
m_layer[0]->set_scrolldx(visarea.min_x, visarea.min_x);
m_layer[0]->set_scrolldy(visarea.min_y, visarea.min_y);
m_layer[0]->draw(bitmap, cliprect, 0, 0);
}
}
void k037122_device::update_palette_color( UINT32 palette_base, int color )
{
UINT32 data = m_tile_ram[(palette_base / 4) + color];
palette_set_color_rgb(machine(), color, pal5bit(data >> 6), pal6bit(data >> 0), pal5bit(data >> 11));
}
READ32_MEMBER( k037122_device::sram_r )
{
return m_tile_ram[offset];
}
WRITE32_MEMBER( k037122_device::sram_w )
{
COMBINE_DATA(m_tile_ram + offset);
if (m_reg[0xc] & 0x10000)
{
if (offset < 0x8000 / 4)
{
m_layer[1]->mark_tile_dirty(offset);
}
else if (offset >= 0x8000 / 4 && offset < 0x18000 / 4)
{
m_layer[0]->mark_tile_dirty(offset - (0x8000 / 4));
}
else if (offset >= 0x18000 / 4)
{
update_palette_color(0x18000, offset - (0x18000 / 4));
}
}
else
{
if (offset < 0x8000 / 4)
{
update_palette_color(0, offset);
}
else if (offset >= 0x8000 / 4 && offset < 0x18000 / 4)
{
m_layer[0]->mark_tile_dirty(offset - (0x8000 / 4));
}
else if (offset >= 0x18000 / 4)
{
m_layer[1]->mark_tile_dirty(offset - (0x18000 / 4));
}
}
}
READ32_MEMBER( k037122_device::char_r )
{
int bank = m_reg[0x30 / 4] & 0x7;
return m_char_ram[offset + (bank * (0x40000 / 4))];
}
WRITE32_MEMBER( k037122_device::char_w )
{
int bank = m_reg[0x30 / 4] & 0x7;
UINT32 addr = offset + (bank * (0x40000/4));
COMBINE_DATA(m_char_ram + addr);
space.machine().gfx[m_gfx_index]->mark_dirty(addr / 32);
}
READ32_MEMBER( k037122_device::reg_r )
{
switch (offset)
{
case 0x14/4:
{
return 0x000003fa;
}
}
return m_reg[offset];
}
WRITE32_MEMBER( k037122_device::reg_w )
{
COMBINE_DATA(m_reg + offset);
}

52
src/mame/video/k037122.h Normal file
View File

@ -0,0 +1,52 @@
#pragma once
#ifndef __K037122_H__
#define __K037122_H__
struct k037122_interface
{
const char *m_screen_tag;
int m_gfx_index;
};
class k037122_device : public device_t,
public k037122_interface
{
public:
k037122_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k037122_device() {}
void tile_draw( bitmap_rgb32 &bitmap, const rectangle &cliprect );
DECLARE_READ32_MEMBER( sram_r );
DECLARE_WRITE32_MEMBER( sram_w );
DECLARE_READ32_MEMBER( char_r );
DECLARE_WRITE32_MEMBER( char_w );
DECLARE_READ32_MEMBER( reg_r );
DECLARE_WRITE32_MEMBER( reg_w );
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
screen_device *m_screen;
tilemap_t *m_layer[2];
UINT32 * m_tile_ram;
UINT32 * m_char_ram;
UINT32 * m_reg;
TILE_GET_INFO_MEMBER(tile_info_layer0);
TILE_GET_INFO_MEMBER(tile_info_layer1);
void update_palette_color( UINT32 palette_base, int color );
};
extern const device_type K037122;
#define MCFG_K037122_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K037122, 0) \
MCFG_DEVICE_CONFIG(_interface)
#endif

317
src/mame/video/k051316.c Normal file
View File

@ -0,0 +1,317 @@
/*
Konami 051316
------
Manages a 32x32 tilemap (16x16 tiles, 512x512 pixels) which can be zoomed,
distorted and rotated.
It uses two internal 24 bit counters which are incremented while scanning the
picture. The coordinates of the pixel in the tilemap that has to be drawn to
the current beam position are the counters / (2^11).
The chip doesn't directly generate the color information for the pixel, it
just generates a 24 bit address (whose top 16 bits are the contents of the
tilemap RAM), and a "visible" signal. It's up to external circuitry to convert
the address into a pixel color. Most games seem to use 4bpp graphics, but Ajax
uses 7bpp.
If the value in the internal counters is out of the visible range (0..511), it
is truncated and the corresponding address is still generated, but the "visible"
signal is not asserted. The external circuitry might ignore that signal and
still generate the pixel, therefore making the tilemap a continuous playfield
that wraps around instead of a large sprite.
control registers
000-001 X counter starting value / 256
002-003 amount to add to the X counter after each horizontal pixel
004-005 amount to add to the X counter after each line (0 = no rotation)
006-007 Y counter starting value / 256
008-009 amount to add to the Y counter after each horizontal pixel (0 = no rotation)
00a-00b amount to add to the Y counter after each line
00c-00d ROM bank to read, used during ROM testing
00e bit 0 = enable ROM reading (active low). This only makes the chip output the
requested address: the ROM is actually read externally, not through
the chip's data bus.
bit 1 = unknown
bit 2 = unknown
00f unused
*/
#include "emu.h"
#include "k051316.h"
#include "konami_helper.h"
#define VERBOSE 0
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
#define XOR(a) WORD_XOR_BE(a)
const device_type K051316 = &device_creator<k051316_device>;
k051316_device::k051316_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, K051316, "Konami 051316", tag, owner, clock, "k051316", __FILE__),
m_ram(NULL)
//m_tmap,
//m_ctrlram[16]
{
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void k051316_device::device_config_complete()
{
// inherit a copy of the static data
const k051316_interface *intf = reinterpret_cast<const k051316_interface *>(static_config());
if (intf != NULL)
*static_cast<k051316_interface *>(this) = *intf;
// or initialize to defaults if none provided
else
{
m_gfx_memory_region_tag = "";
m_gfx_num = 0;
m_bpp = 0;
m_pen_is_mask = 0;
m_transparent_pen = 0;
m_wrap = 0;
m_xoffs = 0;
m_yoffs = 0;
m_callback = NULL;
}
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void k051316_device::device_start()
{
int is_tail2nos = 0;
UINT32 total;
static const gfx_layout charlayout4 =
{
16,16,
0,
4,
{ 0, 1, 2, 3 },
{ 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,
8*4, 9*4, 10*4, 11*4, 12*4, 13*4, 14*4, 15*4 },
{ 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64,
8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
128*8
};
static const gfx_layout charlayout7 =
{
16,16,
0,
7,
{ 1,2,3,4,5,6,7 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
{ 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128,
8*128, 9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128 },
256*8
};
static const gfx_layout charlayout8 =
{
16,16,
0,
8,
{ 0,1,2,3,4,5,6,7 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
{ 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128,
8*128, 9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128 },
256*8
};
static const gfx_layout charlayout_tail2nos =
{
16,16,
0,
4,
{ 0, 1, 2, 3 },
{ XOR(0)*4, XOR(1)*4, XOR(2)*4, XOR(3)*4, XOR(4)*4, XOR(5)*4, XOR(6)*4, XOR(7)*4,
XOR(8)*4, XOR(9)*4, XOR(10)*4, XOR(11)*4, XOR(12)*4, XOR(13)*4, XOR(14)*4, XOR(15)*4 },
{ 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64,
8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
128*8
};
/* decode the graphics */
switch (m_bpp)
{
case -4:
total = 0x400;
is_tail2nos = 1;
konami_decode_gfx(machine(), m_gfx_num, machine().root_device().memregion(m_gfx_memory_region_tag)->base(), total, &charlayout_tail2nos, 4);
break;
case 4:
total = machine().root_device().memregion(m_gfx_memory_region_tag)->bytes() / 128;
konami_decode_gfx(machine(), m_gfx_num, machine().root_device().memregion(m_gfx_memory_region_tag)->base(), total, &charlayout4, 4);
break;
case 7:
total = machine().root_device().memregion(m_gfx_memory_region_tag)->bytes() / 256;
konami_decode_gfx(machine(), m_gfx_num, machine().root_device().memregion(m_gfx_memory_region_tag)->base(), total, &charlayout7, 7);
break;
case 8:
total = machine().root_device().memregion(m_gfx_memory_region_tag)->bytes() / 256;
konami_decode_gfx(machine(), m_gfx_num, machine().root_device().memregion(m_gfx_memory_region_tag)->base(), total, &charlayout8, 8);
break;
default:
fatalerror("Unsupported bpp\n");
}
m_bpp = is_tail2nos ? 4 : m_bpp; // tail2nos is passed with bpp = -4 to setup the custom charlayout!
m_tmap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k051316_device::get_tile_info0),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_ram = auto_alloc_array_clear(machine(), UINT8, 0x800);
if (!m_pen_is_mask)
m_tmap->set_transparent_pen(m_transparent_pen);
else
{
m_tmap->map_pens_to_layer(0, 0, 0, TILEMAP_PIXEL_LAYER1);
m_tmap->map_pens_to_layer(0, m_transparent_pen, m_transparent_pen, TILEMAP_PIXEL_LAYER0);
}
save_pointer(NAME(m_ram), 0x800);
save_item(NAME(m_ctrlram));
save_item(NAME(m_wrap));
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void k051316_device::device_reset()
{
memset(m_ctrlram, 0, 0x10);
}
/*****************************************************************************
DEVICE HANDLERS
*****************************************************************************/
READ8_MEMBER( k051316_device::read )
{
return m_ram[offset];
}
WRITE8_MEMBER( k051316_device::write )
{
m_ram[offset] = data;
m_tmap->mark_tile_dirty(offset & 0x3ff);
}
READ8_MEMBER( k051316_device::rom_r )
{
if ((m_ctrlram[0x0e] & 0x01) == 0)
{
int addr = offset + (m_ctrlram[0x0c] << 11) + (m_ctrlram[0x0d] << 19);
if (m_bpp <= 4)
addr /= 2;
addr &= space.machine().root_device().memregion(m_gfx_memory_region_tag)->bytes() - 1;
// popmessage("%s: offset %04x addr %04x", space.machine().describe_context(), offset, addr);
return space.machine().root_device().memregion(m_gfx_memory_region_tag)->base()[addr];
}
else
{
//logerror("%s: read 051316 ROM offset %04x but reg 0x0c bit 0 not clear\n", space.machine().describe_context(), offset);
return 0;
}
}
WRITE8_MEMBER( k051316_device::ctrl_w )
{
m_ctrlram[offset] = data;
//if (offset >= 0x0c) logerror("%s: write %02x to 051316 reg %x\n", space.machine().describe_context(), data, offset);
}
// a few games (ajax, rollerg, ultraman, etc.) can enable and disable wraparound after start
void k051316_device::wraparound_enable( int status )
{
m_wrap = status;
}
/***************************************************************************
Callbacks for the TileMap code
***************************************************************************/
void k051316_device::get_tile_info( tile_data &tileinfo, int tile_index )
{
int code = m_ram[tile_index];
int color = m_ram[tile_index + 0x400];
int flags = 0;
m_callback(machine(), &code, &color, &flags);
SET_TILE_INFO_MEMBER(
m_gfx_num,
code,
color,
flags);
}
TILE_GET_INFO_MEMBER(k051316_device::get_tile_info0) { get_tile_info(tileinfo, tile_index); }
void k051316_device::zoom_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, int flags, UINT32 priority )
{
UINT32 startx, starty;
int incxx, incxy, incyx, incyy;
startx = 256 * ((INT16)(256 * m_ctrlram[0x00] + m_ctrlram[0x01]));
incxx = (INT16)(256 * m_ctrlram[0x02] + m_ctrlram[0x03]);
incyx = (INT16)(256 * m_ctrlram[0x04] + m_ctrlram[0x05]);
starty = 256 * ((INT16)(256 * m_ctrlram[0x06] + m_ctrlram[0x07]));
incxy = (INT16)(256 * m_ctrlram[0x08] + m_ctrlram[0x09]);
incyy = (INT16)(256 * m_ctrlram[0x0a] + m_ctrlram[0x0b]);
startx -= (16 + m_yoffs) * incyx;
starty -= (16 + m_yoffs) * incyy;
startx -= (89 + m_xoffs) * incxx;
starty -= (89 + m_xoffs) * incxy;
m_tmap->draw_roz(bitmap, cliprect, startx << 5,starty << 5,
incxx << 5,incxy << 5,incyx << 5,incyy << 5,
m_wrap,
flags,priority);
#if 0
popmessage("%02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x",
m_ctrlram[0x00],
m_ctrlram[0x01],
m_ctrlram[0x02],
m_ctrlram[0x03],
m_ctrlram[0x04],
m_ctrlram[0x05],
m_ctrlram[0x06],
m_ctrlram[0x07],
m_ctrlram[0x08],
m_ctrlram[0x09],
m_ctrlram[0x0a],
m_ctrlram[0x0b],
m_ctrlram[0x0c], /* bank for ROM testing */
m_ctrlram[0x0d],
m_ctrlram[0x0e], /* 0 = test ROMs */
m_ctrlram[0x0f]);
#endif
}

63
src/mame/video/k051316.h Normal file
View File

@ -0,0 +1,63 @@
#pragma once
#ifndef __K051316_H__
#define __K051316_H__
typedef void (*k051316_callback)(running_machine &machine, int *code, int *color, int *flags);
struct k051316_interface
{
const char *m_gfx_memory_region_tag;
int m_gfx_num;
int m_bpp, m_pen_is_mask, m_transparent_pen;
int m_wrap, m_xoffs, m_yoffs;
k051316_callback m_callback;
};
class k051316_device : public device_t,
public k051316_interface
{
public:
k051316_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k051316_device() {}
/*
The callback is passed:
- code (range 00-FF, contents of the first tilemap RAM byte)
- color (range 00-FF, contents of the first tilemap RAM byte). Note that bit 6
seems to be hardcoded as flip X.
The callback must put:
- in code the resulting tile number
- in color the resulting color index
- if necessary, put flags for the TileMap code in the tile_info
structure (e.g. TILE_FLIPX)
*/
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
DECLARE_READ8_MEMBER( rom_r );
DECLARE_WRITE8_MEMBER( ctrl_w );
void zoom_draw(bitmap_ind16 &bitmap,const rectangle &cliprect,int flags,UINT32 priority);
void wraparound_enable(int status);
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
UINT8 *m_ram;
tilemap_t *m_tmap;
UINT8 m_ctrlram[16];
TILE_GET_INFO_MEMBER(get_tile_info0);
void get_tile_info( tile_data &tileinfo, int tile_index );
};
extern const device_type K051316;
#define MCFG_K051316_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K051316, 0) \
MCFG_DEVICE_CONFIG(_interface)
#endif

205
src/mame/video/k051733.c Normal file
View File

@ -0,0 +1,205 @@
/*
Konami 051733
------
Sort of a protection device, used for collision detection, and for
arithmetical operations.
It is passed a few parameters, and returns the result.
Memory map(preliminary):
------------------------
00-01 W operand 1
02-03 W operand 2
04-05 W operand 3
00-01 R operand 1 / operand 2
02-03 R operand 1 % operand 2?
04-05 R sqrt(operand 3<<16)
06 R unknown - return value written to 13?
06-07 W distance for collision check
08-09 W Y pos of obj1
0a-0b W X pos of obj1
0c-0d W Y pos of obj2
0e-0f W X pos of obj2
13 W unknown
07 R collision (0x80 = no, 0x00 = yes)
0a-0b R unknown (chequered flag), might just read back X pos
0e-0f R unknown (chequered flag), might just read back X pos
Other addresses are unknown or unused.
Fast Lane:
----------
$9def:
This routine is called only after a collision.
(R) 0x0006: unknown. Only bits 0-3 are used.
Blades of Steel:
----------------
$ac2f:
(R) 0x2f86: unknown. Only uses bit 0.
$a5de:
writes to 0x2f84-0x2f85, waits a little, and then reads from 0x2f84.
$7af3:
(R) 0x2f86: unknown. Only uses bit 0.
Devastators:
------------
$6ce8:
reads from 0x0006, and only uses bit 1.
*/
#include "emu.h"
#include "k051733.h"
#include "konami_helper.h"
#define VERBOSE 0
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
const device_type K051733 = &device_creator<k051733_device>;
k051733_device::k051733_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, K051733, "Konami 051733", tag, owner, clock, "k051733", __FILE__),
//m_ram[0x20],
m_rng(0)
{
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void k051733_device::device_config_complete()
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void k051733_device::device_start()
{
save_item(NAME(m_ram));
save_item(NAME(m_rng));
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void k051733_device::device_reset()
{
int i;
for (i = 0; i < 0x20; i++)
m_ram[i] = 0;
m_rng = 0;
}
/*****************************************************************************
DEVICE HANDLERS
*****************************************************************************/
WRITE8_MEMBER( k051733_device::write )
{
//logerror("%04x: write %02x to 051733 address %02x\n", space.device().safe_pc(), data, offset);
m_ram[offset] = data;
}
static int k051733_int_sqrt( UINT32 op )
{
UINT32 i = 0x8000;
UINT32 step = 0x4000;
while (step)
{
if (i * i == op)
return i;
else if (i * i > op)
i -= step;
else
i += step;
step >>= 1;
}
return i;
}
READ8_MEMBER( k051733_device::read )
{
int op1 = (m_ram[0x00] << 8) | m_ram[0x01];
int op2 = (m_ram[0x02] << 8) | m_ram[0x03];
int op3 = (m_ram[0x04] << 8) | m_ram[0x05];
int rad = (m_ram[0x06] << 8) | m_ram[0x07];
int yobj1c = (m_ram[0x08] << 8) | m_ram[0x09];
int xobj1c = (m_ram[0x0a] << 8) | m_ram[0x0b];
int yobj2c = (m_ram[0x0c] << 8) | m_ram[0x0d];
int xobj2c = (m_ram[0x0e] << 8) | m_ram[0x0f];
switch (offset)
{
case 0x00:
if (op2)
return (op1 / op2) >> 8;
else
return 0xff;
case 0x01:
if (op2)
return (op1 / op2) & 0xff;
else
return 0xff;
/* this is completely unverified */
case 0x02:
if (op2)
return (op1 % op2) >> 8;
else
return 0xff;
case 0x03:
if (op2)
return (op1 % op2) & 0xff;
else
return 0xff;
case 0x04:
return k051733_int_sqrt(op3 << 16) >> 8;
case 0x05:
return k051733_int_sqrt(op3 << 16) & 0xff;
case 0x06:
m_rng += m_ram[0x13];
return m_rng; //RNG read, used by Chequered Flag for differentiate cars, implementation is a raw guess
case 0x07:{ /* note: Chequered Flag definitely wants all these bits to be enabled */
if (xobj1c + rad < xobj2c)
return 0xff;
if (xobj2c + rad < xobj1c)
return 0xff;
if (yobj1c + rad < yobj2c)
return 0xff;
if (yobj2c + rad < yobj1c)
return 0xff;
return 0;
}
case 0x0e: /* best guess */
return (xobj2c - xobj1c) >> 8;
case 0x0f:
return (xobj2c - xobj1c) & 0xff;
default:
return m_ram[offset];
}
}

30
src/mame/video/k051733.h Normal file
View File

@ -0,0 +1,30 @@
#pragma once
#ifndef __K051733_H__
#define __K051733_H__
class k051733_device : public device_t
{
public:
k051733_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k051733_device() {}
DECLARE_WRITE8_MEMBER( write );
DECLARE_READ8_MEMBER( read );
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
UINT8 m_ram[0x20];
UINT8 m_rng;
};
extern const device_type K051733;
#define MCFG_K051733_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, K051733, 0)
#endif

80
src/mame/video/k051960.h Normal file
View File

@ -0,0 +1,80 @@
#pragma once
#ifndef __K051960_H__
#define __K051960_H__
typedef void (*k051960_callback)(running_machine &machine, int *code, int *color, int *priority, int *shadow);
struct k051960_interface
{
const char *m_gfx_memory_region;
int m_gfx_num;
int m_plane_order;
int m_deinterleave;
k051960_callback m_callback;
};
class k051960_device : public device_t,
public k051960_interface
{
public:
k051960_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k051960_device() {}
/*
The callback is passed:
- code (range 00-1FFF, output of the pins CA5-CA17)
- color (range 00-FF, output of the pins OC0-OC7). Note that most of the
time COL7 seems to be "shadow", but not always (e.g. Aliens).
The callback must put:
- in code the resulting sprite number
- in color the resulting color index
- if necessary, in priority the priority of the sprite wrt tilemaps
- if necessary, alter shadow to indicate whether the sprite has shadows enabled.
shadow is preloaded with color & 0x80 so it doesn't need to be changed unless
the game has special treatment (Aliens)
*/
DECLARE_READ8_MEMBER( k051960_r );
DECLARE_WRITE8_MEMBER( k051960_w );
DECLARE_READ16_MEMBER( k051960_word_r );
DECLARE_WRITE16_MEMBER( k051960_word_w );
DECLARE_READ8_MEMBER( k051937_r );
DECLARE_WRITE8_MEMBER( k051937_w );
DECLARE_READ16_MEMBER( k051937_word_r );
DECLARE_WRITE16_MEMBER( k051937_word_w );
void k051960_sprites_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int min_priority, int max_priority);
int k051960_is_irq_enabled();
int k051960_is_nmi_enabled();
void k051960_set_sprite_offsets(int dx, int dy);
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
UINT8 *m_ram;
gfx_element *m_gfx;
UINT8 m_spriterombank[3];
int m_dx, m_dy;
int m_romoffset;
int m_spriteflip, m_readroms;
int m_irq_enabled, m_nmi_enabled;
int m_k051937_counter;
int k051960_fetchromdata( int byte );
};
extern const device_type K051960;
#define MCFG_K051960_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K051960, 0) \
MCFG_DEVICE_CONFIG(_interface)
#endif

751
src/mame/video/k052109.c Normal file
View File

@ -0,0 +1,751 @@
/*
Konami 052109/051962
-------------
These work in pair.
The 052109 manages 3 64x32 scrolling tilemaps with 8x8 characters, and
optionally generates timing clocks and interrupt signals. It uses 0x4000
bytes of RAM, and a variable amount of ROM. It cannot read the ROMs:
instead, it exports 21 bits (16 from the tilemap RAM + 3 for the character
raster line + 2 additional ones for ROM banking) and these are externally
used to generate the address of the required data on the ROM; the output of
the ROMs is sent to the 051962, along with a color code. In theory you could
have any combination of bits in the tilemap RAM, as long as they add to 16.
In practice, all the games supported so far standardize on the same format
which uses 3 bits for the color code and 13 bits for the character code.
The 051962 multiplexes the data of the three layers and converts it into
palette indexes and transparency bits which will be mixed later in the video
chain.
Priority is handled externally: these chips only generate the tilemaps, they
don't mix them.
Both chips are interfaced with the main CPU. When the RMRD pin is asserted,
the CPU can read the gfx ROM data. This is done by telling the 052109 which
dword to read (this is a combination of some banking registers, and the CPU
address lines), and then reading it from the 051962.
052109 inputs:
- address lines (AB0-AB15, AB13-AB15 seem to have a different function)
- data lines (DB0-DB7)
- misc interface stuff
052109 outputs:
- address lines for the private RAM (RA0-RA12)
- data lines for the private RAM (VD0-VD15)
- NMI, IRQ, FIRQ for the main CPU
- misc interface stuff
- ROM bank selector (CAB1-CAB2)
- character "code" (VC0-VC10)
- character "color" (COL0-COL7); used foc color but also bank switching and tile
flipping. Exact meaning depends on externl connections. All evidence indicates
that COL2 and COL3 select the tile bank, and are replaced with the low 2 bits
from the bank register. The top 2 bits of the register go to CAB1-CAB2.
However, this DOES NOT WORK with Gradius III. "color" seems to pass through
unaltered.
- layer A horizontal scroll (ZA1H-ZA4H)
- layer B horizontal scroll (ZB1H-ZB4H)
- ????? (BEN)
051962 inputs:
- gfx data from the ROMs (VC0-VC31)
- color code (COL0-COL7); only COL4-COL7 seem to really be used for color; COL0
is tile flip X.
- layer A horizontal scroll (ZA1H-ZA4H)
- layer B horizontal scroll (ZB1H-ZB4H)
- let main CPU read the gfx ROMs (RMRD)
- address lines to be used with RMRD (AB0-AB1)
- data lines to be used with RMRD (DB0-DB7)
- ????? (BEN)
- misc interface stuff
051962 outputs:
- FIX layer palette index (DFI0-DFI7)
- FIX layer transparency (NFIC)
- A layer palette index (DSA0-DSAD); DSAA-DSAD seem to be unused
- A layer transparency (NSAC)
- B layer palette index (DSB0-DSBD); DSBA-DSBD seem to be unused
- B layer transparency (NSBC)
- misc interface stuff
052109 memory layout:
0000-07ff: layer FIX tilemap (attributes)
0800-0fff: layer A tilemap (attributes)
1000-1fff: layer B tilemap (attributes)
180c-1833: A y scroll
1a00-1bff: A x scroll
1c00 : ?
1c80 : row/column scroll control
------xx layer A row scroll
00 = disabled
01 = disabled? (gradius3, vendetta)
10 = 32 lines
11 = 256 lines
-----x-- layer A column scroll
0 = disabled
1 = 64 (actually 40) columns
---xx--- layer B row scroll
--x----- layer B column scroll
surpratk sets this register to 70 during the second boss. There is
nothing obviously wrong so it's not clear what should happen.
glfgreat sets it to 30 when showing the leader board
1d00 : bits 0 & 1 might enable NMI and FIRQ, not sure
: bit 2 = IRQ enable
1d80 : ROM bank selector bits 0-3 = bank 0 bits 4-7 = bank 1
1e00 : ROM membank selector for ROM testing
1e80 : bit 0 = flip screen (applies to tilemaps only, not sprites)
: bit 1 = set by crimfght, mainevt, surpratk, xmen, mia, punkshot, thndrx2, spy
: it seems to enable tile flip X, however flip X is handled by the
: 051962 and it is not hardwired to a specific tile attribute.
: Note that xmen, punkshot and thndrx2 set the bit but the current
: drivers don't use flip X and seem to work fine.
: bit 2 = enables tile flip Y when bit 1 of the tile attribute is set
1f00 : ROM bank selector bits 0-3 = bank 2 bits 4-7 = bank 3
2000-27ff: layer FIX tilemap (code)
2800-2fff: layer A tilemap (code)
3000-37ff: layer B tilemap (code)
3800-3807: nothing here, so the chip can share address space with a 051937
380c-3833: B y scroll
3a00-3bff: B x scroll
3c00-3fff: nothing here, so the chip can share address space with a 051960
3d80 : mirror of 1d80, but ONLY during ROM test (surpratk)
3e00 : mirror of 1e00, but ONLY during ROM test (surpratk)
3f00 : mirror of 1f00, but ONLY during ROM test (surpratk)
EXTRA ADDRESSING SPACE USED BY X-MEN:
4000-47ff: layer FIX tilemap (code high bits)
4800-4fff: layer A tilemap (code high bits)
5000-57ff: layer B tilemap (code high bits)
The main CPU doesn't have direct acces to the RAM used by the 052109, it has
to through the chip.
*/
#include "emu.h"
#include "k052109.h"
#include "konami_helper.h"
#define VERBOSE 0
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
#define XOR(a) WORD_XOR_BE(a)
const device_type K052109 = &device_creator<k052109_device>;
k052109_device::k052109_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, K052109, "Konami 052109", tag, owner, clock, "k052109", __FILE__),
m_ram(NULL),
m_videoram_F(NULL),
m_videoram_A(NULL),
m_videoram_B(NULL),
m_videoram2_F(NULL),
m_videoram2_A(NULL),
m_videoram2_B(NULL),
m_colorram_F(NULL),
m_colorram_A(NULL),
m_colorram_B(NULL),
//m_tilemap[3],
m_tileflip_enable(0),
//m_charrombank[4],
//m_charrombank_2[4],
m_has_extra_video_ram(0),
m_rmrd_line(0),
m_irq_enabled(0),
//m_dx[3], m_dy[3],
m_romsubbank(0),
m_scrollctrl(0)
{
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void k052109_device::device_config_complete()
{
// inherit a copy of the static data
const k052109_interface *intf = reinterpret_cast<const k052109_interface *>(static_config());
if (intf != NULL)
*static_cast<k052109_interface *>(this) = *intf;
// or initialize to defaults if none provided
else
{
m_gfx_memory_region = "";
m_gfx_num = 0;
m_plane_order = 0;
m_deinterleave = 0;
m_callback = NULL;
}
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void k052109_device::device_start()
{
UINT32 total;
static const gfx_layout charlayout =
{
8,8,
0,
4,
{ 24, 16, 8, 0 },
{ 0, 1, 2, 3, 4, 5, 6, 7 },
{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
32*8
};
static const gfx_layout charlayout_gradius3 =
{
8,8,
0,
4,
{ 0, 1, 2, 3 },
{ XOR(0)*4, XOR(1)*4, XOR(2)*4, XOR(3)*4, XOR(4)*4, XOR(5)*4, XOR(6)*4, XOR(7)*4 },
{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
32*8
};
/* decode the graphics */
switch (m_plane_order)
{
case NORMAL_PLANE_ORDER:
total = machine().root_device().memregion(m_gfx_memory_region)->bytes() / 32;
konami_decode_gfx(machine(), m_gfx_num, machine().root_device().memregion(m_gfx_memory_region)->base(), total, &charlayout, 4);
break;
case GRADIUS3_PLANE_ORDER:
total = 0x1000;
konami_decode_gfx(machine(), m_gfx_num, machine().root_device().memregion(m_gfx_memory_region)->base(), total, &charlayout_gradius3, 4);
break;
default:
fatalerror("Unsupported plane_order\n");
}
/* deinterleave the graphics, if needed */
konami_deinterleave_gfx(machine(), m_gfx_memory_region, m_deinterleave);
m_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k052109_device::get_tile_info0),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
m_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k052109_device::get_tile_info1),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
m_tilemap[2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k052109_device::get_tile_info2),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
m_ram = auto_alloc_array_clear(machine(), UINT8, 0x6000);
m_colorram_F = &m_ram[0x0000];
m_colorram_A = &m_ram[0x0800];
m_colorram_B = &m_ram[0x1000];
m_videoram_F = &m_ram[0x2000];
m_videoram_A = &m_ram[0x2800];
m_videoram_B = &m_ram[0x3000];
m_videoram2_F = &m_ram[0x4000];
m_videoram2_A = &m_ram[0x4800];
m_videoram2_B = &m_ram[0x5000];
m_tilemap[0]->set_transparent_pen(0);
m_tilemap[1]->set_transparent_pen(0);
m_tilemap[2]->set_transparent_pen(0);
save_pointer(NAME(m_ram), 0x6000);
save_item(NAME(m_rmrd_line));
save_item(NAME(m_romsubbank));
save_item(NAME(m_scrollctrl));
save_item(NAME(m_irq_enabled));
save_item(NAME(m_charrombank));
save_item(NAME(m_charrombank_2));
save_item(NAME(m_dx));
save_item(NAME(m_dy));
save_item(NAME(m_has_extra_video_ram));
machine().save().register_postload(save_prepost_delegate(FUNC(k052109_device::tileflip_reset), this));
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void k052109_device::device_reset()
{
int i;
m_rmrd_line = CLEAR_LINE;
m_irq_enabled = 0;
m_romsubbank = 0;
m_scrollctrl = 0;
m_has_extra_video_ram = 0;
for (i = 0; i < 3; i++)
m_dx[i] = m_dy[i] = 0;
for (i = 0; i < 4; i++)
{
m_charrombank[i] = 0;
m_charrombank_2[i] = 0;
}
}
/*****************************************************************************
DEVICE HANDLERS
*****************************************************************************/
READ8_MEMBER( k052109_device::read )
{
if (m_rmrd_line == CLEAR_LINE)
{
if ((offset & 0x1fff) >= 0x1800)
{
if (offset >= 0x180c && offset < 0x1834)
{ /* A y scroll */ }
else if (offset >= 0x1a00 && offset < 0x1c00)
{ /* A x scroll */ }
else if (offset == 0x1d00)
{ /* read for bitwise operations before writing */ }
else if (offset >= 0x380c && offset < 0x3834)
{ /* B y scroll */ }
else if (offset >= 0x3a00 && offset < 0x3c00)
{ /* B x scroll */ }
// else
//logerror("%04x: read from unknown 052109 address %04x\n",space.device().safe_pc(),offset);
}
return m_ram[offset];
}
else /* Punk Shot and TMNT read from 0000-1fff, Aliens from 2000-3fff */
{
int code = (offset & 0x1fff) >> 5;
int color = m_romsubbank;
int flags = 0;
int priority = 0;
int bank = m_charrombank[(color & 0x0c) >> 2] >> 2; /* discard low bits (TMNT) */
int addr;
bank |= (m_charrombank_2[(color & 0x0c) >> 2] >> 2); // Surprise Attack uses this 2nd bank in the rom test
if (m_has_extra_video_ram)
code |= color << 8; /* kludge for X-Men */
else
m_callback(space.machine(), 0, bank, &code, &color, &flags, &priority);
addr = (code << 5) + (offset & 0x1f);
addr &= space.machine().root_device().memregion(m_gfx_memory_region)->bytes() - 1;
// logerror("%04x: off = %04x sub = %02x (bnk = %x) adr = %06x\n", space.device().safe_pc(), offset, m_romsubbank, bank, addr);
return space.machine().root_device().memregion(m_gfx_memory_region)->base()[addr];
}
}
WRITE8_MEMBER( k052109_device::write )
{
if ((offset & 0x1fff) < 0x1800) /* tilemap RAM */
{
if (offset >= 0x4000)
m_has_extra_video_ram = 1; /* kludge for X-Men */
m_ram[offset] = data;
m_tilemap[(offset & 0x1800) >> 11]->mark_tile_dirty(offset & 0x7ff);
}
else /* control registers */
{
m_ram[offset] = data;
if (offset >= 0x180c && offset < 0x1834)
{ /* A y scroll */ }
else if (offset >= 0x1a00 && offset < 0x1c00)
{ /* A x scroll */ }
else if (offset == 0x1c80)
{
if (m_scrollctrl != data)
{
//popmessage("scrollcontrol = %02x", data);
//logerror("%04x: rowscrollcontrol = %02x\n", space.device().safe_pc(), data);
m_scrollctrl = data;
}
}
else if (offset == 0x1d00)
{
//logerror("%04x: 052109 register 1d00 = %02x\n", space.device().safe_pc(), data);
/* bit 2 = irq enable */
/* the custom chip can also generate NMI and FIRQ, for use with a 6809 */
m_irq_enabled = data & 0x04;
}
else if (offset == 0x1d80)
{
int dirty = 0;
if (m_charrombank[0] != (data & 0x0f))
dirty |= 1;
if (m_charrombank[1] != ((data >> 4) & 0x0f))
dirty |= 2;
if (dirty)
{
int i;
m_charrombank[0] = data & 0x0f;
m_charrombank[1] = (data >> 4) & 0x0f;
for (i = 0; i < 0x1800; i++)
{
int bank = (m_ram[i]&0x0c) >> 2;
if ((bank == 0 && (dirty & 1)) || (bank == 1 && (dirty & 2)))
{
m_tilemap[(i & 0x1800) >> 11]->mark_tile_dirty(i & 0x7ff);
}
}
}
}
else if (offset == 0x1e00 || offset == 0x3e00) // Surprise Attack uses offset 0x3e00
{
//logerror("%04x: 052109 register 1e00 = %02x\n",space.device().safe_pc(),data);
m_romsubbank = data;
}
else if (offset == 0x1e80)
{
//if ((data & 0xfe)) logerror("%04x: 052109 register 1e80 = %02x\n",space.device().safe_pc(),data);
m_tilemap[0]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
m_tilemap[1]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
m_tilemap[2]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
if (m_tileflip_enable != ((data & 0x06) >> 1))
{
m_tileflip_enable = ((data & 0x06) >> 1);
m_tilemap[0]->mark_all_dirty();
m_tilemap[1]->mark_all_dirty();
m_tilemap[2]->mark_all_dirty();
}
}
else if (offset == 0x1f00)
{
int dirty = 0;
if (m_charrombank[2] != (data & 0x0f))
dirty |= 1;
if (m_charrombank[3] != ((data >> 4) & 0x0f))
dirty |= 2;
if (dirty)
{
int i;
m_charrombank[2] = data & 0x0f;
m_charrombank[3] = (data >> 4) & 0x0f;
for (i = 0; i < 0x1800; i++)
{
int bank = (m_ram[i] & 0x0c) >> 2;
if ((bank == 2 && (dirty & 1)) || (bank == 3 && (dirty & 2)))
m_tilemap[(i & 0x1800) >> 11]->mark_tile_dirty(i & 0x7ff);
}
}
}
else if (offset >= 0x380c && offset < 0x3834)
{ /* B y scroll */ }
else if (offset >= 0x3a00 && offset < 0x3c00)
{ /* B x scroll */ }
else if (offset == 0x3d80) // Surprise Attack uses offset 0x3d80 in rom test
{
// mirroring this write, breaks Surprise Attack in game tilemaps
m_charrombank_2[0] = data & 0x0f;
m_charrombank_2[1] = (data >> 4) & 0x0f;
}
else if (offset == 0x3f00) // Surprise Attack uses offset 0x3f00 in rom test
{
// mirroring this write, breaks Surprise Attack in game tilemaps
m_charrombank_2[2] = data & 0x0f;
m_charrombank_2[3] = (data >> 4) & 0x0f;
}
// else
// logerror("%04x: write %02x to unknown 052109 address %04x\n",space.device().safe_pc(),data,offset);
}
}
READ16_MEMBER( k052109_device::word_r )
{
return read(space, offset + 0x2000) | (read(space, offset) << 8);
}
WRITE16_MEMBER( k052109_device::word_w )
{
if (ACCESSING_BITS_8_15)
write(space, offset, (data >> 8) & 0xff);
if (ACCESSING_BITS_0_7)
write(space, offset + 0x2000, data & 0xff);
}
READ16_MEMBER( k052109_device::lsb_r )
{
return read(space, offset);
}
WRITE16_MEMBER( k052109_device::lsb_w )
{
if(ACCESSING_BITS_0_7)
write(space, offset, data & 0xff);
}
void k052109_device::set_rmrd_line( int state )
{
m_rmrd_line = state;
}
int k052109_device::get_rmrd_line( )
{
return m_rmrd_line;
}
void k052109_device::tilemap_mark_dirty( int tmap_num )
{
m_tilemap[tmap_num]->mark_all_dirty();
}
void k052109_device::tilemap_update( )
{
int xscroll, yscroll, offs;
#if 0
{
popmessage("%x %x %x %x",
m_charrombank[0],
m_charrombank[1],
m_charrombank[2],
m_charrombank[3]);
}
#endif
if ((m_scrollctrl & 0x03) == 0x02)
{
UINT8 *scrollram = &m_ram[0x1a00];
m_tilemap[1]->set_scroll_rows(256);
m_tilemap[1]->set_scroll_cols(1);
yscroll = m_ram[0x180c];
m_tilemap[1]->set_scrolly(0, yscroll + m_dy[1]);
for (offs = 0; offs < 256; offs++)
{
xscroll = scrollram[2 * (offs & 0xfff8) + 0] + 256 * scrollram[2 * (offs & 0xfff8) + 1];
xscroll -= 6;
m_tilemap[1]->set_scrollx((offs + yscroll) & 0xff, xscroll + m_dx[1]);
}
}
else if ((m_scrollctrl & 0x03) == 0x03)
{
UINT8 *scrollram = &m_ram[0x1a00];
m_tilemap[1]->set_scroll_rows(256);
m_tilemap[1]->set_scroll_cols(1);
yscroll = m_ram[0x180c];
m_tilemap[1]->set_scrolly(0, yscroll + m_dy[1]);
for (offs = 0; offs < 256; offs++)
{
xscroll = scrollram[2 * offs + 0] + 256 * scrollram[2 * offs + 1];
xscroll -= 6;
m_tilemap[1]->set_scrollx((offs + yscroll) & 0xff, xscroll + m_dx[1]);
}
}
else if ((m_scrollctrl & 0x04) == 0x04)
{
UINT8 *scrollram = &m_ram[0x1800];
m_tilemap[1]->set_scroll_rows(1);
m_tilemap[1]->set_scroll_cols(512);
xscroll = m_ram[0x1a00] + 256 * m_ram[0x1a01];
xscroll -= 6;
m_tilemap[1]->set_scrollx(0, xscroll + m_dx[1]);
for (offs = 0; offs < 512; offs++)
{
yscroll = scrollram[offs / 8];
m_tilemap[1]->set_scrolly((offs + xscroll) & 0x1ff, yscroll + m_dy[1]);
}
}
else
{
UINT8 *scrollram = &m_ram[0x1a00];
m_tilemap[1]->set_scroll_rows(1);
m_tilemap[1]->set_scroll_cols(1);
xscroll = scrollram[0] + 256 * scrollram[1];
xscroll -= 6;
yscroll = m_ram[0x180c];
m_tilemap[1]->set_scrollx(0, xscroll + m_dx[1]);
m_tilemap[1]->set_scrolly(0, yscroll + m_dy[1]);
}
if ((m_scrollctrl & 0x18) == 0x10)
{
UINT8 *scrollram = &m_ram[0x3a00];
m_tilemap[2]->set_scroll_rows(256);
m_tilemap[2]->set_scroll_cols(1);
yscroll = m_ram[0x380c];
m_tilemap[2]->set_scrolly(0, yscroll + m_dy[2]);
for (offs = 0; offs < 256; offs++)
{
xscroll = scrollram[2 * (offs & 0xfff8) + 0] + 256 * scrollram[2 * (offs & 0xfff8) + 1];
xscroll -= 6;
m_tilemap[2]->set_scrollx((offs + yscroll) & 0xff, xscroll + m_dx[2]);
}
}
else if ((m_scrollctrl & 0x18) == 0x18)
{
UINT8 *scrollram = &m_ram[0x3a00];
m_tilemap[2]->set_scroll_rows(256);
m_tilemap[2]->set_scroll_cols(1);
yscroll = m_ram[0x380c];
m_tilemap[2]->set_scrolly(0, yscroll + m_dy[2]);
for (offs = 0; offs < 256; offs++)
{
xscroll = scrollram[2 * offs + 0] + 256 * scrollram[2 * offs + 1];
xscroll -= 6;
m_tilemap[2]->set_scrollx((offs + yscroll) & 0xff, xscroll + m_dx[2]);
}
}
else if ((m_scrollctrl & 0x20) == 0x20)
{
UINT8 *scrollram = &m_ram[0x3800];
m_tilemap[2]->set_scroll_rows(1);
m_tilemap[2]->set_scroll_cols(512);
xscroll = m_ram[0x3a00] + 256 * m_ram[0x3a01];
xscroll -= 6;
m_tilemap[2]->set_scrollx(0, xscroll + m_dx[2]);
for (offs = 0; offs < 512; offs++)
{
yscroll = scrollram[offs / 8];
m_tilemap[2]->set_scrolly((offs + xscroll) & 0x1ff, yscroll + m_dy[2]);
}
}
else
{
UINT8 *scrollram = &m_ram[0x3a00];
m_tilemap[2]->set_scroll_rows(1);
m_tilemap[2]->set_scroll_cols(1);
xscroll = scrollram[0] + 256 * scrollram[1];
xscroll -= 6;
yscroll = m_ram[0x380c];
m_tilemap[2]->set_scrollx(0, xscroll + m_dx[2]);
m_tilemap[2]->set_scrolly(0, yscroll + m_dy[2]);
}
#if 0
if ((m_scrollctrl & 0x03) == 0x01 ||
(m_scrollctrl & 0x18) == 0x08 ||
((m_scrollctrl & 0x04) && (m_scrollctrl & 0x03)) ||
((m_scrollctrl & 0x20) && (m_scrollctrl & 0x18)) ||
(m_scrollctrl & 0xc0) != 0)
popmessage("scrollcontrol = %02x", m_scrollctrl);
if (machine().input().code_pressed(KEYCODE_F))
{
FILE *fp;
fp=fopen("TILE.DMP", "w+b");
if (fp)
{
fwrite(m_ram, 0x6000, 1, fp);
popmessage("saved");
fclose(fp);
}
}
#endif
}
void k052109_device::tilemap_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, int tmap_num, UINT32 flags, UINT8 priority )
{
m_tilemap[tmap_num]->draw(bitmap, cliprect, flags, priority);
}
int k052109_device::is_irq_enabled( )
{
return m_irq_enabled;
}
void k052109_device::set_layer_offsets( int layer, int dx, int dy )
{
m_dx[layer] = dx;
m_dy[layer] = dy;
}
/***************************************************************************
Callbacks for the TileMap code
***************************************************************************/
/*
data format:
video RAM xxxxxxxx tile number (low 8 bits)
color RAM xxxx---- depends on external connections (usually color and banking)
color RAM ----xx-- bank select (0-3): these bits are replaced with the 2
bottom bits of the bank register before being placed on
the output pins. The other two bits of the bank register are
placed on the CAB1 and CAB2 output pins.
color RAM ------xx depends on external connections (usually banking, flip)
*/
void k052109_device::get_tile_info( tile_data &tileinfo, int tile_index, int layer, UINT8 *cram, UINT8 *vram1, UINT8 *vram2 )
{
int flipy = 0;
int code = vram1[tile_index] + 256 * vram2[tile_index];
int color = cram[tile_index];
int flags = 0;
int priority = 0;
int bank = m_charrombank[(color & 0x0c) >> 2];
if (m_has_extra_video_ram)
bank = (color & 0x0c) >> 2; /* kludge for X-Men */
color = (color & 0xf3) | ((bank & 0x03) << 2);
bank >>= 2;
flipy = color & 0x02;
m_callback(machine(), layer, bank, &code, &color, &flags, &priority);
/* if the callback set flip X but it is not enabled, turn it off */
if (!(m_tileflip_enable & 1))
flags &= ~TILE_FLIPX;
/* if flip Y is enabled and the attribute but is set, turn it on */
if (flipy && (m_tileflip_enable & 2))
flags |= TILE_FLIPY;
SET_TILE_INFO_MEMBER(
m_gfx_num,
code,
color,
flags);
tileinfo.category = priority;
}
TILE_GET_INFO_MEMBER(k052109_device::get_tile_info0)
{
get_tile_info(tileinfo, tile_index, 0, m_colorram_F, m_videoram_F, m_videoram2_F);
}
TILE_GET_INFO_MEMBER(k052109_device::get_tile_info1)
{
get_tile_info(tileinfo, tile_index, 1, m_colorram_A, m_videoram_A, m_videoram2_A);
}
TILE_GET_INFO_MEMBER(k052109_device::get_tile_info2)
{
get_tile_info(tileinfo, tile_index, 2, m_colorram_B, m_videoram_B, m_videoram2_B);
}
void k052109_device::tileflip_reset()
{
int data = m_ram[0x1e80];
m_tilemap[0]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
m_tilemap[1]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
m_tilemap[2]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
m_tileflip_enable = ((data & 0x06) >> 1);
}

104
src/mame/video/k052109.h Normal file
View File

@ -0,0 +1,104 @@
#pragma once
#ifndef __K052109_H__
#define __K052109_H__
typedef void (*k052109_callback)(running_machine &machine, int layer, int bank, int *code, int *color, int *flags, int *priority);
struct k052109_interface
{
const char *m_gfx_memory_region;
int m_gfx_num;
int m_plane_order;
int m_deinterleave;
k052109_callback m_callback;
};
class k052109_device : public device_t,
public k052109_interface
{
public:
k052109_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k052109_device() {}
/*
You don't have to decode the graphics: the vh_start() routines will do that
for you, using the plane order passed.
Of course the ROM data must be in the correct order. This is a way to ensure
that the ROM test will pass.
The konami_rom_deinterleave() function in konami_helper.h will do the reorganization for
you in most cases (but see tmnt.c for additional bit rotations or byte
permutations which may be required).
The callback is passed:
- layer number (0 = FIX, 1 = A, 2 = B)
- bank (range 0-3, output of the pins CAB1 and CAB2)
- code (range 00-FF, output of the pins VC3-VC10)
NOTE: code is in the range 0000-FFFF for X-Men, which uses extra RAM
- color (range 00-FF, output of the pins COL0-COL7)
The callback must put:
- in code the resulting tile number
- in color the resulting color index
- if necessary, put flags and/or priority for the TileMap code in the tile_info
structure (e.g. TILE_FLIPX). Note that TILE_FLIPY is handled internally by the
chip so it must not be set by the callback.
*/
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
DECLARE_READ16_MEMBER( word_r );
DECLARE_WRITE16_MEMBER( word_w );
DECLARE_READ16_MEMBER( lsb_r );
DECLARE_WRITE16_MEMBER( lsb_w );
void set_rmrd_line(int state);
int get_rmrd_line();
void tilemap_update();
int is_irq_enabled();
void set_layer_offsets(int layer, int dx, int dy);
void tilemap_mark_dirty(int tmap_num);
void tilemap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int tmap_num, UINT32 flags, UINT8 priority);
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
UINT8 *m_ram;
UINT8 *m_videoram_F;
UINT8 *m_videoram_A;
UINT8 *m_videoram_B;
UINT8 *m_videoram2_F;
UINT8 *m_videoram2_A;
UINT8 *m_videoram2_B;
UINT8 *m_colorram_F;
UINT8 *m_colorram_A;
UINT8 *m_colorram_B;
tilemap_t *m_tilemap[3];
int m_tileflip_enable;
UINT8 m_charrombank[4];
UINT8 m_charrombank_2[4];
UINT8 m_has_extra_video_ram;
INT32 m_rmrd_line;
UINT8 m_irq_enabled;
INT32 m_dx[3], m_dy[3];
UINT8 m_romsubbank, m_scrollctrl;
TILE_GET_INFO_MEMBER(get_tile_info0);
TILE_GET_INFO_MEMBER(get_tile_info1);
TILE_GET_INFO_MEMBER(get_tile_info2);
void get_tile_info( tile_data &tileinfo, int tile_index, int layer, UINT8 *cram, UINT8 *vram1, UINT8 *vram2 );
void tileflip_reset();
};
extern const device_type K052109;
#define MCFG_K052109_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K052109, 0) \
MCFG_DEVICE_CONFIG(_interface)
#endif

View File

@ -218,7 +218,25 @@ int K053246_read_register(int regnum);
#define MCFG_K053244_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K053244, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_K053245_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K053245, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_K053246_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K053246, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_K053247_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K053247, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_K055673_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K055673, 0) \
MCFG_DEVICE_CONFIG(_interface)
#endif

277
src/mame/video/k053251.c Normal file
View File

@ -0,0 +1,277 @@
/*
Konami 053251
------
Priority encoder.
The chip has inputs for 5 layers (CI0-CI4); only 4 are used (CI1-CI4)
CI0-CI2 are 9(=5+4) bits inputs, CI3-CI4 8(=4+4) bits
The input connctions change from game to game. E.g. in Simpsons,
CI0 = grounded (background color)
CI1 = sprites
CI2 = FIX
CI3 = A
CI4 = B
in lgtnfght:
CI0 = grounded
CI1 = sprites
CI2 = FIX
CI3 = B
CI4 = A
there are three 6 bit priority inputs, PR0-PR2
simpsons:
PR0 = 111111
PR1 = xxxxx0 x bits coming from the sprite attributes
PR2 = 111111
lgtnfght:
PR0 = 111111
PR1 = 1xx000 x bits coming from the sprite attributes
PR2 = 111111
also two shadow inputs, SDI0 and SDI1 (from the sprite attributes)
the chip outputs the 11 bit palette index, CO0-CO10, and two shadow bits.
16 internal registers; registers are 6 bits wide (input is D0-D5)
For the most part, their meaning is unknown
All registers are write only.
There must be a way to enable/disable the three external PR inputs.
Some games initialize the priorities of the sprite & background layers,
others don't. It isn't clear whether the data written to those registers is
actually used, since the priority is taken from the external ports.
0 priority of CI0 (higher = lower priority)
punkshot: unused?
lgtnfght: unused?
simpsons: 3f = 111111
xmen: 05 = 000101 default value
xmen: 09 = 001001 used to swap CI0 and CI2
1 priority of CI1 (higher = lower priority)
punkshot: 28 = 101000
lgtnfght: unused?
simpsons: unused?
xmen: 02 = 000010
2 priority of CI2 (higher = lower priority)
punkshot: 24 = 100100
lgtnfght: 24 = 100100
simpsons: 04 = 000100
xmen: 09 = 001001 default value
xmen: 05 = 000101 used to swap CI0 and CI2
3 priority of CI3 (higher = lower priority)
punkshot: 34 = 110100
lgtnfght: 34 = 110100
simpsons: 28 = 101000
xmen: 00 = 000000
4 priority of CI4 (higher = lower priority)
punkshot: 2c = 101100 default value
punkshot: 3c = 111100 used to swap CI3 and CI4
punkshot: 26 = 100110 used to swap CI1 and CI4
lgtnfght: 2c = 101100
simpsons: 18 = 011000
xmen: fe = 111110
5 unknown
punkshot: unused?
lgtnfght: 2a = 101010
simpsons: unused?
xmen: unused?
6 unknown
punkshot: 26 = 100110
lgtnfght: 30 = 110000
simpsons: 17 = 010111
xmen: 03 = 000011 (written after initial tests)
7 unknown
punkshot: unused?
lgtnfght: unused?
simpsons: 27 = 100111
xmen: 07 = 000111 (written after initial tests)
8 unknown
punkshot: unused?
lgtnfght: unused?
simpsons: 37 = 110111
xmen: ff = 111111 (written after initial tests)
9 ----xx CI0 palette index base (CO9-CO10)
--xx-- CI1 palette index base (CO9-CO10)
xx---- CI2 palette index base (CO9-CO10)
10 ---xxx CI3 palette index base (CO8-CO10)
xxx--- CI4 palette index base (CO8-CO10)
11 unknown
punkshot: 00 = 000000
lgtnfght: 00 = 000000
simpsons: 00 = 000000
xmen: 00 = 000000 (written after initial tests)
12 unknown
punkshot: 04 = 000100
lgtnfght: 04 = 000100
simpsons: 05 = 000101
xmen: 05 = 000101
13 unused
14 unused
15 unused
*/
#include "emu.h"
#include "k053251.h"
#include "konami_helper.h"
#define VERBOSE 0
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
const device_type K053251 = &device_creator<k053251_device>;
k053251_device::k053251_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, K053251, "Konami 053251", tag, owner, clock, "k053251", __FILE__),
//m_dirty_tmap[5],
//m_ram[16],
m_tilemaps_set(0)
//m_palette_index[5]
{
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void k053251_device::device_config_complete()
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void k053251_device::device_start()
{
save_item(NAME(m_ram));
save_item(NAME(m_tilemaps_set));
save_item(NAME(m_dirty_tmap));
machine().save().register_postload(save_prepost_delegate(FUNC(k053251_device::reset_indexes), this));
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void k053251_device::device_reset()
{
int i;
m_tilemaps_set = 0;
for (i = 0; i < 0x10; i++)
m_ram[i] = 0;
for (i = 0; i < 5; i++)
m_dirty_tmap[i] = 0;
}
/*****************************************************************************
DEVICE HANDLERS
*****************************************************************************/
WRITE8_MEMBER( k053251_device::write )
{
int i, newind;
data &= 0x3f;
if (m_ram[offset] != data)
{
m_ram[offset] = data;
if (offset == 9)
{
/* palette base index */
for (i = 0; i < 3; i++)
{
newind = 32 * ((data >> 2 * i) & 0x03);
if (m_palette_index[i] != newind)
{
m_palette_index[i] = newind;
m_dirty_tmap[i] = 1;
}
}
if (!m_tilemaps_set)
space.machine().tilemap().mark_all_dirty();
}
else if (offset == 10)
{
/* palette base index */
for (i = 0; i < 2; i++)
{
newind = 16 * ((data >> 3 * i) & 0x07);
if (m_palette_index[3 + i] != newind)
{
m_palette_index[3 + i] = newind;
m_dirty_tmap[3 + i] = 1;
}
}
if (!m_tilemaps_set)
space.machine().tilemap().mark_all_dirty();
}
}
}
WRITE16_MEMBER( k053251_device::lsb_w )
{
if (ACCESSING_BITS_0_7)
write(space, offset, data & 0xff);
}
WRITE16_MEMBER( k053251_device::msb_w )
{
if (ACCESSING_BITS_8_15)
write(space, offset, (data >> 8) & 0xff);
}
int k053251_device::get_priority( int ci )
{
return m_ram[ci];
}
int k053251_device::get_palette_index( int ci )
{
return m_palette_index[ci];
}
int k053251_device::get_tmap_dirty( int tmap_num )
{
assert(tmap_num < 5);
return m_dirty_tmap[tmap_num];
}
void k053251_device::set_tmap_dirty( int tmap_num, int data )
{
assert(tmap_num < 5);
m_dirty_tmap[tmap_num] = data ? 1 : 0;
}
void k053251_device::reset_indexes()
{
m_palette_index[0] = 32 * ((m_ram[9] >> 0) & 0x03);
m_palette_index[1] = 32 * ((m_ram[9] >> 2) & 0x03);
m_palette_index[2] = 32 * ((m_ram[9] >> 4) & 0x03);
m_palette_index[3] = 16 * ((m_ram[10] >> 0) & 0x07);
m_palette_index[4] = 16 * ((m_ram[10] >> 3) & 0x07);
}
// debug handlers
READ16_MEMBER( k053251_device::lsb_r )
{
return(m_ram[offset]);
} // PCU1
READ16_MEMBER( k053251_device::msb_r )
{
return(m_ram[offset] << 8);
} // PCU1

View File

@ -107,5 +107,64 @@ void konami_deinterleave_gfx(running_machine &machine, const char *gfx_memory_re
}
}
/* useful function to sort three tile layers by priority order */
void konami_sortlayers3( int *layer, int *pri )
{
#define SWAP(a,b) \
if (pri[a] < pri[b]) \
{ \
int t; \
t = pri[a]; pri[a] = pri[b]; pri[b] = t; \
t = layer[a]; layer[a] = layer[b]; layer[b] = t; \
}
SWAP(0,1)
SWAP(0,2)
SWAP(1,2)
#undef SWAP
}
/* useful function to sort four tile layers by priority order */
void konami_sortlayers4( int *layer, int *pri )
{
#define SWAP(a,b) \
if (pri[a] <= pri[b]) \
{ \
int t; \
t = pri[a]; pri[a] = pri[b]; pri[b] = t; \
t = layer[a]; layer[a] = layer[b]; layer[b] = t; \
}
SWAP(0, 1)
SWAP(0, 2)
SWAP(0, 3)
SWAP(1, 2)
SWAP(1, 3)
SWAP(2, 3)
#undef SWAP
}
/* useful function to sort five tile layers by priority order */
void konami_sortlayers5( int *layer, int *pri )
{
#define SWAP(a,b) \
if (pri[a] <= pri[b]) \
{ \
int t; \
t = pri[a]; pri[a] = pri[b]; pri[b] = t; \
t = layer[a]; layer[a] = layer[b]; layer[b] = t; \
}
SWAP(0, 1)
SWAP(0, 2)
SWAP(0, 3)
SWAP(0, 4)
SWAP(1, 2)
SWAP(1, 3)
SWAP(1, 4)
SWAP(2, 3)
SWAP(2, 4)
SWAP(3, 4)
#undef SWAP
}

View File

@ -4,6 +4,11 @@
#ifndef __KONAMI_HELPER_H__
#define __KONAMI_HELPER_H__
#define NORMAL_PLANE_ORDER 0x0123
#define REVERSE_PLANE_ORDER 0x3210
#define GRADIUS3_PLANE_ORDER 0x1111
#define TASMAN_PLANE_ORDER 0x1616
enum
{
KONAMI_ROM_DEINTERLEAVE_NONE = 0,
@ -23,4 +28,11 @@ 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);
/* helper function to sort three tile layers by priority order */
void konami_sortlayers3(int *layer, int *pri);
/* helper function to sort four tile layers by priority order */
void konami_sortlayers4(int *layer, int *pri);
/* helper function to sort five tile layers by priority order */
void konami_sortlayers5(int *layer, int *pri);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -16,59 +16,9 @@
TYPE DEFINITIONS
***************************************************************************/
typedef void (*k007342_callback)(running_machine &machine, int tmap, int bank, int *code, int *color, int *flags);
typedef void (*k007420_callback)(running_machine &machine, int *code, int *color);
typedef void (*k052109_callback)(running_machine &machine, int layer, int bank, int *code, int *color, int *flags, int *priority);
typedef void (*k051960_callback)(running_machine &machine, int *code, int *color, int *priority, int *shadow);
typedef void (*k051316_callback)(running_machine &machine, int *code, int *color, int *flags);
struct k007342_interface
{
int m_gfxnum;
k007342_callback m_callback;
};
struct k007420_interface
{
int m_banklimit;
k007420_callback m_callback;
};
struct k052109_interface
{
const char *m_gfx_memory_region;
int m_gfx_num;
int m_plane_order;
int m_deinterleave;
k052109_callback m_callback;
};
struct k051960_interface
{
const char *m_gfx_memory_region;
int m_gfx_num;
int m_plane_order;
int m_deinterleave;
k051960_callback m_callback;
};
struct k051316_interface
{
const char *m_gfx_memory_region_tag;
int m_gfx_num;
int m_bpp, m_pen_is_mask, m_transparent_pen;
int m_wrap, m_xoffs, m_yoffs;
k051316_callback m_callback;
};
struct k001006_interface
{
const char *gfx_region;
const char *m_gfx_region;
};
struct k001005_interface
@ -93,400 +43,34 @@ struct k001604_interface
int roz_mem_offset;
};
struct k037122_interface
{
const char *m_screen_tag;
int m_gfx_index;
};
class k007121_device : public device_t
{
public:
k007121_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k007121_device() {}
DECLARE_READ8_MEMBER( ctrlram_r );
DECLARE_WRITE8_MEMBER( ctrl_w );
/* shall we move source in the interface? */
/* also notice that now we directly pass *gfx[chip] instead of **gfx !! */
void sprites_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, colortable_t *ctable, const UINT8 *source, int base_color, int global_x_offset, int bank_base, UINT32 pri_mask );
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
UINT8 m_ctrlram[8];
int m_flipscreen;
};
extern const device_type K007121;
class k007342_device : public device_t,
public k007342_interface
{
public:
k007342_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k007342_device() {}
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
DECLARE_READ8_MEMBER( scroll_r );
DECLARE_WRITE8_MEMBER( scroll_w );
DECLARE_WRITE8_MEMBER( vreg_w );
void tilemap_update();
void tilemap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int num, int flags, UINT32 priority);
int is_int_enabled();
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
UINT8 *m_ram;
UINT8 *m_scroll_ram;
UINT8 *m_videoram_0;
UINT8 *m_videoram_1;
UINT8 *m_colorram_0;
UINT8 *m_colorram_1;
tilemap_t *m_tilemap[2];
int m_flipscreen, m_int_enabled;
UINT8 m_regs[8];
UINT16 m_scrollx[2];
UINT8 m_scrolly[2];
TILEMAP_MAPPER_MEMBER(scan);
TILE_GET_INFO_MEMBER(get_tile_info0);
TILE_GET_INFO_MEMBER(get_tile_info1);
void get_tile_info( tile_data &tileinfo, int tile_index, int layer, UINT8 *cram, UINT8 *vram );
};
extern const device_type K007342;
class k007420_device : public device_t,
public k007420_interface
{
public:
k007420_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k007420_device() {}
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
void sprites_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx);
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
UINT8 *m_ram;
int m_flipscreen; // current code uses the 7342 flipscreen!!
UINT8 m_regs[8]; // current code uses the 7342 regs!! (only [2])
};
extern const device_type K007420;
class k052109_device : public device_t,
public k052109_interface
{
public:
k052109_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k052109_device() {}
/*
You don't have to decode the graphics: the vh_start() routines will do that
for you, using the plane order passed.
Of course the ROM data must be in the correct order. This is a way to ensure
that the ROM test will pass.
The konami_rom_deinterleave() function above will do the reorganization for
you in most cases (but see tmnt.c for additional bit rotations or byte
permutations which may be required).
*/
#define NORMAL_PLANE_ORDER 0x0123
#define REVERSE_PLANE_ORDER 0x3210
#define GRADIUS3_PLANE_ORDER 0x1111
#define TASMAN_PLANE_ORDER 0x1616
/*
The callback is passed:
- layer number (0 = FIX, 1 = A, 2 = B)
- bank (range 0-3, output of the pins CAB1 and CAB2)
- code (range 00-FF, output of the pins VC3-VC10)
NOTE: code is in the range 0000-FFFF for X-Men, which uses extra RAM
- color (range 00-FF, output of the pins COL0-COL7)
The callback must put:
- in code the resulting tile number
- in color the resulting color index
- if necessary, put flags and/or priority for the TileMap code in the tile_info
structure (e.g. TILE_FLIPX). Note that TILE_FLIPY is handled internally by the
chip so it must not be set by the callback.
*/
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
DECLARE_READ16_MEMBER( word_r );
DECLARE_WRITE16_MEMBER( word_w );
DECLARE_READ16_MEMBER( lsb_r );
DECLARE_WRITE16_MEMBER( lsb_w );
void set_rmrd_line(int state);
int get_rmrd_line();
void tilemap_update();
int is_irq_enabled();
void set_layer_offsets(int layer, int dx, int dy);
void tilemap_mark_dirty(int tmap_num);
void tilemap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int tmap_num, UINT32 flags, UINT8 priority);
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
UINT8 *m_ram;
UINT8 *m_videoram_F;
UINT8 *m_videoram_A;
UINT8 *m_videoram_B;
UINT8 *m_videoram2_F;
UINT8 *m_videoram2_A;
UINT8 *m_videoram2_B;
UINT8 *m_colorram_F;
UINT8 *m_colorram_A;
UINT8 *m_colorram_B;
tilemap_t *m_tilemap[3];
int m_tileflip_enable;
UINT8 m_charrombank[4];
UINT8 m_charrombank_2[4];
UINT8 m_has_extra_video_ram;
INT32 m_rmrd_line;
UINT8 m_irq_enabled;
INT32 m_dx[3], m_dy[3];
UINT8 m_romsubbank, m_scrollctrl;
TILE_GET_INFO_MEMBER(get_tile_info0);
TILE_GET_INFO_MEMBER(get_tile_info1);
TILE_GET_INFO_MEMBER(get_tile_info2);
void get_tile_info( tile_data &tileinfo, int tile_index, int layer, UINT8 *cram, UINT8 *vram1, UINT8 *vram2 );
void tileflip_reset();
};
extern const device_type K052109;
class k051960_device : public device_t,
public k051960_interface
{
public:
k051960_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k051960_device() {}
/*
The callback is passed:
- code (range 00-1FFF, output of the pins CA5-CA17)
- color (range 00-FF, output of the pins OC0-OC7). Note that most of the
time COL7 seems to be "shadow", but not always (e.g. Aliens).
The callback must put:
- in code the resulting sprite number
- in color the resulting color index
- if necessary, in priority the priority of the sprite wrt tilemaps
- if necessary, alter shadow to indicate whether the sprite has shadows enabled.
shadow is preloaded with color & 0x80 so it doesn't need to be changed unless
the game has special treatment (Aliens)
*/
DECLARE_READ8_MEMBER( k051960_r );
DECLARE_WRITE8_MEMBER( k051960_w );
DECLARE_READ16_MEMBER( k051960_word_r );
DECLARE_WRITE16_MEMBER( k051960_word_w );
DECLARE_READ8_MEMBER( k051937_r );
DECLARE_WRITE8_MEMBER( k051937_w );
DECLARE_READ16_MEMBER( k051937_word_r );
DECLARE_WRITE16_MEMBER( k051937_word_w );
void k051960_sprites_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int min_priority, int max_priority);
int k051960_is_irq_enabled();
int k051960_is_nmi_enabled();
void k051960_set_sprite_offsets(int dx, int dy);
#if 0 // to be moved in the specific drivers!
/* special handling for the chips sharing address space */
DECLARE_READ8_HANDLER( k052109_051960_r );
DECLARE_WRITE8_HANDLER( k052109_051960_w );
#endif
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
UINT8 *m_ram;
gfx_element *m_gfx;
UINT8 m_spriterombank[3];
int m_dx, m_dy;
int m_romoffset;
int m_spriteflip, m_readroms;
int m_irq_enabled, m_nmi_enabled;
int m_k051937_counter;
int k051960_fetchromdata( int byte );
};
extern const device_type K051960;
class k051316_device : public device_t,
public k051316_interface
{
public:
k051316_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k051316_device() {}
/*
The callback is passed:
- code (range 00-FF, contents of the first tilemap RAM byte)
- color (range 00-FF, contents of the first tilemap RAM byte). Note that bit 6
seems to be hardcoded as flip X.
The callback must put:
- in code the resulting tile number
- in color the resulting color index
- if necessary, put flags for the TileMap code in the tile_info
structure (e.g. TILE_FLIPX)
*/
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
DECLARE_READ8_MEMBER( rom_r );
DECLARE_WRITE8_MEMBER( ctrl_w );
void zoom_draw(bitmap_ind16 &bitmap,const rectangle &cliprect,int flags,UINT32 priority);
void wraparound_enable(int status);
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
UINT8 *m_ram;
tilemap_t *m_tmap;
UINT8 m_ctrlram[16];
TILE_GET_INFO_MEMBER(get_tile_info0);
void get_tile_info( tile_data &tileinfo, int tile_index );
};
extern const device_type K051316;
enum
{
K053251_CI0 = 0,
K053251_CI1,
K053251_CI2,
K053251_CI3,
K053251_CI4
};
class k053251_device : public device_t
{
public:
k053251_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k053251_device() {}
/*
Note: k053251_w() automatically does a ALL_TILEMAPS->mark_all_dirty()
when some palette index changes. If ALL_TILEMAPS is too expensive, use
k053251_set_tilemaps() to indicate which tilemap is associated with each index.
*/
DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE16_MEMBER( lsb_w );
DECLARE_WRITE16_MEMBER( msb_w );
int get_priority(int ci);
int get_palette_index(int ci);
int get_tmap_dirty(int tmap_num);
void set_tmap_dirty(int tmap_num, int data);
DECLARE_READ16_MEMBER( lsb_r ); // PCU1
DECLARE_READ16_MEMBER( msb_r ); // PCU1
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
int m_dirty_tmap[5];
UINT8 m_ram[16];
int m_tilemaps_set;
int m_palette_index[5];
void reset_indexes();
};
extern const device_type K053251;
class k051733_device : public device_t
{
public:
k051733_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k051733_device() {}
DECLARE_WRITE8_MEMBER( write );
DECLARE_READ8_MEMBER( read );
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
UINT8 m_ram[0x20];
UINT8 m_rng;
};
extern const device_type K051733;
class k001006_device : public device_t
class k001006_device : public device_t,
public k001006_interface
{
public:
k001006_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k001006_device() { global_free(m_token); }
~k001006_device() {}
UINT32 get_palette(int index);
DECLARE_READ32_MEMBER( read );
DECLARE_WRITE32_MEMBER( write );
// access to legacy token
void *token() const { assert(m_token != NULL); return m_token; }
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
void *m_token;
screen_device *m_screen;
UINT16 * m_pal_ram;
UINT16 * m_unknown_ram;
UINT32 m_addr;
int m_device_sel;
UINT32 * m_palette;
};
extern const device_type K001006;
@ -541,148 +125,36 @@ private:
extern const device_type K001604;
class k037122_device : public device_t,
public k037122_interface
{
public:
k037122_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~k037122_device() {}
void tile_draw( bitmap_rgb32 &bitmap, const rectangle &cliprect );
DECLARE_READ32_MEMBER( sram_r );
DECLARE_WRITE32_MEMBER( sram_w );
DECLARE_READ32_MEMBER( char_r );
DECLARE_WRITE32_MEMBER( char_w );
DECLARE_READ32_MEMBER( reg_r );
DECLARE_WRITE32_MEMBER( reg_w );
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
screen_device *m_screen;
tilemap_t *m_layer[2];
UINT32 * m_tile_ram;
UINT32 * m_char_ram;
UINT32 * m_reg;
TILE_GET_INFO_MEMBER(tile_info_layer0);
TILE_GET_INFO_MEMBER(tile_info_layer1);
void update_palette_color( UINT32 palette_base, int color );
};
extern const device_type K037122;
/***************************************************************************
DEVICE CONFIGURATION MACROS
***************************************************************************/
#define MCFG_K007121_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, K007121, 0)
#define MCFG_K007342_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K007342, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_K007420_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K007420, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_K052109_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K052109, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_K051960_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K051960, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_K053244_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K053244, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_K053245_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K053245, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_K053246_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K053246, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_K053247_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K053247, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_K055673_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K055673, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_K051316_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K051316, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_K053251_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, K053251, 0)
#define MCFG_K051733_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, K051733, 0)
#define MCFG_K001006_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K001006, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_K001005_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K001005, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_K001604_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K001604, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_K037122_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K037122, 0) \
MCFG_DEVICE_CONFIG(_interface)
/***************************************************************************
HELPERS FOR DRIVERS
***************************************************************************/
/* helper function to sort three tile layers by priority order */
void konami_sortlayers3(int *layer, int *pri);
/* helper function to sort four tile layers by priority order */
void konami_sortlayers4(int *layer, int *pri);
/* helper function to sort five tile layers by priority order */
void konami_sortlayers5(int *layer, int *pri);
/***************************************************************************
DEVICE I/O FUNCTIONS
***************************************************************************/
/** Konami 001006 **/
UINT32 k001006_get_palette(device_t *device, int index);
DECLARE_READ32_DEVICE_HANDLER( k001006_r );
DECLARE_WRITE32_DEVICE_HANDLER( k001006_w );
/** Konami 001005 **/
void k001005_draw(device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect);
void k001005_swap_buffers(device_t *device);

View File

@ -1,5 +1,5 @@
#include "emu.h"
#include "video/konicdev.h"
#include "includes/labyrunr.h"
void labyrunr_state::palette_init()

View File

@ -7,7 +7,7 @@
***************************************************************************/
#include "emu.h"
#include "video/konicdev.h"
#include "includes/mainevt.h"

View File

@ -1,5 +1,5 @@
#include "emu.h"
#include "video/konicdev.h"
#include "includes/parodius.h"

View File

@ -8,7 +8,7 @@
*/
#include "emu.h"
#include "video/konicdev.h"
#include "includes/plygonet.h"
/* TTL text plane */

Some files were not shown because too many files have changed in this diff Show More