summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Osso <mesgnet@yahoo.it>2014-10-27 19:24:59 +0100
committer Osso <mesgnet@yahoo.it>2014-10-27 19:24:59 +0100
commitd0b189505fbea8c39909f258f62885961ba99c4e (patch)
treea1808f7675019321d36084a738ebe1b6f4e87b06
parentbcc0e5bd96673e3b8a37627b7fbb66d40274589b (diff)
konamigx: Moved global variables into driver state (nw)
Let's see if I break line endings again.
-rw-r--r--src/mame/drivers/konamigx.c215
-rw-r--r--src/mame/drivers/mystwarr.c14
-rw-r--r--src/mame/includes/konamigx.h118
-rw-r--r--src/mame/machine/konamigx.c84
-rw-r--r--src/mame/video/konamigx.c437
5 files changed, 421 insertions, 447 deletions
diff --git a/src/mame/drivers/konamigx.c b/src/mame/drivers/konamigx.c
index 3d443af61d5..01903dae7eb 100644
--- a/src/mame/drivers/konamigx.c
+++ b/src/mame/drivers/konamigx.c
@@ -106,14 +106,6 @@
-
-static int konamigx_cfgport;
-
-static int gx_rdport1_3, gx_syncen;
-
-static emu_timer *dmadelay_timer;
-static emu_timer *boothack_timer;
-
/**********************************************************************************/
/*
Konami ESC (E Security Chip) protection chip found on:
@@ -179,13 +171,10 @@ static struct sprite_entry {
static void generate_sprites(address_space &space, UINT32 src, UINT32 spr, int count)
{
- int i;
- int scount;
- int ecount;
- scount = 0;
- ecount = 0;
+ int scount = 0;
+ int ecount = 0;
- for(i=0; i<count; i++) {
+ for(int i=0; i<count; i++) {
UINT32 adr = src + 0x100*i;
int pri;
if(!space.read_word(adr+2))
@@ -200,7 +189,7 @@ static void generate_sprites(address_space &space, UINT32 src, UINT32 spr, int c
}
//qsort(sprites, ecount, sizeof(struct sprite_entry), pri_comp);
- for(i=0; i<ecount; i++) {
+ for(int i=0; i<ecount; i++) {
UINT32 adr = sprites[i].adr;
if(adr) {
UINT32 set =(space.read_word(adr) << 16)|space.read_word(adr+2);
@@ -315,43 +304,37 @@ static void generate_sprites(address_space &space, UINT32 src, UINT32 spr, int c
}
}
-static void tkmmpzdm_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4)
+void konamigx_state::tkmmpzdm_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4)
{
- konamigx_state* state = space.machine().driver_data<konamigx_state>();
- state->konamigx_esc_alert(space.machine().driver_data<konamigx_state>()->m_workram, 0x0142, 0x100, 0);
+ konamigx_esc_alert(m_workram, 0x0142, 0x100, 0);
}
-static void dragoonj_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4)
+void konamigx_state::dragoonj_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4)
{
- konamigx_state* state = space.machine().driver_data<konamigx_state>();
- state->konamigx_esc_alert(space.machine().driver_data<konamigx_state>()->m_workram, 0x5c00, 0x100, 0);
+ konamigx_esc_alert(m_workram, 0x5c00, 0x100, 0);
}
-static void sal2_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4)
+void konamigx_state::sal2_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4)
{
- konamigx_state* state = space.machine().driver_data<konamigx_state>();
- state->konamigx_esc_alert(space.machine().driver_data<konamigx_state>()->m_workram, 0x1c8c, 0x172, 1);
+ konamigx_esc_alert(m_workram, 0x1c8c, 0x172, 1);
}
-static void sexyparo_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4)
+void konamigx_state::sexyparo_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4)
{
// The d20000 should probably be p3
generate_sprites(space, 0xc00604, 0xd20000, 0xfc);
}
-static void tbyahhoo_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4)
+void konamigx_state::tbyahhoo_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4)
{
generate_sprites(space, 0xc00000, 0xd20000, 0x100);
}
-static void daiskiss_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4)
+void konamigx_state::daiskiss_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4)
{
generate_sprites(space, 0xc00000, 0xd20000, 0x100);
}
-static UINT8 esc_program[4096];
-static void (*esc_cb)(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4);
-
WRITE32_MEMBER(konamigx_state::esc_w)
{
UINT32 opcode;
@@ -386,7 +369,7 @@ WRITE32_MEMBER(konamigx_state::esc_w)
break;
case 2: // Load program
for(i=0; i<4096; i++)
- esc_program[i] = space.read_byte(params+i);
+ m_esc_program[i] = space.read_byte(params+i);
/*
{
FILE *f;
@@ -400,12 +383,12 @@ WRITE32_MEMBER(konamigx_state::esc_w)
*/
break;
case 1: // Run program
- if(esc_cb) {
+ if(m_esc_cb) {
UINT32 p1 = (space.read_word(params+0)<<16) | space.read_word(params+2);
UINT32 p2 = (space.read_word(params+4)<<16) | space.read_word(params+6);
UINT32 p3 = (space.read_word(params+8)<<16) | space.read_word(params+10);
UINT32 p4 = (space.read_word(params+12)<<16) | space.read_word(params+14);
- esc_cb(space, p1, p2, p3, p4);
+ (this->*m_esc_cb)(space, p1, p2, p3, p4);
}
break;
default:
@@ -414,9 +397,9 @@ WRITE32_MEMBER(konamigx_state::esc_w)
}
space.write_byte(data+9, ESTATE_END);
- if (konamigx_wrport1_1 & 0x10)
+ if (m_gx_wrport1_1 & 0x10)
{
- gx_rdport1_3 &= ~8;
+ m_gx_rdport1_3 &= ~8;
m_maincpu->set_input_line(4, HOLD_LINE);
}
}
@@ -439,7 +422,7 @@ WRITE32_MEMBER(konamigx_state::esc_w)
CUSTOM_INPUT_MEMBER(konamigx_state::gx_rdport1_3_r)
{
- return (gx_rdport1_3 >> 1);
+ return (m_gx_rdport1_3 >> 1);
}
WRITE32_MEMBER(konamigx_state::eeprom_w)
@@ -462,7 +445,7 @@ WRITE32_MEMBER(konamigx_state::eeprom_w)
m_eepromout->write(odata, 0xff);
- konamigx_wrport1_0 = odata;
+ m_gx_wrport1_0 = odata;
}
if (ACCESSING_BITS_16_23)
@@ -478,12 +461,12 @@ WRITE32_MEMBER(konamigx_state::eeprom_w)
bit 0 = CCU1-INT1 enable
*/
- konamigx_wrport1_1 = (data>>16)&0xff;
-// logerror("write %x to IRQ register (PC=%x)\n", konamigx_wrport1_1, space.device().safe_pc());
+ m_gx_wrport1_1 = (data>>16)&0xff;
+// logerror("write %x to IRQ register (PC=%x)\n", m_gx_wrport1_1, space.device().safe_pc());
- // gx_syncen is to ensure each IRQ is trigger at least once after being enabled
- if (konamigx_wrport1_1 & 0x80)
- gx_syncen |= konamigx_wrport1_1 & 0x1f;
+ // m_gx_syncen is to ensure each IRQ is triggered at least once after being enabled
+ if (m_gx_wrport1_1 & 0x80)
+ m_gx_syncen |= m_gx_wrport1_1 & 0x1f;
}
}
@@ -526,7 +509,7 @@ WRITE32_MEMBER(konamigx_state::control_w)
m_k055673->k053246_set_objcha_line((data&0x100000) ? ASSERT_LINE : CLEAR_LINE);
- konamigx_wrport2 = (data>>16)&0xff;
+ m_gx_wrport2 = (data>>16)&0xff;
}
}
@@ -534,8 +517,6 @@ WRITE32_MEMBER(konamigx_state::control_w)
/**********************************************************************************/
/* IRQ controllers */
-static int suspension_active, resume_trigger;
-
READ32_MEMBER(konamigx_state::ccu_r)
{
// the routine at 204abe in opengolf polls to see if we're in vblank (it wants values between 0x111 and 0x1df)
@@ -559,14 +540,14 @@ WRITE32_MEMBER(konamigx_state::ccu_w)
if (ACCESSING_BITS_24_31)
{
m_maincpu->set_input_line(1, CLEAR_LINE);
- gx_syncen |= 0x20;
+ m_gx_syncen |= 0x20;
}
// hblank interrupt ACK
if (ACCESSING_BITS_8_15)
{
m_maincpu->set_input_line(2, CLEAR_LINE);
- gx_syncen |= 0x40;
+ m_gx_syncen |= 0x40;
}
}
}
@@ -588,22 +569,22 @@ TIMER_CALLBACK_MEMBER(konamigx_state::boothack_callback)
TIMER_CALLBACK_MEMBER(konamigx_state::dmaend_callback)
{
// foul-proof (CPU0 could be deactivated while we wait)
- if (resume_trigger && suspension_active)
+ if (m_resume_trigger && m_suspension_active)
{
- suspension_active = 0;
- machine().scheduler().trigger(resume_trigger);
+ m_suspension_active = 0;
+ machine().scheduler().trigger(m_resume_trigger);
}
// DMA busy flag must be cleared before triggering IRQ 3
- gx_rdport1_3 &= ~2;
+ m_gx_rdport1_3 &= ~2;
// IRQ 3 is the "object DMA end" IRQ also happens during vblank
- if ((konamigx_wrport1_1 & 0x84) == 0x84 || (gx_syncen & 4))
+ if ((m_gx_wrport1_1 & 0x84) == 0x84 || (m_gx_syncen & 4))
{
- gx_syncen &= ~4;
+ m_gx_syncen &= ~4;
// lower OBJINT-REQ flag and trigger interrupt
- gx_rdport1_3 &= ~0x80;
+ m_gx_rdport1_3 &= ~0x80;
m_maincpu->set_input_line(3, HOLD_LINE);
}
}
@@ -611,7 +592,7 @@ TIMER_CALLBACK_MEMBER(konamigx_state::dmaend_callback)
void konamigx_state::dmastart_callback(int data)
{
// raise the DMA busy flag
- gx_rdport1_3 |= 2;
+ m_gx_rdport1_3 |= 2;
// begin transfer if DMAEN(bit4 of OBJSET1) is set (see p.48)
if (m_k055673->k053246_read_register(5) & 0x10)
@@ -621,27 +602,27 @@ void konamigx_state::dmastart_callback(int data)
}
// simulate DMA delay
- dmadelay_timer->adjust(attotime::from_usec(120));
+ m_dmadelay_timer->adjust(attotime::from_usec(120));
}
INTERRUPT_GEN_MEMBER(konamigx_state::konamigx_vbinterrupt)
{
// lift idle suspension
- if (resume_trigger && suspension_active)
+ if (m_resume_trigger && m_suspension_active)
{
- suspension_active = 0;
- machine().scheduler().trigger(resume_trigger);
+ m_suspension_active = 0;
+ machine().scheduler().trigger(m_resume_trigger);
}
// IRQ 1 is the main 60hz vblank interrupt
- if (gx_syncen & 0x20)
+ if (m_gx_syncen & 0x20)
{
- gx_syncen &= ~0x20;
+ m_gx_syncen &= ~0x20;
- if ((konamigx_wrport1_1 & 0x81) == 0x81 || (gx_syncen & 1))
+ if ((m_gx_wrport1_1 & 0x81) == 0x81 || (m_gx_syncen & 1))
{
- gx_syncen &= ~1;
+ m_gx_syncen &= ~1;
device.execute().set_input_line(1, HOLD_LINE);
}
}
@@ -656,26 +637,26 @@ TIMER_DEVICE_CALLBACK_MEMBER(konamigx_state::konamigx_hbinterrupt)
if (scanline == 240)
{
// lift idle suspension
- if (resume_trigger && suspension_active)
+ if (m_resume_trigger && m_suspension_active)
{
- suspension_active = 0;
- machine().scheduler().trigger(resume_trigger);
+ m_suspension_active = 0;
+ machine().scheduler().trigger(m_resume_trigger);
}
// IRQ 1 is the main 60hz vblank interrupt
- // the gx_syncen & 0x20 test doesn't work on type 3 or 4 ROM boards, likely because the ROM board
+ // the m_gx_syncen & 0x20 test doesn't work on type 3 or 4 ROM boards, likely because the ROM board
// generates the timing in those cases. With this change, rushing heroes and rng2 boot :)
// maybe this interrupt should only be every 30fps, or maybe there are flags to prevent the game running too fast
// the real hardware should output the display for each screen on alternate frames
// if(device->m_screen->frame_number() & 1)
- if (1) // gx_syncen & 0x20)
+ if (1) // m_gx_syncen & 0x20)
{
- gx_syncen &= ~0x20;
+ m_gx_syncen &= ~0x20;
- if ((konamigx_wrport1_1 & 0x81) == 0x81 || (gx_syncen & 1))
+ if ((m_gx_wrport1_1 & 0x81) == 0x81 || (m_gx_syncen & 1))
{
- gx_syncen &= ~1;
+ m_gx_syncen &= ~1;
m_maincpu->set_input_line(1, HOLD_LINE);
}
@@ -686,13 +667,13 @@ TIMER_DEVICE_CALLBACK_MEMBER(konamigx_state::konamigx_hbinterrupt)
else if(scanline < 240) // hblank
{
// IRQ 2 is a programmable interrupt with scanline resolution
- if (gx_syncen & 0x40)
+ if (m_gx_syncen & 0x40)
{
- gx_syncen &= ~0x40;
+ m_gx_syncen &= ~0x40;
- if ((konamigx_wrport1_1 & 0x82) == 0x82 || (gx_syncen & 2))
+ if ((m_gx_wrport1_1 & 0x82) == 0x82 || (m_gx_syncen & 2))
{
- gx_syncen &= ~2;
+ m_gx_syncen &= ~2;
m_maincpu->set_input_line(2, HOLD_LINE);
}
}
@@ -759,8 +740,6 @@ READ32_MEMBER(konamigx_state::type1_roz_r2)
return ROM[offset];
}
-//static int sync_frame = 0;
-
READ32_MEMBER(konamigx_state::type3_sync_r)
{
if(m_konamigx_current_frame==0)
@@ -768,7 +747,7 @@ READ32_MEMBER(konamigx_state::type3_sync_r)
else
return 0;// return 0xfffffffe | 0;
}
-static int last_prot_op, last_prot_clk;
+
/*
Run and Gun 2, Rushing Heroes, Winning Spike, and Vs. Net Soccer contain a XILINX FPGA that serves as security.
@@ -844,8 +823,6 @@ static int last_prot_op, last_prot_clk;
move.l #$C10400,($C102EC).l move.l #$C10400,($C102EC).l
*/
-//static int cc=0;
-
WRITE32_MEMBER(konamigx_state::type4_prot_w)
{
int clk;
@@ -853,18 +830,18 @@ WRITE32_MEMBER(konamigx_state::type4_prot_w)
if (offset == 1)
{
- last_prot_op = data>>16;
+ m_last_prot_op = data>>16;
}
else
{
data >>= 16;
clk = data & 0x200;
- if ((clk == 0) && (last_prot_clk != 0))
+ if ((clk == 0) && (m_last_prot_clk != 0))
{
- if (last_prot_op != -1)
+ if (m_last_prot_op != -1)
{
-// osd_printf_debug("type 4 prot command: %x\n", last_prot_op);
+// osd_printf_debug("type 4 prot command: %x\n", m_last_prot_op);
/*
known commands:
rng2 rushhero vsnet winspike what
@@ -874,7 +851,7 @@ WRITE32_MEMBER(konamigx_state::type4_prot_w)
0d97 0515 parse big DMA list at c10200
57a copy 4 bytes from c00f10 to c10f00 and 4 bytes from c00f30 to c0fe00
*/
- if ((last_prot_op == 0xa56) || (last_prot_op == 0xd96) || (last_prot_op == 0xd14) || (last_prot_op == 0xd1c))
+ if ((m_last_prot_op == 0xa56) || (m_last_prot_op == 0xd96) || (m_last_prot_op == 0xd14) || (m_last_prot_op == 0xd1c))
{
// memcpy from c01000 to c01400 for 0x400 bytes (startup check for type 4 games)
for (i = 0; i < 0x400; i += 2)
@@ -882,7 +859,7 @@ WRITE32_MEMBER(konamigx_state::type4_prot_w)
space.write_word(0xc01400+i, space.read_word(0xc01000+i));
}
}
- else if(last_prot_op == 0x57a) // winspike
+ else if(m_last_prot_op == 0x57a) // winspike
{
/* player 1 input buffer protection */
space.write_dword(0xc10f00, space.read_dword(0xc00f10));
@@ -894,7 +871,7 @@ WRITE32_MEMBER(konamigx_state::type4_prot_w)
space.write_dword(0xc0fe00, space.read_dword(0xc00f30));
space.write_dword(0xc0fe04, space.read_dword(0xc00f34));
}
- else if(last_prot_op == 0xd97) // rushhero
+ else if(m_last_prot_op == 0xd97) // rushhero
{
int src = 0xc09ff0;
int dst = 0xd20000;
@@ -917,7 +894,7 @@ WRITE32_MEMBER(konamigx_state::type4_prot_w)
space.write_byte(0xc01cc4, ~space.read_byte(0xc00547));
space.write_byte(0xc01cc5, ~space.read_byte(0xc00567));
}
- else if(last_prot_op == 0xb16) // slamdnk2
+ else if(m_last_prot_op == 0xb16) // slamdnk2
{
int src = 0xc01000;
int dst = 0xd20000;
@@ -932,36 +909,36 @@ WRITE32_MEMBER(konamigx_state::type4_prot_w)
//maybe here there's a [$d8001f] <- 0x31 write too?
}
- else if(last_prot_op == 0x515) // vsnetscr screen 1
+ else if(m_last_prot_op == 0x515) // vsnetscr screen 1
{
int adr;
- //printf("GXT4: command %x %d (PC=%x)\n", last_prot_op, cc++, space.device().safe_pc());
+ //printf("GXT4: command %x %d (PC=%x)\n", m_last_prot_op, cc++, space.device().safe_pc());
for (adr = 0; adr < 0x400; adr += 2)
space.write_word(0xc01c00+adr, space.read_word(0xc01800+adr));
}
- else if(last_prot_op == 0x115d) // vsnetscr screen 2
+ else if(m_last_prot_op == 0x115d) // vsnetscr screen 2
{
int adr;
- //printf("GXT4: command %x %d (PC=%x)\n", last_prot_op, cc++, space.device().safe_pc());
+ //printf("GXT4: command %x %d (PC=%x)\n", m_last_prot_op, cc++, space.device().safe_pc());
for (adr = 0; adr < 0x400; adr += 2)
space.write_word(0xc18c00+adr, space.read_word(0xc18800+adr));
}
else
{
- printf("GXT4: unknown protection command %x (PC=%x)\n", last_prot_op, space.device().safe_pc());
+ printf("GXT4: unknown protection command %x (PC=%x)\n", m_last_prot_op, space.device().safe_pc());
}
- if (konamigx_wrport1_1 & 0x10)
+ if (m_gx_wrport1_1 & 0x10)
{
- gx_rdport1_3 &= ~8;
+ m_gx_rdport1_3 &= ~8;
m_maincpu->set_input_line(4, HOLD_LINE);
}
// don't accidentally do a phony command
- last_prot_op = -1;
+ m_last_prot_op = -1;
}
}
- last_prot_clk = clk;
+ m_last_prot_clk = clk;
}
}
@@ -1180,7 +1157,7 @@ static INPUT_PORTS_START( common )
// note: racin' force expects bit 1 of the eeprom port to toggle
PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read)
- PORT_BIT( 0x000000fe, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, konamigx_state,gx_rdport1_3_r, NULL)
+ PORT_BIT( 0x000000fe, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, konamigx_state, gx_rdport1_3_r, NULL)
PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_UNKNOWN )
@@ -3578,22 +3555,22 @@ ROM_END
MACHINE_START_MEMBER(konamigx_state,konamigx)
{
- save_item(NAME(konamigx_wrport1_1));
+ save_item(NAME(m_gx_wrport1_1));
}
MACHINE_RESET_MEMBER(konamigx_state,konamigx)
{
- konamigx_wrport1_0 = konamigx_wrport1_1 = 0;
- konamigx_wrport2 = 0;
+ m_gx_wrport1_0 = m_gx_wrport1_1 = 0;
+ m_gx_wrport2 = 0;
/*
bit0 : EEPROM data(don't care)
bit1 : DMA busy (cleared)
bit2-7: IRQ ready (all set)
*/
- gx_rdport1_3 = 0xfc;
- gx_syncen = 0;
- suspension_active = 0;
+ m_gx_rdport1_3 = 0xfc;
+ m_gx_syncen = 0;
+ m_suspension_active = 0;
// Hold sound CPUs in reset
m_soundcpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
@@ -3633,7 +3610,7 @@ MACHINE_RESET_MEMBER(konamigx_state,konamigx)
// To hack around this, we underclock the 68020 for 10 seconds during POST
m_maincpu->set_clock_scale(0.66f);
- boothack_timer->adjust(attotime::from_seconds(10));
+ m_boothack_timer->adjust(attotime::from_seconds(10));
}
if (!strcmp(setname, "le2") ||
@@ -3708,15 +3685,15 @@ DRIVER_INIT_MEMBER(konamigx_state,konamigx)
int i, match;
int readback = 0;
- konamigx_cfgport = -1;
- last_prot_op = -1;
- last_prot_clk = 0;
+ m_gx_cfgport = -1;
+ m_last_prot_op = -1;
+ m_last_prot_clk = 0;
- esc_cb = 0;
- resume_trigger = 0;
+ m_esc_cb = NULL;
+ m_resume_trigger = 0;
- dmadelay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(konamigx_state::dmaend_callback),this));
- boothack_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(konamigx_state::boothack_callback),this));
+ m_dmadelay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(konamigx_state::dmaend_callback),this));
+ m_boothack_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(konamigx_state::boothack_callback),this));
i = match = 0;
while ((gameDefs[i].cfgport != -1) && (!match))
@@ -3724,7 +3701,7 @@ DRIVER_INIT_MEMBER(konamigx_state,konamigx)
if (!strcmp(machine().system().name, gameDefs[i].romname))
{
match = 1;
- konamigx_cfgport = gameDefs[i].cfgport;
+ m_gx_cfgport = gameDefs[i].cfgport;
readback = gameDefs[i].readback;
switch (gameDefs[i].special)
@@ -3745,24 +3722,24 @@ DRIVER_INIT_MEMBER(konamigx_state,konamigx)
rom[0x810f1] &= ~1; // fix checksum
rom[0x872ea] |= 0xe0000; // enable plane B,C,D
- esc_cb = tkmmpzdm_esc;
+ m_esc_cb = &konamigx_state::tkmmpzdm_esc;
break;
}
case 3: // dragoon might
- esc_cb = dragoonj_esc;
+ m_esc_cb = &konamigx_state::dragoonj_esc;
break;
case 4: // sexyparo
- esc_cb = sexyparo_esc;
+ m_esc_cb = &konamigx_state::sexyparo_esc;
break;
case 5: // daiskiss
- esc_cb = daiskiss_esc;
+ m_esc_cb = &konamigx_state::daiskiss_esc;
break;
case 6: // salamander 2
- esc_cb = sal2_esc;
+ m_esc_cb = &konamigx_state::sal2_esc;
break;
case 7: // install type 4 Xilinx protection for non-type 3/4 games
@@ -3770,7 +3747,7 @@ DRIVER_INIT_MEMBER(konamigx_state,konamigx)
break;
case 8: // tbyahhoo
- esc_cb = tbyahhoo_esc;
+ m_esc_cb = &konamigx_state::tbyahhoo_esc;
break;
case 9: // fantjour
diff --git a/src/mame/drivers/mystwarr.c b/src/mame/drivers/mystwarr.c
index 76502908844..31c3f6eb12d 100644
--- a/src/mame/drivers/mystwarr.c
+++ b/src/mame/drivers/mystwarr.c
@@ -847,13 +847,13 @@ MACHINE_START_MEMBER(mystwarr_state,mystwarr)
m_sound_ctrl = 2;
reset_sound_region();
- m_mw_irq_control = 0;
-
- /* konamigx_mixer uses this, so better initialize it */
- konamigx_wrport1_0 = 0;
-
- save_item(NAME(m_mw_irq_control));
- save_item(NAME(m_sound_ctrl));
+ m_mw_irq_control = 0;
+
+ /* konamigx_mixer uses this, so better initialize it */
+ m_gx_wrport1_0 = 0;
+
+ save_item(NAME(m_mw_irq_control));
+ save_item(NAME(m_sound_ctrl));
save_item(NAME(m_sound_nmi_clk));
machine().save().register_postload(save_prepost_delegate(FUNC(mystwarr_state::reset_sound_region), this));
diff --git a/src/mame/includes/konamigx.h b/src/mame/includes/konamigx.h
index 5921cabbb1f..0a4f1a497cd 100644
--- a/src/mame/includes/konamigx.h
+++ b/src/mame/includes/konamigx.h
@@ -16,58 +16,59 @@ public:
m_maincpu(*this,"maincpu"),
m_soundcpu(*this, "soundcpu"),
m_dasp(*this, "dasp"),
- m_workram(*this,"workram"),
- m_psacram(*this,"psacram"),
- m_subpaletteram32(*this,"subpaletteram"),
m_k055673(*this, "k055673"),
m_k055555(*this, "k055555"),
m_k056832(*this, "k056832"),
m_k054338(*this, "k054338"),
+ m_k056800(*this, "k056800"),
+ m_k054539_1(*this,"k054539_1"),
+ m_k054539_2(*this,"k054539_2"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_screen(*this, "screen"),
+ m_palette(*this, "palette"),
+ m_workram(*this,"workram"),
+ m_psacram(*this,"psacram"),
+ m_subpaletteram32(*this,"subpaletteram"),
m_k053936_0_ctrl(*this,"k053936_0_ctrl",32),
m_k053936_0_linectrl(*this,"k053936_0_line",32),
m_k053936_0_ctrl_16(*this,"k053936_0_ct16",16),
m_k053936_0_linectrl_16(*this,"k053936_0_li16",16),
m_konamigx_type3_psac2_bank(*this,"psac2_bank"),
- m_k056800(*this, "k056800"),
- m_k054539_1(*this,"k054539_1"),
- m_k054539_2(*this,"k054539_2"),
+ m_generic_paletteram_32(*this, "paletteram"),
m_an0(*this, "AN0"),
m_an1(*this, "AN1"),
m_light0_x(*this, "LIGHT0_X"),
m_light0_y(*this, "LIGHT0_Y"),
m_light1_x(*this, "LIGHT1_X"),
m_light1_y(*this, "LIGHT1_Y"),
- m_eepromout(*this, "EEPROMOUT"),
- m_gfxdecode(*this, "gfxdecode"),
- m_screen(*this, "screen"),
- m_palette(*this, "palette"),
- m_generic_paletteram_32(*this, "paletteram")
+ m_eepromout(*this, "EEPROMOUT")
{ }
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_soundcpu;
optional_device<tms57002_device> m_dasp;
-
- optional_shared_ptr<UINT32> m_workram;
- optional_shared_ptr<UINT32> m_psacram;
- optional_shared_ptr<UINT32> m_subpaletteram32;
required_device<k055673_device> m_k055673;
required_device<k055555_device> m_k055555;
required_device<k056832_device> m_k056832;
optional_device<k054338_device> m_k054338;
- optional_shared_ptr<UINT16> m_k053936_0_ctrl;
- optional_shared_ptr<UINT16> m_k053936_0_linectrl;
- optional_shared_ptr<UINT16> m_k053936_0_ctrl_16;
- optional_shared_ptr<UINT16> m_k053936_0_linectrl_16;
- optional_shared_ptr<UINT32> m_konamigx_type3_psac2_bank;
optional_device<k056800_device> m_k056800;
optional_device<k054539_device> m_k054539_1;
optional_device<k054539_device> m_k054539_2;
- optional_ioport m_an0, m_an1, m_light0_x, m_light0_y, m_light1_x, m_light1_y, m_eepromout;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
+
+ optional_shared_ptr<UINT32> m_workram;
+ optional_shared_ptr<UINT32> m_psacram;
+ optional_shared_ptr<UINT32> m_subpaletteram32;
+ optional_shared_ptr<UINT16> m_k053936_0_ctrl;
+ optional_shared_ptr<UINT16> m_k053936_0_linectrl;
+ optional_shared_ptr<UINT16> m_k053936_0_ctrl_16;
+ optional_shared_ptr<UINT16> m_k053936_0_linectrl_16;
+ optional_shared_ptr<UINT32> m_konamigx_type3_psac2_bank;
optional_shared_ptr<UINT32> m_generic_paletteram_32;
+
+ optional_ioport m_an0, m_an1, m_light0_x, m_light0_y, m_light1_x, m_light1_y, m_eepromout;
DECLARE_WRITE32_MEMBER(esc_w);
DECLARE_WRITE32_MEMBER(eeprom_w);
@@ -166,23 +167,84 @@ public:
void fantjour_dma_install();
void konamigx_mixer_primode(int mode);
+
+ typedef void (konamigx_state::*esc_cb)(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4);
+
+ void tkmmpzdm_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4);
+ void dragoonj_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4);
+ void sal2_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4);
+ void sexyparo_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4);
+ void tbyahhoo_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4);
+ void daiskiss_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4);
+
+ inline int K053247GX_combine_c18(int attrib);
+ inline int K055555GX_decode_objcolor(int c18);
+ inline int K055555GX_decode_inpri(int c18);
+ int K055555GX_decode_vmixcolor(int layer, int *color);
UINT8 m_sound_ctrl;
UINT8 m_sound_intck;
UINT32 m_fantjour_dma[8];
int m_konamigx_current_frame;
int m_gx_objdma, m_gx_primode;
-};
-
+ emu_timer *m_dmadelay_timer;
+ emu_timer *m_boothack_timer;
+ int m_gx_rdport1_3, m_gx_syncen;
+ int m_gx_cfgport;
+ int m_suspension_active, m_resume_trigger;
+ int m_last_prot_op, m_last_prot_clk;
+
+ UINT8 m_esc_program[4096];
+ esc_cb m_esc_cb;
+
+ UINT16 m_prot_data[0x20];
+
+ // 1st-Tier GX/MW Variables
+ // frequently used registers
+ int m_k053247_vrcbk[4];
+ int m_k053247_coreg, m_k053247_coregshift, m_k053247_opset;
+ int m_opri, m_oinprion;
+ int m_vcblk[6], m_ocblk;
+ int m_vinmix, m_vmixon, m_osinmix, m_osmixon;
+ UINT8 m_gx_wrport1_0, m_gx_wrport1_1;
+ UINT16 m_gx_wrport2;
+
+ // 2nd-Tier GX/MW Graphics Variables
+ UINT8 *m_gx_objzbuf, *m_gx_shdzbuf;
+ int m_layer_colorbase[4];
+ INT32 m_gx_tilebanks[8], m_gx_oldbanks[8];
+ int m_gx_tilemode, m_gx_rozenable, m_psac_colorbase, m_last_psac_colorbase;
+ int m_gx_specialrozenable; // type 1 roz, with voxel height-map, rendered from 2 source tilemaps (which include height data) to temp bitmap for further processing
+ int m_gx_rushingheroes_hack;
+ int m_gx_le2_textcolour_hack;
+ tilemap_t *m_gx_psac_tilemap, *m_gx_psac_tilemap2;
+ bitmap_ind16 *m_type3_roz_temp_bitmap;
+ tilemap_t *m_gx_psac_tilemap_alt;
+ int m_konamigx_has_dual_screen;
+ int m_konamigx_palformat;
+ bitmap_rgb32 *m_dualscreen_left_tempbitmap;
+ bitmap_rgb32 *m_dualscreen_right_tempbitmap;
+
+ /* On Type-1 the K053936 output is rendered to these temporary bitmaps as raw data
+ the 'voxel' effect to give the pixels height is a post-process operation on the
+ output of the K053936 (this can clearly be seen in videos as large chunks of
+ scenary flicker when in the distance due to single pixels in the K053936 output
+ becoming visible / invisible due to drawing precision.
-/*----------- defined in video/konamigx.c -----------*/
+ -- however, progress on this has stalled as our K053936 doesn't seem to give
+ the right output for post processing, I suspect the game is using some
+ unsupported flipping modes (probably due to the way it's hooked up to the
+ rest of the chips) which is causing entirely the wrong output.
-
-// 1st-Tier GX/MW Variables and Functions
-extern UINT8 konamigx_wrport1_0, konamigx_wrport1_1;
-extern UINT16 konamigx_wrport2;
+ -- furthermore video/konamigx.c contains it's own implementation of
+ the K053936_zoom_draw named K053936GP_zoom_draw ...
+ */
+ bitmap_ind16 *m_gxtype1_roz_dstbitmap;
+ bitmap_ind16 *m_gxtype1_roz_dstbitmap2;
+ rectangle m_gxtype1_roz_dstbitmapclip;
+};
// Sprite Callbacks
diff --git a/src/mame/machine/konamigx.c b/src/mame/machine/konamigx.c
index f871c31257a..c88d08e90f3 100644
--- a/src/mame/machine/konamigx.c
+++ b/src/mame/machine/konamigx.c
@@ -41,13 +41,11 @@ Has word-wide registers as follows:
*/
// K055550/K053990 protection chips, perform simple memset() and other game logic operations
-static UINT16 prot_data[0x20];
-
READ16_MEMBER(konamigx_state::K055550_word_r)
{
- return(prot_data[offset]);
+ return(m_prot_data[offset]);
}
WRITE16_MEMBER(konamigx_state::K055550_word_w)
@@ -56,7 +54,7 @@ WRITE16_MEMBER(konamigx_state::K055550_word_w)
int src, tgt, srcend, tgtend, skip, cx1, sx1, wx1, cy1, sy1, wy1, cz1, sz1, wz1, c2, s2, w2;
int dx, dy, angle;
- COMBINE_DATA(prot_data+offset);
+ COMBINE_DATA(m_prot_data+offset);
if (offset == 0 && ACCESSING_BITS_8_15)
{
@@ -65,13 +63,13 @@ WRITE16_MEMBER(konamigx_state::K055550_word_w)
{
case 0x97: // memset() (Dadandarn at 0x639dc)
case 0x9f: // memset() (Violent Storm at 0x989c)
- adr = (prot_data[7] << 16) | prot_data[8];
- bsize = (prot_data[10] << 16) | prot_data[11];
- count = (prot_data[0] & 0xff) + 1;
+ adr = (m_prot_data[7] << 16) | m_prot_data[8];
+ bsize = (m_prot_data[10] << 16) | m_prot_data[11];
+ count = (m_prot_data[0] & 0xff) + 1;
lim = adr+bsize*count;
for(i=adr; i<lim; i+=2)
- space.write_word(i, prot_data[0x1a/2]);
+ space.write_word(i, m_prot_data[0x1a/2]);
break;
// WARNING: The following cases are speculation based with questionable accuracy!(AAT)
@@ -82,19 +80,19 @@ WRITE16_MEMBER(konamigx_state::K055550_word_w)
// gameplay. It refers to a 32x8-word list at 0x210e00 and seems to
// be tied with another 13x128-byte table at 0x205080.
// Both tables appear "check-only" and have little effect on gameplay.
- count =(prot_data[0] & 0xff) + 1; // unknown ( byte 0x00)
- i = prot_data[1]; // unknown ( byte 0x1f)
- adr = prot_data[7]<<16 | prot_data[8]; // address (dword 0x210e00)
- lim = prot_data[9]; // unknown ( word 0x0010)
- src = prot_data[10]<<16 | prot_data[11]; // unknown (dword zero)
- tgt = prot_data[12]<<16 | prot_data[13]; // unknown (dword zero)
+ count =(m_prot_data[0] & 0xff) + 1; // unknown ( byte 0x00)
+ i = m_prot_data[1]; // unknown ( byte 0x1f)
+ adr = m_prot_data[7]<<16 | m_prot_data[8]; // address (dword 0x210e00)
+ lim = m_prot_data[9]; // unknown ( word 0x0010)
+ src = m_prot_data[10]<<16 | m_prot_data[11]; // unknown (dword zero)
+ tgt = m_prot_data[12]<<16 | m_prot_data[13]; // unknown (dword zero)
break;
case 0xa0: // update collision detection table (Violent Storm at 0x018b42)
- count = prot_data[0] & 0xff; // number of objects - 1
- skip = prot_data[1]>>(8-1); // words to skip in each entry to reach the "hit list"
- adr = prot_data[2]<<16 | prot_data[3]; // where the table is located
- bsize = prot_data[5]<<16 | prot_data[6]; // object entry size in bytes
+ count = m_prot_data[0] & 0xff; // number of objects - 1
+ skip = m_prot_data[1]>>(8-1); // words to skip in each entry to reach the "hit list"
+ adr = m_prot_data[2]<<16 | m_prot_data[3]; // where the table is located
+ bsize = m_prot_data[5]<<16 | m_prot_data[6]; // object entry size in bytes
srcend = adr + bsize * count;
tgtend = srcend + bsize;
@@ -142,8 +140,8 @@ WRITE16_MEMBER(konamigx_state::K055550_word_w)
break;
case 0xc0: // calculate object "homes-in" vector (Violent Storm at 0x03da9e)
- dx = (short)prot_data[0xc];
- dy = (short)prot_data[0xd];
+ dx = (short)m_prot_data[0xc];
+ dy = (short)m_prot_data[0xd];
// it's not necessary to use lookup tables because Violent Storm
// only calls the service once per enemy per frame.
@@ -165,7 +163,7 @@ WRITE16_MEMBER(konamigx_state::K055550_word_w)
else
i = machine().rand() & 0xff; // vector direction indeterminate
- prot_data[0x10] = i;
+ m_prot_data[0x10] = i;
break;
default:
@@ -183,27 +181,27 @@ WRITE16_MEMBER(konamigx_state::K053990_martchmp_word_w)
int mode, i, element_size = 1;
UINT16 mod_val, mod_data;
- COMBINE_DATA(prot_data+offset);
+ COMBINE_DATA(m_prot_data+offset);
if (offset == 0x0c && ACCESSING_BITS_8_15)
{
- mode = (prot_data[0x0d]<<8 & 0xff00) | (prot_data[0x0f] & 0xff);
+ mode = (m_prot_data[0x0d]<<8 & 0xff00) | (m_prot_data[0x0f] & 0xff);
switch (mode)
{
case 0xffff: // word copy
element_size = 2;
case 0xff00: // byte copy
- src_addr = prot_data[0x0];
- src_addr |= prot_data[0x1]<<16 & 0xff0000;
- dst_addr = prot_data[0x2];
- dst_addr |= prot_data[0x3]<<16 & 0xff0000;
- src_count = prot_data[0x8]>>8;
- //dst_count = prot_data[0x9]>>8;
- src_skip = prot_data[0xa] & 0xff;
- dst_skip = prot_data[0xb] & 0xff;
-
- if ((prot_data[0x8] & 0xff) == 2) src_count <<= 1;
+ src_addr = m_prot_data[0x0];
+ src_addr |= m_prot_data[0x1]<<16 & 0xff0000;
+ dst_addr = m_prot_data[0x2];
+ dst_addr |= m_prot_data[0x3]<<16 & 0xff0000;
+ src_count = m_prot_data[0x8]>>8;
+ //dst_count = m_prot_data[0x9]>>8;
+ src_skip = m_prot_data[0xa] & 0xff;
+ dst_skip = m_prot_data[0xb] & 0xff;
+
+ if ((m_prot_data[0x8] & 0xff) == 2) src_count <<= 1;
src_skip += element_size;
dst_skip += element_size;
@@ -223,16 +221,16 @@ WRITE16_MEMBER(konamigx_state::K053990_martchmp_word_w)
break;
case 0x00ff: // sprite list modifier
- src_addr = prot_data[0x0];
- src_addr |= prot_data[0x1]<<16 & 0xff0000;
- src_skip = prot_data[0x1]>>8;
- dst_addr = prot_data[0x2];
- dst_addr |= prot_data[0x3]<<16 & 0xff0000;
- dst_skip = prot_data[0x3]>>8;
- mod_addr = prot_data[0x4];
- mod_addr |= prot_data[0x5]<<16 & 0xff0000;
- mod_skip = prot_data[0x5]>>8;
- mod_offs = prot_data[0x8] & 0xff;
+ src_addr = m_prot_data[0x0];
+ src_addr |= m_prot_data[0x1]<<16 & 0xff0000;
+ src_skip = m_prot_data[0x1]>>8;
+ dst_addr = m_prot_data[0x2];
+ dst_addr |= m_prot_data[0x3]<<16 & 0xff0000;
+ dst_skip = m_prot_data[0x3]>>8;
+ mod_addr = m_prot_data[0x4];
+ mod_addr |= m_prot_data[0x5]<<16 & 0xff0000;
+ mod_skip = m_prot_data[0x5]>>8;
+ mod_offs = m_prot_data[0x8] & 0xff;
mod_offs<<= 1;
mod_count = 0x100;
diff --git a/src/mame/video/konamigx.c b/src/mame/video/konamigx.c
index 1128d55655b..6886673f1d8 100644
--- a/src/mame/video/konamigx.c
+++ b/src/mame/video/konamigx.c
@@ -11,71 +11,8 @@
//#define GX_DEBUG
#define VERBOSE 0
-/***************************************************************************/
-/* */
-/* 2nd-Tier GX/MW Graphics Functions */
-/* */
-/***************************************************************************/
-
-
-static UINT8 *gx_objzbuf, *gx_shdzbuf;
-
-
-
-static int layer_colorbase[4];
-static INT32 gx_tilebanks[8], gx_oldbanks[8];
-static int gx_tilemode, gx_rozenable, psac_colorbase, last_psac_colorbase;
-static int gx_specialrozenable; // type 1 roz, with voxel height-map, rendered from 2 source tilemaps (which include height data) to temp bitmap for further processing
-static int gx_rushingheroes_hack;
-static int gx_le2_textcolour_hack;
-static tilemap_t *gx_psac_tilemap, *gx_psac_tilemap2;
-static bitmap_ind16* type3_roz_temp_bitmap;
-static tilemap_t* gx_psac_tilemap_alt;
-
-static int konamigx_has_dual_screen;
INLINE void set_color_555(palette_device &palette, pen_t color, int rshift, int gshift, int bshift, UINT16 data);
-static int konamigx_palformat;
-static bitmap_rgb32* dualscreen_left_tempbitmap;
-static bitmap_rgb32* dualscreen_right_tempbitmap;
-
-/* On Type-1 the K053936 output is rendered to these temporary bitmaps as raw data
- the 'voxel' effect to give the pixels height is a post-process operation on the
- output of the K053936 (this can clearly be seen in videos as large chunks of
- scenary flicker when in the distance due to single pixels in the K053936 output
- becoming visible / invisible due to drawing precision.
-
- -- however, progress on this has stalled as our K053936 doesn't seem to give
- the right output for post processing, I suspect the game is using some
- unsupported flipping modes (probably due to the way it's hooked up to the
- rest of the chips) which is causing entirely the wrong output.
-
- -- furthermore machine/konamigx.c (!) contains it's own implementation of
- the K053936_zoom_draw named K053936GP_zoom_draw ... It really shouldn't do,
- epsecially not in 'machine', which isn't meant to be video related.
-
-
- */
-static bitmap_ind16 *gxtype1_roz_dstbitmap;
-static bitmap_ind16 *gxtype1_roz_dstbitmap2;
-static rectangle gxtype1_roz_dstbitmapclip;
-
-/***************************************************************************/
-/* */
-/* 1st-Tier GX/MW Variables and Functions */
-/* */
-/***************************************************************************/
-
-// global system ports access
-UINT8 konamigx_wrport1_0, konamigx_wrport1_1;
-UINT16 konamigx_wrport2;
-
-// frequently used registers
-static int k053247_vrcbk[4];
-static int k053247_coreg, k053247_coregshift, k053247_opset;
-static int opri, oinprion;
-static int vcblk[6], ocblk;
-static int vinmix, vmixon, osinmix, osmixon;
void konamigx_state::konamigx_precache_registers(void)
@@ -86,68 +23,68 @@ void konamigx_state::konamigx_precache_registers(void)
int i;
i = m_k055673->k053247_read_register(0x8/2);
- k053247_vrcbk[0] = (i & 0x000f) << 14;
- k053247_vrcbk[1] = (i & 0x0f00) << 6;
+ m_k053247_vrcbk[0] = (i & 0x000f) << 14;
+ m_k053247_vrcbk[1] = (i & 0x0f00) << 6;
i = m_k055673->k053247_read_register(0xa/2);
- k053247_vrcbk[2] = (i & 0x000f) << 14;
- k053247_vrcbk[3] = (i & 0x0f00) << 6;
+ m_k053247_vrcbk[2] = (i & 0x000f) << 14;
+ m_k053247_vrcbk[3] = (i & 0x0f00) << 6;
// COREG == OBJSET2+1C == bit8-11 of OPSET ??? (see p.50 last table, needs p.49 to confirm)
- k053247_opset = m_k055673->k053247_read_register(0xc/2);
-
- i = k053247_opset & 7; if (i > 4) i = 4;
-
- k053247_coreg = m_k055673->k053247_read_register(0xc/2)>>8 & 0xf;
- k053247_coreg =(k053247_coreg & coregmasks[i]) << 12;
-
- k053247_coregshift = coregshifts[i];
-
- opri = m_k055555->K055555_read_register(K55_PRIINP_8);
- oinprion = m_k055555->K055555_read_register(K55_OINPRI_ON);
- vcblk[0] = m_k055555->K055555_read_register(K55_PALBASE_A);
- vcblk[1] = m_k055555->K055555_read_register(K55_PALBASE_B);
- vcblk[2] = m_k055555->K055555_read_register(K55_PALBASE_C);
- vcblk[3] = m_k055555->K055555_read_register(K55_PALBASE_D);
- vcblk[4] = m_k055555->K055555_read_register(K55_PALBASE_SUB1);
- vcblk[5] = m_k055555->K055555_read_register(K55_PALBASE_SUB2);
- ocblk = m_k055555->K055555_read_register(K55_PALBASE_OBJ);
- vinmix = m_k055555->K055555_read_register(K55_BLEND_ENABLES);
- vmixon = m_k055555->K055555_read_register(K55_VINMIX_ON);
- osinmix = m_k055555->K055555_read_register(K55_OSBLEND_ENABLES);
- osmixon = m_k055555->K055555_read_register(K55_OSBLEND_ON);
+ m_k053247_opset = m_k055673->k053247_read_register(0xc/2);
+
+ i = m_k053247_opset & 7; if (i > 4) i = 4;
+
+ m_k053247_coreg = m_k055673->k053247_read_register(0xc/2)>>8 & 0xf;
+ m_k053247_coreg =(m_k053247_coreg & coregmasks[i]) << 12;
+
+ m_k053247_coregshift = coregshifts[i];
+
+ m_opri = m_k055555->K055555_read_register(K55_PRIINP_8);
+ m_oinprion = m_k055555->K055555_read_register(K55_OINPRI_ON);
+ m_vcblk[0] = m_k055555->K055555_read_register(K55_PALBASE_A);
+ m_vcblk[1] = m_k055555->K055555_read_register(K55_PALBASE_B);
+ m_vcblk[2] = m_k055555->K055555_read_register(K55_PALBASE_C);
+ m_vcblk[3] = m_k055555->K055555_read_register(K55_PALBASE_D);
+ m_vcblk[4] = m_k055555->K055555_read_register(K55_PALBASE_SUB1);
+ m_vcblk[5] = m_k055555->K055555_read_register(K55_PALBASE_SUB2);
+ m_ocblk = m_k055555->K055555_read_register(K55_PALBASE_OBJ);
+ m_vinmix = m_k055555->K055555_read_register(K55_BLEND_ENABLES);
+ m_vmixon = m_k055555->K055555_read_register(K55_VINMIX_ON);
+ m_osinmix = m_k055555->K055555_read_register(K55_OSBLEND_ENABLES);
+ m_osmixon = m_k055555->K055555_read_register(K55_OSBLEND_ON);
}
-INLINE int K053247GX_combine_c18(int attrib) // (see p.46)
+inline int konamigx_state::K053247GX_combine_c18(int attrib) // (see p.46)
{
int c18;
- c18 = (attrib & 0xff)<<k053247_coregshift | k053247_coreg;
+ c18 = (attrib & 0xff)<<m_k053247_coregshift | m_k053247_coreg;
- if (konamigx_wrport2 & 4) c18 &= 0x3fff; else
- if (!(konamigx_wrport2 & 8)) c18 = (c18 & 0x3fff) | (attrib<<6 & 0xc000);
+ if (m_gx_wrport2 & 4) c18 &= 0x3fff; else
+ if (!(m_gx_wrport2 & 8)) c18 = (c18 & 0x3fff) | (attrib<<6 & 0xc000);
return(c18);
}
-INLINE int K055555GX_decode_objcolor(int c18) // (see p.59 7.2.2)
+inline int konamigx_state::K055555GX_decode_objcolor(int c18) // (see p.59 7.2.2)
{
int ocb, opon;
- opon = oinprion<<8 | 0xff;
- ocb = (ocblk & 7) << 10;
+ opon = m_oinprion<<8 | 0xff;
+ ocb = (m_ocblk & 7) << 10;
c18 &= opon;
ocb &=~opon;
- return((ocb | c18) >> k053247_coregshift);
+ return((ocb | c18) >> m_k053247_coregshift);
}
-INLINE int K055555GX_decode_inpri(int c18) // (see p.59 7.2.2)
+inline int konamigx_state::K055555GX_decode_inpri(int c18) // (see p.59 7.2.2)
{
- int op = opri;
+ int op = m_opri;
c18 >>= 8;
- op &= oinprion;
- c18 &=~oinprion;
+ op &= m_oinprion;
+ c18 &=~m_oinprion;
return(c18 | op);
}
@@ -157,7 +94,7 @@ K055673_CB_MEMBER(konamigx_state::type2_sprite_callback)
int num = *code;
int c18 = *color;
- *code = k053247_vrcbk[num>>14] | (num & 0x3fff);
+ *code = m_k053247_vrcbk[num>>14] | (num & 0x3fff);
c18 = K053247GX_combine_c18(c18);
*color = K055555GX_decode_objcolor(c18);
*priority_mask = K055555GX_decode_inpri(c18);
@@ -168,13 +105,13 @@ K055673_CB_MEMBER(konamigx_state::dragoonj_sprite_callback)
int num, op, pri, c18;
num = *code;
- *code = k053247_vrcbk[num>>14] | (num & 0x3fff);
+ *code = m_k053247_vrcbk[num>>14] | (num & 0x3fff);
c18 = pri = *color;
- op = opri;
+ op = m_opri;
pri = (pri & 0x200) ? 4 : pri>>4 & 0xf;
- op &= oinprion;
- pri &=~oinprion;
+ op &= m_oinprion;
+ pri &=~m_oinprion;
*priority_mask = pri | op;
c18 = K053247GX_combine_c18(c18);
@@ -186,13 +123,13 @@ K055673_CB_MEMBER(konamigx_state::salmndr2_sprite_callback)
int num, op, pri, c18;
num = *code;
- *code = k053247_vrcbk[num>>14] | (num & 0x3fff);
+ *code = m_k053247_vrcbk[num>>14] | (num & 0x3fff);
c18 = pri = *color;
- op = opri;
+ op = m_opri;
pri = pri>>4 & 0x3f;
- op &= oinprion;
- pri &=~oinprion;
+ op &= m_oinprion;
+ pri &=~m_oinprion;
*priority_mask = pri | op;
c18 = K053247GX_combine_c18(c18);
@@ -204,27 +141,27 @@ K055673_CB_MEMBER(konamigx_state::le2_sprite_callback)
int num, op, pri;
num = *code;
- *code = k053247_vrcbk[num>>14] | (num & 0x3fff);
+ *code = m_k053247_vrcbk[num>>14] | (num & 0x3fff);
pri = *color;
*color &= 0x1f;
- op = opri;
+ op = m_opri;
pri &= 0xf0;
- op &= oinprion;
- pri &=~oinprion;
+ op &= m_oinprion;
+ pri &=~m_oinprion;
*priority_mask = pri | op;
}
-static int K055555GX_decode_vmixcolor(int layer, int *color) // (see p.62 7.2.6 and p.27 3.3)
+int konamigx_state::K055555GX_decode_vmixcolor(int layer, int *color) // (see p.62 7.2.6 and p.27 3.3)
{
int vcb, shift, pal, vmx, von, pl45, emx;
- vcb = vcblk[layer]<<6;
+ vcb = m_vcblk[layer]<<6;
shift = layer<<1;
pal = *color;
- vmx = vinmix>>shift & 3;
- von = vmixon>>shift & 3;
+ vmx = m_vinmix>>shift & 3;
+ von = m_vmixon>>shift & 3;
emx = pl45 = pal>>4 & 3;
pal &= 0xf;
pl45 &= von;
@@ -235,7 +172,7 @@ static int K055555GX_decode_vmixcolor(int layer, int *color) // (see p.62 7.2.6
emx |= vmx;
pal |= vcb;
- if (gx_le2_textcolour_hack)
+ if (m_gx_le2_textcolour_hack)
if (layer==0)
pal |= 0x1c0;
@@ -252,13 +189,13 @@ int K055555GX_decode_osmixcolor(int layer, int *color) // (see p.63, p.49-50 and
shift = layer<<1;
pal = *color;
- osmx = osinmix>>shift & 3;
- oson = osmixon>>shift & 3;
+ osmx = m_osinmix>>shift & 3;
+ oson = m_osmixon>>shift & 3;
if (layer)
{
// layer 1-3 are external tile layers
- scb = vcblk[layer+3]<<6;
+ scb = m_vcblk[layer+3]<<6;
emx = pl45 = pal>>4 & 3;
pal &= 0xf;
pl45 &= oson;
@@ -292,14 +229,14 @@ void konamigx_state::wipezbuf(int noshadow)
int w = visarea.width();
int h = visarea.height();
- UINT8 *zptr = gx_objzbuf;
+ UINT8 *zptr = m_gx_objzbuf;
int ecx = h;
do { memset(zptr, -1, w); zptr += GX_ZBUFW; } while (--ecx);
if (!noshadow)
{
- zptr = gx_shdzbuf;
+ zptr = m_gx_shdzbuf;
w <<= 1;
ecx = h;
do { memset(zptr, -1, w); zptr += (GX_ZBUFW<<1); } while (--ecx);
@@ -350,8 +287,8 @@ void konamigx_state::konamigx_mixer_init(screen_device &screen, int objdma)
m_gx_objdma = 0;
m_gx_primode = 0;
- gx_objzbuf = &screen.priority().pix8(0);
- gx_shdzbuf = auto_alloc_array(machine(), UINT8, GX_ZBUFSIZE);
+ m_gx_objzbuf = &screen.priority().pix8(0);
+ m_gx_shdzbuf = auto_alloc_array(machine(), UINT8, GX_ZBUFSIZE);
gx_objpool = auto_alloc_array(machine(), struct GX_OBJ, GX_MAX_OBJECTS);
m_k054338->export_config(&K054338_shdRGB);
@@ -393,14 +330,14 @@ void konamigx_state::konamigx_mixer(screen_device &screen, bitmap_rgb32 &bitmap,
int cltc_shdpri, /*prflp,*/ disp;
// buffer can move when it's resized, so refresh the pointer
- gx_objzbuf = &screen.priority().pix8(0);
+ m_gx_objzbuf = &screen.priority().pix8(0);
// abort if object database failed to initialize
objpool = gx_objpool;
if (!objpool) return;
// clear screen with backcolor and update flicker pulse
- if (konamigx_wrport1_0 & 0x20)
+ if (m_gx_wrport1_0 & 0x20)
m_k054338->fill_backcolor(bitmap,
cliprect,
m_palette->pens() + (m_k055555->K055555_read_register(0) << 9),
@@ -564,7 +501,7 @@ void konamigx_state::konamigx_mixer(screen_device &screen, bitmap_rgb32 &bitmap,
int zcode = gx_spriteram[offs] & 0xff;
// invert z-order when opset_pri is set (see p.51 OPSET PRI)
- if (k053247_opset & 0x10) zcode = 0xff - zcode;
+ if (m_k053247_opset & 0x10) zcode = 0xff - zcode;
int code = gx_spriteram[offs+1];
int color = k = gx_spriteram[offs+6];
@@ -635,7 +572,7 @@ void konamigx_state::konamigx_mixer(screen_device &screen, bitmap_rgb32 &bitmap,
if (temp3)
{
// determine shadow priority
- spri = (k053247_opset & 0x20) ? pri : shdpri[shadow]; // (see p.51 OPSET SDSEL)
+ spri = (m_k053247_opset & 0x20) ? pri : shdpri[shadow]; // (see p.51 OPSET SDSEL)
}
}
@@ -732,13 +669,13 @@ void konamigx_state::gx_draw_basic_tilemaps(screen_device &screen, bitmap_rgb32
if (j == GXMIX_BLEND_FORCE) { temp1 = 0x00; temp2 = mixerflags>>(i+16); temp3 = 3; }
else
{
- temp1 = vinmix;
- temp2 = vinmix>>i & 3;
- temp3 = vmixon>>i & 3;
+ temp1 = m_vinmix;
+ temp2 = m_vinmix>>i & 3;
+ temp3 = m_vmixon>>i & 3;
}
/* blend layer only when:
- 1) vinmix != 0xff
+ 1) m_vinmix != 0xff
2) its internal mix code is set
3) all mix code bits are internal(overriden until tile blending has been implemented)
4) 0 > alpha < 255;
@@ -775,9 +712,9 @@ void konamigx_state::gx_draw_basic_extended_tilemaps_1(screen_device &screen, bi
if (j == GXMIX_BLEND_FORCE) { temp1 = 0x00; temp2 = mixerflags>>24; temp3 = 3; }
else
{
- temp1 = osinmix;
- temp2 = osinmix>>2 & 3;
- temp3 = osmixon>>2 & 3;
+ temp1 = m_osinmix;
+ temp2 = m_osinmix>>2 & 3;
+ temp3 = m_osmixon>>2 & 3;
}
if (temp1!=0xff && temp2 /*&& temp3==3*/)
@@ -803,7 +740,7 @@ void konamigx_state::gx_draw_basic_extended_tilemaps_1(screen_device &screen, bi
}
else
{
- machine().device<k053250_device>("k053250_1")->draw(bitmap, cliprect, vcblk[4]<<l, 0, screen.priority(), 0);
+ machine().device<k053250_device>("k053250_1")->draw(bitmap, cliprect, m_vcblk[4]<<l, 0, screen.priority(), 0);
}
}
}
@@ -825,9 +762,9 @@ void konamigx_state::gx_draw_basic_extended_tilemaps_2(screen_device &screen, bi
if (j == GXMIX_BLEND_FORCE) { temp1 = 0x00; temp2 = mixerflags>>26; temp3 = 3; }
else
{
- temp1 = osinmix;
- temp2 = osinmix>>4 & 3;
- temp3 = osmixon>>4 & 3;
+ temp1 = m_osinmix;
+ temp2 = m_osinmix>>4 & 3;
+ temp3 = m_osmixon>>4 & 3;
}
if (temp1!=0xff && temp2 /*&& temp3==3*/)
@@ -875,7 +812,7 @@ void konamigx_state::gx_draw_basic_extended_tilemaps_2(screen_device &screen, bi
}
}
else
- machine().device<k053250_device>("k053250_2")->draw(bitmap, cliprect, vcblk[5]<<l, 0, screen.priority(), 0);
+ machine().device<k053250_device>("k053250_2")->draw(bitmap, cliprect, m_vcblk[5]<<l, 0, screen.priority(), 0);
}
}
@@ -932,7 +869,7 @@ void konamigx_state::konamigx_mixer_draw(screen_device &screen, bitmap_rgb32 &bi
m_k055673->k053247_draw_single_sprite_gxcore(bitmap, cliprect,
- gx_objzbuf, gx_shdzbuf, code, gx_spriteram, offs,
+ m_gx_objzbuf, m_gx_shdzbuf, code, gx_spriteram, offs,
color, alpha, drawmode, zcode, pri,
/* non-gx only */
0,0,NULL,NULL,0
@@ -985,7 +922,7 @@ TILE_GET_INFO_MEMBER(konamigx_state::get_gx_psac_tile_info)
}
- colour = (psac_colorbase << 4) + col;
+ colour = (m_psac_colorbase << 4) + col;
SET_TILE_INFO_MEMBER(0, tileno, colour, TILE_FLIPYX(flip));
}
@@ -1003,7 +940,7 @@ WRITE32_MEMBER(konamigx_state::konamigx_type3_psac2_bank_w)
/* handle this by creating 2 roz tilemaps instead, otherwise performance dies completely on dual screen mode
if (konamigx_type3_psac2_actual_bank!=konamigx_type3_psac2_actual_last_bank)
{
- gx_psac_tilemap->mark_all_dirty();
+ m_gx_psac_tilemap->mark_all_dirty();
konamigx_type3_psac2_actual_last_bank = konamigx_type3_psac2_actual_bank;
}
*/
@@ -1106,7 +1043,7 @@ K056832_CB_MEMBER(konamigx_state::type2_tile_callback)
{
int d = *code;
- *code = (gx_tilebanks[(d & 0xe000)>>13]<<13) + (d & 0x1fff);
+ *code = (m_gx_tilebanks[(d & 0xe000)>>13]<<13) + (d & 0x1fff);
K055555GX_decode_vmixcolor(layer, color);
}
@@ -1118,7 +1055,7 @@ K056832_CB_MEMBER(konamigx_state::alpha_tile_callback)
mixcode = K055555GX_decode_vmixcolor(layer, color);
if (mixcode < 0)
- *code = (gx_tilebanks[(d & 0xe000)>>13]<<13) + (d & 0x1fff);
+ *code = (m_gx_tilebanks[(d & 0xe000)>>13]<<13) + (d & 0x1fff);
else
{
/* save mixcode and mark tile alpha (unimplemented) */
@@ -1165,17 +1102,17 @@ void konamigx_state::common_init()
for (int i = 0; i < 8; i++)
{
- gx_tilebanks[i] = gx_oldbanks[i] = 0;
+ m_gx_tilebanks[i] = m_gx_oldbanks[i] = 0;
}
- machine().save().save_item(NAME(gx_tilebanks));
+ machine().save().save_item(NAME(m_gx_tilebanks));
- gx_tilemode = 0;
+ m_gx_tilemode = 0;
- gx_rozenable = 0;
- gx_specialrozenable = 0;
- gx_rushingheroes_hack = 0;
- gx_le2_textcolour_hack = 0;
+ m_gx_rozenable = 0;
+ m_gx_specialrozenable = 0;
+ m_gx_rushingheroes_hack = 0;
+ m_gx_le2_textcolour_hack = 0;
// Documented relative offsets of non-flipped games are (-2, 0, 2, 3),(0, 0, 0, 0).
// (+ve values move layers to the right and -ve values move layers to the left)
@@ -1187,7 +1124,7 @@ void konamigx_state::common_init()
m_k056832->set_layer_offs(2, 2, 0);
m_k056832->set_layer_offs(3, 3, 0);
- konamigx_has_dual_screen = 0;
+ m_konamigx_has_dual_screen = 0;
m_konamigx_current_frame = 0;
}
@@ -1197,7 +1134,7 @@ VIDEO_START_MEMBER(konamigx_state, konamigx_5bpp)
common_init();
if (!strcmp(machine().system().name,"tbyahhoo"))
- gx_tilemode = 1;
+ m_gx_tilemode = 1;
else if (!strcmp(machine().system().name,"crzcross") || !strcmp(machine().system().name,"puzldama"))
konamigx_mixer_primode(5);
else if (!strcmp(machine().system().name,"daiskiss"))
@@ -1220,7 +1157,7 @@ VIDEO_START_MEMBER(konamigx_state, le2)
konamigx_mixer_primode(-1); // swapped layer B and C priorities?
- gx_le2_textcolour_hack = 1; // force text layer to use the right palette
+ m_gx_le2_textcolour_hack = 1; // force text layer to use the right palette
}
VIDEO_START_MEMBER(konamigx_state, konamigx_6bpp)
@@ -1234,23 +1171,23 @@ VIDEO_START_MEMBER(konamigx_state, konamigx_type3)
int width = m_screen->width();
int height = m_screen->height();
- dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height);
- dualscreen_right_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height);
+ m_dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height);
+ m_dualscreen_right_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height);
common_init();
- gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac3_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 256, 256);
- gx_psac_tilemap_alt = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac3_alt_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 256, 256);
+ m_gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac3_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 256, 256);
+ m_gx_psac_tilemap_alt = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac3_alt_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 256, 256);
- gx_rozenable = 0;
- gx_specialrozenable = 2;
+ m_gx_rozenable = 0;
+ m_gx_specialrozenable = 2;
/* set up tile layers */
- type3_roz_temp_bitmap = auto_bitmap_ind16_alloc(machine(), width, height);
+ m_type3_roz_temp_bitmap = auto_bitmap_ind16_alloc(machine(), width, height);
- //gx_psac_tilemap->set_flip(TILEMAP_FLIPX| TILEMAP_FLIPY);
+ //m_gx_psac_tilemap->set_flip(TILEMAP_FLIPX| TILEMAP_FLIPY);
K053936_wraparound_enable(0, 1);
// K053936GP_set_offset(0, -30, -1);
@@ -1261,8 +1198,8 @@ VIDEO_START_MEMBER(konamigx_state, konamigx_type3)
m_k056832->set_layer_offs(2, -48, 0);
m_k056832->set_layer_offs(3, -48, 0);
- konamigx_has_dual_screen = 1;
- konamigx_palformat = 1;
+ m_konamigx_has_dual_screen = 1;
+ m_konamigx_palformat = 1;
}
VIDEO_START_MEMBER(konamigx_state, konamigx_type4)
@@ -1270,14 +1207,14 @@ VIDEO_START_MEMBER(konamigx_state, konamigx_type4)
int width = m_screen->width();
int height = m_screen->height();
- dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height);
- dualscreen_right_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height);
+ m_dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height);
+ m_dualscreen_right_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height);
common_init();
- gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128);
- gx_rozenable = 0;
- gx_specialrozenable = 3;
+ m_gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128);
+ m_gx_rozenable = 0;
+ m_gx_specialrozenable = 3;
m_k056832->set_layer_offs(0, -27, 0);
m_k056832->set_layer_offs(1, -25, 0);
@@ -1287,9 +1224,9 @@ VIDEO_START_MEMBER(konamigx_state, konamigx_type4)
K053936_wraparound_enable(0, 0);
K053936GP_set_offset(0, -36, 1);
- gx_rushingheroes_hack = 1;
- konamigx_has_dual_screen = 1;
- konamigx_palformat = 0;
+ m_gx_rushingheroes_hack = 1;
+ m_konamigx_has_dual_screen = 1;
+ m_konamigx_palformat = 0;
}
@@ -1298,14 +1235,14 @@ VIDEO_START_MEMBER(konamigx_state, konamigx_type4_vsn)
int width = m_screen->width();
int height = m_screen->height();
- dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height);
- dualscreen_right_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height);
+ m_dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height);
+ m_dualscreen_right_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height);
common_init();
- gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128);
- gx_rozenable = 0;
- gx_specialrozenable = 3;
+ m_gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128);
+ m_gx_rozenable = 0;
+ m_gx_specialrozenable = 3;
m_k056832->set_layer_offs(0, -52, 0);
m_k056832->set_layer_offs(1, -48, 0);
@@ -1315,9 +1252,9 @@ VIDEO_START_MEMBER(konamigx_state, konamigx_type4_vsn)
K053936_wraparound_enable(0, 1); // wraparound doesn't work properly with the custom drawing function anyway, see the crowd in vsnet and rushhero
K053936GP_set_offset(0, -30, 0);
- gx_rushingheroes_hack = 1;
- konamigx_has_dual_screen = 1;
- konamigx_palformat = 0;
+ m_gx_rushingheroes_hack = 1;
+ m_konamigx_has_dual_screen = 1;
+ m_konamigx_palformat = 0;
}
VIDEO_START_MEMBER(konamigx_state, konamigx_type4_sd2)
@@ -1325,14 +1262,14 @@ VIDEO_START_MEMBER(konamigx_state, konamigx_type4_sd2)
int width = m_screen->width();
int height = m_screen->height();
- dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height);
- dualscreen_right_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height);
+ m_dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height);
+ m_dualscreen_right_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height);
common_init();
- gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128);
- gx_rozenable = 0;
- gx_specialrozenable = 3;
+ m_gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128);
+ m_gx_rozenable = 0;
+ m_gx_specialrozenable = 3;
m_k056832->set_layer_offs(0, -29, -1);
@@ -1344,9 +1281,9 @@ VIDEO_START_MEMBER(konamigx_state, konamigx_type4_sd2)
K053936_wraparound_enable(0, 0);
K053936GP_set_offset(0, -36, -1);
- gx_rushingheroes_hack = 1;
- konamigx_has_dual_screen = 1;
- konamigx_palformat = 0;
+ m_gx_rushingheroes_hack = 1;
+ m_konamigx_has_dual_screen = 1;
+ m_konamigx_palformat = 0;
}
@@ -1359,21 +1296,21 @@ VIDEO_START_MEMBER(konamigx_state, opengolf)
m_k056832->set_layer_offs(2, 2+1, 0);
m_k056832->set_layer_offs(3, 3+1, 0);
- gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac1a_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128);
- gx_psac_tilemap2 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac1b_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128);
+ m_gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac1a_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128);
+ m_gx_psac_tilemap2 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac1b_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128);
// transparency will be handled manually in post-processing
- //gx_psac_tilemap->set_transparent_pen(0);
- //gx_psac_tilemap2->set_transparent_pen(0);
+ //m_gx_psac_tilemap->set_transparent_pen(0);
+ //m_gx_psac_tilemap2->set_transparent_pen(0);
- gx_rozenable = 0;
- gx_specialrozenable = 1;
+ m_gx_rozenable = 0;
+ m_gx_specialrozenable = 1;
- gxtype1_roz_dstbitmap = auto_bitmap_ind16_alloc(machine(),512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing
- gxtype1_roz_dstbitmap2 = auto_bitmap_ind16_alloc(machine(),512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing
+ m_gxtype1_roz_dstbitmap = auto_bitmap_ind16_alloc(machine(),512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing
+ m_gxtype1_roz_dstbitmap2 = auto_bitmap_ind16_alloc(machine(),512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing
- gxtype1_roz_dstbitmapclip.set(0, 512-1, 0, 512-1);
+ m_gxtype1_roz_dstbitmapclip.set(0, 512-1, 0, 512-1);
K053936_wraparound_enable(0, 1);
@@ -1394,21 +1331,21 @@ VIDEO_START_MEMBER(konamigx_state, racinfrc)
m_k056832->set_layer_offs(2, 2+1, 0);
m_k056832->set_layer_offs(3, 3+1, 0);
- gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac1a_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128);
- gx_psac_tilemap2 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac1b_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128);
+ m_gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac1a_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128);
+ m_gx_psac_tilemap2 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac1b_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128);
// transparency will be handled manually in post-processing
- //gx_psac_tilemap->set_transparent_pen(0);
- //gx_psac_tilemap2->set_transparent_pen(0);
+ //m_gx_psac_tilemap->set_transparent_pen(0);
+ //m_gx_psac_tilemap2->set_transparent_pen(0);
- gx_rozenable = 0;
- gx_specialrozenable = 1;
+ m_gx_rozenable = 0;
+ m_gx_specialrozenable = 1;
- gxtype1_roz_dstbitmap = auto_bitmap_ind16_alloc(machine(),512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing
- gxtype1_roz_dstbitmap2 = auto_bitmap_ind16_alloc(machine(),512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing
+ m_gxtype1_roz_dstbitmap = auto_bitmap_ind16_alloc(machine(),512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing
+ m_gxtype1_roz_dstbitmap2 = auto_bitmap_ind16_alloc(machine(),512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing
- gxtype1_roz_dstbitmapclip.set(0, 512-1, 0, 512-1);
+ m_gxtype1_roz_dstbitmapclip.set(0, 512-1, 0, 512-1);
K053936_wraparound_enable(0, 1);
@@ -1428,20 +1365,20 @@ UINT32 konamigx_state::screen_update_konamigx(screen_device &screen, bitmap_rgb3
/* if any banks are different from last render, we need to flush the planes */
for (dirty = 0, i = 0; i < 8; i++)
{
- newbank = gx_tilebanks[i];
- if (gx_oldbanks[i] != newbank) { gx_oldbanks[i] = newbank; dirty = 1; }
+ newbank = m_gx_tilebanks[i];
+ if (m_gx_oldbanks[i] != newbank) { m_gx_oldbanks[i] = newbank; dirty = 1; }
}
- if (gx_tilemode == 0)
+ if (m_gx_tilemode == 0)
{
// driver approximates tile update in mode 0 for speed
unchained = m_k056832->get_layer_association();
for (i=0; i<4; i++)
{
newbase = m_k055555->K055555_get_palette_index(i)<<6;
- if (layer_colorbase[i] != newbase)
+ if (m_layer_colorbase[i] != newbase)
{
- layer_colorbase[i] = newbase;
+ m_layer_colorbase[i] = newbase;
if (unchained)
m_k056832->mark_plane_dirty(i);
@@ -1456,17 +1393,17 @@ UINT32 konamigx_state::screen_update_konamigx(screen_device &screen, bitmap_rgb3
}
// sub2 is PSAC colorbase on GX
- if (gx_rozenable)
+ if (m_gx_rozenable)
{
- last_psac_colorbase = psac_colorbase;
- psac_colorbase = m_k055555->K055555_get_palette_index(6);
+ m_last_psac_colorbase = m_psac_colorbase;
+ m_psac_colorbase = m_k055555->K055555_get_palette_index(6);
- if (psac_colorbase != last_psac_colorbase)
+ if (m_psac_colorbase != m_last_psac_colorbase)
{
- gx_psac_tilemap->mark_all_dirty();
- if (gx_rozenable == 3)
+ m_gx_psac_tilemap->mark_all_dirty();
+ if (m_gx_rozenable == 3)
{
- gx_psac_tilemap2->mark_all_dirty();
+ m_gx_psac_tilemap2->mark_all_dirty();
}
}
}
@@ -1474,42 +1411,42 @@ UINT32 konamigx_state::screen_update_konamigx(screen_device &screen, bitmap_rgb3
if (dirty) m_k056832->mark_all_tilemaps_dirty();
// Type-1
- if (gx_specialrozenable == 1)
+ if (m_gx_specialrozenable == 1)
{
- K053936_0_zoom_draw(screen, *gxtype1_roz_dstbitmap, gxtype1_roz_dstbitmapclip,gx_psac_tilemap, 0,0,0); // height data
- K053936_0_zoom_draw(screen, *gxtype1_roz_dstbitmap2,gxtype1_roz_dstbitmapclip,gx_psac_tilemap2,0,0,0); // colour data (+ some voxel height data?)
+ K053936_0_zoom_draw(screen, *m_gxtype1_roz_dstbitmap, m_gxtype1_roz_dstbitmapclip,m_gx_psac_tilemap, 0,0,0); // height data
+ K053936_0_zoom_draw(screen, *m_gxtype1_roz_dstbitmap2,m_gxtype1_roz_dstbitmapclip,m_gx_psac_tilemap2,0,0,0); // colour data (+ some voxel height data?)
}
- if (gx_specialrozenable==3)
+ if (m_gx_specialrozenable==3)
{
- konamigx_mixer(screen, bitmap, cliprect, gx_psac_tilemap, GXSUB_8BPP,0,0, 0, 0, gx_rushingheroes_hack);
+ konamigx_mixer(screen, bitmap, cliprect, m_gx_psac_tilemap, GXSUB_8BPP,0,0, 0, 0, m_gx_rushingheroes_hack);
}
// hack, draw the roz tilemap if W is held
// todo: fix so that it works with the mixer without crashing(!)
- else if (gx_specialrozenable == 2)
+ else if (m_gx_specialrozenable == 2)
{
// we're going to throw half of this away anyway in post-process, so only render what's needed
rectangle temprect;
temprect = cliprect;
temprect.max_x = cliprect.min_x+320;
- if (konamigx_type3_psac2_actual_bank == 1) K053936_0_zoom_draw(screen, *type3_roz_temp_bitmap, temprect,gx_psac_tilemap_alt, 0,0,0); // soccerss playfield
- else K053936_0_zoom_draw(screen, *type3_roz_temp_bitmap, temprect,gx_psac_tilemap, 0,0,0); // soccerss playfield
+ if (konamigx_type3_psac2_actual_bank == 1) K053936_0_zoom_draw(screen, *m_type3_roz_temp_bitmap, temprect,m_gx_psac_tilemap_alt, 0,0,0); // soccerss playfield
+ else K053936_0_zoom_draw(screen, *m_type3_roz_temp_bitmap, temprect,m_gx_psac_tilemap, 0,0,0); // soccerss playfield
- konamigx_mixer(screen, bitmap, cliprect, 0, 0, 0, 0, 0, type3_roz_temp_bitmap, gx_rushingheroes_hack);
+ konamigx_mixer(screen, bitmap, cliprect, 0, 0, 0, 0, 0, m_type3_roz_temp_bitmap, m_gx_rushingheroes_hack);
}
else
{
- konamigx_mixer(screen, bitmap, cliprect, 0, 0, 0, 0, 0, 0, gx_rushingheroes_hack);
+ konamigx_mixer(screen, bitmap, cliprect, 0, 0, 0, 0, 0, 0, m_gx_rushingheroes_hack);
}
/* Hack! draw type-1 roz layer here for testing purposes only */
- if (gx_specialrozenable == 1)
+ if (m_gx_specialrozenable == 1)
{
const pen_t *paldata = m_palette->pens();
@@ -1522,12 +1459,12 @@ UINT32 konamigx_state::screen_update_konamigx(screen_device &screen, bitmap_rgb3
{
for (y=0;y<256;y++)
{
- //UINT16* src = &gxtype1_roz_dstbitmap->pix16(y);
+ //UINT16* src = &m_gxtype1_roz_dstbitmap->pix16(y);
//UINT32* dst = &bitmap.pix32(y);
// ths K053936 rendering should probably just be flipped
// this is just kludged to align the racing force 2d logo
- UINT16* src = &gxtype1_roz_dstbitmap2->pix16(y+30);
+ UINT16* src = &m_gxtype1_roz_dstbitmap2->pix16(y+30);
UINT32* dst = &bitmap.pix32(256-y);
for (x=0;x<512;x++)
@@ -1554,7 +1491,7 @@ UINT32 konamigx_state::screen_update_konamigx_left(screen_device &screen, bitmap
{
int offset=0;
- if (konamigx_palformat==1)
+ if (m_konamigx_palformat==1)
{
for (offset=0;offset<0x4000/4;offset++)
{
@@ -1578,12 +1515,12 @@ UINT32 konamigx_state::screen_update_konamigx_left(screen_device &screen, bitmap
}
}
- screen_update_konamigx( screen, downcast<bitmap_rgb32 &>(*dualscreen_left_tempbitmap), cliprect);
- copybitmap(bitmap, *dualscreen_left_tempbitmap, 0, 0, 0, 0, cliprect);
+ screen_update_konamigx( screen, downcast<bitmap_rgb32 &>(*m_dualscreen_left_tempbitmap), cliprect);
+ copybitmap(bitmap, *m_dualscreen_left_tempbitmap, 0, 0, 0, 0, cliprect);
}
else
{
- copybitmap(bitmap, *dualscreen_left_tempbitmap, 0, 0, 0, 0, cliprect);
+ copybitmap(bitmap, *m_dualscreen_left_tempbitmap, 0, 0, 0, 0, cliprect);
}
return 0;
@@ -1593,13 +1530,13 @@ UINT32 konamigx_state::screen_update_konamigx_right(screen_device &screen, bitma
{
if (m_konamigx_current_frame==1)
{
- copybitmap(bitmap, *dualscreen_right_tempbitmap, 0, 0, 0, 0, cliprect);
+ copybitmap(bitmap, *m_dualscreen_right_tempbitmap, 0, 0, 0, 0, cliprect);
}
else
{
int offset=0;
- if (konamigx_palformat==1)
+ if (m_konamigx_palformat==1)
{
for (offset=0;offset<0x4000/4;offset++)
{
@@ -1623,8 +1560,8 @@ UINT32 konamigx_state::screen_update_konamigx_right(screen_device &screen, bitma
}
}
- screen_update_konamigx(screen, downcast<bitmap_rgb32 &>(*dualscreen_right_tempbitmap), cliprect);
- copybitmap(bitmap, *dualscreen_right_tempbitmap, 0, 0, 0, 0, cliprect);
+ screen_update_konamigx(screen, downcast<bitmap_rgb32 &>(*m_dualscreen_right_tempbitmap), cliprect);
+ copybitmap(bitmap, *m_dualscreen_right_tempbitmap, 0, 0, 0, 0, cliprect);
}
return 0;
@@ -1697,21 +1634,21 @@ WRITE32_MEMBER(konamigx_state::konamigx_555_palette2_w)
WRITE32_MEMBER(konamigx_state::konamigx_tilebank_w)
{
if (ACCESSING_BITS_24_31)
- gx_tilebanks[offset*4] = (data>>24)&0xff;
+ m_gx_tilebanks[offset*4] = (data>>24)&0xff;
if (ACCESSING_BITS_16_23)
- gx_tilebanks[offset*4+1] = (data>>16)&0xff;
+ m_gx_tilebanks[offset*4+1] = (data>>16)&0xff;
if (ACCESSING_BITS_8_15)
- gx_tilebanks[offset*4+2] = (data>>8)&0xff;
+ m_gx_tilebanks[offset*4+2] = (data>>8)&0xff;
if (ACCESSING_BITS_0_7)
- gx_tilebanks[offset*4+3] = data&0xff;
+ m_gx_tilebanks[offset*4+3] = data&0xff;
}
// type 1 RAM-based PSAC tilemap
WRITE32_MEMBER(konamigx_state::konamigx_t1_psacmap_w)
{
COMBINE_DATA(&m_psacram[offset]);
- gx_psac_tilemap->mark_tile_dirty(offset/2);
- gx_psac_tilemap2->mark_tile_dirty(offset/2);
+ m_gx_psac_tilemap->mark_tile_dirty(offset/2);
+ m_gx_psac_tilemap2->mark_tile_dirty(offset/2);
}
// type 4 RAM-based PSAC tilemap
@@ -1719,6 +1656,6 @@ WRITE32_MEMBER(konamigx_state::konamigx_t4_psacmap_w)
{
COMBINE_DATA(&m_psacram[offset]);
- gx_psac_tilemap->mark_tile_dirty(offset*2);
- gx_psac_tilemap->mark_tile_dirty((offset*2)+1);
+ m_gx_psac_tilemap->mark_tile_dirty(offset*2);
+ m_gx_psac_tilemap->mark_tile_dirty((offset*2)+1);
}