From 10e5c3506851523b565d65129bb3fd1ddba2f881 Mon Sep 17 00:00:00 2001 From: Zsolt Vasvari Date: Wed, 20 Feb 2008 13:17:06 +0000 Subject: [PATCH] - Changed all drivers using the MC6845 chip to use the device interface - Removed mc6845_config - Minor changes to the Qix driver --- src/emu/video/mc6845.c | 83 ++++++++++++++++----------------- src/emu/video/mc6845.h | 4 -- src/mame/drivers/carrera.c | 4 +- src/mame/drivers/coinmstr.c | 4 +- src/mame/drivers/couple.c | 4 +- src/mame/drivers/funworld.c | 7 ++- src/mame/drivers/gdrawpkr.c | 5 +- src/mame/drivers/magicfly.c | 5 +- src/mame/drivers/miniboy7.c | 4 +- src/mame/drivers/mpu4drvr.c | 3 +- src/mame/drivers/murogem.c | 4 +- src/mame/drivers/nyny.c | 6 ++- src/mame/drivers/pmpoker.c | 4 +- src/mame/drivers/qix.c | 34 +++++++------- src/mame/drivers/r2dtank.c | 6 ++- src/mame/drivers/rockola.c | 5 ++ src/mame/drivers/spiders.c | 6 ++- src/mame/drivers/ssingles.c | 5 +- src/mame/drivers/usgames.c | 3 ++ src/mame/includes/qix.h | 4 +- src/mame/machine/qix.c | 2 +- src/mame/video/funworld.c | 6 +-- src/mame/video/gdrawpkr.c | 2 +- src/mame/video/madalien.c | 28 +++++++----- src/mame/video/qix.c | 91 +++++++++++++++++++------------------ src/mame/video/rockola.c | 4 +- src/mame/video/usgames.c | 2 +- 27 files changed, 188 insertions(+), 147 deletions(-) diff --git a/src/emu/video/mc6845.c b/src/emu/video/mc6845.c index bf1c18369bd..3e8de485d9d 100644 --- a/src/emu/video/mc6845.c +++ b/src/emu/video/mc6845.c @@ -15,6 +15,9 @@ (1) as per the document at http://www.6502.org/users/andre/hwinfo/crtc/diffs.html + The various speed rated devices are identified by a letter, + for example M68A45, M68B45, etc. + The chip is originally designed by Hitachi, not by Motorola. **********************************************************************/ @@ -69,48 +72,6 @@ static void update_timer(mc6845_t *mc6845); static TIMER_CALLBACK( display_enable_changed_timer_cb ); -mc6845_t *mc6845_config(running_machine *machine, const mc6845_interface *intf) -{ - mc6845_t *mc6845; - - assert(machine != NULL); - - /* allocate the object that holds the state */ - mc6845 = auto_malloc(sizeof(*mc6845)); - memset(mc6845, 0, sizeof(*mc6845)); - - mc6845->machine = machine; - mc6845->intf = intf; - - /* create the timer if the user is interested in getting display enable - notifications */ - if (intf && intf->display_enable_changed) - mc6845->display_enable_changed_timer = timer_alloc(display_enable_changed_timer_cb, mc6845); - - /* register for state saving */ - state_save_register_func_postload_ptr(mc6845_state_save_postload, mc6845); - - state_save_register_item("mc6845", 0, mc6845->address_latch); - state_save_register_item("mc6845", 0, mc6845->horiz_total); - state_save_register_item("mc6845", 0, mc6845->horiz_disp); - state_save_register_item("mc6845", 0, mc6845->horiz_sync_pos); - state_save_register_item("mc6845", 0, mc6845->sync_width); - state_save_register_item("mc6845", 0, mc6845->vert_total); - state_save_register_item("mc6845", 0, mc6845->vert_total_adj); - state_save_register_item("mc6845", 0, mc6845->vert_disp); - state_save_register_item("mc6845", 0, mc6845->vert_sync_pos); - state_save_register_item("mc6845", 0, mc6845->intl_skew); - state_save_register_item("mc6845", 0, mc6845->max_ras_addr); - state_save_register_item("mc6845", 0, mc6845->cursor_start_ras); - state_save_register_item("mc6845", 0, mc6845->cursor_end_ras); - state_save_register_item("mc6845", 0, mc6845->start_addr); - state_save_register_item("mc6845", 0, mc6845->cursor); - state_save_register_item("mc6845", 0, mc6845->light_pen); - - return mc6845; -} - - static void mc6845_state_save_postload(void *param) { mc6845_t *mc6845 = (mc6845_t *)param; @@ -451,7 +412,43 @@ void mc6845_update(mc6845_t *mc6845, mame_bitmap *bitmap, const rectangle *clipr /* device interface */ static void *mc6845_start(running_machine *machine, const void *static_config, const void *inline_config) { - return mc6845_config(machine, static_config); + mc6845_t *mc6845; + + assert(machine != NULL); + + /* allocate the object that holds the state */ + mc6845 = auto_malloc(sizeof(*mc6845)); + memset(mc6845, 0, sizeof(*mc6845)); + + mc6845->machine = machine; + mc6845->intf = static_config; + + /* create the timer if the user is interested in getting display enable + notifications */ + if (mc6845->intf && mc6845->intf->display_enable_changed) + mc6845->display_enable_changed_timer = timer_alloc(display_enable_changed_timer_cb, mc6845); + + /* register for state saving */ + state_save_register_func_postload_ptr(mc6845_state_save_postload, mc6845); + + state_save_register_item("mc6845", 0, mc6845->address_latch); + state_save_register_item("mc6845", 0, mc6845->horiz_total); + state_save_register_item("mc6845", 0, mc6845->horiz_disp); + state_save_register_item("mc6845", 0, mc6845->horiz_sync_pos); + state_save_register_item("mc6845", 0, mc6845->sync_width); + state_save_register_item("mc6845", 0, mc6845->vert_total); + state_save_register_item("mc6845", 0, mc6845->vert_total_adj); + state_save_register_item("mc6845", 0, mc6845->vert_disp); + state_save_register_item("mc6845", 0, mc6845->vert_sync_pos); + state_save_register_item("mc6845", 0, mc6845->intl_skew); + state_save_register_item("mc6845", 0, mc6845->max_ras_addr); + state_save_register_item("mc6845", 0, mc6845->cursor_start_ras); + state_save_register_item("mc6845", 0, mc6845->cursor_end_ras); + state_save_register_item("mc6845", 0, mc6845->start_addr); + state_save_register_item("mc6845", 0, mc6845->cursor); + state_save_register_item("mc6845", 0, mc6845->light_pen); + + return mc6845; } diff --git a/src/emu/video/mc6845.h b/src/emu/video/mc6845.h index 0aee067d733..fae02aad598 100644 --- a/src/emu/video/mc6845.h +++ b/src/emu/video/mc6845.h @@ -56,10 +56,6 @@ struct _mc6845_interface /* device interface */ void mc6845_get_info(running_machine *machine, void *token, UINT32 state, deviceinfo *info); -/* use mc6845_init to set up for save states. - if intf is NULL, the emulator will NOT call video_configure_screen() */ -mc6845_t *mc6845_config(running_machine *machine, const mc6845_interface *intf); - /* select one of the registers for reading or writing */ void mc6845_address_w(mc6845_t *mc6845, UINT8 data); diff --git a/src/mame/drivers/carrera.c b/src/mame/drivers/carrera.c index e3430706430..1a3ea0e1113 100644 --- a/src/mame/drivers/carrera.c +++ b/src/mame/drivers/carrera.c @@ -259,7 +259,7 @@ GFXDECODE_END static VIDEO_START(carrera) { - mc6845 = mc6845_config(machine, NULL); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); } static VIDEO_UPDATE(carrera) @@ -323,6 +323,8 @@ static MACHINE_DRIVER_START( carrera ) MDRV_VIDEO_START(carrera) MDRV_VIDEO_UPDATE(carrera) + MDRV_DEVICE_ADD("crtc", MC6845, 0) + /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/coinmstr.c b/src/mame/drivers/coinmstr.c index d6b75ee4498..184ef3bfec3 100644 --- a/src/mame/drivers/coinmstr.c +++ b/src/mame/drivers/coinmstr.c @@ -544,7 +544,7 @@ static TILE_GET_INFO( get_bg_tile_info ) static VIDEO_START( coinmstr ) { - mc6845 = mc6845_config(machine, NULL); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); bg_tilemap = tilemap_create(get_bg_tile_info,tilemap_scan_rows, 8, 8, 46, 64); } @@ -653,6 +653,8 @@ static MACHINE_DRIVER_START( coinmstr ) MDRV_VIDEO_START(coinmstr) MDRV_VIDEO_UPDATE(coinmstr) + MDRV_DEVICE_ADD("crtc", MC6845, 0) + /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/couple.c b/src/mame/drivers/couple.c index db2f530a50d..79d1fb33be5 100644 --- a/src/mame/drivers/couple.c +++ b/src/mame/drivers/couple.c @@ -76,7 +76,7 @@ static TILE_GET_INFO( get_tile_info ) static VIDEO_START( couple ) { - mc6845 = mc6845_config(machine, NULL); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); bg_tilemap = tilemap_create(get_tile_info,tilemap_scan_rows,8,8,64,32); } @@ -463,6 +463,8 @@ static MACHINE_DRIVER_START( couple ) MDRV_VIDEO_START(couple) MDRV_VIDEO_UPDATE(couple) + MDRV_DEVICE_ADD("crtc", MC6845, 0) + MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SOUND_ADD(AY8910, 4000000) diff --git a/src/mame/drivers/funworld.c b/src/mame/drivers/funworld.c index 0edc3058392..34ec77a0760 100644 --- a/src/mame/drivers/funworld.c +++ b/src/mame/drivers/funworld.c @@ -800,8 +800,9 @@ #define MASTER_CLOCK XTAL_16MHz #include "driver.h" -#include "sound/ay8910.h" +#include "video/mc6845.h" #include "machine/6821pia.h" +#include "sound/ay8910.h" #include "funworld.lh" @@ -1475,6 +1476,8 @@ static MACHINE_DRIVER_START( funworld ) MDRV_VIDEO_START(funworld) MDRV_VIDEO_UPDATE(funworld) + MDRV_DEVICE_ADD("crtc", MC6845, 0) + // sound hardware MDRV_SPEAKER_STANDARD_MONO("mono") @@ -1546,6 +1549,8 @@ static MACHINE_DRIVER_START( snookr10 ) // MDRV_SCREEN_SIZE((124+1)*4, (30+1)*8) // MDRV_SCREEN_VISIBLE_AREA(0*4, 96*4-1, 0*8, 29*8-1) +// MDRV_DEVICE_ADD("crtc", MC6845, 0) + MDRV_GFXDECODE(sn10) // MDRV_DEFAULT_LAYOUT(layout_funworld) diff --git a/src/mame/drivers/gdrawpkr.c b/src/mame/drivers/gdrawpkr.c index 46c63849c2a..1095e1bbd6a 100644 --- a/src/mame/drivers/gdrawpkr.c +++ b/src/mame/drivers/gdrawpkr.c @@ -235,8 +235,9 @@ #define MASTER_CLOCK 10000000 #include "driver.h" -#include "sound/ay8910.h" +#include "video/mc6845.h" #include "machine/6821pia.h" +#include "sound/ay8910.h" /* from video */ WRITE8_HANDLER( gdrawpkr_videoram_w ); @@ -586,6 +587,8 @@ static MACHINE_DRIVER_START( gdrawpkr ) MDRV_VIDEO_START(gdrawpkr) MDRV_VIDEO_UPDATE(gdrawpkr) + MDRV_DEVICE_ADD("crtc", MC6845, 0) + // sound hardware MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SOUND_ADD(AY8912, MASTER_CLOCK/12) /* guessing again... */ diff --git a/src/mame/drivers/magicfly.c b/src/mame/drivers/magicfly.c index b97eca85bfb..3ad1c6d7564 100644 --- a/src/mame/drivers/magicfly.c +++ b/src/mame/drivers/magicfly.c @@ -379,7 +379,7 @@ static TILE_GET_INFO( get_magicfly_tile_info ) static VIDEO_START(magicfly) { - mc6845 = mc6845_config(machine, NULL); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); bg_tilemap = tilemap_create(get_magicfly_tile_info, tilemap_scan_rows, 8, 8, 32, 29); } @@ -411,7 +411,7 @@ static TILE_GET_INFO( get_7mezzo_tile_info ) static VIDEO_START( 7mezzo ) { - mc6845 = mc6845_config(machine, NULL); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); bg_tilemap = tilemap_create(get_7mezzo_tile_info, tilemap_scan_rows, 8, 8, 32, 29); } @@ -680,6 +680,7 @@ static MACHINE_DRIVER_START( magicfly ) MDRV_VIDEO_START(magicfly) MDRV_VIDEO_UPDATE(magicfly) + MDRV_DEVICE_ADD("crtc", MC6845, 0) MACHINE_DRIVER_END static MACHINE_DRIVER_START( 7mezzo ) diff --git a/src/mame/drivers/miniboy7.c b/src/mame/drivers/miniboy7.c index d40d6899a04..a319d0fbab0 100644 --- a/src/mame/drivers/miniboy7.c +++ b/src/mame/drivers/miniboy7.c @@ -182,7 +182,7 @@ static TILE_GET_INFO( get_bg_tile_info ) static VIDEO_START( miniboy7 ) { - mc6845 = mc6845_config(machine, NULL); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 37, 37); } @@ -290,6 +290,8 @@ static MACHINE_DRIVER_START( miniboy7 ) MDRV_VIDEO_START(miniboy7) MDRV_VIDEO_UPDATE(miniboy7) + + MDRV_DEVICE_ADD("crtc", MC6845, 0) MACHINE_DRIVER_END diff --git a/src/mame/drivers/mpu4drvr.c b/src/mame/drivers/mpu4drvr.c index f734069a070..47a1c177d7b 100644 --- a/src/mame/drivers/mpu4drvr.c +++ b/src/mame/drivers/mpu4drvr.c @@ -1548,7 +1548,7 @@ static PALETTE_INIT( dealem ) static VIDEO_START(dealem) { - mc6845 = mc6845_config(machine, NULL); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); } static VIDEO_UPDATE(dealem) @@ -1685,6 +1685,7 @@ static MACHINE_DRIVER_START( dealem ) MDRV_PALETTE_LENGTH(32) MDRV_PALETTE_INIT(dealem) + MDRV_DEVICE_ADD("crtc", MC6845, 0) MACHINE_DRIVER_END static DRIVER_INIT (crmaze) diff --git a/src/mame/drivers/murogem.c b/src/mame/drivers/murogem.c index be74f2f234a..a187e2cfdd2 100644 --- a/src/mame/drivers/murogem.c +++ b/src/mame/drivers/murogem.c @@ -180,7 +180,7 @@ static PALETTE_INIT(murogem) static VIDEO_START(murogem) { - mc6845 = mc6845_config(machine, NULL); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); } static VIDEO_UPDATE(murogem) @@ -229,6 +229,8 @@ static MACHINE_DRIVER_START( murogem ) MDRV_PALETTE_INIT(murogem) MDRV_VIDEO_START(murogem) MDRV_VIDEO_UPDATE(murogem) + + MDRV_DEVICE_ADD("crtc", MC6845, 0) MACHINE_DRIVER_END diff --git a/src/mame/drivers/nyny.c b/src/mame/drivers/nyny.c index fac6011320c..7bc791f0cd1 100644 --- a/src/mame/drivers/nyny.c +++ b/src/mame/drivers/nyny.c @@ -429,8 +429,7 @@ static const mc6845_interface mc6845_intf = static VIDEO_START( nyny ) { - /* configure the CRT controller */ - mc6845 = mc6845_config(machine, &mc6845_intf); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); } @@ -700,6 +699,9 @@ static MACHINE_DRIVER_START( nyny ) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 256, 0, 256, 256, 0, 256) /* temporary, CRTC will configure screen */ + MDRV_DEVICE_ADD("crtc", MC6845, 0) + MDRV_DEVICE_CONFIG(mc6845_intf) + /* audio hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/pmpoker.c b/src/mame/drivers/pmpoker.c index 6fa1993f2f9..b1c0475597f 100644 --- a/src/mame/drivers/pmpoker.c +++ b/src/mame/drivers/pmpoker.c @@ -431,7 +431,7 @@ static TILE_GET_INFO( get_bg_tile_info ) static VIDEO_START( pmpoker ) { - mc6845 = mc6845_config(machine, NULL); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 29); } @@ -1023,6 +1023,8 @@ static MACHINE_DRIVER_START( pmpoker ) MDRV_VIDEO_START(pmpoker) MDRV_VIDEO_UPDATE(pmpoker) + + MDRV_DEVICE_ADD("crtc", MC6845, 0) MACHINE_DRIVER_END static MACHINE_DRIVER_START( jokerpkr ) diff --git a/src/mame/drivers/qix.c b/src/mame/drivers/qix.c index c39447cf1de..dc558866720 100644 --- a/src/mame/drivers/qix.c +++ b/src/mame/drivers/qix.c @@ -1018,7 +1018,6 @@ ROM_END - /************************************* * * Game-specific initialization @@ -1089,6 +1088,7 @@ static DRIVER_INIT( kram3 ) } } + static DRIVER_INIT( zookeep ) { /* configure the banking */ @@ -1112,19 +1112,19 @@ static DRIVER_INIT( slither ) * *************************************/ -GAME( 1981, qix, 0, qix, qix, 0, ROT270, "Taito America Corporation", "Qix (set 1)", GAME_SUPPORTS_SAVE ) -GAME( 1981, qixa, qix, qix, qix, 0, ROT270, "Taito America Corporation", "Qix (set 2)", GAME_SUPPORTS_SAVE ) -GAME( 1981, qixb, qix, qix, qix, 0, ROT270, "Taito America Corporation", "Qix (set 3)", GAME_SUPPORTS_SAVE ) -GAME( 1981, qix2, qix, qix, qix, 0, ROT270, "Taito America Corporation", "Qix II (Tournament)", GAME_SUPPORTS_SAVE ) -GAME( 1981, sdungeon, 0, mcu, sdungeon, 0, ROT270, "Taito America Corporation", "Space Dungeon", GAME_SUPPORTS_SAVE ) -GAME( 1982, elecyoyo, 0, mcu, elecyoyo, 0, ROT270, "Taito America Corporation", "The Electric Yo-Yo (set 1)", GAME_SUPPORTS_SAVE ) -GAME( 1982, elecyoy2, elecyoyo, mcu, elecyoyo, 0, ROT270, "Taito America Corporation", "The Electric Yo-Yo (set 2)", GAME_SUPPORTS_SAVE ) -GAME( 1982, kram, 0, mcu, kram, 0, ROT0, "Taito America Corporation", "Kram (set 1)", GAME_SUPPORTS_SAVE ) -GAME( 1982, kram2, kram, mcu, kram, 0, ROT0, "Taito America Corporation", "Kram (set 2)", GAME_SUPPORTS_SAVE ) -GAME( 1982, kram3, kram, qix, kram, kram3, ROT0, "Taito America Corporation", "Kram (encrypted)", GAME_SUPPORTS_SAVE ) -GAME( 1982, zookeep, 0, zookeep, zookeep, zookeep, ROT0, "Taito America Corporation", "Zoo Keeper (set 1)", GAME_SUPPORTS_SAVE ) -GAME( 1982, zookeep2, zookeep, zookeep, zookeep, zookeep, ROT0, "Taito America Corporation", "Zoo Keeper (set 2)", GAME_SUPPORTS_SAVE ) -GAME( 1982, zookeep3, zookeep, zookeep, zookeep, zookeep, ROT0, "Taito America Corporation", "Zoo Keeper (set 3)", GAME_SUPPORTS_SAVE ) -GAME( 1982, slither, 0, slither, slither, slither, ROT270, "Century II", "Slither (set 1)", GAME_SUPPORTS_SAVE ) -GAME( 1982, slithera, slither, slither, slither, slither, ROT270, "Century II", "Slither (set 2)", GAME_SUPPORTS_SAVE ) -GAME( 1984, complexx, 0, qix, complexx, 0, ROT270, "Taito America Corporation", "Complex X", GAME_SUPPORTS_SAVE ) +GAME( 1981, qix, 0, qix, qix, 0, ROT270, "Taito America Corporation", "Qix (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1981, qixa, qix, qix, qix, 0, ROT270, "Taito America Corporation", "Qix (set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1981, qixb, qix, qix, qix, 0, ROT270, "Taito America Corporation", "Qix (set 3)", GAME_SUPPORTS_SAVE ) +GAME( 1981, qix2, qix, qix, qix, 0, ROT270, "Taito America Corporation", "Qix II (Tournament)", GAME_SUPPORTS_SAVE ) +GAME( 1981, sdungeon, 0, mcu, sdungeon, 0, ROT270, "Taito America Corporation", "Space Dungeon", GAME_SUPPORTS_SAVE ) +GAME( 1982, elecyoyo, 0, mcu, elecyoyo, 0, ROT270, "Taito America Corporation", "The Electric Yo-Yo (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1982, elecyoy2, elecyoyo, mcu, elecyoyo, 0, ROT270, "Taito America Corporation", "The Electric Yo-Yo (set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1982, kram, 0, mcu, kram, 0, ROT0, "Taito America Corporation", "Kram (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1982, kram2, kram, mcu, kram, 0, ROT0, "Taito America Corporation", "Kram (set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1982, kram3, kram, qix, kram, kram3, ROT0, "Taito America Corporation", "Kram (encrypted)", GAME_SUPPORTS_SAVE ) +GAME( 1982, zookeep, 0, zookeep, zookeep, zookeep, ROT0, "Taito America Corporation", "Zoo Keeper (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1982, zookeep2, zookeep, zookeep, zookeep, zookeep, ROT0, "Taito America Corporation", "Zoo Keeper (set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1982, zookeep3, zookeep, zookeep, zookeep, zookeep, ROT0, "Taito America Corporation", "Zoo Keeper (set 3)", GAME_SUPPORTS_SAVE ) +GAME( 1982, slither, 0, slither, slither, slither, ROT270, "Century II", "Slither (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1982, slithera, slither, slither, slither, slither, ROT270, "Century II", "Slither (set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1984, complexx, 0, qix, complexx, 0, ROT270, "Taito America Corporation", "Complex X", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/r2dtank.c b/src/mame/drivers/r2dtank.c index db9d68baf9f..3916c3418e0 100644 --- a/src/mame/drivers/r2dtank.c +++ b/src/mame/drivers/r2dtank.c @@ -407,8 +407,7 @@ static const mc6845_interface mc6845_intf = static VIDEO_START( r2dtank ) { - /* configure the CRT controller */ - mc6845 = mc6845_config(machine, &mc6845_intf); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); } @@ -566,6 +565,9 @@ static MACHINE_DRIVER_START( r2dtank ) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 256, 0, 256, 256, 0, 256) /* temporary, CRTC will configure screen */ + MDRV_DEVICE_ADD("crtc", MC6845, 0) + MDRV_DEVICE_CONFIG(mc6845_intf) + /* audio hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/rockola.c b/src/mame/drivers/rockola.c index 6ba63e86e25..56246cacbdb 100644 --- a/src/mame/drivers/rockola.c +++ b/src/mame/drivers/rockola.c @@ -265,6 +265,7 @@ Stephh's notes (based on the games M6502 code and some tests) : #include "driver.h" #include "deprecat.h" #include "cpu/m6502/m6502.h" +#include "video/mc6845.h" #include "sound/sn76477.h" #include "sound/custom.h" #include "sound/samples.h" @@ -1099,6 +1100,8 @@ static MACHINE_DRIVER_START( sasuke ) MDRV_VIDEO_START(satansat) MDRV_VIDEO_UPDATE(rockola) + MDRV_DEVICE_ADD("crtc", MC6845, 0) + // sound hardware MDRV_SPEAKER_STANDARD_MONO("mono") @@ -1171,6 +1174,8 @@ static MACHINE_DRIVER_START( vanguard ) MDRV_VIDEO_START(rockola) MDRV_VIDEO_UPDATE(rockola) + MDRV_DEVICE_ADD("crtc", MC6845, 0) + // sound hardware MDRV_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/spiders.c b/src/mame/drivers/spiders.c index e3ed19781c5..a0545e4becb 100644 --- a/src/mame/drivers/spiders.c +++ b/src/mame/drivers/spiders.c @@ -529,8 +529,7 @@ static const mc6845_interface mc6845_intf = static VIDEO_START( spiders ) { - /* configure the CRT controller */ - mc6845 = mc6845_config(machine, &mc6845_intf); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); } @@ -734,6 +733,9 @@ static MACHINE_DRIVER_START( spiders ) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 256, 0, 256, 256, 0, 256) /* temporary, CRTC will configure screen */ + MDRV_DEVICE_ADD("crtc", MC6845, 0) + MDRV_DEVICE_CONFIG(mc6845_intf) + /* audio hardware */ MDRV_IMPORT_FROM(spiders_audio) diff --git a/src/mame/drivers/ssingles.c b/src/mame/drivers/ssingles.c index c287e62c203..c8ea9842d8f 100644 --- a/src/mame/drivers/ssingles.c +++ b/src/mame/drivers/ssingles.c @@ -119,7 +119,7 @@ static WRITE8_HANDLER( ssingles_mc6845_register_w ) static VIDEO_START(ssingles) { - mc6845 = mc6845_config(machine, &mc6845_intf); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); { int i; @@ -286,6 +286,9 @@ static MACHINE_DRIVER_START( ssingles ) MDRV_VIDEO_START(ssingles) MDRV_VIDEO_UPDATE(ssingles) + MDRV_DEVICE_ADD("crtc", MC6845, 0) + MDRV_DEVICE_CONFIG(mc6845_intf) + /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/usgames.c b/src/mame/drivers/usgames.c index 860d243a83e..6fc7d6d2f5f 100644 --- a/src/mame/drivers/usgames.c +++ b/src/mame/drivers/usgames.c @@ -24,6 +24,7 @@ Sound: AY-3-8912 */ #include "driver.h" +#include "video/mc6845.h" #include "sound/ay8910.h" /* video */ @@ -310,6 +311,8 @@ static MACHINE_DRIVER_START( usg32 ) MDRV_VIDEO_START(usgames) MDRV_VIDEO_UPDATE(usgames) + MDRV_DEVICE_ADD("crtc", MC6845, 0) + /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/includes/qix.h b/src/mame/includes/qix.h index 85507917a20..697a67971cc 100644 --- a/src/mame/includes/qix.h +++ b/src/mame/includes/qix.h @@ -29,9 +29,9 @@ struct _qix_state mc6845_t *mc6845; UINT8 *videoram; UINT8 *videoram_address; + UINT8 *videoram_mask; UINT8 *paletteram; UINT8 flip_screen; - UINT8 vram_mask; UINT8 palette_bank; UINT8 leds; UINT8 *scanline_latch; @@ -45,7 +45,7 @@ MACHINE_START( qixmcu ); MACHINE_START( slither ); MACHINE_RESET( qix ); -WRITE8_HANDLER( zoo_bankswitch_w ); +WRITE8_HANDLER( zookeep_bankswitch_w ); READ8_HANDLER( qix_data_firq_r ); READ8_HANDLER( qix_data_firq_ack_r ); diff --git a/src/mame/machine/qix.c b/src/mame/machine/qix.c index 11d0228d983..f9c181c8fca 100644 --- a/src/mame/machine/qix.c +++ b/src/mame/machine/qix.c @@ -281,7 +281,7 @@ INTERRUPT_GEN( qix_vblank_start ) * *************************************/ -WRITE8_HANDLER( zoo_bankswitch_w ) +WRITE8_HANDLER( zookeep_bankswitch_w ) { memory_set_bank(1, (data >> 2) & 1); /* not necessary, but technically correct */ diff --git a/src/mame/video/funworld.c b/src/mame/video/funworld.c index 78c2c5f141c..738cb0661d5 100644 --- a/src/mame/video/funworld.c +++ b/src/mame/video/funworld.c @@ -136,19 +136,19 @@ static TILE_GET_INFO( get_bg_tile_info ) VIDEO_START(funworld) { - mc6845 = mc6845_config(machine, NULL); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 4, 8, 96, 29); } VIDEO_START(magiccrd) { - mc6845 = mc6845_config(machine, NULL); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 4, 8, 112, 34); } VIDEO_START(snookr10) { -// mc6845 = mc6845_config(machine, NULL); +// mc6845 = devtag_get_token(machine, MC6845, "crtc"); bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 4, 8, 128, 32); } diff --git a/src/mame/video/gdrawpkr.c b/src/mame/video/gdrawpkr.c index 01a3acf92d8..3502d2b35db 100644 --- a/src/mame/video/gdrawpkr.c +++ b/src/mame/video/gdrawpkr.c @@ -61,7 +61,7 @@ WRITE8_HANDLER( gdrawpkr_mc6845_register_w ) VIDEO_START( gdrawpkr ) { - mc6845 = mc6845_config(machine, NULL); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 31); } diff --git a/src/mame/video/madalien.c b/src/mame/video/madalien.c index 5bf848957f7..cbda1c2528f 100644 --- a/src/mame/video/madalien.c +++ b/src/mame/video/madalien.c @@ -160,18 +160,7 @@ static VIDEO_START( madalien ) 16, 16, 32, 32 }; - static const mc6845_interface mc6845_intf = - { - 0, /* screen we are acting on */ - PIXEL_CLOCK / 8, /* the clock of the chip */ - 8, /* number of pixels per video memory address */ - NULL, /* before pixel update callback */ - NULL, /* row update callback */ - NULL, /* after pixel update callback */ - NULL /* call back for display state changes */ - }; - - mc6845 = mc6845_config(machine, &mc6845_intf); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); tilemap_fg = tilemap_create(get_tile_info_FG, tilemap_scan_cols_flip_x, 8, 8, 32, 32); tilemap_set_transparent_pen(tilemap_fg, 0); @@ -407,6 +396,18 @@ static GFXDECODE_START( madalien ) GFXDECODE_END +static const mc6845_interface mc6845_intf = +{ + 0, /* screen we are acting on */ + PIXEL_CLOCK / 8, /* the clock of the chip */ + 8, /* number of pixels per video memory address */ + NULL, /* before pixel update callback */ + NULL, /* row update callback */ + NULL, /* after pixel update callback */ + NULL /* call back for display state changes */ +}; + + MACHINE_DRIVER_START( madalien_video ) MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) @@ -417,4 +418,7 @@ MACHINE_DRIVER_START( madalien_video ) MDRV_PALETTE_INIT(madalien) MDRV_VIDEO_START(madalien) MDRV_VIDEO_UPDATE(madalien) + + MDRV_DEVICE_ADD("crtc", MC6845, 0) + MDRV_DEVICE_CONFIG(mc6845_intf) MACHINE_DRIVER_END diff --git a/src/mame/video/qix.c b/src/mame/video/qix.c index e9dca478186..c1424357f22 100644 --- a/src/mame/video/qix.c +++ b/src/mame/video/qix.c @@ -41,35 +41,19 @@ static void qix_update_row(running_machine *machine, * *************************************/ -static const mc6845_interface mc6845_intf = -{ - 0, /* screen we are acting on */ - QIX_CHARACTER_CLOCK, /* the clock (pin 21) of the chip */ - 8, /* number of pixels per video memory address */ - qix_begin_update, /* before pixel update callback */ - qix_update_row, /* row update callback */ - 0, /* after pixel update callback */ - qix_display_enable_changed /* call back for display state changes */ -}; - - static VIDEO_START( qix ) { qix_state *state = machine->driver_data; /* get the pointer to the mc6845 object */ - state->mc6845 = devtag_get_token(machine, MC6845, "crtc"); + state->mc6845 = devtag_get_token(machine, MC6845, "vid-u18"); /* allocate memory for the full video RAM */ state->videoram = auto_malloc(256 * 256); - /* initialize the mask for games that don't use it */ - state->vram_mask = 0xff; - /* set up save states */ state_save_register_global_pointer(state->videoram, 256 * 256); state_save_register_global(state->flip_screen); - state_save_register_global(state->vram_mask); state_save_register_global(state->palette_bank); state_save_register_global(state->leds); } @@ -99,24 +83,6 @@ static void qix_display_enable_changed(running_machine *machine, mc6845_t *mc684 -/************************************* - * - * Video RAM mask - * - *************************************/ - -static WRITE8_HANDLER( slither_vram_mask_w ) -{ - qix_state *state = Machine->driver_data; - - /* Slither appears to extend the basic hardware by providing */ - /* a mask register which controls which data bits get written */ - /* to video RAM */ - state->vram_mask = data; -} - - - /************************************* * * Cocktail flip @@ -168,8 +134,24 @@ static WRITE8_HANDLER( qix_videoram_w ) /* add in the upper bit of the address latch */ offset += (state->videoram_address[0] & 0x80) << 8; + /* write the data */ + state->videoram[offset] = data; +} + + +static WRITE8_HANDLER( slither_videoram_w ) +{ + qix_state *state = Machine->driver_data; + + /* update the screen in case the game is writing "behind" the beam - + Zookeeper likes to do this */ + video_screen_update_now(0); + + /* add in the upper bit of the address latch */ + offset += (state->videoram_address[0] & 0x80) << 8; + /* blend the data */ - state->videoram[offset] = (state->videoram[offset] & ~state->vram_mask) | (data & state->vram_mask); + state->videoram[offset] = (state->videoram[offset] & ~*state->videoram_mask) | (data & *state->videoram_mask); } @@ -199,7 +181,6 @@ static READ8_HANDLER( qix_addresslatch_r ) } - static WRITE8_HANDLER( qix_addresslatch_w ) { qix_state *state = Machine->driver_data; @@ -207,8 +188,20 @@ static WRITE8_HANDLER( qix_addresslatch_w ) /* compute the value at the address latch */ offset = (state->videoram_address[0] << 8) | state->videoram_address[1]; + /* write the data */ + state->videoram[offset] = data; +} + + +static WRITE8_HANDLER( slither_addresslatch_w ) +{ + qix_state *state = Machine->driver_data; + + /* compute the value at the address latch */ + offset = (state->videoram_address[0] << 8) | state->videoram_address[1]; + /* blend the data */ - state->videoram[offset] = (state->videoram[offset] & ~state->vram_mask) | (data & state->vram_mask); + state->videoram[offset] = (state->videoram[offset] & ~*state->videoram_mask) | (data & *state->videoram_mask); } @@ -425,7 +418,7 @@ static ADDRESS_MAP_START( zookeep_video_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x8000, 0x83ff) AM_RAM AM_SHARE(1) AM_RANGE(0x8400, 0x87ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) AM_RANGE(0x8800, 0x8800) AM_MIRROR(0x03fe) AM_WRITE(qix_palettebank_w) - AM_RANGE(0x8801, 0x8801) AM_MIRROR(0x03fe) AM_WRITE(zoo_bankswitch_w) + AM_RANGE(0x8801, 0x8801) AM_MIRROR(0x03fe) AM_WRITE(zookeep_bankswitch_w) AM_RANGE(0x8c00, 0x8c00) AM_MIRROR(0x03fe) AM_READWRITE(qix_data_firq_r, qix_data_firq_w) AM_RANGE(0x8c01, 0x8c01) AM_MIRROR(0x03fe) AM_READWRITE(qix_video_firq_ack_r, qix_video_firq_ack_w) AM_RANGE(0x9000, 0x93ff) AM_READWRITE(MRA8_RAM, qix_paletteram_w) AM_BASE_MEMBER(qix_state, paletteram) @@ -440,15 +433,15 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( slither_video_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x7fff) AM_READWRITE(qix_videoram_r, qix_videoram_w) + AM_RANGE(0x0000, 0x7fff) AM_READWRITE(qix_videoram_r, slither_videoram_w) AM_RANGE(0x8000, 0x83ff) AM_RAM AM_SHARE(1) AM_RANGE(0x8400, 0x87ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) AM_RANGE(0x8800, 0x8800) AM_MIRROR(0x03ff) AM_WRITE(qix_palettebank_w) AM_RANGE(0x8c00, 0x8c00) AM_MIRROR(0x03fe) AM_READWRITE(qix_data_firq_r, qix_data_firq_w) AM_RANGE(0x8c01, 0x8c01) AM_MIRROR(0x03fe) AM_READWRITE(qix_video_firq_ack_r, qix_video_firq_ack_w) AM_RANGE(0x9000, 0x93ff) AM_READWRITE(MRA8_RAM, qix_paletteram_w) AM_BASE_MEMBER(qix_state, paletteram) - AM_RANGE(0x9400, 0x9400) AM_MIRROR(0x03fc) AM_READWRITE(qix_addresslatch_r, qix_addresslatch_w) - AM_RANGE(0x9401, 0x9401) AM_MIRROR(0x03fc) AM_WRITE(slither_vram_mask_w) + AM_RANGE(0x9400, 0x9400) AM_MIRROR(0x03fc) AM_READWRITE(qix_addresslatch_r, slither_addresslatch_w) + AM_RANGE(0x9401, 0x9401) AM_MIRROR(0x03fc) AM_WRITE(MWA8_RAM) AM_BASE_MEMBER(qix_state, videoram_mask) AM_RANGE(0x9402, 0x9403) AM_MIRROR(0x03fc) AM_WRITE(MWA8_RAM) AM_BASE_MEMBER(qix_state, videoram_address) AM_RANGE(0x9800, 0x9800) AM_MIRROR(0x03ff) AM_READ(MRA8_RAM) AM_BASE_MEMBER(qix_state, scanline_latch) AM_RANGE(0x9c00, 0x9c00) AM_MIRROR(0x03fe) AM_WRITE(qix_mc6845_address_w) @@ -464,6 +457,18 @@ ADDRESS_MAP_END * *************************************/ +static const mc6845_interface mc6845_intf = +{ + 0, /* screen we are acting on */ + QIX_CHARACTER_CLOCK, /* the clock (pin 21) of the chip */ + 8, /* number of pixels per video memory address */ + qix_begin_update, /* before pixel update callback */ + qix_update_row, /* row update callback */ + 0, /* after pixel update callback */ + qix_display_enable_changed /* call back for display state changes */ +}; + + MACHINE_DRIVER_START( qix_video ) MDRV_CPU_ADD_TAG("video", M6809, MAIN_CLOCK_OSC/4/4) /* 1.25 MHz */ MDRV_CPU_PROGRAM_MAP(qix_video_map,0) @@ -472,7 +477,7 @@ MACHINE_DRIVER_START( qix_video ) MDRV_VIDEO_START(qix) MDRV_VIDEO_UPDATE(qix) - MDRV_DEVICE_ADD("crtc", MC6845, 0) + MDRV_DEVICE_ADD("vid-u18", MC6845, 0) MDRV_DEVICE_CONFIG(mc6845_intf) MDRV_SCREEN_ADD("main", 0) diff --git a/src/mame/video/rockola.c b/src/mame/video/rockola.c index 1840f5eb3d5..3f70ce44d82 100644 --- a/src/mame/video/rockola.c +++ b/src/mame/video/rockola.c @@ -193,7 +193,7 @@ static TILE_GET_INFO( get_fg_tile_info ) VIDEO_START( rockola ) { - mc6845 = mc6845_config(machine, NULL); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); @@ -315,7 +315,7 @@ static TILE_GET_INFO( satansat_get_fg_tile_info ) VIDEO_START( satansat ) { - mc6845 = mc6845_config(machine, NULL); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); bg_tilemap = tilemap_create(satansat_get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); fg_tilemap = tilemap_create(satansat_get_fg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); diff --git a/src/mame/video/usgames.c b/src/mame/video/usgames.c index a398f32f409..b95c1d6590a 100644 --- a/src/mame/video/usgames.c +++ b/src/mame/video/usgames.c @@ -51,7 +51,7 @@ static TILE_GET_INFO( get_usgames_tile_info ) VIDEO_START(usgames) { - mc6845 = mc6845_config(machine, NULL); + mc6845 = devtag_get_token(machine, MC6845, "crtc"); usgames_tilemap = tilemap_create(get_usgames_tile_info,tilemap_scan_rows, 8, 8,64,32); }