diff --git a/.gitattributes b/.gitattributes index a5053b87f9b..5daedebc885 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3141,6 +3141,7 @@ src/mame/includes/sauro.h svneol=native#text/plain src/mame/includes/sbasketb.h svneol=native#text/plain src/mame/includes/sbugger.h svneol=native#text/plain src/mame/includes/scotrsht.h svneol=native#text/plain +src/mame/includes/scramble.h svneol=native#text/plain src/mame/includes/sderby.h svneol=native#text/plain src/mame/includes/segag80r.h svneol=native#text/plain src/mame/includes/segag80v.h svneol=native#text/plain diff --git a/src/emu/info.c b/src/emu/info.c index 6b9b82e7c74..d0e39604249 100644 --- a/src/emu/info.c +++ b/src/emu/info.c @@ -199,9 +199,6 @@ enum {cjoy, cdoublejoy, cAD_stick, cdial, ctrackball, cpaddle, clightgun, cpedal for (field = port->fieldlist; field != NULL; field = field->next) { -// if(input_field_name(field) != NULL) -// fprintf(out, "=%s\n", xml_normalize_string(input_field_name(field))); - if (nplayer < field->player + 1) nplayer = field->player + 1; diff --git a/src/emu/video.c b/src/emu/video.c index 6312727b02b..aed2ef572bc 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -555,7 +555,7 @@ void video_manager::exit() global_free(m_snap_bitmap); // print a final result if we have at least 5 seconds' worth of data - if (m_overall_emutime.seconds >= 1) + if (m_overall_emutime.seconds >= 5) { osd_ticks_t tps = osd_ticks_per_second(); double final_real_time = (double)m_overall_real_seconds + (double)m_overall_real_ticks / (double)tps; @@ -1044,8 +1044,7 @@ void video_manager::recompute_speed(attotime emutime) { // create a final screenshot emu_file file(m_machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); - file_error filerr = open_next(file, "png"); -// file_error filerr = file.open(m_machine.basename(), PATH_SEPARATOR "final.png"); + file_error filerr = file.open(m_machine.basename(), PATH_SEPARATOR "final.png"); if (filerr == FILERR_NONE) save_snapshot(m_machine.primary_screen, file); } diff --git a/src/mame/audio/scramble.c b/src/mame/audio/scramble.c index d985de1c285..6fc9b244d88 100644 --- a/src/mame/audio/scramble.c +++ b/src/mame/audio/scramble.c @@ -17,7 +17,7 @@ #include "sound/flt_rc.h" #include "sound/tms5110.h" #include "sound/ay8910.h" -#include "includes/galaxold.h" +#include "includes/scramble.h" #define AD2083_TMS5110_CLOCK XTAL_640kHz diff --git a/src/mame/drivers/dambustr.c b/src/mame/drivers/dambustr.c index ed0e0f7df9f..9b016b01667 100644 --- a/src/mame/drivers/dambustr.c +++ b/src/mame/drivers/dambustr.c @@ -54,11 +54,11 @@ Stephh's notes (based on the games Z80 code and some tests) : #include "machine/7474.h" -class dambustr_state : public driver_device +class dambustr_state : public galaxold_state { public: dambustr_state(running_machine &machine, const driver_device_config_base &config) - : driver_device(machine, config) { } + : galaxold_state(machine, config) { } int m_noise_data; }; @@ -84,11 +84,11 @@ static ADDRESS_MAP_START( dambustr_map, AS_PROGRAM, 8 ) AM_RANGE(0xc000, 0xc7ff) AM_RAM - AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0xd400, 0xd7ff) AM_READ(galaxold_videoram_r) - AM_RANGE(0xd800, 0xd83f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0xd840, 0xd85f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0xd860, 0xd87f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0xd800, 0xd83f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0xd840, 0xd85f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0xd860, 0xd87f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0xd880, 0xd8ff) AM_RAM diff --git a/src/mame/drivers/galaxold.c b/src/mame/drivers/galaxold.c index de1f82a9827..17c07a54d35 100644 --- a/src/mame/drivers/galaxold.c +++ b/src/mame/drivers/galaxold.c @@ -410,11 +410,11 @@ static READ8_HANDLER( drivfrcg_port0_r ) static ADDRESS_MAP_START( galaxold_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_RANGE(0x4000, 0x47ff) AM_RAM - AM_RANGE(0x5000, 0x53ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x5000, 0x53ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x5400, 0x57ff) AM_READ(galaxold_videoram_r) - AM_RANGE(0x5800, 0x583f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x5840, 0x585f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x5860, 0x587f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x5800, 0x583f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x5840, 0x585f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x5860, 0x587f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x5880, 0x58ff) AM_RAM AM_RANGE(0x6000, 0x6000) AM_READ_PORT("IN0") AM_RANGE(0x6000, 0x6001) AM_WRITE(galaxold_leds_w) @@ -440,11 +440,11 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( mooncrst_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM AM_RANGE(0x8000, 0x87ff) AM_RAM - AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x9400, 0x97ff) AM_READ(galaxold_videoram_r) - AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x9880, 0x98ff) AM_RAM AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0") AM_RANGE(0xa003, 0xa003) AM_WRITE(galaxold_coin_counter_w) @@ -465,18 +465,18 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( rockclim_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x4000, 0x47ff) AM_READWRITE(rockclim_videoram_r, rockclim_videoram_w) AM_BASE(&rockclim_videoram)//4800 - 4803 = bg scroll ? + AM_RANGE(0x4000, 0x47ff) AM_READWRITE(rockclim_videoram_r, rockclim_videoram_w) AM_BASE_MEMBER(galaxold_state, m_rockclim_videoram)//4800 - 4803 = bg scroll ? AM_RANGE(0x4800, 0x4803) AM_WRITE(rockclim_scroll_w) AM_RANGE(0x5000, 0x53ff) AM_RAM //? AM_RANGE(0x5800, 0x5800) AM_READ_PORT("IN2") AM_RANGE(0x6000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x87ff) AM_RAM AM_RANGE(0x8800, 0x8800) AM_READ_PORT("DSW1") - AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x9400, 0x97ff) AM_READ(galaxold_videoram_r) - AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x9880, 0x98ff) AM_RAM AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0") AM_RANGE(0xa000, 0xa002) AM_WRITE(galaxold_gfxbank_w)// a002 - sprite bank @@ -498,10 +498,10 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( ckongg_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM AM_RANGE(0x6000, 0x6fff) AM_RAM - AM_RANGE(0x9000, 0x93ff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE(&galaxold_videoram) - AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x9000, 0x93ff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) + AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x9880, 0x98ff) AM_RAM AM_RANGE(0xc000, 0xc000) AM_READ_PORT("IN0") AM_RANGE(0xc000, 0xc001) AM_WRITE(galaxold_leds_w) @@ -525,10 +525,10 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( ckongmc_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM AM_RANGE(0x6000, 0x6fff) AM_RAM - AM_RANGE(0x9000, 0x93ff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE(&galaxold_videoram) - AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x9000, 0x93ff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) + AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x9880, 0x98ff) AM_RAM AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0") AM_RANGE(0xa001, 0xa002) AM_WRITE(galaxold_leds_w) /* GUESS */ @@ -552,10 +552,10 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( scramblb_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_RANGE(0x4000, 0x47ff) AM_RAM - AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) - AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) + AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x5080, 0x50ff) AM_RAM AM_RANGE(0x6000, 0x6000) AM_READ_PORT("IN0") AM_RANGE(0x6000, 0x6001) AM_WRITENOP /* sound triggers */ @@ -587,11 +587,11 @@ static READ8_HANDLER( scramb2_port2_r ) { return (input_port_read(space->machine static ADDRESS_MAP_START( scramb2_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_RANGE(0x4000, 0x47ff) AM_RAM - AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x4c00, 0x4fff) AM_WRITE(galaxold_videoram_w) // mirror - AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x5080, 0x50ff) AM_RAM AM_RANGE(0x5800, 0x5fff) AM_READ(scramb2_protection_r) // must return 0x25 AM_RANGE(0x6000, 0x6007) AM_READ(scramb2_port0_r) // reads from 8 addresses, 1 bit per address @@ -612,11 +612,11 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( _4in1_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROMBANK("bank1") /* banked game code */ AM_RANGE(0x4000, 0x47ff) AM_RAM - AM_RANGE(0x5000, 0x53ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x5000, 0x53ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x5400, 0x57ff) AM_READ(galaxold_videoram_r) - AM_RANGE(0x5800, 0x583f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x5840, 0x585f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x5860, 0x587f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x5800, 0x583f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x5840, 0x585f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x5860, 0x587f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x5880, 0x58ff) AM_RAM AM_RANGE(0x6000, 0x6000) AM_READ_PORT("IN0") AM_RANGE(0x6000, 0x6001) AM_WRITE(galaxold_leds_w) @@ -643,11 +643,11 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( bagmanmc_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM AM_RANGE(0x6000, 0x67ff) AM_RAM - AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x9400, 0x97ff) AM_READ(galaxold_videoram_r) - AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x9880, 0x98ff) AM_RAM AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0") AM_RANGE(0xa003, 0xa003) AM_WRITE(galaxold_coin_counter_w) @@ -665,10 +665,10 @@ static ADDRESS_MAP_START( dkongjrm_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM AM_RANGE(0x6000, 0x6fff) AM_RAM AM_RANGE(0x7000, 0x7fff) AM_ROM - AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) - AM_RANGE(0x9800, 0x983f) AM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x9840, 0x987f) AM_WRITEONLY AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x98c0, 0x98ff) AM_WRITEONLY AM_BASE(&galaxold_spriteram2) AM_SIZE(&galaxold_spriteram2_size) + AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) + AM_RANGE(0x9800, 0x983f) AM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x9840, 0x987f) AM_WRITEONLY AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x98c0, 0x98ff) AM_WRITEONLY AM_BASE_MEMBER(galaxold_state, m_spriteram2) AM_SIZE_MEMBER(galaxold_state, m_spriteram2_size) AM_RANGE(0xa000, 0xa0ff) AM_READ_PORT("IN0") AM_RANGE(0xa003, 0xa003) AM_WRITE(galaxold_coin_counter_w) //AM_RANGE(0xa004, 0xa007) AM_WRITE(galaxian_lfo_freq_w) @@ -691,11 +691,11 @@ static ADDRESS_MAP_START( tazzmang, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM AM_RANGE(0x7000, 0x7000) AM_READ_PORT("DSW0") /* mirror */ AM_RANGE(0x8000, 0x87ff) AM_RAM - AM_RANGE(0x8800, 0x883f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x8840, 0x885f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x8860, 0x887f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x8800, 0x883f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x8840, 0x885f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x8860, 0x887f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x8880, 0x8bff) AM_WRITENOP - AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x9800, 0x9800) AM_READ(watchdog_reset_r) AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0") AM_RANGE(0xa7ff, 0xa7ff) AM_READ_PORT("IN0") /* mirror */ @@ -716,11 +716,11 @@ static ADDRESS_MAP_START( bongo, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM AM_RANGE(0x8000, 0x83ff) AM_RAM AM_RANGE(0x8400, 0x87ff) AM_WRITENOP // not used - AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x9400, 0x97ff) AM_WRITENOP // not used - AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0") AM_RANGE(0xa800, 0xa800) AM_READ_PORT("IN1") AM_RANGE(0xb000, 0xb000) AM_READ_PORT("DSW0") @@ -742,10 +742,10 @@ static ADDRESS_MAP_START( ozon1_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x2fff) AM_ROM AM_RANGE(0x4000, 0x4200) AM_RAM AM_RANGE(0x4300, 0x43ff) AM_RAM - AM_RANGE(0x4800, 0x4bff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x4800, 0x4bff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x4c00, 0x4fff) AM_WRITE(galaxold_videoram_w) - AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) + AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) AM_RANGE(0x6801, 0x6801) AM_WRITENOP //continuosly 0 and 1 AM_RANGE(0x6802, 0x6802) AM_WRITE(galaxold_coin_counter_w) AM_RANGE(0x6806, 0x6806) AM_WRITE(galaxold_flip_screen_x_w) @@ -766,16 +766,16 @@ static ADDRESS_MAP_START( harem_cpu1, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x1fff) AM_ROM AM_RANGE(0x2000, 0x27ff) AM_RAM AM_RANGE(0x4000, 0x47ff) AM_RAM - AM_RANGE(0x4800, 0x4fff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x4800, 0x4fff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x5000, 0x5000) AM_WRITENOP AM_RANGE(0x5800, 0x5800) AM_READNOP AM_WRITE(interrupt_enable_w) AM_RANGE(0x5801, 0x5807) AM_WRITENOP AM_RANGE(0x6101, 0x6101) AM_READ_PORT("IN0") AM_RANGE(0x6102, 0x6102) AM_READ_PORT("IN1") AM_RANGE(0x6103, 0x6103) AM_WRITENOP - AM_RANGE(0x6200, 0x6203) AM_WRITENOP AM_BASE(&galaxold_attributesram) + AM_RANGE(0x6200, 0x6203) AM_WRITENOP AM_BASE_MEMBER(galaxold_state, m_attributesram) AM_RANGE(0x8000, 0x9fff) AM_ROM - AM_RANGE(0xffe6, 0xffff) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) + AM_RANGE(0xffe6, 0xffff) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) ADDRESS_MAP_END static ADDRESS_MAP_START( harem_cpu2, AS_PROGRAM, 8 ) @@ -797,8 +797,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( hunchbkg, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x1480, 0x14bf) AM_MIRROR(0x6000) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x14c0, 0x14ff) AM_MIRROR(0x6000) AM_WRITEONLY AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) + AM_RANGE(0x1480, 0x14bf) AM_MIRROR(0x6000) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x14c0, 0x14ff) AM_MIRROR(0x6000) AM_WRITEONLY AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) AM_RANGE(0x1500, 0x1500) AM_MIRROR(0x6000) AM_READ_PORT("IN0") AM_RANGE(0x1500, 0x1501) AM_MIRROR(0x6000) AM_WRITE(galaxold_leds_w) /* not connected ... */ AM_RANGE(0x1502, 0x1502) AM_MIRROR(0x6000) AM_WRITE(galaxold_coin_lockout_w) /* not connected ... */ @@ -815,7 +815,7 @@ static ADDRESS_MAP_START( hunchbkg, AS_PROGRAM, 8 ) AM_RANGE(0x1606, 0x1606) AM_MIRROR(0x6000) AM_WRITE(galaxold_flip_screen_x_w) AM_RANGE(0x1607, 0x1607) AM_MIRROR(0x6000) AM_WRITE(galaxold_flip_screen_y_w) AM_RANGE(0x1680, 0x1680) AM_MIRROR(0x6000) AM_READ(watchdog_reset_r) AM_DEVWRITE(GAL_AUDIO, galaxian_pitch_w) - AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM AM_RANGE(0x2000, 0x2fff) AM_ROM AM_RANGE(0x4000, 0x4fff) AM_ROM @@ -832,8 +832,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( drivfrcg, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x1480, 0x14bf) AM_MIRROR(0x6000) AM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x14c0, 0x14ff) AM_MIRROR(0x6000) AM_WRITEONLY AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) + AM_RANGE(0x1480, 0x14bf) AM_MIRROR(0x6000) AM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x14c0, 0x14ff) AM_MIRROR(0x6000) AM_WRITEONLY AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) AM_RANGE(0x1500, 0x1500) AM_MIRROR(0x6000) AM_READ_PORT("IN0") AM_RANGE(0x1503, 0x1503) AM_MIRROR(0x6000) AM_WRITE(galaxold_coin_counter_w) AM_RANGE(0x1580, 0x1580) AM_MIRROR(0x6000) AM_READ_PORT("IN1") @@ -845,7 +845,7 @@ static ADDRESS_MAP_START( drivfrcg, AS_PROGRAM, 8 ) AM_RANGE(0x1700, 0x1700) AM_MIRROR(0x6000) AM_READ_PORT("DSW1") AM_WRITENOP AM_RANGE(0x1701, 0x1701) AM_MIRROR(0x6000) AM_WRITENOP AM_RANGE(0x1704, 0x1707) AM_MIRROR(0x6000) AM_DEVWRITE(GAL_AUDIO, galaxian_vol_w) - AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM AM_RANGE(0x2000, 0x2fff) AM_ROM AM_RANGE(0x4000, 0x4fff) AM_ROM @@ -860,8 +860,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( racknrol, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x1400, 0x143f) AM_MIRROR(0x6000) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x1440, 0x14bf) AM_MIRROR(0x6000) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) + AM_RANGE(0x1400, 0x143f) AM_MIRROR(0x6000) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x1440, 0x14bf) AM_MIRROR(0x6000) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) AM_RANGE(0x14c0, 0x14ff) AM_MIRROR(0x6000) AM_RAM AM_RANGE(0x1500, 0x1500) AM_MIRROR(0x6000) AM_READ_PORT("IN0") AM_RANGE(0x1580, 0x1580) AM_MIRROR(0x6000) AM_READ_PORT("IN1") @@ -872,7 +872,7 @@ static ADDRESS_MAP_START( racknrol, AS_PROGRAM, 8 ) AM_RANGE(0x1680, 0x1680) AM_MIRROR(0x6000) AM_READNOP // AM_RANGE(0x1700, 0x1700) AM_MIRROR(0x6000) AM_READ(trvchlng_question_r) // AM_RANGE(0x1701, 0x1703) AM_MIRROR(0x6000) AM_READ(trvchlng_question_w) - AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM AM_RANGE(0x2000, 0x2fff) AM_ROM AM_RANGE(0x4000, 0x4fff) AM_ROM @@ -883,7 +883,7 @@ static ADDRESS_MAP_START( racknrol_io, AS_IO, 8 ) AM_RANGE(0x1d, 0x1d) AM_DEVWRITE("sn1", sn76496_w) AM_RANGE(0x1e, 0x1e) AM_DEVWRITE("sn2", sn76496_w) AM_RANGE(0x1f, 0x1f) AM_DEVWRITE("sn3", sn76496_w) - AM_RANGE(0x20, 0x3f) AM_WRITE(racknrol_tiles_bank_w) AM_BASE(&racknrol_tiles_bank) + AM_RANGE(0x20, 0x3f) AM_WRITE(racknrol_tiles_bank_w) AM_BASE_MEMBER(galaxold_state, m_racknrol_tiles_bank) AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ_PORT("SENSE") ADDRESS_MAP_END @@ -903,7 +903,7 @@ static READ8_HANDLER( hexpoola_data_port_r ) static ADDRESS_MAP_START( hexpoola_io, AS_IO, 8 ) AM_RANGE(0x00, 0x00) AM_READNOP - AM_RANGE(0x20, 0x3f) AM_WRITE(racknrol_tiles_bank_w) AM_BASE(&racknrol_tiles_bank) + AM_RANGE(0x20, 0x3f) AM_WRITE(racknrol_tiles_bank_w) AM_BASE_MEMBER(galaxold_state, m_racknrol_tiles_bank) AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_READ(hexpoola_data_port_r) AM_DEVWRITE("snsnd", sn76496_w) AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ_PORT("SENSE") ADDRESS_MAP_END @@ -2117,7 +2117,7 @@ static const ay8910_interface bongo_ay8910_interface = }; -static MACHINE_CONFIG_START( galaxold_base, driver_device ) +static MACHINE_CONFIG_START( galaxold_base, galaxold_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, PIXEL_CLOCK/2) /* 3.072 MHz */ @@ -2276,7 +2276,7 @@ static MACHINE_CONFIG_DERIVED( ozon1, galaxold_base ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END -static MACHINE_CONFIG_START( drivfrcg, driver_device ) +static MACHINE_CONFIG_START( drivfrcg, galaxold_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", S2650, MASTER_CLOCK/6) @@ -2370,7 +2370,7 @@ static MACHINE_CONFIG_DERIVED( tazzmang, galaxian ) MCFG_CPU_PROGRAM_MAP(tazzmang) MACHINE_CONFIG_END -static MACHINE_CONFIG_START( racknrol, driver_device ) +static MACHINE_CONFIG_START( racknrol, galaxold_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", S2650, PIXEL_CLOCK/2) @@ -2426,7 +2426,7 @@ static MACHINE_CONFIG_DERIVED( ckongmc, galaxian ) MACHINE_CONFIG_END -static MACHINE_CONFIG_START( hexpoola, driver_device ) +static MACHINE_CONFIG_START( hexpoola, galaxold_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", S2650, PIXEL_CLOCK/2) diff --git a/src/mame/drivers/scobra.c b/src/mame/drivers/scobra.c index ff8a2e571b4..4d046387854 100644 --- a/src/mame/drivers/scobra.c +++ b/src/mame/drivers/scobra.c @@ -36,15 +36,15 @@ Notes/Tidbits: #include "cpu/z80/z80.h" #include "machine/8255ppi.h" #include "machine/7474.h" -#include "includes/galaxold.h" #include "sound/ay8910.h" +#include "includes/scramble.h" -class scobra_state : public driver_device +class scobra_state : public scramble_state { public: scobra_state(running_machine &machine, const driver_device_config_base &config) - : driver_device(machine, config) { } + : scramble_state(machine, config) { } UINT8 *m_soundram; }; @@ -115,12 +115,12 @@ static WRITE8_DEVICE_HANDLER(hustler_ppi8255_w) static ADDRESS_MAP_START( type1_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x87ff) AM_RAM - AM_RANGE(0x8800, 0x8bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x8800, 0x8bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x8c00, 0x8fff) AM_RAM_WRITE(galaxold_videoram_w) /* mirror */ AM_RANGE(0x8c00, 0x8fff) AM_READ(galaxold_videoram_r) /* mirror */ - AM_RANGE(0x9000, 0x903f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x9040, 0x905f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x9060, 0x907f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x9000, 0x903f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x9040, 0x905f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x9060, 0x907f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x9080, 0x90ff) AM_RAM AM_RANGE(0x9800, 0x9803) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w) AM_RANGE(0xa000, 0xa003) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w) @@ -135,11 +135,11 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( type2_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x87ff) AM_RAM - AM_RANGE(0x8800, 0x883f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x8840, 0x885f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x8860, 0x887f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x8800, 0x883f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x8840, 0x885f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x8860, 0x887f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x8880, 0x88ff) AM_RAM - AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x9400, 0x97ff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) /* mirror */ AM_RANGE(0x9800, 0x9800) AM_READ(watchdog_reset_r) AM_RANGE(0xa000, 0xa00f) AM_DEVREADWRITE("ppi8255_0", scobra_type2_ppi8255_r, scobra_type2_ppi8255_w) @@ -155,10 +155,10 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( hustler_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x87ff) AM_RAM - AM_RANGE(0x8800, 0x8bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) - AM_RANGE(0x9000, 0x903f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x9040, 0x905f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x9060, 0x907f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x8800, 0x8bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) + AM_RANGE(0x9000, 0x903f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x9040, 0x905f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x9060, 0x907f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x9080, 0x90ff) AM_RAM AM_RANGE(0xa802, 0xa802) AM_WRITE(galaxold_flip_screen_x_w) AM_RANGE(0xa804, 0xa804) AM_WRITE(galaxold_nmi_enable_w) @@ -172,10 +172,10 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( hustlerb_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_RAM AM_RANGE(0x8000, 0x87ff) AM_RAM - AM_RANGE(0x8800, 0x8bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) - AM_RANGE(0x9000, 0x903f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x9040, 0x905f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x9060, 0x907f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x8800, 0x8bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) + AM_RANGE(0x9000, 0x903f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x9040, 0x905f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x9060, 0x907f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x9080, 0x90ff) AM_RAM AM_RANGE(0xa801, 0xa801) AM_WRITE(galaxold_nmi_enable_w) AM_RANGE(0xa802, 0xa802) AM_WRITENOP /* coin counters */ @@ -189,11 +189,11 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( mimonkey_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_RANGE(0x8000, 0x87ff) AM_RAM - AM_RANGE(0x8800, 0x8bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x8800, 0x8bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x8c00, 0x8fff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) /* mirror */ - AM_RANGE(0x9000, 0x903f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x9040, 0x905f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x9060, 0x907f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x9000, 0x903f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x9040, 0x905f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x9060, 0x907f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x9080, 0x90ff) AM_RAM AM_RANGE(0x9800, 0x9803) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w) AM_RANGE(0xa000, 0xa003) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w) diff --git a/src/mame/drivers/scramble.c b/src/mame/drivers/scramble.c index 26e46ebd1fa..edcf9bbdb2e 100644 --- a/src/mame/drivers/scramble.c +++ b/src/mame/drivers/scramble.c @@ -33,18 +33,18 @@ Notes: #include "sound/flt_rc.h" #include "machine/7474.h" #include "machine/8255ppi.h" -#include "includes/galaxold.h" +#include "includes/scramble.h" static ADDRESS_MAP_START( scramble_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_RANGE(0x4000, 0x47ff) AM_RAM - AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x4c00, 0x4fff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) /* mirror address */ - AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x5080, 0x50ff) AM_RAM AM_RANGE(0x6801, 0x6801) AM_WRITE(galaxold_nmi_enable_w) AM_RANGE(0x6802, 0x6802) AM_WRITE(galaxold_coin_counter_w) @@ -62,11 +62,11 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( turpins_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_ROM AM_RANGE(0x8000, 0x87ff) AM_RAM - AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x9400, 0x97ff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) - AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x9880, 0x98ff) AM_RAM AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0") @@ -94,10 +94,10 @@ static ADDRESS_MAP_START( ckongs_map, AS_PROGRAM, 8 ) AM_RANGE(0x6000, 0x6bff) AM_RAM AM_RANGE(0x7000, 0x7003) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w) AM_RANGE(0x7800, 0x7803) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w) - AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) - AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) + AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x9860, 0x987f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x9880, 0x98ff) AM_RAM AM_RANGE(0xa801, 0xa801) AM_WRITE(galaxold_nmi_enable_w) AM_RANGE(0xa802, 0xa802) AM_WRITE(galaxold_coin_counter_w) @@ -121,11 +121,11 @@ static WRITE8_DEVICE_HANDLER(mars_ppi8255_w) static ADDRESS_MAP_START( mars_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_RANGE(0x4000, 0x47ff) AM_RAM - AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x4c00, 0x4fff) AM_READ(galaxold_videoram_r) - AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x5080, 0x50ff) AM_RAM AM_RANGE(0x6800, 0x6800) AM_WRITE(galaxold_coin_counter_1_w) AM_RANGE(0x6801, 0x6801) AM_WRITE(galaxold_stars_enable_w) @@ -143,11 +143,11 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( newsin7_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_RANGE(0x4000, 0x47ff) AM_RAM - AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x4c00, 0x4fff) AM_READ(galaxold_videoram_r) - AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x5080, 0x50ff) AM_RAM AM_RANGE(0x6800, 0x6800) AM_WRITE(galaxold_coin_counter_1_w) AM_RANGE(0x6801, 0x6801) AM_WRITE(galaxold_stars_enable_w) @@ -165,11 +165,11 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( mrkougar_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_RANGE(0x4000, 0x47ff) AM_RAM - AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x4c00, 0x4fff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) - AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x5080, 0x50ff) AM_RAM AM_RANGE(0x6800, 0x6800) AM_WRITE(galaxold_coin_counter_1_w) AM_RANGE(0x6801, 0x6801) AM_WRITE(galaxold_nmi_enable_w) @@ -185,11 +185,11 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( hotshock_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_RANGE(0x4000, 0x47ff) AM_RAM - AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x4c00, 0x4fff) AM_READ(galaxold_videoram_r) - AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x5080, 0x50ff) AM_RAM AM_RANGE(0x6000, 0x6000) AM_WRITE(galaxold_coin_counter_2_w) AM_RANGE(0x6002, 0x6002) AM_WRITE(galaxold_coin_counter_1_w) @@ -209,16 +209,16 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( hunchbks_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x0fff) AM_ROM AM_RANGE(0x1210, 0x1213) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w) - AM_RANGE(0x1400, 0x143f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x1440, 0x145f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x1460, 0x147f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x1400, 0x143f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x1440, 0x145f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x1460, 0x147f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x1480, 0x14ff) AM_RAM AM_RANGE(0x1500, 0x1503) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w) AM_RANGE(0x1606, 0x1606) AM_WRITE(galaxold_flip_screen_x_w) AM_RANGE(0x1607, 0x1607) AM_WRITE(galaxold_flip_screen_y_w) AM_RANGE(0x1680, 0x1680) AM_READ(watchdog_reset_r) AM_RANGE(0x1780, 0x1780) AM_READ(watchdog_reset_r) - AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) + AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) AM_RANGE(0x1c00, 0x1fff) AM_RAM AM_RANGE(0x2000, 0x2fff) AM_ROM AM_RANGE(0x3000, 0x3fff) AM_READWRITE(hunchbks_mirror_r, hunchbks_mirror_w) @@ -233,10 +233,10 @@ static ADDRESS_MAP_START( mimonscr_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_RANGE(0x4000, 0x43ff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) /* mirror address?, probably not */ AM_RANGE(0x4400, 0x47ff) AM_RAM - AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) - AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) + AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x5080, 0x50ff) AM_RAM AM_RANGE(0x6801, 0x6801) AM_WRITE(galaxold_nmi_enable_w) AM_RANGE(0x6800, 0x6802) AM_WRITE(galaxold_gfxbank_w) @@ -252,10 +252,10 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( ad2083_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_RANGE(0x4000, 0x47ff) AM_RAM - AM_RANGE(0x4800, 0x4bff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE(&galaxold_videoram) - AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) - AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) - AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE(&galaxold_bulletsram) AM_SIZE(&galaxold_bulletsram_size) + AM_RANGE(0x4800, 0x4bff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) AM_BASE_MEMBER(galaxold_state, m_videoram) + AM_RANGE(0x5000, 0x503f) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE_MEMBER(galaxold_state, m_attributesram) + AM_RANGE(0x5040, 0x505f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_spriteram) AM_SIZE_MEMBER(galaxold_state, m_spriteram_size) + AM_RANGE(0x5060, 0x507f) AM_RAM AM_BASE_MEMBER(galaxold_state, m_bulletsram) AM_SIZE_MEMBER(galaxold_state, m_bulletsram_size) AM_RANGE(0x6004, 0x6004) AM_WRITE(hotshock_flip_screen_w) AM_RANGE(0x6800, 0x6800) AM_WRITE(galaxold_coin_counter_2_w) AM_RANGE(0x6801, 0x6801) AM_WRITE(galaxold_nmi_enable_w) @@ -1206,22 +1206,23 @@ static GFXDECODE_START( scramble ) GFXDECODE_END -static UINT8 *scramble_soundram; static READ8_HANDLER(scramble_soundram_r) { - return scramble_soundram[offset & 0x03ff]; + scramble_state *state = space->machine().driver_data(); + return state->m_soundram[offset & 0x03ff]; } static WRITE8_HANDLER(scramble_soundram_w) { - scramble_soundram[offset & 0x03ff] = data; + scramble_state *state = space->machine().driver_data(); + state->m_soundram[offset & 0x03ff] = data; } static ADDRESS_MAP_START( scramble_sound_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x2fff) AM_ROM AM_RANGE(0x8000, 0x8fff) AM_READWRITE(scramble_soundram_r, scramble_soundram_w) - AM_RANGE(0x8000, 0x83ff) AM_WRITENOP AM_BASE(&scramble_soundram) /* only here to initialize pointer */ + AM_RANGE(0x8000, 0x83ff) AM_WRITENOP AM_BASE_MEMBER(scramble_state, m_soundram) /* only here to initialize pointer */ AM_RANGE(0x9000, 0x9fff) AM_WRITE(scramble_filter_w) ADDRESS_MAP_END @@ -1233,7 +1234,7 @@ static ADDRESS_MAP_START( scramble_sound_io_map, AS_IO, 8 ) AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("8910.2", ay8910_r, ay8910_data_w) ADDRESS_MAP_END -static MACHINE_CONFIG_START( scramble, driver_device ) +static MACHINE_CONFIG_START( scramble, scramble_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, 18432000/6) /* 3.072 MHz */ @@ -1313,7 +1314,7 @@ static MACHINE_CONFIG_DERIVED( newsin7, scramble ) MCFG_GFXDECODE(newsin7) MCFG_PALETTE_LENGTH(32+64+2+0) /* 32 for characters, 64 for stars, 2 for bullets, 0/1 for background */ MCFG_PALETTE_INIT(galaxold) - MCFG_VIDEO_START(newsin7) + MCFG_VIDEO_START(scrambold) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( mrkougar, scramble ) @@ -1463,7 +1464,7 @@ static MACHINE_CONFIG_DERIVED( hncholms, hunchbks ) MCFG_VIDEO_START(scorpion) MACHINE_CONFIG_END -static MACHINE_CONFIG_START( ad2083, driver_device ) +static MACHINE_CONFIG_START( ad2083, scramble_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, 18432000/6) /* 3.072 MHz */ MCFG_CPU_PROGRAM_MAP(ad2083_map) diff --git a/src/mame/includes/fastfred.h b/src/mame/includes/fastfred.h index ec8f48de1b8..20e05f6e548 100644 --- a/src/mame/includes/fastfred.h +++ b/src/mame/includes/fastfred.h @@ -5,11 +5,13 @@ ***************************************************************************/ -class fastfred_state : public driver_device +#include "includes/galaxold.h" + +class fastfred_state : public galaxold_state { public: fastfred_state(running_machine &machine, const driver_device_config_base &config) - : driver_device(machine, config) { } + : galaxold_state(machine, config) { } UINT8 m_imago_sprites[0x800*3]; UINT16 m_imago_sprites_address; diff --git a/src/mame/includes/galaxold.h b/src/mame/includes/galaxold.h index f003b7eedc7..31eabe0d9f3 100644 --- a/src/mame/includes/galaxold.h +++ b/src/mame/includes/galaxold.h @@ -1,35 +1,90 @@ /*************************************************************************** - Galaxian hardware family + Galaxian hardware family (old) This include file is used by the following drivers: - - galaxian.c + - dambustr.c + - galaxold.c - scramble.c - scobra.c - - frogger.c - - amidar.c - - dambustr.c ***************************************************************************/ -#include "machine/8255ppi.h" +#ifndef __GALAXOLD_H__ +#define __GALAXOLD_H__ + +/* star circuit */ +#define STAR_COUNT 252 +struct star +{ + int x, y, color; +}; + +class galaxold_state : public driver_device +{ +public: + galaxold_state(running_machine &machine, const driver_device_config_base &config) + : driver_device(machine, config) { } + + UINT8 *m_videoram; + UINT8 *m_spriteram; + UINT8 *m_spriteram2; + UINT8 *m_attributesram; + UINT8 *m_bulletsram; + UINT8 *m_rockclim_videoram; + UINT8 *m_racknrol_tiles_bank; + size_t m_spriteram_size; + size_t m_spriteram2_size; + size_t m_bulletsram_size; + int m_irq_line; + UINT8 m__4in1_bank; + tilemap_t *m_bg_tilemap; + tilemap_t *m_rockclim_tilemap; + int m_mooncrst_gfxextend; + int m_spriteram2_present; + UINT8 m_gfxbank[5]; + UINT8 m_flipscreen_x; + UINT8 m_flipscreen_y; + UINT8 m_color_mask; + tilemap_t *m_dambustr_tilemap2; + UINT8 *m_dambustr_videoram2; + void (*m_modify_charcode)(running_machine &machine, UINT16 *code, UINT8 x); /* function to call to do character banking */ + void (*m_modify_spritecode)(running_machine &machine, UINT8 *spriteram, int*, int*, int*, int); /* function to call to do sprite banking */ + void (*m_modify_color)(UINT8 *color); /* function to call to do modify how the color codes map to the PROM */ + void (*m_modify_ypos)(UINT8*); /* function to call to do modify how vertical positioning bits are connected */ + void (*m_tilemap_set_scroll)( tilemap_t *, int col, int value ); + + UINT8 m_timer_adjusted; + UINT8 m_darkplnt_bullet_color; + void (*m_draw_bullets)(running_machine &,bitmap_t *,const rectangle *, int, int, int); /* function to call to draw a bullet */ + + UINT8 m_background_enable; + UINT8 m_background_red; + UINT8 m_background_green; + UINT8 m_background_blue; + void (*m_draw_background)(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); /* function to call to draw the background */ + UINT16 m_rockclim_v; + UINT16 m_rockclim_h; + int m_dambustr_bg_split_line; + int m_dambustr_bg_color_1; + int m_dambustr_bg_color_2; + int m_dambustr_bg_priority; + int m_dambustr_char_bank; + bitmap_t *m_dambustr_tmpbitmap; + + void (*m_draw_stars)(running_machine &machine, bitmap_t *, const rectangle *); /* function to call to draw the star layer */ + int m_stars_colors_start; + INT32 m_stars_scrollpos; + UINT8 m_stars_on; + UINT8 m_stars_blink_state; + emu_timer *m_stars_blink_timer; + emu_timer *m_stars_scroll_timer; + struct star m_stars[STAR_COUNT]; +}; + /*----------- defined in video/galaxold.c -----------*/ -extern UINT8 *galaxold_videoram; -extern UINT8 *galaxold_spriteram; -extern UINT8 *galaxold_spriteram2; -extern UINT8 *galaxold_attributesram; -extern UINT8 *galaxold_bulletsram; -extern UINT8 *rockclim_videoram; -extern UINT8 *racknrol_tiles_bank; - - -extern size_t galaxold_spriteram_size; -extern size_t galaxold_spriteram2_size; -extern size_t galaxold_bulletsram_size; -extern UINT8 galaxold_stars_on; - PALETTE_INIT( galaxold ); PALETTE_INIT( scrambold ); PALETTE_INIT( darkplnt ); @@ -77,7 +132,6 @@ VIDEO_START( stratgyx ); VIDEO_START( mimonkey ); VIDEO_START( mariner ); VIDEO_START( ckongs ); -VIDEO_START( newsin7 ); VIDEO_START( rockclim ); VIDEO_START( drivfrcg ); VIDEO_START( bongo ); @@ -127,66 +181,4 @@ CUSTOM_INPUT( _4in1_fake_port_r ); INTERRUPT_GEN( hunchbks_vh_interrupt ); - -/*----------- defined in machine/scramble.c -----------*/ - -extern const ppi8255_interface scramble_ppi_0_intf; -extern const ppi8255_interface scramble_ppi_1_intf; -extern const ppi8255_interface stratgyx_ppi_1_intf; -extern const ppi8255_interface scramble_protection_ppi_1_intf; -extern const ppi8255_interface mrkougar_ppi_1_intf; - - -DRIVER_INIT( scramble_ppi ); -DRIVER_INIT( stratgyx ); -DRIVER_INIT( tazmani2 ); -DRIVER_INIT( ckongs ); -DRIVER_INIT( mariner ); -DRIVER_INIT( devilfsh ); -DRIVER_INIT( mars ); -DRIVER_INIT( hotshock ); -DRIVER_INIT( cavelon ); -DRIVER_INIT( darkplnt ); -DRIVER_INIT( mimonkey ); -DRIVER_INIT( mimonsco ); -DRIVER_INIT( mimonscr ); -DRIVER_INIT( rescue ); -DRIVER_INIT( minefld ); -DRIVER_INIT( hustler ); -DRIVER_INIT( hustlerd ); -DRIVER_INIT( billiard ); -DRIVER_INIT( mrkougar ); -DRIVER_INIT( mrkougb ); -DRIVER_INIT( ad2083 ); - -MACHINE_RESET( scramble ); -MACHINE_RESET( explorer ); - -READ8_HANDLER( triplep_pip_r ); -READ8_HANDLER( triplep_pap_r ); - -READ8_HANDLER( hunchbks_mirror_r ); -WRITE8_HANDLER( hunchbks_mirror_w ); - -CUSTOM_INPUT( darkplnt_custom_r ); - - -/*----------- defined in audio/scramble.c -----------*/ - -void scramble_sh_init(running_machine &machine); -WRITE_LINE_DEVICE_HANDLER( scramble_sh_7474_q_callback ); - -WRITE8_HANDLER( scramble_filter_w ); -WRITE8_HANDLER( frogger_filter_w ); - -READ8_DEVICE_HANDLER( scramble_portB_r ); -READ8_DEVICE_HANDLER( frogger_portB_r ); - -READ8_DEVICE_HANDLER( hotshock_soundlatch_r ); - -WRITE8_DEVICE_HANDLER( scramble_sh_irqtrigger_w ); -WRITE8_DEVICE_HANDLER( mrkougar_sh_irqtrigger_w ); -WRITE8_HANDLER( hotshock_sh_irqtrigger_w ); - -MACHINE_CONFIG_EXTERN( ad2083_audio ); - +#endif diff --git a/src/mame/includes/scramble.h b/src/mame/includes/scramble.h new file mode 100644 index 00000000000..0117463621c --- /dev/null +++ b/src/mame/includes/scramble.h @@ -0,0 +1,78 @@ +#include "machine/8255ppi.h" +#include "includes/galaxold.h" + +class scramble_state : public galaxold_state +{ +public: + scramble_state(running_machine &machine, const driver_device_config_base &config) + : galaxold_state(machine, config) { } + + UINT8 *m_soundram; + UINT8 m_cavelon_bank; + UINT8 m_security_2B_counter; + UINT8 m_xb; +}; + + +/*----------- defined in machine/scramble.c -----------*/ + +extern const ppi8255_interface scramble_ppi_0_intf; +extern const ppi8255_interface scramble_ppi_1_intf; +extern const ppi8255_interface stratgyx_ppi_1_intf; +extern const ppi8255_interface scramble_protection_ppi_1_intf; +extern const ppi8255_interface mrkougar_ppi_1_intf; + + +DRIVER_INIT( scramble_ppi ); +DRIVER_INIT( stratgyx ); +DRIVER_INIT( tazmani2 ); +DRIVER_INIT( ckongs ); +DRIVER_INIT( mariner ); +DRIVER_INIT( devilfsh ); +DRIVER_INIT( mars ); +DRIVER_INIT( hotshock ); +DRIVER_INIT( cavelon ); +DRIVER_INIT( darkplnt ); +DRIVER_INIT( mimonkey ); +DRIVER_INIT( mimonsco ); +DRIVER_INIT( mimonscr ); +DRIVER_INIT( rescue ); +DRIVER_INIT( minefld ); +DRIVER_INIT( hustler ); +DRIVER_INIT( hustlerd ); +DRIVER_INIT( billiard ); +DRIVER_INIT( mrkougar ); +DRIVER_INIT( mrkougb ); +DRIVER_INIT( ad2083 ); + +MACHINE_RESET( scramble ); +MACHINE_RESET( explorer ); + +READ8_HANDLER( triplep_pip_r ); +READ8_HANDLER( triplep_pap_r ); + +READ8_HANDLER( hunchbks_mirror_r ); +WRITE8_HANDLER( hunchbks_mirror_w ); + +CUSTOM_INPUT( darkplnt_custom_r ); + + +/*----------- defined in audio/scramble.c -----------*/ + +void scramble_sh_init(running_machine &machine); +WRITE_LINE_DEVICE_HANDLER( scramble_sh_7474_q_callback ); + +WRITE8_HANDLER( scramble_filter_w ); +WRITE8_HANDLER( frogger_filter_w ); + +READ8_DEVICE_HANDLER( scramble_portB_r ); +READ8_DEVICE_HANDLER( frogger_portB_r ); + +READ8_DEVICE_HANDLER( hotshock_soundlatch_r ); + +WRITE8_DEVICE_HANDLER( scramble_sh_irqtrigger_w ); +WRITE8_DEVICE_HANDLER( mrkougar_sh_irqtrigger_w ); +WRITE8_HANDLER( hotshock_sh_irqtrigger_w ); + +MACHINE_CONFIG_EXTERN( ad2083_audio ); + diff --git a/src/mame/machine/galaxold.c b/src/mame/machine/galaxold.c index 1714a8dd34e..2f22e89bf2f 100644 --- a/src/mame/machine/galaxold.c +++ b/src/mame/machine/galaxold.c @@ -11,12 +11,10 @@ #include "machine/7474.h" #include "includes/galaxold.h" -static int irq_line; - -static UINT8 _4in1_bank; static IRQ_CALLBACK(hunchbkg_irq_callback) { + //galaxold_state *state = device->machine().driver_data(); /* for some reason a call to cputag_set_input_line * is significantly delayed .... * @@ -25,7 +23,7 @@ static IRQ_CALLBACK(hunchbkg_irq_callback) * Therefore we reset the line without any detour .... */ device_set_input_line(device->machine().firstcpu, 0, CLEAR_LINE); - //cpu_set_info(device->machine().firstcpu, CPUINFO_INT_INPUT_STATE + irq_line, CLEAR_LINE); + //cpu_set_info(device->machine().firstcpu, CPUINFO_INT_INPUT_STATE + state->m_irq_line, CLEAR_LINE); return 0x03; } @@ -39,8 +37,9 @@ WRITE_LINE_DEVICE_HANDLER( galaxold_7474_9m_2_q_callback ) WRITE_LINE_DEVICE_HANDLER( galaxold_7474_9m_1_callback ) { + galaxold_state *drvstate = device->machine().driver_data(); /* Q goes to the NMI line */ - cputag_set_input_line(device->machine(), "maincpu", irq_line, state ? CLEAR_LINE : ASSERT_LINE); + cputag_set_input_line(device->machine(), "maincpu", drvstate->m_irq_line, state ? CLEAR_LINE : ASSERT_LINE); } WRITE8_HANDLER( galaxold_nmi_enable_w ) @@ -68,9 +67,10 @@ TIMER_DEVICE_CALLBACK( galaxold_interrupt_timer ) static void machine_reset_common(running_machine &machine, int line) { + galaxold_state *state = machine.driver_data(); device_t *ttl7474_9m_1 = machine.device("7474_9m_1"); device_t *ttl7474_9m_2 = machine.device("7474_9m_2"); - irq_line = line; + state->m_irq_line = line; /* initalize main CPU interrupt generator flip-flops */ ttl7474_preset_w(ttl7474_9m_2, 1); @@ -249,17 +249,19 @@ READ8_HANDLER( scramblb_protection_2_r ) WRITE8_HANDLER( _4in1_bank_w ) { - _4in1_bank = data & 0x03; - galaxold_gfxbank_w(space, 0, _4in1_bank); - memory_set_bank(space->machine(), "bank1", _4in1_bank); + galaxold_state *state = space->machine().driver_data(); + state->m__4in1_bank = data & 0x03; + galaxold_gfxbank_w(space, 0, state->m__4in1_bank); + memory_set_bank(space->machine(), "bank1", state->m__4in1_bank); } CUSTOM_INPUT( _4in1_fake_port_r ) { + galaxold_state *state = field->port->machine().driver_data(); static const char *const portnames[] = { "FAKE1", "FAKE2", "FAKE3", "FAKE4" }; int bit_mask = (FPTR)param; - return (input_port_read(field->port->machine(), portnames[_4in1_bank]) & bit_mask) ? 0x01 : 0x00; + return (input_port_read(field->port->machine(), portnames[state->m__4in1_bank]) & bit_mask) ? 0x01 : 0x00; } #ifdef UNUSED_FUNCTION @@ -397,6 +399,7 @@ Pin layout is such that links can replace the PAL if encryption is not used. DRIVER_INIT( 4in1 ) { + galaxold_state *state = machine.driver_data(); address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM); offs_t i, len = machine.region("maincpu")->bytes(); UINT8 *RAM = machine.region("maincpu")->base(); @@ -410,7 +413,7 @@ DRIVER_INIT( 4in1 ) _4in1_bank_w(space, 0, 0); /* set the initial CPU bank */ - state_save_register_global(machine, _4in1_bank); + state_save_register_global(machine, state->m__4in1_bank); } INTERRUPT_GEN( hunchbks_vh_interrupt ) diff --git a/src/mame/machine/scramble.c b/src/mame/machine/scramble.c index f5958266336..d4e9db3f319 100644 --- a/src/mame/machine/scramble.c +++ b/src/mame/machine/scramble.c @@ -10,20 +10,18 @@ #include "emu.h" #include "cpu/z80/z80.h" #include "machine/8255ppi.h" -#include "includes/galaxold.h" +#include "includes/scramble.h" -static UINT8 cavelon_bank; - -static UINT8 security_2B_counter; MACHINE_RESET( scramble ) { + scramble_state *state = machine.driver_data(); MACHINE_RESET_CALL(galaxold); if (machine.device("audiocpu") != NULL) scramble_sh_init(machine); - security_2B_counter = 0; + state->m_security_2B_counter = 0; } MACHINE_RESET( explorer ) @@ -51,11 +49,11 @@ CUSTOM_INPUT( darkplnt_custom_r ) } /* state of the security PAL (6J) */ -static UINT8 xb; static WRITE8_DEVICE_HANDLER( scramble_protection_w ) { - xb = data; + scramble_state *state = device->machine().driver_data(); + state->m_xb = data; } static READ8_DEVICE_HANDLER( scramble_protection_r ) @@ -107,12 +105,13 @@ READ8_HANDLER( triplep_pap_r ) static void cavelon_banksw(running_machine &machine) { + scramble_state *state = machine.driver_data(); /* any read/write access in the 0x8000-0xffff region causes a bank switch. Only the lower 0x2000 is switched but we switch the whole region to keep the CPU core happy at the boundaries */ - cavelon_bank = !cavelon_bank; - memory_set_bank(machine, "bank1", cavelon_bank); + state->m_cavelon_bank = !state->m_cavelon_bank; + memory_set_bank(machine, "bank1", state->m_cavelon_bank); } static READ8_HANDLER( cavelon_banksw_r ) @@ -325,6 +324,7 @@ DRIVER_INIT( hotshock ) DRIVER_INIT( cavelon ) { + scramble_state *state = machine.driver_data(); UINT8 *ROM = machine.region("maincpu")->base(); /* banked ROM */ @@ -338,7 +338,7 @@ DRIVER_INIT( cavelon ) machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x2000, 0x2000); /* ??? */ machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x3800, 0x3801); /* looks suspicously like an AY8910, but not sure */ - state_save_register_global(machine, cavelon_bank); + state_save_register_global(machine, state->m_cavelon_bank); } @@ -395,7 +395,7 @@ DRIVER_INIT( mimonscr ) } -static int bit(int i,int n) +INLINE int bit(int i,int n) { return ((i >> n) & 1); } diff --git a/src/mame/video/fastfred.c b/src/mame/video/fastfred.c index 88812612c97..f69533115c6 100644 --- a/src/mame/video/fastfred.c +++ b/src/mame/video/fastfred.c @@ -9,14 +9,13 @@ #include "emu.h" #include "video/resnet.h" #include "includes/fastfred.h" -#include "includes/galaxold.h" static const rectangle spritevisiblearea = { - 2*8, 32*8-1, - 2*8, 30*8-1 + 2*8, 32*8-1, + 2*8, 30*8-1 }; static const rectangle spritevisibleareaflipx = @@ -371,7 +370,7 @@ VIDEO_START( imago ) /* the game has a galaxian starfield */ galaxold_init_stars(machine, 256); - galaxold_stars_on = 1; + state->m_stars_on = 1; /* web colors */ palette_set_color(machine,256+64+0,MAKE_RGB(0x50,0x00,0x00)); diff --git a/src/mame/video/galaxold.c b/src/mame/video/galaxold.c index f514b7e3350..70c624c300e 100644 --- a/src/mame/video/galaxold.c +++ b/src/mame/video/galaxold.c @@ -7,110 +7,59 @@ #include "emu.h" #include "includes/galaxold.h" -static const rectangle _spritevisiblearea = +static const rectangle spritevisiblearea = { 2*8+1, 32*8-1, 2*8, 30*8-1 }; -static const rectangle _spritevisibleareaflipx = +static const rectangle spritevisibleareaflipx = { 0*8, 30*8-2, 2*8, 30*8-1 }; -static const rectangle* spritevisiblearea; -static const rectangle* spritevisibleareaflipx; - #define STARS_COLOR_BASE (machine.region("proms")->bytes()) #define BULLETS_COLOR_BASE (STARS_COLOR_BASE + 64) #define BACKGROUND_COLOR_BASE (BULLETS_COLOR_BASE + 2) -UINT8 *galaxold_videoram; -UINT8 *galaxold_spriteram; -UINT8 *galaxold_spriteram2; -UINT8 *galaxold_attributesram; -UINT8 *galaxold_bulletsram; -UINT8 *rockclim_videoram; -size_t galaxold_spriteram_size; -size_t galaxold_spriteram2_size; -size_t galaxold_bulletsram_size; - - static TILE_GET_INFO( get_tile_info ); static TILE_GET_INFO( rockclim_get_tile_info ); -static tilemap_t *bg_tilemap; -static tilemap_t *rockclim_tilemap; -static int mooncrst_gfxextend; -static int spriteram2_present; -static UINT8 gfxbank[5]; -static UINT8 flipscreen_x; -static UINT8 flipscreen_y; -static UINT8 color_mask; -static tilemap_t *dambustr_tilemap2; -static UINT8 *dambustr_videoram2; -static void (*modify_charcode)(running_machine &machine, UINT16 *code,UINT8 x); /* function to call to do character banking */ -static void mooncrst_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x); -static void pisces_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x); -static void mimonkey_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x); -static void mariner_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x); -static void dambustr_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x); +static void mooncrst_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); +static void pisces_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); +static void mimonkey_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); +static void mariner_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); +static void dambustr_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x); -static void (*modify_spritecode)(UINT8 *spriteram,int*,int*,int*,int); /* function to call to do sprite banking */ -static void mshuttle_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs); -static void mimonkey_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs); -static void batman2_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs); -static void dkongjrm_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs); -static void ad2083_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs); -static void dambustr_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs); +static void mshuttle_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); +static void mimonkey_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); +static void batman2_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); +static void dkongjrm_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); +static void ad2083_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); +static void dambustr_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs); -static void (*modify_color)(UINT8 *color); /* function to call to do modify how the color codes map to the PROM */ static void drivfrcg_modify_color(UINT8 *color); -static void (*modify_ypos)(UINT8*); /* function to call to do modify how vertical positioning bits are connected */ - static TIMER_CALLBACK( stars_blink_callback ); static TIMER_CALLBACK( stars_scroll_callback ); -static void (*tilemap_set_scroll)( tilemap_t *, int col, int value ); - -/* star circuit */ -#define STAR_COUNT 252 -struct star -{ - int x,y,color; -}; -static struct star stars[STAR_COUNT]; -static int stars_colors_start; - UINT8 galaxold_stars_on; -static INT32 stars_scrollpos; -static UINT8 stars_blink_state; -static emu_timer *stars_blink_timer; -static emu_timer *stars_scroll_timer; -static UINT8 timer_adjusted; void galaxold_init_stars(running_machine &machine, int colors_offset); -static void (*draw_stars)(running_machine &machine, bitmap_t *, const rectangle *); /* function to call to draw the star layer */ static void noop_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); void galaxold_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); static void scrambold_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); static void rescue_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); static void mariner_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); -static void start_stars_blink_timer(double ra, double rb, double c); +static void start_stars_blink_timer(running_machine &machine, double ra, double rb, double c); static void start_stars_scroll_timer(running_machine &machine); /* bullets circuit */ -static UINT8 darkplnt_bullet_color; -static void (*draw_bullets)(running_machine &,bitmap_t *,const rectangle *,int,int,int); /* function to call to draw a bullet */ static void galaxold_draw_bullets(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y); static void scrambold_draw_bullets(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y); static void darkplnt_draw_bullets(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y); static void dambustr_draw_bullets(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y); /* background circuit */ -static UINT8 background_enable; -static UINT8 background_red, background_green, background_blue; -static void (*draw_background)(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); /* function to call to draw the background */ static void galaxold_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); static void scrambold_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); static void ad2083_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); @@ -120,14 +69,6 @@ static void minefld_draw_background(running_machine &machine, bitmap_t *bitmap, static void rescue_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); static void dambustr_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect); -static UINT16 rockclim_v; -static UINT16 rockclim_h; -static int dambustr_bg_split_line; -static int dambustr_bg_color_1; -static int dambustr_bg_color_2; -static int dambustr_bg_priority; -static int dambustr_char_bank; -static bitmap_t *dambustr_tmpbitmap; @@ -496,189 +437,191 @@ PALETTE_INIT( turtles ) static void state_save_register(running_machine &machine) { - state_save_register_global_array(machine, gfxbank); - state_save_register_global(machine, flipscreen_x); - state_save_register_global(machine, flipscreen_y); + galaxold_state *state = machine.driver_data(); + state_save_register_global_array(machine, state->m_gfxbank); + state_save_register_global(machine, state->m_flipscreen_x); + state_save_register_global(machine, state->m_flipscreen_y); - state_save_register_global(machine, galaxold_stars_on); - state_save_register_global(machine, stars_scrollpos); - state_save_register_global(machine, stars_blink_state); + state_save_register_global(machine, state->m_stars_on); + state_save_register_global(machine, state->m_stars_scrollpos); + state_save_register_global(machine, state->m_stars_blink_state); - state_save_register_global(machine, darkplnt_bullet_color); + state_save_register_global(machine, state->m_darkplnt_bullet_color); - state_save_register_global(machine, background_enable); - state_save_register_global(machine, background_red); - state_save_register_global(machine, background_green); - state_save_register_global(machine, background_blue); + state_save_register_global(machine, state->m_background_enable); + state_save_register_global(machine, state->m_background_red); + state_save_register_global(machine, state->m_background_green); + state_save_register_global(machine, state->m_background_blue); } -static void video_start_common(running_machine &machine, tilemap_mapper_func get_memory_offset) +static void video_start_common(running_machine &machine) { - bg_tilemap = tilemap_create(machine, get_tile_info,get_memory_offset,8,8,32,32); + galaxold_state *state = machine.driver_data(); + state->m_modify_charcode = 0; + state->m_modify_spritecode = 0; + state->m_modify_color = 0; + state->m_modify_ypos = 0; - tilemap_set_transparent_pen(bg_tilemap,0); + state->m_mooncrst_gfxextend = 0; + state->m_draw_bullets = 0; - modify_charcode = 0; - modify_spritecode = 0; - modify_color = 0; - modify_ypos = 0; + state->m_draw_background = galaxold_draw_background; + state->m_background_enable = 0; + state->m_background_blue = 0; + state->m_background_red = 0; + state->m_background_green = 0; - mooncrst_gfxextend = 0; + state->m_draw_stars = noop_draw_stars; - draw_bullets = 0; + state->m_flipscreen_x = 0; + state->m_flipscreen_y = 0; - draw_background = galaxold_draw_background; - background_enable = 0; - background_blue = 0; - background_red = 0; - background_green = 0; - - draw_stars = noop_draw_stars; - - flipscreen_x = 0; - flipscreen_y = 0; - - spriteram2_present = 0; - - spritevisiblearea = &_spritevisiblearea; - spritevisibleareaflipx = &_spritevisibleareaflipx; - - color_mask = (machine.gfx[0]->color_granularity == 4) ? 7 : 3; + state->m_spriteram2_present = 0; state_save_register(machine); } VIDEO_START( galaxold_plain ) { - video_start_common(machine,tilemap_scan_rows); + galaxold_state *state = machine.driver_data(); + video_start_common(machine); + state->m_bg_tilemap = tilemap_create(machine, get_tile_info,tilemap_scan_rows,8,8,32,32); + tilemap_set_transparent_pen(state->m_bg_tilemap,0); - tilemap_set_scroll_cols(bg_tilemap, 32); - tilemap_set_scroll = tilemap_set_scrolly; + tilemap_set_scroll_cols(state->m_bg_tilemap, 32); + state->m_tilemap_set_scroll = tilemap_set_scrolly; + + state->m_color_mask = (machine.gfx[0]->color_granularity == 4) ? 7 : 3; } VIDEO_START( galaxold ) { + galaxold_state *state = machine.driver_data(); VIDEO_START_CALL(galaxold_plain); - draw_stars = galaxold_draw_stars; + state->m_draw_stars = galaxold_draw_stars; - draw_bullets = galaxold_draw_bullets; + state->m_draw_bullets = galaxold_draw_bullets; } VIDEO_START( scrambold ) { + galaxold_state *state = machine.driver_data(); VIDEO_START_CALL(galaxold_plain); /* FIXME: This most probably needs to be adjusted * again when RAW video params are added to scramble */ - tilemap_set_scrolldx(bg_tilemap, 0, 0); + tilemap_set_scrolldx(state->m_bg_tilemap, 0, 0); - draw_stars = scrambold_draw_stars; + state->m_draw_stars = scrambold_draw_stars; - draw_bullets = scrambold_draw_bullets; + state->m_draw_bullets = scrambold_draw_bullets; - draw_background = scrambold_draw_background; + state->m_draw_background = scrambold_draw_background; } VIDEO_START( darkplnt ) { + galaxold_state *state = machine.driver_data(); VIDEO_START_CALL(galaxold_plain); - tilemap_set_scrolldx(bg_tilemap, 0, 0); - draw_bullets = darkplnt_draw_bullets; + tilemap_set_scrolldx(state->m_bg_tilemap, 0, 0); + state->m_draw_bullets = darkplnt_draw_bullets; } VIDEO_START( rescue ) { + galaxold_state *state = machine.driver_data(); VIDEO_START_CALL(scrambold); - draw_stars = rescue_draw_stars; + state->m_draw_stars = rescue_draw_stars; - draw_background = rescue_draw_background; + state->m_draw_background = rescue_draw_background; } VIDEO_START( minefld ) { + galaxold_state *state = machine.driver_data(); VIDEO_START_CALL(scrambold); - draw_stars = rescue_draw_stars; + state->m_draw_stars = rescue_draw_stars; - draw_background = minefld_draw_background; + state->m_draw_background = minefld_draw_background; } VIDEO_START( stratgyx ) { + galaxold_state *state = machine.driver_data(); VIDEO_START_CALL(galaxold_plain); - draw_background = stratgyx_draw_background; + state->m_draw_background = stratgyx_draw_background; } VIDEO_START( ckongs ) { + galaxold_state *state = machine.driver_data(); VIDEO_START_CALL(scrambold); - modify_spritecode = mshuttle_modify_spritecode; + state->m_modify_spritecode = mshuttle_modify_spritecode; } VIDEO_START( mariner ) { + galaxold_state *state = machine.driver_data(); VIDEO_START_CALL(galaxold_plain); - draw_stars = mariner_draw_stars; + state->m_draw_stars = mariner_draw_stars; - draw_bullets = scrambold_draw_bullets; + state->m_draw_bullets = scrambold_draw_bullets; - draw_background = mariner_draw_background; + state->m_draw_background = mariner_draw_background; - modify_charcode = mariner_modify_charcode; + state->m_modify_charcode = mariner_modify_charcode; } VIDEO_START( mimonkey ) { + galaxold_state *state = machine.driver_data(); VIDEO_START_CALL(scrambold); - modify_charcode = mimonkey_modify_charcode; - modify_spritecode = mimonkey_modify_spritecode; + state->m_modify_charcode = mimonkey_modify_charcode; + state->m_modify_spritecode = mimonkey_modify_spritecode; } VIDEO_START( dkongjrm ) { + galaxold_state *state = machine.driver_data(); VIDEO_START_CALL(galaxold_plain); - modify_charcode = pisces_modify_charcode; - modify_spritecode = dkongjrm_modify_spritecode; + state->m_modify_charcode = pisces_modify_charcode; + state->m_modify_spritecode = dkongjrm_modify_spritecode; - spriteram2_present= 1; -} - -VIDEO_START( newsin7 ) -{ - VIDEO_START_CALL(scrambold); - - spritevisiblearea = &_spritevisibleareaflipx; - spritevisibleareaflipx = &_spritevisiblearea; + state->m_spriteram2_present= 1; } VIDEO_START( scorpion ) { + galaxold_state *state = machine.driver_data(); VIDEO_START_CALL(scrambold); - modify_spritecode = batman2_modify_spritecode; + state->m_modify_spritecode = batman2_modify_spritecode; } -static void pisces_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) +static void pisces_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { - *code |= (gfxbank[0] << 6); + galaxold_state *state = machine.driver_data(); + *code |= (state->m_gfxbank[0] << 6); } VIDEO_START( pisces ) { + galaxold_state *state = machine.driver_data(); VIDEO_START_CALL(galaxold); - modify_charcode = pisces_modify_charcode; - modify_spritecode = pisces_modify_spritecode; + state->m_modify_charcode = pisces_modify_charcode; + state->m_modify_spritecode = pisces_modify_spritecode; } #ifdef UNUSED_FUNCTION @@ -699,172 +642,142 @@ static void theend_draw_bullets(running_machine &machine, bitmap_t *bitmap, cons VIDEO_START( theend ) { + galaxold_state *state = machine.driver_data(); VIDEO_START_CALL(galaxold); - draw_bullets = theend_draw_bullets; + state->m_draw_bullets = theend_draw_bullets; } #endif -static void mooncrst_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) +static void mooncrst_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { - if (gfxbank[2] && ((*code & 0x30) == 0x20)) + galaxold_state *state = machine.driver_data(); + if (state->m_gfxbank[2] && ((*code & 0x30) == 0x20)) { - *code = (*code & 0x0f) | (gfxbank[0] << 4) | (gfxbank[1] << 5) | 0x40; + *code = (*code & 0x0f) | (state->m_gfxbank[0] << 4) | (state->m_gfxbank[1] << 5) | 0x40; } } VIDEO_START( mooncrst ) { + galaxold_state *state = machine.driver_data(); VIDEO_START_CALL(galaxold); - modify_charcode = mooncrst_modify_charcode; - modify_spritecode = mooncrst_modify_spritecode; + state->m_modify_charcode = mooncrst_modify_charcode; + state->m_modify_spritecode = mooncrst_modify_spritecode; } -static void batman2_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x) +static void batman2_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) { + galaxold_state *state = machine.driver_data(); if (*code & 0x80) { - *code |= (gfxbank[0] << 8); + *code |= (state->m_gfxbank[0] << 8); } } VIDEO_START( batman2 ) { + galaxold_state *state = machine.driver_data(); VIDEO_START_CALL(galaxold); - modify_charcode = batman2_modify_charcode; - modify_spritecode = batman2_modify_spritecode; - + state->m_modify_charcode = batman2_modify_charcode; + state->m_modify_spritecode = batman2_modify_spritecode; } static void rockclim_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) { - tilemap_draw(bitmap,cliprect,rockclim_tilemap, 0,0); + galaxold_state *state = machine.driver_data(); + tilemap_draw(bitmap,cliprect,state->m_rockclim_tilemap, 0,0); } -static void rockclim_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) +static void rockclim_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { - if (gfxbank[2]) *code|=0x40; + galaxold_state *state = machine.driver_data(); + if (state->m_gfxbank[2]) *code|=0x40; } VIDEO_START( rockclim ) { + galaxold_state *state = machine.driver_data(); VIDEO_START_CALL(galaxold); - rockclim_tilemap = tilemap_create(machine, rockclim_get_tile_info,tilemap_scan_rows,8,8,64,32); - draw_background = rockclim_draw_background; - modify_charcode = mooncrst_modify_charcode; - modify_spritecode = rockclim_modify_spritecode; - rockclim_v = rockclim_h = 0; - state_save_register_global(machine, rockclim_v); - state_save_register_global(machine, rockclim_h); + state->m_rockclim_tilemap = tilemap_create(machine, rockclim_get_tile_info,tilemap_scan_rows,8,8,64,32); + + state->m_draw_background = rockclim_draw_background; + state->m_modify_charcode = mooncrst_modify_charcode; + state->m_modify_spritecode = rockclim_modify_spritecode; + + state->m_rockclim_v = state->m_rockclim_h = 0; + state_save_register_global(machine, state->m_rockclim_v); + state_save_register_global(machine, state->m_rockclim_h); } static TILE_GET_INFO( drivfrcg_get_tile_info ) { - int code = galaxold_videoram[tile_index]; + galaxold_state *state = machine.driver_data(); + int code = state->m_videoram[tile_index]; UINT8 x = tile_index & 0x1f; - UINT8 color = galaxold_attributesram[(x << 1) | 1] & 7; - UINT8 bank = galaxold_attributesram[(x << 1) | 1] & 0x30; + UINT8 color = state->m_attributesram[(x << 1) | 1] & 7; + UINT8 bank = state->m_attributesram[(x << 1) | 1] & 0x30; code |= (bank << 4); - color |= ((galaxold_attributesram[(x << 1) | 1] & 0x40) >> 3); + color |= ((state->m_attributesram[(x << 1) | 1] & 0x40) >> 3); SET_TILE_INFO(0, code, color, 0); } VIDEO_START( drivfrcg ) { - bg_tilemap = tilemap_create(machine, drivfrcg_get_tile_info,tilemap_scan_rows,8,8,32,32); + galaxold_state *state = machine.driver_data(); + video_start_common(machine); + state->m_bg_tilemap = tilemap_create(machine, drivfrcg_get_tile_info,tilemap_scan_rows,8,8,32,32); - tilemap_set_transparent_pen(bg_tilemap,0); - tilemap_set_scroll_cols(bg_tilemap, 32); - tilemap_set_scroll = tilemap_set_scrolly; + tilemap_set_transparent_pen(state->m_bg_tilemap,0); + tilemap_set_scroll_cols(state->m_bg_tilemap, 32); + state->m_tilemap_set_scroll = tilemap_set_scrolly; - modify_charcode = 0; - modify_spritecode = mshuttle_modify_spritecode; - modify_color = drivfrcg_modify_color; - modify_ypos = 0; + state->m_modify_spritecode = mshuttle_modify_spritecode; + state->m_modify_color = drivfrcg_modify_color; - mooncrst_gfxextend = 0; - - draw_bullets = 0; - - draw_background = galaxold_draw_background; - background_enable = 0; - background_blue = 0; - background_red = 0; - background_green = 0; - - draw_stars = noop_draw_stars; - - flipscreen_x = 0; - flipscreen_y = 0; - - spriteram2_present = 0; - - spritevisiblearea = &_spritevisiblearea; - spritevisibleareaflipx = &_spritevisibleareaflipx; - - color_mask = 0xff; - - state_save_register(machine); + state->m_color_mask = 0xff; } VIDEO_START( ad2083 ) { - bg_tilemap = tilemap_create(machine, drivfrcg_get_tile_info,tilemap_scan_rows,8,8,32,32); + galaxold_state *state = machine.driver_data(); + video_start_common(machine); + state->m_bg_tilemap = tilemap_create(machine, drivfrcg_get_tile_info,tilemap_scan_rows,8,8,32,32); - tilemap_set_transparent_pen(bg_tilemap,0); - tilemap_set_scroll_cols(bg_tilemap, 32); - tilemap_set_scroll = tilemap_set_scrolly; + tilemap_set_transparent_pen(state->m_bg_tilemap,0); + tilemap_set_scroll_cols(state->m_bg_tilemap, 32); + state->m_tilemap_set_scroll = tilemap_set_scrolly; - modify_charcode = 0; - modify_spritecode = ad2083_modify_spritecode; - modify_color = 0; - modify_ypos = 0; + state->m_modify_spritecode = ad2083_modify_spritecode; - mooncrst_gfxextend = 0; + state->m_draw_bullets = scrambold_draw_bullets; - draw_bullets = scrambold_draw_bullets; + state->m_draw_background = ad2083_draw_background; - draw_background = ad2083_draw_background; - background_enable = 0; - background_blue = 0; - background_red = 0; - background_green = 0; - - draw_stars = noop_draw_stars; - - flipscreen_x = 0; - flipscreen_y = 0; - - spriteram2_present = 0; - - spritevisiblearea = &_spritevisiblearea; - spritevisibleareaflipx = &_spritevisibleareaflipx; - - color_mask = 7; - - state_save_register(machine); + state->m_color_mask = 7; } -UINT8 *racknrol_tiles_bank; WRITE8_HANDLER( racknrol_tiles_bank_w ) { - racknrol_tiles_bank[offset] = data; - tilemap_mark_all_tiles_dirty(bg_tilemap); + galaxold_state *state = space->machine().driver_data(); + state->m_racknrol_tiles_bank[offset] = data; + tilemap_mark_all_tiles_dirty(state->m_bg_tilemap); } static TILE_GET_INFO( racknrol_get_tile_info ) { - int code = galaxold_videoram[tile_index]; + galaxold_state *state = machine.driver_data(); + int code = state->m_videoram[tile_index]; UINT8 x = tile_index & 0x1f; - UINT8 color = galaxold_attributesram[(x << 1) | 1] & 7; - UINT8 bank = racknrol_tiles_bank[x] & 7; + UINT8 color = state->m_attributesram[(x << 1) | 1] & 7; + UINT8 bank = state->m_racknrol_tiles_bank[x] & 7; code |= (bank << 8); @@ -873,64 +786,41 @@ static TILE_GET_INFO( racknrol_get_tile_info ) VIDEO_START( racknrol ) { - bg_tilemap = tilemap_create(machine, racknrol_get_tile_info,tilemap_scan_rows,8,8,32,32); + galaxold_state *state = machine.driver_data(); + video_start_common(machine); + state->m_bg_tilemap = tilemap_create(machine, racknrol_get_tile_info,tilemap_scan_rows,8,8,32,32); - tilemap_set_transparent_pen(bg_tilemap,0); - tilemap_set_scroll_cols(bg_tilemap, 32); - tilemap_set_scroll = tilemap_set_scrolly; + tilemap_set_transparent_pen(state->m_bg_tilemap,0); + tilemap_set_scroll_cols(state->m_bg_tilemap, 32); + state->m_tilemap_set_scroll = tilemap_set_scrolly; - modify_charcode = 0; - modify_spritecode = 0; - modify_color = 0; - modify_ypos = 0; - - mooncrst_gfxextend = 0; - - draw_bullets = 0; - - draw_background = galaxold_draw_background; - background_enable = 0; - background_blue = 0; - background_red = 0; - background_green = 0; - - draw_stars = noop_draw_stars; - - flipscreen_x = 0; - flipscreen_y = 0; - - spriteram2_present = 0; - - spritevisiblearea = &_spritevisiblearea; - spritevisibleareaflipx = &_spritevisibleareaflipx; - - color_mask = 0xff; - - state_save_register(machine); + state->m_color_mask = 0xff; } VIDEO_START( bongo ) { + galaxold_state *state = machine.driver_data(); VIDEO_START_CALL(galaxold_plain); - modify_spritecode = batman2_modify_spritecode; + state->m_modify_spritecode = batman2_modify_spritecode; } static TILE_GET_INFO( dambustr_get_tile_info2 ) { + galaxold_state *state = machine.driver_data(); UINT8 x = tile_index & 0x1f; - UINT16 code = dambustr_videoram2[tile_index]; - UINT8 color = galaxold_attributesram[(x << 1) | 1] & color_mask; + UINT16 code = state->m_dambustr_videoram2[tile_index]; + UINT8 color = state->m_attributesram[(x << 1) | 1] & state->m_color_mask; - if (modify_charcode) + if (state->m_modify_charcode) { - modify_charcode(machine, &code, x); + (*state->m_modify_charcode)(machine, &code, x); } - if (modify_color) + if (state->m_modify_color) { - modify_color(&color); + (*state->m_modify_color)(&color); } SET_TILE_INFO(0, code, color, 0); @@ -938,47 +828,51 @@ static TILE_GET_INFO( dambustr_get_tile_info2 ) VIDEO_START( dambustr ) { + galaxold_state *state = machine.driver_data(); VIDEO_START_CALL(galaxold); - dambustr_bg_split_line = 0; - dambustr_bg_color_1 = 0; - dambustr_bg_color_2 = 0; - dambustr_bg_priority = 0; - dambustr_char_bank = 0; + state->m_dambustr_bg_split_line = 0; + state->m_dambustr_bg_color_1 = 0; + state->m_dambustr_bg_color_2 = 0; + state->m_dambustr_bg_priority = 0; + state->m_dambustr_char_bank = 0; - draw_background = dambustr_draw_background; + state->m_draw_background = dambustr_draw_background; - modify_charcode = dambustr_modify_charcode; - modify_spritecode = dambustr_modify_spritecode; + state->m_modify_charcode = dambustr_modify_charcode; + state->m_modify_spritecode = dambustr_modify_spritecode; - draw_bullets = dambustr_draw_bullets; + state->m_draw_bullets = dambustr_draw_bullets; /* allocate the temporary bitmap for the background priority */ - dambustr_tmpbitmap = machine.primary_screen->alloc_compatible_bitmap(); + state->m_dambustr_tmpbitmap = machine.primary_screen->alloc_compatible_bitmap(); /* make a copy of the tilemap to emulate background priority */ - dambustr_videoram2 = auto_alloc_array(machine, UINT8, 0x0400); - dambustr_tilemap2 = tilemap_create(machine, dambustr_get_tile_info2,tilemap_scan_rows,8,8,32,32); + state->m_dambustr_videoram2 = auto_alloc_array(machine, UINT8, 0x0400); + state->m_dambustr_tilemap2 = tilemap_create(machine, dambustr_get_tile_info2,tilemap_scan_rows,8,8,32,32); - tilemap_set_transparent_pen(dambustr_tilemap2,0); + tilemap_set_transparent_pen(state->m_dambustr_tilemap2,0); } WRITE8_HANDLER( galaxold_videoram_w ) { - galaxold_videoram[offset] = data; - tilemap_mark_tile_dirty(bg_tilemap, offset); + galaxold_state *state = space->machine().driver_data(); + state->m_videoram[offset] = data; + tilemap_mark_tile_dirty(state->m_bg_tilemap, offset); } READ8_HANDLER( galaxold_videoram_r ) { - return galaxold_videoram[offset]; + galaxold_state *state = space->machine().driver_data(); + return state->m_videoram[offset]; } WRITE8_HANDLER( galaxold_attributesram_w ) { - if (galaxold_attributesram[offset] != data) + galaxold_state *state = space->machine().driver_data(); + if (state->m_attributesram[offset] != data) { if (offset & 0x01) { @@ -986,40 +880,42 @@ WRITE8_HANDLER( galaxold_attributesram_w ) int i; for (i = offset >> 1; i < 0x0400; i += 32) - tilemap_mark_tile_dirty(bg_tilemap, i); + tilemap_mark_tile_dirty(state->m_bg_tilemap, i); } else { - if (modify_ypos) + if (state->m_modify_ypos) { - modify_ypos(&data); + (*state->m_modify_ypos)(&data); } - tilemap_set_scroll(bg_tilemap, offset >> 1, data); + (*state->m_tilemap_set_scroll)(state->m_bg_tilemap, offset >> 1, data); } - galaxold_attributesram[offset] = data; + state->m_attributesram[offset] = data; } } WRITE8_HANDLER( galaxold_flip_screen_x_w ) { - if (flipscreen_x != (data & 0x01)) + galaxold_state *state = space->machine().driver_data(); + if (state->m_flipscreen_x != (data & 0x01)) { - flipscreen_x = data & 0x01; + state->m_flipscreen_x = data & 0x01; - tilemap_set_flip(bg_tilemap, (flipscreen_x ? TILEMAP_FLIPX : 0) | (flipscreen_y ? TILEMAP_FLIPY : 0)); + tilemap_set_flip(state->m_bg_tilemap, (state->m_flipscreen_x ? TILEMAP_FLIPX : 0) | (state->m_flipscreen_y ? TILEMAP_FLIPY : 0)); } } WRITE8_HANDLER( galaxold_flip_screen_y_w ) { - if (flipscreen_y != (data & 0x01)) + galaxold_state *state = space->machine().driver_data(); + if (state->m_flipscreen_y != (data & 0x01)) { - flipscreen_y = data & 0x01; + state->m_flipscreen_y = data & 0x01; - tilemap_set_flip(bg_tilemap, (flipscreen_x ? TILEMAP_FLIPX : 0) | (flipscreen_y ? TILEMAP_FLIPY : 0)); + tilemap_set_flip(state->m_bg_tilemap, (state->m_flipscreen_x ? TILEMAP_FLIPX : 0) | (state->m_flipscreen_y ? TILEMAP_FLIPY : 0)); } } @@ -1046,67 +942,76 @@ WRITE8_HANDLER( hotshock_flip_screen_w ) WRITE8_HANDLER( scrambold_background_enable_w ) { - background_enable = data & 0x01; + galaxold_state *state = space->machine().driver_data(); + state->m_background_enable = data & 0x01; } WRITE8_HANDLER( scrambold_background_red_w ) { - background_red = data & 0x01; + galaxold_state *state = space->machine().driver_data(); + state->m_background_red = data & 0x01; } WRITE8_HANDLER( scrambold_background_green_w ) { - background_green = data & 0x01; + galaxold_state *state = space->machine().driver_data(); + state->m_background_green = data & 0x01; } WRITE8_HANDLER( scrambold_background_blue_w ) { - background_blue = data & 0x01; + galaxold_state *state = space->machine().driver_data(); + state->m_background_blue = data & 0x01; } WRITE8_HANDLER( galaxold_stars_enable_w ) { - galaxold_stars_on = data & 0x01; + galaxold_state *state = space->machine().driver_data(); + state->m_stars_on = data & 0x01; - if (!galaxold_stars_on) + if (!state->m_stars_on) { - stars_scrollpos = 0; + state->m_stars_scrollpos = 0; } } WRITE8_HANDLER( darkplnt_bullet_color_w ) { - darkplnt_bullet_color = data & 0x01; + galaxold_state *state = space->machine().driver_data(); + state->m_darkplnt_bullet_color = data & 0x01; } WRITE8_HANDLER( galaxold_gfxbank_w ) { - if (gfxbank[offset] != data) + galaxold_state *state = space->machine().driver_data(); + if (state->m_gfxbank[offset] != data) { - gfxbank[offset] = data; + state->m_gfxbank[offset] = data; - tilemap_mark_all_tiles_dirty(bg_tilemap); + tilemap_mark_all_tiles_dirty(state->m_bg_tilemap); } } WRITE8_HANDLER( rockclim_videoram_w ) { - rockclim_videoram[offset] = data; - tilemap_mark_tile_dirty(rockclim_tilemap, offset); + galaxold_state *state = space->machine().driver_data(); + state->m_rockclim_videoram[offset] = data; + tilemap_mark_tile_dirty(state->m_rockclim_tilemap, offset); } WRITE8_HANDLER( rockclim_scroll_w ) { + galaxold_state *state = space->machine().driver_data(); switch(offset&3) { - case 0: rockclim_h=(rockclim_h&0xff00)|data;tilemap_set_scrollx(rockclim_tilemap , 0, rockclim_h );break; - case 1: rockclim_h=(rockclim_h&0xff)|(data<<8);tilemap_set_scrollx(rockclim_tilemap , 0, rockclim_h );break; - case 2: rockclim_v=(rockclim_v&0xff00)|data;tilemap_set_scrolly(rockclim_tilemap , 0, rockclim_v );break; - case 3: rockclim_v=(rockclim_v&0xff)|(data<<8);tilemap_set_scrolly(rockclim_tilemap , 0, rockclim_v );break; + case 0: state->m_rockclim_h=(state->m_rockclim_h&0xff00)|data;tilemap_set_scrollx(state->m_rockclim_tilemap , 0, state->m_rockclim_h );break; + case 1: state->m_rockclim_h=(state->m_rockclim_h&0xff)|(data<<8);tilemap_set_scrollx(state->m_rockclim_tilemap , 0, state->m_rockclim_h );break; + case 2: state->m_rockclim_v=(state->m_rockclim_v&0xff00)|data;tilemap_set_scrolly(state->m_rockclim_tilemap , 0, state->m_rockclim_v );break; + case 3: state->m_rockclim_v=(state->m_rockclim_v&0xff)|(data<<8);tilemap_set_scrolly(state->m_rockclim_tilemap , 0, state->m_rockclim_v );break; } } @@ -1114,48 +1019,54 @@ WRITE8_HANDLER( rockclim_scroll_w ) READ8_HANDLER( rockclim_videoram_r ) { - return rockclim_videoram[offset]; + galaxold_state *state = space->machine().driver_data(); + return state->m_rockclim_videoram[offset]; } WRITE8_HANDLER( dambustr_bg_split_line_w ) { - dambustr_bg_split_line = data; + galaxold_state *state = space->machine().driver_data(); + state->m_dambustr_bg_split_line = data; } WRITE8_HANDLER( dambustr_bg_color_w ) { - dambustr_bg_color_1 = (BIT(data,2)<<2) | (BIT(data,1)<<1) | BIT(data,0); - dambustr_bg_color_2 = (BIT(data,6)<<2) | (BIT(data,5)<<1) | BIT(data,4); - dambustr_bg_priority = BIT(data,3); - dambustr_char_bank = BIT(data,7); - tilemap_mark_all_tiles_dirty(bg_tilemap); + galaxold_state *state = space->machine().driver_data(); + state->m_dambustr_bg_color_1 = (BIT(data,2)<<2) | (BIT(data,1)<<1) | BIT(data,0); + state->m_dambustr_bg_color_2 = (BIT(data,6)<<2) | (BIT(data,5)<<1) | BIT(data,4); + state->m_dambustr_bg_priority = BIT(data,3); + state->m_dambustr_char_bank = BIT(data,7); + tilemap_mark_all_tiles_dirty(state->m_bg_tilemap); } /* character banking functions */ -static void mooncrst_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x) +static void mooncrst_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) { - if (gfxbank[2] && ((*code & 0xc0) == 0x80)) + galaxold_state *state = machine.driver_data(); + if (state->m_gfxbank[2] && ((*code & 0xc0) == 0x80)) { - *code = (*code & 0x3f) | (gfxbank[0] << 6) | (gfxbank[1] << 7) | 0x0100; + *code = (*code & 0x3f) | (state->m_gfxbank[0] << 6) | (state->m_gfxbank[1] << 7) | 0x0100; } } -static void pisces_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x) +static void pisces_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) { - *code |= (gfxbank[0] << 8); + galaxold_state *state = machine.driver_data(); + *code |= (state->m_gfxbank[0] << 8); } -static void mimonkey_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x) +static void mimonkey_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) { - *code |= (gfxbank[0] << 8) | (gfxbank[2] << 9); + galaxold_state *state = machine.driver_data(); + *code |= (state->m_gfxbank[0] << 8) | (state->m_gfxbank[2] << 9); } -static void mariner_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x) +static void mariner_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) { UINT8 *prom; @@ -1167,9 +1078,10 @@ static void mariner_modify_charcode(running_machine &machine, UINT16 *code,UINT8 *code |= ((prom[x] & 0x01) << 8); } -static void dambustr_modify_charcode(running_machine &machine, UINT16 *code,UINT8 x) +static void dambustr_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x) { - if (dambustr_char_bank == 0) { // text mode + galaxold_state *state = machine.driver_data(); + if (state->m_dambustr_char_bank == 0) { // text mode *code |= 0x0300; } else { // graphics mode @@ -1184,38 +1096,39 @@ static void dambustr_modify_charcode(running_machine &machine, UINT16 *code,UINT /* sprite banking functions */ -static void mshuttle_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) +static void mshuttle_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { *code |= ((spriteram[offs + 2] & 0x30) << 2); } -static void mimonkey_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) +static void mimonkey_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { - *code |= (gfxbank[0] << 6) | (gfxbank[2] << 7); + galaxold_state *state = machine.driver_data(); + *code |= (state->m_gfxbank[0] << 6) | (state->m_gfxbank[2] << 7); } -static void batman2_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) +static void batman2_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { /* only the upper 64 sprites are used */ *code |= 0x40; } -static void dkongjrm_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) +static void dkongjrm_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { /* No x flip */ *code = (spriteram[offs + 1] & 0x7f) | 0x80; *flipx = 0; } -static void ad2083_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) +static void ad2083_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { /* No x flip */ *code = (spriteram[offs + 1] & 0x7f) | ((spriteram[offs + 2] & 0x30) << 2); *flipx = 0; } -static void dambustr_modify_spritecode(UINT8 *spriteram,int *code,int *flipx,int *flipy,int offs) +static void dambustr_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs) { *code += 0x40; } @@ -1257,7 +1170,8 @@ static void galaxold_draw_bullets(running_machine &machine, bitmap_t *bitmap, co static void scrambold_draw_bullets(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y) { - if (flipscreen_x) x++; + galaxold_state *state = machine.driver_data(); + if (state->m_flipscreen_x) x++; x = x - 6; @@ -1268,12 +1182,13 @@ static void scrambold_draw_bullets(running_machine &machine, bitmap_t *bitmap, c static void darkplnt_draw_bullets(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y) { - if (flipscreen_x) x++; + galaxold_state *state = machine.driver_data(); + if (state->m_flipscreen_x) x++; x = x - 6; if ((x >= cliprect->min_x) && (x <= cliprect->max_x) && (y >= cliprect->min_y) && (y <= cliprect->max_y)) - *BITMAP_ADDR16(bitmap, y, x) = 32 + darkplnt_bullet_color; + *BITMAP_ADDR16(bitmap, y, x) = 32 + state->m_darkplnt_bullet_color; } static void dambustr_draw_bullets(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int x, int y) @@ -1314,7 +1229,8 @@ static void galaxold_draw_background(running_machine &machine, bitmap_t *bitmap, static void scrambold_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) { - if (background_enable) + galaxold_state *state = machine.driver_data(); + if (state->m_background_enable) bitmap_fill(bitmap,cliprect,BACKGROUND_COLOR_BASE); else bitmap_fill(bitmap,cliprect,0); @@ -1322,13 +1238,15 @@ static void scrambold_draw_background(running_machine &machine, bitmap_t *bitmap static void ad2083_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) { - int color = (background_blue << 2) | (background_green << 1) | background_red; + galaxold_state *state = machine.driver_data(); + int color = (state->m_background_blue << 2) | (state->m_background_green << 1) | state->m_background_red; bitmap_fill(bitmap,cliprect,BACKGROUND_COLOR_BASE + color); } static void stratgyx_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) { + galaxold_state *state = machine.driver_data(); UINT8 x; UINT8 *prom; int base = BACKGROUND_COLOR_BASE; @@ -1350,11 +1268,11 @@ static void stratgyx_draw_background(running_machine &machine, bitmap_t *bitmap, color = 0; - if ((~prom[x] & 0x02) && background_red) color |= 0x01; - if ((~prom[x] & 0x02) && background_green) color |= 0x02; - if ((~prom[x] & 0x01) && background_blue) color |= 0x04; + if ((~prom[x] & 0x02) && state->m_background_red) color |= 0x01; + if ((~prom[x] & 0x02) && state->m_background_green) color |= 0x02; + if ((~prom[x] & 0x01) && state->m_background_blue) color |= 0x04; - if (flipscreen_x) + if (state->m_flipscreen_x) sx = 8 * (31 - x); else sx = 8 * x; @@ -1365,7 +1283,8 @@ static void stratgyx_draw_background(running_machine &machine, bitmap_t *bitmap, static void minefld_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) { - if (background_enable) + galaxold_state *state = machine.driver_data(); + if (state->m_background_enable) { int base = BACKGROUND_COLOR_BASE; int x; @@ -1385,7 +1304,8 @@ static void minefld_draw_background(running_machine &machine, bitmap_t *bitmap, static void rescue_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) { - if (background_enable) + galaxold_state *state = machine.driver_data(); + if (state->m_background_enable) { int base = BACKGROUND_COLOR_BASE; int x; @@ -1404,6 +1324,7 @@ static void rescue_draw_background(running_machine &machine, bitmap_t *bitmap, c static void mariner_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) { + galaxold_state *state = machine.driver_data(); int base = BACKGROUND_COLOR_BASE; UINT8 x; UINT8 *prom; @@ -1415,7 +1336,7 @@ static void mariner_draw_background(running_machine &machine, bitmap_t *bitmap, prom = machine.region("user1")->base(); - if (flipscreen_x) + if (state->m_flipscreen_x) { for (x = 0; x < 32; x++) { @@ -1447,42 +1368,44 @@ static void mariner_draw_background(running_machine &machine, bitmap_t *bitmap, static void dambustr_draw_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) { + galaxold_state *state = machine.driver_data(); int base = BACKGROUND_COLOR_BASE; - int col1 = base + dambustr_bg_color_1; - int col2 = base + dambustr_bg_color_2; + int col1 = base + state->m_dambustr_bg_color_1; + int col2 = base + state->m_dambustr_bg_color_2; if (flip_screen_x_get(machine)) { - plot_box(bitmap, 0, 0, 256-dambustr_bg_split_line, 256, col2); - plot_box(bitmap, 256-dambustr_bg_split_line, 0, dambustr_bg_split_line, 256, col1); + plot_box(bitmap, 0, 0, 256-state->m_dambustr_bg_split_line, 256, col2); + plot_box(bitmap, 256-state->m_dambustr_bg_split_line, 0, state->m_dambustr_bg_split_line, 256, col1); } else { - plot_box(bitmap, 0, 0, 256-dambustr_bg_split_line, 256, col1); - plot_box(bitmap, 256-dambustr_bg_split_line, 0, dambustr_bg_split_line, 256, col2); + plot_box(bitmap, 0, 0, 256-state->m_dambustr_bg_split_line, 256, col1); + plot_box(bitmap, 256-state->m_dambustr_bg_split_line, 0, state->m_dambustr_bg_split_line, 256, col2); } } static void dambustr_draw_upper_background(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) { - static rectangle clip = { 0, 0, 0, 0 }; + galaxold_state *state = machine.driver_data(); + rectangle clip; if (flip_screen_x_get(machine)) { - clip.min_x = 254 - dambustr_bg_split_line; - clip.max_x = dambustr_bg_split_line; + clip.min_x = 254 - state->m_dambustr_bg_split_line; + clip.max_x = state->m_dambustr_bg_split_line; clip.min_y = 0; clip.max_y = 255; - copybitmap(bitmap, dambustr_tmpbitmap, 0, 0, 0, 0, &clip); + copybitmap(bitmap, state->m_dambustr_tmpbitmap, 0, 0, 0, 0, &clip); } else { clip.min_x = 0; - clip.max_x = 254 - dambustr_bg_split_line; + clip.max_x = 254 - state->m_dambustr_bg_split_line; clip.min_y = 0; clip.max_y = 255; - copybitmap(bitmap, dambustr_tmpbitmap, 0, 0, 0, 0, &clip); + copybitmap(bitmap, state->m_dambustr_tmpbitmap, 0, 0, 0, 0, &clip); } } @@ -1492,18 +1415,20 @@ static void dambustr_draw_upper_background(running_machine &machine, bitmap_t *b void galaxold_init_stars(running_machine &machine, int colors_offset) { + galaxold_state *state = machine.driver_data(); + struct star *stars = state->m_stars; int i; int total_stars; UINT32 generator; int x,y; - galaxold_stars_on = 0; - stars_blink_state = 0; - stars_blink_timer = machine.scheduler().timer_alloc(FUNC(stars_blink_callback)); - stars_scroll_timer = machine.scheduler().timer_alloc(FUNC(stars_scroll_callback)); - timer_adjusted = 0; - stars_colors_start = colors_offset; + state->m_stars_on = 0; + state->m_stars_blink_state = 0; + state->m_stars_blink_timer = machine.scheduler().timer_alloc(FUNC(stars_blink_callback)); + state->m_stars_scroll_timer = machine.scheduler().timer_alloc(FUNC(stars_scroll_callback)); + state->m_timer_adjusted = 0; + state->m_stars_colors_start = colors_offset; for (i = 0;i < 64;i++) { @@ -1561,16 +1486,16 @@ void galaxold_init_stars(running_machine &machine, int colors_offset) } } -static void plot_star(bitmap_t *bitmap, int x, int y, int color, const rectangle *cliprect) +static void plot_star(galaxold_state *state, bitmap_t *bitmap, int x, int y, int color, const rectangle *cliprect) { - if (flipscreen_x) + if (state->m_flipscreen_x) x = 255 - x; - if (flipscreen_y) + if (state->m_flipscreen_y) y = 255 - y; if ((x >= cliprect->min_x) && (x <= cliprect->max_x) && (y >= cliprect->min_y) && (y <= cliprect->max_y)) - *BITMAP_ADDR16(bitmap, y, x) = stars_colors_start + color; + *BITMAP_ADDR16(bitmap, y, x) = state->m_stars_colors_start + color; } static void noop_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) @@ -1579,13 +1504,15 @@ static void noop_draw_stars(running_machine &machine, bitmap_t *bitmap, const re void galaxold_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) { + galaxold_state *state = machine.driver_data(); + struct star *stars = state->m_stars; int offs; - if (!timer_adjusted) + if (!state->m_timer_adjusted) { start_stars_scroll_timer(machine); - timer_adjusted = 1; + state->m_timer_adjusted = 1; } @@ -1594,25 +1521,27 @@ void galaxold_draw_stars(running_machine &machine, bitmap_t *bitmap, const recta int x,y; - x = ((stars[offs].x + stars_scrollpos) & 0x01ff) >> 1; - y = ( stars[offs].y + ((stars_scrollpos + stars[offs].x) >> 9)) & 0xff; + x = ((stars[offs].x + state->m_stars_scrollpos) & 0x01ff) >> 1; + y = ( stars[offs].y + ((state->m_stars_scrollpos + stars[offs].x) >> 9)) & 0xff; if ((y & 0x01) ^ ((x >> 3) & 0x01)) { - plot_star(bitmap, x, y, stars[offs].color, cliprect); + plot_star(state, bitmap, x, y, stars[offs].color, cliprect); } } } static void scrambold_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) { + galaxold_state *state = machine.driver_data(); + struct star *stars = state->m_stars; int offs; - if (!timer_adjusted) + if (!state->m_timer_adjusted) { - start_stars_blink_timer(100000, 10000, 0.00001); - timer_adjusted = 1; + start_stars_blink_timer(machine, 100000, 10000, 0.00001); + state->m_timer_adjusted = 1; } @@ -1627,7 +1556,7 @@ static void scrambold_draw_stars(running_machine &machine, bitmap_t *bitmap, con if ((y & 0x01) ^ ((x >> 3) & 0x01)) { /* determine when to skip plotting */ - switch (stars_blink_state & 0x03) + switch (state->m_stars_blink_state & 0x03) { case 0: if (!(stars[offs].color & 0x01)) continue; @@ -1643,22 +1572,24 @@ static void scrambold_draw_stars(running_machine &machine, bitmap_t *bitmap, con break; } - plot_star(bitmap, x, y, stars[offs].color, cliprect); + plot_star(state, bitmap, x, y, stars[offs].color, cliprect); } } } static void rescue_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) { + galaxold_state *state = machine.driver_data(); + struct star *stars = state->m_stars; int offs; /* same as Scramble, but only top (left) half of screen */ - if (!timer_adjusted) + if (!state->m_timer_adjusted) { - start_stars_blink_timer(100000, 10000, 0.00001); - timer_adjusted = 1; + start_stars_blink_timer(machine, 100000, 10000, 0.00001); + state->m_timer_adjusted = 1; } @@ -1673,7 +1604,7 @@ static void rescue_draw_stars(running_machine &machine, bitmap_t *bitmap, const if ((x < 128) && ((y & 0x01) ^ ((x >> 3) & 0x01))) { /* determine when to skip plotting */ - switch (stars_blink_state & 0x03) + switch (state->m_stars_blink_state & 0x03) { case 0: if (!(stars[offs].color & 0x01)) continue; @@ -1689,21 +1620,23 @@ static void rescue_draw_stars(running_machine &machine, bitmap_t *bitmap, const break; } - plot_star(bitmap, x, y, stars[offs].color, cliprect); + plot_star(state, bitmap, x, y, stars[offs].color, cliprect); } } } static void mariner_draw_stars(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) { + galaxold_state *state = machine.driver_data(); + struct star *stars = state->m_stars; int offs; UINT8 *prom; - if (!timer_adjusted) + if (!state->m_timer_adjusted) { start_stars_scroll_timer(machine); - timer_adjusted = 1; + state->m_timer_adjusted = 1; } @@ -1716,14 +1649,14 @@ static void mariner_draw_stars(running_machine &machine, bitmap_t *bitmap, const int x,y; - x = ((stars[offs].x + -stars_scrollpos) & 0x01ff) >> 1; - y = ( stars[offs].y + ((-stars_scrollpos + stars[offs].x) >> 9)) & 0xff; + x = ((stars[offs].x + -state->m_stars_scrollpos) & 0x01ff) >> 1; + y = ( stars[offs].y + ((-state->m_stars_scrollpos + stars[offs].x) >> 9)) & 0xff; if ((y & 0x01) ^ ((x >> 3) & 0x01)) { if (prom[(x/8 + 1) & 0x1f] & 0x04) { - plot_star(bitmap, x, y, stars[offs].color, cliprect); + plot_star(state, bitmap, x, y, stars[offs].color, cliprect); } } } @@ -1731,49 +1664,54 @@ static void mariner_draw_stars(running_machine &machine, bitmap_t *bitmap, const static TIMER_CALLBACK( stars_blink_callback ) { - stars_blink_state++; + galaxold_state *state = machine.driver_data(); + state->m_stars_blink_state++; } -static void start_stars_blink_timer(double ra, double rb, double c) +static void start_stars_blink_timer(running_machine &machine, double ra, double rb, double c) { + galaxold_state *state = machine.driver_data(); /* calculate the period using the formula given in the 555 datasheet */ int period_in_ms = 693 * (ra + 2.0 * rb) * c; - stars_blink_timer->adjust(attotime::from_msec(period_in_ms), 0, attotime::from_msec(period_in_ms)); + state->m_stars_blink_timer->adjust(attotime::from_msec(period_in_ms), 0, attotime::from_msec(period_in_ms)); } static TIMER_CALLBACK( stars_scroll_callback ) { - if (galaxold_stars_on) + galaxold_state *state = machine.driver_data(); + if (state->m_stars_on) { - stars_scrollpos++; + state->m_stars_scrollpos++; } } static void start_stars_scroll_timer(running_machine &machine) { - stars_scroll_timer->adjust(machine.primary_screen->frame_period(), 0, machine.primary_screen->frame_period()); + galaxold_state *state = machine.driver_data(); + state->m_stars_scroll_timer->adjust(machine.primary_screen->frame_period(), 0, machine.primary_screen->frame_period()); } static TILE_GET_INFO( get_tile_info ) { + galaxold_state *state = machine.driver_data(); UINT8 x = tile_index & 0x1f; - UINT16 code = galaxold_videoram[tile_index]; - UINT8 color = galaxold_attributesram[(x << 1) | 1] & color_mask; + UINT16 code = state->m_videoram[tile_index]; + UINT8 color = state->m_attributesram[(x << 1) | 1] & state->m_color_mask; - if (modify_charcode) + if (state->m_modify_charcode) { - modify_charcode(machine, &code, x); + (*state->m_modify_charcode)(machine, &code, x); } - if (modify_color) + if (state->m_modify_color) { - modify_color(&color); + (*state->m_modify_color)(&color); } SET_TILE_INFO(0, code, color, 0); @@ -1781,31 +1719,34 @@ static TILE_GET_INFO( get_tile_info ) static TILE_GET_INFO( rockclim_get_tile_info ) { - UINT16 code = rockclim_videoram[tile_index]; + galaxold_state *state = machine.driver_data(); + UINT16 code = state->m_rockclim_videoram[tile_index]; SET_TILE_INFO(2, code, 0, 0); } static void draw_bullets_common(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) { + galaxold_state *state = machine.driver_data(); int offs; - for (offs = 0;offs < galaxold_bulletsram_size;offs += 4) + for (offs = 0;offs < state->m_bulletsram_size;offs += 4) { UINT8 sx,sy; - sy = 255 - galaxold_bulletsram[offs + 1]; - sx = 255 - galaxold_bulletsram[offs + 3]; + sy = 255 - state->m_bulletsram[offs + 1]; + sx = 255 - state->m_bulletsram[offs + 3]; - if (flipscreen_y) sy = 255 - sy; + if (state->m_flipscreen_y) sy = 255 - sy; - draw_bullets(machine, bitmap, cliprect, offs, sx, sy); + (*state->m_draw_bullets)(machine, bitmap, cliprect, offs, sx, sy); } } static void draw_sprites(running_machine &machine, bitmap_t *bitmap, UINT8 *spriteram, size_t spriteram_size) { + galaxold_state *state = machine.driver_data(); int offs; @@ -1820,30 +1761,30 @@ static void draw_sprites(running_machine &machine, bitmap_t *bitmap, UINT8 *spri flipx = spriteram[offs + 1] & 0x40; flipy = spriteram[offs + 1] & 0x80; code = spriteram[offs + 1] & 0x3f; - color = spriteram[offs + 2] & color_mask; + color = spriteram[offs + 2] & state->m_color_mask; - if (modify_spritecode) + if (state->m_modify_spritecode) { - modify_spritecode(spriteram, &code, &flipx, &flipy, offs); + (*state->m_modify_spritecode)(machine, spriteram, &code, &flipx, &flipy, offs); } - if (modify_color) + if (state->m_modify_color) { - modify_color(&color); + (*state->m_modify_color)(&color); } - if (modify_ypos) + if (state->m_modify_ypos) { - modify_ypos(&sy); + (*state->m_modify_ypos)(&sy); } - if (flipscreen_x) + if (state->m_flipscreen_x) { sx = 240 - sx; flipx = !flipx; } - if (flipscreen_y) + if (state->m_flipscreen_y) { flipy = !flipy; } @@ -1861,7 +1802,7 @@ static void draw_sprites(running_machine &machine, bitmap_t *bitmap, UINT8 *spri if (offs < 3*4) sy++; - drawgfx_transpen(bitmap,flipscreen_x ? spritevisibleareaflipx : spritevisiblearea,machine.gfx[1], + drawgfx_transpen(bitmap, state->m_flipscreen_x ? &spritevisibleareaflipx : &spritevisiblearea, machine.gfx[1], code,color, flipx,flipy, sx,sy,0); @@ -1871,29 +1812,29 @@ static void draw_sprites(running_machine &machine, bitmap_t *bitmap, UINT8 *spri SCREEN_UPDATE( galaxold ) { - draw_background(screen->machine(), bitmap, cliprect); + galaxold_state *state = screen->machine().driver_data(); + (*state->m_draw_background)(screen->machine(), bitmap, cliprect); - if (galaxold_stars_on) + if (state->m_stars_on) { - draw_stars(screen->machine(), bitmap, cliprect); + (*state->m_draw_stars)(screen->machine(), bitmap, cliprect); } - tilemap_draw(bitmap, 0, bg_tilemap, 0, 0); + tilemap_draw(bitmap, 0, state->m_bg_tilemap, 0, 0); - - if (draw_bullets) + if (state->m_draw_bullets) { draw_bullets_common(screen->machine(), bitmap, cliprect); } - draw_sprites(screen->machine(), bitmap, galaxold_spriteram, galaxold_spriteram_size); + draw_sprites(screen->machine(), bitmap, state->m_spriteram, state->m_spriteram_size); - if (spriteram2_present) + if (state->m_spriteram2_present) { - draw_sprites(screen->machine(), bitmap, galaxold_spriteram2, galaxold_spriteram2_size); + draw_sprites(screen->machine(), bitmap, state->m_spriteram2, state->m_spriteram2_size); } return 0; } @@ -1901,44 +1842,45 @@ SCREEN_UPDATE( galaxold ) SCREEN_UPDATE( dambustr ) { + galaxold_state *state = screen->machine().driver_data(); int i, j; UINT8 color; - draw_background(screen->machine(), bitmap, cliprect); + (*state->m_draw_background)(screen->machine(), bitmap, cliprect); - if (galaxold_stars_on) + if (state->m_stars_on) { - draw_stars(screen->machine(), bitmap, cliprect); + (*state->m_draw_stars)(screen->machine(), bitmap, cliprect); } /* save the background for drawing it again later, if background has priority over characters */ - copybitmap(dambustr_tmpbitmap, bitmap, 0, 0, 0, 0, NULL); + copybitmap(state->m_dambustr_tmpbitmap, bitmap, 0, 0, 0, 0, NULL); - tilemap_draw(bitmap, 0, bg_tilemap, 0, 0); + tilemap_draw(bitmap, 0, state->m_bg_tilemap, 0, 0); - if (draw_bullets) + if (state->m_draw_bullets) { draw_bullets_common(screen->machine(), bitmap, cliprect); } - draw_sprites(screen->machine(), bitmap, galaxold_spriteram, galaxold_spriteram_size); + draw_sprites(screen->machine(), bitmap, state->m_spriteram, state->m_spriteram_size); - if (dambustr_bg_priority) + if (state->m_dambustr_bg_priority) { /* draw the upper part of the background, as it has priority */ dambustr_draw_upper_background(screen->machine(), bitmap, cliprect); /* only rows with color code > 3 are stronger than the background */ - memset(dambustr_videoram2, 0x20, 0x0400); + memset(state->m_dambustr_videoram2, 0x20, 0x0400); for (i=0; i<32; i++) { - color = galaxold_attributesram[(i << 1) | 1] & color_mask; + color = state->m_attributesram[(i << 1) | 1] & state->m_color_mask; if (color > 3) { for (j=0; j<32; j++) - dambustr_videoram2[32*j+i] = galaxold_videoram[32*j+i]; + state->m_dambustr_videoram2[32*j+i] = state->m_videoram[32*j+i]; }; }; - tilemap_mark_all_tiles_dirty(dambustr_tilemap2); - tilemap_draw(bitmap, 0, dambustr_tilemap2, 0, 0); + tilemap_mark_all_tiles_dirty(state->m_dambustr_tilemap2); + tilemap_draw(bitmap, 0, state->m_dambustr_tilemap2, 0, 0); }; return 0;