summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Fabio Priuli <etabeta78@users.noreply.github.com>2009-12-11 01:34:38 +0000
committer Fabio Priuli <etabeta78@users.noreply.github.com>2009-12-11 01:34:38 +0000
commitdcd164adc7bc462573497f4f5c6d2b31dcfa500a (patch)
tree06d6b257706211c0a6f4c9bd3e221758768c31c4
parent64a35dfe954f1dc0d9f7167556810efcca5e5b84 (diff)
Converted Signetics 2636 video chip to be a MAME device and updated drivers using it accordingly
Also, added driver data struct and save states to laserbas.c, laserbat.c, lastfght.c, lazercmd.c and lemmings.c Finally, added driver data struct to lasso.c
-rw-r--r--.gitattributes1
-rw-r--r--src/emu/video/s2636.c143
-rw-r--r--src/emu/video/s2636.h62
-rw-r--r--src/mame/audio/laserbat.c52
-rw-r--r--src/mame/drivers/cvs.c59
-rw-r--r--src/mame/drivers/galaxia.c59
-rw-r--r--src/mame/drivers/laserbas.c105
-rw-r--r--src/mame/drivers/laserbat.c285
-rw-r--r--src/mame/drivers/lasso.c139
-rw-r--r--src/mame/drivers/lastfght.c283
-rw-r--r--src/mame/drivers/lazercmd.c318
-rw-r--r--src/mame/drivers/lemmings.c72
-rw-r--r--src/mame/drivers/malzak.c42
-rw-r--r--src/mame/drivers/quasar.c30
-rw-r--r--src/mame/drivers/zac2650.c1
-rw-r--r--src/mame/includes/cvs.h3
-rw-r--r--src/mame/includes/laserbat.h50
-rw-r--r--src/mame/includes/lasso.h36
-rw-r--r--src/mame/includes/lazercmd.h20
-rw-r--r--src/mame/includes/lemmings.h31
-rw-r--r--src/mame/video/cvs.c14
-rw-r--r--src/mame/video/lasso.c162
-rw-r--r--src/mame/video/lazercmd.c32
-rw-r--r--src/mame/video/lemmings.c151
-rw-r--r--src/mame/video/malzak.c18
-rw-r--r--src/mame/video/quasar.c13
-rw-r--r--src/mame/video/zac2650.c2
27 files changed, 1397 insertions, 786 deletions
diff --git a/.gitattributes b/.gitattributes
index abbf62f1038..b4050474003 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2530,6 +2530,7 @@ src/mame/includes/ksayakyu.h svneol=native#text/plain
src/mame/includes/kyugo.h svneol=native#text/plain
src/mame/includes/ladybug.h svneol=native#text/plain
src/mame/includes/ladyfrog.h svneol=native#text/plain
+src/mame/includes/laserbat.h svneol=native#text/plain
src/mame/includes/lasso.h svneol=native#text/plain
src/mame/includes/lastduel.h svneol=native#text/plain
src/mame/includes/lazercmd.h svneol=native#text/plain
diff --git a/src/emu/video/s2636.c b/src/emu/video/s2636.c
index b539415f814..c12450a2ff2 100644
--- a/src/emu/video/s2636.c
+++ b/src/emu/video/s2636.c
@@ -76,9 +76,7 @@
*************************************************************/
#include "driver.h"
-#include "s2636.h"
-
-
+#include "video/s2636.h"
/*************************************
*
@@ -91,49 +89,45 @@
static const int sprite_offsets[4] = { 0x00, 0x10, 0x20, 0x40 };
-
-
/*************************************
*
* Internal S2636 data structure
*
*************************************/
-struct _s2636_t
+typedef struct _s2636_state s2636_state;
+struct _s2636_state
{
- UINT8 *work_ram;
- int y_offset;
- int x_offset;
+ UINT8 *work_ram;
+ int work_ram_size;
+ int y_offset;
+ int x_offset;
bitmap_t *bitmap;
bitmap_t *collision_bitmap;
};
-
-
/*************************************
*
- * Configuration
+ * Inline functions
*
*************************************/
-s2636_t *s2636_config(running_machine *machine, UINT8 *work_ram, int screen_height, int screen_width, int y_offset, int x_offset)
+INLINE s2636_state *get_safe_token( const device_config *device )
{
- s2636_t *s2636;
-
- /* allocate the object that holds the state */
- s2636 = auto_alloc(machine, s2636_t);
-
- s2636->work_ram = work_ram;
- s2636->y_offset = y_offset;
- s2636->x_offset = x_offset;
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == S2636);
- s2636->bitmap = auto_bitmap_alloc(machine, screen_width, screen_height, BITMAP_FORMAT_INDEXED16);
- s2636->collision_bitmap = auto_bitmap_alloc(machine, screen_width, screen_height, BITMAP_FORMAT_INDEXED16);
-
- return s2636;
+ return (s2636_state *)device->token;
}
+INLINE const s2636_interface *get_interface( const device_config *device )
+{
+ assert(device != NULL);
+ assert((device->type == S2636));
+ return (const s2636_interface *) device->static_config;
+}
/*************************************
@@ -142,8 +136,7 @@ s2636_t *s2636_config(running_machine *machine, UINT8 *work_ram, int screen_heig
*
*************************************/
-static void draw_sprite(UINT8 *gfx, int color, int y, int x, int expand,
- int or_mode, bitmap_t *bitmap, const rectangle *cliprect)
+static void draw_sprite( UINT8 *gfx, int color, int y, int x, int expand, int or_mode, bitmap_t *bitmap, const rectangle *cliprect )
{
int sy;
@@ -197,8 +190,9 @@ static void draw_sprite(UINT8 *gfx, int color, int y, int x, int expand,
*
*************************************/
-static int check_collision(s2636_t *s2636, int spriteno1, int spriteno2, const rectangle *cliprect)
+static int check_collision( const device_config *device, int spriteno1, int spriteno2, const rectangle *cliprect )
{
+ s2636_state *s2636 = get_safe_token(device);
int checksum = 0;
UINT8* attr1 = &s2636->work_ram[sprite_offsets[spriteno1]];
@@ -227,10 +221,8 @@ static int check_collision(s2636_t *s2636, int spriteno1, int spriteno2, const r
for (x = x1; x < x1 + SPRITE_WIDTH; x++)
for (y = y1; y < y1 + SPRITE_HEIGHT; y++)
{
- if ((x < cliprect->min_x) ||
- (x > cliprect->max_x) ||
- (y < cliprect->min_y) ||
- (y > cliprect->max_y))
+ if ((x < cliprect->min_x) || (x > cliprect->max_x) ||
+ (y < cliprect->min_y) || (y > cliprect->max_y))
continue;
checksum = checksum + *BITMAP_ADDR16(s2636->collision_bitmap, y, x);
@@ -243,10 +235,8 @@ static int check_collision(s2636_t *s2636, int spriteno1, int spriteno2, const r
for (x = x1; x < x1 + SPRITE_WIDTH; x++)
for (y = y1; y < y1 + SPRITE_HEIGHT; y++)
{
- if ((x < cliprect->min_x) ||
- (x > cliprect->max_x) ||
- (y < cliprect->min_y) ||
- (y > cliprect->max_y))
+ if ((x < cliprect->min_x) || (x > cliprect->max_x) ||
+ (y < cliprect->min_y) || (y > cliprect->max_y))
continue;
checksum = checksum - *BITMAP_ADDR16(s2636->collision_bitmap, y, x);
@@ -264,8 +254,9 @@ static int check_collision(s2636_t *s2636, int spriteno1, int spriteno2, const r
*
*************************************/
-bitmap_t *s2636_update(s2636_t *s2636, const rectangle *cliprect)
+bitmap_t *s2636_update( const device_config *device, const rectangle *cliprect )
{
+ s2636_state *s2636 = get_safe_token(device);
UINT8 collision = 0;
int spriteno;
@@ -274,7 +265,6 @@ bitmap_t *s2636_update(s2636_t *s2636, const rectangle *cliprect)
for (spriteno = 0; spriteno < 4; spriteno++)
{
int color, expand, x, y;
-
UINT8* attr = &s2636->work_ram[sprite_offsets[spriteno]];
/* get out if sprite is turned off */
@@ -304,14 +294,79 @@ bitmap_t *s2636_update(s2636_t *s2636, const rectangle *cliprect)
}
/* collision detection */
- if (check_collision(s2636, 0, 1, cliprect)) collision |= 0x20;
- if (check_collision(s2636, 0, 2, cliprect)) collision |= 0x10;
- if (check_collision(s2636, 0, 3, cliprect)) collision |= 0x08;
- if (check_collision(s2636, 1, 2, cliprect)) collision |= 0x04;
- if (check_collision(s2636, 1, 3, cliprect)) collision |= 0x02;
- if (check_collision(s2636, 2, 3, cliprect)) collision |= 0x01;
+ if (check_collision(device, 0, 1, cliprect)) collision |= 0x20;
+ if (check_collision(device, 0, 2, cliprect)) collision |= 0x10;
+ if (check_collision(device, 0, 3, cliprect)) collision |= 0x08;
+ if (check_collision(device, 1, 2, cliprect)) collision |= 0x04;
+ if (check_collision(device, 1, 3, cliprect)) collision |= 0x02;
+ if (check_collision(device, 2, 3, cliprect)) collision |= 0x01;
s2636->work_ram[0xcb] = collision;
return s2636->bitmap;
}
+
+
+/*************************************
+ *
+ * Work RAM access handlers
+ *
+ *************************************/
+
+WRITE8_DEVICE_HANDLER( s2636_work_ram_w )
+{
+ s2636_state *s2636 = get_safe_token(device);
+
+ assert(offset < 8);
+
+ s2636->work_ram[offset] = data;
+}
+
+
+READ8_DEVICE_HANDLER( s2636_work_ram_r )
+{
+ s2636_state *s2636 = get_safe_token(device);
+
+ assert(offset < s2636->work_ram_size);
+
+ return s2636->work_ram[offset];
+}
+
+/*************************************
+ *
+ * Device interface
+ *
+ *************************************/
+
+static DEVICE_START( s2636 )
+{
+ s2636_state *s2636 = get_safe_token(device);
+ const s2636_interface *intf = get_interface(device);
+ const device_config *screen = devtag_get_device(device->machine, intf->screen);
+ int width = video_screen_get_width(screen);
+ int height = video_screen_get_height(screen);
+
+ s2636->work_ram_size = intf->work_ram_size;
+ s2636->x_offset = intf->x_offset;
+ s2636->y_offset = intf->y_offset;
+
+ s2636->work_ram = auto_alloc_array(device->machine, UINT8, intf->work_ram_size);
+ s2636->bitmap = auto_bitmap_alloc(device->machine, width, height, BITMAP_FORMAT_INDEXED16);
+ s2636->collision_bitmap = auto_bitmap_alloc(device->machine, width, height, BITMAP_FORMAT_INDEXED16);
+
+ state_save_register_device_item(device, 0, s2636->x_offset);
+ state_save_register_device_item(device, 0, s2636->y_offset);
+ state_save_register_device_item_pointer(device, 0, s2636->work_ram, s2636->work_ram_size);
+ state_save_register_device_item_bitmap(device, 0, s2636->bitmap);
+ state_save_register_device_item_bitmap(device, 0, s2636->collision_bitmap);
+}
+
+static const char DEVTEMPLATE_SOURCE[] = __FILE__;
+
+#define DEVTEMPLATE_ID( p, s ) p##s2636##s
+#define DEVTEMPLATE_FEATURES DT_HAS_START
+#define DEVTEMPLATE_NAME "Signetics 2636"
+#define DEVTEMPLATE_FAMILY "Signetics Video Chips"
+#define DEVTEMPLATE_CLASS DEVICE_CLASS_VIDEO
+#include "devtempl.h"
+
diff --git a/src/emu/video/s2636.h b/src/emu/video/s2636.h
index ad2034dea53..432b52f8946 100644
--- a/src/emu/video/s2636.h
+++ b/src/emu/video/s2636.h
@@ -4,21 +4,65 @@
**********************************************************************/
-#ifndef S2636
-#define S2636
+#ifndef __S2636_H__
+#define __S2636_H__
+#include "devcb.h"
-typedef struct _s2636_t s2636_t;
+#define S2636_IS_PIXEL_DRAWN(p) (((p) & 0x08) ? TRUE : FALSE)
+#define S2636_PIXEL_COLOR(p) ((p) & 0x07)
-/* helpful macros to parse the bitmap returned by s2636_update */
-#define S2636_IS_PIXEL_DRAWN(p) (((p) & 0x08) ? TRUE : FALSE)
-#define S2636_PIXEL_COLOR(p) ((p) & 0x07)
+/*************************************
+ *
+ * Type definitions
+ *
+ *************************************/
+
+typedef struct _s2636_interface s2636_interface;
+struct _s2636_interface
+{
+ const char *screen;
+ int work_ram_size;
+ int y_offset;
+ int x_offset;
+};
+
+/*************************************
+ *
+ * Function prototypes
+ *
+ *************************************/
+
+DEVICE_GET_INFO( s2636 );
+
+
+/*************************************
+ *
+ * Device configuration macros
+ *
+ *************************************/
+
+#define S2636 DEVICE_GET_INFO_NAME( s2636 )
+
+#define MDRV_S2636_ADD(_tag, _interface) \
+ MDRV_DEVICE_ADD(_tag, S2636, 0) \
+ MDRV_DEVICE_CONFIG(_interface)
+
+
+/*************************************
+ *
+ * Device I/O functions
+ *
+ *************************************/
-s2636_t *s2636_config(running_machine *machine, UINT8 *work_ram, int screen_height, int screen_width, int y_offset, int x_offset);
/* returns a BITMAP_FORMAT_INDEXED16 bitmap the size of the screen
D0-D2 of each pixel is the pixel color
D3 indicates whether the S2636 drew this pixel - 0 = not drawn, 1 = drawn */
-bitmap_t *s2636_update(s2636_t *s2636, const rectangle *cliprect);
-#endif
+bitmap_t *s2636_update( const device_config *device, const rectangle *cliprect );
+WRITE8_DEVICE_HANDLER( s2636_work_ram_w );
+READ8_DEVICE_HANDLER( s2636_work_ram_r );
+
+
+#endif /* __S2636_H__ */
diff --git a/src/mame/audio/laserbat.c b/src/mame/audio/laserbat.c
index 73b871c2e4d..59a4dcb3e67 100644
--- a/src/mame/audio/laserbat.c
+++ b/src/mame/audio/laserbat.c
@@ -1,26 +1,24 @@
#include "driver.h"
#include "sound/sn76477.h"
#include "sound/tms3615.h"
-
-static int csound1;
-static int ksound1, ksound2, ksound3;
-static int degr, filt, a, us, bit14;
+#include "includes/laserbat.h"
WRITE8_HANDLER( laserbat_csound1_w )
{
- csound1 = data;
+ laserbat_state *state = (laserbat_state *)space->machine->driver_data;
+ state->csound1 = data;
}
WRITE8_HANDLER( laserbat_csound2_w )
{
- const device_config *sn = devtag_get_device(space->machine, "snsnd");
+ laserbat_state *state = (laserbat_state *)space->machine->driver_data;
int ksound = 0;
if (data & 0x01)
{
int noise_filter_res = 0, vco_res = 0;
- switch(csound1 & 0x07)
+ switch(state->csound1 & 0x07)
{
case 0x00:
noise_filter_res = RES_K(270);
@@ -56,53 +54,53 @@ WRITE8_HANDLER( laserbat_csound2_w )
break;
}
- sn76477_noise_filter_res_w(sn, noise_filter_res);
- sn76477_vco_res_w(sn, vco_res);
+ sn76477_noise_filter_res_w(state->sn, noise_filter_res);
+ sn76477_vco_res_w(state->sn, vco_res);
- sn76477_enable_w(sn, (csound1 & 0x08) ? 1 : 0); // AB SOUND
- sn76477_mixer_b_w(sn, (csound1 & 0x10) ? 1 : 0); // _VCO/NOISE
+ sn76477_enable_w(state->sn, (state->csound1 & 0x08) ? 1 : 0); // AB SOUND
+ sn76477_mixer_b_w(state->sn, (state->csound1 & 0x10) ? 1 : 0); // _VCO/NOISE
- degr = (csound1 & 0x20) ? 1 : 0;
- filt = (csound1 & 0x40) ? 1 : 0;
- a = (csound1 & 0x80) ? 1 : 0;
- us = 0; // sn76477 pin 12
+ state->degr = (state->csound1 & 0x20) ? 1 : 0;
+ state->filt = (state->csound1 & 0x40) ? 1 : 0;
+ state->a = (state->csound1 & 0x80) ? 1 : 0;
+ state->us = 0; // sn76477 pin 12
}
- sn76477_vco_w(sn, (data & 0x40) ? 0 : 1);
+ sn76477_vco_w(state->sn, (data & 0x40) ? 0 : 1);
switch((data & 0x1c) >> 2)
{
case 0x00:
- sn76477_slf_res_w(sn, RES_K(27));
+ sn76477_slf_res_w(state->sn, RES_K(27));
break;
case 0x01:
- sn76477_slf_res_w(sn, RES_K(22));
+ sn76477_slf_res_w(state->sn, RES_K(22));
break;
case 0x02:
- sn76477_slf_res_w(sn, RES_K(22));
+ sn76477_slf_res_w(state->sn, RES_K(22));
break;
case 0x03:
- sn76477_slf_res_w(sn, RES_K(12));
+ sn76477_slf_res_w(state->sn, RES_K(12));
break;
case 0x04: // not connected
break;
case 0x05: // SL1
- ksound1 = csound1;
+ state->ksound1 = state->csound1;
break;
case 0x06: // SL2
- ksound2 = csound1;
+ state->ksound2 = state->csound1;
break;
case 0x07: // SL3
- ksound3 = csound1;
+ state->ksound3 = state->csound1;
break;
}
- ksound = ((data & 0x02) << 23) + (ksound3 << 16) + (ksound2 << 8) + ksound1;
+ ksound = ((data & 0x02) << 23) + (state->ksound3 << 16) + (state->ksound2 << 8) + state->ksound1;
- tms3615_enable_w(devtag_get_device(space->machine, "tms1"), ksound & 0x1fff);
- tms3615_enable_w(devtag_get_device(space->machine, "tms2"), (ksound >> 13) << 1);
+ tms3615_enable_w(state->tms1, ksound & 0x1fff);
+ tms3615_enable_w(state->tms2, (ksound >> 13) << 1);
- bit14 = (data & 0x20) ? 1 : 0;
+ state->bit14 = (data & 0x20) ? 1 : 0;
// (data & 0x80) = reset
}
diff --git a/src/mame/drivers/cvs.c b/src/mame/drivers/cvs.c
index d5ecee96767..d432d2918e3 100644
--- a/src/mame/drivers/cvs.c
+++ b/src/mame/drivers/cvs.c
@@ -118,9 +118,6 @@ UINT8 *cvs_video_ram;
UINT8 *cvs_bullet_ram;
UINT8 *cvs_palette_ram;
static UINT8 *cvs_character_ram;
-UINT8 *cvs_s2636_0_ram;
-UINT8 *cvs_s2636_1_ram;
-UINT8 *cvs_s2636_2_ram;
UINT8 *cvs_fo_state;
static emu_timer *cvs_393hz_timer;
@@ -185,14 +182,18 @@ WRITE8_HANDLER( cvs_bullet_ram_or_palette_w )
READ8_HANDLER( cvs_s2636_0_or_character_ram_r )
{
+ const device_config *s2636_0 = devtag_get_device(space->machine, "s2636_0");
+
if (*cvs_fo_state)
return cvs_character_ram[(0 * 0x800) | 0x400 | character_ram_page_start | offset];
else
- return cvs_s2636_0_ram[offset];
+ return s2636_work_ram_r(s2636_0, offset);
}
WRITE8_HANDLER( cvs_s2636_0_or_character_ram_w )
{
+ const device_config *s2636_0 = devtag_get_device(space->machine, "s2636_0");
+
if (*cvs_fo_state)
{
offset |= (0 * 0x800) | 0x400 | character_ram_page_start;
@@ -200,20 +201,24 @@ WRITE8_HANDLER( cvs_s2636_0_or_character_ram_w )
gfx_element_mark_dirty(space->machine->gfx[1], (offset/8) % 256);
}
else
- cvs_s2636_0_ram[offset] = data;
+ s2636_work_ram_w(s2636_0, offset, data);
}
READ8_HANDLER( cvs_s2636_1_or_character_ram_r )
{
+ const device_config *s2636_1 = devtag_get_device(space->machine, "s2636_1");
+
if (*cvs_fo_state)
return cvs_character_ram[(1 * 0x800) | 0x400 | character_ram_page_start | offset];
else
- return cvs_s2636_1_ram[offset];
+ return s2636_work_ram_r(s2636_1, offset);
}
WRITE8_HANDLER( cvs_s2636_1_or_character_ram_w )
{
+ const device_config *s2636_1 = devtag_get_device(space->machine, "s2636_1");
+
if (*cvs_fo_state)
{
offset |= (1 * 0x800) | 0x400 | character_ram_page_start;
@@ -221,20 +226,24 @@ WRITE8_HANDLER( cvs_s2636_1_or_character_ram_w )
gfx_element_mark_dirty(space->machine->gfx[1], (offset/8) % 256);
}
else
- cvs_s2636_1_ram[offset] = data;
+ s2636_work_ram_w(s2636_1, offset, data);
}
READ8_HANDLER( cvs_s2636_2_or_character_ram_r )
{
+ const device_config *s2636_2 = devtag_get_device(space->machine, "s2636_2");
+
if (*cvs_fo_state)
return cvs_character_ram[(2 * 0x800) | 0x400 | character_ram_page_start | offset];
else
- return cvs_s2636_2_ram[offset];
+ return s2636_work_ram_r(s2636_2, offset);
}
WRITE8_HANDLER( cvs_s2636_2_or_character_ram_w )
{
+ const device_config *s2636_2 = devtag_get_device(space->machine, "s2636_2");
+
if (*cvs_fo_state)
{
offset |= (2 * 0x800) | 0x400 | character_ram_page_start;
@@ -242,7 +251,7 @@ WRITE8_HANDLER( cvs_s2636_2_or_character_ram_w )
gfx_element_mark_dirty(space->machine->gfx[1], (offset/8) % 256);
}
else
- cvs_s2636_2_ram[offset] = data;
+ s2636_work_ram_w(s2636_2, offset, data);
}
@@ -525,9 +534,9 @@ static ADDRESS_MAP_START( cvs_main_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_GLOBAL_MASK(0x7fff)
AM_RANGE(0x0000, 0x13ff) AM_ROM
AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_bullet_ram_or_palette_r, cvs_bullet_ram_or_palette_w) AM_BASE(&cvs_bullet_ram)
- AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_2_or_character_ram_r, cvs_s2636_2_or_character_ram_w) AM_BASE(&cvs_s2636_2_ram)
- AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_1_or_character_ram_r, cvs_s2636_1_or_character_ram_w) AM_BASE(&cvs_s2636_1_ram)
- AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_0_or_character_ram_r, cvs_s2636_0_or_character_ram_w) AM_BASE(&cvs_s2636_0_ram)
+ AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_2_or_character_ram_r, cvs_s2636_2_or_character_ram_w)
+ AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_1_or_character_ram_r, cvs_s2636_1_or_character_ram_w)
+ AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_0_or_character_ram_r, cvs_s2636_0_or_character_ram_w)
AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READWRITE(cvs_video_or_color_ram_r, cvs_video_or_color_ram_w) AM_BASE(&cvs_video_ram)
AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM
AM_RANGE(0x2000, 0x33ff) AM_ROM
@@ -1014,6 +1023,28 @@ GFXDECODE_END
*
*************************************/
+static const s2636_interface s2636_0_config =
+{
+ "screen",
+ 0xff,
+ CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
+};
+
+static const s2636_interface s2636_1_config =
+{
+ "screen",
+ 0xff,
+ CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
+};
+
+static const s2636_interface s2636_2_config =
+{
+ "screen",
+ 0xff,
+ CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
+};
+
+
static MACHINE_DRIVER_START( cvs )
/* basic machine hardware */
@@ -1048,6 +1079,10 @@ static MACHINE_DRIVER_START( cvs )
MDRV_SCREEN_REFRESH_RATE(60)
MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1000))
+ MDRV_S2636_ADD("s2636_0", s2636_0_config)
+ MDRV_S2636_ADD("s2636_1", s2636_1_config)
+ MDRV_S2636_ADD("s2636_2", s2636_2_config)
+
/* audio hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
diff --git a/src/mame/drivers/galaxia.c b/src/mame/drivers/galaxia.c
index 14f7399d6b7..f8f83629dd3 100644
--- a/src/mame/drivers/galaxia.c
+++ b/src/mame/drivers/galaxia.c
@@ -30,22 +30,6 @@ TS 2008.08.12:
static UINT8 *galaxia_video;
static UINT8 *galaxia_color;
-static s2636_t *s2636_0, *s2636_1, *s2636_2;
-static UINT8 *galaxia_s2636_0_ram;
-static UINT8 *galaxia_s2636_1_ram;
-static UINT8 *galaxia_s2636_2_ram;
-
-static VIDEO_START( galaxia )
-{
- int width = video_screen_get_width(machine->primary_screen);
- int height = video_screen_get_height(machine->primary_screen);
-
- /* configure the S2636 chips */
- s2636_0 = s2636_config(machine, galaxia_s2636_0_ram, height, width, 3, -27);
- s2636_1 = s2636_config(machine, galaxia_s2636_1_ram, height, width, 3, -27);
- s2636_2 = s2636_config(machine, galaxia_s2636_2_ram, height, width, 3, -27);
-}
-
static VIDEO_UPDATE( galaxia )
{
int x,y, count;
@@ -53,6 +37,10 @@ static VIDEO_UPDATE( galaxia )
bitmap_t *s2636_0_bitmap;
bitmap_t *s2636_1_bitmap;
bitmap_t *s2636_2_bitmap;
+
+ const device_config *s2636_0 = devtag_get_device(screen->machine, "s2636_0");
+ const device_config *s2636_1 = devtag_get_device(screen->machine, "s2636_1");
+ const device_config *s2636_2 = devtag_get_device(screen->machine, "s2636_2");
count = 0;
@@ -118,9 +106,9 @@ static READ8_HANDLER(galaxia_video_r)
static ADDRESS_MAP_START( mem_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x13ff) AM_ROM
AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_RAM
- AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&galaxia_s2636_0_ram)
- AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&galaxia_s2636_1_ram)
- AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&galaxia_s2636_2_ram)
+ AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_DEVREADWRITE("s2636_0", s2636_work_ram_r, s2636_work_ram_w)
+ AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_DEVREADWRITE("s2636_1", s2636_work_ram_r, s2636_work_ram_w)
+ AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_DEVREADWRITE("s2636_2", s2636_work_ram_r, s2636_work_ram_w)
AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READWRITE(galaxia_video_r, galaxia_video_w) AM_BASE(&galaxia_video)
AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM
AM_RANGE(0x2000, 0x33ff) AM_ROM
@@ -141,9 +129,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( astrowar_mem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x13ff) AM_ROM
AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_RAM
- AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&galaxia_s2636_0_ram)
- AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&galaxia_s2636_1_ram)
- AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&galaxia_s2636_2_ram)
+ AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_DEVREADWRITE("s2636_0", s2636_work_ram_r, s2636_work_ram_w)
+ AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_DEVREADWRITE("s2636_1", s2636_work_ram_r, s2636_work_ram_w)
+ AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_DEVREADWRITE("s2636_2", s2636_work_ram_r, s2636_work_ram_w)
AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READWRITE(galaxia_video_r, galaxia_video_w) AM_BASE(&galaxia_video)
AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM
AM_RANGE(0x2000, 0x33ff) AM_ROM
@@ -242,6 +230,28 @@ static INTERRUPT_GEN( galaxia_interrupt )
cpu_set_input_line_and_vector(device, 0, HOLD_LINE, 0x03);
}
+
+static const s2636_interface s2636_0_config =
+{
+ "screen",
+ 0xff,
+ 3, -27
+};
+
+static const s2636_interface s2636_1_config =
+{
+ "screen",
+ 0xff,
+ 3, -27
+};
+
+static const s2636_interface s2636_2_config =
+{
+ "screen",
+ 0xff,
+ 3, -27
+};
+
static MACHINE_DRIVER_START( galaxia )
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", S2650,2000000) /* ? MHz */
@@ -260,7 +270,10 @@ static MACHINE_DRIVER_START( galaxia )
MDRV_GFXDECODE(galaxia)
MDRV_PALETTE_LENGTH(0x100)
- MDRV_VIDEO_START(galaxia)
+ MDRV_S2636_ADD("s2636_0", s2636_0_config)
+ MDRV_S2636_ADD("s2636_1", s2636_1_config)
+ MDRV_S2636_ADD("s2636_2", s2636_2_config)
+
MDRV_VIDEO_UPDATE(galaxia)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/laserbas.c b/src/mame/drivers/laserbas.c
index 9906d7fc1f0..2c5e5afc245 100644
--- a/src/mame/drivers/laserbas.c
+++ b/src/mame/drivers/laserbas.c
@@ -20,71 +20,95 @@
#include "cpu/z80/z80.h"
#include "deprecat.h"
-static UINT8 *vram1,*vram2;
-static int vrambank=0;
+typedef struct _laserbas_state laserbas_state;
+struct _laserbas_state
+{
+ /* video-related */
+ UINT8 *vram1;
+ UINT8 *vram2;
+ int vrambank;
+
+ /* misc */
+ int count;
+};
+
static VIDEO_START(laserbas)
{
- vram1=auto_alloc_array(machine, UINT8, 0x8000);
- vram2=auto_alloc_array(machine, UINT8, 0x8000);
+ laserbas_state *state = (laserbas_state *)machine->driver_data;
+
+ state->vram1 = auto_alloc_array(machine, UINT8, 0x8000);
+ state->vram2 = auto_alloc_array(machine, UINT8, 0x8000);
+
+ state_save_register_global_pointer(machine, state->vram1, 0x8000);
+ state_save_register_global_pointer(machine, state->vram2, 0x8000);
}
static VIDEO_UPDATE(laserbas)
{
- int x,y;
- for(y=0;y<256;y++)
- for(x=0;x<128;x++)
+ laserbas_state *state = (laserbas_state *)screen->machine->driver_data;
+ int x, y;
+
+ for (y = 0; y < 256; y++)
+ for(x = 0; x < 128; x++)
{
- if (vram2[y*128+x]&0xf)
- *BITMAP_ADDR16(bitmap, y, x*2) = (vram2[y*128+x]&0xf)+16;
+ if (state->vram2[y * 128 + x] & 0xf)
+ *BITMAP_ADDR16(bitmap, y, x * 2) = (state->vram2[y * 128 + x] & 0xf) + 16;
else
- *BITMAP_ADDR16(bitmap, y, x*2) = (vram1[y*128+x]&0xf)+16;
+ *BITMAP_ADDR16(bitmap, y, x * 2) = (state->vram1[y * 128 + x] & 0xf) + 16;
- if (vram2[y*128+x]>>4)
- *BITMAP_ADDR16(bitmap, y, x*2+1) = (vram2[y*128+x]>>4)+16;
+ if (state->vram2[y * 128 + x] >> 4)
+ *BITMAP_ADDR16(bitmap, y, x * 2 + 1) = (state->vram2[y * 128 + x] >> 4) + 16;
else
- *BITMAP_ADDR16(bitmap, y, x*2+1) = (vram1[y*128+x]>>4)+16;
+ *BITMAP_ADDR16(bitmap, y, x * 2 + 1) = (state->vram1[y * 128 + x] >> 4) + 16;
}
return 0;
}
static READ8_HANDLER(vram_r)
{
- if(!vrambank)
- return vram1[offset];
+ laserbas_state *state = (laserbas_state *)space->machine->driver_data;
+
+ if(!state->vrambank)
+ return state->vram1[offset];
else
- return vram2[offset];
+ return state->vram2[offset];
}
static WRITE8_HANDLER(vram_w)
{
- if(!vrambank)
- vram1[offset]=data;
+ laserbas_state *state = (laserbas_state *)space->machine->driver_data;
+
+ if(!state->vrambank)
+ state->vram1[offset] = data;
else
- vram2[offset]=data;
+ state->vram2[offset] = data;
}
static READ8_HANDLER( read_unk )
{
- static int count=0;
- count ^= 0x80;
- return count|0x7f;
+ laserbas_state *state = (laserbas_state *)space->machine->driver_data;
+
+ state->count ^= 0x80;
+ return state->count | 0x7f;
}
static WRITE8_HANDLER(palette_w)
{
- palette_set_color_rgb(space->machine,offset,pal3bit(data>>5),pal3bit(data>>2),pal2bit(data));
+ palette_set_color_rgb(space->machine, offset, pal3bit(data >> 5), pal3bit(data >> 2), pal2bit(data));
}
static WRITE8_HANDLER(vrambank_w)
{
- if((offset&0xf1)==0x10)
- vrambank=data&0x40;
+ laserbas_state *state = (laserbas_state *)space->machine->driver_data;
+
+ if ((offset & 0xf1) == 0x10)
+ state->vrambank = data & 0x40;
}
static ADDRESS_MAP_START( laserbas_memory, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
- AM_RANGE(0x4000, 0xbfff) AM_READ(vram_r) AM_WRITE(vram_w)
+ AM_RANGE(0x4000, 0xbfff) AM_READWRITE(vram_r, vram_w)
AM_RANGE(0xc000, 0xf7ff) AM_ROM
AM_RANGE(0xf800, 0xfbff) AM_RAM /* protection device */
AM_RANGE(0xfc00, 0xffff) AM_RAM
@@ -123,17 +147,37 @@ INPUT_PORTS_END
static INTERRUPT_GEN( laserbas_interrupt )
{
if(video_screen_get_vblank(device->machine->primary_screen))
- cpu_set_input_line(device, 0, HOLD_LINE);
+ cpu_set_input_line(device, 0, HOLD_LINE);
else
cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
}
+static MACHINE_START( laserbas )
+{
+ laserbas_state *state = (laserbas_state *)machine->driver_data;
+
+ state_save_register_global(machine, state->vrambank);
+ state_save_register_global(machine, state->count);
+}
+
+static MACHINE_RESET( laserbas )
+{
+ laserbas_state *state = (laserbas_state *)machine->driver_data;
+
+ state->vrambank = 0;
+ state->count = 0;
+}
+
static MACHINE_DRIVER_START( laserbas )
+ MDRV_DRIVER_DATA(laserbas_state)
+
MDRV_CPU_ADD("maincpu", Z80, 4000000)
MDRV_CPU_PROGRAM_MAP(laserbas_memory)
MDRV_CPU_IO_MAP(laserbas_io)
MDRV_CPU_VBLANK_INT_HACK(laserbas_interrupt,2)
+ MDRV_MACHINE_START(laserbas)
+ MDRV_MACHINE_RESET(laserbas)
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60)
@@ -145,7 +189,6 @@ static MACHINE_DRIVER_START( laserbas )
MDRV_PALETTE_LENGTH(32)
MDRV_VIDEO_START(laserbas)
MDRV_VIDEO_UPDATE(laserbas)
-
MACHINE_DRIVER_END
/*
@@ -236,6 +279,6 @@ ROM_START( futflash )
ROM_LOAD( "ff.8", 0xf000, 0x0800, CRC(623f558f) SHA1(be6c6565df658555f21c43a8c2459cf399794a84) )
ROM_END
-GAME( 1981, laserbas, 0, laserbas, laserbas, 0, ROT270, "Amstar/HOEI", "Laser Base (set 1)", GAME_NO_SOUND | GAME_NOT_WORKING)
-GAME( 1981, laserbasa,laserbas, laserbas, laserbas, 0, ROT270, "Amstar/HOEI", "Laser Base (set 2)", GAME_NO_SOUND | GAME_NOT_WORKING )
-GAME( 1981, futflash, laserbas, laserbas, laserbas, 0, ROT270, "HOEI", "Future Flash", GAME_NO_SOUND | GAME_NOT_WORKING)
+GAME( 1981, laserbas, 0, laserbas, laserbas, 0, ROT270, "Amstar/HOEI", "Laser Base (set 1)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
+GAME( 1981, laserbasa,laserbas, laserbas, laserbas, 0, ROT270, "Amstar/HOEI", "Laser Base (set 2)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
+GAME( 1981, futflash, laserbas, laserbas, laserbas, 0, ROT270, "HOEI", "Future Flash", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/laserbat.c b/src/mame/drivers/laserbat.c
index 896ddcec320..ab6c7ef8fcf 100644
--- a/src/mame/drivers/laserbat.c
+++ b/src/mame/drivers/laserbat.c
@@ -20,65 +20,54 @@ TODO:
#include "cpu/m6800/m6800.h"
#include "cpu/s2650/s2650.h"
#include "machine/6821pia.h"
-#include "video/s2636.h"
#include "sound/ay8910.h"
#include "sound/sn76477.h"
#include "sound/tms3615.h"
+#include "video/s2636.h"
+#include "includes/laserbat.h"
-WRITE8_HANDLER( laserbat_csound1_w );
-WRITE8_HANDLER( laserbat_csound2_w );
-
-static tilemap *bg_tilemap;
-static int laserbat_video_page = 0;
-static int laserbat_input_mux = 0;
-static s2636_t *s2636_0, *s2636_1, *s2636_2;
-static UINT8 *s2636_0_ram;
-static UINT8 *s2636_1_ram;
-static UINT8 *s2636_2_ram;
-
-/* information for the single 32x32 sprite displayed */
-static struct sprite_info
-{
- int x;
- int y;
- int code;
- int color;
- int enable;
-} sprite_info;
static WRITE8_HANDLER( laserbat_videoram_w )
{
- if(laserbat_video_page == 0)
+ laserbat_state *state = (laserbat_state *)space->machine->driver_data;
+
+ if (state->video_page == 0)
{
- space->machine->generic.videoram.u8[offset] = data;
- tilemap_mark_tile_dirty(bg_tilemap,offset);
+ state->videoram[offset] = data;
+ tilemap_mark_tile_dirty(state->bg_tilemap, offset);
}
- else if(laserbat_video_page == 1)
+ else if (state->video_page == 1)
{
- space->machine->generic.colorram.u8[offset] = data;
- tilemap_mark_tile_dirty(bg_tilemap,offset); // wrong!
+ state->colorram[offset] = data;
+ tilemap_mark_tile_dirty(state->bg_tilemap, offset); // wrong!
}
}
static WRITE8_HANDLER( video_extra_w )
{
- laserbat_video_page = (data & 0x10) >> 4;
- sprite_info.enable = (data & 1) ^ 1;
- sprite_info.code = (data & 0xe0) >> 5;
- sprite_info.color = (data & 0x0e) >> 1;
+ laserbat_state *state = (laserbat_state *)space->machine->driver_data;
+
+ state->video_page = (data & 0x10) >> 4;
+ state->sprite_enable = (data & 1) ^ 1;
+ state->sprite_code = (data & 0xe0) >> 5;
+ state->sprite_color = (data & 0x0e) >> 1;
}
static WRITE8_HANDLER( sprite_x_y_w )
{
- if(offset == 0)
- sprite_info.x = 256 - data;
+ laserbat_state *state = (laserbat_state *)space->machine->driver_data;
+
+ if (offset == 0)
+ state->sprite_x = 256 - data;
else
- sprite_info.y = 256 - data;
+ state->sprite_y = 256 - data;
}
static WRITE8_HANDLER( laserbat_input_mux_w )
{
- laserbat_input_mux = (data & 0x30) >> 4;
+ laserbat_state *state = (laserbat_state *)space->machine->driver_data;
+
+ state->input_mux = (data & 0x30) >> 4;
flip_screen_set_no_update(space->machine, data & 0x08);
@@ -90,9 +79,10 @@ static WRITE8_HANDLER( laserbat_input_mux_w )
static READ8_HANDLER( laserbat_input_r )
{
+ laserbat_state *state = (laserbat_state *)space->machine->driver_data;
static const char *const portnames[] = { "IN0", "IN1", "IN2", "IN3" };
- return input_port_read(space->machine, portnames[laserbat_input_mux]);
+ return input_port_read(space->machine, portnames[state->input_mux]);
}
static WRITE8_HANDLER( laserbat_cnteff_w )
@@ -185,9 +175,9 @@ static ADDRESS_MAP_START( laserbat_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x7800, 0x7bff) AM_ROM
AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_WRITENOP // always 0 (bullet ram in Quasar)
- AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&s2636_0_ram)
- AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&s2636_1_ram)
- AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&s2636_2_ram)
+ AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_DEVREADWRITE("s2636_1", s2636_work_ram_r, s2636_work_ram_w)
+ AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_DEVREADWRITE("s2636_2", s2636_work_ram_r, s2636_work_ram_w)
+ AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_DEVREADWRITE("s2636_3", s2636_work_ram_r, s2636_work_ram_w)
AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_WRITE(laserbat_videoram_w)
AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM
ADDRESS_MAP_END
@@ -497,39 +487,39 @@ GFXDECODE_END
static TILE_GET_INFO( get_tile_info )
{
+ laserbat_state *state = (laserbat_state *)machine->driver_data;
+
// wrong color index!
- SET_TILE_INFO(0, machine->generic.videoram.u8[tile_index], machine->generic.colorram.u8[tile_index] & 0x7f, 0);
+ SET_TILE_INFO(0, state->videoram[tile_index], state->colorram[tile_index] & 0x7f, 0);
}
static VIDEO_START( laserbat )
{
- int screen_width = video_screen_get_width(machine->primary_screen);
- int screen_height = video_screen_get_height(machine->primary_screen);
+ laserbat_state *state = (laserbat_state *)machine->driver_data;
- bg_tilemap = tilemap_create(machine, get_tile_info,tilemap_scan_rows,8,8,32,32);
+ state->bg_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
- machine->generic.videoram.u8 = auto_alloc_array(machine, UINT8, 0x400);
- machine->generic.colorram.u8 = auto_alloc_array(machine, UINT8, 0x400);
+ state->videoram = auto_alloc_array(machine, UINT8, 0x400);
+ state->colorram = auto_alloc_array(machine, UINT8, 0x400);
- /* configure the S2636 chips */
- s2636_0 = s2636_config(machine, s2636_0_ram, screen_height, screen_width, 0, -19);
- s2636_1 = s2636_config(machine, s2636_1_ram, screen_height, screen_width, 0, -19);
- s2636_2 = s2636_config(machine, s2636_2_ram, screen_height, screen_width, 0, -19);
+ state_save_register_global_pointer(machine, state->videoram, 0x400);
+ state_save_register_global_pointer(machine, state->colorram, 0x400);
}
static VIDEO_UPDATE( laserbat )
{
+ laserbat_state *state = (laserbat_state *)screen->machine->driver_data;
int y;
- bitmap_t *s2636_0_bitmap;
bitmap_t *s2636_1_bitmap;
bitmap_t *s2636_2_bitmap;
+ bitmap_t *s2636_3_bitmap;
- tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
+ tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
- /* update the S2636 chips */
- s2636_0_bitmap = s2636_update(s2636_0, cliprect);
- s2636_1_bitmap = s2636_update(s2636_1, cliprect);
- s2636_2_bitmap = s2636_update(s2636_2, cliprect);
+ /* update the S2636 chips */
+ s2636_1_bitmap = s2636_update(state->s2636_1, cliprect);
+ s2636_2_bitmap = s2636_update(state->s2636_2, cliprect);
+ s2636_3_bitmap = s2636_update(state->s2636_3, cliprect);
/* copy the S2636 images into the main bitmap */
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
@@ -538,27 +528,27 @@ static VIDEO_UPDATE( laserbat )
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
{
- int pixel0 = *BITMAP_ADDR16(s2636_0_bitmap, y, x);
int pixel1 = *BITMAP_ADDR16(s2636_1_bitmap, y, x);
int pixel2 = *BITMAP_ADDR16(s2636_2_bitmap, y, x);
-
- if (S2636_IS_PIXEL_DRAWN(pixel0))
- *BITMAP_ADDR16(bitmap, y, x) = S2636_PIXEL_COLOR(pixel0);
+ int pixel3 = *BITMAP_ADDR16(s2636_3_bitmap, y, x);
if (S2636_IS_PIXEL_DRAWN(pixel1))
*BITMAP_ADDR16(bitmap, y, x) = S2636_PIXEL_COLOR(pixel1);
if (S2636_IS_PIXEL_DRAWN(pixel2))
*BITMAP_ADDR16(bitmap, y, x) = S2636_PIXEL_COLOR(pixel2);
+
+ if (S2636_IS_PIXEL_DRAWN(pixel3))
+ *BITMAP_ADDR16(bitmap, y, x) = S2636_PIXEL_COLOR(pixel3);
}
}
- if(sprite_info.enable)
+ if (state->sprite_enable)
drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[1],
- sprite_info.code,
- sprite_info.color,
+ state->sprite_code,
+ state->sprite_color,
0,0,
- sprite_info.x - 6,sprite_info.y,0);
+ state->sprite_x - 6,state->sprite_y,0);
return 0;
}
@@ -594,52 +584,60 @@ static const sn76477_interface laserbat_sn76477_interface =
/* Cat'N Mouse sound ***********************************/
-static WRITE_LINE_DEVICE_HANDLER( zaccaria_irq0a ) { cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE); }
-static WRITE_LINE_DEVICE_HANDLER( zaccaria_irq0b ) { cputag_set_input_line(device->machine, "audiocpu", 0, state ? ASSERT_LINE : CLEAR_LINE); }
+static WRITE_LINE_DEVICE_HANDLER( zaccaria_irq0a )
+{
+ laserbat_state *laserbat = (laserbat_state *)device->machine->driver_data;
+ cpu_set_input_line(laserbat->audiocpu, INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE);
+}
-static int active_8910,port0a;
+static WRITE_LINE_DEVICE_HANDLER( zaccaria_irq0b )
+{
+ laserbat_state *laserbat = (laserbat_state *)device->machine->driver_data;
+ cpu_set_input_line(laserbat->audiocpu, 0, state ? ASSERT_LINE : CLEAR_LINE);
+}
static READ8_DEVICE_HANDLER( zaccaria_port0a_r )
{
- return ay8910_r(devtag_get_device(device->machine, (active_8910 == 0) ? "ay1" : "ay2"), 0);
+ laserbat_state *state = (laserbat_state *)device->machine->driver_data;
+ const device_config *ay = (state->active_8910 == 0) ? state->ay1 : state->ay2;
+ return ay8910_r(ay, 0);
}
static WRITE8_DEVICE_HANDLER( zaccaria_port0a_w )
{
- port0a = data;
+ laserbat_state *state = (laserbat_state *)device->machine->driver_data;
+ state->port0a = data;
}
static WRITE8_DEVICE_HANDLER( zaccaria_port0b_w )
{
- static int last;
-
-
+ laserbat_state *state = (laserbat_state *)device->machine->driver_data;
/* bit 1 goes to 8910 #0 BDIR pin */
- if ((last & 0x02) == 0x02 && (data & 0x02) == 0x00)
+ if ((state->last_port0b & 0x02) == 0x02 && (data & 0x02) == 0x00)
{
/* bit 0 goes to the 8910 #0 BC1 pin */
- ay8910_data_address_w(devtag_get_device(device->machine, "ay1"), last >> 0, port0a);
+ ay8910_data_address_w(state->ay1, state->last_port0b >> 0, state->port0a);
}
- else if ((last & 0x02) == 0x00 && (data & 0x02) == 0x02)
+ else if ((state->last_port0b & 0x02) == 0x00 && (data & 0x02) == 0x02)
{
/* bit 0 goes to the 8910 #0 BC1 pin */
- if (last & 0x01)
- active_8910 = 0;
+ if (state->last_port0b & 0x01)
+ state->active_8910 = 0;
}
/* bit 3 goes to 8910 #1 BDIR pin */
- if ((last & 0x08) == 0x08 && (data & 0x08) == 0x00)
+ if ((state->last_port0b & 0x08) == 0x08 && (data & 0x08) == 0x00)
{
/* bit 2 goes to the 8910 #1 BC1 pin */
- ay8910_data_address_w(devtag_get_device(device->machine, "ay2"), last >> 2, port0a);
+ ay8910_data_address_w(state->ay2, state->last_port0b >> 2, state->port0a);
}
- else if ((last & 0x08) == 0x00 && (data & 0x08) == 0x08)
+ else if ((state->last_port0b & 0x08) == 0x00 && (data & 0x08) == 0x08)
{
/* bit 2 goes to the 8910 #1 BC1 pin */
- if (last & 0x04)
- active_8910 = 1;
+ if (state->last_port0b & 0x04)
+ state->active_8910 = 1;
}
- last = data;
+ state->last_port0b = data;
}
static const pia6821_interface pia_intf =
@@ -671,26 +669,116 @@ static const ay8910_interface ay8910_config =
static INTERRUPT_GEN( laserbat_interrupt )
{
- generic_pulse_irq_line_and_vector(device,0,0x0a);
+ generic_pulse_irq_line_and_vector(device, 0, 0x0a);
}
static INTERRUPT_GEN( zaccaria_cb1_toggle )
{
- const device_config *pia = devtag_get_device(device->machine, "pia");
- static int toggle;
+ laserbat_state *state = (laserbat_state *)device->machine->driver_data;
+
+ pia6821_cb1_w(state->pia, 0, state->cb1_toggle & 1);
+ state->cb1_toggle ^= 1;
+}
+
+
+static const s2636_interface s2636_1_config =
+{
+ "screen",
+ 0xff,
+ 0, -19
+};
+
+static const s2636_interface s2636_2_config =
+{
+ "screen",
+ 0xff,
+ 0, -19
+};
+
+static const s2636_interface s2636_3_config =
+{
+ "screen",
+ 0xff,
+ 0, -19
+};
- pia6821_cb1_w(pia,0,toggle & 1);
- toggle ^= 1;
+static MACHINE_START( laserbat )
+{
+ laserbat_state *state = (laserbat_state *)machine->driver_data;
+
+ state->audiocpu = devtag_get_device(machine, "audiocpu");
+ state->s2636_1 = devtag_get_device(machine, "s2636_1");
+ state->s2636_2 = devtag_get_device(machine, "s2636_2");
+ state->s2636_3 = devtag_get_device(machine, "s2636_3");
+ state->pia = devtag_get_device(machine, "pia");
+ state->sn = devtag_get_device(machine, "snsnd");
+ state->tms1 = devtag_get_device(machine, "tms1");
+ state->tms2 = devtag_get_device(machine, "tms2");
+ state->ay1 = devtag_get_device(machine, "ay1");
+ state->ay2 = devtag_get_device(machine, "ay2");
+
+ state_save_register_global(machine, state->video_page);
+ state_save_register_global(machine, state->input_mux);
+ state_save_register_global(machine, state->active_8910);
+ state_save_register_global(machine, state->port0a);
+ state_save_register_global(machine, state->last_port0b);
+ state_save_register_global(machine, state->cb1_toggle);
+ state_save_register_global(machine, state->sprite_x);
+ state_save_register_global(machine, state->sprite_y);
+ state_save_register_global(machine, state->sprite_code);
+ state_save_register_global(machine, state->sprite_color);
+ state_save_register_global(machine, state->sprite_enable);
+ state_save_register_global(machine, state->csound1);
+ state_save_register_global(machine, state->ksound1);
+ state_save_register_global(machine, state->ksound2);
+ state_save_register_global(machine, state->ksound3);
+ state_save_register_global(machine, state->degr);
+ state_save_register_global(machine, state->filt);
+ state_save_register_global(machine, state->a);
+ state_save_register_global(machine, state->us);
+ state_save_register_global(machine, state->bit14);
}
+static MACHINE_RESET( laserbat )
+{
+ laserbat_state *state = (laserbat_state *)machine->driver_data;
+
+ state->video_page = 0;
+ state->input_mux = 0;
+ state->active_8910 = 0;
+ state->port0a = 0;
+ state->last_port0b = 0;
+ state->cb1_toggle = 0;
+ state->sprite_x = 0;
+ state->sprite_y = 0;
+ state->sprite_code = 0;
+ state->sprite_color = 0;
+ state->sprite_enable = 0;
+ state->csound1 = 0;
+ state->ksound1 = 0;
+ state->ksound2 = 0;
+ state->ksound3 = 0;
+ state->degr = 0;
+ state->filt = 0;
+ state->a = 0;
+ state->us = 0;
+ state->bit14 = 0;
+}
static MACHINE_DRIVER_START( laserbat )
+ /* driver data */
+ MDRV_DRIVER_DATA(laserbat_state)
+
+ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", S2650, 14318180/4) // ???
MDRV_CPU_PROGRAM_MAP(laserbat_map)
MDRV_CPU_IO_MAP(laserbat_io_map)
MDRV_CPU_VBLANK_INT("screen", laserbat_interrupt)
+ MDRV_MACHINE_START(laserbat)
+ MDRV_MACHINE_RESET(laserbat)
+
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(50)
@@ -702,6 +790,10 @@ static MACHINE_DRIVER_START( laserbat )
MDRV_GFXDECODE(laserbat)
MDRV_PALETTE_LENGTH(1024)
+ MDRV_S2636_ADD("s2636_1", s2636_1_config)
+ MDRV_S2636_ADD("s2636_2", s2636_2_config)
+ MDRV_S2636_ADD("s2636_3", s2636_3_config)
+
MDRV_VIDEO_START(laserbat)
MDRV_VIDEO_UPDATE(laserbat)
@@ -720,6 +812,10 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( catnmous )
+ /* driver data */
+ MDRV_DRIVER_DATA(laserbat_state)
+
+ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", S2650, 14318000/4) /* ? */
MDRV_CPU_PROGRAM_MAP(laserbat_map)
MDRV_CPU_IO_MAP(catnmous_io_map)
@@ -731,6 +827,9 @@ static MACHINE_DRIVER_START( catnmous )
MDRV_PIA6821_ADD("pia", pia_intf)
+ MDRV_MACHINE_START(laserbat)
+ MDRV_MACHINE_RESET(laserbat)
+
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60)
@@ -742,6 +841,10 @@ static MACHINE_DRIVER_START( catnmous )
MDRV_GFXDECODE(laserbat)
MDRV_PALETTE_LENGTH(1024)
+ MDRV_S2636_ADD("s2636_1", s2636_1_config)
+ MDRV_S2636_ADD("s2636_2", s2636_2_config)
+ MDRV_S2636_ADD("s2636_3", s2636_3_config)
+
MDRV_VIDEO_START(laserbat)
MDRV_VIDEO_UPDATE(laserbat)
@@ -932,7 +1035,7 @@ ROM_START( catnmousa )
ROM_END
-GAME( 1981, laserbat, 0, laserbat, laserbat, 0, ROT0, "Zaccaria", "Laser Battle", GAME_IMPERFECT_SOUND | GAME_WRONG_COLORS | GAME_NO_COCKTAIL )
-GAME( 1981, lazarian, laserbat, laserbat, lazarian, 0, ROT0, "Bally Midway (Zaccaria License)", "Lazarian", GAME_IMPERFECT_SOUND | GAME_WRONG_COLORS | GAME_NO_COCKTAIL )
-GAME( 1982, catnmous, 0, catnmous, catnmous, 0, ROT90, "Zaccaria", "Cat and Mouse (set 1)", GAME_NO_SOUND | GAME_WRONG_COLORS | GAME_NO_COCKTAIL )
-GAME( 1982, catnmousa,catnmous, catnmous, catnmous, 0, ROT90, "Zaccaria", "Cat and Mouse (set 2)", GAME_NO_SOUND | GAME_WRONG_COLORS | GAME_NO_COCKTAIL | GAME_NOT_WORKING )
+GAME( 1981, laserbat, 0, laserbat, laserbat, 0, ROT0, "Zaccaria", "Laser Battle", GAME_IMPERFECT_SOUND | GAME_WRONG_COLORS | GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
+GAME( 1981, lazarian, laserbat, laserbat, lazarian, 0, ROT0, "Bally Midway (Zaccaria License)", "Lazarian", GAME_IMPERFECT_SOUND | GAME_WRONG_COLORS | GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
+GAME( 1982, catnmous, 0, catnmous, catnmous, 0, ROT90, "Zaccaria", "Cat and Mouse (set 1)", GAME_NO_SOUND | GAME_WRONG_COLORS | GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE)
+GAME( 1982, catnmousa,catnmous, catnmous, catnmous, 0, ROT90, "Zaccaria", "Cat and Mouse (set 2)", GAME_NO_SOUND | GAME_WRONG_COLORS | GAME_NO_COCKTAIL | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE)
diff --git a/src/mame/drivers/lasso.c b/src/mame/drivers/lasso.c
index 15bd516f78b..937f628d98e 100644
--- a/src/mame/drivers/lasso.c
+++ b/src/mame/drivers/lasso.c
@@ -30,34 +30,34 @@ DIP locations verified for:
#include "driver.h"
#include "cpu/m6502/m6502.h"
#include "cpu/z80/z80.h"
-#include "lasso.h"
#include "sound/dac.h"
#include "sound/sn76496.h"
#include "sound/ay8910.h"
+#include "includes/lasso.h"
static INPUT_CHANGED( coin_inserted )
{
+ lasso_state *state = (lasso_state *)field->port->machine->driver_data;
+
/* coin insertion causes an NMI */
- cputag_set_input_line(field->port->machine, "maincpu", INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
+ cpu_set_input_line(state->maincpu, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
}
/* Write to the sound latch and generate an IRQ on the sound CPU */
-
-static UINT8 *lasso_chip_data;
-
-
static WRITE8_HANDLER( sound_command_w )
{
- soundlatch_w(space,offset,data);
- generic_pulse_irq_line(cputag_get_cpu(space->machine, "audiocpu"), 0);
+ lasso_state *state = (lasso_state *)space->machine->driver_data;
+ soundlatch_w(space, offset, data);
+ generic_pulse_irq_line(state->audiocpu, 0);
}
static WRITE8_HANDLER( pinbo_sound_command_w )
{
- soundlatch_w(space,offset,data);
- cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE);
+ lasso_state *state = (lasso_state *)space->machine->driver_data;
+ soundlatch_w(space, offset, data);
+ cpu_set_input_line(state->audiocpu, 0, HOLD_LINE);
}
static READ8_HANDLER( sound_status_r )
@@ -68,24 +68,25 @@ static READ8_HANDLER( sound_status_r )
static WRITE8_HANDLER( sound_select_w )
{
- UINT8 to_write = BITSWAP8(*lasso_chip_data, 0, 1, 2, 3, 4, 5, 6, 7);
+ lasso_state *state = (lasso_state *)space->machine->driver_data;
+ UINT8 to_write = BITSWAP8(*state->chip_data, 0, 1, 2, 3, 4, 5, 6, 7);
if (~data & 0x01) /* chip #0 */
- sn76496_w(devtag_get_device(space->machine, "sn76489.1"), 0, to_write);
+ sn76496_w(state->sn_1, 0, to_write);
if (~data & 0x02) /* chip #1 */
- sn76496_w(devtag_get_device(space->machine, "sn76489.2"), 0, to_write);
+ sn76496_w(state->sn_2, 0, to_write);
}
static ADDRESS_MAP_START( lasso_main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x03ff) AM_RAM
- AM_RANGE(0x0400, 0x07ff) AM_RAM_WRITE(lasso_videoram_w) AM_BASE(&lasso_videoram)
- AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(lasso_colorram_w) AM_BASE(&lasso_colorram)
- AM_RANGE(0x0c00, 0x0c7f) AM_RAM AM_BASE(&lasso_spriteram) AM_SIZE(&lasso_spriteram_size)
+ AM_RANGE(0x0400, 0x07ff) AM_RAM_WRITE(lasso_videoram_w) AM_BASE_MEMBER(lasso_state, videoram)
+ AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(lasso_colorram_w) AM_BASE_MEMBER(lasso_state, colorram)
+ AM_RANGE(0x0c00, 0x0c7f) AM_RAM AM_BASE_SIZE_MEMBER(lasso_state, spriteram, spriteram_size)
AM_RANGE(0x1000, 0x17ff) AM_RAM AM_SHARE("share1")
AM_RANGE(0x1800, 0x1800) AM_WRITE(sound_command_w)
- AM_RANGE(0x1801, 0x1801) AM_WRITEONLY AM_BASE(&lasso_back_color)
+ AM_RANGE(0x1801, 0x1801) AM_WRITEONLY AM_BASE_MEMBER(lasso_state, back_color)
AM_RANGE(0x1802, 0x1802) AM_WRITE(lasso_video_control_w)
AM_RANGE(0x1804, 0x1804) AM_READ_PORT("1804")
AM_RANGE(0x1805, 0x1805) AM_READ_PORT("1805")
@@ -98,7 +99,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( lasso_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x01ff) AM_RAM
AM_RANGE(0x5000, 0x7fff) AM_ROM
- AM_RANGE(0xb000, 0xb000) AM_WRITEONLY AM_BASE(&lasso_chip_data)
+ AM_RANGE(0xb000, 0xb000) AM_WRITEONLY AM_BASE_MEMBER(lasso_state, chip_data)
AM_RANGE(0xb001, 0xb001) AM_WRITE(sound_select_w)
AM_RANGE(0xb004, 0xb004) AM_READ(sound_status_r)
AM_RANGE(0xb005, 0xb005) AM_READ(soundlatch_r)
@@ -108,20 +109,20 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( lasso_coprocessor_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("share1")
- AM_RANGE(0x2000, 0x3fff) AM_RAM AM_BASE(&lasso_bitmap_ram)
+ AM_RANGE(0x2000, 0x3fff) AM_RAM AM_BASE_MEMBER(lasso_state, bitmap_ram)
AM_RANGE(0x8000, 0x8fff) AM_MIRROR(0x7000) AM_ROM
ADDRESS_MAP_END
static ADDRESS_MAP_START( chameleo_main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x03ff) AM_RAM
- AM_RANGE(0x0400, 0x07ff) AM_RAM_WRITE(lasso_videoram_w) AM_BASE(&lasso_videoram)
- AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(lasso_colorram_w) AM_BASE(&lasso_colorram)
+ AM_RANGE(0x0400, 0x07ff) AM_RAM_WRITE(lasso_videoram_w) AM_BASE_MEMBER(lasso_state, videoram)
+ AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(lasso_colorram_w) AM_BASE_MEMBER(lasso_state, colorram)
AM_RANGE(0x0c00, 0x0fff) AM_RAM
- AM_RANGE(0x1000, 0x107f) AM_RAM AM_BASE(&lasso_spriteram) AM_SIZE(&lasso_spriteram_size)
+ AM_RANGE(0x1000, 0x107f) AM_RAM AM_BASE_SIZE_MEMBER(lasso_state, spriteram, spriteram_size)
AM_RANGE(0x1080, 0x10ff) AM_RAM
AM_RANGE(0x1800, 0x1800) AM_WRITE(sound_command_w)
- AM_RANGE(0x1801, 0x1801) AM_WRITEONLY AM_BASE(&lasso_back_color)
+ AM_RANGE(0x1801, 0x1801) AM_WRITEONLY AM_BASE_MEMBER(lasso_state, back_color)
AM_RANGE(0x1802, 0x1802) AM_WRITE(lasso_video_control_w)
AM_RANGE(0x1804, 0x1804) AM_READ_PORT("1804")
AM_RANGE(0x1805, 0x1805) AM_READ_PORT("1805")
@@ -136,7 +137,7 @@ static ADDRESS_MAP_START( chameleo_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x01ff) AM_RAM
AM_RANGE(0x1000, 0x1fff) AM_ROM
AM_RANGE(0x6000, 0x7fff) AM_ROM
- AM_RANGE(0xb000, 0xb000) AM_WRITEONLY AM_BASE(&lasso_chip_data)
+ AM_RANGE(0xb000, 0xb000) AM_WRITEONLY AM_BASE_MEMBER(lasso_state, chip_data)
AM_RANGE(0xb001, 0xb001) AM_WRITE(sound_select_w)
AM_RANGE(0xb004, 0xb004) AM_READ(sound_status_r)
AM_RANGE(0xb005, 0xb005) AM_READ(soundlatch_r)
@@ -146,18 +147,18 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( wwjgtin_main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM
- AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(lasso_videoram_w) AM_BASE(&lasso_videoram)
- AM_RANGE(0x0c00, 0x0fff) AM_RAM_WRITE(lasso_colorram_w) AM_BASE(&lasso_colorram)
- AM_RANGE(0x1000, 0x10ff) AM_RAM AM_BASE(&lasso_spriteram) AM_SIZE(&lasso_spriteram_size)
+ AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(lasso_videoram_w) AM_BASE_MEMBER(lasso_state, videoram)
+ AM_RANGE(0x0c00, 0x0fff) AM_RAM_WRITE(lasso_colorram_w) AM_BASE_MEMBER(lasso_state, colorram)
+ AM_RANGE(0x1000, 0x10ff) AM_RAM AM_BASE_SIZE_MEMBER(lasso_state, spriteram, spriteram_size)
AM_RANGE(0x1800, 0x1800) AM_WRITE(sound_command_w)
- AM_RANGE(0x1801, 0x1801) AM_WRITEONLY AM_BASE(&lasso_back_color)
- AM_RANGE(0x1802, 0x1802) AM_WRITE(wwjgtin_video_control_w )
+ AM_RANGE(0x1801, 0x1801) AM_WRITEONLY AM_BASE_MEMBER(lasso_state, back_color)
+ AM_RANGE(0x1802, 0x1802) AM_WRITE(wwjgtin_video_control_w)
AM_RANGE(0x1804, 0x1804) AM_READ_PORT("1804")
AM_RANGE(0x1805, 0x1805) AM_READ_PORT("1805")
AM_RANGE(0x1806, 0x1806) AM_READ_PORT("1806")
AM_RANGE(0x1807, 0x1807) AM_READ_PORT("1807")
- AM_RANGE(0x1c00, 0x1c03) AM_WRITEONLY AM_BASE(&wwjgtin_last_colors)
- AM_RANGE(0x1c04, 0x1c07) AM_WRITEONLY AM_BASE(&wwjgtin_track_scroll)
+ AM_RANGE(0x1c00, 0x1c03) AM_WRITEONLY AM_BASE_MEMBER(lasso_state, last_colors)
+ AM_RANGE(0x1c04, 0x1c07) AM_WRITEONLY AM_BASE_MEMBER(lasso_state, track_scroll)
AM_RANGE(0x4000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION("maincpu", 0x8000)
ADDRESS_MAP_END
@@ -166,7 +167,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( wwjgtin_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x01ff) AM_RAM
AM_RANGE(0x4000, 0x7fff) AM_MIRROR(0x8000) AM_ROM
- AM_RANGE(0xb000, 0xb000) AM_WRITEONLY AM_BASE(&lasso_chip_data)
+ AM_RANGE(0xb000, 0xb000) AM_WRITEONLY AM_BASE_MEMBER(lasso_state, chip_data)
AM_RANGE(0xb001, 0xb001) AM_WRITE(sound_select_w)
AM_RANGE(0xb003, 0xb003) AM_DEVWRITE("dac", dac_w)
AM_RANGE(0xb004, 0xb004) AM_READ(sound_status_r)
@@ -176,9 +177,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( pinbo_main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x03ff) AM_RAM
- AM_RANGE(0x0400, 0x07ff) AM_RAM_WRITE(lasso_videoram_w) AM_BASE(&lasso_videoram)
- AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(lasso_colorram_w) AM_BASE(&lasso_colorram)
- AM_RANGE(0x1000, 0x10ff) AM_RAM AM_BASE(&lasso_spriteram) AM_SIZE(&lasso_spriteram_size)
+ AM_RANGE(0x0400, 0x07ff) AM_RAM_WRITE(lasso_videoram_w) AM_BASE_MEMBER(lasso_state, videoram)
+ AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(lasso_colorram_w) AM_BASE_MEMBER(lasso_state, colorram)
+ AM_RANGE(0x1000, 0x10ff) AM_RAM AM_BASE_SIZE_MEMBER(lasso_state, spriteram, spriteram_size)
AM_RANGE(0x1800, 0x1800) AM_WRITE(pinbo_sound_command_w)
AM_RANGE(0x1802, 0x1802) AM_WRITE(pinbo_video_control_w)
AM_RANGE(0x1804, 0x1804) AM_READ_PORT("1804")
@@ -217,8 +218,8 @@ static INPUT_PORTS_START( lasso )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) /* lasso */
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) /* shoot */
- PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
- PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
+ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
+ PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START("1805")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
@@ -226,9 +227,9 @@ static INPUT_PORTS_START( lasso )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL
- PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
- PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL
+ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
+ PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START("1806")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:!1")
@@ -266,8 +267,8 @@ static INPUT_PORTS_START( lasso )
PORT_DIPNAME( 0x08, 0x00, "Invulnerability (Cheat)") PORT_DIPLOCATION("SW1:!6") /* Listed as "Test" */
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x08, DEF_STR( On ) )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START1 )
INPUT_PORTS_END
@@ -324,10 +325,10 @@ static INPUT_PORTS_START( wwjgtin )
PORT_DIPSETTING( 0x02, DEF_STR( On ) )
PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x00, "SW1:!5" ) /* probably unused */
PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x00, "SW1:!6" ) /* probably unused */
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
- PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START1 )
- PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START2 )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
+ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START1 )
+ PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START2 )
INPUT_PORTS_END
static INPUT_PORTS_START( pinbo )
@@ -461,8 +462,48 @@ GFXDECODE_END
+static MACHINE_START( lasso )
+{
+ lasso_state *state = (lasso_state *)machine->driver_data;
+
+ state->maincpu = devtag_get_device(machine, "maincpu");
+ state->audiocpu = devtag_get_device(machine, "audiocpu");
+ state->sn_1 = devtag_get_device(machine, "sn76489.1");
+ state->sn_2 = devtag_get_device(machine, "sn76489.2");
+
+ state_save_register_global(machine, state->gfxbank);
+}
+
+static MACHINE_START( wwjgtin )
+{
+ lasso_state *state = (lasso_state *)machine->driver_data;
+
+ MACHINE_START_CALL(lasso);
+
+ state_save_register_global(machine, state->track_enable);
+}
+
+static MACHINE_RESET( lasso )
+{
+ lasso_state *state = (lasso_state *)machine->driver_data;
+
+ state->gfxbank = 0;
+}
+
+static MACHINE_RESET( wwjgtin )
+{
+ lasso_state *state = (lasso_state *)machine->driver_data;
+
+ MACHINE_RESET_CALL(lasso);
+
+ state->track_enable = 0;
+}
+
static MACHINE_DRIVER_START( base )
+ /* driver data */
+ MDRV_DRIVER_DATA(lasso_state)
+
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M6502, 11289000/16) /* guess */
MDRV_CPU_PROGRAM_MAP(lasso_main_map)
@@ -473,6 +514,9 @@ static MACHINE_DRIVER_START( base )
MDRV_QUANTUM_TIME(HZ(6000))
+ MDRV_MACHINE_START(lasso)
+ MDRV_MACHINE_RESET(lasso)
+
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(57) /* guess, but avoids glitching of Chameleon's high score table */
@@ -531,6 +575,9 @@ static MACHINE_DRIVER_START( wwjgtin )
MDRV_CPU_MODIFY("audiocpu")
MDRV_CPU_PROGRAM_MAP(wwjgtin_audio_map)
+ MDRV_MACHINE_START(wwjgtin)
+ MDRV_MACHINE_RESET(wwjgtin)
+
/* video hardware */
MDRV_SCREEN_MODIFY("screen")
MDRV_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 2*8, 30*8-1) // Smaller visible area?
diff --git a/src/mame/drivers/lastfght.c b/src/mame/drivers/lastfght.c
index ccec91d1743..435d60872c9 100644
--- a/src/mame/drivers/lastfght.c
+++ b/src/mame/drivers/lastfght.c
@@ -66,231 +66,287 @@ Notes:
#include "deprecat.h"
#include "cpu/h83002/h8.h"
+typedef struct _lastfght_state lastfght_state;
+struct _lastfght_state
+{
+ /* memory pointers */
+ UINT8 * colorram;
+// UINT8 * nvram; // currently this uses generic nvram handling
+
+ /* video-related */
+ bitmap_t *bitmap[2];
+ int clr_offset;
+ int dest;
+ int hi, sx, sx1, dsx, sy, sy1, dsy, sp, sr;
+ int x, y, w, h;
+
+ /* misc */
+ UINT16 c00006;
+
+ /* devices */
+ const device_config *maincpu;
+};
+
+
/***************************************************************************
Video Hardware
***************************************************************************/
-static bitmap_t *lastfght_bitmap[2];
-static int clr_offset;
-static int lastfght_dest;
-
static VIDEO_START( lastfght )
{
+ lastfght_state *state = (lastfght_state *)machine->driver_data;
int i;
for (i = 0; i < 2; i++)
- lastfght_bitmap[i] = video_screen_auto_bitmap_alloc(machine->primary_screen);
+ state->bitmap[i] = video_screen_auto_bitmap_alloc(machine->primary_screen);
+
+ state->colorram = auto_alloc_array(machine, UINT8, 256 * 3);
- machine->generic.colorram.u8 = auto_alloc_array(machine, UINT8, 256*3);
+ state_save_register_global_bitmap(machine, state->bitmap[0]);
+ state_save_register_global_bitmap(machine, state->bitmap[1]);
+ state_save_register_global_pointer(machine, state->colorram, 256 * 3);
}
static VIDEO_UPDATE( lastfght )
{
+ lastfght_state *state = (lastfght_state *)screen->machine->driver_data;
+
#ifdef MAME_DEBUG
#if 1
// gfx roms viewer (toggle with enter, use pgup/down to browse)
int x, y, count = 0;
static unsigned base = 0;
static int view_roms = 0;
- UINT8 *gfxdata = memory_region( screen->machine, "gfx1" );
+ UINT8 *gfxdata = memory_region(screen->machine, "gfx1");
UINT8 data;
- if ( input_code_pressed_once(screen->machine, KEYCODE_ENTER) ) view_roms ^= 1;
- if ( view_roms )
+ if (input_code_pressed_once(screen->machine, KEYCODE_ENTER)) view_roms ^= 1;
+ if (view_roms)
{
- if ( input_code_pressed_once(screen->machine, KEYCODE_PGDN) ) base += 512 * 256;
- if ( input_code_pressed_once(screen->machine, KEYCODE_PGUP) ) base -= 512 * 256;
- base %= memory_region_length( screen->machine, "gfx1" );
+ if (input_code_pressed_once(screen->machine, KEYCODE_PGDN)) base += 512 * 256;
+ if (input_code_pressed_once(screen->machine, KEYCODE_PGUP)) base -= 512 * 256;
+ base %= memory_region_length(screen->machine, "gfx1");
count = base;
- bitmap_fill( bitmap, cliprect , get_black_pen(screen->machine));
- for ( y = 0 ; y < 256; y++ )
+ bitmap_fill(bitmap, cliprect , get_black_pen(screen->machine));
+ for (y = 0 ; y < 256; y++)
{
- for ( x = 0; x < 512; x++ )
+ for (x = 0; x < 512; x++)
{
- data = ( ((count&0xf)==0)&&((count&0x1e00)==0) )? get_white_pen(screen->machine) : gfxdata[count]; // white grid or data
+ data = (((count & 0xf) == 0) && ((count & 0x1e00) == 0)) ? get_white_pen(screen->machine) : gfxdata[count]; // white grid or data
*BITMAP_ADDR16(bitmap, y, x) = data;
count++;
}
}
- popmessage("%x",base);
+ popmessage("%x", base);
return 0;
}
#endif
#endif
- copybitmap(bitmap,lastfght_bitmap[lastfght_dest^1],0,0,0,0,cliprect);
+ copybitmap(bitmap, state->bitmap[state->dest ^ 1], 0, 0, 0, 0, cliprect);
return 0;
}
// Palette: HMC HM86171 VGA 256 colour RAMDAC
-static WRITE16_HANDLER(colordac_w)
+static WRITE16_HANDLER( colordac_w )
{
+ lastfght_state *state = (lastfght_state *)space->machine->driver_data;
+
if (ACCESSING_BITS_0_7)
{
- space->machine->generic.colorram.u8[clr_offset] = data;
- palette_set_color_rgb(space->machine, clr_offset/3,
- pal6bit(space->machine->generic.colorram.u8[(clr_offset/3)*3+0]),
- pal6bit(space->machine->generic.colorram.u8[(clr_offset/3)*3+1]),
- pal6bit(space->machine->generic.colorram.u8[(clr_offset/3)*3+2])
+ state->colorram[state->clr_offset] = data;
+ palette_set_color_rgb(space->machine, state->clr_offset / 3,
+ pal6bit(state->colorram[(state->clr_offset / 3) * 3 + 0]),
+ pal6bit(state->colorram[(state->clr_offset / 3) * 3 + 1]),
+ pal6bit(state->colorram[(state->clr_offset / 3) * 3 + 2])
);
- clr_offset = (clr_offset+1) % (256*3);
+ state->clr_offset = (state->clr_offset + 1) % (256 * 3);
}
-
if (ACCESSING_BITS_8_15)
{
- clr_offset = (data>>8) * 3;
+ state->clr_offset = (data >> 8) * 3;
}
}
// Blitter (supports zooming)
-static int lastfght_hi, lastfght_sx, lastfght_sx1, lastfght_dsx, lastfght_sy, lastfght_sy1, lastfght_dsy, lastfght_sp, lastfght_sr;
-static int lastfght_x, lastfght_y, lastfght_w, lastfght_h;
-
// high byte of a 16 bit register
static WRITE16_HANDLER( lastfght_hi_w )
{
- if (ACCESSING_BITS_8_15) logerror("%06x: 600000.b = %02x\n", cpu_get_pc(space->cpu),data>>8);
+ lastfght_state *state = (lastfght_state *)space->machine->driver_data;
+
+ if (ACCESSING_BITS_8_15)
+ logerror("%06x: 600000.b = %02x\n", cpu_get_pc(space->cpu), data >> 8);
if (ACCESSING_BITS_0_7)
{
- lastfght_hi = data << 8;
- //logerror("%06x: lastfght_hi = %02x\n", cpu_get_pc(space->cpu),data);
+ state->hi = data << 8;
+ //logerror("%06x: lastfght_hi = %02x\n", cpu_get_pc(space->cpu), data);
}
}
+
// screen x
static WRITE16_HANDLER( lastfght_x_w )
{
- if (ACCESSING_BITS_8_15) logerror("%06x: 800008.b = %02x\n", cpu_get_pc(space->cpu),data>>8);
+ lastfght_state *state = (lastfght_state *)space->machine->driver_data;
+
+ if (ACCESSING_BITS_8_15)
+ logerror("%06x: 800008.b = %02x\n", cpu_get_pc(space->cpu), data >> 8);
if (ACCESSING_BITS_0_7)
{
- lastfght_x = lastfght_hi | data;
+ state->x = state->hi | data;
//logerror("%06x: lastfght_x = %02x\n", cpu_get_pc(space->cpu),data);
}
}
+
// screen y, screen width - 1
static WRITE16_HANDLER( lastfght_yw_w )
{
+ lastfght_state *state = (lastfght_state *)space->machine->driver_data;
+
if (ACCESSING_BITS_8_15)
{
- lastfght_y = lastfght_hi | (data >> 8);
- //logerror("%06x: lastfght_y = %02x\n", cpu_get_pc(space->cpu),data>>8);
+ state->y = state->hi | (data >> 8);
+ //logerror("%06x: lastfght_y = %02x\n", cpu_get_pc(space->cpu), data >> 8);
}
if (ACCESSING_BITS_0_7)
{
- lastfght_w = lastfght_hi | data;
- //logerror("%06x: lastfght_w = %02x\n", cpu_get_pc(space->cpu),data);
+ state->w = state->hi | data;
+ //logerror("%06x: lastfght_w = %02x\n", cpu_get_pc(space->cpu), data);
}
}
+
// screen height - 1
static WRITE16_HANDLER( lastfght_h_w )
{
+ lastfght_state *state = (lastfght_state *)space->machine->driver_data;
+
if (ACCESSING_BITS_8_15)
{
- lastfght_h = lastfght_hi | (data >> 8);
- //logerror("%06x: lastfght_h = %02x\n", cpu_get_pc(space->cpu),data>>8);
+ state->h = state->hi | (data >> 8);
+ //logerror("%06x: lastfght_h = %02x\n", cpu_get_pc(space->cpu), data >> 8);
}
- if (ACCESSING_BITS_0_7) logerror("%06x: 80000d.b = %02x\n", cpu_get_pc(space->cpu),data);
+ if (ACCESSING_BITS_0_7)
+ logerror("%06x: 80000d.b = %02x\n", cpu_get_pc(space->cpu), data);
}
+
// source delta x << 6, source x << 6
static WRITE16_HANDLER( lastfght_sx_w )
{
+ lastfght_state *state = (lastfght_state *)space->machine->driver_data;
+
if (ACCESSING_BITS_8_15)
{
- lastfght_dsx = lastfght_hi | (data >> 8);
- //logerror("%06x: lastfght_dsx = %02x\n", cpu_get_pc(space->cpu),data>>8);
+ state->dsx = state->hi | (data >> 8);
+ //logerror("%06x: lastfght_dsx = %02x\n", cpu_get_pc(space->cpu), data >> 8);
}
if (ACCESSING_BITS_0_7)
{
- lastfght_sx = lastfght_hi | data;
- //logerror("%06x: lastfght_sx = %02x\n", cpu_get_pc(space->cpu),data);
+ state->sx = state->hi | data;
+ //logerror("%06x: lastfght_sx = %02x\n", cpu_get_pc(space->cpu), data);
}
}
+
// source y << 6, source y1 << 6
static WRITE16_HANDLER( lastfght_sy_w )
{
+ lastfght_state *state = (lastfght_state *)space->machine->driver_data;
+
if (ACCESSING_BITS_8_15)
{
- lastfght_sy = lastfght_hi | (data >> 8);
- //logerror("%06x: lastfght_sy = %02x\n", cpu_get_pc(space->cpu),data>>8);
+ state->sy = state->hi | (data >> 8);
+ //logerror("%06x: lastfght_sy = %02x\n", cpu_get_pc(space->cpu), data >> 8);
}
if (ACCESSING_BITS_0_7)
{
- lastfght_sy1 = lastfght_hi | data;
- //logerror("%06x: lastfght_sy1 = %02x\n", cpu_get_pc(space->cpu),data);
+ state->sy1 = state->hi | data;
+ //logerror("%06x: lastfght_sy1 = %02x\n", cpu_get_pc(space->cpu), data);
}
}
+
// source rom (0x200000 bytes), source page (512x256 bytes)
static WRITE16_HANDLER( lastfght_sr_w )
{
+ lastfght_state *state = (lastfght_state *)space->machine->driver_data;
+
if (ACCESSING_BITS_8_15)
{
- lastfght_sp = (lastfght_hi>>8) >> 4;
- //logerror("%06x: lastfght_sp = %02x\n", cpu_get_pc(space->cpu),data>>8);
+ state->sp = (state->hi >> 8) >> 4;
+ //logerror("%06x: lastfght_sp = %02x\n", cpu_get_pc(space->cpu), data >> 8);
}
if (ACCESSING_BITS_0_7)
{
- lastfght_sr = data;
- //logerror("%06x: lastfght_sr = %02x\n", cpu_get_pc(space->cpu),data);
+ state->sr = data;
+ //logerror("%06x: lastfght_sr = %02x\n", cpu_get_pc(space->cpu), data);
}
}
+
// source x1 << 6, source delta y << 6
static WRITE16_HANDLER( lastfght_sd_w )
{
+ lastfght_state *state = (lastfght_state *)space->machine->driver_data;
+
if (ACCESSING_BITS_8_15)
{
- lastfght_sx1 = lastfght_hi | (data >> 8);
- //logerror("%06x: lastfght_sx1 = %02x\n", cpu_get_pc(space->cpu),data>>8);
+ state->sx1 = state->hi | (data >> 8);
+ //logerror("%06x: lastfght_sx1 = %02x\n", cpu_get_pc(space->cpu), data >> 8);
}
if (ACCESSING_BITS_0_7)
{
- lastfght_dsy = lastfght_hi | data;
- //logerror("%06x: lastfght_dsy = %02x\n", cpu_get_pc(space->cpu),data);
+ state->dsy = state->hi | data;
+ //logerror("%06x: lastfght_dsy = %02x\n", cpu_get_pc(space->cpu), data);
}
}
+
// start blit
static WRITE16_HANDLER( lastfght_blit_w )
{
+ lastfght_state *state = (lastfght_state *)space->machine->driver_data;
+
if (ACCESSING_BITS_8_15)
{
- int x,y, addr;
+ int x, y, addr;
UINT8 *gfxdata = memory_region( space->machine, "gfx1" );
- bitmap_t *dest = lastfght_bitmap[lastfght_dest];
+ bitmap_t *dest = state->bitmap[state->dest];
#if 0
logerror("%06x: blit x %03x, y %03x, w %03x, h %03x, sx %03x.%02x, sx1 %03x.%02x, dsx %03x.%02x, sy %03x.%02x, sy1 %03x.%02x, dsy %03x.%02x, sp %02x, sr %02x, data %02x\n", cpu_get_pc(space->cpu),
- lastfght_x,lastfght_y,lastfght_w+1,lastfght_h+1,
- lastfght_sx>>6,lastfght_sx&0x3f, lastfght_sx1>>6,lastfght_dsx&0x3f, lastfght_sx1>>6,lastfght_sx1&0x3f,
- lastfght_sy>>6,lastfght_sy&0x3f, lastfght_sy1>>6,lastfght_dsy&0x3f, lastfght_sy1>>6,lastfght_sy1&0x3f,
- lastfght_sp,lastfght_sr,
- data>>8 );
+ state->x, state->y, state->w + 1, state->h + 1,
+ state->sx >> 6, state->sx & 0x3f, state->sx1 >> 6, state->dsx & 0x3f, state->sx1 >> 6, state->sx1 & 0x3f,
+ state->sy >> 6, state->sy & 0x3f, state->sy1 >> 6, state->dsy & 0x3f, state->sy1 >> 6, state->sy1 & 0x3f,
+ state->sp, state->sr,
+ data >> 8);
#endif
- for (y = 0; y <= lastfght_h; y++)
+ for (y = 0; y <= state->h; y++)
{
- for (x = 0; x <= lastfght_w; x++)
+ for (x = 0; x <= state->w; x++)
{
- addr = (( (lastfght_sx + lastfght_sx1 + lastfght_dsx * x) >> 6 ) & 0x1ff) +
- (( (lastfght_sy + lastfght_sy1 + lastfght_dsy * y) >> 6 ) & 0xff ) * 0x200 +
- lastfght_sp * 0x200 * 0x100 +
- lastfght_sr * 0x200000;
+ addr = (((state->sx + state->sx1 + state->dsx * x) >> 6) & 0x1ff) +
+ (((state->sy + state->sy1 + state->dsy * y) >> 6) & 0xff) * 0x200 +
+ state->sp * 0x200 * 0x100 + state->sr * 0x200000;
- data = gfxdata[addr];
+ data = gfxdata[addr];
- if (data && (lastfght_x + x >= 0) && (lastfght_x + x < 512) && (lastfght_y + y >= 0) && (lastfght_y + y < 256))
- *BITMAP_ADDR16(dest, lastfght_y + y, lastfght_x + x) = data;
+ if (data && (state->x + x >= 0) && (state->x + x < 512) && (state->y + y >= 0) && (state->y + y < 256))
+ *BITMAP_ADDR16(dest, state->y + y, state->x + x) = data;
}
}
}
- if (ACCESSING_BITS_0_7) logerror("%06x: 600007.b = %02x\n", cpu_get_pc(space->cpu),data);
+ if (ACCESSING_BITS_0_7)
+ logerror("%06x: 600007.b = %02x\n", cpu_get_pc(space->cpu), data);
}
+
// toggle framebuffer
static WRITE16_HANDLER( lastfght_dest_w )
{
- if (ACCESSING_BITS_0_7) lastfght_dest ^= 1;
+ lastfght_state *state = (lastfght_state *)space->machine->driver_data;
+
+ if (ACCESSING_BITS_0_7)
+ state->dest ^= 1;
}
static READ16_HANDLER( lastfght_c00000_r )
@@ -324,9 +380,9 @@ static READ16_HANDLER( lastfght_c00006_r )
static WRITE16_HANDLER( lastfght_c00006_w )
{
- static UINT16 val = 0;
- COMBINE_DATA(&val);
-// popmessage("%04x",val);
+ lastfght_state *state = (lastfght_state *)space->machine->driver_data;
+ COMBINE_DATA(&state->c00006);
+ // popmessage("%04x", state->c00006);
}
static READ16_HANDLER( lastfght_sound_r )
@@ -338,8 +394,10 @@ static READ16_HANDLER( lastfght_sound_r )
static WRITE16_HANDLER( lastfght_sound_w )
{
- if (ACCESSING_BITS_8_15) logerror("%06x: sound_w msb = %02x\n", cpu_get_pc(space->cpu),data>>8);
- if (ACCESSING_BITS_0_7) logerror("%06x: sound_w lsb = %02x\n", cpu_get_pc(space->cpu),data);
+ if (ACCESSING_BITS_8_15)
+ logerror("%06x: sound_w msb = %02x\n", cpu_get_pc(space->cpu), data >> 8);
+ if (ACCESSING_BITS_0_7)
+ logerror("%06x: sound_w lsb = %02x\n", cpu_get_pc(space->cpu), data);
}
/***************************************************************************
@@ -449,24 +507,79 @@ INPUT_PORTS_END
static INTERRUPT_GEN( unknown_interrupt )
{
+ lastfght_state *state = (lastfght_state *)device->machine->driver_data;
switch (cpu_getiloops(device))
{
case 0:
generic_pulse_irq_line(device, 0);
break;
default:
- cputag_set_input_line(device->machine, "maincpu", H8_METRO_TIMER_HACK, HOLD_LINE);
+ cpu_set_input_line(state->maincpu, H8_METRO_TIMER_HACK, HOLD_LINE);
break;
}
}
+static MACHINE_START( lastfght )
+{
+ lastfght_state *state = (lastfght_state *)machine->driver_data;
+
+ state->maincpu = devtag_get_device(machine, "maincpu");
+
+ state_save_register_global(machine, state->clr_offset);
+ state_save_register_global(machine, state->dest);
+ state_save_register_global(machine, state->hi);
+ state_save_register_global(machine, state->sx);
+ state_save_register_global(machine, state->sx1);
+ state_save_register_global(machine, state->dsx);
+ state_save_register_global(machine, state->sy);
+ state_save_register_global(machine, state->sy1);
+ state_save_register_global(machine, state->dsy);
+ state_save_register_global(machine, state->sp);
+ state_save_register_global(machine, state->sr);
+ state_save_register_global(machine, state->x);
+ state_save_register_global(machine, state->y);
+ state_save_register_global(machine, state->w);
+ state_save_register_global(machine, state->h);
+ state_save_register_global(machine, state->c00006);
+}
+
+static MACHINE_RESET( lastfght )
+{
+ lastfght_state *state = (lastfght_state *)machine->driver_data;
+
+ state->clr_offset = 0;
+ state->dest = 0;
+ state->hi = 0;
+ state->sx = 0;
+ state->sx1 = 0;
+ state->dsx = 0;
+ state->sy = 0;
+ state->sy1 = 0;
+ state->dsy = 0;
+ state->sp = 0;
+ state->sr = 0;
+ state->x = 0;
+ state->y = 0;
+ state->w = 0;
+ state->h = 0;
+ state->c00006 = 0;
+}
+
static MACHINE_DRIVER_START( lastfght )
+
+ /* driver data */
+ MDRV_DRIVER_DATA(lastfght_state)
+
+ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", H83044, 32000000/2)
MDRV_CPU_PROGRAM_MAP( lastfght_map)
MDRV_CPU_VBLANK_INT_HACK(unknown_interrupt,2)
MDRV_NVRAM_HANDLER(generic_0fill)
+ MDRV_MACHINE_START(lastfght)
+ MDRV_MACHINE_RESET(lastfght)
+
/* video hardware */
MDRV_PALETTE_LENGTH( 256 )
@@ -504,10 +617,10 @@ static DRIVER_INIT(lastfght)
UINT16 *rom = (UINT16*)memory_region(machine, "maincpu");
// pass initial check (protection ? hw?)
- rom[0x00354/2] = 0x403e;
+ rom[0x00354 / 2] = 0x403e;
// rts -> rte
- rom[0x01b86/2] = 0x5670;
+ rom[0x01b86 / 2] = 0x5670;
}
-GAME(2000, lastfght, 0, lastfght, lastfght, lastfght, ROT0, "Subsino", "Last Fighting", GAME_NO_SOUND)
+GAME( 2000, lastfght, 0, lastfght, lastfght, lastfght, ROT0, "Subsino", "Last Fighting", GAME_NO_SOUND | GAME_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/lazercmd.c b/src/mame/drivers/lazercmd.c
index 2313c60d1d2..cb06258ea66 100644
--- a/src/mame/drivers/lazercmd.c
+++ b/src/mame/drivers/lazercmd.c
@@ -222,9 +222,9 @@
#include "driver.h"
#include "deprecat.h"
-#include "lazercmd.h"
#include "cpu/s2650/s2650.h"
#include "sound/dac.h"
+#include "includes/lazercmd.h"
#include "rendlay.h"
#include "lazercmd.lh"
@@ -232,32 +232,29 @@
#define MASTER_CLOCK XTAL_8MHz
/*************************************************************
- *
- * Statics
- *
- *************************************************************/
-static int timer_count = 0;
-
-/*************************************************************
* Interrupt for the cpu
* Fake something toggling the sense input line of the S2650
* The rate should be at about 1 Hz
*************************************************************/
+
static INTERRUPT_GEN( lazercmd_timer )
{
- static int sense_state = 0;
+ lazercmd_state *state = (lazercmd_state *)device->machine->driver_data;
- if( ++timer_count >= 64*128 ) {
- timer_count = 0;
- sense_state ^= 1;
- cpu_set_input_line(device, 1, (sense_state) ? ASSERT_LINE : CLEAR_LINE );
+ if (++state->timer_count >= 64 * 128)
+ {
+ state->timer_count = 0;
+ state->sense_state ^= 1;
+ cpu_set_input_line(device, 1, (state->sense_state) ? ASSERT_LINE : CLEAR_LINE);
}
}
static INTERRUPT_GEN( bbonk_timer )
{
- if( ++timer_count >= 64*128 )
- timer_count = 0;
+ lazercmd_state *state = (lazercmd_state *)device->machine->driver_data;
+
+ if (++state->timer_count >= 64 * 128)
+ state->timer_count = 0;
}
/*************************************************************
@@ -274,7 +271,7 @@ static WRITE8_HANDLER( lazercmd_ctrl_port_w )
/* triggered by REDC,r opcode */
static READ8_HANDLER( lazercmd_ctrl_port_r )
{
- int data = 0;
+ UINT8 data = 0;
return data;
}
@@ -286,33 +283,28 @@ static WRITE8_HANDLER( lazercmd_data_port_w )
/* triggered by REDD,r opcode */
static READ8_HANDLER( lazercmd_data_port_r )
{
- int data;
- data = input_port_read(space->machine, "DSW") & 0x0f;
+ UINT8 data = input_port_read(space->machine, "DSW") & 0x0f;
return data;
}
static WRITE8_HANDLER( lazercmd_hardware_w )
{
- static int DAC_data = 0;
+ lazercmd_state *state = (lazercmd_state *)space->machine->driver_data;
switch (offset)
{
case 0: /* audio channels */
- DAC_data=(data&0x80)^((data&0x40)<<1)^((data&0x20)<<2)^((data&0x10)<<3);
- if (DAC_data)
- {
- dac_data_w(devtag_get_device(space->machine, "dac"), 0xff);
- }
+ state->dac_data = (data & 0x80) ^ ((data & 0x40) << 1) ^ ((data & 0x20) << 2) ^ ((data & 0x10) << 3);
+ if (state->dac_data)
+ dac_data_w(state->dac, 0xff);
else
- {
- dac_data_w(devtag_get_device(space->machine, "dac"), 0);
- }
+ dac_data_w(state->dac, 0);
break;
case 1: /* marker Y position */
- marker_y = data;
+ state->marker_y = data;
break;
case 2: /* marker X position */
- marker_x = data;
+ state->marker_x = data;
break;
case 3: /* D4 clears coin detected and D0 toggles on attract mode */
break;
@@ -321,7 +313,7 @@ static WRITE8_HANDLER( lazercmd_hardware_w )
static WRITE8_HANDLER( medlanes_hardware_w )
{
- static int DAC_data = 0;
+ lazercmd_state *state = (lazercmd_state *)space->machine->driver_data;
switch (offset)
{
@@ -329,21 +321,17 @@ static WRITE8_HANDLER( medlanes_hardware_w )
/* bits 4 and 5 are used to control a sound board */
/* these could be used to control sound samples */
/* at the moment they are routed through the dac */
- DAC_data=((data&0x20)<<2)^((data&0x10)<<3);
- if (DAC_data)
- {
- dac_data_w(devtag_get_device(space->machine, "dac"), 0xff);
- }
+ state->dac_data = ((data & 0x20) << 2) ^ ((data & 0x10) << 3);
+ if (state->dac_data)
+ dac_data_w(state->dac, 0xff);
else
- {
- dac_data_w(devtag_get_device(space->machine, "dac"), 0);
- }
+ dac_data_w(state->dac, 0);
break;
case 1: /* marker Y position */
- marker_y = data;
+ state->marker_y = data;
break;
case 2: /* marker X position */
- marker_x = data;
+ state->marker_x = data;
break;
case 3: /* D4 clears coin detected and D0 toggles on attract mode */
break;
@@ -352,7 +340,7 @@ static WRITE8_HANDLER( medlanes_hardware_w )
static WRITE8_HANDLER( bbonk_hardware_w )
{
- static int DAC_data = 0;
+ lazercmd_state *state = (lazercmd_state *)space->machine->driver_data;
switch (offset)
{
@@ -360,15 +348,11 @@ static WRITE8_HANDLER( bbonk_hardware_w )
/* bits 4 and 5 are used to control a sound board */
/* these could be used to control sound samples */
/* at the moment they are routed through the dac */
- DAC_data=((data&0x20)<<2)^((data&0x10)<<3);
- if (DAC_data)
- {
- dac_data_w(devtag_get_device(space->machine, "dac"), 0xff);
- }
+ state->dac_data = ((data & 0x20) << 2) ^ ((data & 0x10) << 3);
+ if (state->dac_data)
+ dac_data_w(state->dac, 0xff);
else
- {
- dac_data_w(devtag_get_device(space->machine, "dac"), 0);
- }
+ dac_data_w(state->dac, 0);
break;
case 3: /* D4 clears coin detected and D0 toggles on attract mode */
break;
@@ -377,7 +361,8 @@ static WRITE8_HANDLER( bbonk_hardware_w )
static READ8_HANDLER( lazercmd_hardware_r )
{
- int data = 0;
+ lazercmd_state *state = (lazercmd_state *)space->machine->driver_data;
+ UINT8 data = 0;
switch (offset)
{
@@ -394,16 +379,17 @@ static READ8_HANDLER( lazercmd_hardware_r )
data = input_port_read(space->machine, "IN2");
break;
case 4: /* vertical scan counter */
- data = ((timer_count&0x10)>>1)|((timer_count&0x20)>>3)|((timer_count&0x40)>>5)|((timer_count&0x80)>>7);
+ data = ((state->timer_count & 0x10) >> 1) | ((state->timer_count & 0x20) >> 3)
+ | ((state->timer_count & 0x40) >> 5) | ((state->timer_count & 0x80) >> 7);
break;
case 5: /* vertical scan counter */
- data = timer_count & 0x0f;
+ data = state->timer_count & 0x0f;
break;
case 6: /* 1f02 readback */
- data = marker_x;
+ data = state->marker_x;
break;
case 7: /* 1f01 readback */
- data = marker_y;
+ data = state->marker_y;
break;
}
return data;
@@ -419,7 +405,7 @@ static READ8_HANDLER( lazercmd_hardware_r )
static ADDRESS_MAP_START( lazercmd_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0bff) AM_ROM
AM_RANGE(0x1c00, 0x1c1f) AM_RAM
- AM_RANGE(0x1c20, 0x1eff) AM_RAM AM_BASE_GENERIC(videoram) AM_SIZE_GENERIC(videoram)
+ AM_RANGE(0x1c20, 0x1eff) AM_RAM AM_BASE_SIZE_MEMBER(lazercmd_state, videoram, videoram_size)
AM_RANGE(0x1f00, 0x1f03) AM_WRITE(lazercmd_hardware_w)
AM_RANGE(0x1f00, 0x1f07) AM_READ(lazercmd_hardware_r)
ADDRESS_MAP_END
@@ -429,7 +415,7 @@ static ADDRESS_MAP_START( medlanes_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0bff) AM_ROM
AM_RANGE(0x1000, 0x17ff) AM_ROM
AM_RANGE(0x1c00, 0x1c1f) AM_RAM
- AM_RANGE(0x1c20, 0x1eff) AM_RAM AM_BASE_GENERIC(videoram) AM_SIZE_GENERIC(videoram)
+ AM_RANGE(0x1c20, 0x1eff) AM_RAM AM_BASE_SIZE_MEMBER(lazercmd_state, videoram, videoram_size)
AM_RANGE(0x1f00, 0x1f03) AM_WRITE(medlanes_hardware_w)
AM_RANGE(0x1f00, 0x1f07) AM_READ(lazercmd_hardware_r)
ADDRESS_MAP_END
@@ -438,7 +424,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( bbonk_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0bff) AM_ROM
AM_RANGE(0x1c00, 0x1c1f) AM_RAM
- AM_RANGE(0x1c20, 0x1eff) AM_RAM AM_BASE_GENERIC(videoram) AM_SIZE_GENERIC(videoram)
+ AM_RANGE(0x1c20, 0x1eff) AM_RAM AM_BASE_SIZE_MEMBER(lazercmd_state, videoram, videoram_size)
AM_RANGE(0x1f00, 0x1f03) AM_WRITE(bbonk_hardware_w)
AM_RANGE(0x1f00, 0x1f07) AM_READ(lazercmd_hardware_r)
ADDRESS_MAP_END
@@ -452,47 +438,47 @@ ADDRESS_MAP_END
static INPUT_PORTS_START( lazercmd )
- PORT_START("IN0") /* IN0 player 1 controls */
+ PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_START("IN1") /* IN1 player 2 controls */
+ PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_START("DSW") /* IN2 dip switch */
+ PORT_START("DSW")
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Game_Time ) )
- PORT_DIPSETTING( 0x00, "60 seconds" )
- PORT_DIPSETTING( 0x01, "90 seconds" )
- PORT_DIPSETTING( 0x02, "120 seconds" )
- PORT_DIPSETTING( 0x03, "180 seconds" )
+ PORT_DIPSETTING( 0x00, "60 seconds" )
+ PORT_DIPSETTING( 0x01, "90 seconds" )
+ PORT_DIPSETTING( 0x02, "120 seconds" )
+ PORT_DIPSETTING( 0x03, "180 seconds" )
PORT_BIT( 0x18, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_DIPNAME( 0x20, 0x20, "Video Invert" )
- PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x20, DEF_STR( On ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x20, DEF_STR( On ) )
PORT_DIPNAME( 0x40, 0x40, "Marker Size" )
- PORT_DIPSETTING( 0x00, "Small" )
- PORT_DIPSETTING( 0x40, "Large" )
+ PORT_DIPSETTING( 0x00, "Small" )
+ PORT_DIPSETTING( 0x40, "Large" )
// PORT_DIPNAME( 0x80, 0x80, "Color Overlay" )
// PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
// PORT_DIPSETTING( 0x80, DEF_STR( On ) )
- PORT_START("IN2") /* IN3 coinage & start */
+ PORT_START("IN2")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coinage ) )
- PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) )
- PORT_DIPSETTING( 0x01, DEF_STR( 1C_1C ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) )
+ PORT_DIPSETTING( 0x01, DEF_STR( 1C_1C ) )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )
- PORT_START("IN3") /* IN4 player 1 + 2 buttons */
+ PORT_START("IN3")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
@@ -501,87 +487,87 @@ static INPUT_PORTS_START( lazercmd )
INPUT_PORTS_END
static INPUT_PORTS_START( medlanes )
- PORT_START("IN0") /* IN0 player 1 controls */
+ PORT_START("IN0")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_START("IN1") /* IN1 player 1 controls */
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Hook Left") PORT_CODE(KEYCODE_Z)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Hook Right") PORT_CODE(KEYCODE_X)
- PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED)
+ PORT_START("IN1")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Hook Left") PORT_CODE(KEYCODE_Z)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Hook Right") PORT_CODE(KEYCODE_X)
+ PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_START("DSW") /* IN2 dip switch */
+ PORT_START("DSW")
PORT_DIPNAME( 0x01, 0x01, "Game Timer" )
- PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x01, DEF_STR( On ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x01, DEF_STR( On ) )
PORT_DIPNAME( 0x02, 0x02, "Time" )
- PORT_DIPSETTING( 0x00, "3 seconds" )
- PORT_DIPSETTING( 0x02, "5 seconds" )
- PORT_BIT( 0x1C, IP_ACTIVE_LOW, IPT_UNUSED)
+ PORT_DIPSETTING( 0x00, "3 seconds" )
+ PORT_DIPSETTING( 0x02, "5 seconds" )
+ PORT_BIT( 0x1C, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_DIPNAME( 0x20, 0x00, "Video Invert" )
- PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x20, DEF_STR( On ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x20, DEF_STR( On ) )
PORT_DIPNAME( 0x40, 0x00, "Marker Size" )
- PORT_DIPSETTING( 0x00, "Small" )
- PORT_DIPSETTING( 0x40, "Large" )
+ PORT_DIPSETTING( 0x00, "Small" )
+ PORT_DIPSETTING( 0x40, "Large" )
// PORT_DIPNAME( 0x80, 0x80, "Color Overlay" )
// PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
// PORT_DIPSETTING( 0x80, DEF_STR( On ) )
- PORT_START("IN2") /* IN3 coinage & start */
+ PORT_START("IN2")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coinage ) )
- PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) )
- PORT_DIPSETTING( 0x01, DEF_STR( 1C_1C ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) )
+ PORT_DIPSETTING( 0x01, DEF_STR( 1C_1C ) )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_BIT( 0xf4, IP_ACTIVE_HIGH, IPT_UNUSED )
- PORT_START("IN3") /* IN4 not used */
+ PORT_START("IN3")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
static INPUT_PORTS_START( bbonk )
- PORT_START("IN0") /* IN0 player 1 controls */
+ PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_START("IN1") /* IN1 player 2 controls */
+ PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_START("DSW") /* IN2 dip switch */
+ PORT_START("DSW")
PORT_DIPNAME( 0x03, 0x02, "Games to win" )
- PORT_DIPSETTING( 0x02, "2" )
- PORT_DIPSETTING( 0x03, "3" )
- PORT_DIPSETTING( 0x00, "4" )
- PORT_DIPSETTING( 0x01, "5" )
- PORT_BIT( 0x1C, IP_ACTIVE_LOW, IPT_UNUSED)
+ PORT_DIPSETTING( 0x02, "2" )
+ PORT_DIPSETTING( 0x03, "3" )
+ PORT_DIPSETTING( 0x00, "4" )
+ PORT_DIPSETTING( 0x01, "5" )
+ PORT_BIT( 0x1C, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_DIPNAME( 0x20, 0x00, "Video Invert" )
- PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x20, DEF_STR( On ) )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED)
+ PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x20, DEF_STR( On ) )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
// PORT_DIPNAME( 0x80, 0x00, "Color Overlay" )
// PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
// PORT_DIPSETTING( 0x80, DEF_STR( On ) )
- PORT_START("IN2") /* IN3 coinage & start */
+ PORT_START("IN2")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coinage ) )
- PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) )
- PORT_DIPSETTING( 0x01, DEF_STR( 1C_1C ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) )
+ PORT_DIPSETTING( 0x01, DEF_STR( 1C_1C ) )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_BIT( 0xf4, IP_ACTIVE_HIGH, IPT_UNUSED )
- PORT_START("IN3") /* IN4 not used */
+ PORT_START("IN3")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
@@ -603,27 +589,59 @@ GFXDECODE_END
static PALETTE_INIT( lazercmd )
{
- palette_set_color(machine,0,MAKE_RGB(0xb0,0xb0,0xb0)); /* white */
- palette_set_color(machine,1,MAKE_RGB(0x00,0x00,0x00)); /* black */
+ palette_set_color(machine, 0, MAKE_RGB(0xb0, 0xb0, 0xb0)); /* white */
+ palette_set_color(machine, 1, MAKE_RGB(0x00, 0x00, 0x00)); /* black */
- palette_set_color(machine,2,MAKE_RGB(0x00,0x00,0x00)); /* black */
- palette_set_color(machine,3,MAKE_RGB(0xb0,0xb0,0xb0)); /* white */
+ palette_set_color(machine, 2, MAKE_RGB(0x00, 0x00, 0x00)); /* black */
+ palette_set_color(machine, 3, MAKE_RGB(0xb0, 0xb0, 0xb0)); /* white */
- palette_set_color(machine,4,MAKE_RGB(0xff,0xff,0xff)); /* bright white */
+ palette_set_color(machine, 4, MAKE_RGB(0xff, 0xff, 0xff)); /* bright white */
}
+
+static MACHINE_START( lazercmd )
+{
+ lazercmd_state *state = (lazercmd_state *)machine->driver_data;
+
+ state->dac = devtag_get_device(machine, "dac");
+
+ state_save_register_global(machine, state->marker_x);
+ state_save_register_global(machine, state->marker_y);
+ state_save_register_global(machine, state->timer_count);
+ state_save_register_global(machine, state->sense_state);
+ state_save_register_global(machine, state->dac_data);
+}
+
+static MACHINE_RESET( lazercmd )
+{
+ lazercmd_state *state = (lazercmd_state *)machine->driver_data;
+
+ state->marker_x = 0;
+ state->marker_y = 0;
+ state->timer_count = 0;
+ state->sense_state = 0;
+ state->dac_data = 0;
+}
+
+
static MACHINE_DRIVER_START( lazercmd )
+ /* driver data */
+ MDRV_DRIVER_DATA(lazercmd_state)
+
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", S2650,MASTER_CLOCK/12) /* 672 kHz? */
-/* Main Clock is 8MHz divided by 12
- but memory and IO access is only possible
- within the line and frame blanking period
- thus requiring an extra loading of approx 3-5 */
+/* Main Clock is 8MHz divided by 12
+ but memory and IO access is only possible
+ within the line and frame blanking period
+ thus requiring an extra loading of approx 3-5 */
MDRV_CPU_PROGRAM_MAP(lazercmd_map)
MDRV_CPU_IO_MAP(lazercmd_portmap)
MDRV_CPU_VBLANK_INT_HACK(lazercmd_timer, 128) /* 7680 Hz */
+ MDRV_MACHINE_START(lazercmd)
+ MDRV_MACHINE_RESET(lazercmd)
+
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60)
@@ -649,16 +667,22 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( medlanes )
+ /* driver data */
+ MDRV_DRIVER_DATA(lazercmd_state)
+
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", S2650,MASTER_CLOCK/12) /* 666 kHz */
-/* Main Clock is 8MHz divided by 12
- but memory and IO access is only possible
- within the line and frame blanking period
- thus requiring an extra loading of approx 3-5 */
+/* Main Clock is 8MHz divided by 12
+ but memory and IO access is only possible
+ within the line and frame blanking period
+ thus requiring an extra loading of approx 3-5 */
MDRV_CPU_PROGRAM_MAP(medlanes_map)
MDRV_CPU_IO_MAP(lazercmd_portmap)
MDRV_CPU_VBLANK_INT_HACK(lazercmd_timer, 128) /* 7680 Hz */
+ MDRV_MACHINE_START(lazercmd)
+ MDRV_MACHINE_RESET(lazercmd)
+
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60)
@@ -684,16 +708,22 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( bbonk )
+ /* driver data */
+ MDRV_DRIVER_DATA(lazercmd_state)
+
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", S2650,MASTER_CLOCK/12) /* 666 kHz */
-/* Main Clock is 8MHz divided by 12
- but memory and IO access is only possible
- within the line and frame blanking period
- thus requiring an extra loading of approx 3-5 */
+/* Main Clock is 8MHz divided by 12
+ but memory and IO access is only possible
+ within the line and frame blanking period
+ thus requiring an extra loading of approx 3-5 */
MDRV_CPU_PROGRAM_MAP(bbonk_map)
MDRV_CPU_IO_MAP(lazercmd_portmap)
MDRV_CPU_VBLANK_INT_HACK(bbonk_timer, 128) /* 7680 Hz */
+ MDRV_MACHINE_START(lazercmd)
+ MDRV_MACHINE_RESET(lazercmd)
+
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60)
@@ -767,8 +797,8 @@ ROM_END
static DRIVER_INIT( lazercmd )
{
-int i, y;
-UINT8 *gfx = memory_region(machine, "gfx1");
+ int i, y;
+ UINT8 *gfx = memory_region(machine, "gfx1");
/******************************************************************
* To show the maze bit #6 and #7 of the video ram are used.
@@ -785,10 +815,10 @@ UINT8 *gfx = memory_region(machine, "gfx1");
for (y = 0; y < VERT_CHR; y++)
{
- d[0*64*10] = (y < VERT_FNT) ? *s++ : 0xff;
- d[1*64*10] = (y == VERT_CHR - 1) ? 0 : *d;
- d[2*64*10] = *d & 0xfe;
- d[3*64*10] = (y == VERT_CHR - 1) ? 0 : *d & 0xfe;
+ d[0 * 64 * 10] = (y < VERT_FNT) ? *s++ : 0xff;
+ d[1 * 64 * 10] = (y == VERT_CHR - 1) ? 0 : *d;
+ d[2 * 64 * 10] = *d & 0xfe;
+ d[3 * 64 * 10] = (y == VERT_CHR - 1) ? 0 : *d & 0xfe;
d++;
}
}
@@ -796,8 +826,8 @@ UINT8 *gfx = memory_region(machine, "gfx1");
static DRIVER_INIT( medlanes )
{
-int i, y;
-UINT8 *gfx = memory_region(machine, "gfx1");
+ int i, y;
+ UINT8 *gfx = memory_region(machine, "gfx1");
/******************************************************************
* To show the maze bit #6 and #7 of the video ram are used.
@@ -814,10 +844,10 @@ UINT8 *gfx = memory_region(machine, "gfx1");
for (y = 0; y < VERT_CHR; y++)
{
- d[0*64*10] = (y < VERT_FNT) ? *s++ : 0xff;
- d[1*64*10] = (y == VERT_CHR - 1) ? 0 : *d;
- d[2*64*10] = *d & 0xfe;
- d[3*64*10] = (y == VERT_CHR - 1) ? 0 : *d & 0xfe;
+ d[0 * 64 * 10] = (y < VERT_FNT) ? *s++ : 0xff;
+ d[1 * 64 * 10] = (y == VERT_CHR - 1) ? 0 : *d;
+ d[2 * 64 * 10] = *d & 0xfe;
+ d[3 * 64 * 10] = (y == VERT_CHR - 1) ? 0 : *d & 0xfe;
d++;
}
}
@@ -825,8 +855,8 @@ UINT8 *gfx = memory_region(machine, "gfx1");
static DRIVER_INIT( bbonk )
{
-int i, y;
-UINT8 *gfx = memory_region(machine, "gfx1");
+ int i, y;
+ UINT8 *gfx = memory_region(machine, "gfx1");
/******************************************************************
* To show the maze bit #6 and #7 of the video ram are used.
@@ -843,10 +873,10 @@ UINT8 *gfx = memory_region(machine, "gfx1");
for (y = 0; y < VERT_CHR; y++)
{
- d[0*64*10] = (y < VERT_FNT) ? *s++ : 0xff;
- d[1*64*10] = (y == VERT_CHR - 1) ? 0 : *d;
- d[2*64*10] = *d & 0xfe;
- d[3*64*10] = (y == VERT_CHR - 1) ? 0 : *d & 0xfe;
+ d[0 * 64 * 10] = (y < VERT_FNT) ? *s++ : 0xff;
+ d[1 * 64 * 10] = (y == VERT_CHR - 1) ? 0 : *d;
+ d[2 * 64 * 10] = *d & 0xfe;
+ d[3 * 64 * 10] = (y == VERT_CHR - 1) ? 0 : *d & 0xfe;
d++;
}
}
@@ -854,6 +884,6 @@ UINT8 *gfx = memory_region(machine, "gfx1");
-GAMEL( 1976, lazercmd, 0, lazercmd, lazercmd, lazercmd, ROT0, "Meadows Games, Inc.", "Lazer Command", 0, layout_lazercmd )
-GAMEL( 1977, medlanes, 0, medlanes, medlanes, medlanes, ROT0, "Meadows Games, Inc.", "Meadows Lanes", GAME_IMPERFECT_SOUND, layout_ho2eff2e )
-GAME ( 1976, bbonk, 0, bbonk, bbonk, bbonk, ROT0, "Meadows Games, Inc.", "Bigfoot Bonkers", 0 )
+GAMEL( 1976, lazercmd, 0, lazercmd, lazercmd, lazercmd, ROT0, "Meadows Games, Inc.", "Lazer Command", GAME_SUPPORTS_SAVE, layout_lazercmd )
+GAMEL( 1977, medlanes, 0, medlanes, medlanes, medlanes, ROT0, "Meadows Games, Inc.", "Meadows Lanes", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE, layout_ho2eff2e )
+GAME ( 1976, bbonk, 0, bbonk, bbonk, bbonk, ROT0, "Meadows Games, Inc.", "Bigfoot Bonkers", GAME_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/lemmings.c b/src/mame/drivers/lemmings.c
index d70607af00f..b3d63334c47 100644
--- a/src/mame/drivers/lemmings.c
+++ b/src/mame/drivers/lemmings.c
@@ -18,22 +18,24 @@
#include "driver.h"
#include "cpu/m6809/m6809.h"
#include "cpu/m68000/m68000.h"
-#include "lemmings.h"
#include "sound/2151intf.h"
#include "sound/okim6295.h"
-
-/******************************************************************************/
+#include "includes/lemmings.h"
static WRITE16_HANDLER( lemmings_control_w )
{
+ lemmings_state *state = (lemmings_state *)space->machine->driver_data;
+
/* Offset==0 Pixel layer X scroll */
- if (offset==4) return; /* Watchdog or IRQ ack */
- COMBINE_DATA(&lemmings_control_data[offset]);
+ if (offset == 4)
+ return; /* Watchdog or IRQ ack */
+ COMBINE_DATA(&state->control_data[offset]);
}
static READ16_HANDLER( lemmings_trackball_r )
{
- switch (offset) {
+ switch (offset)
+ {
case 0: return input_port_read(space->machine, "AN0");
case 1: return input_port_read(space->machine, "AN1");
case 4: return input_port_read(space->machine, "AN2");
@@ -45,7 +47,8 @@ static READ16_HANDLER( lemmings_trackball_r )
/* Same as Robocop 2 protection chip */
static READ16_HANDLER( lemmings_prot_r )
{
- switch (offset<<1) {
+ switch (offset << 1)
+ {
case 0x41a:
return input_port_read(space->machine, "BUTTONS");
@@ -61,27 +64,31 @@ static READ16_HANDLER( lemmings_prot_r )
static WRITE16_HANDLER( lemmings_palette_24bit_w )
{
- int r,g,b;
+ lemmings_state *state = (lemmings_state *)space->machine->driver_data;
+ int r, g, b;
- COMBINE_DATA(&space->machine->generic.paletteram.u16[offset]);
- if (offset&1) offset--;
+ COMBINE_DATA(&state->paletteram[offset]);
+ if (offset & 1)
+ offset--;
- b = (space->machine->generic.paletteram.u16[offset] >> 0) & 0xff;
- g = (space->machine->generic.paletteram.u16[offset+1] >> 8) & 0xff;
- r = (space->machine->generic.paletteram.u16[offset+1] >> 0) & 0xff;
+ b = (state->paletteram[offset] >> 0) & 0xff;
+ g = (state->paletteram[offset + 1] >> 8) & 0xff;
+ r = (state->paletteram[offset + 1] >> 0) & 0xff;
- palette_set_color(space->machine,offset/2,MAKE_RGB(r,g,b));
+ palette_set_color(space->machine, offset / 2, MAKE_RGB(r, g, b));
}
static WRITE16_HANDLER( lemmings_sound_w )
{
- soundlatch_w(space,0,data&0xff);
- cputag_set_input_line(space->machine, "audiocpu", 1, HOLD_LINE);
+ lemmings_state *state = (lemmings_state *)space->machine->driver_data;
+ soundlatch_w(space, 0, data & 0xff);
+ cpu_set_input_line(state->audiocpu, 1, HOLD_LINE);
}
static WRITE8_HANDLER( lemmings_sound_ack_w )
{
- cputag_set_input_line(space->machine, "audiocpu", 1, CLEAR_LINE);
+ lemmings_state *state = (lemmings_state *)space->machine->driver_data;
+ cpu_set_input_line(state->audiocpu, 1, CLEAR_LINE);
}
/******************************************************************************/
@@ -91,17 +98,17 @@ static ADDRESS_MAP_START( lemmings_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x100000, 0x10ffff) AM_RAM
AM_RANGE(0x120000, 0x1207ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
AM_RANGE(0x140000, 0x1407ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram2)
- AM_RANGE(0x160000, 0x160fff) AM_RAM_WRITE(lemmings_palette_24bit_w) AM_BASE_GENERIC(paletteram)
- AM_RANGE(0x170000, 0x17000f) AM_RAM_WRITE(lemmings_control_w) AM_BASE(&lemmings_control_data)
+ AM_RANGE(0x160000, 0x160fff) AM_RAM_WRITE(lemmings_palette_24bit_w) AM_BASE_MEMBER(lemmings_state, paletteram)
+ AM_RANGE(0x170000, 0x17000f) AM_RAM_WRITE(lemmings_control_w) AM_BASE_MEMBER(lemmings_state, control_data)
AM_RANGE(0x190000, 0x19000f) AM_READ(lemmings_trackball_r)
AM_RANGE(0x1a0000, 0x1a07ff) AM_READ(lemmings_prot_r)
AM_RANGE(0x1a0064, 0x1a0065) AM_WRITE(lemmings_sound_w)
AM_RANGE(0x1c0000, 0x1c0001) AM_WRITE(buffer_spriteram16_w) /* 1 written once a frame */
AM_RANGE(0x1e0000, 0x1e0001) AM_WRITE(buffer_spriteram16_2_w) /* 1 written once a frame */
- AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(lemmings_vram_w) AM_BASE(&lemmings_vram_data)
+ AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(lemmings_vram_w) AM_BASE_MEMBER(lemmings_state, vram_data)
AM_RANGE(0x202000, 0x202fff) AM_RAM
- AM_RANGE(0x300000, 0x37ffff) AM_RAM_WRITE(lemmings_pixel_0_w) AM_BASE(&lemmings_pixel_0_data)
- AM_RANGE(0x380000, 0x39ffff) AM_RAM_WRITE(lemmings_pixel_1_w) AM_BASE(&lemmings_pixel_1_data)
+ AM_RANGE(0x300000, 0x37ffff) AM_RAM_WRITE(lemmings_pixel_0_w) AM_BASE_MEMBER(lemmings_state, pixel_0_data)
+ AM_RANGE(0x380000, 0x39ffff) AM_RAM_WRITE(lemmings_pixel_1_w) AM_BASE_MEMBER(lemmings_state, pixel_1_data)
ADDRESS_MAP_END
/******************************************************************************/
@@ -135,7 +142,7 @@ static INPUT_PORTS_START( lemmings )
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_START("SYSTEM") /* Credits */
+ PORT_START("SYSTEM")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_SERVICE_NO_TOGGLE(0x0004, IP_ACTIVE_LOW)
@@ -237,9 +244,10 @@ GFXDECODE_END
/******************************************************************************/
-static void sound_irq(const device_config *device, int state)
+static void sound_irq( const device_config *device, int state )
{
- cputag_set_input_line(device->machine, "audiocpu", 0, state);
+ lemmings_state *lemmings = (lemmings_state *)device->machine->driver_data;
+ cpu_set_input_line(lemmings->audiocpu, 0, state);
}
static const ym2151_interface ym2151_config =
@@ -247,8 +255,18 @@ static const ym2151_interface ym2151_config =
sound_irq
};
+static MACHINE_START( lemmings )
+{
+ lemmings_state *state = (lemmings_state *)machine->driver_data;
+
+ state->audiocpu = devtag_get_device(machine, "audiocpu");
+}
+
static MACHINE_DRIVER_START( lemmings )
+ /* driver data */
+ MDRV_DRIVER_DATA(lemmings_state)
+
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 14000000)
MDRV_CPU_PROGRAM_MAP(lemmings_map)
@@ -257,6 +275,8 @@ static MACHINE_DRIVER_START( lemmings )
MDRV_CPU_ADD("audiocpu", M6809,32220000/8)
MDRV_CPU_PROGRAM_MAP(sound_map)
+ MDRV_MACHINE_START(lemmings)
+
/* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
@@ -322,4 +342,4 @@ ROM_END
/******************************************************************************/
-GAME( 1991, lemmings, 0, lemmings, lemmings, 0, ROT0, "Data East USA", "Lemmings (US Prototype)", 0 )
+GAME( 1991, lemmings, 0, lemmings, lemmings, 0, ROT0, "Data East USA", "Lemmings (US Prototype)", GAME_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/malzak.c b/src/mame/drivers/malzak.c
index 5e3aaa519bb..f44c851f9da 100644
--- a/src/mame/drivers/malzak.c
+++ b/src/mame/drivers/malzak.c
@@ -75,8 +75,6 @@ extern int malzak_x;
extern int malzak_y;
extern UINT8 *saa5050_vidram; /* Video RAM for SAA 5050 */
-extern UINT8 *malzak_s2636_0_ram;
-extern UINT8 *malzak_s2636_1_ram;
// in video/malzak.c
VIDEO_START( malzak );
@@ -86,7 +84,9 @@ WRITE8_HANDLER( malzak_playfield_w );
static READ8_HANDLER( fake_VRLE_r )
{
- return (malzak_s2636_0_ram[0xcb] & 0x3f) + (video_screen_get_vblank(space->machine->primary_screen)*0x40);
+ const device_config *s2636_0 = devtag_get_device(space->machine, "s2636_0");
+
+ return (s2636_work_ram_r(s2636_0, 0xcb) & 0x3f) + (video_screen_get_vblank(space->machine->primary_screen)*0x40);
}
static READ8_HANDLER( bank_r )
@@ -125,8 +125,8 @@ static ADDRESS_MAP_START( malzak_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1200, 0x12ff) AM_MIRROR(0x6000) AM_RAM
AM_RANGE(0x1300, 0x13ff) AM_MIRROR(0x6000) AM_RAM
AM_RANGE(0x14cb, 0x14cb) AM_MIRROR(0x6000) AM_READ(fake_VRLE_r)
- AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&malzak_s2636_0_ram)
- AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&malzak_s2636_1_ram)
+ AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_DEVREADWRITE("s2636_0", s2636_work_ram_r, s2636_work_ram_w)
+ AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_DEVREADWRITE("s2636_1", s2636_work_ram_r, s2636_work_ram_w)
AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_RAM_WRITE(malzak_playfield_w)
AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_RAM
AM_RANGE(0x1800, 0x1fff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&saa5050_vidram)
@@ -146,8 +146,8 @@ static ADDRESS_MAP_START( malzak2_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1300, 0x13ff) AM_MIRROR(0x6000) AM_RAM
AM_RANGE(0x14cb, 0x14cb) AM_MIRROR(0x6000) AM_READ(fake_VRLE_r)
AM_RANGE(0x14cc, 0x14cc) AM_MIRROR(0x6000) AM_READ(s2636_portA_r)
- AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&malzak_s2636_0_ram)
- AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&malzak_s2636_1_ram)
+ AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_DEVREADWRITE("s2636_0", s2636_work_ram_r, s2636_work_ram_w)
+ AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_DEVREADWRITE("s2636_1", s2636_work_ram_r, s2636_work_ram_w)
AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_RAM_WRITE(malzak_playfield_w)
AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_RAM AM_BASE_SIZE_GENERIC(nvram)
AM_RANGE(0x1800, 0x1fff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&saa5050_vidram)
@@ -205,11 +205,11 @@ static ADDRESS_MAP_START( malzak_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x00) AM_READ(collision_r) // returns where a collision can occur.
AM_RANGE(0x40, 0x40) AM_WRITE(port40_w) // possibly sound codes for dual SN76477s
AM_RANGE(0x60, 0x60) AM_WRITE(port60_w) // possibly playfield scroll X offset
- AM_RANGE(0x80, 0x80) AM_READ_PORT("IN0") //controls
+ AM_RANGE(0x80, 0x80) AM_READ_PORT("IN0") //controls
AM_RANGE(0xa0, 0xa0) AM_WRITENOP // echoes I/O port read from port 0x80
AM_RANGE(0xc0, 0xc0) AM_WRITE(portc0_w) // possibly playfield row selection for writing and/or collisions
AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_READ(s2650_data_r) // read upon death
- AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ_PORT("SENSE")
+ AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ_PORT("SENSE")
ADDRESS_MAP_END
@@ -228,8 +228,8 @@ static INPUT_PORTS_START( malzak )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
- PORT_START("POT")
- /* No POT switch on Malzak as far as I know */
+ PORT_START("POT")
+ /* No POT switch on Malzak as far as I know */
PORT_START("SENSE") /* SENSE */
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
@@ -251,7 +251,7 @@ static INPUT_PORTS_START( malzak2 )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
- PORT_START("POT") /* Fake DIP switch to handle the POT switch */
+ PORT_START("POT") /* Fake DIP switch to handle the POT switch */
PORT_DIPNAME( 0x03, 0x00, "POT switch position" )
PORT_DIPSETTING( 0x00, "1" ) // Normal play
PORT_DIPSETTING( 0x01, "2" )
@@ -363,6 +363,20 @@ static const sn76477_interface sn76477_intf =
};
+static const s2636_interface s2636_0_config =
+{
+ "screen",
+ 0xff,
+ 0, -16 /* -8, -16 */
+};
+
+static const s2636_interface s2636_1_config =
+{
+ "screen",
+ 0xff,
+ 0, -16 /* -9, -16 */
+};
+
static MACHINE_DRIVER_START( malzak )
/* basic machine hardware */
@@ -384,7 +398,9 @@ static MACHINE_DRIVER_START( malzak )
// MDRV_MACHINE_RESET(malzak)
- MDRV_VIDEO_START(malzak)
+ MDRV_S2636_ADD("s2636_0", s2636_0_config)
+ MDRV_S2636_ADD("s2636_1", s2636_1_config)
+
MDRV_VIDEO_UPDATE(malzak)
/* sound hardware */
diff --git a/src/mame/drivers/quasar.c b/src/mame/drivers/quasar.c
index 261e23d2f34..1d338da8f06 100644
--- a/src/mame/drivers/quasar.c
+++ b/src/mame/drivers/quasar.c
@@ -153,9 +153,9 @@ static READ8_HANDLER( audio_t1_r )
static ADDRESS_MAP_START( quasar, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x13ff) AM_ROM
AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_bullet_ram_or_palette_r, quasar_bullet_w) AM_BASE(&cvs_bullet_ram)
- AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_0_or_character_ram_r, cvs_s2636_0_or_character_ram_w) AM_BASE(&cvs_s2636_0_ram)
- AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_1_or_character_ram_r, cvs_s2636_1_or_character_ram_w) AM_BASE(&cvs_s2636_1_ram)
- AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_2_or_character_ram_r, cvs_s2636_2_or_character_ram_w) AM_BASE(&cvs_s2636_2_ram)
+ AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_0_or_character_ram_r, cvs_s2636_0_or_character_ram_w)
+ AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_1_or_character_ram_r, cvs_s2636_1_or_character_ram_w)
+ AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_2_or_character_ram_r, cvs_s2636_2_or_character_ram_w)
AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READWRITE(cvs_video_or_color_ram_r, quasar_video_w) AM_BASE(&cvs_video_ram)
AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM
AM_RANGE(0x2000, 0x33ff) AM_ROM
@@ -314,6 +314,26 @@ static INTERRUPT_GEN( quasar_interrupt )
generic_pulse_irq_line_and_vector(device,0,0x03);
}
+static const s2636_interface s2636_0_config =
+{
+ "screen",
+ 0xff,
+ CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
+};
+
+static const s2636_interface s2636_1_config =
+{
+ "screen",
+ 0xff,
+ CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
+};
+
+static const s2636_interface s2636_2_config =
+{
+ "screen",
+ 0xff,
+ CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
+};
// ****************************************
// Quasar S2650 Main CPU, I8035 sound board
@@ -345,6 +365,10 @@ static MACHINE_DRIVER_START( quasar )
MDRV_GFXDECODE(quasar)
MDRV_PALETTE_LENGTH((64+1)*8+(4*256))
+ MDRV_S2636_ADD("s2636_0", s2636_0_config)
+ MDRV_S2636_ADD("s2636_1", s2636_1_config)
+ MDRV_S2636_ADD("s2636_2", s2636_2_config)
+
MDRV_PALETTE_INIT(quasar)
MDRV_VIDEO_START(quasar)
MDRV_VIDEO_UPDATE(quasar)
diff --git a/src/mame/drivers/zac2650.c b/src/mame/drivers/zac2650.c
index d90238e58ea..2bb9d499bcb 100644
--- a/src/mame/drivers/zac2650.c
+++ b/src/mame/drivers/zac2650.c
@@ -10,7 +10,6 @@
#include "driver.h"
#include "cpu/s2650/s2650.h"
-#include "video/s2636.h"
#include "tinv2650.lh"
diff --git a/src/mame/includes/cvs.h b/src/mame/includes/cvs.h
index 60ced7f48e3..f7b48d617a1 100644
--- a/src/mame/includes/cvs.h
+++ b/src/mame/includes/cvs.h
@@ -15,9 +15,6 @@ extern UINT8 *cvs_color_ram;
extern UINT8 *cvs_video_ram;
extern UINT8 *cvs_bullet_ram;
extern UINT8 *cvs_palette_ram;
-extern UINT8 *cvs_s2636_0_ram;
-extern UINT8 *cvs_s2636_1_ram;
-extern UINT8 *cvs_s2636_2_ram;
extern UINT8 *cvs_fo_state;
MACHINE_START( cvs );
diff --git a/src/mame/includes/laserbat.h b/src/mame/includes/laserbat.h
new file mode 100644
index 00000000000..fbb4f2bb070
--- /dev/null
+++ b/src/mame/includes/laserbat.h
@@ -0,0 +1,50 @@
+/*************************************************************************
+
+ Laser Battle / Lazarian - Cat and Mouse
+
+*************************************************************************/
+
+typedef struct _laserbat_state laserbat_state;
+struct _laserbat_state
+{
+ /* video-related */
+ tilemap *bg_tilemap;
+ UINT8 *videoram;
+ UINT8 *colorram;
+ int video_page;
+
+ /* misc */
+ int input_mux;
+ int active_8910, port0a, last_port0b;
+ int cb1_toggle;
+
+ /* information for the single 32x32 sprite displayed */
+ int sprite_x;
+ int sprite_y;
+ int sprite_code;
+ int sprite_color;
+ int sprite_enable;
+
+ /* sound-related */
+ int csound1;
+ int ksound1, ksound2, ksound3;
+ int degr, filt, a, us, bit14;
+
+ /* device */
+ const device_config *audiocpu;
+ const device_config *s2636_1;
+ const device_config *s2636_2;
+ const device_config *s2636_3;
+ const device_config *pia;
+ const device_config *sn;
+ const device_config *tms1;
+ const device_config *tms2;
+ const device_config *ay1;
+ const device_config *ay2;
+};
+
+
+/*----------- defined in audio/laserbat.c -----------*/
+
+WRITE8_HANDLER( laserbat_csound1_w );
+WRITE8_HANDLER( laserbat_csound2_w );
diff --git a/src/mame/includes/lasso.h b/src/mame/includes/lasso.h
index ac0f5b95924..dc995728d0d 100644
--- a/src/mame/includes/lasso.h
+++ b/src/mame/includes/lasso.h
@@ -4,16 +4,34 @@
***************************************************************************/
-/*----------- defined in video/lasso.c -----------*/
+typedef struct _lasso_state lasso_state;
+struct _lasso_state
+{
+ /* memory pointers */
+ UINT8 * videoram;
+ UINT8 * colorram;
+ UINT8 * spriteram;
+ UINT8 * bitmap_ram; /* 0x2000 bytes for a 256 x 256 x 1 bitmap */
+ UINT8 * back_color;
+ UINT8 * chip_data;
+ UINT8 * track_scroll;
+ UINT8 * last_colors;
+ size_t spriteram_size;
+
+ /* video-related */
+ tilemap *bg_tilemap, *track_tilemap;
+ UINT8 gfxbank; /* used by lasso, chameleo, wwjgtin and pinbo */
+ UINT8 track_enable; /* used by wwjgtin */
+
+ /* devices */
+ const device_config *maincpu;
+ const device_config *audiocpu;
+ const device_config *sn_1;
+ const device_config *sn_2;
+};
+
-extern UINT8 *lasso_videoram;
-extern UINT8 *lasso_colorram;
-extern UINT8 *lasso_spriteram;
-extern size_t lasso_spriteram_size;
-extern UINT8 *lasso_bitmap_ram;
-extern UINT8 *wwjgtin_track_scroll;
-extern UINT8 *lasso_back_color;
-extern UINT8 *wwjgtin_last_colors;
+/*----------- defined in video/lasso.c -----------*/
WRITE8_HANDLER( lasso_videoram_w );
WRITE8_HANDLER( lasso_colorram_w );
diff --git a/src/mame/includes/lazercmd.h b/src/mame/includes/lazercmd.h
index 3f2f610ffec..6835577aed8 100644
--- a/src/mame/includes/lazercmd.h
+++ b/src/mame/includes/lazercmd.h
@@ -17,8 +17,24 @@
#define MARKER_HORZ_ADJ -1
#define MARKER_VERT_ADJ -10
-/*----------- defined in video/lazercmd.c -----------*/
+typedef struct _lazercmd_state lazercmd_state;
+struct _lazercmd_state
+{
+ /* memory pointers */
+ UINT8 * videoram;
+ size_t videoram_size;
+
+ /* video-related */
+ int marker_x, marker_y;
+
+ /* misc */
+ int timer_count, sense_state, dac_data;
-extern int marker_x, marker_y;
+ /* device */
+ const device_config *dac;
+};
+
+
+/*----------- defined in video/lazercmd.c -----------*/
VIDEO_UPDATE( lazercmd );
diff --git a/src/mame/includes/lemmings.h b/src/mame/includes/lemmings.h
index 9b2274d2087..26edfbcc01f 100644
--- a/src/mame/includes/lemmings.h
+++ b/src/mame/includes/lemmings.h
@@ -1,10 +1,33 @@
+
+typedef struct _lemmings_state lemmings_state;
+struct _lemmings_state
+{
+ /* memory pointers */
+ UINT16 * pixel_0_data;
+ UINT16 * pixel_1_data;
+ UINT16 * vram_data;
+ UINT16 * control_data;
+ UINT16 * paletteram;
+// UINT16 * spriteram; // this currently uses generic buffered spriteram
+// UINT16 * spriteram2; // this currently uses generic buffered spriteram
+
+ /* video-related */
+ bitmap_t *bitmap0;
+ tilemap *vram_tilemap;
+ UINT16 *sprite_triple_buffer_0,*sprite_triple_buffer_1;
+ UINT8 *vram_buffer;
+
+ /* devices */
+ const device_config *audiocpu;
+};
+
+
/*----------- defined in video/lemmings.c -----------*/
-VIDEO_START( lemmings );
-VIDEO_EOF( lemmings );
-VIDEO_UPDATE( lemmings );
WRITE16_HANDLER( lemmings_pixel_0_w );
WRITE16_HANDLER( lemmings_pixel_1_w );
WRITE16_HANDLER( lemmings_vram_w );
-extern UINT16 *lemmings_pixel_0_data,*lemmings_pixel_1_data,*lemmings_vram_data,*lemmings_control_data;
+VIDEO_START( lemmings );
+VIDEO_EOF( lemmings );
+VIDEO_UPDATE( lemmings );
diff --git a/src/mame/video/cvs.c b/src/mame/video/cvs.c
index 37ac84427f6..4da2f795a37 100644
--- a/src/mame/video/cvs.c
+++ b/src/mame/video/cvs.c
@@ -19,7 +19,6 @@
#define STARS_COLOR_BASE 16
-static s2636_t *s2636_0, *s2636_1, *s2636_2;
static bitmap_t *background_bitmap;
bitmap_t *cvs_collision_background;
static bitmap_t *scrolled_collision_background;
@@ -145,7 +144,7 @@ WRITE8_HANDLER( cvs_scroll_w )
VIDEO_START( cvs )
{
int generator = 0;
- int y, width, height;
+ int y;
/* precalculate the star background */
@@ -182,14 +181,6 @@ VIDEO_START( cvs )
}
}
- /* configure the S2636 chips */
- width = video_screen_get_width(machine->primary_screen);
- height = video_screen_get_height(machine->primary_screen);
-
- s2636_0 = s2636_config(machine, cvs_s2636_0_ram, height, width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET);
- s2636_1 = s2636_config(machine, cvs_s2636_1_ram, height, width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET);
- s2636_2 = s2636_config(machine, cvs_s2636_2_ram, height, width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET);
-
/* create helper bitmaps */
background_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
cvs_collision_background = video_screen_auto_bitmap_alloc(machine->primary_screen);
@@ -214,6 +205,9 @@ VIDEO_UPDATE( cvs )
bitmap_t *s2636_0_bitmap;
bitmap_t *s2636_1_bitmap;
bitmap_t *s2636_2_bitmap;
+ const device_config *s2636_0 = devtag_get_device(screen->machine, "s2636_0");
+ const device_config *s2636_1 = devtag_get_device(screen->machine, "s2636_1");
+ const device_config *s2636_2 = devtag_get_device(screen->machine, "s2636_2");
set_pens(screen->machine->colortable);
diff --git a/src/mame/video/lasso.c b/src/mame/video/lasso.c
index 5a89580c794..a38d6376fe7 100644
--- a/src/mame/video/lasso.c
+++ b/src/mame/video/lasso.c
@@ -28,22 +28,7 @@
***************************************************************************/
#include "driver.h"
-#include "lasso.h"
-
-
-UINT8 *lasso_videoram;
-UINT8 *lasso_colorram;
-UINT8 *lasso_spriteram;
-size_t lasso_spriteram_size;
-UINT8 *lasso_bitmap_ram; /* 0x2000 bytes for a 256 x 256 x 1 bitmap */
-UINT8 *wwjgtin_track_scroll;
-UINT8 *lasso_back_color;
-UINT8 *wwjgtin_last_colors;
-
-static tilemap *bg_tilemap, *track_tilemap;
-static UINT8 gfxbank; /* used by lasso, chameleo, wwjgtin and pinbo */
-static UINT8 wwjgtin_track_enable; /* used by wwjgtin */
-
+#include "includes/lasso.h"
/***************************************************************************
@@ -53,7 +38,7 @@ static UINT8 wwjgtin_track_enable; /* used by wwjgtin */
***************************************************************************/
-static rgb_t get_color(int data)
+static rgb_t get_color( int data )
{
int bit0, bit1, bit2;
int r, g, b;
@@ -117,13 +102,14 @@ PALETTE_INIT( wwjgtin )
}
-static void wwjgtin_set_last_four_colors(colortable_t *colortable)
+static void wwjgtin_set_last_four_colors( running_machine *machine, colortable_t *colortable )
{
+ lasso_state *state = (lasso_state *)machine->driver_data;
int i;
/* the last palette entries can be changed */
for (i = 0; i < 4; i++)
- colortable_palette_set_color(colortable, 0x3f - i, get_color(wwjgtin_last_colors[i]));
+ colortable_palette_set_color(colortable, 0x3f - i, get_color(state->last_colors[i]));
}
@@ -136,11 +122,12 @@ static void wwjgtin_set_last_four_colors(colortable_t *colortable)
static TILE_GET_INFO( lasso_get_bg_tile_info )
{
- int code = lasso_videoram[tile_index];
- int color = lasso_colorram[tile_index];
+ lasso_state *state = (lasso_state *)machine->driver_data;
+ int code = state->videoram[tile_index];
+ int color = state->colorram[tile_index];
SET_TILE_INFO(0,
- code + ((UINT16)gfxbank << 8),
+ code + ((UINT16)state->gfxbank << 8),
color & 0x0f,
0);
}
@@ -148,7 +135,7 @@ static TILE_GET_INFO( lasso_get_bg_tile_info )
static TILE_GET_INFO( wwjgtin_get_track_tile_info )
{
UINT8 *ROM = memory_region(machine, "user1");
- int code = ROM[tile_index];
+ int code = ROM[tile_index];
int color = ROM[tile_index + 0x2000];
SET_TILE_INFO(2,
@@ -159,8 +146,9 @@ static TILE_GET_INFO( wwjgtin_get_track_tile_info )
static TILE_GET_INFO( pinbo_get_bg_tile_info )
{
- int code = lasso_videoram[tile_index];
- int color = lasso_colorram[tile_index];
+ lasso_state *state = (lasso_state *)machine->driver_data;
+ int code = state->videoram[tile_index];
+ int color = state->colorram[tile_index];
SET_TILE_INFO(0,
code + ((color & 0x30) << 4),
@@ -177,35 +165,31 @@ static TILE_GET_INFO( pinbo_get_bg_tile_info )
VIDEO_START( lasso )
{
- /* create tilemap */
- bg_tilemap = tilemap_create(machine, lasso_get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
+ lasso_state *state = (lasso_state *)machine->driver_data;
- tilemap_set_transparent_pen(bg_tilemap, 0);
+ /* create tilemap */
+ state->bg_tilemap = tilemap_create(machine, lasso_get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
- /* register for saving */
- state_save_register_global(machine, gfxbank);
+ tilemap_set_transparent_pen(state->bg_tilemap, 0);
}
VIDEO_START( wwjgtin )
{
- /* create tilemaps */
- bg_tilemap = tilemap_create(machine, lasso_get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
- track_tilemap = tilemap_create(machine, wwjgtin_get_track_tile_info, tilemap_scan_rows, 16, 16, 128, 64);
+ lasso_state *state = (lasso_state *)machine->driver_data;
- tilemap_set_transparent_pen(bg_tilemap, 0);
+ /* create tilemaps */
+ state->bg_tilemap = tilemap_create(machine, lasso_get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
+ state->track_tilemap = tilemap_create(machine, wwjgtin_get_track_tile_info, tilemap_scan_rows, 16, 16, 128, 64);
- /* register for saving */
- state_save_register_global(machine, gfxbank);
- state_save_register_global(machine, wwjgtin_track_enable);
+ tilemap_set_transparent_pen(state->bg_tilemap, 0);
}
VIDEO_START( pinbo )
{
- /* create tilemap */
- bg_tilemap = tilemap_create(machine, pinbo_get_bg_tile_info, tilemap_scan_rows, 8, 8,32,32);
+ lasso_state *state = (lasso_state *)machine->driver_data;
- /* register for saving */
- state_save_register_global(machine, gfxbank);
+ /* create tilemap */
+ state->bg_tilemap = tilemap_create(machine, pinbo_get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
}
@@ -217,14 +201,16 @@ VIDEO_START( pinbo )
WRITE8_HANDLER( lasso_videoram_w )
{
- lasso_videoram[offset] = data;
- tilemap_mark_tile_dirty( bg_tilemap, offset );
+ lasso_state *state = (lasso_state *)space->machine->driver_data;
+ state->videoram[offset] = data;
+ tilemap_mark_tile_dirty(state->bg_tilemap, offset);
}
WRITE8_HANDLER( lasso_colorram_w )
{
- lasso_colorram[offset] = data;
- tilemap_mark_tile_dirty( bg_tilemap, offset );
+ lasso_state *state = (lasso_state *)space->machine->driver_data;
+ state->colorram[offset] = data;
+ tilemap_mark_tile_dirty(state->bg_tilemap, offset);
}
@@ -232,20 +218,20 @@ static WRITE8_HANDLER( lasso_flip_screen_w )
{
/* don't know which is which, but they are always set together */
flip_screen_x_set(space->machine, data & 0x01);
- flip_screen_y_set(space->machine, data & 0x02);
+ flip_screen_y_set(space->machine, data & 0x02);
- tilemap_set_flip_all(space->machine, (flip_screen_x_get(space->machine) ? TILEMAP_FLIPX : 0) |
- (flip_screen_y_get(space->machine) ? TILEMAP_FLIPY : 0));
+ tilemap_set_flip_all(space->machine, (flip_screen_x_get(space->machine) ? TILEMAP_FLIPX : 0) | (flip_screen_y_get(space->machine) ? TILEMAP_FLIPY : 0));
}
WRITE8_HANDLER( lasso_video_control_w )
{
+ lasso_state *state = (lasso_state *)space->machine->driver_data;
int bank = (data & 0x04) >> 2;
- if (gfxbank != bank)
+ if (state->gfxbank != bank)
{
- gfxbank = bank;
+ state->gfxbank = bank;
tilemap_mark_all_tiles_dirty_all(space->machine);
}
@@ -254,12 +240,13 @@ WRITE8_HANDLER( lasso_video_control_w )
WRITE8_HANDLER( wwjgtin_video_control_w )
{
+ lasso_state *state = (lasso_state *)space->machine->driver_data;
int bank = ((data & 0x04) ? 0 : 1) + ((data & 0x10) ? 2 : 0);
- wwjgtin_track_enable = data & 0x08;
+ state->track_enable = data & 0x08;
- if (gfxbank != bank)
+ if (state->gfxbank != bank)
{
- gfxbank = bank;
+ state->gfxbank = bank;
tilemap_mark_all_tiles_dirty_all(space->machine);
}
@@ -268,8 +255,10 @@ WRITE8_HANDLER( wwjgtin_video_control_w )
WRITE8_HANDLER( pinbo_video_control_w )
{
+ lasso_state *state = (lasso_state *)space->machine->driver_data;
+
/* no need to dirty the tilemap -- only the sprites use the global bank */
- gfxbank = (data & 0x0c) >> 2;
+ state->gfxbank = (data & 0x0c) >> 2;
lasso_flip_screen_w(space, offset, data);
}
@@ -281,28 +270,29 @@ WRITE8_HANDLER( pinbo_video_control_w )
*
*************************************/
-static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int reverse )
+static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int reverse )
{
+ lasso_state *state = (lasso_state *)machine->driver_data;
const UINT8 *finish, *source;
int inc;
if (reverse)
{
- source = lasso_spriteram;
- finish = lasso_spriteram + lasso_spriteram_size;
- inc = 4;
+ source = state->spriteram;
+ finish = state->spriteram + state->spriteram_size;
+ inc = 4;
}
else
{
- source = lasso_spriteram + lasso_spriteram_size - 4;
- finish = lasso_spriteram - 4;
- inc = -4;
+ source = state->spriteram + state->spriteram_size - 4;
+ finish = state->spriteram - 4;
+ inc = -4;
}
- while( source != finish )
+ while (source != finish)
{
- int sx,sy,flipx,flipy;
- int code,color;
+ int sx, sy, flipx, flipy;
+ int code, color;
sx = source[3];
sy = source[0];
@@ -316,20 +306,15 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
}
if (flip_screen_y_get(machine))
- {
flipy = !flipy;
- }
else
- {
sy = 240 - sy;
- }
code = source[1] & 0x3f;
color = source[2] & 0x0f;
-
- drawgfx_transpen(bitmap, cliprect, machine->gfx[1],
- code | ((UINT16)gfxbank << 6),
+ drawgfx_transpen(bitmap, cliprect, machine->gfx[1],
+ code | ((UINT16)state->gfxbank << 6),
color,
flipx, flipy,
sx,sy,0);
@@ -339,8 +324,9 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
}
-static void draw_lasso(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
+static void draw_lasso( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{
+ lasso_state *state = (lasso_state *)machine->driver_data;
offs_t offs;
pen_t pen = 0x3f;
@@ -358,7 +344,7 @@ static void draw_lasso(running_machine *machine, bitmap_t *bitmap, const rectang
continue;
x = (offs & 0x1f) << 3;
- data = lasso_bitmap_ram[offs];
+ data = state->bitmap_ram[offs];
if (flip_screen_x_get(machine))
x = ~x;
@@ -381,10 +367,11 @@ static void draw_lasso(running_machine *machine, bitmap_t *bitmap, const rectang
VIDEO_UPDATE( lasso )
{
- palette_set_color(screen->machine, 0, get_color(*lasso_back_color));
+ lasso_state *state = (lasso_state *)screen->machine->driver_data;
+ palette_set_color(screen->machine, 0, get_color(*state->back_color));
bitmap_fill(bitmap, cliprect, 0);
- tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
+ tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
draw_lasso(screen->machine, bitmap, cliprect);
draw_sprites(screen->machine, bitmap, cliprect, 0);
@@ -393,10 +380,11 @@ VIDEO_UPDATE( lasso )
VIDEO_UPDATE( chameleo )
{
- palette_set_color(screen->machine, 0, get_color(*lasso_back_color));
+ lasso_state *state = (lasso_state *)screen->machine->driver_data;
+ palette_set_color(screen->machine, 0, get_color(*state->back_color));
bitmap_fill(bitmap, cliprect, 0);
- tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
+ tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
draw_sprites(screen->machine, bitmap, cliprect, 0);
return 0;
@@ -405,19 +393,20 @@ VIDEO_UPDATE( chameleo )
VIDEO_UPDATE( wwjgtin )
{
- colortable_palette_set_color(screen->machine->colortable, 0, get_color(*lasso_back_color));
- wwjgtin_set_last_four_colors(screen->machine->colortable);
+ lasso_state *state = (lasso_state *)screen->machine->driver_data;
+ colortable_palette_set_color(screen->machine->colortable, 0, get_color(*state->back_color));
+ wwjgtin_set_last_four_colors(screen->machine, screen->machine->colortable);
- tilemap_set_scrollx(track_tilemap, 0, wwjgtin_track_scroll[0] + wwjgtin_track_scroll[1]*256);
- tilemap_set_scrolly(track_tilemap, 0, wwjgtin_track_scroll[2] + wwjgtin_track_scroll[3]*256);
+ tilemap_set_scrollx(state->track_tilemap, 0, state->track_scroll[0] + state->track_scroll[1] * 256);
+ tilemap_set_scrolly(state->track_tilemap, 0, state->track_scroll[2] + state->track_scroll[3] * 256);
- if (wwjgtin_track_enable)
- tilemap_draw(bitmap, cliprect, track_tilemap, 0, 0);
+ if (state->track_enable)
+ tilemap_draw(bitmap, cliprect, state->track_tilemap, 0, 0);
else
bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
draw_sprites(screen->machine, bitmap, cliprect, 1); // reverse order
- tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
+ tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
return 0;
}
@@ -425,10 +414,9 @@ VIDEO_UPDATE( wwjgtin )
VIDEO_UPDATE( pinbo )
{
- tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
+ lasso_state *state = (lasso_state *)screen->machine->driver_data;
+ tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
draw_sprites(screen->machine, bitmap, cliprect, 0);
return 0;
}
-
-
diff --git a/src/mame/video/lazercmd.c b/src/mame/video/lazercmd.c
index c4920b58c05..9ba88a69023 100644
--- a/src/mame/video/lazercmd.c
+++ b/src/mame/video/lazercmd.c
@@ -7,9 +7,6 @@
#include "driver.h"
#include "includes/lazercmd.h"
-int marker_x, marker_y;
-
-
/* scale a markers vertical position */
/* the following table shows how the markers */
/* vertical position worked in hardware */
@@ -21,33 +18,33 @@ int marker_x, marker_y;
/* 4 8 + 9 12 18 + 19 */
static int vert_scale(int data)
{
- return ((data & 0x07)<<1) + ((data & 0xf8)>>3) * VERT_CHR;
+ return ((data & 0x07) << 1) + ((data & 0xf8) >> 3) * VERT_CHR;
}
/* plot a bitmap marker */
/* hardware has 2 marker sizes 2x2 and 4x2 selected by jumper */
/* meadows lanes normaly use 2x2 pixels and lazer command uses either */
-static void plot_pattern(running_machine *machine, bitmap_t *bitmap, int x, int y)
+static void plot_pattern( running_machine *machine, bitmap_t *bitmap, int x, int y )
{
int xbit, ybit, size;
- size = 2;
+ size = 2;
if (input_port_read(machine, "DSW") & 0x40)
- {
+ {
size = 4;
- }
+ }
for (ybit = 0; ybit < 2; ybit++)
{
- if (y+ybit < 0 || y+ybit >= VERT_RES * VERT_CHR)
+ if (y + ybit < 0 || y + ybit >= VERT_RES * VERT_CHR)
return;
for (xbit = 0; xbit < size; xbit++)
{
- if (x+xbit < 0 || x+xbit >= HORZ_RES * HORZ_CHR)
+ if (x + xbit < 0 || x + xbit >= HORZ_RES * HORZ_CHR)
continue;
- *BITMAP_ADDR16(bitmap, y+ybit, x+xbit) = 4;
+ *BITMAP_ADDR16(bitmap, y + ybit, x + xbit) = 4;
}
}
}
@@ -55,14 +52,15 @@ static void plot_pattern(running_machine *machine, bitmap_t *bitmap, int x, int
VIDEO_UPDATE( lazercmd )
{
- int i,x,y;
+ lazercmd_state *state = (lazercmd_state *)screen->machine->driver_data;
+ int i, x, y;
int video_inverted = input_port_read(screen->machine, "DSW") & 0x20;
/* The first row of characters are invisible */
for (i = 0; i < (VERT_RES - 1) * HORZ_RES; i++)
{
- int sx,sy;
+ int sx, sy;
sx = i % HORZ_RES;
sy = i / HORZ_RES;
@@ -71,14 +69,14 @@ VIDEO_UPDATE( lazercmd )
sy *= VERT_CHR;
drawgfx_opaque(bitmap, cliprect,screen->machine->gfx[0],
- screen->machine->generic.videoram.u8[i], video_inverted ? 1 : 0,
+ state->videoram[i], video_inverted ? 1 : 0,
0,0,
sx,sy);
}
- x = marker_x - 1; /* normal video lags marker by 1 pixel */
- y = vert_scale(marker_y) - VERT_CHR; /* first line used as scratch pad */
- plot_pattern(screen->machine, bitmap,x,y);
+ x = state->marker_x - 1; /* normal video lags marker by 1 pixel */
+ y = vert_scale(state->marker_y) - VERT_CHR; /* first line used as scratch pad */
+ plot_pattern(screen->machine, bitmap, x, y);
return 0;
}
diff --git a/src/mame/video/lemmings.c b/src/mame/video/lemmings.c
index 36a34b1f823..73aac4240ca 100644
--- a/src/mame/video/lemmings.c
+++ b/src/mame/video/lemmings.c
@@ -13,34 +13,27 @@
***************************************************************************/
#include "driver.h"
-#include "lemmings.h"
+#include "includes/lemmings.h"
-UINT16 *lemmings_pixel_0_data,*lemmings_pixel_1_data,*lemmings_vram_data,*lemmings_control_data;
-static UINT16 *sprite_triple_buffer_0,*sprite_triple_buffer_1;
-static UINT8 *vram_buffer;
-static bitmap_t *bitmap0;
-static tilemap *vram_tilemap;
-
-/******************************************************************************/
-
-static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16 *spritedata, int gfxbank, UINT16 pri)
+static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16 *spritedata, int gfxbank, UINT16 pri )
{
int offs;
- for (offs = 0;offs < 0x400;offs += 4)
+ for (offs = 0; offs < 0x400; offs += 4)
{
- int x,y,sprite,colour,multi,fx,fy,inc,flash,mult;
+ int x, y, sprite, colour, multi, fx, fy, inc, flash, mult;
- sprite = spritedata[offs+1] & 0x3fff;
+ sprite = spritedata[offs + 1] & 0x3fff;
- if ((spritedata[offs+2]&0x2000)!=pri)
+ if ((spritedata[offs + 2] & 0x2000) != pri)
continue;
y = spritedata[offs];
- flash=y&0x1000;
- if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1)) continue;
+ flash = y & 0x1000;
+ if (flash && (video_screen_get_frame_number(machine->primary_screen) & 1))
+ continue;
- x = spritedata[offs+2];
+ x = spritedata[offs + 2];
colour = (x >>9) & 0xf;
fx = y & 0x2000;
@@ -52,7 +45,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
if (x >= 320) x -= 512;
if (y >= 256) y -= 512;
- if (x>320 || x<-16) continue;
+ if (x > 320 || x < -16) continue;
sprite &= ~multi;
if (fy)
@@ -62,7 +55,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
sprite += multi;
inc = -1;
}
- mult=-16;
+ mult = -16;
while (multi >= 0)
{
@@ -81,7 +74,8 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
static TILE_GET_INFO( get_tile_info )
{
- UINT16 tile=lemmings_vram_data[tile_index];
+ lemmings_state *state = (lemmings_state *)machine->driver_data;
+ UINT16 tile = state->vram_data[tile_index];
SET_TILE_INFO(
2,
@@ -92,99 +86,114 @@ static TILE_GET_INFO( get_tile_info )
VIDEO_START( lemmings )
{
- bitmap0 = auto_bitmap_alloc(machine,2048,256,video_screen_get_format(machine->primary_screen));
- vram_tilemap = tilemap_create(machine, get_tile_info,tilemap_scan_cols,8,8,64,32);
+ lemmings_state *state = (lemmings_state *)machine->driver_data;
+ state->bitmap0 = auto_bitmap_alloc(machine, 2048, 256, video_screen_get_format(machine->primary_screen));
+ state->vram_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_cols, 8, 8, 64, 32);
- vram_buffer = auto_alloc_array(machine, UINT8, 2048*64); /* 64 bytes per VRAM character */
- sprite_triple_buffer_0 = auto_alloc_array(machine, UINT16, 0x800/2);
- sprite_triple_buffer_1 = auto_alloc_array(machine, UINT16, 0x800/2);
+ state->vram_buffer = auto_alloc_array(machine, UINT8, 2048 * 64); /* 64 bytes per VRAM character */
+ state->sprite_triple_buffer_0 = auto_alloc_array(machine, UINT16, 0x800 / 2);
+ state->sprite_triple_buffer_1 = auto_alloc_array(machine, UINT16, 0x800 / 2);
- tilemap_set_transparent_pen(vram_tilemap,0);
- bitmap_fill(bitmap0,0,0x100);
+ tilemap_set_transparent_pen(state->vram_tilemap, 0);
+ bitmap_fill(state->bitmap0, 0, 0x100);
- gfx_element_set_source(machine->gfx[2], vram_buffer);
+ gfx_element_set_source(machine->gfx[2], state->vram_buffer);
+
+ state_save_register_global_bitmap(machine, state->bitmap0);
+ state_save_register_global_pointer(machine, state->vram_buffer, 2048 * 64);
+ state_save_register_global_pointer(machine, state->sprite_triple_buffer_0, 0x800 / 2);
+ state_save_register_global_pointer(machine, state->sprite_triple_buffer_1, 0x800 / 2);
}
VIDEO_EOF( lemmings )
{
- memcpy(sprite_triple_buffer_0,machine->generic.buffered_spriteram.u16,0x800);
- memcpy(sprite_triple_buffer_1,machine->generic.buffered_spriteram2.u16,0x800);
+ lemmings_state *state = (lemmings_state *)machine->driver_data;
+
+ memcpy(state->sprite_triple_buffer_0, machine->generic.buffered_spriteram.u16, 0x800);
+ memcpy(state->sprite_triple_buffer_1, machine->generic.buffered_spriteram2.u16, 0x800);
}
/******************************************************************************/
WRITE16_HANDLER( lemmings_pixel_0_w )
{
- int sx,sy,src,old;
+ lemmings_state *state = (lemmings_state *)space->machine->driver_data;
+ int sx, sy, src, old;
- old=lemmings_pixel_0_data[offset];
- COMBINE_DATA(&lemmings_pixel_0_data[offset]);
- src=lemmings_pixel_0_data[offset];
- if (old==src)
+ old = state->pixel_0_data[offset];
+ COMBINE_DATA(&state->pixel_0_data[offset]);
+ src = state->pixel_0_data[offset];
+ if (old == src)
return;
- sy=(offset<<1)/0x800;
- sx=(offset<<1)&0x7ff;
+ sy = (offset << 1) / 0x800;
+ sx = (offset << 1) & 0x7ff;
- if (sx>2047 || sy>255)
+ if (sx > 2047 || sy > 255)
return;
- *BITMAP_ADDR16(bitmap0, sy, sx+0) = ((src>>8)&0xf)|0x100;
- *BITMAP_ADDR16(bitmap0, sy, sx+1) = ((src>>0)&0xf)|0x100;
+ *BITMAP_ADDR16(state->bitmap0, sy, sx + 0) = ((src >> 8) & 0xf) | 0x100;
+ *BITMAP_ADDR16(state->bitmap0, sy, sx + 1) = ((src >> 0) & 0xf) | 0x100;
}
WRITE16_HANDLER( lemmings_pixel_1_w )
{
- int sx,sy,src,old,tile;
+ lemmings_state *state = (lemmings_state *)space->machine->driver_data;
+ int sx, sy, src, old, tile;
- old=lemmings_pixel_1_data[offset];
- COMBINE_DATA(&lemmings_pixel_1_data[offset]);
- src=lemmings_pixel_1_data[offset];
-// if (old==src)
+ old = state->pixel_1_data[offset];
+ COMBINE_DATA(&state->pixel_1_data[offset]);
+ src = state->pixel_1_data[offset];
+// if (old == src)
// return;
- sy=((offset<<1)/0x200);
- sx=((offset<<1)&0x1ff);
+ sy = ((offset << 1) / 0x200);
+ sx = ((offset << 1) & 0x1ff);
/* Copy pixel to buffer for easier decoding later */
- tile=((sx/8)*32)+(sy/8);
+ tile = ((sx / 8) * 32) + (sy / 8);
gfx_element_mark_dirty(space->machine->gfx[2], tile);
- vram_buffer[(tile*64) + ((sx&7)) + ((sy&7)*8)]=(src>>8)&0xf;
+ state->vram_buffer[(tile * 64) + ((sx & 7)) + ((sy & 7) * 8)] = (src >> 8) & 0xf;
- sx+=1; /* Update both pixels in the word */
- vram_buffer[(tile*64) + ((sx&7)) + ((sy&7)*8)]=(src>>0)&0xf;
+ sx += 1; /* Update both pixels in the word */
+ state->vram_buffer[(tile * 64) + ((sx & 7)) + ((sy & 7) * 8)] = (src >> 0) & 0xf;
}
WRITE16_HANDLER( lemmings_vram_w )
{
- COMBINE_DATA(&lemmings_vram_data[offset]);
- tilemap_mark_tile_dirty(vram_tilemap,offset);
+ lemmings_state *state = (lemmings_state *)space->machine->driver_data;
+ COMBINE_DATA(&state->vram_data[offset]);
+ tilemap_mark_tile_dirty(state->vram_tilemap, offset);
}
VIDEO_UPDATE( lemmings )
{
- int x1=-lemmings_control_data[0],x0=-lemmings_control_data[2],y=0;
+ lemmings_state *state = (lemmings_state *)screen->machine->driver_data;
+ int x1 = -state->control_data[0];
+ int x0 = -state->control_data[2];
+ int y = 0;
rectangle rect;
- rect.max_y=cliprect->max_y;
- rect.min_y=cliprect->min_y;
+ rect.max_y = cliprect->max_y;
+ rect.min_y = cliprect->min_y;
- bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine));
- draw_sprites(screen->machine,bitmap,cliprect,sprite_triple_buffer_1,1,0x0000);
+ bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
+ draw_sprites(screen->machine, bitmap, cliprect, state->sprite_triple_buffer_1, 1, 0x0000);
/* Pixel layer can be windowed in hardware (two player mode) */
- if ((lemmings_control_data[6]&2)==0) {
- copyscrollbitmap_trans(bitmap,bitmap0,1,&x1,1,&y,cliprect,0x100);
- } else {
- rect.max_x=159;
- rect.min_x=0;
- copyscrollbitmap_trans(bitmap,bitmap0,1,&x0,1,&y,&rect,0x100);
- rect.max_x=319;
- rect.min_x=160;
- copyscrollbitmap_trans(bitmap,bitmap0,1,&x1,1,&y,&rect,0x100);
+ if ((state->control_data[6] & 2) == 0)
+ copyscrollbitmap_trans(bitmap, state->bitmap0, 1, &x1, 1, &y, cliprect, 0x100);
+ else
+ {
+ rect.max_x = 159;
+ rect.min_x = 0;
+ copyscrollbitmap_trans(bitmap, state->bitmap0, 1, &x0, 1, &y, &rect, 0x100);
+ rect.max_x = 319;
+ rect.min_x = 160;
+ copyscrollbitmap_trans(bitmap, state->bitmap0, 1, &x1, 1, &y, &rect, 0x100);
}
- draw_sprites(screen->machine,bitmap,cliprect,sprite_triple_buffer_0,0,0x0000);
- draw_sprites(screen->machine,bitmap,cliprect,sprite_triple_buffer_1,1,0x2000);
- tilemap_draw(bitmap,cliprect,vram_tilemap,0,0);
- draw_sprites(screen->machine,bitmap,cliprect,sprite_triple_buffer_0,0,0x2000);
+ draw_sprites(screen->machine, bitmap, cliprect, state->sprite_triple_buffer_0, 0, 0x0000);
+ draw_sprites(screen->machine, bitmap, cliprect, state->sprite_triple_buffer_1, 1, 0x2000);
+ tilemap_draw(bitmap, cliprect, state->vram_tilemap, 0, 0);
+ draw_sprites(screen->machine, bitmap, cliprect, state->sprite_triple_buffer_0, 0, 0x2000);
return 0;
}
diff --git a/src/mame/video/malzak.c b/src/mame/video/malzak.c
index dd2eb34f3f0..2206e17478d 100644
--- a/src/mame/video/malzak.c
+++ b/src/mame/video/malzak.c
@@ -40,10 +40,6 @@ static struct
UINT8* saa5050_vidram; /* Video RAM for SAA 5050 */
-static s2636_t *s2636_0, *s2636_1;
-UINT8 *malzak_s2636_0_ram;
-UINT8 *malzak_s2636_1_ram;
-
int malzak_x;
int malzak_y;
@@ -54,18 +50,6 @@ static struct playfield
int code;
} field[256];
-VIDEO_START( malzak )
-{
- int width = video_screen_get_width(machine->primary_screen);
- int height = video_screen_get_height(machine->primary_screen);
-
- /* configure the S2636 chips */
-// s2636_0 = s2636_config(machine, malzak_s2636_0_ram, height, width, -8, -16);
-// s2636_1 = s2636_config(machine, malzak_s2636_1_ram, height, width, -9, -16);
- s2636_0 = s2636_config(machine, malzak_s2636_0_ram, height, width, 0, -16);
- s2636_1 = s2636_config(machine, malzak_s2636_1_ram, height, width, 0, -16);
-}
-
VIDEO_UPDATE( malzak )
{
int code, colour;
@@ -73,6 +57,8 @@ VIDEO_UPDATE( malzak )
int x,y;
bitmap_t *s2636_0_bitmap;
bitmap_t *s2636_1_bitmap;
+ const device_config *s2636_0 = devtag_get_device(screen->machine, "s2636_0");
+ const device_config *s2636_1 = devtag_get_device(screen->machine, "s2636_1");
bitmap_fill(bitmap,0,0);
diff --git a/src/mame/video/quasar.c b/src/mame/video/quasar.c
index f55b87e06f0..c8afd8d123b 100644
--- a/src/mame/video/quasar.c
+++ b/src/mame/video/quasar.c
@@ -23,8 +23,6 @@
UINT8 *quasar_effectram;
UINT8 quasar_effectcontrol;
-static s2636_t *s2636_0, *s2636_1, *s2636_2;
-
PALETTE_INIT( quasar )
{
int i;
@@ -98,16 +96,8 @@ PALETTE_INIT( quasar )
VIDEO_START( quasar )
{
- int width = video_screen_get_width(machine->primary_screen);
- int height = video_screen_get_height(machine->primary_screen);
-
quasar_effectram = auto_alloc_array(machine, UINT8, 0x400);
- /* configure the S2636 chips */
- s2636_0 = s2636_config(machine, cvs_s2636_0_ram, height, width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET);
- s2636_1 = s2636_config(machine, cvs_s2636_1_ram, height, width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET);
- s2636_2 = s2636_config(machine, cvs_s2636_2_ram, height, width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET);
-
/* create helper bitmaps */
cvs_collision_background = video_screen_auto_bitmap_alloc(machine->primary_screen);
}
@@ -118,6 +108,9 @@ VIDEO_UPDATE( quasar )
bitmap_t *s2636_0_bitmap;
bitmap_t *s2636_1_bitmap;
bitmap_t *s2636_2_bitmap;
+ const device_config *s2636_0 = devtag_get_device(screen->machine, "s2636_0");
+ const device_config *s2636_1 = devtag_get_device(screen->machine, "s2636_1");
+ const device_config *s2636_2 = devtag_get_device(screen->machine, "s2636_2");
/* for every character in the video RAM */
for (offs = 0; offs < 0x0400; offs++)
diff --git a/src/mame/video/zac2650.c b/src/mame/video/zac2650.c
index adcc5b26ee1..8e839749412 100644
--- a/src/mame/video/zac2650.c
+++ b/src/mame/video/zac2650.c
@@ -5,8 +5,6 @@
/*************************************************************/
#include "driver.h"
-#include "video/s2636.h"
-
UINT8 *zac2650_s2636_0_ram;
static bitmap_t *spritebitmap;