mirror of
https://github.com/holub/mame
synced 2025-04-24 17:30:55 +03:00
Merged video/gticlub functionality to K001005/1006 devices. Converted K001005 to use the new poly manager. [Ville Linde]
This commit is contained in:
parent
7f806850f0
commit
b81c48bc11
@ -230,7 +230,8 @@ Hang Pilot (uses an unknown but similar video board) 12W
|
||||
#include "sound/rf5c400.h"
|
||||
#include "sound/k056800.h"
|
||||
#include "video/voodoo.h"
|
||||
#include "video/gticlub.h"
|
||||
#include "video/k001005.h"
|
||||
#include "video/k001006.h"
|
||||
#include "video/k001604.h"
|
||||
|
||||
|
||||
@ -254,8 +255,11 @@ public:
|
||||
m_analog3(*this, "AN3"),
|
||||
m_eeprom(*this, "eeprom"),
|
||||
m_palette(*this, "palette"),
|
||||
m_k001005(*this, "k001005"),
|
||||
m_k001006_1(*this, "k001006_1"),
|
||||
m_k001006_2(*this, "k001006_2"),
|
||||
m_generic_paletteram_32(*this, "paletteram") { }
|
||||
|
||||
|
||||
// TODO: Needs verification on real hardware
|
||||
static const int m_sound_timer_usec = 2400;
|
||||
|
||||
@ -269,6 +273,9 @@ public:
|
||||
optional_ioport m_analog0, m_analog1, m_analog2, m_analog3;
|
||||
required_device<eeprom_serial_93cxx_device> m_eeprom;
|
||||
required_device<palette_device> m_palette;
|
||||
optional_device<k001005_device> m_k001005;
|
||||
optional_device<k001006_device> m_k001006_1;
|
||||
optional_device<k001006_device> m_k001006_2;
|
||||
required_shared_ptr<UINT32> m_generic_paletteram_32;
|
||||
|
||||
DECLARE_WRITE32_MEMBER(paletteram32_w);
|
||||
@ -485,8 +492,8 @@ static ADDRESS_MAP_START( gticlub_map, AS_PROGRAM, 32, gticlub_state )
|
||||
AM_RANGE(0x74020000, 0x7403ffff) AM_READWRITE(gticlub_k001604_tile_r, gticlub_k001604_tile_w)
|
||||
AM_RANGE(0x74040000, 0x7407ffff) AM_READWRITE(gticlub_k001604_char_r, gticlub_k001604_char_w)
|
||||
AM_RANGE(0x78000000, 0x7800ffff) AM_READWRITE_LEGACY(cgboard_dsp_shared_r_ppc, cgboard_dsp_shared_w_ppc)
|
||||
AM_RANGE(0x78040000, 0x7804000f) AM_READWRITE_LEGACY(K001006_0_r, K001006_0_w)
|
||||
AM_RANGE(0x78080000, 0x7808000f) AM_READWRITE_LEGACY(K001006_1_r, K001006_1_w)
|
||||
AM_RANGE(0x78040000, 0x7804000f) AM_DEVREADWRITE("k001006_1", k001006_device, read, write)
|
||||
AM_RANGE(0x78080000, 0x7808000f) AM_DEVREADWRITE("k001006_2", k001006_device, read, write)
|
||||
AM_RANGE(0x780c0000, 0x780c0003) AM_READWRITE_LEGACY(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc)
|
||||
AM_RANGE(0x7e000000, 0x7e003fff) AM_READWRITE8(sysreg_r, sysreg_w, 0xffffffff)
|
||||
AM_RANGE(0x7e008000, 0x7e009fff) AM_DEVREADWRITE8("k056230", k056230_device, read, write, 0xffffffff)
|
||||
@ -533,7 +540,7 @@ WRITE32_MEMBER(gticlub_state::dsp_dataram1_w)
|
||||
static ADDRESS_MAP_START( sharc_map, AS_DATA, 32, gticlub_state )
|
||||
AM_RANGE(0x400000, 0x41ffff) AM_READWRITE_LEGACY(cgboard_0_shared_sharc_r, cgboard_0_shared_sharc_w)
|
||||
AM_RANGE(0x500000, 0x5fffff) AM_READWRITE(dsp_dataram0_r, dsp_dataram0_w)
|
||||
AM_RANGE(0x600000, 0x6fffff) AM_READWRITE_LEGACY(K001005_r, K001005_w)
|
||||
AM_RANGE(0x600000, 0x6fffff) AM_DEVREADWRITE("k001005", k001005_device, read, write)
|
||||
AM_RANGE(0x700000, 0x7000ff) AM_READWRITE_LEGACY(cgboard_0_comm_sharc_r, cgboard_0_comm_sharc_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -796,9 +803,6 @@ VIDEO_START_MEMBER(gticlub_state,gticlub)
|
||||
debug_tex_page = 0;
|
||||
debug_tex_palette = 0;
|
||||
*/
|
||||
|
||||
K001006_init(machine(),m_palette);
|
||||
K001005_init(machine());
|
||||
}
|
||||
|
||||
UINT32 gticlub_state::screen_update_gticlub(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
@ -807,7 +811,7 @@ UINT32 gticlub_state::screen_update_gticlub(screen_device &screen, bitmap_rgb32
|
||||
|
||||
k001604->draw_back_layer(bitmap, cliprect);
|
||||
|
||||
K001005_draw(bitmap, cliprect);
|
||||
m_k001005->draw(bitmap, cliprect);
|
||||
|
||||
k001604->draw_front_layer(screen, bitmap, cliprect);
|
||||
|
||||
@ -951,6 +955,19 @@ static MACHINE_CONFIG_START( gticlub, gticlub_state )
|
||||
MCFG_K001604_GFXDECODE("gfxdecode")
|
||||
MCFG_K001604_PALETTE("palette")
|
||||
|
||||
MCFG_DEVICE_ADD("k001005", K001005, 0)
|
||||
MCFG_K001005_TEXEL_CHIP("k001006_1")
|
||||
|
||||
MCFG_DEVICE_ADD("k001006_1", K001006, 0)
|
||||
MCFG_K001006_GFX_REGION("gfx1")
|
||||
MCFG_K001006_TEX_LAYOUT(1)
|
||||
|
||||
// The second K001006 chip connects to the second K001005 chip.
|
||||
// Hook this up when the K001005 separation is understood (seems the load balancing is done on hardware).
|
||||
MCFG_DEVICE_ADD("k001006_2", K001006, 0)
|
||||
MCFG_K001006_GFX_REGION("gfx1")
|
||||
MCFG_K001006_TEX_LAYOUT(1)
|
||||
|
||||
MCFG_K056800_ADD("k056800", XTAL_33_8688MHz/2)
|
||||
MCFG_K056800_INT_HANDLER(INPUTLINE("audiocpu", M68K_IRQ_2))
|
||||
|
||||
@ -1376,8 +1393,6 @@ DRIVER_INIT_MEMBER(gticlub_state,gticlub)
|
||||
init_konami_cgboard(machine(), 1, CGBOARD_TYPE_GTICLUB);
|
||||
|
||||
m_sharc_dataram_0 = auto_alloc_array(machine(), UINT32, 0x100000/4);
|
||||
|
||||
K001005_preprocess_texture_data(memregion("gfx1")->base(), memregion("gfx1")->bytes(), 1);
|
||||
}
|
||||
|
||||
void gticlub_state::init_hangplt_common()
|
||||
|
@ -174,7 +174,8 @@ Check gticlub.c for details on the bottom board.
|
||||
#include "sound/k056800.h"
|
||||
#include "sound/k054539.h"
|
||||
#include "video/k001604.h"
|
||||
#include "video/gticlub.h"
|
||||
#include "video/k001005.h"
|
||||
#include "video/k001006.h"
|
||||
#include "video/k054156_k054157_k056832.h"
|
||||
#include "video/konami_helper.h"
|
||||
|
||||
@ -202,8 +203,12 @@ public:
|
||||
m_analog2(*this, "ANALOG2"),
|
||||
m_analog3(*this, "ANALOG3"),
|
||||
m_palette(*this, "palette"),
|
||||
m_k001005(*this, "k001005"),
|
||||
m_k001006_1(*this, "k001006_1"),
|
||||
m_k001006_2(*this, "k001006_2"),
|
||||
m_generic_paletteram_32(*this, "paletteram") { }
|
||||
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
required_device<cpu_device> m_dsp;
|
||||
@ -213,6 +218,9 @@ public:
|
||||
optional_shared_ptr<UINT32> m_workram;
|
||||
required_ioport m_in0, m_in1, m_in2, m_in3, m_in4, m_out4, m_eepromout, m_analog1, m_analog2, m_analog3;
|
||||
required_device<palette_device> m_palette;
|
||||
optional_device<k001005_device> m_k001005;
|
||||
optional_device<k001006_device> m_k001006_1;
|
||||
optional_device<k001006_device> m_k001006_2;
|
||||
required_shared_ptr<UINT32> m_generic_paletteram_32;
|
||||
|
||||
UINT32 *m_sharc_dataram;
|
||||
@ -255,8 +263,6 @@ protected:
|
||||
|
||||
VIDEO_START_MEMBER(zr107_state,jetwave)
|
||||
{
|
||||
K001005_init(machine());
|
||||
K001006_init(machine(),m_palette);
|
||||
}
|
||||
|
||||
|
||||
@ -266,7 +272,7 @@ UINT32 zr107_state::screen_update_jetwave(screen_device &screen, bitmap_rgb32 &b
|
||||
|
||||
m_k001604->draw_back_layer(bitmap, cliprect);
|
||||
|
||||
K001005_draw(bitmap, cliprect);
|
||||
m_k001005->draw(bitmap, cliprect);
|
||||
|
||||
m_k001604->draw_front_layer(screen, bitmap, cliprect);
|
||||
|
||||
@ -305,9 +311,6 @@ VIDEO_START_MEMBER(zr107_state,zr107)
|
||||
m_k056832->set_layer_offs(5, -29, -27);
|
||||
m_k056832->set_layer_offs(6, -29, -27);
|
||||
m_k056832->set_layer_offs(7, -29, -27);
|
||||
|
||||
K001006_init(machine(),m_palette);
|
||||
K001005_init(machine());
|
||||
}
|
||||
|
||||
UINT32 zr107_state::screen_update_zr107(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
@ -315,7 +318,7 @@ UINT32 zr107_state::screen_update_zr107(screen_device &screen, bitmap_rgb32 &bit
|
||||
bitmap.fill(m_palette->pen(0), cliprect);
|
||||
|
||||
m_k056832->tilemap_draw(screen, bitmap, cliprect, 1, 0, 0);
|
||||
K001005_draw(bitmap, cliprect);
|
||||
m_k001005->draw(bitmap, cliprect);
|
||||
m_k056832->tilemap_draw(screen, bitmap, cliprect, 0, 0, 0);
|
||||
|
||||
draw_7segment_led(bitmap, 3, 3, m_led_reg0);
|
||||
@ -466,7 +469,7 @@ static ADDRESS_MAP_START( zr107_map, AS_PROGRAM, 32, zr107_state )
|
||||
AM_RANGE(0x740a0000, 0x740a3fff) AM_DEVREAD("k056832", k056832_device, rom_long_r)
|
||||
AM_RANGE(0x78000000, 0x7800ffff) AM_READWRITE_LEGACY(cgboard_dsp_shared_r_ppc, cgboard_dsp_shared_w_ppc) /* 21N 21K 23N 23K */
|
||||
AM_RANGE(0x78010000, 0x7801ffff) AM_WRITE_LEGACY(cgboard_dsp_shared_w_ppc)
|
||||
AM_RANGE(0x78040000, 0x7804000f) AM_READWRITE_LEGACY(K001006_0_r, K001006_0_w)
|
||||
AM_RANGE(0x78040000, 0x7804000f) AM_DEVREADWRITE("k001006_1", k001006_device, read, write)
|
||||
AM_RANGE(0x780c0000, 0x780c0007) AM_READWRITE_LEGACY(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc)
|
||||
AM_RANGE(0x7e000000, 0x7e003fff) AM_READWRITE8(sysreg_r, sysreg_w, 0xffffffff)
|
||||
AM_RANGE(0x7e008000, 0x7e009fff) AM_DEVREADWRITE8("k056230", k056230_device, read, write, 0xffffffff) /* LANC registers */
|
||||
@ -492,8 +495,8 @@ static ADDRESS_MAP_START( jetwave_map, AS_PROGRAM, 32, zr107_state )
|
||||
AM_RANGE(0x74040000, 0x7407ffff) AM_MIRROR(0x80000000) AM_DEVREADWRITE("k001604", k001604_device, char_r, char_w)
|
||||
AM_RANGE(0x78000000, 0x7800ffff) AM_MIRROR(0x80000000) AM_READWRITE_LEGACY(cgboard_dsp_shared_r_ppc, cgboard_dsp_shared_w_ppc) /* 21N 21K 23N 23K */
|
||||
AM_RANGE(0x78010000, 0x7801ffff) AM_MIRROR(0x80000000) AM_WRITE_LEGACY(cgboard_dsp_shared_w_ppc)
|
||||
AM_RANGE(0x78040000, 0x7804000f) AM_MIRROR(0x80000000) AM_READWRITE_LEGACY(K001006_0_r, K001006_0_w)
|
||||
AM_RANGE(0x78080000, 0x7808000f) AM_MIRROR(0x80000000) AM_READWRITE_LEGACY(K001006_1_r, K001006_1_w)
|
||||
AM_RANGE(0x78040000, 0x7804000f) AM_MIRROR(0x80000000) AM_DEVREADWRITE("k001006_1", k001006_device, read, write)
|
||||
AM_RANGE(0x78080000, 0x7808000f) AM_MIRROR(0x80000000) AM_DEVREADWRITE("k001006_2", k001006_device, read, write)
|
||||
AM_RANGE(0x780c0000, 0x780c0007) AM_MIRROR(0x80000000) AM_READWRITE_LEGACY(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc)
|
||||
AM_RANGE(0x7e000000, 0x7e003fff) AM_MIRROR(0x80000000) AM_READWRITE8(sysreg_r, sysreg_w, 0xffffffff)
|
||||
AM_RANGE(0x7e008000, 0x7e009fff) AM_MIRROR(0x80000000) AM_DEVREADWRITE8("k056230", k056230_device, read, write, 0xffffffff) /* LANC registers */
|
||||
@ -550,7 +553,7 @@ WRITE32_MEMBER(zr107_state::dsp_dataram_w)
|
||||
static ADDRESS_MAP_START( sharc_map, AS_DATA, 32, zr107_state )
|
||||
AM_RANGE(0x400000, 0x41ffff) AM_READWRITE_LEGACY(cgboard_0_shared_sharc_r, cgboard_0_shared_sharc_w)
|
||||
AM_RANGE(0x500000, 0x5fffff) AM_READWRITE(dsp_dataram_r, dsp_dataram_w)
|
||||
AM_RANGE(0x600000, 0x6fffff) AM_READWRITE_LEGACY(K001005_r, K001005_w)
|
||||
AM_RANGE(0x600000, 0x6fffff) AM_DEVREADWRITE("k001005", k001005_device, read, write)
|
||||
AM_RANGE(0x700000, 0x7000ff) AM_READWRITE_LEGACY(cgboard_0_comm_sharc_r, cgboard_0_comm_sharc_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -796,6 +799,13 @@ static MACHINE_CONFIG_START( zr107, zr107_state )
|
||||
MCFG_K056832_GFXDECODE("gfxdecode")
|
||||
MCFG_K056832_PALETTE("palette")
|
||||
|
||||
MCFG_DEVICE_ADD("k001005", K001005, 0)
|
||||
MCFG_K001005_TEXEL_CHIP("k001006_1")
|
||||
|
||||
MCFG_DEVICE_ADD("k001006_1", K001006, 0)
|
||||
MCFG_K001006_GFX_REGION("gfx1")
|
||||
MCFG_K001006_TEX_LAYOUT(0)
|
||||
|
||||
MCFG_K056800_ADD("k056800", XTAL_18_432MHz)
|
||||
MCFG_K056800_INT_HANDLER(INPUTLINE("audiocpu", M68K_IRQ_1))
|
||||
|
||||
@ -859,6 +869,19 @@ static MACHINE_CONFIG_START( jetwave, zr107_state )
|
||||
MCFG_K001604_GFXDECODE("gfxdecode")
|
||||
MCFG_K001604_PALETTE("palette")
|
||||
|
||||
MCFG_DEVICE_ADD("k001005", K001005, 0)
|
||||
MCFG_K001005_TEXEL_CHIP("k001006_1")
|
||||
|
||||
MCFG_DEVICE_ADD("k001006_1", K001006, 0)
|
||||
MCFG_K001006_GFX_REGION("gfx1")
|
||||
MCFG_K001006_TEX_LAYOUT(0)
|
||||
|
||||
// The second K001006 chip connects to the second K001005 chip.
|
||||
// Hook this up when the K001005 separation is understood (seems the load balancing is done on hardware).
|
||||
MCFG_DEVICE_ADD("k001006_2", K001006, 0)
|
||||
MCFG_K001006_GFX_REGION("gfx1")
|
||||
MCFG_K001006_TEX_LAYOUT(0)
|
||||
|
||||
MCFG_K056800_ADD("k056800", XTAL_18_432MHz)
|
||||
MCFG_K056800_INT_HANDLER(INPUTLINE("audiocpu", M68K_IRQ_1))
|
||||
|
||||
@ -885,8 +908,6 @@ DRIVER_INIT_MEMBER(zr107_state,common)
|
||||
m_sharc_dataram = auto_alloc_array(machine(), UINT32, 0x100000/4);
|
||||
m_led_reg0 = m_led_reg1 = 0x7f;
|
||||
m_ccu_vcth = m_ccu_vctl = 0;
|
||||
|
||||
K001005_preprocess_texture_data(memregion("gfx1")->base(), memregion("gfx1")->bytes(), 0);
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(zr107_state,zr107)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,46 +2,115 @@
|
||||
#ifndef __K001005_H__
|
||||
#define __K001005_H__
|
||||
|
||||
#include "video/polylgcy.h"
|
||||
#include <float.h>
|
||||
#include "video/poly.h"
|
||||
#include "video/k001006.h"
|
||||
#include "cpu/sharc/sharc.h"
|
||||
|
||||
#define POLY_DEVICE 0
|
||||
|
||||
struct k001005_interface
|
||||
struct k001005_polydata
|
||||
{
|
||||
const char *m_cpu_tag;
|
||||
const char *m_dsp_tag;
|
||||
const char *m_k001006_1_tag;
|
||||
const char *m_k001006_2_tag;
|
||||
UINT32 color;
|
||||
int texture_x, texture_y;
|
||||
int texture_width, texture_height;
|
||||
int texture_page;
|
||||
int texture_palette;
|
||||
int texture_mirror_x;
|
||||
int texture_mirror_y;
|
||||
int light_r, light_g, light_b;
|
||||
int ambient_r, ambient_g, ambient_b;
|
||||
int fog_r, fog_g, fog_b;
|
||||
UINT32 flags;
|
||||
};
|
||||
|
||||
const char *m_gfx_memory_region_tag;
|
||||
int m_gfx_index;
|
||||
enum k001005_param
|
||||
{
|
||||
K001005_LIGHT_R,
|
||||
K001005_LIGHT_G,
|
||||
K001005_LIGHT_B,
|
||||
K001005_AMBIENT_R,
|
||||
K001005_AMBIENT_G,
|
||||
K001005_AMBIENT_B,
|
||||
K001005_FOG_R,
|
||||
K001005_FOG_G,
|
||||
K001005_FOG_B,
|
||||
K001005_FAR_Z,
|
||||
};
|
||||
|
||||
|
||||
class k001005_renderer : public poly_manager<float, k001005_polydata, 8, 50000>
|
||||
{
|
||||
public:
|
||||
k001005_renderer(device_t &parent, screen_device &screen, device_t *k001006);
|
||||
~k001005_renderer() {}
|
||||
|
||||
void reset();
|
||||
void push_data(UINT32 data);
|
||||
void render_polygons();
|
||||
void swap_buffers();
|
||||
bool fifo_filled();
|
||||
void draw(bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
void set_param(k001005_param param, UINT32 value);
|
||||
|
||||
void draw_scanline_2d(INT32 scanline, const extent_t &extent, const k001005_polydata &extradata, int threadid);
|
||||
void draw_scanline_2d_tex(INT32 scanline, const extent_t &extent, const k001005_polydata &extradata, int threadid);
|
||||
void draw_scanline(INT32 scanline, const extent_t &extent, const k001005_polydata &extradata, int threadid);
|
||||
void draw_scanline_tex(INT32 scanline, const extent_t &extent, const k001005_polydata &extradata, int threadid);
|
||||
void draw_scanline_gouraud_blend(INT32 scanline, const extent_t &extent, const k001005_polydata &extradata, int threadid);
|
||||
|
||||
static const int POLY_Z = 0;
|
||||
static const int POLY_FOG = 1;
|
||||
static const int POLY_BRI = 2;
|
||||
static const int POLY_U = 3;
|
||||
static const int POLY_V = 4;
|
||||
static const int POLY_W = 5;
|
||||
static const int POLY_A = 2;
|
||||
static const int POLY_R = 3;
|
||||
static const int POLY_G = 4;
|
||||
static const int POLY_B = 5;
|
||||
|
||||
private:
|
||||
bitmap_rgb32 *m_fb[2];
|
||||
bitmap_ind32 *m_zb;
|
||||
rectangle m_cliprect;
|
||||
int m_fb_page;
|
||||
|
||||
UINT32 *m_3dfifo;
|
||||
int m_3dfifo_ptr;
|
||||
|
||||
vertex_t m_prev_v[4];
|
||||
|
||||
UINT32 m_light_r;
|
||||
UINT32 m_light_g;
|
||||
UINT32 m_light_b;
|
||||
UINT32 m_ambient_r;
|
||||
UINT32 m_ambient_g;
|
||||
UINT32 m_ambient_b;
|
||||
UINT32 m_fog_r;
|
||||
UINT32 m_fog_g;
|
||||
UINT32 m_fog_b;
|
||||
float m_far_z;
|
||||
|
||||
device_t *m_k001006;
|
||||
|
||||
int *m_tex_mirror_table[2][8];
|
||||
};
|
||||
|
||||
|
||||
class k001005_device : public device_t,
|
||||
public device_video_interface,
|
||||
public k001005_interface
|
||||
public device_video_interface
|
||||
{
|
||||
public:
|
||||
k001005_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
~k001005_device() {}
|
||||
|
||||
static void static_set_palette_tag(device_t &device, const char *tag);
|
||||
static void set_texel_chip(device_t &device, const char *tag);
|
||||
|
||||
void draw(bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
void swap_buffers();
|
||||
void preprocess_texture_data(UINT8 *rom, int length, int gticlub);
|
||||
void render_polygons();
|
||||
|
||||
#if POLY_DEVICE
|
||||
|
||||
void draw_scanline( void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid );
|
||||
void draw_scanline_tex( void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid );
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
DECLARE_READ32_MEMBER( read );
|
||||
DECLARE_WRITE32_MEMBER( write );
|
||||
|
||||
@ -54,35 +123,20 @@ protected:
|
||||
|
||||
private:
|
||||
// internal state
|
||||
device_t *m_cpu;
|
||||
adsp21062_device *m_dsp;
|
||||
device_t *m_k001006_1;
|
||||
device_t *m_k001006_2;
|
||||
device_t *m_k001006;
|
||||
const char *m_k001006_tag;
|
||||
|
||||
UINT8 * m_texture;
|
||||
UINT16 * m_ram[2];
|
||||
UINT32 * m_fifo;
|
||||
UINT32 * m_3d_fifo;
|
||||
UINT32 m_status;
|
||||
|
||||
UINT32 m_status;
|
||||
bitmap_rgb32 *m_bitmap[2];
|
||||
bitmap_ind32 *m_zbuffer;
|
||||
rectangle m_cliprect;
|
||||
int m_ram_ptr;
|
||||
int m_fifo_read_ptr;
|
||||
int m_fifo_write_ptr;
|
||||
int m_3d_fifo_ptr;
|
||||
int m_ram_ptr;
|
||||
int m_fifo_read_ptr;
|
||||
int m_fifo_write_ptr;
|
||||
UINT32 m_reg_far_z;
|
||||
|
||||
|
||||
int m_tex_mirror_table[4][128];
|
||||
|
||||
int m_bitmap_page;
|
||||
|
||||
legacy_poly_manager *m_poly;
|
||||
poly_vertex m_prev_v[4];
|
||||
int m_prev_poly_type;
|
||||
|
||||
UINT8 *m_gfxrom;
|
||||
required_device<palette_device> m_palette;
|
||||
k001005_renderer *m_renderer;
|
||||
};
|
||||
|
||||
extern const device_type K001005;
|
||||
@ -92,7 +146,7 @@ extern const device_type K001005;
|
||||
MCFG_DEVICE_ADD(_tag, K001005, 0) \
|
||||
MCFG_DEVICE_CONFIG(_interface)
|
||||
|
||||
#define MCFG_K001005_PALETTE(_palette_tag) \
|
||||
k001005_device::static_set_palette_tag(*device, "^" _palette_tag);
|
||||
#define MCFG_K001005_TEXEL_CHIP(_tag) \
|
||||
k001005_device::set_texel_chip(*device, _tag);
|
||||
|
||||
#endif
|
||||
|
@ -1,11 +1,8 @@
|
||||
/* This is currently unused, video/gticlub.c has it's own implementation, why? */
|
||||
|
||||
|
||||
#include "emu.h"
|
||||
#include "k001006.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Konami K001006 Custom 3D Texel Renderer chip (KS10081) */
|
||||
/* Konami K001006 Texel Unit (KS10081) */
|
||||
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
@ -16,12 +13,13 @@
|
||||
const device_type K001006 = &device_creator<k001006_device>;
|
||||
|
||||
k001006_device::k001006_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, K001006, "K001006 3D Texel Renderer", tag, owner, clock, "k001006", __FILE__),
|
||||
: device_t(mconfig, K001006, "K001006 Texel Unit", tag, owner, clock, "k001006", __FILE__),
|
||||
m_pal_ram(NULL),
|
||||
m_unknown_ram(NULL),
|
||||
m_addr(0),
|
||||
m_device_sel(0),
|
||||
m_palette(NULL)
|
||||
m_palette(NULL),
|
||||
m_tex_layout(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -33,16 +31,7 @@ k001006_device::k001006_device(const machine_config &mconfig, const char *tag, d
|
||||
|
||||
void k001006_device::device_config_complete()
|
||||
{
|
||||
// inherit a copy of the static data
|
||||
const k001006_interface *intf = reinterpret_cast<const k001006_interface *>(static_config());
|
||||
if (intf != NULL)
|
||||
*static_cast<k001006_interface *>(this) = *intf;
|
||||
|
||||
// or initialize to defaults if none provided
|
||||
else
|
||||
{
|
||||
m_gfx_region = "";
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -55,6 +44,11 @@ void k001006_device::device_start()
|
||||
m_unknown_ram = auto_alloc_array_clear(machine(), UINT16, 0x1000);
|
||||
m_palette = auto_alloc_array_clear(machine(), UINT32, 0x800);
|
||||
|
||||
m_gfxrom = machine().root_device().memregion(m_gfx_region)->base();
|
||||
m_texrom = auto_alloc_array(machine(), UINT8, 0x800000);
|
||||
|
||||
preprocess_texture_data(m_texrom, m_gfxrom, 0x800000, m_tex_layout);
|
||||
|
||||
save_pointer(NAME(m_pal_ram), 0x800*sizeof(UINT16));
|
||||
save_pointer(NAME(m_unknown_ram), 0x1000*sizeof(UINT16));
|
||||
save_pointer(NAME(m_palette), 0x800*sizeof(UINT32));
|
||||
@ -158,7 +152,67 @@ WRITE32_MEMBER( k001006_device::write )
|
||||
}
|
||||
}
|
||||
|
||||
UINT32 k001006_device::get_palette( int index )
|
||||
UINT32 k001006_device::fetch_texel(int page, int pal_index, int u, int v)
|
||||
{
|
||||
return m_palette[index];
|
||||
UINT8 *tex = m_texrom + page;
|
||||
int texel = tex[((v & 0x1ff) * 512) + (u & 0x1ff)];
|
||||
return m_palette[pal_index + texel];
|
||||
}
|
||||
|
||||
|
||||
void k001006_device::preprocess_texture_data(UINT8 *dst, UINT8 *src, int length, int layout)
|
||||
{
|
||||
static const int decode_x_gti[8] = { 0, 16, 2, 18, 4, 20, 6, 22 };
|
||||
static const int decode_y_gti[16] = { 0, 8, 32, 40, 1, 9, 33, 41, 64, 72, 96, 104, 65, 73, 97, 105 };
|
||||
|
||||
static const int decode_x_zr107[8] = { 0, 16, 1, 17, 2, 18, 3, 19 };
|
||||
static const int decode_y_zr107[16] = { 0, 8, 32, 40, 4, 12, 36, 44, 64, 72, 96, 104, 68, 76, 100, 108 };
|
||||
|
||||
int index;
|
||||
int i, x, y;
|
||||
UINT8 temp[0x40000];
|
||||
|
||||
const int *decode_x;
|
||||
const int *decode_y;
|
||||
|
||||
if (layout == 1)
|
||||
{
|
||||
decode_x = decode_x_gti;
|
||||
decode_y = decode_y_gti;
|
||||
}
|
||||
else
|
||||
{
|
||||
decode_x = decode_x_zr107;
|
||||
decode_y = decode_y_zr107;
|
||||
}
|
||||
|
||||
for (index=0; index < length; index += 0x40000)
|
||||
{
|
||||
int offset = index;
|
||||
|
||||
memset(temp, 0, 0x40000);
|
||||
|
||||
for (i=0; i < 0x800; i++)
|
||||
{
|
||||
int tx = ((i & 0x400) >> 5) | ((i & 0x100) >> 4) | ((i & 0x40) >> 3) | ((i & 0x10) >> 2) | ((i & 0x4) >> 1) | (i & 0x1);
|
||||
int ty = ((i & 0x200) >> 5) | ((i & 0x80) >> 4) | ((i & 0x20) >> 3) | ((i & 0x8) >> 2) | ((i & 0x2) >> 1);
|
||||
|
||||
tx <<= 3;
|
||||
ty <<= 4;
|
||||
|
||||
for (y=0; y < 16; y++)
|
||||
{
|
||||
for (x=0; x < 8; x++)
|
||||
{
|
||||
UINT8 pixel = src[offset + decode_y[y] + decode_x[x]];
|
||||
|
||||
temp[((ty+y) * 512) + (tx+x)] = pixel;
|
||||
}
|
||||
}
|
||||
|
||||
offset += 128;
|
||||
}
|
||||
|
||||
memcpy(&dst[index], temp, 0x40000);
|
||||
}
|
||||
}
|
||||
|
@ -4,23 +4,18 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct k001006_interface
|
||||
{
|
||||
const char *m_gfx_region;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class k001006_device : public device_t,
|
||||
public k001006_interface
|
||||
class k001006_device : public device_t
|
||||
{
|
||||
public:
|
||||
k001006_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
~k001006_device() {}
|
||||
|
||||
UINT32 get_palette(int index);
|
||||
// static configuration
|
||||
static void set_gfx_region(device_t &device, const char *tag) { downcast<k001006_device &>(device).m_gfx_region = tag; }
|
||||
static void set_tex_layout(device_t &device, int layout) { downcast<k001006_device &>(device).m_tex_layout = layout; }
|
||||
|
||||
UINT32 fetch_texel(int page, int pal_index, int u, int v);
|
||||
void preprocess_texture_data(UINT8 *dst, UINT8 *src, int length, int gticlub);
|
||||
|
||||
DECLARE_READ32_MEMBER( read );
|
||||
DECLARE_WRITE32_MEMBER( write );
|
||||
@ -38,17 +33,27 @@ private:
|
||||
UINT32 m_addr;
|
||||
int m_device_sel;
|
||||
|
||||
UINT8 * m_texrom;
|
||||
|
||||
UINT32 * m_palette;
|
||||
|
||||
const char * m_gfx_region;
|
||||
UINT8 * m_gfxrom;
|
||||
int m_tex_width;
|
||||
int m_tex_height;
|
||||
int m_tex_mirror_x;
|
||||
int m_tex_mirror_y;
|
||||
int m_tex_layout;
|
||||
};
|
||||
|
||||
|
||||
extern const device_type K001006;
|
||||
|
||||
#define MCFG_K001006_ADD(_tag, _interface) \
|
||||
MCFG_DEVICE_ADD(_tag, K001006, 0) \
|
||||
MCFG_DEVICE_CONFIG(_interface)
|
||||
|
||||
|
||||
#define MCFG_K001006_GFX_REGION(_tag) \
|
||||
k001006_device::set_gfx_region(*device, _tag);
|
||||
|
||||
#define MCFG_K001006_TEX_LAYOUT(x) \
|
||||
k001006_device::set_tex_layout(*device, x);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user