From 3995e07169a00167911c4791522000b83c957751 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 8 Feb 2013 13:40:47 +0000 Subject: Modernization of drivers part 10 (no whatsnew) --- src/mame/drivers/kaneko16.c | 48 +++---- src/mame/drivers/karnov.c | 300 +++++++++++++++++++++---------------------- src/mame/drivers/kchamp.c | 12 +- src/mame/drivers/kickgoal.c | 10 +- src/mame/includes/kaneko16.h | 5 + src/mame/includes/kangaroo.h | 2 + src/mame/includes/karnov.h | 5 + src/mame/includes/kchamp.h | 3 + src/mame/includes/kickgoal.h | 2 + src/mame/includes/kingobox.h | 5 + src/mame/includes/kncljoe.h | 1 + src/mame/includes/ksayakyu.h | 1 + src/mame/includes/kyugo.h | 1 + src/mame/video/kaneko16.c | 22 ++-- src/mame/video/kangaroo.c | 33 ++--- src/mame/video/karnov.c | 32 +++-- src/mame/video/kchamp.c | 22 ++-- src/mame/video/kickgoal.c | 13 +- src/mame/video/kingobox.c | 52 ++++---- src/mame/video/kncljoe.c | 15 +-- src/mame/video/ksayakyu.c | 13 +- src/mame/video/kyugo.c | 20 ++- 22 files changed, 309 insertions(+), 308 deletions(-) (limited to 'src/mame') diff --git a/src/mame/drivers/kaneko16.c b/src/mame/drivers/kaneko16.c index 7704b4860e7..11224f675ed 100644 --- a/src/mame/drivers/kaneko16.c +++ b/src/mame/drivers/kaneko16.c @@ -632,17 +632,17 @@ ADDRESS_MAP_END Shogun Warriors ***************************************************************************/ -static void kaneko16_common_oki_bank_w( running_machine& machine, const char *bankname, const char* tag, int bank, size_t fixedsize, size_t bankedsize ) +void kaneko16_state::kaneko16_common_oki_bank_w( const char *bankname, const char* tag, int bank, size_t fixedsize, size_t bankedsize ) { UINT32 bankaddr; - UINT8* samples = machine.root_device().memregion(tag)->base(); - size_t length = machine.root_device().memregion(tag)->bytes(); + UINT8* samples = machine().root_device().memregion(tag)->base(); + size_t length = machine().root_device().memregion(tag)->bytes(); bankaddr = fixedsize + (bankedsize * bank); if (bankaddr <= (length-bankedsize)) { - machine.root_device().membank(bankname)->set_base(samples + bankaddr); + machine().root_device().membank(bankname)->set_base(samples + bankaddr); } } @@ -650,8 +650,8 @@ WRITE16_MEMBER(kaneko16_shogwarr_state::shogwarr_oki_bank_w) { if (ACCESSING_BITS_0_7) { - kaneko16_common_oki_bank_w(machine(), "bank10", "oki1", (data >> 4) & 0xf, 0x30000, 0x10000); - kaneko16_common_oki_bank_w(machine(), "bank11", "oki2", (data & 0xf) , 0x00000, 0x40000); + kaneko16_common_oki_bank_w("bank10", "oki1", (data >> 4) & 0xf, 0x30000, 0x10000); + kaneko16_common_oki_bank_w("bank11", "oki2", (data & 0xf) , 0x00000, 0x40000); } } @@ -659,8 +659,8 @@ WRITE16_MEMBER(kaneko16_shogwarr_state::brapboys_oki_bank_w) { if (ACCESSING_BITS_0_7) { - kaneko16_common_oki_bank_w(machine(), "bank10", "oki1", (data >> 4) & 0xf, 0x30000, 0x10000); - kaneko16_common_oki_bank_w(machine(), "bank11", "oki2", (data & 0xf) , 0x20000, 0x20000); + kaneko16_common_oki_bank_w("bank10", "oki1", (data >> 4) & 0xf, 0x30000, 0x10000); + kaneko16_common_oki_bank_w("bank11", "oki2", (data & 0xf) , 0x20000, 0x20000); } } @@ -2155,10 +2155,10 @@ MACHINE_CONFIG_END have the even and odd pixels swapped. So we use this function to untangle them and have one single gfxlayout for both tiles and sprites. */ -static void kaneko16_unscramble_tiles(running_machine &machine, const char *region) +void kaneko16_state::kaneko16_unscramble_tiles(const char *region) { - UINT8 *RAM = machine.root_device().memregion(region)->base(); - int size = machine.root_device().memregion(region)->bytes(); + UINT8 *RAM = machine().root_device().memregion(region)->base(); + int size = machine().root_device().memregion(region)->bytes(); int i; if (RAM == NULL) return; @@ -2169,7 +2169,7 @@ static void kaneko16_unscramble_tiles(running_machine &machine, const char *regi } } -static void kaneko16_expand_sample_banks(running_machine &machine, const char *region) +void kaneko16_state::kaneko16_expand_sample_banks(const char *region) { /* The sample data for the first OKI has an address translator/ banking register in it that munges the addresses as follows: @@ -2183,11 +2183,11 @@ static void kaneko16_expand_sample_banks(running_machine &machine, const char *r int bank; UINT8 *src0; - if (machine.root_device().memregion(region)->bytes() < 0x40000 * 16) + if (machine().root_device().memregion(region)->bytes() < 0x40000 * 16) fatalerror("gtmr SOUND1 region too small\n"); /* bank 0 maps to itself, so we just leave it alone */ - src0 = machine.root_device().memregion(region)->base(); + src0 = machine().root_device().memregion(region)->base(); for (bank = 15; bank > 0; bank--) { UINT8 *srcn = src0 + 0x10000 * (bank < 3 ? 3 : bank); @@ -2200,20 +2200,20 @@ static void kaneko16_expand_sample_banks(running_machine &machine, const char *r DRIVER_INIT_MEMBER( kaneko16_state, kaneko16 ) { - kaneko16_unscramble_tiles(machine(), "gfx2"); - kaneko16_unscramble_tiles(machine(), "gfx3"); + kaneko16_unscramble_tiles("gfx2"); + kaneko16_unscramble_tiles("gfx3"); } DRIVER_INIT_MEMBER( kaneko16_berlwall_state, berlwall ) { - kaneko16_unscramble_tiles(machine(), "gfx2"); + kaneko16_unscramble_tiles("gfx2"); } DRIVER_INIT_MEMBER( kaneko16_state, samplebank ) { - kaneko16_unscramble_tiles(machine(), "gfx2"); - kaneko16_unscramble_tiles(machine(), "gfx3"); - kaneko16_expand_sample_banks(machine(), "oki1"); + kaneko16_unscramble_tiles("gfx2"); + kaneko16_unscramble_tiles("gfx3"); + kaneko16_expand_sample_banks("oki1"); } @@ -3829,8 +3829,8 @@ DRIVER_INIT_MEMBER( kaneko16_gtmr_state, gtmr ) DRIVER_INIT_MEMBER( kaneko16_shogwarr_state, shogwarr ) { // default sample banks - kaneko16_common_oki_bank_w(machine(), "bank10", "oki1", 0, 0x30000, 0x10000); - kaneko16_common_oki_bank_w(machine(), "bank11", "oki2", 0, 0x00000, 0x40000); + kaneko16_common_oki_bank_w("bank10", "oki1", 0, 0x30000, 0x10000); + kaneko16_common_oki_bank_w("bank11", "oki2", 0, 0x00000, 0x40000); DRIVER_INIT_CALL(kaneko16); } @@ -3841,8 +3841,8 @@ DRIVER_INIT_MEMBER( kaneko16_shogwarr_state, brapboys ) machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xe00000, 0xe00001, write16_delegate(FUNC(kaneko16_shogwarr_state::brapboys_oki_bank_w),this)); // default sample banks - kaneko16_common_oki_bank_w(machine(), "bank10", "oki1", 0, 0x30000, 0x10000); - kaneko16_common_oki_bank_w(machine(), "bank11", "oki2", 0, 0x20000, 0x20000); + kaneko16_common_oki_bank_w("bank10", "oki1", 0, 0x30000, 0x10000); + kaneko16_common_oki_bank_w("bank11", "oki2", 0, 0x20000, 0x20000); DRIVER_INIT_CALL(kaneko16); } diff --git a/src/mame/drivers/karnov.c b/src/mame/drivers/karnov.c index 92dc914d585..4d67db80385 100644 --- a/src/mame/drivers/karnov.c +++ b/src/mame/drivers/karnov.c @@ -91,62 +91,58 @@ Stephh's notes (based on the games M68000 code and some tests) : *************************************/ /* Emulation of the protected microcontroller - for coins & general protection */ -static void karnov_i8751_w( running_machine &machine, int data ) +void karnov_state::karnov_i8751_w( int data ) { - karnov_state *state = machine.driver_data(); - /* Pending coin operations may cause protection commands to be queued */ - if (state->m_i8751_needs_ack) + if (m_i8751_needs_ack) { - state->m_i8751_command_queue = data; + m_i8751_command_queue = data; return; } - state->m_i8751_return = 0; + m_i8751_return = 0; - if (data == 0x100 && state->m_microcontroller_id == KARNOV) /* USA version */ - state->m_i8751_return = 0x56b; + if (data == 0x100 && m_microcontroller_id == KARNOV) /* USA version */ + m_i8751_return = 0x56b; - if (data == 0x100 && state->m_microcontroller_id == KARNOVJ) /* Japan version */ - state->m_i8751_return = 0x56a; + if (data == 0x100 && m_microcontroller_id == KARNOVJ) /* Japan version */ + m_i8751_return = 0x56a; if ((data & 0xf00) == 0x300) - state->m_i8751_return = (data & 0xff) * 0x12; /* Player sprite mapping */ + m_i8751_return = (data & 0xff) * 0x12; /* Player sprite mapping */ /* I'm not sure the ones marked ^ appear in the right order */ - if (data == 0x400) state->m_i8751_return = 0x4000; /* Get The Map... */ - if (data == 0x402) state->m_i8751_return = 0x40a6; /* Ancient Ruins */ - if (data == 0x403) state->m_i8751_return = 0x4054; /* Forest... */ - if (data == 0x404) state->m_i8751_return = 0x40de; /* ^Rocky hills */ - if (data == 0x405) state->m_i8751_return = 0x4182; /* Sea */ - if (data == 0x406) state->m_i8751_return = 0x41ca; /* Town */ - if (data == 0x407) state->m_i8751_return = 0x421e; /* Desert */ - if (data == 0x401) state->m_i8751_return = 0x4138; /* ^Whistling wind */ - if (data == 0x408) state->m_i8751_return = 0x4276; /* ^Heavy Gates */ - -// if (!state->m_i8751_return && data != 0x300) logerror("%s - Unknown Write %02x intel\n", machine.describe_context(), data); - - state->m_maincpu->set_input_line(6, HOLD_LINE); /* Signal main cpu task is complete */ - state->m_i8751_needs_ack = 1; + if (data == 0x400) m_i8751_return = 0x4000; /* Get The Map... */ + if (data == 0x402) m_i8751_return = 0x40a6; /* Ancient Ruins */ + if (data == 0x403) m_i8751_return = 0x4054; /* Forest... */ + if (data == 0x404) m_i8751_return = 0x40de; /* ^Rocky hills */ + if (data == 0x405) m_i8751_return = 0x4182; /* Sea */ + if (data == 0x406) m_i8751_return = 0x41ca; /* Town */ + if (data == 0x407) m_i8751_return = 0x421e; /* Desert */ + if (data == 0x401) m_i8751_return = 0x4138; /* ^Whistling wind */ + if (data == 0x408) m_i8751_return = 0x4276; /* ^Heavy Gates */ + +// if (!m_i8751_return && data != 0x300) logerror("%s - Unknown Write %02x intel\n", machine().describe_context(), data); + + m_maincpu->set_input_line(6, HOLD_LINE); /* Signal main cpu task is complete */ + m_i8751_needs_ack = 1; } -static void wndrplnt_i8751_w( running_machine &machine, int data ) +void karnov_state::wndrplnt_i8751_w( int data ) { - karnov_state *state = machine.driver_data(); - /* The last command hasn't been ACK'd (probably a conflict with coin command) */ - if (state->m_i8751_needs_ack) + if (m_i8751_needs_ack) { - state->m_i8751_command_queue = data; + m_i8751_command_queue = data; return; } - state->m_i8751_return=0; + m_i8751_return=0; - if (data == 0x100) state->m_i8751_return = 0x67a; - if (data == 0x200) state->m_i8751_return = 0x214; - if (data == 0x300) state->m_i8751_return = 0x17; /* Copyright text on title screen */ -// if (data == 0x300) state->m_i8751_return = 0x1; /* (USA) Copyright text on title screen */ + if (data == 0x100) m_i8751_return = 0x67a; + if (data == 0x200) m_i8751_return = 0x214; + if (data == 0x300) m_i8751_return = 0x17; /* Copyright text on title screen */ +// if (data == 0x300) m_i8751_return = 0x1; /* (USA) Copyright text on title screen */ /* The game writes many values in the 0x600 range, but only a specific mask matters for the return value */ @@ -154,172 +150,170 @@ static void wndrplnt_i8751_w( running_machine &machine, int data ) { switch (data & 0x18) { - case 0x00: state->m_i8751_return = 0x4d53; break; - case 0x08: state->m_i8751_return = 0x4b54; break; - case 0x10: state->m_i8751_return = 0x5453; break; - case 0x18: state->m_i8751_return = 0x5341; break; + case 0x00: m_i8751_return = 0x4d53; break; + case 0x08: m_i8751_return = 0x4b54; break; + case 0x10: m_i8751_return = 0x5453; break; + case 0x18: m_i8751_return = 0x5341; break; } } -// else logerror("%s - Unknown Write %02x intel\n", machine.describe_context(), data); +// else logerror("%s - Unknown Write %02x intel\n", machine().describe_context(), data); /* These are 68k function call addresses - different address for each power-up */ - if (data == 0x400) state->m_i8751_return = 0x594; - if (data == 0x401) state->m_i8751_return = 0x5ea; - if (data == 0x402) state->m_i8751_return = 0x628; - if (data == 0x403) state->m_i8751_return = 0x66c; - if (data == 0x404) state->m_i8751_return = 0x6a4; - if (data == 0x405) state->m_i8751_return = 0x6a4; - if (data == 0x406) state->m_i8751_return = 0x6a4; + if (data == 0x400) m_i8751_return = 0x594; + if (data == 0x401) m_i8751_return = 0x5ea; + if (data == 0x402) m_i8751_return = 0x628; + if (data == 0x403) m_i8751_return = 0x66c; + if (data == 0x404) m_i8751_return = 0x6a4; + if (data == 0x405) m_i8751_return = 0x6a4; + if (data == 0x406) m_i8751_return = 0x6a4; /* This is 68k program code which is executed every frame */ - if (data == 0x50c) state->m_i8751_return = 0x13fc; - if (data == 0x50b) state->m_i8751_return = 0x00ff; - if (data == 0x50a) state->m_i8751_return = 0x0006; - if (data == 0x509) state->m_i8751_return = 0x0000; - if (data == 0x508) state->m_i8751_return = 0x4a39; - if (data == 0x507) state->m_i8751_return = 0x0006; - if (data == 0x506) state->m_i8751_return = 0x0000; - if (data == 0x505) state->m_i8751_return = 0x66f8; - if (data == 0x504) state->m_i8751_return = 0x4a39; - if (data == 0x503) state->m_i8751_return = 0x000c; - if (data == 0x502) state->m_i8751_return = 0x0003; - if (data == 0x501) state->m_i8751_return = 0x6bf8; - if (data == 0x500) state->m_i8751_return = 0x4e75; - - state->m_maincpu->set_input_line(6, HOLD_LINE); /* Signal main cpu task is complete */ - state->m_i8751_needs_ack = 1; + if (data == 0x50c) m_i8751_return = 0x13fc; + if (data == 0x50b) m_i8751_return = 0x00ff; + if (data == 0x50a) m_i8751_return = 0x0006; + if (data == 0x509) m_i8751_return = 0x0000; + if (data == 0x508) m_i8751_return = 0x4a39; + if (data == 0x507) m_i8751_return = 0x0006; + if (data == 0x506) m_i8751_return = 0x0000; + if (data == 0x505) m_i8751_return = 0x66f8; + if (data == 0x504) m_i8751_return = 0x4a39; + if (data == 0x503) m_i8751_return = 0x000c; + if (data == 0x502) m_i8751_return = 0x0003; + if (data == 0x501) m_i8751_return = 0x6bf8; + if (data == 0x500) m_i8751_return = 0x4e75; + + m_maincpu->set_input_line(6, HOLD_LINE); /* Signal main cpu task is complete */ + m_i8751_needs_ack = 1; } -static void chelnov_i8751_w( running_machine &machine, int data ) +void karnov_state::chelnov_i8751_w( int data ) { - karnov_state *state = machine.driver_data(); - /* Pending coin operations may cause protection commands to be queued */ - if (state->m_i8751_needs_ack) + if (m_i8751_needs_ack) { - state->m_i8751_command_queue = data; + m_i8751_command_queue = data; return; } - state->m_i8751_return = 0; + m_i8751_return = 0; - if (data == 0x200 && state->m_microcontroller_id == CHELNOV) /* World version */ - state->m_i8751_return = 0x7736; + if (data == 0x200 && m_microcontroller_id == CHELNOV) /* World version */ + m_i8751_return = 0x7736; - if (data == 0x200 && state->m_microcontroller_id == CHELNOVU) /* USA version */ - state->m_i8751_return = 0x783e; + if (data == 0x200 && m_microcontroller_id == CHELNOVU) /* USA version */ + m_i8751_return = 0x783e; - if (data == 0x200 && state->m_microcontroller_id == CHELNOVJ) /* Japan version */ - state->m_i8751_return = 0x7734; + if (data == 0x200 && m_microcontroller_id == CHELNOVJ) /* Japan version */ + m_i8751_return = 0x7734; - if (data == 0x100 && state->m_microcontroller_id == CHELNOV) /* World version */ - state->m_i8751_return = 0x71c; + if (data == 0x100 && m_microcontroller_id == CHELNOV) /* World version */ + m_i8751_return = 0x71c; - if (data == 0x100 && state->m_microcontroller_id == CHELNOVU) /* USA version */ - state->m_i8751_return = 0x71b; + if (data == 0x100 && m_microcontroller_id == CHELNOVU) /* USA version */ + m_i8751_return = 0x71b; - if (data == 0x100 && state->m_microcontroller_id == CHELNOVJ) /* Japan version */ - state->m_i8751_return = 0x71a; + if (data == 0x100 && m_microcontroller_id == CHELNOVJ) /* Japan version */ + m_i8751_return = 0x71a; if (data >= 0x6000 && data < 0x8000) - state->m_i8751_return = 1; /* patched */ + m_i8751_return = 1; /* patched */ - if ((data & 0xf000) == 0x1000) state->m_i8751_level = 1; /* Level 1 */ - if ((data & 0xf000) == 0x2000) state->m_i8751_level++; /* Level Increment */ + if ((data & 0xf000) == 0x1000) m_i8751_level = 1; /* Level 1 */ + if ((data & 0xf000) == 0x2000) m_i8751_level++; /* Level Increment */ if ((data & 0xf000) == 0x3000) { /* Sprite table mapping */ int b = data & 0xff; - switch (state->m_i8751_level) + switch (m_i8751_level) { case 1: /* Level 1, Sprite mapping tables */ - if (state->m_microcontroller_id == CHELNOVU) /* USA */ + if (m_microcontroller_id == CHELNOVU) /* USA */ { - if (b < 2) state->m_i8751_return = 0; - else if (b < 6) state->m_i8751_return = 1; - else if (b < 0xb) state->m_i8751_return = 2; - else if (b < 0xf) state->m_i8751_return = 3; - else if (b < 0x13) state->m_i8751_return = 4; - else state->m_i8751_return = 5; + if (b < 2) m_i8751_return = 0; + else if (b < 6) m_i8751_return = 1; + else if (b < 0xb) m_i8751_return = 2; + else if (b < 0xf) m_i8751_return = 3; + else if (b < 0x13) m_i8751_return = 4; + else m_i8751_return = 5; } else /* Japan, World */ { - if (b < 3) state->m_i8751_return = 0; - else if (b < 8) state->m_i8751_return = 1; - else if (b < 0xc) state->m_i8751_return = 2; - else if (b < 0x10) state->m_i8751_return = 3; - else if (b < 0x19) state->m_i8751_return = 4; - else if (b < 0x1b) state->m_i8751_return = 5; - else if (b < 0x22) state->m_i8751_return = 6; - else if (b < 0x28) state->m_i8751_return = 7; - else state->m_i8751_return = 8; + if (b < 3) m_i8751_return = 0; + else if (b < 8) m_i8751_return = 1; + else if (b < 0xc) m_i8751_return = 2; + else if (b < 0x10) m_i8751_return = 3; + else if (b < 0x19) m_i8751_return = 4; + else if (b < 0x1b) m_i8751_return = 5; + else if (b < 0x22) m_i8751_return = 6; + else if (b < 0x28) m_i8751_return = 7; + else m_i8751_return = 8; } break; case 2: /* Level 2, Sprite mapping tables, all sets are the same */ - if (b < 3) state->m_i8751_return = 0; - else if (b < 9) state->m_i8751_return = 1; - else if (b < 0x11) state->m_i8751_return = 2; - else if (b < 0x1b) state->m_i8751_return = 3; - else if (b < 0x21) state->m_i8751_return = 4; - else if (b < 0x28) state->m_i8751_return = 5; - else state->m_i8751_return = 6; + if (b < 3) m_i8751_return = 0; + else if (b < 9) m_i8751_return = 1; + else if (b < 0x11) m_i8751_return = 2; + else if (b < 0x1b) m_i8751_return = 3; + else if (b < 0x21) m_i8751_return = 4; + else if (b < 0x28) m_i8751_return = 5; + else m_i8751_return = 6; break; case 3: /* Level 3, Sprite mapping tables, all sets are the same */ - if (b < 5) state->m_i8751_return = 0; - else if (b < 9) state->m_i8751_return = 1; - else if (b < 0xd) state->m_i8751_return = 2; - else if (b < 0x11) state->m_i8751_return = 3; - else if (b < 0x1b) state->m_i8751_return = 4; - else if (b < 0x1c) state->m_i8751_return = 5; - else if (b < 0x22) state->m_i8751_return = 6; - else if (b < 0x27) state->m_i8751_return = 7; - else state->m_i8751_return = 8; + if (b < 5) m_i8751_return = 0; + else if (b < 9) m_i8751_return = 1; + else if (b < 0xd) m_i8751_return = 2; + else if (b < 0x11) m_i8751_return = 3; + else if (b < 0x1b) m_i8751_return = 4; + else if (b < 0x1c) m_i8751_return = 5; + else if (b < 0x22) m_i8751_return = 6; + else if (b < 0x27) m_i8751_return = 7; + else m_i8751_return = 8; break; case 4: /* Level 4, Sprite mapping tables, all sets are the same */ - if (b < 4) state->m_i8751_return = 0; - else if (b < 0xc) state->m_i8751_return = 1; - else if (b < 0xf) state->m_i8751_return = 2; - else if (b < 0x19) state->m_i8751_return = 3; - else if (b < 0x1c) state->m_i8751_return = 4; - else if (b < 0x22) state->m_i8751_return = 5; - else if (b < 0x29) state->m_i8751_return = 6; - else state->m_i8751_return = 7; + if (b < 4) m_i8751_return = 0; + else if (b < 0xc) m_i8751_return = 1; + else if (b < 0xf) m_i8751_return = 2; + else if (b < 0x19) m_i8751_return = 3; + else if (b < 0x1c) m_i8751_return = 4; + else if (b < 0x22) m_i8751_return = 5; + else if (b < 0x29) m_i8751_return = 6; + else m_i8751_return = 7; break; case 5: /* Level 5, Sprite mapping tables, all sets are the same */ - if (b < 7) state->m_i8751_return = 0; - else if (b < 0xe) state->m_i8751_return = 1; - else if (b < 0x14) state->m_i8751_return = 2; - else if (b < 0x1a) state->m_i8751_return = 3; - else if (b < 0x23) state->m_i8751_return = 4; - else if (b < 0x27) state->m_i8751_return = 5; - else state->m_i8751_return = 6; + if (b < 7) m_i8751_return = 0; + else if (b < 0xe) m_i8751_return = 1; + else if (b < 0x14) m_i8751_return = 2; + else if (b < 0x1a) m_i8751_return = 3; + else if (b < 0x23) m_i8751_return = 4; + else if (b < 0x27) m_i8751_return = 5; + else m_i8751_return = 6; break; case 6: /* Level 6, Sprite mapping tables, all sets are the same */ - if (b < 3) state->m_i8751_return = 0; - else if (b < 0xb) state->m_i8751_return = 1; - else if (b < 0x11) state->m_i8751_return = 2; - else if (b < 0x17) state->m_i8751_return = 3; - else if (b < 0x1d) state->m_i8751_return = 4; - else if (b < 0x24) state->m_i8751_return = 5; - else state->m_i8751_return = 6; + if (b < 3) m_i8751_return = 0; + else if (b < 0xb) m_i8751_return = 1; + else if (b < 0x11) m_i8751_return = 2; + else if (b < 0x17) m_i8751_return = 3; + else if (b < 0x1d) m_i8751_return = 4; + else if (b < 0x24) m_i8751_return = 5; + else m_i8751_return = 6; break; case 7: /* Level 7, Sprite mapping tables, all sets are the same */ - if (b < 5) state->m_i8751_return = 0; - else if (b < 0xb) state->m_i8751_return = 1; - else if (b < 0x11) state->m_i8751_return = 2; - else if (b < 0x1a) state->m_i8751_return = 3; - else if (b < 0x21) state->m_i8751_return = 4; - else if (b < 0x27) state->m_i8751_return = 5; - else state->m_i8751_return = 6; + if (b < 5) m_i8751_return = 0; + else if (b < 0xb) m_i8751_return = 1; + else if (b < 0x11) m_i8751_return = 2; + else if (b < 0x1a) m_i8751_return = 3; + else if (b < 0x21) m_i8751_return = 4; + else if (b < 0x27) m_i8751_return = 5; + else m_i8751_return = 6; break; } } - // logerror("%s - Unknown Write %02x intel\n", machine.describe_context(), data); + // logerror("%s - Unknown Write %02x intel\n", machine().describe_context(), data); - state->m_maincpu->set_input_line(6, HOLD_LINE); /* Signal main cpu task is complete */ - state->m_i8751_needs_ack = 1; + m_maincpu->set_input_line(6, HOLD_LINE); /* Signal main cpu task is complete */ + m_i8751_needs_ack = 1; } /************************************* @@ -370,16 +364,16 @@ WRITE16_MEMBER(karnov_state::karnov_control_w) case 6: /* SECREQ (Interrupt & Data to i8751) */ if (m_microcontroller_id == KARNOV || m_microcontroller_id == KARNOVJ) - karnov_i8751_w(machine(), data); + karnov_i8751_w(data); if (m_microcontroller_id == CHELNOV || m_microcontroller_id == CHELNOVU || m_microcontroller_id == CHELNOVJ) - chelnov_i8751_w(machine(), data); + chelnov_i8751_w(data); if (m_microcontroller_id == WNDRPLNT) - wndrplnt_i8751_w(machine(), data); + wndrplnt_i8751_w(data); break; case 8: /* HSHIFT (9 bits) - Top bit indicates video flip */ COMBINE_DATA(&m_scroll[0]); - karnov_flipscreen_w(machine(), data >> 15); + karnov_flipscreen_w(data >> 15); break; case 0xa: /* VSHIFT */ diff --git a/src/mame/drivers/kchamp.c b/src/mame/drivers/kchamp.c index 5dd2ab24b41..ff5888708c9 100644 --- a/src/mame/drivers/kchamp.c +++ b/src/mame/drivers/kchamp.c @@ -705,11 +705,11 @@ ROM_START( karatevs ) ROM_END -static UINT8 *decrypt_code(running_machine &machine) +UINT8 *kchamp_state::decrypt_code() { - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); - UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x10000); - UINT8 *rom = machine.root_device().memregion("maincpu")->base(); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); + UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x10000); + UINT8 *rom = machine().root_device().memregion("maincpu")->base(); int A; space.set_decrypted_region(0x0000, 0xffff, decrypted); @@ -724,7 +724,7 @@ static UINT8 *decrypt_code(running_machine &machine) DRIVER_INIT_MEMBER(kchamp_state,kchampvs) { UINT8 *rom = memregion("maincpu")->base(); - UINT8 *decrypted = decrypt_code(machine()); + UINT8 *decrypted = decrypt_code(); int A; /* @@ -754,7 +754,7 @@ DRIVER_INIT_MEMBER(kchamp_state,kchampvs) DRIVER_INIT_MEMBER(kchamp_state,kchampvs2) { - decrypt_code(machine()); + decrypt_code(); m_counter = 0; m_msm_data = 0; m_msm_play_lo_nibble = 1; diff --git a/src/mame/drivers/kickgoal.c b/src/mame/drivers/kickgoal.c index bf4c4838693..b5908aa4f14 100644 --- a/src/mame/drivers/kickgoal.c +++ b/src/mame/drivers/kickgoal.c @@ -116,7 +116,7 @@ Hollywood Action //static int kickgoal_melody; //static int kickgoal_snd_bank; -static void kickgoal_play(okim6295_device *oki, int melody, int data) +void ::kickgoal_play(okim6295_device *oki, int melody, int data) { int status = oki->read(0); @@ -124,12 +124,12 @@ static void kickgoal_play(okim6295_device *oki, int melody, int data) if (kickgoal_sound == 0) popmessage("Unknown sound command %02x",kickgoal_sound); if (melody) { - if (state->m_melody != kickgoal_sound) { - state->m_melody = kickgoal_sound; - state->m_melody_loop = kickgoal_sound; + if (m_melody != kickgoal_sound) { + m_melody = kickgoal_sound; + m_melody_loop = kickgoal_sound; if (status & 0x08) oki->write(0,0x40); - oki->write(0,(0x80 | state->m_melody)); + oki->write(0,(0x80 | m_melody)); oki->write(0,0x81); } } diff --git a/src/mame/includes/kaneko16.h b/src/mame/includes/kaneko16.h index 52d3e263915..14c39d75f46 100644 --- a/src/mame/includes/kaneko16.h +++ b/src/mame/includes/kaneko16.h @@ -67,6 +67,10 @@ public: UINT32 screen_update_common(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(kaneko16_interrupt); TIMER_DEVICE_CALLBACK_MEMBER(shogwarr_interrupt); + void kaneko16_fill_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect); + void kaneko16_common_oki_bank_w( const char *bankname, const char* tag, int bank, size_t fixedsize, size_t bankedsize ); + void kaneko16_unscramble_tiles(const char *region); + void kaneko16_expand_sample_banks(const char *region); }; class kaneko16_gtmr_state : public kaneko16_state @@ -117,6 +121,7 @@ public: DECLARE_PALETTE_INIT(berlwall); DECLARE_VIDEO_START(berlwall); UINT32 screen_update_berlwall(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void kaneko16_render_15bpp_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect); }; class kaneko16_shogwarr_state : public kaneko16_state diff --git a/src/mame/includes/kangaroo.h b/src/mame/includes/kangaroo.h index bdfac9df0ee..e0c339dd057 100644 --- a/src/mame/includes/kangaroo.h +++ b/src/mame/includes/kangaroo.h @@ -31,4 +31,6 @@ public: virtual void video_start(); DECLARE_MACHINE_START(kangaroo_mcu); UINT32 screen_update_kangaroo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void videoram_write( UINT16 offset, UINT8 data, UINT8 mask ); + void blitter_execute( ); }; diff --git a/src/mame/includes/karnov.h b/src/mame/includes/karnov.h index 2e973b70363..5e62fd2eb4f 100644 --- a/src/mame/includes/karnov.h +++ b/src/mame/includes/karnov.h @@ -59,6 +59,11 @@ public: DECLARE_VIDEO_START(wndrplnt); UINT32 screen_update_karnov(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(karnov_interrupt); + void karnov_flipscreen_w( int data ); + void draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect ); + void karnov_i8751_w( int data ); + void wndrplnt_i8751_w( int data ); + void chelnov_i8751_w( int data ); }; enum { diff --git a/src/mame/includes/kchamp.h b/src/mame/includes/kchamp.h index e0e4731913c..c813ae4feee 100644 --- a/src/mame/includes/kchamp.h +++ b/src/mame/includes/kchamp.h @@ -52,4 +52,7 @@ public: UINT32 screen_update_kchamp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(kc_interrupt); INTERRUPT_GEN_MEMBER(sound_int); + void kchamp_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); + void kchampvs_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); + UINT8 *decrypt_code(); }; diff --git a/src/mame/includes/kickgoal.h b/src/mame/includes/kickgoal.h index 40addbdc5a0..fff205a98fe 100644 --- a/src/mame/includes/kickgoal.h +++ b/src/mame/includes/kickgoal.h @@ -76,4 +76,6 @@ public: DECLARE_VIDEO_START(actionhw); UINT32 screen_update_kickgoal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(kickgoal_interrupt); + void kickgoal_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); + void kickgoal_play(okim6295_device *oki, int melody, int data); }; diff --git a/src/mame/includes/kingobox.h b/src/mame/includes/kingobox.h index 952fb187a48..347a1b16f1e 100644 --- a/src/mame/includes/kingobox.h +++ b/src/mame/includes/kingobox.h @@ -59,4 +59,9 @@ public: UINT32 screen_update_kingofb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_ringking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(kingofb_interrupt); + void palette_init_common( const UINT8 *color_prom, void (kingofb_state::*get_rgb_data)(const UINT8 *, int, int *, int *, int *) ); + void kingofb_get_rgb_data( const UINT8 *color_prom, int i, int *r_data, int *g_data, int *b_data ); + void ringking_get_rgb_data( const UINT8 *color_prom, int i, int *r_data, int *g_data, int *b_data ); + void kingofb_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void ringking_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/kncljoe.h b/src/mame/includes/kncljoe.h index 5d098188e69..a8e2df70aa0 100644 --- a/src/mame/includes/kncljoe.h +++ b/src/mame/includes/kncljoe.h @@ -47,4 +47,5 @@ public: virtual void palette_init(); UINT32 screen_update_kncljoe(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(sound_nmi); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/ksayakyu.h b/src/mame/includes/ksayakyu.h index 509c2a3063a..d918d313047 100644 --- a/src/mame/includes/ksayakyu.h +++ b/src/mame/includes/ksayakyu.h @@ -40,4 +40,5 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_ksayakyu(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/kyugo.h b/src/mame/includes/kyugo.h index b61e13d1648..ce61dd4b5cc 100644 --- a/src/mame/includes/kyugo.h +++ b/src/mame/includes/kyugo.h @@ -60,4 +60,5 @@ public: virtual void video_start(); UINT32 screen_update_kyugo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vblank_irq); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/video/kaneko16.c b/src/mame/video/kaneko16.c index 6d13a5ade9a..5c5eaeb0299 100644 --- a/src/mame/video/kaneko16.c +++ b/src/mame/video/kaneko16.c @@ -24,11 +24,10 @@ VIDEO_START_MEMBER(kaneko16_state,kaneko16) -static void kaneko16_fill_bitmap(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void kaneko16_state::kaneko16_fill_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) { - kaneko16_state *state = machine.driver_data(); - if (state->m_kaneko_spr) - if(state->m_kaneko_spr->get_sprite_type()== 1) + if (m_kaneko_spr) + if(m_kaneko_spr->get_sprite_type()== 1) { bitmap.fill(0x7f00, cliprect); return; @@ -67,7 +66,7 @@ UINT32 kaneko16_state::screen_update_common(screen_device &screen, bitmap_ind16 UINT32 kaneko16_state::screen_update_kaneko16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - kaneko16_fill_bitmap(machine(),bitmap,cliprect); + kaneko16_fill_bitmap(bitmap,cliprect); // if the display is disabled, do nothing? if (!m_disp_enable) return 0; @@ -168,13 +167,12 @@ WRITE16_MEMBER(kaneko16_berlwall_state::kaneko16_bg15_reg_w) } -static void kaneko16_render_15bpp_bitmap(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void kaneko16_berlwall_state::kaneko16_render_15bpp_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) { - kaneko16_berlwall_state *state = machine.driver_data(); - if (state->m_bg15_bitmap.valid()) + if (m_bg15_bitmap.valid()) { - int select = state->m_bg15_select[ 0 ]; -// int reg = state->m_bg15_reg[ 0 ]; + int select = m_bg15_select[ 0 ]; +// int reg = m_bg15_reg[ 0 ]; int flip = select & 0x20; int sx, sy; @@ -183,7 +181,7 @@ static void kaneko16_render_15bpp_bitmap(running_machine &machine, bitmap_ind16 sx = (select & 0x1f) * 256; sy = 0; - copybitmap(bitmap, state->m_bg15_bitmap, flip, flip, -sx, -sy, cliprect); + copybitmap(bitmap, m_bg15_bitmap, flip, flip, -sx, -sy, cliprect); // flag = 0; } @@ -191,7 +189,7 @@ static void kaneko16_render_15bpp_bitmap(running_machine &machine, bitmap_ind16 UINT32 kaneko16_berlwall_state::screen_update_berlwall(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // berlwall uses a 15bpp bitmap as a bg, not a solid fill - kaneko16_render_15bpp_bitmap(machine(),bitmap,cliprect); + kaneko16_render_15bpp_bitmap(bitmap,cliprect); // if the display is disabled, do nothing? if (!m_disp_enable) return 0; diff --git a/src/mame/video/kangaroo.c b/src/mame/video/kangaroo.c index 4234c199008..4552080b552 100644 --- a/src/mame/video/kangaroo.c +++ b/src/mame/video/kangaroo.c @@ -7,9 +7,6 @@ #include "emu.h" #include "includes/kangaroo.h" -static void blitter_execute(running_machine &machine); - - /************************************* * * Video setup @@ -31,9 +28,8 @@ void kangaroo_state::video_start() * *************************************/ -static void videoram_write( running_machine &machine, UINT16 offset, UINT8 data, UINT8 mask ) +void kangaroo_state::videoram_write( UINT16 offset, UINT8 data, UINT8 mask ) { - kangaroo_state *state = machine.driver_data(); UINT32 expdata, layermask; /* data contains 4 2-bit values packed as DCBADCBA; expand these into 4 8-bit values */ @@ -55,13 +51,13 @@ static void videoram_write( running_machine &machine, UINT16 offset, UINT8 data, if (mask & 0x01) layermask |= 0x0c0c0c0c; /* update layers */ - state->m_videoram[offset] = (state->m_videoram[offset] & ~layermask) | (expdata & layermask); + m_videoram[offset] = (m_videoram[offset] & ~layermask) | (expdata & layermask); } WRITE8_MEMBER(kangaroo_state::kangaroo_videoram_w) { - videoram_write(machine(), offset, data, m_video_control[8]); + videoram_write(offset, data, m_video_control[8]); } @@ -79,7 +75,7 @@ WRITE8_MEMBER(kangaroo_state::kangaroo_video_control_w) switch (offset) { case 5: /* blitter start */ - blitter_execute(machine()); + blitter_execute(); break; case 8: /* bank select */ @@ -96,16 +92,15 @@ WRITE8_MEMBER(kangaroo_state::kangaroo_video_control_w) * *************************************/ -static void blitter_execute( running_machine &machine ) +void kangaroo_state::blitter_execute( ) { - kangaroo_state *state = machine.driver_data(); - UINT32 gfxhalfsize = state->memregion("gfx1")->bytes() / 2; - const UINT8 *gfxbase = state->memregion("gfx1")->base(); - UINT16 src = state->m_video_control[0] + 256 * state->m_video_control[1]; - UINT16 dst = state->m_video_control[2] + 256 * state->m_video_control[3]; - UINT8 height = state->m_video_control[5]; - UINT8 width = state->m_video_control[4]; - UINT8 mask = state->m_video_control[8]; + UINT32 gfxhalfsize = memregion("gfx1")->bytes() / 2; + const UINT8 *gfxbase = memregion("gfx1")->base(); + UINT16 src = m_video_control[0] + 256 * m_video_control[1]; + UINT16 dst = m_video_control[2] + 256 * m_video_control[3]; + UINT8 height = m_video_control[5]; + UINT8 width = m_video_control[4]; + UINT8 mask = m_video_control[8]; int x, y; /* during DMA operations, the top 2 bits are ORed together, as well as the bottom 2 bits */ @@ -119,8 +114,8 @@ static void blitter_execute( running_machine &machine ) { UINT16 effdst = (dst + x) & 0x3fff; UINT16 effsrc = src++ & (gfxhalfsize - 1); - videoram_write(machine, effdst, gfxbase[0 * gfxhalfsize + effsrc], mask & 0x05); - videoram_write(machine, effdst, gfxbase[1 * gfxhalfsize + effsrc], mask & 0x0a); + videoram_write(effdst, gfxbase[0 * gfxhalfsize + effsrc], mask & 0x05); + videoram_write(effdst, gfxbase[1 * gfxhalfsize + effsrc], mask & 0x0a); } } diff --git a/src/mame/video/karnov.c b/src/mame/video/karnov.c index 3446cb024e7..77d15953569 100644 --- a/src/mame/video/karnov.c +++ b/src/mame/video/karnov.c @@ -66,22 +66,20 @@ void karnov_state::palette_init() } } -void karnov_flipscreen_w( running_machine &machine, int data ) +void karnov_state::karnov_flipscreen_w( int data ) { - karnov_state *state = machine.driver_data(); - state->m_flipscreen = data; - machine.tilemap().set_flip_all(state->m_flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); - state->flip_screen_set(state->m_flipscreen); + m_flipscreen = data; + machine().tilemap().set_flip_all(m_flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); + flip_screen_set(m_flipscreen); } -static void draw_background( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void karnov_state::draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - karnov_state *state = machine.driver_data(); int my, mx, offs, color, tile, fx, fy; - int scrollx = state->m_scroll[0]; - int scrolly = state->m_scroll[1]; + int scrollx = m_scroll[0]; + int scrolly = m_scroll[1]; - if (state->m_flipscreen) + if (m_flipscreen) fx = fy = 1; else fx = fy = 0; @@ -98,18 +96,18 @@ static void draw_background( running_machine &machine, bitmap_ind16 &bitmap, con my++; } - tile = state->m_pf_data[offs]; + tile = m_pf_data[offs]; color = tile >> 12; tile = tile & 0x7ff; - if (state->m_flipscreen) - drawgfx_opaque(*state->m_bitmap_f, state->m_bitmap_f->cliprect(), machine.gfx[1],tile, + if (m_flipscreen) + drawgfx_opaque(*m_bitmap_f, m_bitmap_f->cliprect(), machine().gfx[1],tile, color, fx, fy, 496-16*mx,496-16*my); else - drawgfx_opaque(*state->m_bitmap_f, state->m_bitmap_f->cliprect(), machine.gfx[1],tile, + drawgfx_opaque(*m_bitmap_f, m_bitmap_f->cliprect(), machine().gfx[1],tile, color, fx, fy, 16*mx,16*my); } - if (!state->m_flipscreen) + if (!m_flipscreen) { scrolly = -scrolly; scrollx = -scrollx; @@ -120,14 +118,14 @@ static void draw_background( running_machine &machine, bitmap_ind16 &bitmap, con scrollx = scrollx + 256; } - copyscrollbitmap(bitmap, *state->m_bitmap_f, 1, &scrollx, 1, &scrolly, cliprect); + copyscrollbitmap(bitmap, *m_bitmap_f, 1, &scrollx, 1, &scrolly, cliprect); } /******************************************************************************/ UINT32 karnov_state::screen_update_karnov(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - draw_background(machine(), bitmap, cliprect); + draw_background(bitmap, cliprect); machine().device("spritegen")->draw_sprites(machine(), bitmap, cliprect, m_spriteram->buffer(), 0x800, 0); m_fix_tilemap->draw(bitmap, cliprect, 0, 0); return 0; diff --git a/src/mame/video/kchamp.c b/src/mame/video/kchamp.c index dd21f4a9c00..691dfe072c2 100644 --- a/src/mame/video/kchamp.c +++ b/src/mame/video/kchamp.c @@ -65,10 +65,9 @@ void kchamp_state::video_start() 3 XXXXXXXX */ -static void kchamp_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void kchamp_state::kchamp_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - kchamp_state *state = machine.driver_data(); - UINT8 *spriteram = state->m_spriteram; + UINT8 *spriteram = m_spriteram; int offs; for (offs = 0; offs < 0x100; offs += 4) @@ -82,7 +81,7 @@ static void kchamp_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, int sx = spriteram[offs + 3] - 8; int sy = 247 - spriteram[offs]; - if (state->flip_screen()) + if (flip_screen()) { sx = 240 - sx; sy = 240 - sy; @@ -90,14 +89,13 @@ static void kchamp_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, flipy = !flipy; } - drawgfx_transpen(bitmap, cliprect, machine.gfx[bank], code, color, flipx, flipy, sx, sy, 0); + drawgfx_transpen(bitmap, cliprect, machine().gfx[bank], code, color, flipx, flipy, sx, sy, 0); } } -static void kchampvs_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void kchamp_state::kchampvs_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - kchamp_state *state = machine.driver_data(); - UINT8 *spriteram = state->m_spriteram; + UINT8 *spriteram = m_spriteram; int offs; for (offs = 0; offs < 0x100; offs += 4) @@ -111,7 +109,7 @@ static void kchampvs_draw_sprites( running_machine &machine, bitmap_ind16 &bitma int sx = spriteram[offs + 3]; int sy = 240 - spriteram[offs]; - if (state->flip_screen()) + if (flip_screen()) { sx = 240 - sx; sy = 240 - sy; @@ -119,7 +117,7 @@ static void kchampvs_draw_sprites( running_machine &machine, bitmap_ind16 &bitma flipy = !flipy; } - drawgfx_transpen(bitmap, cliprect, machine.gfx[bank], code, color, flipx, flipy, sx, sy, 0); + drawgfx_transpen(bitmap, cliprect, machine().gfx[bank], code, color, flipx, flipy, sx, sy, 0); } } @@ -127,13 +125,13 @@ static void kchampvs_draw_sprites( running_machine &machine, bitmap_ind16 &bitma UINT32 kchamp_state::screen_update_kchamp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(bitmap, cliprect, 0, 0); - kchamp_draw_sprites(machine(), bitmap, cliprect); + kchamp_draw_sprites(bitmap, cliprect); return 0; } UINT32 kchamp_state::screen_update_kchampvs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(bitmap, cliprect, 0, 0); - kchampvs_draw_sprites(machine(), bitmap, cliprect); + kchampvs_draw_sprites(bitmap, cliprect); return 0; } diff --git a/src/mame/video/kickgoal.c b/src/mame/video/kickgoal.c index b32de34b912..00acb6f6bf6 100644 --- a/src/mame/video/kickgoal.c +++ b/src/mame/video/kickgoal.c @@ -88,14 +88,13 @@ TILEMAP_MAPPER_MEMBER(kickgoal_state::tilemap_scan_actionhwbg2)// 32x32 tiles -static void kickgoal_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) +void kickgoal_state::kickgoal_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) { - kickgoal_state *state = machine.driver_data(); - UINT16 *spriteram = state->m_spriteram; - gfx_element *gfx = machine.gfx[1]; + UINT16 *spriteram = m_spriteram; + gfx_element *gfx = machine().gfx[1]; int offs; - for (offs = 0; offs < state->m_spriteram.bytes() / 2; offs += 4) + for (offs = 0; offs < m_spriteram.bytes() / 2; offs += 4) { int xpos = spriteram[offs + 3]; int ypos = spriteram[offs + 0] & 0x00ff; @@ -108,7 +107,7 @@ static void kickgoal_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap ypos = 0x110 - ypos; drawgfx_transpen(bitmap,cliprect,gfx, - tileno+state->m_sprbase, + tileno+m_sprbase, 0x30 + color, flipx,0, xpos-16+4,ypos-32,15); @@ -172,7 +171,7 @@ UINT32 kickgoal_state::screen_update_kickgoal(screen_device &screen, bitmap_ind1 m_bg2tm->draw(bitmap, cliprect, 0, 0); m_bgtm->draw(bitmap, cliprect, 0, 0); - kickgoal_draw_sprites(machine(), bitmap, cliprect); + kickgoal_draw_sprites(bitmap, cliprect); m_fgtm->draw(bitmap, cliprect, 0, 0); diff --git a/src/mame/video/kingobox.c b/src/mame/video/kingobox.c index de33e59531d..ef85bded1fe 100644 --- a/src/mame/video/kingobox.c +++ b/src/mame/video/kingobox.c @@ -23,7 +23,7 @@ ***************************************************************************/ -static void palette_init_common( running_machine &machine, const UINT8 *color_prom, void (*get_rgb_data)(const UINT8 *, int, int *, int *, int *) ) +void kingofb_state::palette_init_common( const UINT8 *color_prom, void (kingofb_state::*get_rgb_data)(const UINT8 *, int, int *, int *, int *) ) { static const int resistances[4] = { 1500, 750, 360, 180 }; static const int resistances_fg[1] = { 51 }; @@ -43,7 +43,7 @@ static void palette_init_common( running_machine &machine, const UINT8 *color_pr 4, resistances, bweights, 470, 0); /* allocate the colortable */ - machine.colortable = colortable_alloc(machine, 0x108); + machine().colortable = colortable_alloc(machine(), 0x108); for (i = 0; i < 0x100; i++) { @@ -51,7 +51,7 @@ static void palette_init_common( running_machine &machine, const UINT8 *color_pr int bit0, bit1, bit2, bit3; int r, g, b; - get_rgb_data(color_prom, i, &r_data, &g_data, &b_data); + (this->*get_rgb_data)(color_prom, i, &r_data, &g_data, &b_data); /* red component */ bit0 = (r_data >> 0) & 0x01; @@ -74,7 +74,7 @@ static void palette_init_common( running_machine &machine, const UINT8 *color_pr bit3 = (b_data >> 3) & 0x01; b = combine_4_weights(bweights, bit0, bit1, bit2, bit3); - colortable_palette_set_color(machine.colortable, i, MAKE_RGB(r, g, b)); + colortable_palette_set_color(machine().colortable, i, MAKE_RGB(r, g, b)); } /* the foreground chars directly map to primary colors */ @@ -91,21 +91,21 @@ static void palette_init_common( running_machine &machine, const UINT8 *color_pr /* blue component */ b = (((i - 0x100) >> 0) & 0x01) * bweights_fg[0]; - colortable_palette_set_color(machine.colortable, i, MAKE_RGB(r, g, b)); + colortable_palette_set_color(machine().colortable, i, MAKE_RGB(r, g, b)); } for (i = 0; i < 0x100; i++) - colortable_entry_set_value(machine.colortable, i, i); + colortable_entry_set_value(machine().colortable, i, i); for (i = 0x101; i < 0x110; i += 2) { UINT16 ctabentry = ((i - 0x101) >> 1) | 0x100; - colortable_entry_set_value(machine.colortable, i, ctabentry); + colortable_entry_set_value(machine().colortable, i, ctabentry); } } -static void kingofb_get_rgb_data( const UINT8 *color_prom, int i, int *r_data, int *g_data, int *b_data ) +void kingofb_state::kingofb_get_rgb_data( const UINT8 *color_prom, int i, int *r_data, int *g_data, int *b_data ) { *r_data = color_prom[i + 0x000] & 0x0f; *g_data = color_prom[i + 0x100] & 0x0f; @@ -113,7 +113,7 @@ static void kingofb_get_rgb_data( const UINT8 *color_prom, int i, int *r_data, i } -static void ringking_get_rgb_data( const UINT8 *color_prom, int i, int *r_data, int *g_data, int *b_data ) +void kingofb_state::ringking_get_rgb_data( const UINT8 *color_prom, int i, int *r_data, int *g_data, int *b_data ) { *r_data = (color_prom[i + 0x000] >> 4) & 0x0f; *g_data = (color_prom[i + 0x000] >> 0) & 0x0f; @@ -124,13 +124,13 @@ static void ringking_get_rgb_data( const UINT8 *color_prom, int i, int *r_data, PALETTE_INIT_MEMBER(kingofb_state,kingofb) { const UINT8 *color_prom = machine().root_device().memregion("proms")->base(); - palette_init_common(machine(), color_prom, kingofb_get_rgb_data); + palette_init_common(color_prom, &kingofb_state::kingofb_get_rgb_data); } PALETTE_INIT_MEMBER(kingofb_state,ringking) { const UINT8 *color_prom = machine().root_device().memregion("proms")->base(); - palette_init_common(machine(), color_prom, ringking_get_rgb_data); + palette_init_common(color_prom, &kingofb_state::ringking_get_rgb_data); } WRITE8_MEMBER(kingofb_state::kingofb_videoram_w) @@ -202,13 +202,12 @@ VIDEO_START_MEMBER(kingofb_state,kingofb) m_fg_tilemap->set_transparent_pen(0); } -static void kingofb_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void kingofb_state::kingofb_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - kingofb_state *state = machine.driver_data(); - UINT8 *spriteram = state->m_spriteram; + UINT8 *spriteram = m_spriteram; int offs; - for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4) + for (offs = 0; offs < m_spriteram.bytes(); offs += 4) { int roffs, bank, code, color, flipx, flipy, sx, sy; @@ -219,13 +218,13 @@ static void kingofb_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, bank = (spriteram[roffs + 3] & 0x04) >> 2; code = spriteram[roffs + 2] + ((spriteram[roffs + 3] & 0x03) << 8); - color = ((spriteram[roffs + 3] & 0x70) >> 4) + 8 * state->m_palette_bank; + color = ((spriteram[roffs + 3] & 0x70) >> 4) + 8 * m_palette_bank; flipx = 0; flipy = spriteram[roffs + 3] & 0x80; sx = spriteram[roffs + 1]; sy = spriteram[roffs]; - if (state->flip_screen()) + if (flip_screen()) { sx = 240 - sx; sy = 240 - sy; @@ -233,7 +232,7 @@ static void kingofb_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, flipy = !flipy; } - drawgfx_transpen(bitmap, cliprect, machine.gfx[2 + bank], + drawgfx_transpen(bitmap, cliprect, machine().gfx[2 + bank], code, color, flipx, flipy, sx, sy, 0); @@ -244,7 +243,7 @@ UINT32 kingofb_state::screen_update_kingofb(screen_device &screen, bitmap_ind16 { m_bg_tilemap->set_scrolly(0, -(*m_scroll_y)); m_bg_tilemap->draw(bitmap, cliprect, 0, 0); - kingofb_draw_sprites(machine(), bitmap, cliprect); + kingofb_draw_sprites(bitmap, cliprect); m_fg_tilemap->draw(bitmap, cliprect, 0, 0); return 0; } @@ -267,23 +266,22 @@ VIDEO_START_MEMBER(kingofb_state,ringking) m_fg_tilemap->set_transparent_pen(0); } -static void ringking_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void kingofb_state::ringking_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - kingofb_state *state = machine.driver_data(); - UINT8 *spriteram = state->m_spriteram; + UINT8 *spriteram = m_spriteram; int offs; - for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4) + for (offs = 0; offs < m_spriteram.bytes(); offs += 4) { int bank = (spriteram[offs + 1] & 0x04) >> 2; int code = spriteram[offs + 3] + ((spriteram[offs + 1] & 0x03) << 8); - int color = ((spriteram[offs + 1] & 0x70) >> 4) + 8 * state->m_palette_bank; + int color = ((spriteram[offs + 1] & 0x70) >> 4) + 8 * m_palette_bank; int flipx = 0; int flipy = (spriteram[offs + 1] & 0x80) ? 0 : 1; int sx = spriteram[offs + 2]; int sy = spriteram[offs]; - if (state->flip_screen()) + if (flip_screen()) { sx = 240 - sx; sy = 240 - sy; @@ -291,7 +289,7 @@ static void ringking_draw_sprites( running_machine &machine, bitmap_ind16 &bitma flipy = !flipy; } - drawgfx_transpen(bitmap, cliprect, machine.gfx[2 + bank], + drawgfx_transpen(bitmap, cliprect, machine().gfx[2 + bank], code, color, flipx, flipy, sx, sy, 0); @@ -302,7 +300,7 @@ UINT32 kingofb_state::screen_update_ringking(screen_device &screen, bitmap_ind16 { m_bg_tilemap->set_scrolly(0, -(*m_scroll_y)); m_bg_tilemap->draw(bitmap, cliprect, 0, 0); - ringking_draw_sprites(machine(), bitmap, cliprect); + ringking_draw_sprites(bitmap, cliprect); m_fg_tilemap->draw(bitmap, cliprect, 0, 0); return 0; } diff --git a/src/mame/video/kncljoe.c b/src/mame/video/kncljoe.c index 851785113c3..d80e5ac269a 100644 --- a/src/mame/video/kncljoe.c +++ b/src/mame/video/kncljoe.c @@ -176,18 +176,17 @@ WRITE8_MEMBER(kncljoe_state::kncljoe_scroll_w) ***************************************************************************/ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void kncljoe_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - kncljoe_state *state = machine.driver_data(); - UINT8 *spriteram = state->m_spriteram; + UINT8 *spriteram = m_spriteram; rectangle clip = cliprect; - gfx_element *gfx = machine.gfx[1 + state->m_sprite_bank]; + gfx_element *gfx = machine().gfx[1 + m_sprite_bank]; int i, j; static const int pribase[4]={0x0180, 0x0080, 0x0100, 0x0000}; - const rectangle &visarea = machine.primary_screen->visible_area(); + const rectangle &visarea = machine().primary_screen->visible_area(); /* score covers sprites */ - if (state->m_flipscreen) + if (m_flipscreen) { if (clip.max_y > visarea.max_y - 64) clip.max_y = visarea.max_y - 64; @@ -215,7 +214,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const if (attr & 0x20) code += 256; - if (state->m_flipscreen) + if (m_flipscreen) { flipx = !flipx; flipy = !flipy; @@ -237,6 +236,6 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const UINT32 kncljoe_state::screen_update_kncljoe(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); return 0; } diff --git a/src/mame/video/ksayakyu.c b/src/mame/video/ksayakyu.c index aebc16de53c..b6077e43639 100644 --- a/src/mame/video/ksayakyu.c +++ b/src/mame/video/ksayakyu.c @@ -78,11 +78,10 @@ TILE_GET_INFO_MEMBER(ksayakyu_state::get_text_tile_info) [3] */ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void ksayakyu_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - ksayakyu_state *state = machine.driver_data(); - const UINT8 *source = state->m_spriteram + state->m_spriteram.bytes() - 4; - const UINT8 *finish = state->m_spriteram; + const UINT8 *source = m_spriteram + m_spriteram.bytes() - 4; + const UINT8 *finish = m_spriteram; while (source>=finish) /* is order correct ? */ { @@ -93,9 +92,9 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const int flipx = (tile & 0x80) ? 1 : 0; int flipy = 0; - gfx_element *gfx = machine.gfx[2]; + gfx_element *gfx = machine().gfx[2]; - if (state->m_flipscreen) + if (m_flipscreen) { sx = 240 - sx; sy = 240 - sy; @@ -128,6 +127,6 @@ UINT32 ksayakyu_state::screen_update_ksayakyu(screen_device &screen, bitmap_ind1 m_tilemap->draw(bitmap, cliprect, 0, 0); m_textmap->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); return 0; } diff --git a/src/mame/video/kyugo.c b/src/mame/video/kyugo.c index cea96df53e6..9753a1e443e 100644 --- a/src/mame/video/kyugo.c +++ b/src/mame/video/kyugo.c @@ -142,15 +142,13 @@ WRITE8_MEMBER(kyugo_state::kyugo_flipscreen_w) * *************************************/ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void kyugo_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - kyugo_state *state = machine.driver_data(); - /* sprite information is scattered through memory */ /* and uses a portion of the text layer memory (outside the visible area) */ - UINT8 *spriteram_area1 = &state->m_spriteram_1[0x28]; - UINT8 *spriteram_area2 = &state->m_spriteram_2[0x28]; - UINT8 *spriteram_area3 = &state->m_fgvideoram[0x28]; + UINT8 *spriteram_area1 = &m_spriteram_1[0x28]; + UINT8 *spriteram_area2 = &m_spriteram_2[0x28]; + UINT8 *spriteram_area3 = &m_fgvideoram[0x28]; int n; @@ -168,7 +166,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const if (sy > 0xf0) sy -= 256; - if (state->m_flipscreen) + if (m_flipscreen) sy = 240 - sy; color = spriteram_area1[offs + 1] & 0x1f; @@ -185,18 +183,18 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const flipx = attr & 0x08; flipy = attr & 0x04; - if (state->m_flipscreen) + if (m_flipscreen) { flipx = !flipx; flipy = !flipy; } - drawgfx_transpen( bitmap, cliprect,machine.gfx[2], + drawgfx_transpen( bitmap, cliprect,machine().gfx[2], code, color, flipx,flipy, - sx,state->m_flipscreen ? sy - 16*y : sy + 16*y, 0 ); + sx,m_flipscreen ? sy - 16*y : sy + 16*y, 0 ); } } } @@ -212,7 +210,7 @@ UINT32 kyugo_state::screen_update_kyugo(screen_device &screen, bitmap_ind16 &bit m_bg_tilemap->set_scrolly(0, m_scroll_y); m_bg_tilemap->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); m_fg_tilemap->draw(bitmap, cliprect, 0, 0); return 0; } -- cgit v1.2.3