From 4ffbeffe5e9de6def066f4cda5998fedb7f88724 Mon Sep 17 00:00:00 2001 From: MooglyGuy Date: Mon, 17 Feb 2020 01:37:48 +0100 Subject: -1942: Improved sprite priorities, but not yet perfect. Improved IRQ timing accuracy. Demoted to MACHINE_IMPERFECT_GRAPHICS. [Ryan Holtz, David Haywood, smf, Olivier Galibert] --- src/mame/drivers/1942.cpp | 208 +++++++++++++++++++++++++++++----------------- src/mame/includes/1942.h | 5 ++ src/mame/video/1942.cpp | 142 +++++++++++++++++-------------- 3 files changed, 219 insertions(+), 136 deletions(-) diff --git a/src/mame/drivers/1942.cpp b/src/mame/drivers/1942.cpp index 3a7c85ceb04..7b155bedb8d 100644 --- a/src/mame/drivers/1942.cpp +++ b/src/mame/drivers/1942.cpp @@ -67,7 +67,6 @@ correctly. #include "cpu/z80/z80.h" #include "sound/ay8910.h" #include "machine/netlist.h" -#include "screen.h" #include "speaker.h" #include "audio/nl_1942.h" @@ -96,11 +95,26 @@ TIMER_DEVICE_CALLBACK_MEMBER(_1942_state::_1942_scanline) { int scanline = param; - if(scanline == 240) // vblank-out irq - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xd7); /* Z80 - RST 10h - vblank */ + //buffer_sprites(m_screen->vpos()); + m_screen->update_partial(m_screen->vpos()); + + if (scanline == 0x2c) // audio irq point 1 + m_audiocpu->set_input_line(0, HOLD_LINE); - if(scanline == 0) // unknown irq event, presumably vblank-in or a periodic one (writes to the soundlatch and drives freeze dip-switch) + if (scanline == 0x6d) // periodic irq (writes to the soundlatch and drives freeze dip-switch), + audio irq point 2 + { m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xcf); /* Z80 - RST 08h */ + m_audiocpu->set_input_line(0, HOLD_LINE); + } + + if (scanline == 0xaf) // audio irq point 3 + m_audiocpu->set_input_line(0, HOLD_LINE); + + if (scanline == 0xf0) // vblank-out irq, audio irq point 4 + { + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xd7); /* Z80 - RST 10h - vblank */ + m_audiocpu->set_input_line(0, HOLD_LINE); + } } @@ -495,21 +509,19 @@ void _1942_state::_1942(machine_config &config) Z80(config, m_audiocpu, SOUND_CPU_CLOCK); /* 3 MHz ??? */ m_audiocpu->set_addrmap(AS_PROGRAM, &_1942_state::sound_map); - m_audiocpu->set_periodic_int(FUNC(_1942_state::irq0_line_hold), attotime::from_hz(4*60)); - /* video hardware */ GFXDECODE(config, m_gfxdecode, m_palette, gfx_1942); PALETTE(config, m_palette, FUNC(_1942_state::_1942_palette), 64*4+4*32*8+16*16, 256); - screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); - screen.set_refresh_hz(60); - screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); - screen.set_size(32*8, 32*8); - screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1); - screen.set_screen_update(FUNC(_1942_state::screen_update)); - screen.set_palette(m_palette); + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_refresh_hz(60); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0)); + m_screen->set_size(32*8, 32*8); + m_screen->set_visarea(0*8, 32*8-1, 2*8, 30*8-1); + m_screen->set_screen_update(FUNC(_1942_state::screen_update)); + m_screen->set_palette(m_palette); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -566,13 +578,13 @@ void _1942p_state::_1942p(machine_config &config) PALETTE(config, m_palette, FUNC(_1942p_state::_1942p_palette), 0x500, 0x400); - screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); - screen.set_refresh_hz(60); - screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); - screen.set_size(32*8, 32*8); - screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1); - screen.set_screen_update(FUNC(_1942p_state::screen_update)); - screen.set_palette(m_palette); + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_refresh_hz(60); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0)); + m_screen->set_size(32*8, 32*8); + m_screen->set_visarea(0*8, 32*8-1, 2*8, 30*8-1); + m_screen->set_screen_update(FUNC(_1942p_state::screen_update)); + m_screen->set_palette(m_palette); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -619,17 +631,25 @@ ROM_START( 1942 ) ROM_LOAD( "sr-16.n1", 0x08000, 0x4000, CRC(024418f8) SHA1(145b8d5d6c8654cd090955a98f6dd8c8dbafe7c1) ) ROM_LOAD( "sr-17.n2", 0x0c000, 0x4000, CRC(e2c7e489) SHA1(d4b5d575c021f58f6966df189df94e08c5b3621c) ) - ROM_REGION( 0x0a00, "proms", 0 ) + ROM_REGION( 0x0300, "palproms", 0 ) ROM_LOAD( "sb-5.e8", 0x0000, 0x0100, CRC(93ab8153) SHA1(a792f24e5c0c3c4a6b436102e7a98199f878ece1) ) /* red component */ ROM_LOAD( "sb-6.e9", 0x0100, 0x0100, CRC(8ab44f7d) SHA1(f74680a6a987d74b3acb32e6396f20e127874149) ) /* green component */ ROM_LOAD( "sb-7.e10", 0x0200, 0x0100, CRC(f4ade9a4) SHA1(62ad31d31d183cce213b03168daa035083b2f28e) ) /* blue component */ - ROM_LOAD( "sb-0.f1", 0x0300, 0x0100, CRC(6047d91b) SHA1(1ce025f9524c1033e48c5294ee7d360f8bfebe8d) ) /* char lookup table */ - ROM_LOAD( "sb-4.d6", 0x0400, 0x0100, CRC(4858968d) SHA1(20b5dbcaa1a4081b3139e7e2332d8fe3c9e55ed6) ) /* tile lookup table */ - ROM_LOAD( "sb-8.k3", 0x0500, 0x0100, CRC(f6fad943) SHA1(b0a24ea7805272e8ebf72a99b08907bc00d5f82f) ) /* sprite lookup table */ - ROM_LOAD( "sb-2.d1", 0x0600, 0x0100, CRC(8bb8b3df) SHA1(49de2819c4c92057fedcb20425282515d85829aa) ) /* tile palette selector? (not used) */ - ROM_LOAD( "sb-3.d2", 0x0700, 0x0100, CRC(3b0c99af) SHA1(38f30ac1e48632634e409f328ee3051b987de7ad) ) /* tile palette selector? (not used) */ - ROM_LOAD( "sb-1.k6", 0x0800, 0x0100, CRC(712ac508) SHA1(5349d722ab6733afdda65f6e0a98322f0d515e86) ) /* interrupt timing (not used) */ - ROM_LOAD( "sb-9.m11", 0x0900, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) /* video timing? (not used) */ + + ROM_REGION( 0x0100, "charprom", 0 ) + ROM_LOAD( "sb-0.f1", 0x0000, 0x0100, CRC(6047d91b) SHA1(1ce025f9524c1033e48c5294ee7d360f8bfebe8d) ) /* char lookup table */ + + ROM_REGION( 0x0100, "tileprom", 0 ) + ROM_LOAD( "sb-4.d6", 0x0000, 0x0100, CRC(4858968d) SHA1(20b5dbcaa1a4081b3139e7e2332d8fe3c9e55ed6) ) /* tile lookup table */ + + ROM_REGION( 0x0100, "sprprom", 0 ) + ROM_LOAD( "sb-8.k3", 0x0000, 0x0100, CRC(f6fad943) SHA1(b0a24ea7805272e8ebf72a99b08907bc00d5f82f) ) /* sprite lookup table */ + + ROM_REGION( 0x0400, "proms", 0 ) + ROM_LOAD( "sb-2.d1", 0x0000, 0x0100, CRC(8bb8b3df) SHA1(49de2819c4c92057fedcb20425282515d85829aa) ) /* tile palette selector? (not used) */ + ROM_LOAD( "sb-3.d2", 0x0100, 0x0100, CRC(3b0c99af) SHA1(38f30ac1e48632634e409f328ee3051b987de7ad) ) /* tile palette selector? (not used) */ + ROM_LOAD( "sb-1.k6", 0x0200, 0x0100, CRC(712ac508) SHA1(5349d722ab6733afdda65f6e0a98322f0d515e86) ) /* interrupt timing (not used) */ + ROM_LOAD( "sb-9.m11", 0x0300, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) /* video timing? (not used) */ ROM_END ROM_START( 1942a ) @@ -660,17 +680,25 @@ ROM_START( 1942a ) ROM_LOAD( "sr-16.n1", 0x08000, 0x4000, CRC(024418f8) SHA1(145b8d5d6c8654cd090955a98f6dd8c8dbafe7c1) ) ROM_LOAD( "sr-17.n2", 0x0c000, 0x4000, CRC(e2c7e489) SHA1(d4b5d575c021f58f6966df189df94e08c5b3621c) ) - ROM_REGION( 0x0a00, "proms", 0 ) + ROM_REGION( 0x0300, "palproms", 0 ) ROM_LOAD( "sb-5.e8", 0x0000, 0x0100, CRC(93ab8153) SHA1(a792f24e5c0c3c4a6b436102e7a98199f878ece1) ) /* red component */ ROM_LOAD( "sb-6.e9", 0x0100, 0x0100, CRC(8ab44f7d) SHA1(f74680a6a987d74b3acb32e6396f20e127874149) ) /* green component */ ROM_LOAD( "sb-7.e10", 0x0200, 0x0100, CRC(f4ade9a4) SHA1(62ad31d31d183cce213b03168daa035083b2f28e) ) /* blue component */ - ROM_LOAD( "sb-0.f1", 0x0300, 0x0100, CRC(6047d91b) SHA1(1ce025f9524c1033e48c5294ee7d360f8bfebe8d) ) /* char lookup table */ - ROM_LOAD( "sb-4.d6", 0x0400, 0x0100, CRC(4858968d) SHA1(20b5dbcaa1a4081b3139e7e2332d8fe3c9e55ed6) ) /* tile lookup table */ - ROM_LOAD( "sb-8.k3", 0x0500, 0x0100, CRC(f6fad943) SHA1(b0a24ea7805272e8ebf72a99b08907bc00d5f82f) ) /* sprite lookup table */ - ROM_LOAD( "sb-2.d1", 0x0600, 0x0100, CRC(8bb8b3df) SHA1(49de2819c4c92057fedcb20425282515d85829aa) ) /* tile palette selector? (not used) */ - ROM_LOAD( "sb-3.d2", 0x0700, 0x0100, CRC(3b0c99af) SHA1(38f30ac1e48632634e409f328ee3051b987de7ad) ) /* tile palette selector? (not used) */ - ROM_LOAD( "sb-1.k6", 0x0800, 0x0100, CRC(712ac508) SHA1(5349d722ab6733afdda65f6e0a98322f0d515e86) ) /* interrupt timing (not used) */ - ROM_LOAD( "sb-9.m11", 0x0900, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) /* video timing? (not used) */ + + ROM_REGION( 0x0100, "charprom", 0 ) + ROM_LOAD( "sb-0.f1", 0x0000, 0x0100, CRC(6047d91b) SHA1(1ce025f9524c1033e48c5294ee7d360f8bfebe8d) ) /* char lookup table */ + + ROM_REGION( 0x0100, "tileprom", 0 ) + ROM_LOAD( "sb-4.d6", 0x0000, 0x0100, CRC(4858968d) SHA1(20b5dbcaa1a4081b3139e7e2332d8fe3c9e55ed6) ) /* tile lookup table */ + + ROM_REGION( 0x0100, "sprprom", 0 ) + ROM_LOAD( "sb-8.k3", 0x0000, 0x0100, CRC(f6fad943) SHA1(b0a24ea7805272e8ebf72a99b08907bc00d5f82f) ) /* sprite lookup table */ + + ROM_REGION( 0x0400, "proms", 0 ) + ROM_LOAD( "sb-2.d1", 0x0000, 0x0100, CRC(8bb8b3df) SHA1(49de2819c4c92057fedcb20425282515d85829aa) ) /* tile palette selector? (not used) */ + ROM_LOAD( "sb-3.d2", 0x0100, 0x0100, CRC(3b0c99af) SHA1(38f30ac1e48632634e409f328ee3051b987de7ad) ) /* tile palette selector? (not used) */ + ROM_LOAD( "sb-1.k6", 0x0200, 0x0100, CRC(712ac508) SHA1(5349d722ab6733afdda65f6e0a98322f0d515e86) ) /* interrupt timing (not used) */ + ROM_LOAD( "sb-9.m11", 0x0300, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) /* video timing? (not used) */ ROM_END /* this is the same as the 1942a set, but with a different rom arrangement (larger roms), it appears to be a common bootleg */ @@ -698,17 +726,25 @@ ROM_START( 1942abl ) ROM_CONTINUE(0x8000,0x4000) // proms not in the set, assumed to be the same - ROM_REGION( 0x0a00, "proms", 0 ) + ROM_REGION( 0x0300, "palproms", 0 ) ROM_LOAD( "sb-5.e8", 0x0000, 0x0100, CRC(93ab8153) SHA1(a792f24e5c0c3c4a6b436102e7a98199f878ece1) ) /* red component */ ROM_LOAD( "sb-6.e9", 0x0100, 0x0100, CRC(8ab44f7d) SHA1(f74680a6a987d74b3acb32e6396f20e127874149) ) /* green component */ ROM_LOAD( "sb-7.e10", 0x0200, 0x0100, CRC(f4ade9a4) SHA1(62ad31d31d183cce213b03168daa035083b2f28e) ) /* blue component */ - ROM_LOAD( "sb-0.f1", 0x0300, 0x0100, CRC(6047d91b) SHA1(1ce025f9524c1033e48c5294ee7d360f8bfebe8d) ) /* char lookup table */ - ROM_LOAD( "sb-4.d6", 0x0400, 0x0100, CRC(4858968d) SHA1(20b5dbcaa1a4081b3139e7e2332d8fe3c9e55ed6) ) /* tile lookup table */ - ROM_LOAD( "sb-8.k3", 0x0500, 0x0100, CRC(f6fad943) SHA1(b0a24ea7805272e8ebf72a99b08907bc00d5f82f) ) /* sprite lookup table */ - ROM_LOAD( "sb-2.d1", 0x0600, 0x0100, CRC(8bb8b3df) SHA1(49de2819c4c92057fedcb20425282515d85829aa) ) /* tile palette selector? (not used) */ - ROM_LOAD( "sb-3.d2", 0x0700, 0x0100, CRC(3b0c99af) SHA1(38f30ac1e48632634e409f328ee3051b987de7ad) ) /* tile palette selector? (not used) */ - ROM_LOAD( "sb-1.k6", 0x0800, 0x0100, CRC(712ac508) SHA1(5349d722ab6733afdda65f6e0a98322f0d515e86) ) /* interrupt timing (not used) */ - ROM_LOAD( "sb-9.m11", 0x0900, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) /* video timing? (not used) */ + + ROM_REGION( 0x0100, "charprom", 0 ) + ROM_LOAD( "sb-0.f1", 0x0000, 0x0100, CRC(6047d91b) SHA1(1ce025f9524c1033e48c5294ee7d360f8bfebe8d) ) /* char lookup table */ + + ROM_REGION( 0x0100, "tileprom", 0 ) + ROM_LOAD( "sb-4.d6", 0x0000, 0x0100, CRC(4858968d) SHA1(20b5dbcaa1a4081b3139e7e2332d8fe3c9e55ed6) ) /* tile lookup table */ + + ROM_REGION( 0x0100, "sprprom", 0 ) + ROM_LOAD( "sb-8.k3", 0x0000, 0x0100, CRC(f6fad943) SHA1(b0a24ea7805272e8ebf72a99b08907bc00d5f82f) ) /* sprite lookup table */ + + ROM_REGION( 0x0400, "proms", 0 ) + ROM_LOAD( "sb-2.d1", 0x0000, 0x0100, CRC(8bb8b3df) SHA1(49de2819c4c92057fedcb20425282515d85829aa) ) /* tile palette selector? (not used) */ + ROM_LOAD( "sb-3.d2", 0x0100, 0x0100, CRC(3b0c99af) SHA1(38f30ac1e48632634e409f328ee3051b987de7ad) ) /* tile palette selector? (not used) */ + ROM_LOAD( "sb-1.k6", 0x0200, 0x0100, CRC(712ac508) SHA1(5349d722ab6733afdda65f6e0a98322f0d515e86) ) /* interrupt timing (not used) */ + ROM_LOAD( "sb-9.m11", 0x0300, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) /* video timing? (not used) */ ROM_END /* set contained only three program ROMs, other ROMs should be checked against a real PCB */ @@ -740,17 +776,25 @@ ROM_START( 1942h ) ROM_LOAD( "sr-16.n1", 0x08000, 0x4000, CRC(024418f8) SHA1(145b8d5d6c8654cd090955a98f6dd8c8dbafe7c1) ) ROM_LOAD( "sr-17.n2", 0x0c000, 0x4000, CRC(e2c7e489) SHA1(d4b5d575c021f58f6966df189df94e08c5b3621c) ) - ROM_REGION( 0x0a00, "proms", 0 ) + ROM_REGION( 0x0300, "palproms", 0 ) ROM_LOAD( "sb-5.e8", 0x0000, 0x0100, CRC(93ab8153) SHA1(a792f24e5c0c3c4a6b436102e7a98199f878ece1) ) /* red component */ ROM_LOAD( "sb-6.e9", 0x0100, 0x0100, CRC(8ab44f7d) SHA1(f74680a6a987d74b3acb32e6396f20e127874149) ) /* green component */ ROM_LOAD( "sb-7.e10", 0x0200, 0x0100, CRC(f4ade9a4) SHA1(62ad31d31d183cce213b03168daa035083b2f28e) ) /* blue component */ - ROM_LOAD( "sb-0.f1", 0x0300, 0x0100, CRC(6047d91b) SHA1(1ce025f9524c1033e48c5294ee7d360f8bfebe8d) ) /* char lookup table */ - ROM_LOAD( "sb-4.d6", 0x0400, 0x0100, CRC(4858968d) SHA1(20b5dbcaa1a4081b3139e7e2332d8fe3c9e55ed6) ) /* tile lookup table */ - ROM_LOAD( "sb-8.k3", 0x0500, 0x0100, CRC(f6fad943) SHA1(b0a24ea7805272e8ebf72a99b08907bc00d5f82f) ) /* sprite lookup table */ - ROM_LOAD( "sb-2.d1", 0x0600, 0x0100, CRC(8bb8b3df) SHA1(49de2819c4c92057fedcb20425282515d85829aa) ) /* tile palette selector? (not used) */ - ROM_LOAD( "sb-3.d2", 0x0700, 0x0100, CRC(3b0c99af) SHA1(38f30ac1e48632634e409f328ee3051b987de7ad) ) /* tile palette selector? (not used) */ - ROM_LOAD( "sb-1.k6", 0x0800, 0x0100, CRC(712ac508) SHA1(5349d722ab6733afdda65f6e0a98322f0d515e86) ) /* interrupt timing (not used) */ - ROM_LOAD( "sb-9.m11", 0x0900, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) /* video timing? (not used) */ + + ROM_REGION( 0x0100, "charprom", 0 ) + ROM_LOAD( "sb-0.f1", 0x0000, 0x0100, CRC(6047d91b) SHA1(1ce025f9524c1033e48c5294ee7d360f8bfebe8d) ) /* char lookup table */ + + ROM_REGION( 0x0100, "tileprom", 0 ) + ROM_LOAD( "sb-4.d6", 0x0000, 0x0100, CRC(4858968d) SHA1(20b5dbcaa1a4081b3139e7e2332d8fe3c9e55ed6) ) /* tile lookup table */ + + ROM_REGION( 0x0100, "sprprom", 0 ) + ROM_LOAD( "sb-8.k3", 0x0000, 0x0100, CRC(f6fad943) SHA1(b0a24ea7805272e8ebf72a99b08907bc00d5f82f) ) /* sprite lookup table */ + + ROM_REGION( 0x0400, "proms", 0 ) + ROM_LOAD( "sb-2.d1", 0x0000, 0x0100, CRC(8bb8b3df) SHA1(49de2819c4c92057fedcb20425282515d85829aa) ) /* tile palette selector? (not used) */ + ROM_LOAD( "sb-3.d2", 0x0100, 0x0100, CRC(3b0c99af) SHA1(38f30ac1e48632634e409f328ee3051b987de7ad) ) /* tile palette selector? (not used) */ + ROM_LOAD( "sb-1.k6", 0x0200, 0x0100, CRC(712ac508) SHA1(5349d722ab6733afdda65f6e0a98322f0d515e86) ) /* interrupt timing (not used) */ + ROM_LOAD( "sb-9.m11", 0x0300, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) /* video timing? (not used) */ ROM_END ROM_START( 1942b ) @@ -781,17 +825,25 @@ ROM_START( 1942b ) ROM_LOAD( "sr-16.n1", 0x08000, 0x4000, CRC(024418f8) SHA1(145b8d5d6c8654cd090955a98f6dd8c8dbafe7c1) ) ROM_LOAD( "sr-17.n2", 0x0c000, 0x4000, CRC(e2c7e489) SHA1(d4b5d575c021f58f6966df189df94e08c5b3621c) ) - ROM_REGION( 0x0a00, "proms", 0 ) + ROM_REGION( 0x0300, "palproms", 0 ) ROM_LOAD( "sb-5.e8", 0x0000, 0x0100, CRC(93ab8153) SHA1(a792f24e5c0c3c4a6b436102e7a98199f878ece1) ) /* red component */ ROM_LOAD( "sb-6.e9", 0x0100, 0x0100, CRC(8ab44f7d) SHA1(f74680a6a987d74b3acb32e6396f20e127874149) ) /* green component */ ROM_LOAD( "sb-7.e10", 0x0200, 0x0100, CRC(f4ade9a4) SHA1(62ad31d31d183cce213b03168daa035083b2f28e) ) /* blue component */ - ROM_LOAD( "sb-0.f1", 0x0300, 0x0100, CRC(6047d91b) SHA1(1ce025f9524c1033e48c5294ee7d360f8bfebe8d) ) /* char lookup table */ - ROM_LOAD( "sb-4.d6", 0x0400, 0x0100, CRC(4858968d) SHA1(20b5dbcaa1a4081b3139e7e2332d8fe3c9e55ed6) ) /* tile lookup table */ - ROM_LOAD( "sb-8.k3", 0x0500, 0x0100, CRC(f6fad943) SHA1(b0a24ea7805272e8ebf72a99b08907bc00d5f82f) ) /* sprite lookup table */ - ROM_LOAD( "sb-2.d1", 0x0600, 0x0100, CRC(8bb8b3df) SHA1(49de2819c4c92057fedcb20425282515d85829aa) ) /* tile palette selector? (not used) */ - ROM_LOAD( "sb-3.d2", 0x0700, 0x0100, CRC(3b0c99af) SHA1(38f30ac1e48632634e409f328ee3051b987de7ad) ) /* tile palette selector? (not used) */ - ROM_LOAD( "sb-1.k6", 0x0800, 0x0100, CRC(712ac508) SHA1(5349d722ab6733afdda65f6e0a98322f0d515e86) ) /* interrupt timing (not used) */ - ROM_LOAD( "sb-9.m11", 0x0900, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) /* video timing? (not used) */ + + ROM_REGION( 0x0100, "charprom", 0 ) + ROM_LOAD( "sb-0.f1", 0x0000, 0x0100, CRC(6047d91b) SHA1(1ce025f9524c1033e48c5294ee7d360f8bfebe8d) ) /* char lookup table */ + + ROM_REGION( 0x0100, "tileprom", 0 ) + ROM_LOAD( "sb-4.d6", 0x0000, 0x0100, CRC(4858968d) SHA1(20b5dbcaa1a4081b3139e7e2332d8fe3c9e55ed6) ) /* tile lookup table */ + + ROM_REGION( 0x0100, "sprprom", 0 ) + ROM_LOAD( "sb-8.k3", 0x0000, 0x0100, CRC(f6fad943) SHA1(b0a24ea7805272e8ebf72a99b08907bc00d5f82f) ) /* sprite lookup table */ + + ROM_REGION( 0x0400, "proms", 0 ) + ROM_LOAD( "sb-2.d1", 0x0000, 0x0100, CRC(8bb8b3df) SHA1(49de2819c4c92057fedcb20425282515d85829aa) ) /* tile palette selector? (not used) */ + ROM_LOAD( "sb-3.d2", 0x0100, 0x0100, CRC(3b0c99af) SHA1(38f30ac1e48632634e409f328ee3051b987de7ad) ) /* tile palette selector? (not used) */ + ROM_LOAD( "sb-1.k6", 0x0200, 0x0100, CRC(712ac508) SHA1(5349d722ab6733afdda65f6e0a98322f0d515e86) ) /* interrupt timing (not used) */ + ROM_LOAD( "sb-9.m11", 0x0300, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) /* video timing? (not used) */ ROM_END ROM_START( 1942w ) @@ -822,17 +874,25 @@ ROM_START( 1942w ) ROM_LOAD( "sr-16.n1", 0x08000, 0x4000, CRC(024418f8) SHA1(145b8d5d6c8654cd090955a98f6dd8c8dbafe7c1) ) ROM_LOAD( "sr-17.n2", 0x0c000, 0x4000, CRC(e2c7e489) SHA1(d4b5d575c021f58f6966df189df94e08c5b3621c) ) - ROM_REGION( 0x0a00, "proms", 0 ) + ROM_REGION( 0x0300, "palproms", 0 ) ROM_LOAD( "sb-5.e8", 0x0000, 0x0100, CRC(93ab8153) SHA1(a792f24e5c0c3c4a6b436102e7a98199f878ece1) ) /* red component */ ROM_LOAD( "sb-6.e9", 0x0100, 0x0100, CRC(8ab44f7d) SHA1(f74680a6a987d74b3acb32e6396f20e127874149) ) /* green component */ ROM_LOAD( "sb-7.e10", 0x0200, 0x0100, CRC(f4ade9a4) SHA1(62ad31d31d183cce213b03168daa035083b2f28e) ) /* blue component */ - ROM_LOAD( "sb-0.f1", 0x0300, 0x0100, CRC(6047d91b) SHA1(1ce025f9524c1033e48c5294ee7d360f8bfebe8d) ) /* char lookup table */ - ROM_LOAD( "sb-4.d6", 0x0400, 0x0100, CRC(4858968d) SHA1(20b5dbcaa1a4081b3139e7e2332d8fe3c9e55ed6) ) /* tile lookup table */ - ROM_LOAD( "sb-8.k3", 0x0500, 0x0100, CRC(f6fad943) SHA1(b0a24ea7805272e8ebf72a99b08907bc00d5f82f) ) /* sprite lookup table */ - ROM_LOAD( "sb-2.d1", 0x0600, 0x0100, CRC(8bb8b3df) SHA1(49de2819c4c92057fedcb20425282515d85829aa) ) /* tile palette selector? (not used) */ - ROM_LOAD( "sb-3.d2", 0x0700, 0x0100, CRC(3b0c99af) SHA1(38f30ac1e48632634e409f328ee3051b987de7ad) ) /* tile palette selector? (not used) */ - ROM_LOAD( "sb-1.k6", 0x0800, 0x0100, CRC(712ac508) SHA1(5349d722ab6733afdda65f6e0a98322f0d515e86) ) /* interrupt timing (not used) */ - ROM_LOAD( "sb-9.m11", 0x0900, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) /* video timing? (not used) */ + + ROM_REGION( 0x0100, "charprom", 0 ) + ROM_LOAD( "sb-0.f1", 0x0000, 0x0100, CRC(6047d91b) SHA1(1ce025f9524c1033e48c5294ee7d360f8bfebe8d) ) /* char lookup table */ + + ROM_REGION( 0x0100, "tileprom", 0 ) + ROM_LOAD( "sb-4.d6", 0x0000, 0x0100, CRC(4858968d) SHA1(20b5dbcaa1a4081b3139e7e2332d8fe3c9e55ed6) ) /* tile lookup table */ + + ROM_REGION( 0x0100, "sprprom", 0 ) + ROM_LOAD( "sb-8.k3", 0x0000, 0x0100, CRC(f6fad943) SHA1(b0a24ea7805272e8ebf72a99b08907bc00d5f82f) ) /* sprite lookup table */ + + ROM_REGION( 0x0400, "proms", 0 ) + ROM_LOAD( "sb-2.d1", 0x0000, 0x0100, CRC(8bb8b3df) SHA1(49de2819c4c92057fedcb20425282515d85829aa) ) /* tile palette selector? (not used) */ + ROM_LOAD( "sb-3.d2", 0x0100, 0x0100, CRC(3b0c99af) SHA1(38f30ac1e48632634e409f328ee3051b987de7ad) ) /* tile palette selector? (not used) */ + ROM_LOAD( "sb-1.k6", 0x0200, 0x0100, CRC(712ac508) SHA1(5349d722ab6733afdda65f6e0a98322f0d515e86) ) /* interrupt timing (not used) */ + ROM_LOAD( "sb-9.m11", 0x0300, 0x0100, CRC(4921635c) SHA1(aee37d6cdc36acf0f11ff5f93e7b16e4b12f6c39) ) /* video timing? (not used) */ ROM_END @@ -873,10 +933,10 @@ void _1942_state::driver_init() } -GAME( 1984, 1942, 0, _1942, 1942, _1942_state, driver_init, ROT270, "Capcom", "1942 (Revision B)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, 1942a, 1942, _1942, 1942, _1942_state, driver_init, ROT270, "Capcom", "1942 (Revision A)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, 1942abl, 1942, _1942, 1942, _1942_state, driver_init, ROT270, "bootleg", "1942 (Revision A, bootleg)", MACHINE_SUPPORTS_SAVE ) // data is the same as 1942a set, different rom format -GAME( 1991, 1942h, 1942, _1942, 1942, _1942_state, driver_init, ROT270, "hack (Two Bit Score)", "Supercharger 1942", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, 1942b, 1942, _1942, 1942, _1942_state, driver_init, ROT270, "Capcom", "1942 (First Version)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, 1942w, 1942, _1942, 1942, _1942_state, driver_init, ROT270, "Capcom (Williams Electronics license)", "1942 (Williams Electronics license)", MACHINE_SUPPORTS_SAVE ) /* Based on 1942 (Revision B) */ +GAME( 1984, 1942, 0, _1942, 1942, _1942_state, driver_init, ROT270, "Capcom", "1942 (Revision B)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) +GAME( 1984, 1942a, 1942, _1942, 1942, _1942_state, driver_init, ROT270, "Capcom", "1942 (Revision A)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) +GAME( 1984, 1942abl, 1942, _1942, 1942, _1942_state, driver_init, ROT270, "bootleg", "1942 (Revision A, bootleg)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) // data is the same as 1942a set, different rom format +GAME( 1991, 1942h, 1942, _1942, 1942, _1942_state, driver_init, ROT270, "hack (Two Bit Score)", "Supercharger 1942", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) +GAME( 1984, 1942b, 1942, _1942, 1942, _1942_state, driver_init, ROT270, "Capcom", "1942 (First Version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) +GAME( 1985, 1942w, 1942, _1942, 1942, _1942_state, driver_init, ROT270, "Capcom (Williams Electronics license)", "1942 (Williams Electronics license)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS) /* Based on 1942 (Revision B) */ GAME( 1984, 1942p, 1942, _1942p, 1942p, _1942p_state, driver_init, ROT270, "bootleg", "1942 (Tecfri PCB, bootleg?)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/1942.h b/src/mame/includes/1942.h index 18830458fe4..ce081b62ce4 100644 --- a/src/mame/includes/1942.h +++ b/src/mame/includes/1942.h @@ -14,12 +14,14 @@ #include "machine/timer.h" #include "emupal.h" #include "tilemap.h" +#include "screen.h" class _1942_state : public driver_device { public: _1942_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) + , m_screen(*this, "screen") , m_spriteram(*this, "spriteram") , m_fg_videoram(*this, "fg_videoram") , m_bg_videoram(*this, "bg_videoram") @@ -56,6 +58,8 @@ protected: uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); virtual void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_screen; + /* memory pointers */ required_shared_ptr m_spriteram; required_shared_ptr m_fg_videoram; @@ -73,6 +77,7 @@ protected: int m_palette_bank; uint8_t m_scroll[2]; void create_palette(palette_device &palette) const; + uint8_t m_sprite_bufs[2][512]; }; class _1942p_state : public _1942_state diff --git a/src/mame/video/1942.cpp b/src/mame/video/1942.cpp index 2c2acdcb5ef..84665edf9f8 100644 --- a/src/mame/video/1942.cpp +++ b/src/mame/video/1942.cpp @@ -28,29 +28,27 @@ void _1942_state::create_palette(palette_device &palette) const { - const uint8_t *color_prom = memregion("proms")->base(); + const uint8_t *color_prom = memregion("palproms")->base(); for (int i = 0; i < 256; i++) { - int bit0, bit1, bit2, bit3; - // red component - bit0 = (color_prom[i + 0 * 256] >> 0) & 0x01; - bit1 = (color_prom[i + 0 * 256] >> 1) & 0x01; - bit2 = (color_prom[i + 0 * 256] >> 2) & 0x01; - bit3 = (color_prom[i + 0 * 256] >> 3) & 0x01; + int bit0 = BIT(color_prom[i + 0 * 256], 0); + int bit1 = BIT(color_prom[i + 0 * 256], 1); + int bit2 = BIT(color_prom[i + 0 * 256], 2); + int bit3 = BIT(color_prom[i + 0 * 256], 3); int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; // green component - bit0 = (color_prom[i + 1 * 256] >> 0) & 0x01; - bit1 = (color_prom[i + 1 * 256] >> 1) & 0x01; - bit2 = (color_prom[i + 1 * 256] >> 2) & 0x01; - bit3 = (color_prom[i + 1 * 256] >> 3) & 0x01; + bit0 = BIT(color_prom[i + 1 * 256], 0); + bit1 = BIT(color_prom[i + 1 * 256], 1); + bit2 = BIT(color_prom[i + 1 * 256], 2); + bit3 = BIT(color_prom[i + 1 * 256], 3); int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; // blue component - bit0 = (color_prom[i + 2 * 256] >> 0) & 0x01; - bit1 = (color_prom[i + 2 * 256] >> 1) & 0x01; - bit2 = (color_prom[i + 2 * 256] >> 2) & 0x01; - bit3 = (color_prom[i + 2 * 256] >> 3) & 0x01; + bit0 = BIT(color_prom[i + 2 * 256], 0); + bit1 = BIT(color_prom[i + 2 * 256], 1); + bit2 = BIT(color_prom[i + 2 * 256], 2); + bit3 = BIT(color_prom[i + 2 * 256], 3); int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; palette.set_indirect_color(i, rgb_t(r, g, b)); @@ -61,31 +59,28 @@ void _1942_state::_1942_palette(palette_device &palette) const { create_palette(palette); - const uint8_t *color_prom = memregion("proms")->base(); - color_prom += 3 * 256; - // color_prom now points to the beginning of the lookup table - - /* characters use palette entries 128-143 */ int colorbase = 0; + const uint8_t *charlut_prom = memregion("charprom")->base(); for (int i = 0; i < 64 * 4; i++) - palette.set_pen_indirect(colorbase + i, 0x80 | *color_prom++); + palette.set_pen_indirect(colorbase + i, 0x80 | charlut_prom[i]); // background tiles use palette entries 0-63 in four banks colorbase += 64 * 4; + const uint8_t *tilelut_prom = memregion("tileprom")->base(); for (int i = 0; i < 32 * 8; i++) { - palette.set_pen_indirect(colorbase + 0 * 32 * 8 + i, 0x00 | *color_prom); - palette.set_pen_indirect(colorbase + 1 * 32 * 8 + i, 0x10 | *color_prom); - palette.set_pen_indirect(colorbase + 2 * 32 * 8 + i, 0x20 | *color_prom); - palette.set_pen_indirect(colorbase + 3 * 32 * 8 + i, 0x30 | *color_prom); - color_prom++; + palette.set_pen_indirect(colorbase + 0 * 32 * 8 + i, 0x00 | tilelut_prom[i]); + palette.set_pen_indirect(colorbase + 1 * 32 * 8 + i, 0x10 | tilelut_prom[i]); + palette.set_pen_indirect(colorbase + 2 * 32 * 8 + i, 0x20 | tilelut_prom[i]); + palette.set_pen_indirect(colorbase + 3 * 32 * 8 + i, 0x30 | tilelut_prom[i]); } // sprites use palette entries 64-79 colorbase += 4 * 32 * 8; + const uint8_t *sprlut_prom = memregion("sprprom")->base(); for (int i = 0; i < 16 * 16; i++) - palette.set_pen_indirect(colorbase + i, 0x40 | *color_prom++); + palette.set_pen_indirect(colorbase + i, 0x40 | sprlut_prom[i]); } void _1942p_state::_1942p_palette(palette_device &palette) const @@ -108,10 +103,8 @@ void _1942p_state::_1942p_palette(palette_device &palette) const TILE_GET_INFO_MEMBER(_1942_state::get_fg_tile_info) { - int code, color; - - code = m_fg_videoram[tile_index]; - color = m_fg_videoram[tile_index + 0x400]; + int code = m_fg_videoram[tile_index]; + int color = m_fg_videoram[tile_index + 0x400]; SET_TILE_INFO_MEMBER(0, code + ((color & 0x80) << 1), color & 0x3f, @@ -120,12 +113,10 @@ TILE_GET_INFO_MEMBER(_1942_state::get_fg_tile_info) TILE_GET_INFO_MEMBER(_1942_state::get_bg_tile_info) { - int code, color; - tile_index = (tile_index & 0x0f) | ((tile_index & 0x01f0) << 1); - code = m_bg_videoram[tile_index]; - color = m_bg_videoram[tile_index + 0x10]; + int code = m_bg_videoram[tile_index]; + int color = m_bg_videoram[tile_index + 0x10]; SET_TILE_INFO_MEMBER(1, code + ((color & 0x80) << 1), (color & 0x1f) + (0x20 * m_palette_bank), @@ -212,18 +203,50 @@ WRITE8_MEMBER(_1942_state::_1942_c804_w) void _1942_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int offs; - - for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) + uint8_t objdata[4]; + uint8_t v = flip_screen() ? ~m_screen->vpos() : m_screen->vpos(); + for (int h_idx = 0; h_idx < 32; h_idx++) { - int i, code, col, sx, sy, dir; - - code = (m_spriteram[offs] & 0x7f) + 4 * (m_spriteram[offs + 1] & 0x20) - + 2 * (m_spriteram[offs] & 0x80); - col = m_spriteram[offs + 1] & 0x0f; - sx = m_spriteram[offs + 3] - 0x10 * (m_spriteram[offs + 1] & 0x10); - sy = m_spriteram[offs + 2]; - dir = 1; + const int h = h_idx << 4; + const bool objcnt4 = BIT(h, 8) != BIT(~h, 7); + const bool objcnt3 = (BIT(v, 7) && objcnt4) != BIT(~h, 7); + uint8_t obj_idx = h_idx & 7; + obj_idx |= objcnt3 ? 0x08 : 0x00; + obj_idx |= objcnt4 ? 0x10 : 0x00; + obj_idx <<= 2; + + for (int i = 0; i < 4; i++) + objdata[i] = m_spriteram[obj_idx | i]; + + int code = (objdata[0] & 0x7f) + ((objdata[1] & 0x20) << 2) + ((objdata[0] & 0x80) << 1); + int col = objdata[1] & 0x0f; + int sx = objdata[3] - 0x10 * (objdata[1] & 0x10); + int sy = objdata[2]; + int dir = 1; + + uint8_t valpha = (uint8_t)sy; + uint8_t v2c = (uint8_t)(~v) + (flip_screen() ? 0x01 : 0xff); + uint8_t lvbeta = v2c + valpha;//(sy - m_screen->vpos());// flip_screen() ? (sy - m_screen->vpos()) : (sy - m_screen->vpos() + 1)); + uint8_t vbeta = ~lvbeta; + bool vleq = vbeta <= ((~valpha) & 0xff); + bool vinlen = true; + uint8_t vlen = objdata[1] >> 6; + switch (vlen & 3) + { + case 0: + vinlen = BIT(lvbeta, 7) && BIT(lvbeta, 6) && BIT(lvbeta, 5) && BIT(lvbeta, 4); + break; + case 1: + vinlen = BIT(lvbeta, 7) && BIT(lvbeta, 6) && BIT(lvbeta, 5); + break; + case 2: + vinlen = BIT(lvbeta, 7) && BIT(lvbeta, 6); + break; + case 3: + vinlen = true; + break; + } + bool vinzone = !(vleq && vinlen); if (flip_screen()) { @@ -233,26 +256,25 @@ void _1942_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) } /* handle double / quadruple height */ - i = (m_spriteram[offs + 1] & 0xc0) >> 6; + int i = (objdata[1] & 0xc0) >> 6; if (i == 2) i = 3; - do + if (!vinzone) { - m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, - code + i,col, - flip_screen(),flip_screen(), - sx,sy + 16 * i * dir,15); - - i--; - } while (i >= 0); + do + { + m_gfxdecode->gfx(2)->transpen(bitmap, cliprect, code + i, col, flip_screen(), flip_screen(), sx, sy + 16 * i * dir, 15); + } while (i-- > 0); + } } - - } uint32_t _1942_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { + if (cliprect.min_y != cliprect.max_y) + return 0; + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); draw_sprites(bitmap, cliprect); m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); @@ -268,7 +290,6 @@ void _1942p_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) + 2 * (m_spriteram[offs] & 0x80); int col = m_spriteram[offs + 3] & 0x0f; - int sx = m_spriteram[offs + 2] - 0x10 * (m_spriteram[offs + 3] & 0x10); int sy = m_spriteram[offs + 1]; @@ -293,10 +314,7 @@ void _1942p_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) do { - m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, - code + i,col, - flip_screen(),flip_screen(), - sx,sy + 16 * i * dir,15); + m_gfxdecode->gfx(2)->transpen(bitmap, cliprect, code + i, col, flip_screen(), flip_screen(), sx, sy + 16 * i * dir, 15); i--; } while (i >= 0); -- cgit v1.2.3