diff options
-rw-r--r-- | src/mame/drivers/dlair.cpp | 24 | ||||
-rw-r--r-- | src/mame/machine/raiden2cop.cpp | 363 | ||||
-rw-r--r-- | src/mame/machine/raiden2cop.h | 5 |
3 files changed, 210 insertions, 182 deletions
diff --git a/src/mame/drivers/dlair.cpp b/src/mame/drivers/dlair.cpp index fb7c981a6f1..35c587f73be 100644 --- a/src/mame/drivers/dlair.cpp +++ b/src/mame/drivers/dlair.cpp @@ -214,6 +214,7 @@ UINT32 dlair_state::screen_update_dleuro(screen_device &screen, bitmap_ind16 &bi for (x = 0; x < 32; x++) { UINT8 *base = &videoram[y * 64 + x * 2 + 1]; + // TODO: opaque? m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, base[0], base[1], 0, 0, 10 * x, 16 * y); } @@ -472,13 +473,13 @@ Address in ROM: * *************************************/ + // TODO: DIPs still needs work static INPUT_PORTS_START( dlair ) PORT_START("DSW1") - PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("A:2,1") + PORT_DIPNAME( 0x01, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("A:1") PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) ) -// PORT_DIPSETTING( 0x02, DEF_STR( 3C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x03, DEF_STR( Unused ) ) // TODO: kill me + PORT_DIPUNUSED_DIPLOC( 0x02, IP_ACTIVE_HIGH, "A:2") PORT_DIPNAME( 0x04, 0x00, "Difficulty Mode" ) PORT_DIPLOCATION("A:3") PORT_DIPSETTING( 0x04, "Mode 1" ) PORT_DIPSETTING( 0x00, "Mode 2" ) @@ -499,7 +500,7 @@ static INPUT_PORTS_START( dlair ) PORT_START("DSW2") PORT_DIPNAME( 0x01, 0x01, "Sound every 8 attracts" ) PORT_DIPLOCATION("B:1") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("B:2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) @@ -549,9 +550,9 @@ static INPUT_PORTS_START( dlaire ) PORT_INCLUDE(dlair) PORT_MODIFY("DSW2") - PORT_DIPNAME( 0x08, 0x08, "LD Player" ) /* In Rev F, F2 and so on... before it was Joystick Sound Feedback */ - PORT_DIPSETTING( 0x00, "LD-PR7820" ) - PORT_DIPSETTING( 0x08, "LDV-1000" ) + PORT_DIPNAME( 0x08, 0x00, "LD Player" ) PORT_DIPLOCATION("B:3") /* In Rev F, F2 and so on... before it was Joystick Sound Feedback */ + PORT_DIPSETTING( 0x08, "LD-PR7820" ) + PORT_DIPSETTING( 0x00, "LDV-1000" ) INPUT_PORTS_END @@ -576,11 +577,10 @@ static INPUT_PORTS_START( dleuro ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, dlair_state,laserdisc_command_r, nullptr) /* command strobe */ PORT_START("DSW1") - PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("A:2,1") + PORT_DIPNAME( 0x01, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("A:1") PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) ) -// PORT_DIPSETTING( 0x02, DEF_STR( 3C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x03, DEF_STR( Unused ) ) + PORT_DIPUNUSED_DIPLOC( 0x02, IP_ACTIVE_HIGH, "A:2") PORT_DIPNAME( 0x04, 0x00, "Difficulty Mode" ) PORT_DIPLOCATION("A:3") PORT_DIPSETTING( 0x04, "Mode 1" ) PORT_DIPSETTING( 0x00, "Mode 2" ) @@ -673,7 +673,7 @@ static INPUT_PORTS_START( spaceace ) INPUT_PORTS_END -// TODO: dips for Space Ace euro +// TODO: dips for Space Ace euro, different than NTSC /************************************* * @@ -802,7 +802,7 @@ ROM_START( dlair ) /* revision F2 */ ROM_LOAD( "dl_f2_u4.bin", 0x6000, 0x2000, CRC(f5ec23d2) SHA1(71149e2d359cc5944fbbb53dd7d0c2b42fbc9bb4) ) DISK_REGION( "ld_ldv1000" ) - DISK_IMAGE_READONLY( "dlair", 0, NO_DUMP ) + DISK_IMAGE_READONLY( "dlair", 0, SHA1(da70bac4fe526e48d556ad3fea72cde022c26648) ) ROM_END ROM_START( dlair_1 ) /* Serial #001, courtesy Jason Finn */ diff --git a/src/mame/machine/raiden2cop.cpp b/src/mame/machine/raiden2cop.cpp index 0876506cf78..103a0b145c9 100644 --- a/src/mame/machine/raiden2cop.cpp +++ b/src/mame/machine/raiden2cop.cpp @@ -2,13 +2,14 @@ // copyright-holders:Olivier Galibert, Angelo Salese, David Haywood, Tomasz Slanina /*************************************************************************** - Seibu Cop (Co-Processor) device simulation + Seibu Cop (Co-Processor) device emulation (new implementation, based on Raiden 2 code) TODO: - improve documentation, ffs! - split commands into own file, 2000+ lines is excessive; - improve class OO public/protected/private; + - give this one own folder; - nuke legacy command implementations; - assert for something that needs actual playtesting is bad. - add better debug facilities in a new sub-class, including but not limited to: @@ -16,7 +17,16 @@ - printing facilities; - debugger break on pre-setted commands; - ... - + + Tech notes: + ----------- + [0x6fc] DMA mode bit scheme: + ---1 ---1 ---- ---- fill op if true, else transfer + ---- ---- x--- ---- palette brightness + ---- ---- ---x ---- internal buffer selector + ---- ---- ---- x--- size modifier? Bus transfer size actually? + ---- ---- ---- -xxx select channel + ***************************************************************************/ #include "emu.h" @@ -648,153 +658,198 @@ UINT8 raiden2cop_device::fade_table(int v) return (low * (high | (high >> 5)) + 0x210) >> 10; } +// ALL games use this - tilemap DMA (RAM -> private buffer) +void raiden2cop_device::dma_tilemap_buffer() +{ + int src = cop_dma_src[cop_dma_mode] << 6; + if (src == 0xcfc0) src = 0xd000; // R2, why?? everything else sets the right pointer (it also sets up odd size / dest regs, they probably counteract this) -WRITE16_MEMBER(raiden2cop_device::cop_dma_trigger_w) + for (int i = 0; i < 0x2800 / 2; i++) + { + UINT16 tileval = m_host_space->read_word(src); + src += 2; + m_videoramout_cb(i, tileval, 0xffff); + } +} + + // ALL games use this - palette DMA (RAM -> private buffer) +void raiden2cop_device::dma_palette_buffer() { -#if 0 - if (cop_dma_mode != 0x14 && cop_dma_mode != 0x15) + int src = cop_dma_src[cop_dma_mode] << 6; + + for (int i = 0; i < 0x1000 / 2; i++) // todo, use length register { - printf("COP DMA mode=%x adr=%x size=%x vals=%x %x %x\n", - cop_dma_mode, - cop_dma_src[cop_dma_mode] << 6, - cop_dma_size[cop_dma_mode] << 4, - cop_dma_v1, - cop_dma_v2, - cop_dma_dst[cop_dma_mode]); + UINT16 palval = m_host_space->read_word(src); + src += 2; + m_palette->set_pen_color(i, pal5bit(palval >> 0), pal5bit(palval >> 5), pal5bit(palval >> 10)); } -#endif - switch (cop_dma_mode) +} + +// these are typically used to transfer palette data from one RAM buffer to another, applying fade values to it prior to the 0x15 transfer +void raiden2cop_device::dma_palette_brightness() +{ + UINT32 src, dst, size, i; + + /* + Apparently all of those are just different DMA channels, brightness effects are done through a RAM table and the pal_brightness_val / mode + 0x80 is used by Legionnaire + 0x81 is used by SD Gundam and Godzilla + 0x82 is used by Zero Team and X Se Dae + 0x86 is used by Seibu Cup Soccer + 0x87 is used by Denjin Makai + + TODO: + - Denjin Makai mode 4 is totally guessworked. + - SD Gundam doesn't fade colors correctly, it should have the text layer / sprites with normal gradient and the rest dimmed in most cases, + presumably bad RAM table or bad algorithm + */ + + //if(dma_trigger != 0x87) + //printf("SRC: %08x %08x DST:%08x SIZE:%08x TRIGGER: %08x %02x %02x\n",cop_dma_src[cop_dma_mode] << 6,cop_dma_adr_rel * 0x400,cop_dma_dst[cop_dma_mode] << 6,cop_dma_size[cop_dma_mode] << 5,cop_dma_mode,pal_brightness_val,pal_brightness_mode); + + src = (cop_dma_src[cop_dma_mode] << 6); + dst = (cop_dma_dst[cop_dma_mode] << 6); + size = ((cop_dma_size[cop_dma_mode] << 5) - (cop_dma_dst[cop_dma_mode] << 6) + 0x20) / 2; + + for (i = 0; i < size; i++) { - /********************************************************************************************************************/ - case 0x14: - { // ALL games use this - tilemap DMA (RAM -> private buffer) - { - int src = cop_dma_src[cop_dma_mode] << 6; - if (src == 0xcfc0) src = 0xd000; // R2, why?? everything else sets the right pointer (it also sets up odd size / dest regs, they probably counteract this) + UINT16 pal_val; + int r, g, b; + int rt, gt, bt; - for (int i = 0; i < 0x2800 / 2; i++) + if (pal_brightness_mode == 5) + { + bt = ((m_host_space->read_word(src + (cop_dma_adr_rel * 0x400))) & 0x7c00) >> 5; + bt = fade_table(bt | (pal_brightness_val ^ 0)); + b = ((m_host_space->read_word(src)) & 0x7c00) >> 5; + b = fade_table(b | (pal_brightness_val ^ 0x1f)); + pal_val = ((b + bt) & 0x1f) << 10; + gt = ((m_host_space->read_word(src + (cop_dma_adr_rel * 0x400))) & 0x03e0); + gt = fade_table(gt | (pal_brightness_val ^ 0)); + g = ((m_host_space->read_word(src)) & 0x03e0); + g = fade_table(g | (pal_brightness_val ^ 0x1f)); + pal_val |= ((g + gt) & 0x1f) << 5; + rt = ((m_host_space->read_word(src + (cop_dma_adr_rel * 0x400))) & 0x001f) << 5; + rt = fade_table(rt | (pal_brightness_val ^ 0)); + r = ((m_host_space->read_word(src)) & 0x001f) << 5; + r = fade_table(r | (pal_brightness_val ^ 0x1f)); + pal_val |= ((r + rt) & 0x1f); + } + else if (pal_brightness_mode == 4) //Denjin Makai + { + UINT16 targetpaldata = m_host_space->read_word(src + (cop_dma_adr_rel * 0x400)); + UINT16 paldata = m_host_space->read_word(src); // ^1 !!! (why?) + + bt = (targetpaldata & 0x7c00) >> 10; + b = (paldata & 0x7c00) >> 10; + gt = (targetpaldata & 0x03e0) >> 5; + g = (paldata & 0x03e0) >> 5; + rt = (targetpaldata & 0x001f) >> 0; + r = (paldata & 0x001f) >> 0; + + if (pal_brightness_val == 0x10) + pal_val = bt << 10 | gt << 5 | rt << 0; + else if (pal_brightness_val == 0xff) // TODO: might be the back plane or it still doesn't do any mod, needs PCB tests + pal_val = 0; + else { - UINT16 tileval =m_host_space->read_word(src); - src += 2; - m_videoramout_cb(i, tileval, 0xffff); + bt = fade_table(bt << 5 | ((pal_brightness_val * 2) ^ 0)); + b = fade_table(b << 5 | ((pal_brightness_val * 2) ^ 0x1f)); + pal_val = ((b + bt) & 0x1f) << 10; + gt = fade_table(gt << 5 | ((pal_brightness_val * 2) ^ 0)); + g = fade_table(g << 5 | ((pal_brightness_val * 2) ^ 0x1f)); + pal_val |= ((g + gt) & 0x1f) << 5; + rt = fade_table(rt << 5 | ((pal_brightness_val * 2) ^ 0)); + r = fade_table(r << 5 | ((pal_brightness_val * 2) ^ 0x1f)); + pal_val |= ((r + rt) & 0x1f); } - + } + else + { + printf("Warning: palette DMA used with mode %02x!\n", pal_brightness_mode); + pal_val = m_host_space->read_word(src); } - break; + m_host_space->write_word(dst, pal_val); + src += 2; + dst += 2; } - /********************************************************************************************************************/ - case 0x15: - { // ALL games use this - palette DMA (RAM -> private buffer) - int src = cop_dma_src[cop_dma_mode] << 6; +} - for (int i = 0; i < 0x1000 / 2; i++) // todo, use length register - { - UINT16 palval = m_host_space->read_word(src); - src += 2; - m_palette->set_pen_color(i, pal5bit(palval >> 0), pal5bit(palval >> 5), pal5bit(palval >> 10)); - } +void raiden2cop_device::dma_fill() +{ + UINT32 length, address; + int i; + if (cop_dma_dst[cop_dma_mode] != 0x0000) // Invalid? + return; - break; - } - /********************************************************************************************************************/ - case 0x80: - case 0x81: - case 0x82: - case 0x83: - case 0x84: - case 0x85: - case 0x86: - case 0x87: - { // these are typically used to transfer palette data from one RAM buffer to another, applying fade values to it prior to the 0x15 transfer - UINT32 src, dst, size, i; + address = (cop_dma_src[cop_dma_mode] << 6); + length = (cop_dma_size[cop_dma_mode] + 1) << 5; - /* - Apparently all of those are just different DMA channels, brightness effects are done through a RAM table and the pal_brightness_val / mode - 0x80 is used by Legionnaire - 0x81 is used by SD Gundam and Godzilla - 0x82 is used by Zero Team and X Se Dae - 0x86 is used by Seibu Cup Soccer - 0x87 is used by Denjin Makai + //printf("%08x %08x\n",address,length); - TODO: - - Denjin Makai mode 4 is totally guessworked. - - SD Gundam doesn't fade colors correctly, it should have the text layer / sprites with normal gradient and the rest dimmed in most cases, - presumably bad RAM table or bad algorithm - */ + for (i = address; i < address + length; i += 4) + m_host_space->write_dword(i, (cop_dma_v1) | (cop_dma_v2 << 16)); - //if(dma_trigger != 0x87) - //printf("SRC: %08x %08x DST:%08x SIZE:%08x TRIGGER: %08x %02x %02x\n",cop_dma_src[cop_dma_mode] << 6,cop_dma_adr_rel * 0x400,cop_dma_dst[cop_dma_mode] << 6,cop_dma_size[cop_dma_mode] << 5,cop_dma_mode,pal_brightness_val,pal_brightness_mode); + /* + UINT32 length, address; + int i; + if(cop_dma_dst[cop_dma_mode] != 0x0000) // Invalid? + return; - src = (cop_dma_src[cop_dma_mode] << 6); - dst = (cop_dma_dst[cop_dma_mode] << 6); - size = ((cop_dma_size[cop_dma_mode] << 5) - (cop_dma_dst[cop_dma_mode] << 6) + 0x20) / 2; + address = (cop_dma_src[cop_dma_mode] << 6); + length = (cop_dma_size[cop_dma_mode]+1) << 5; - for (i = 0; i < size; i++) - { - UINT16 pal_val; - int r, g, b; - int rt, gt, bt; + //printf("%08x %08x\n",address,length); - if (pal_brightness_mode == 5) - { - bt = ((m_host_space->read_word(src + (cop_dma_adr_rel * 0x400))) & 0x7c00) >> 5; - bt = fade_table(bt | (pal_brightness_val ^ 0)); - b = ((m_host_space->read_word(src)) & 0x7c00) >> 5; - b = fade_table(b | (pal_brightness_val ^ 0x1f)); - pal_val = ((b + bt) & 0x1f) << 10; - gt = ((m_host_space->read_word(src + (cop_dma_adr_rel * 0x400))) & 0x03e0); - gt = fade_table(gt | (pal_brightness_val ^ 0)); - g = ((m_host_space->read_word(src)) & 0x03e0); - g = fade_table(g | (pal_brightness_val ^ 0x1f)); - pal_val |= ((g + gt) & 0x1f) << 5; - rt = ((m_host_space->read_word(src + (cop_dma_adr_rel * 0x400))) & 0x001f) << 5; - rt = fade_table(rt | (pal_brightness_val ^ 0)); - r = ((m_host_space->read_word(src)) & 0x001f) << 5; - r = fade_table(r | (pal_brightness_val ^ 0x1f)); - pal_val |= ((r + rt) & 0x1f); - } - else if (pal_brightness_mode == 4) //Denjin Makai - { - UINT16 targetpaldata = m_host_space->read_word(src + (cop_dma_adr_rel * 0x400)); - UINT16 paldata = m_host_space->read_word(src); // ^1 !!! (why?) - - bt = (targetpaldata & 0x7c00) >> 10; - b = (paldata & 0x7c00) >> 10; - gt = (targetpaldata & 0x03e0) >> 5; - g = (paldata & 0x03e0) >> 5; - rt = (targetpaldata & 0x001f) >> 0; - r = (paldata & 0x001f) >> 0; - - if (pal_brightness_val == 0x10) - pal_val = bt << 10 | gt << 5 | rt << 0; - else if (pal_brightness_val == 0xff) // TODO: might be the back plane or it still doesn't do any mod, needs PCB tests - pal_val = 0; - else - { - bt = fade_table(bt << 5 | ((pal_brightness_val * 2) ^ 0)); - b = fade_table(b << 5 | ((pal_brightness_val * 2) ^ 0x1f)); - pal_val = ((b + bt) & 0x1f) << 10; - gt = fade_table(gt << 5 | ((pal_brightness_val * 2) ^ 0)); - g = fade_table(g << 5 | ((pal_brightness_val * 2) ^ 0x1f)); - pal_val |= ((g + gt) & 0x1f) << 5; - rt = fade_table(rt << 5 | ((pal_brightness_val * 2) ^ 0)); - r = fade_table(r << 5 | ((pal_brightness_val * 2) ^ 0x1f)); - pal_val |= ((r + rt) & 0x1f); - } - } - else - { - printf("Warning: palette DMA used with mode %02x!\n", pal_brightness_mode); - pal_val = m_host_space->read_word(src); - } + for (i=address;i<address+length;i+=4) + { + m_host_space->write_dword(i, m_fill_val); + } + */ +} - m_host_space->write_word(dst, pal_val); - src += 2; - dst += 2; - } - break; +WRITE16_MEMBER(raiden2cop_device::cop_dma_trigger_w) +{ +#if 0 + if (cop_dma_mode != 0x14 && cop_dma_mode != 0x15) + { + printf("COP DMA mode=%x adr=%x size=%x vals=%x %x %x\n", + cop_dma_mode, + cop_dma_src[cop_dma_mode] << 6, + cop_dma_size[cop_dma_mode] << 4, + cop_dma_v1, + cop_dma_v2, + cop_dma_dst[cop_dma_mode]); } +#endif + + switch (cop_dma_mode) + { + case 0x14: + { + dma_tilemap_buffer(); + break; + } + + case 0x15: + { + dma_palette_buffer(); + break; + } + + case 0x80: + case 0x81: + case 0x82: + case 0x83: + case 0x84: + case 0x85: + case 0x86: + case 0x87: + { dma_palette_brightness(); + break; + } + /********************************************************************************************************************/ case 0x09: { UINT32 src, dst, size; @@ -852,50 +907,18 @@ WRITE16_MEMBER(raiden2cop_device::cop_dma_trigger_w) break; } - /********************************************************************************************************************/ - case 0x118: - case 0x119: - case 0x11a: - case 0x11b: - case 0x11c: - case 0x11d: - case 0x11e: - case 0x11f: { - UINT32 length, address; - int i; - if (cop_dma_dst[cop_dma_mode] != 0x0000) // Invalid? - return; - - address = (cop_dma_src[cop_dma_mode] << 6); - length = (cop_dma_size[cop_dma_mode] + 1) << 5; - - //printf("%08x %08x\n",address,length); - - for (i = address; i < address + length; i += 4) - { - m_host_space->write_dword(i, (cop_dma_v1) | (cop_dma_v2 << 16)); - } - /* - UINT32 length, address; - int i; - if(cop_dma_dst[cop_dma_mode] != 0x0000) // Invalid? - return; - - address = (cop_dma_src[cop_dma_mode] << 6); - length = (cop_dma_size[cop_dma_mode]+1) << 5; - - //printf("%08x %08x\n",address,length); - - for (i=address;i<address+length;i+=4) + case 0x118: + case 0x119: + case 0x11a: + case 0x11b: + case 0x11c: + case 0x11d: + case 0x11e: + case 0x11f: { - m_host_space->write_dword(i, m_fill_val); + dma_fill(); + break; } - */ - - break; - } - - } } diff --git a/src/mame/machine/raiden2cop.h b/src/mame/machine/raiden2cop.h index f635474895b..eefda38ca1a 100644 --- a/src/mame/machine/raiden2cop.h +++ b/src/mame/machine/raiden2cop.h @@ -267,6 +267,11 @@ private: UINT8 cop_read_byte(int address); void cop_write_word(int address, UINT16 data); void cop_write_byte(int address, UINT8 data); + + void dma_tilemap_buffer(); + void dma_palette_buffer(); + void dma_fill(); + void dma_palette_brightness(); }; extern const device_type RAIDEN2COP; |