summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author angelosa <salese_corp_ltd@email.it>2016-02-08 21:36:36 +0100
committer angelosa <salese_corp_ltd@email.it>2016-02-08 21:37:11 +0100
commit7a1eb1d2add20aab3b78f9e1712af823085e715e (patch)
tree03789f61d8ece0bf36c410b28428d7ac28dde089
parent78592ed5eea2e92efe836eb22de6e2e84429620a (diff)
Moved Night Gal to use JANGOU_BLITTER
-rw-r--r--src/devices/video/jangou_blitter.cpp17
-rw-r--r--src/devices/video/jangou_blitter.h4
-rw-r--r--src/mame/drivers/nightgal.cpp187
3 files changed, 30 insertions, 178 deletions
diff --git a/src/devices/video/jangou_blitter.cpp b/src/devices/video/jangou_blitter.cpp
index e7390d44a8f..be11e07b315 100644
--- a/src/devices/video/jangou_blitter.cpp
+++ b/src/devices/video/jangou_blitter.cpp
@@ -52,7 +52,6 @@ void jangou_blitter_device::device_start()
fatalerror("JANGOU_BLITTER: \"gfx\" memory base not found");
m_gfxrommask = devregion->bytes()-1;
-
save_item(NAME(m_pen_data));
save_item(NAME(m_blit_data));
save_item(NAME(m_blit_buffer));
@@ -65,13 +64,8 @@ void jangou_blitter_device::device_start()
void jangou_blitter_device::device_reset()
{
- int i;
-
- for (i = 0; i < 6; i++)
- m_blit_data[i] = 0;
-
- for (i = 0; i < 16; i++)
- m_pen_data[i] = 0;
+ memset(m_blit_data, 0, ARRAY_LENGTH(m_blit_data));
+ memset(m_pen_data, 0, ARRAY_LENGTH(m_pen_data));
}
@@ -80,7 +74,7 @@ void jangou_blitter_device::device_reset()
//**************************************************************************
// TODO: inline these
-UINT8 jangou_blitter_device::gfx_nibble( UINT16 niboffset )
+UINT8 jangou_blitter_device::gfx_nibble( UINT32 niboffset )
{
if (niboffset & 1)
return (m_gfxrom[(niboffset >> 1) & m_gfxrommask] & 0xf0) >> 4;
@@ -111,11 +105,12 @@ WRITE8_MEMBER( jangou_blitter_device::blitter_process_w )
int count = 0;
int xcount, ycount;
- /* printf("%02x %02x %02x %02x %02x %02x\n", m_blit_data[0], m_blit_data[1], m_blit_data[2],
- m_blit_data[3], m_blit_data[4], m_blit_data[5]); */
+ //printf("%02x %02x %02x %02x %02x %02x %02x\n", m_blit_data[0], m_blit_data[1], m_blit_data[2],
+ // m_blit_data[3], m_blit_data[4], m_blit_data[5],m_blit_data[6]);
w = (m_blit_data[4] & 0xff) + 1;
h = (m_blit_data[5] & 0xff) + 1;
src = ((m_blit_data[1] << 8)|(m_blit_data[0] << 0));
+ src |= (m_blit_data[6] & 3) << 16;
x = (m_blit_data[2] & 0xff);
y = (m_blit_data[3] & 0xff);
diff --git a/src/devices/video/jangou_blitter.h b/src/devices/video/jangou_blitter.h
index d96ff1d11f7..735fea64a73 100644
--- a/src/devices/video/jangou_blitter.h
+++ b/src/devices/video/jangou_blitter.h
@@ -44,9 +44,9 @@ protected:
private:
void plot_gfx_pixel( UINT8 pix, int x, int y );
- UINT8 gfx_nibble( UINT16 niboffset );
+ UINT8 gfx_nibble( UINT32 niboffset );
UINT8 m_pen_data[0x10];
- UINT8 m_blit_data[6];
+ UINT8 m_blit_data[7];
UINT8 *m_gfxrom;
UINT32 m_gfxrommask;
};
diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp
index 98976ef8b88..b89e04c5ad3 100644
--- a/src/mame/drivers/nightgal.cpp
+++ b/src/mame/drivers/nightgal.cpp
@@ -24,6 +24,7 @@ TODO:
#include "sound/2203intf.h"
#include "cpu/z80/z80.h"
#include "cpu/m6800/m6800.h"
+#include "video/jangou_blitter.h"
#include "video/resnet.h"
#define MASTER_CLOCK XTAL_19_968MHz
@@ -36,7 +37,6 @@ public:
m_comms_ram(*this, "comms_ram"),
m_maincpu(*this, "maincpu"),
m_subcpu(*this, "sub"),
- m_gfxrom(*this, "gfx1"),
m_io_cr_clear(*this, "CR_CLEAR"),
m_io_coins(*this, "COINS"),
m_io_pl1_1(*this, "PL1_1"),
@@ -56,13 +56,11 @@ public:
m_io_dswa(*this, "DSWA"),
m_io_dswb(*this, "DSWB"),
m_io_dswc(*this, "DSWC"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette"),
+ m_blitter(*this, "blitter") { }
/* video-related */
UINT8 m_blit_raw_data[3];
- UINT8 m_true_blit[7];
- UINT8 m_pen_data[0x10];
- UINT8 m_pen_raw_data[0x10];
/* misc */
UINT8 m_nsc_latch;
@@ -76,17 +74,14 @@ public:
required_device<cpu_device> m_subcpu;
/* memory */
- UINT8 m_blit_buffer[256*256];
DECLARE_READ8_MEMBER(blitter_status_r);
- DECLARE_WRITE8_MEMBER(nsc_true_blitter_w);
- DECLARE_WRITE8_MEMBER(sexygal_nsc_true_blitter_w);
+ //DECLARE_WRITE8_MEMBER(sexygal_nsc_true_blitter_w);
DECLARE_WRITE8_MEMBER(royalqn_blitter_0_w);
DECLARE_WRITE8_MEMBER(royalqn_blitter_1_w);
DECLARE_WRITE8_MEMBER(royalqn_blitter_2_w);
DECLARE_READ8_MEMBER(royalqn_nsc_blit_r);
DECLARE_READ8_MEMBER(royalqn_comm_r);
DECLARE_WRITE8_MEMBER(royalqn_comm_w);
- DECLARE_WRITE8_MEMBER(blit_true_vregs_w);
DECLARE_WRITE8_MEMBER(mux_w);
DECLARE_READ8_MEMBER(input_1p_r);
DECLARE_READ8_MEMBER(input_2p_r);
@@ -100,7 +95,6 @@ public:
UINT32 screen_update_nightgal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
protected:
- required_region_ptr<UINT8> m_gfxrom;
required_ioport m_io_cr_clear;
required_ioport m_io_coins;
required_ioport m_io_pl1_1;
@@ -121,11 +115,10 @@ protected:
required_ioport m_io_dswb;
required_ioport m_io_dswc;
required_device<palette_device> m_palette;
+ required_device<jangou_blitter_device> m_blitter;
void z80_wait_assert_cb();
TIMER_CALLBACK_MEMBER( z80_wait_ack_cb );
-
- UINT8 nightgal_gfx_nibble( int niboffset );
- void plot_nightgal_gfx_pixel( UINT8 pix, int x, int y );
+
};
@@ -137,7 +130,6 @@ READ8_MEMBER(nightgal_state::blitter_status_r)
void nightgal_state::video_start()
{
- save_item(NAME(m_blit_buffer));
}
UINT32 nightgal_state::screen_update_nightgal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@@ -146,7 +138,7 @@ UINT32 nightgal_state::screen_update_nightgal(screen_device &screen, bitmap_ind1
for (y = cliprect.min_y; y <= cliprect.max_y; ++y)
{
- UINT8 *src = &m_blit_buffer[y * 512 / 2 + cliprect.min_x];
+ UINT8 *src = &m_blitter->m_blit_buffer[y * 256 + cliprect.min_x];
UINT16 *dst = &bitmap.pix16(y, cliprect.min_x);
for (x = cliprect.min_x; x <= cliprect.max_x; x += 2)
@@ -161,85 +153,8 @@ UINT32 nightgal_state::screen_update_nightgal(screen_device &screen, bitmap_ind1
return 0;
}
-UINT8 nightgal_state::nightgal_gfx_nibble( int niboffset )
-{
- if (niboffset & 1)
- {
- return (m_gfxrom[(niboffset >> 1) & 0x1ffff] & 0xf0) >> 4;
- }
- else
- {
- return (m_gfxrom[(niboffset >> 1) & 0x1ffff] & 0x0f);
- }
-}
-
-void nightgal_state::plot_nightgal_gfx_pixel( UINT8 pix, int x, int y )
-{
- if (y >= 512) return;
- if (x >= 512) return;
- if (y < 0) return;
- if (x < 0) return;
-
- if (x & 1)
- m_blit_buffer[(y * 256) + (x >> 1)] = (m_blit_buffer[(y * 256) + (x >> 1)] & 0x0f) | ((pix << 4) & 0xf0);
- else
- m_blit_buffer[(y * 256) + (x >> 1)] = (m_blit_buffer[(y * 256) + (x >> 1)] & 0xf0) | (pix & 0x0f);
-}
-
-WRITE8_MEMBER(nightgal_state::nsc_true_blitter_w)
-{
- int src, x, y, h, w, flipx;
- m_true_blit[offset] = data;
-
- /*trigger blitter write to ram,might not be correct...*/
- if (offset == 5)
- {
- //printf("%02x %02x %02x %02x %02x %02x %02x\n", m_true_blit[0], m_true_blit[1], m_true_blit[2], m_true_blit[3], m_true_blit[4], m_true_blit[5], m_true_blit[6]);
- w = (m_true_blit[4] & 0xff) + 1;
- h = (m_true_blit[5] & 0xff) + 1;
- src = ((m_true_blit[1] << 8) | (m_true_blit[0] << 0));
- src |= (m_true_blit[6] & 3) << 16;
-
- x = (m_true_blit[2] & 0xff);
- y = (m_true_blit[3] & 0xff);
-
- // lowest bit of src controls flipping / draw direction?
- flipx = (m_true_blit[0] & 1);
-
- if (!flipx)
- src += (w * h) - 1;
- else
- src -= (w * h) - 1;
-
- {
- int count = 0;
- int xcount, ycount;
- for (ycount = 0; ycount < h; ycount++)
- {
- for (xcount = 0; xcount < w; xcount++)
- {
- int drawx = (x + xcount) & 0xff;
- int drawy = (y + ycount) & 0xff;
- UINT8 dat = nightgal_gfx_nibble(src + count);
- UINT8 cur_pen_hi = m_pen_data[(dat & 0xf0) >> 4];
- UINT8 cur_pen_lo = m_pen_data[(dat & 0x0f) >> 0];
-
- dat = cur_pen_lo | (cur_pen_hi << 4);
-
- if ((dat & 0xff) != 0)
- plot_nightgal_gfx_pixel(dat, drawx, drawy);
-
- if (!flipx)
- count--;
- else
- count++;
- }
- }
- }
- }
-}
-
/* different register writes (probably a PAL line swapping).*/
+#ifdef UNUSED_FUNCTION
WRITE8_MEMBER(nightgal_state::sexygal_nsc_true_blitter_w)
{
int src, x, y, h, w, flipx;
@@ -294,6 +209,7 @@ WRITE8_MEMBER(nightgal_state::sexygal_nsc_true_blitter_w)
}
}
}
+#endif
/* guess: use the same resistor values as Crazy Climber (needs checking on the real HW) */
PALETTE_INIT_MEMBER(nightgal_state, nightgal)
@@ -359,46 +275,7 @@ master-slave algorithm
-executes a wai (i.e. halt) opcode then expects to receive another irq...
*/
-#define MAIN_Z80_RUN if(offset == 2) m_z80_latch = 0x00
-#define MAIN_Z80_HALT if(offset == 2) m_z80_latch = 0x80
-//#define SUB_NCS_RUN m_ncs_latch = 0x00
-//#define SUB_NCS_HALT m_ncs_latch = 0x80
-#ifdef UNUSED_CODE
-WRITE8_MEMBER(nightgal_state::nsc_latch_w)
-{
- m_subcpu->set_input_line(0, HOLD_LINE );
-}
-
-READ8_MEMBER(nightgal_state::nsc_latch_r)
-{
- return m_z80_latch;
-}
-
-WRITE8_MEMBER(nightgal_state::z80_latch_w)
-{
- m_nsc_latch = data;
-}
-
-READ8_MEMBER(nightgal_state::z80_latch_r)
-{
- return m_nsc_latch;
-}
-
-/*z80 -> MCU video params*/
-WRITE8_MEMBER(nightgal_state::blitter_w)
-{
- m_blit_raw_data[offset] = data;
- MAIN_Z80_HALT;
-}
-
-READ8_MEMBER(nightgal_state::nsc_blit_r)
-{
- MAIN_Z80_RUN;
- return m_blit_raw_data[offset];
-}
-#endif
/* TODO: simplify this (error in the document) */
-
WRITE8_MEMBER(nightgal_state::royalqn_blitter_0_w)
{
m_blit_raw_data[0] = data;
@@ -449,21 +326,6 @@ WRITE8_MEMBER(nightgal_state::royalqn_comm_w)
m_comms_ram[offset] = data & 0x80;
}
-#ifdef UNUSED_CODE
-WRITE8_MEMBER(nightgal_state::blit_vregs_w)
-{
- m_pen_raw_data[offset] = data;
-}
-
-READ8_MEMBER(nightgal_state::blit_vregs_r)
-{
- return m_pen_raw_data[offset];
-}
-#endif
-WRITE8_MEMBER(nightgal_state::blit_true_vregs_w)
-{
- m_pen_data[offset] = data;
-}
/********************************************
*
@@ -557,9 +419,9 @@ static ADDRESS_MAP_START( sexygal_nsc_map, AS_PROGRAM, 8, nightgal_state )
AM_RANGE(0x0000, 0x007f) AM_RAM
AM_RANGE(0x0080, 0x0080) AM_READ(blitter_status_r)
AM_RANGE(0x0081, 0x0083) AM_READ(royalqn_nsc_blit_r)
- AM_RANGE(0x0080, 0x0086) AM_WRITE(sexygal_nsc_true_blitter_w)
+ AM_RANGE(0x0080, 0x0086) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_process_w)
+ AM_RANGE(0x00a0, 0x00af) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_vregs_w)
- AM_RANGE(0x00a0, 0x00af) AM_WRITE(blit_true_vregs_w)
AM_RANGE(0x00b0, 0x00b0) AM_WRITENOP // bltflip register
AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x2c00) AM_READWRITE(royalqn_comm_r, royalqn_comm_w) AM_SHARE("comms_ram")
@@ -595,9 +457,8 @@ static ADDRESS_MAP_START( royalqn_nsc_map, AS_PROGRAM, 8, nightgal_state )
AM_RANGE(0x0000, 0x007f) AM_RAM
AM_RANGE(0x0080, 0x0080) AM_READ(blitter_status_r)
AM_RANGE(0x0081, 0x0083) AM_READ(royalqn_nsc_blit_r)
- AM_RANGE(0x0080, 0x0086) AM_WRITE(nsc_true_blitter_w)
-
- AM_RANGE(0x00a0, 0x00af) AM_WRITE(blit_true_vregs_w)
+ AM_RANGE(0x0080, 0x0086) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_process_w)
+ AM_RANGE(0x00a0, 0x00af) AM_DEVWRITE("blitter", jangou_blitter_device, blitter_vregs_w)
AM_RANGE(0x00b0, 0x00b0) AM_WRITENOP // bltflip register
AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x2c00) AM_READWRITE(royalqn_comm_r,royalqn_comm_w)
@@ -851,9 +712,6 @@ void nightgal_state::machine_start()
save_item(NAME(m_mux_data));
save_item(NAME(m_blit_raw_data));
- save_item(NAME(m_true_blit));
- save_item(NAME(m_pen_data));
- save_item(NAME(m_pen_raw_data));
}
void nightgal_state::machine_reset()
@@ -863,9 +721,6 @@ void nightgal_state::machine_reset()
m_mux_data = 0;
memset(m_blit_raw_data, 0, ARRAY_LENGTH(m_blit_raw_data));
- memset(m_true_blit, 0, ARRAY_LENGTH(m_true_blit));
- memset(m_pen_data, 0, ARRAY_LENGTH(m_pen_data));
- memset(m_pen_raw_data, 0, ARRAY_LENGTH(m_pen_raw_data));
}
static MACHINE_CONFIG_START( royalqn, nightgal_state )
@@ -881,6 +736,8 @@ static MACHINE_CONFIG_START( royalqn, nightgal_state )
MCFG_QUANTUM_PERFECT_CPU("maincpu")
+ MCFG_JANGOU_BLITTER_ADD("blitter", MASTER_CLOCK/4)
+
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/4,320,0,256,264,16,240)
@@ -963,7 +820,7 @@ ROM_START( nightgal )
ROM_REGION( 0x10000, "sub", 0 )
ROM_LOAD( "ngal_09.bin", 0x0c000, 0x02000, CRC(da3dcc08) SHA1(6f5319c1777dabf7041286698ac8f25eca1545a1) )
- ROM_REGION( 0x20000, "gfx1", 0 )
+ ROM_REGION( 0x20000, "gfx", 0 )
ROM_LOAD( "ngal_01.bin", 0x00000, 0x02000, CRC(8e4c92ad) SHA1(13cebe765ebabe6be79c9c9ac3f778550e450380) )
ROM_LOAD( "ngal_02.bin", 0x02000, 0x02000, CRC(c60f7dc1) SHA1(273fd05c62e1efe26538efd2d4f0973c5eba65e4) )
ROM_LOAD( "ngal_03.bin", 0x04000, 0x02000, CRC(824b7d9e) SHA1(04d3340cbb954add0d70c093df4ccb669e5ed12b) )
@@ -1013,7 +870,7 @@ ROM_START( ngtbunny )
ROM_REGION( 0x10000, "sub", 0 )
ROM_LOAD( "5.3m", 0x0c000, 0x02000, CRC(b8a82966) SHA1(9f86b3208fb48f9735cfc4f8e62680f0cb4a92f0) )
- ROM_REGION( 0x20000, "gfx1", 0 )
+ ROM_REGION( 0x20000, "gfx", 0 )
ROM_LOAD( "1.3a", 0x00000, 0x02000, CRC(16776c5f) SHA1(a2925eaed938ae3985ea796658b62d6fafb6412b) )
ROM_LOAD( "2.3c", 0x02000, 0x02000, CRC(dffd2cc6) SHA1(34f45b20596f69c44dc01c7aef765ab3ddaa076b) )
ROM_LOAD( "3.3d", 0x04000, 0x02000, CRC(c532ca49) SHA1(b01b08e99e24649c45ce1833f830775d6f532f6b) )
@@ -1032,7 +889,7 @@ ROM_START( royalngt )
ROM_REGION( 0x10000, "sub", 0 )
ROM_LOAD( "rn5.3l", 0x0c000, 0x02000, CRC(b8a82966) SHA1(9f86b3208fb48f9735cfc4f8e62680f0cb4a92f0) )
- ROM_REGION( 0x20000, "gfx1", 0 )
+ ROM_REGION( 0x20000, "gfx", 0 )
ROM_LOAD( "rn1.3a", 0x00000, 0x02000, CRC(16776c5f) SHA1(a2925eaed938ae3985ea796658b62d6fafb6412b) )
ROM_LOAD( "rn2.3c", 0x02000, 0x02000, CRC(dffd2cc6) SHA1(34f45b20596f69c44dc01c7aef765ab3ddaa076b) )
ROM_LOAD( "rn3.3d", 0x04000, 0x02000, CRC(31fb1d47) SHA1(41441bc2613c95dc810cad569cbaa0c023c819ba) )
@@ -1053,7 +910,7 @@ ROM_START( royalqn )
ROM_REGION( 0xc000, "samples", ROMREGION_ERASE00 )
- ROM_REGION( 0x20000, "gfx1", 0 )
+ ROM_REGION( 0x20000, "gfx", 0 )
ROM_LOAD( "rq1.3a", 0x00000, 0x02000, CRC(066449dc) SHA1(34838f5e3569b313306ce465e481b934e938c837) )
ROM_LOAD( "rq2.3c", 0x02000, 0x02000, CRC(c467adb5) SHA1(755ebde6229bbf0c7d9293e0becb7506d9aa9d49) )
ROM_LOAD( "rq3.3d", 0x04000, 0x02000, CRC(7e5a7a2d) SHA1(5770cd832de59ff4f61ac40eca8c2238ff7b582d) )
@@ -1121,7 +978,7 @@ ROM_START( sexygal )
ROM_LOAD( "13.s7b", 0x04000, 0x04000, CRC(5eb75f56) SHA1(b7d81d786d1ac8d65a6a122140954eb89d76e8b4) )
ROM_LOAD( "14.s6b", 0x08000, 0x04000, CRC(b4a2497b) SHA1(7231f57b4548899c886625e883b9972c0f30e9f2) )
- ROM_REGION( 0x20000, "gfx1", 0 )
+ ROM_REGION( 0x20000, "gfx", 0 )
ROM_LOAD( "2.3c", 0x00000, 0x04000, CRC(f719e09d) SHA1(c78411b4f974b3dd261d51e522e086fc30a96fcb) )
ROM_LOAD( "3.3d", 0x04000, 0x04000, CRC(a84d9a89) SHA1(91d5978e35ba4acf9353a13ec22c22aeb8a35f12) )
ROM_LOAD( "4.3e", 0x08000, 0x04000, CRC(f1cdbedb) SHA1(caacf2887a3a05e498d57d570a1e9873f95a5d5f) )
@@ -1148,7 +1005,7 @@ ROM_START( sweetgal )
ROM_LOAD( "v2_13.bin", 0x04000, 0x04000, CRC(60785a0d) SHA1(71eaec3512c0b18b93c083c1808eec51cfd4f520) )
ROM_LOAD( "v2_14.bin", 0x08000, 0x04000, CRC(149e84c1) SHA1(5c4e18637bef2f31bc3578cae6525fb6280fbc06) )
- ROM_REGION( 0x20000, "gfx1", 0 )
+ ROM_REGION( 0x20000, "gfx", 0 )
ROM_LOAD( "2.3c", 0x00000, 0x04000, CRC(3a3d78f7) SHA1(71e35529f30c43ee8ec2363f85fe17042f1d304e) ) // sldh
ROM_LOAD( "3.3d", 0x04000, 0x04000, CRC(c6f9b884) SHA1(32d6fe1906a3f1f528f30dbd3f89971b2ea1925b) ) // sldh
// all roms below match sexygal
@@ -1215,7 +1072,7 @@ ROM_START( ngalsumr )
ROM_LOAD( "2s.ic6", 0x04000, 0x04000, CRC(ca2a735f) SHA1(5980525a67fb0ffbfa04b82d805eee2463236ce3) )
ROM_LOAD( "3s.ic5", 0x08000, 0x04000, CRC(5cf15267) SHA1(72e4b2aa59a50af6b1b25d5279b3b125bfe06d86) )
- ROM_REGION( 0x20000, "gfx1", 0 )
+ ROM_REGION( 0x20000, "gfx", 0 )
ROM_LOAD( "1.3a", 0x00000, 0x04000, CRC(9626f812) SHA1(ca7162811a0ba05dfaa2aa8cc93a2e898b326e9e) )
ROM_LOAD( "2.3c", 0x04000, 0x04000, CRC(0d59cf7a) SHA1(600bc70d29853fb936f8adaef048d925cbae0ce9) )
ROM_LOAD( "3.3d", 0x08000, 0x04000, CRC(2fb2ec0b) SHA1(2f1735e33906783b8c0b283455a2a079431e6f11) )