From f8ea749a38769aedfdd99fb958cbef485bcb319a Mon Sep 17 00:00:00 2001 From: Andrew Gardner Date: Thu, 19 Nov 2015 16:05:09 +0100 Subject: [PATCH] The AVG/DVG vector device now inherits device_execute_interface, and is executed and scheduled by the default machine scheduler. --- src/mame/drivers/asteroid.cpp | 34 +++--- src/mame/drivers/bwidow.cpp | 6 +- src/mame/drivers/bzone.cpp | 14 +-- src/mame/drivers/mhavoc.cpp | 14 +-- src/mame/drivers/omegrace.cpp | 2 +- src/mame/drivers/quantum.cpp | 2 +- src/mame/drivers/starwars.cpp | 2 +- src/mame/drivers/tempest.cpp | 2 +- src/mame/drivers/tomcat.cpp | 4 +- src/mame/machine/asteroid.cpp | 5 +- src/mame/video/avgdvg.cpp | 195 ++++++++++++++++------------------ src/mame/video/avgdvg.h | 22 ++-- 12 files changed, 146 insertions(+), 156 deletions(-) diff --git a/src/mame/drivers/asteroid.cpp b/src/mame/drivers/asteroid.cpp index b8b8720c2bb..e487e737f41 100644 --- a/src/mame/drivers/asteroid.cpp +++ b/src/mame/drivers/asteroid.cpp @@ -655,7 +655,7 @@ static MACHINE_CONFIG_START( asteroid, asteroid_state ) MCFG_SCREEN_VISIBLE_AREA(522, 1566, 394, 1182) MCFG_SCREEN_UPDATE_DEVICE("vector", vector_device, screen_update) - MCFG_DEVICE_ADD("dvg", DVG, 0) + MCFG_DEVICE_ADD("dvg", DVG, MASTER_CLOCK) MCFG_AVGDVG_VECTOR("vector") /* sound hardware */ @@ -1019,21 +1019,21 @@ DRIVER_INIT_MEMBER(asteroid_state,asterock) * *************************************/ -GAME( 1979, asteroid, 0, asteroid, asteroid, driver_device, 0, ROT0, "Atari", "Asteroids (rev 4)", MACHINE_SUPPORTS_SAVE ) -GAME( 1979, asteroid2, asteroid, asteroid, asteroid, driver_device, 0, ROT0, "Atari", "Asteroids (rev 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1979, asteroid1, asteroid, asteroid, asteroid, driver_device, 0, ROT0, "Atari", "Asteroids (rev 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1979, asteroidb, asteroid, asteroid, asteroidb, asteroid_state, asteroidb, ROT0, "bootleg", "Asteroids (bootleg on Lunar Lander hardware)", MACHINE_SUPPORTS_SAVE ) -GAME( 1980, aerolitos, asteroid, asteroid, aerolitos, driver_device, 0, ROT0, "bootleg (Rodmar Elec.)","Aerolitos (Spanish bootleg of Asteroids)", MACHINE_SUPPORTS_SAVE ) // 'Aerolitos' appears on the cabinet, this was distributed in Spain, the Spanish text is different to that contained in the original version (corrected) -GAME( 1979, asterock, asteroid, asterock, asterock, asteroid_state, asterock, ROT0, "bootleg (Sidam)", "Asterock (Sidam bootleg of Asteroids)", MACHINE_SUPPORTS_SAVE ) -GAME( 1979, asterockv, asteroid, asterock, asterock, asteroid_state, asterock, ROT0, "bootleg (Videotron)", "Asterock (Videotron bootleg of Asteroids)", MACHINE_SUPPORTS_SAVE ) -GAME( 1979, meteorts, asteroid, asteroid, asteroid, driver_device, 0, ROT0, "bootleg (VGG)", "Meteorites (bootleg of Asteroids)", MACHINE_SUPPORTS_SAVE ) -GAME( 1979, meteorho, asteroid, asteroid, asteroid, driver_device, 0, ROT0, "bootleg (Hoei)", "Meteor (bootleg of Asteroids)", MACHINE_SUPPORTS_SAVE ) -GAME( 1979, hyperspc, asteroid, asteroid, asteroid, driver_device, 0, ROT0, "bootleg (Rumiano)", "Hyperspace (bootleg of Asteroids)", MACHINE_SUPPORTS_SAVE ) +GAME( 1979, asteroid, 0, asteroid, asteroid, driver_device, 0, ROT0, "Atari", "Asteroids (rev 4)", MACHINE_SUPPORTS_SAVE ) +GAME( 1979, asteroid2, asteroid, asteroid, asteroid, driver_device, 0, ROT0, "Atari", "Asteroids (rev 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1979, asteroid1, asteroid, asteroid, asteroid, driver_device, 0, ROT0, "Atari", "Asteroids (rev 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1979, asteroidb, asteroid, asteroid, asteroidb, asteroid_state, asteroidb, ROT0, "bootleg", "Asteroids (bootleg on Lunar Lander hardware)", MACHINE_SUPPORTS_SAVE ) +GAME( 1980, aerolitos, asteroid, asteroid, aerolitos, driver_device, 0, ROT0, "bootleg (Rodmar Elec.)", "Aerolitos (Spanish bootleg of Asteroids)", MACHINE_SUPPORTS_SAVE ) // 'Aerolitos' appears on the cabinet, this was distributed in Spain, the Spanish text is different to that contained in the original version (corrected) +GAME( 1979, asterock, asteroid, asterock, asterock, asteroid_state, asterock, ROT0, "bootleg (Sidam)", "Asterock (Sidam bootleg of Asteroids)", MACHINE_SUPPORTS_SAVE ) +GAME( 1979, asterockv, asteroid, asterock, asterock, asteroid_state, asterock, ROT0, "bootleg (Videotron)", "Asterock (Videotron bootleg of Asteroids)", MACHINE_SUPPORTS_SAVE ) +GAME( 1979, meteorts, asteroid, asteroid, asteroid, driver_device, 0, ROT0, "bootleg (VGG)", "Meteorites (bootleg of Asteroids)", MACHINE_SUPPORTS_SAVE ) +GAME( 1979, meteorho, asteroid, asteroid, asteroid, driver_device, 0, ROT0, "bootleg (Hoei)", "Meteor (bootleg of Asteroids)", MACHINE_SUPPORTS_SAVE ) +GAME( 1979, hyperspc, asteroid, asteroid, asteroid, driver_device, 0, ROT0, "bootleg (Rumiano)", "Hyperspace (bootleg of Asteroids)", MACHINE_SUPPORTS_SAVE ) -GAMEL(1980, astdelux, 0, astdelux, astdelux, driver_device, 0, ROT0, "Atari", "Asteroids Deluxe (rev 3)", MACHINE_SUPPORTS_SAVE, layout_astdelux ) -GAMEL(1980, astdelux2, astdelux, astdelux, astdelux, driver_device, 0, ROT0, "Atari", "Asteroids Deluxe (rev 2)", MACHINE_SUPPORTS_SAVE, layout_astdelux ) -GAMEL(1980, astdelux1, astdelux, astdelux, astdelux, driver_device, 0, ROT0, "Atari", "Asteroids Deluxe (rev 1)", MACHINE_SUPPORTS_SAVE, layout_astdelux ) +GAMEL(1980, astdelux, 0, astdelux, astdelux, driver_device, 0, ROT0, "Atari", "Asteroids Deluxe (rev 3)", MACHINE_SUPPORTS_SAVE, layout_astdelux ) +GAMEL(1980, astdelux2, astdelux, astdelux, astdelux, driver_device, 0, ROT0, "Atari", "Asteroids Deluxe (rev 2)", MACHINE_SUPPORTS_SAVE, layout_astdelux ) +GAMEL(1980, astdelux1, astdelux, astdelux, astdelux, driver_device, 0, ROT0, "Atari", "Asteroids Deluxe (rev 1)", MACHINE_SUPPORTS_SAVE, layout_astdelux ) -GAME( 1979, llander, 0, llander, llander, driver_device, 0, ROT0, "Atari", "Lunar Lander (rev 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1979, llander1, llander, llander, llander1, driver_device, 0, ROT0, "Atari", "Lunar Lander (rev 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1979, llandert, llander, llander, llandert, driver_device, 0, ROT0, "Atari", "Lunar Lander (screen test)", MACHINE_SUPPORTS_SAVE ) // no copyright shown, assume it's an in-house diagnostics romset (PCB came from a seller that has had Atari prototypes in his possession before) +GAME( 1979, llander, 0, llander, llander, driver_device, 0, ROT0, "Atari", "Lunar Lander (rev 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1979, llander1, llander, llander, llander1, driver_device, 0, ROT0, "Atari", "Lunar Lander (rev 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1979, llandert, llander, llander, llandert, driver_device, 0, ROT0, "Atari", "Lunar Lander (screen test)", MACHINE_SUPPORTS_SAVE ) // no copyright shown, assume it's an in-house diagnostics romset (PCB came from a seller that has had Atari prototypes in his possession before) diff --git a/src/mame/drivers/bwidow.cpp b/src/mame/drivers/bwidow.cpp index afe5c9654d7..7989a3aae86 100644 --- a/src/mame/drivers/bwidow.cpp +++ b/src/mame/drivers/bwidow.cpp @@ -745,7 +745,7 @@ static MACHINE_CONFIG_START( bwidow, bwidow_state ) MCFG_SCREEN_VISIBLE_AREA(0, 480, 0, 440) MCFG_SCREEN_UPDATE_DEVICE("vector", vector_device, screen_update) - MCFG_DEVICE_ADD("avg", AVG, 0) + MCFG_DEVICE_ADD("avg", AVG, MASTER_CLOCK) MCFG_AVGDVG_VECTOR("vector") /* sound hardware */ @@ -1062,8 +1062,8 @@ ROM_END GAME( 1980, spacduel, 0, spacduel, spacduel, driver_device, 0, ROT0, "Atari", "Space Duel (version 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1980, spacduel1,spacduel, spacduel, spacduel, driver_device, 0, ROT0, "Atari", "Space Duel (version 1)", MACHINE_SUPPORTS_SAVE ) GAME( 1980, spacduel0,spacduel, spacduel, spacduel, driver_device, 0, ROT0, "Atari", "Space Duel (prototype)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, bwidow, 0, bwidow, bwidow, driver_device, 0, ROT0, "Atari", "Black Widow", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, bwidowp, bwidow, bwidowp, bwidow, driver_device, 0, ROT0, "Atari", "Black Widow (prototype)", MACHINE_NOT_WORKING ) +GAME( 1982, bwidow, 0, bwidow, bwidow, driver_device, 0, ROT0, "Atari", "Black Widow", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, bwidowp, bwidow, bwidowp, bwidow, driver_device, 0, ROT0, "Atari", "Black Widow (prototype)", MACHINE_NOT_WORKING ) GAME( 1982, gravitar, 0, gravitar, gravitar, driver_device, 0, ROT0, "Atari", "Gravitar (version 3)", MACHINE_SUPPORTS_SAVE ) GAME( 1982, gravitar2,gravitar, gravitar, gravitar, driver_device, 0, ROT0, "Atari", "Gravitar (version 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1982, gravitar1,gravitar, gravitar, gravitar, driver_device, 0, ROT0, "Atari", "Gravitar (version 1)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/bzone.cpp b/src/mame/drivers/bzone.cpp index 03601f5cb6e..b7af7deba0e 100644 --- a/src/mame/drivers/bzone.cpp +++ b/src/mame/drivers/bzone.cpp @@ -546,7 +546,7 @@ static MACHINE_CONFIG_START( bzone_base, bzone_state ) MCFG_SCREEN_VISIBLE_AREA(0, 580, 0, 400) MCFG_SCREEN_UPDATE_DEVICE("vector", vector_device, screen_update) - MCFG_DEVICE_ADD("avg", AVG_BZONE, 0) + MCFG_DEVICE_ADD("avg", AVG_BZONE, XTAL_12_096MHz) MCFG_AVGDVG_VECTOR("vector") /* Drivers */ @@ -875,9 +875,9 @@ DRIVER_INIT_MEMBER(bzone_state,bradley) * *************************************/ -GAMEL(1980, bzone, 0, bzone, bzone, driver_device, 0, ROT0, "Atari", "Battle Zone (rev 2)", MACHINE_SUPPORTS_SAVE, layout_bzone ) -GAMEL(1980, bzonea, bzone, bzone, bzone, driver_device, 0, ROT0, "Atari", "Battle Zone (rev 1)", MACHINE_SUPPORTS_SAVE, layout_bzone ) -GAMEL(1980, bzonec, bzone, bzone, bzone, driver_device, 0, ROT0, "Atari", "Battle Zone (cocktail)", MACHINE_SUPPORTS_SAVE|MACHINE_NO_COCKTAIL, layout_bzone ) -GAME( 1980, bradley, 0, bzone, bradley, bzone_state, bradley, ROT0, "Atari", "Bradley Trainer", MACHINE_SUPPORTS_SAVE ) -GAMEL(1980, redbaron, 0, redbaron, redbaron, driver_device, 0, ROT0, "Atari", "Red Baron (Revised Hardware)", MACHINE_SUPPORTS_SAVE, layout_redbaron ) -GAMEL(1980, redbarona, redbaron, redbaron, redbaron, driver_device, 0, ROT0, "Atari", "Red Baron", MACHINE_SUPPORTS_SAVE, layout_redbaron ) +GAMEL( 1980, bzone, 0, bzone, bzone, driver_device, 0, ROT0, "Atari", "Battle Zone (rev 2)", MACHINE_SUPPORTS_SAVE, layout_bzone ) +GAMEL( 1980, bzonea, bzone, bzone, bzone, driver_device, 0, ROT0, "Atari", "Battle Zone (rev 1)", MACHINE_SUPPORTS_SAVE, layout_bzone ) +GAMEL( 1980, bzonec, bzone, bzone, bzone, driver_device, 0, ROT0, "Atari", "Battle Zone (cocktail)", MACHINE_SUPPORTS_SAVE|MACHINE_NO_COCKTAIL, layout_bzone ) +GAME ( 1980, bradley, 0, bzone, bradley, bzone_state, bradley, ROT0, "Atari", "Bradley Trainer", MACHINE_SUPPORTS_SAVE ) +GAMEL( 1980, redbaron, 0, redbaron, redbaron, driver_device, 0, ROT0, "Atari", "Red Baron (Revised Hardware)", MACHINE_SUPPORTS_SAVE, layout_redbaron ) +GAMEL( 1980, redbarona, redbaron, redbaron, redbaron, driver_device, 0, ROT0, "Atari", "Red Baron", MACHINE_SUPPORTS_SAVE, layout_redbaron ) diff --git a/src/mame/drivers/mhavoc.cpp b/src/mame/drivers/mhavoc.cpp index f039a8d5596..2909da27dde 100644 --- a/src/mame/drivers/mhavoc.cpp +++ b/src/mame/drivers/mhavoc.cpp @@ -505,7 +505,7 @@ static MACHINE_CONFIG_START( mhavoc, mhavoc_state ) MCFG_SCREEN_VISIBLE_AREA(0, 300, 0, 260) MCFG_SCREEN_UPDATE_DEVICE("vector", vector_device, screen_update) - MCFG_DEVICE_ADD("avg", AVG_MHAVOC, 0) + MCFG_DEVICE_ADD("avg", AVG_MHAVOC, XTAL_12_096MHz) MCFG_AVGDVG_VECTOR("vector") /* sound hardware */ @@ -763,9 +763,9 @@ ROM_END * *************************************/ -GAME( 1983, mhavoc, 0, mhavoc, mhavoc, driver_device, 0, ROT0, "Atari", "Major Havoc (rev 3)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, mhavoc2, mhavoc, mhavoc, mhavoc, driver_device, 0, ROT0, "Atari", "Major Havoc (rev 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, mhavocrv, mhavoc, mhavocrv, mhavocrv, mhavoc_state, mhavocrv, ROT0, "Atari / JMA", "Major Havoc (Return to Vax)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, mhavocp, mhavoc, mhavoc, mhavocp, driver_device, 0, ROT0, "Atari", "Major Havoc (prototype)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, alphaone, mhavoc, alphaone, alphaone, driver_device, 0, ROT0, "Atari", "Alpha One (prototype, 3 lives)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, alphaonea,mhavoc, alphaone, alphaone, driver_device, 0, ROT0, "Atari", "Alpha One (prototype, 5 lives)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, mhavoc, 0, mhavoc, mhavoc, driver_device, 0, ROT0, "Atari", "Major Havoc (rev 3)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, mhavoc2, mhavoc, mhavoc, mhavoc, driver_device, 0, ROT0, "Atari", "Major Havoc (rev 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, mhavocrv, mhavoc, mhavocrv, mhavocrv, mhavoc_state, mhavocrv, ROT0, "Atari / JMA", "Major Havoc (Return to Vax)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, mhavocp, mhavoc, mhavoc, mhavocp, driver_device, 0, ROT0, "Atari", "Major Havoc (prototype)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, alphaone, mhavoc, alphaone, alphaone, driver_device, 0, ROT0, "Atari", "Alpha One (prototype, 3 lives)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, alphaonea,mhavoc, alphaone, alphaone, driver_device, 0, ROT0, "Atari", "Alpha One (prototype, 5 lives)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/omegrace.cpp b/src/mame/drivers/omegrace.cpp index 7f7ef74044f..a5da3412001 100644 --- a/src/mame/drivers/omegrace.cpp +++ b/src/mame/drivers/omegrace.cpp @@ -521,7 +521,7 @@ static MACHINE_CONFIG_START( omegrace, omegrace_state ) MCFG_SCREEN_VISIBLE_AREA(522, 1566, 522, 1566) MCFG_SCREEN_UPDATE_DEVICE("vector", vector_device, screen_update) - MCFG_DEVICE_ADD("dvg", DVG, 0) + MCFG_DEVICE_ADD("dvg", DVG, XTAL_12MHz) MCFG_AVGDVG_VECTOR("vector") /* sound hardware */ diff --git a/src/mame/drivers/quantum.cpp b/src/mame/drivers/quantum.cpp index 59c9bde6e6f..0a341cb1a4a 100644 --- a/src/mame/drivers/quantum.cpp +++ b/src/mame/drivers/quantum.cpp @@ -278,7 +278,7 @@ static MACHINE_CONFIG_START( quantum, quantum_state ) MCFG_SCREEN_VISIBLE_AREA(0, 900, 0, 600) MCFG_SCREEN_UPDATE_DEVICE("vector", vector_device, screen_update) - MCFG_DEVICE_ADD("avg", AVG_QUANTUM, 0) + MCFG_DEVICE_ADD("avg", AVG_QUANTUM, MASTER_CLOCK) MCFG_AVGDVG_VECTOR("vector") /* sound hardware */ diff --git a/src/mame/drivers/starwars.cpp b/src/mame/drivers/starwars.cpp index d0c9027ff1c..26b20f94933 100644 --- a/src/mame/drivers/starwars.cpp +++ b/src/mame/drivers/starwars.cpp @@ -355,7 +355,7 @@ static MACHINE_CONFIG_START( starwars, starwars_state ) MCFG_SCREEN_VISIBLE_AREA(0, 250, 0, 280) MCFG_SCREEN_UPDATE_DEVICE("vector", vector_device, screen_update) - MCFG_DEVICE_ADD("avg", AVG_STARWARS, 0) + MCFG_DEVICE_ADD("avg", AVG_STARWARS, MASTER_CLOCK) MCFG_AVGDVG_VECTOR("vector") /* sound hardware */ diff --git a/src/mame/drivers/tempest.cpp b/src/mame/drivers/tempest.cpp index 507d01a6e0b..c3beebe7c35 100644 --- a/src/mame/drivers/tempest.cpp +++ b/src/mame/drivers/tempest.cpp @@ -603,7 +603,7 @@ static MACHINE_CONFIG_START( tempest, tempest_state ) MCFG_SCREEN_VISIBLE_AREA(0, 580, 0, 570) MCFG_SCREEN_UPDATE_DEVICE("vector", vector_device, screen_update) - MCFG_DEVICE_ADD("avg", AVG_TEMPEST, 0) + MCFG_DEVICE_ADD("avg", AVG_TEMPEST, MASTER_CLOCK) MCFG_AVGDVG_VECTOR("vector") /* Drivers */ diff --git a/src/mame/drivers/tomcat.cpp b/src/mame/drivers/tomcat.cpp index de60c5f8bfc..b7854a2d8ca 100644 --- a/src/mame/drivers/tomcat.cpp +++ b/src/mame/drivers/tomcat.cpp @@ -426,7 +426,7 @@ static MACHINE_CONFIG_START( tomcat, tomcat_state ) MCFG_SCREEN_VISIBLE_AREA(0, 280, 0, 250) MCFG_SCREEN_UPDATE_DEVICE("vector", vector_device, screen_update) - MCFG_DEVICE_ADD("avg", AVG_TOMCAT, 0) + MCFG_DEVICE_ADD("avg", AVG_TOMCAT, XTAL_12MHz) MCFG_AVGDVG_VECTOR("vector") MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") @@ -454,4 +454,4 @@ ROM_START( tomcat ) ROM_LOAD( "136021-105.1l", 0x0000, 0x0100, CRC(82fc3eb2) SHA1(184231c7baef598294860a7d2b8a23798c5c7da6) ) /* AVG PROM */ ROM_END -GAME( 1985, tomcat, 0, tomcat, tomcat, driver_device, 0, ROT0, "Atari", "TomCat (prototype)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, tomcat, 0, tomcat, tomcat, driver_device, 0, ROT0, "Atari", "TomCat (prototype)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/machine/asteroid.cpp b/src/mame/machine/asteroid.cpp index 37e252e6bd0..98026d3132a 100644 --- a/src/mame/machine/asteroid.cpp +++ b/src/mame/machine/asteroid.cpp @@ -4,14 +4,13 @@ machine.c - Functions to emulate general aspects of the machine (RAM, ROM, interrupts, - I/O ports) + Functions to emulate general aspects of the machine + (RAM, ROM, interrupts, I/O ports) ***************************************************************************/ #include "emu.h" #include "machine/atari_vg.h" -#include "video/avgdvg.h" #include "includes/asteroid.h" diff --git a/src/mame/video/avgdvg.cpp b/src/mame/video/avgdvg.cpp index 4363db0e66c..a476a23cd42 100644 --- a/src/mame/video/avgdvg.cpp +++ b/src/mame/video/avgdvg.cpp @@ -22,8 +22,6 @@ * *************************************/ -#define MASTER_CLOCK (12096000) -#define VGSLICE (10000) #define VGVECTOR 0 #define VGCLIP 1 @@ -43,20 +41,20 @@ void avgdvg_device::set_flip_x(int flip) { - flip_x = flip; + m_flipx = flip; } void avgdvg_device::set_flip_y(int flip) { - flip_y = flip; + m_flipy = flip; } void avgdvg_device::apply_flipping(int *x, int *y) { - if (flip_x) - *x += (xcenter - *x) << 1; - if (flip_y) - *y += (ycenter - *y) << 1; + if (m_flipx) + *x += (m_xcenter - *x) << 1; + if (m_flipy) + *y += (m_ycenter - *y) << 1; } @@ -74,7 +72,7 @@ void avgdvg_device::vg_flush() i++; m_vector->add_point(vectbuf[i].x, vectbuf[i].y, vectbuf[i].color, 0); - for (i = 0; i < nvect; i++) + for (i = 0; i < m_nvect; i++) { if (vectbuf[i].status == VGVECTOR) m_vector->add_point(vectbuf[i].x, vectbuf[i].y, vectbuf[i].color, vectbuf[i].intensity); @@ -83,32 +81,32 @@ void avgdvg_device::vg_flush() m_vector->add_clip(vectbuf[i].x, vectbuf[i].y, vectbuf[i].arg1, vectbuf[i].arg2); } - nvect=0; + m_nvect=0; } void avgdvg_device::vg_add_point_buf(int x, int y, rgb_t color, int intensity) { - if (nvect < MAXVECT) + if (m_nvect < MAXVECT) { - vectbuf[nvect].status = VGVECTOR; - vectbuf[nvect].x = x; - vectbuf[nvect].y = y; - vectbuf[nvect].color = color; - vectbuf[nvect].intensity = intensity; - nvect++; + vectbuf[m_nvect].status = VGVECTOR; + vectbuf[m_nvect].x = x; + vectbuf[m_nvect].y = y; + vectbuf[m_nvect].color = color; + vectbuf[m_nvect].intensity = intensity; + m_nvect++; } } -void avgdvg_device::vg_add_clip (int xmin, int ymin, int xmax, int ymax) +void avgdvg_device::vg_add_clip(int xmin, int ymin, int xmax, int ymax) { - if (nvect < MAXVECT) + if (m_nvect < MAXVECT) { - vectbuf[nvect].status = VGCLIP; - vectbuf[nvect].x = xmin; - vectbuf[nvect].y = ymin; - vectbuf[nvect].arg1 = xmax; - vectbuf[nvect].arg2 = ymax; - nvect++; + vectbuf[m_nvect].status = VGCLIP; + vectbuf[m_nvect].x = xmin; + vectbuf[m_nvect].y = ymin; + vectbuf[m_nvect].arg1 = xmax; + vectbuf[m_nvect].arg2 = ymax; + m_nvect++; } } @@ -121,9 +119,7 @@ void avgdvg_device::vg_add_clip (int xmin, int ymin, int xmax, int ymax) void dvg_device::update_databus() // dvg_data { - /* - * DVG uses low bit of state for address - */ + // DVG uses low bit of state for address m_data = avgdvg_vectorram[(m_pc << 1) | (m_state_latch & 1)]; } @@ -167,8 +163,8 @@ int dvg_device::handler_1() // dvg_dmald void dvg_device::dvg_draw_to(int x, int y, int intensity) { if (((x | y) & 0x400) == 0) - vg_add_point_buf((xmin + x - 512) << 16, - (ymin + 512 - y) << 16, + vg_add_point_buf((m_xmin + x - 512) << 16, + (m_ymin + 512 - y) << 16, VECTOR_COLOR111(7), intensity << 4); } @@ -594,8 +590,8 @@ int avg_device::avg_common_strobe3() { cycles = 0x8000 - m_timer; m_timer = 0; - m_xpos = xcenter; - m_ypos = ycenter; + m_xpos = m_xcenter; + m_ypos = m_ycenter; vg_add_point_buf(m_xpos, m_ypos, 0, 0); } @@ -627,8 +623,7 @@ int avg_tempest_device::handler_6() // tempest_strobe2 { if ((OP2 == 0) && (m_dvy12 == 0)) { - /* Contrary to previous documentation in MAME, - Tempest does not have the m_enspkl bit. */ + /* Contrary to previous documentation in MAME, Tempest does not have the m_enspkl bit. */ if (m_dvy & 0x800) m_color = m_dvy & 0xf; else @@ -662,8 +657,8 @@ int avg_tempest_device::handler_7() // tempest_strobe3 apply_flipping(&x, &y); - vg_add_point_buf(y - ycenter + xcenter, - x - xcenter + ycenter, rgb_t(r, g, b), + vg_add_point_buf(y - m_ycenter + m_xcenter, + x - m_xcenter + m_ycenter, rgb_t(r, g, b), (((m_int_latch >> 1) == 1)? m_intensity: m_int_latch & 0xe) << 4); } @@ -681,7 +676,7 @@ void avg_tempest_device::vggo() // tempest_vggo * avg_common_strobe2). If we don't discard all vectors in the * current buffer at this point, the screen starts flickering. */ - nvect = 0; + m_nvect = 0; } #endif @@ -699,7 +694,7 @@ void avg_tempest_device::vggo() // tempest_vggo if (m_lst == 0) { - vg_add_clip(0, m_ypos, xmax << 16, ymax << 16); + vg_add_clip(0, m_ypos, m_xmax << 16, m_ymax << 16); } m_lst = 1; @@ -822,8 +817,8 @@ int avg_mhavoc_device::handler_7() // mhavoc_strobe3 { cycles = 0x8000 - m_timer; m_timer = 0; - m_xpos = xcenter; - m_ypos = ycenter; + m_xpos = m_xcenter; + m_ypos = m_ycenter; vg_add_point_buf(m_xpos, m_ypos, 0, 0); } @@ -910,7 +905,7 @@ void avg_quantum_device::vggo() // tempest_vggo * avg_common_strobe2). If we don't discard all vectors in the * current buffer at this point, the screen starts flickering. */ - nvect = 0; + m_nvect = 0; } int avg_quantum_device::handler_0() // quantum_st2st3 @@ -1040,16 +1035,16 @@ int avg_quantum_device::handler_7() // quantum_strobe3 apply_flipping(&x, &y); - vg_add_point_buf(y - ycenter + xcenter, - x - xcenter + ycenter, rgb_t(r, g, b), - ((m_int_latch == 2)? m_intensity: m_int_latch) << 4); + vg_add_point_buf(y - m_ycenter + m_xcenter, x - m_xcenter + m_ycenter, + rgb_t(r, g, b), + ((m_int_latch == 2)? m_intensity: m_int_latch) << 4); } if (OP2) { cycles = 0x4000 - m_timer; m_timer = 0; - m_xpos = xcenter; - m_ypos = ycenter; + m_xpos = m_xcenter; + m_ypos = m_ycenter; vg_add_point_buf(m_xpos, m_ypos, 0, 0); } @@ -1165,7 +1160,7 @@ int avg_tomcat_device::handler_7() // starwars_strobe3 /************************************* * - * halt functions + * halt function * *************************************/ @@ -1175,11 +1170,6 @@ void avgdvg_device::vg_set_halt(int dummy) m_sync_halt = dummy; } -TIMER_CALLBACK_MEMBER( avgdvg_device::vg_set_halt_callback ) -{ - vg_set_halt(param); -} - /******************************************************************** * @@ -1194,12 +1184,17 @@ TIMER_CALLBACK_MEMBER( avgdvg_device::vg_set_halt_callback ) * *******************************************************************/ -TIMER_CALLBACK_MEMBER( avgdvg_device::run_state_machine ) +void avgdvg_device::execute_run() { - int cycles = 0; + if (m_halt) + { + m_icount = 0; + return; + } + UINT8 *state_prom = machine().root_device().memregion("user1")->base(); - while (cycles < VGSLICE) + while (m_icount > 0) { /* Get next state */ m_state_latch = (m_state_latch & 0x10) @@ -1212,26 +1207,26 @@ TIMER_CALLBACK_MEMBER( avgdvg_device::run_state_machine ) /* Decode state and call the corresponding handler */ switch(m_state_latch & 7) { - case 0 : cycles += handler_0(); break; - case 1 : cycles += handler_1(); break; - case 2 : cycles += handler_2(); break; - case 3 : cycles += handler_3(); break; - case 4 : cycles += handler_4(); break; - case 5 : cycles += handler_5(); break; - case 6 : cycles += handler_6(); break; - case 7 : cycles += handler_7(); break; + case 0 : m_icount -= handler_0(); break; + case 1 : m_icount -= handler_1(); break; + case 2 : m_icount -= handler_2(); break; + case 3 : m_icount -= handler_3(); break; + case 4 : m_icount -= handler_4(); break; + case 5 : m_icount -= handler_5(); break; + case 6 : m_icount -= handler_6(); break; + case 7 : m_icount -= handler_7(); break; } } - /* If halt flag was set, let CPU catch up before we make halt visible */ - if (m_halt && !(m_state_latch & 0x10)) - vg_halt_timer->adjust(attotime::from_hz(MASTER_CLOCK) * cycles, 1); + // Halt if flag was set + if (m_halt && !(m_state_latch & 0x10)) + { + vg_set_halt(1); + } m_state_latch = (m_halt << 4) | (m_state_latch & 0xf); - cycles += 8; + m_icount -= 8; } - - vg_run_timer->adjust(attotime::from_hz(MASTER_CLOCK) * cycles); } @@ -1250,7 +1245,7 @@ WRITE8_MEMBER( avgdvg_device::go_w ) { vggo(); - if (m_sync_halt && (nvect > 10)) + if (m_sync_halt && (m_nvect > 10)) { /* * This is a good time to start a new frame. Major Havoc @@ -1262,7 +1257,6 @@ WRITE8_MEMBER( avgdvg_device::go_w ) vg_flush(); vg_set_halt(0); - vg_run_timer->adjust(attotime::zero); } WRITE16_MEMBER( avgdvg_device::go_word_w ) @@ -1285,7 +1279,7 @@ WRITE8_MEMBER( avgdvg_device::reset_w ) WRITE16_MEMBER( avgdvg_device::reset_word_w ) { - reset_w (space,0,0); + reset_w(space,0,0); } /************************************* @@ -1328,8 +1322,8 @@ void avgdvg_device::register_state() save_item(NAME(m_clipx_max)); save_item(NAME(m_clipy_max)); - save_item(NAME(flip_x)); - save_item(NAME(flip_y)); + save_item(NAME(m_flipx)); + save_item(NAME(m_flipy)); save_pointer(NAME(avgdvg_vectorram), avgdvg_vectorram_size); } @@ -1345,18 +1339,15 @@ void avg_device::device_start() avgdvg_colorram = reinterpret_cast(machine().root_device().memshare("colorram")->ptr()); - xmin = visarea.min_x; - ymin = visarea.min_y; - xmax = visarea.max_x; - ymax = visarea.max_y; + m_xmin = visarea.min_x; + m_ymin = visarea.min_y; + m_xmax = visarea.max_x; + m_ymax = visarea.max_y; - xcenter = ((xmax - xmin) / 2) << 16; - ycenter = ((ymax - ymin) / 2) << 16; + m_xcenter = ((m_xmax - m_xmin) / 2) << 16; + m_ycenter = ((m_ymax - m_ymin) / 2) << 16; - flip_x = flip_y = 0; - - vg_halt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(avgdvg_device::vg_set_halt_callback),this)); - vg_run_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(avgdvg_device::run_state_machine),this)); + m_flipx = m_flipy = 0; /* * The x and y DACs use 10 bit of the counter values which are in @@ -1366,6 +1357,8 @@ void avg_device::device_start() m_xdac_xor = 0x200; m_ydac_xor = 0x200; + m_icountptr = &m_icount; + register_state(); } @@ -1381,12 +1374,11 @@ void dvg_device::device_start() avgdvg_colorram = reinterpret_cast(machine().root_device().memshare("colorram")->ptr()); - xmin = visarea.min_x; - ymin = visarea.min_y; - - vg_halt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(avgdvg_device::vg_set_halt_callback),this)); - vg_run_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(avgdvg_device::run_state_machine),this)); + m_xmin = visarea.min_x; + m_ymin = visarea.min_y; + m_icountptr = &m_icount; + register_state(); } @@ -1395,9 +1387,10 @@ void avgdvg_device::static_set_vector_tag(device_t &device, const char *tag) downcast(device).m_vector.set_tag(tag); } -avgdvg_device::avgdvg_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : - device_t(mconfig, type, name, tag, owner, clock, shortname, source), - m_vector(*this) +avgdvg_device::avgdvg_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source) + , device_execute_interface(mconfig, *this) + , m_vector(*this) { m_pc = 0; m_sp = 0; @@ -1440,15 +1433,15 @@ avgdvg_device::avgdvg_device(const machine_config &mconfig, device_type type, co m_clipx_max = 0; m_clipy_max = 0; - xmin = 0; - xmax = 0; - ymin = 0; - ymax = 0; - xcenter = 0; - ycenter = 0; - flip_x = 0; - flip_y = 0; - nvect = 0; + m_xmin = 0; + m_xmax = 0; + m_ymin = 0; + m_ymax = 0; + m_xcenter = 0; + m_ycenter = 0; + m_flipx = 0; + m_flipy = 0; + m_nvect = 0; } dvg_device::dvg_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : diff --git a/src/mame/video/avgdvg.h b/src/mame/video/avgdvg.h index 269e7ebc49f..fa62cb5cac8 100644 --- a/src/mame/video/avgdvg.h +++ b/src/mame/video/avgdvg.h @@ -21,7 +21,8 @@ struct vgvector // ======================> avgdvg_device -class avgdvg_device : public device_t +class avgdvg_device : public device_t, + public device_execute_interface { public: // construction/destruction @@ -40,8 +41,6 @@ public: void set_flip_x(int flip); void set_flip_y(int flip); - TIMER_CALLBACK_MEMBER(vg_set_halt_callback); - TIMER_CALLBACK_MEMBER(run_state_machine); protected: void apply_flipping(int *x, int *y); void vg_set_halt(int dummy); @@ -52,22 +51,21 @@ protected: void register_state(); + virtual void execute_run(); + int m_icount; + UINT8 *avgdvg_vectorram; size_t avgdvg_vectorram_size; - UINT8 *avgdvg_colorram; + UINT8 *avgdvg_colorram; + int m_xmin, m_xmax, m_ymin, m_ymax; + int m_xcenter, m_ycenter; + int m_flipx, m_flipy; - int xmin, xmax, ymin, ymax; - int xcenter, ycenter; - emu_timer *vg_run_timer, *vg_halt_timer; - - int flip_x, flip_y; - - int nvect; + int m_nvect; vgvector vectbuf[MAXVECT]; - UINT16 m_pc; UINT8 m_sp; UINT16 m_dvx;