This changes the MC6845 to take and pass device_config's only
The following shook out from this that are applicable to other devices as well: - running_machine is no longer taken, passed or stored - mc6845_t is now private - since passing device_config's is not device type safe, I added a get_safe_token() to mc6845.c to check the device passed in for the valid type. I think something like this should be added to the core. - As a side note, I really don't think that device_config is a good name, naming it simply device_t or something like that might be better.
This commit is contained in:
parent
8b444900ca
commit
6302df116d
@ -39,6 +39,7 @@ enum
|
||||
NUM_TYPES
|
||||
};
|
||||
|
||||
|
||||
/* tags for state saving */
|
||||
const char * const device_tags[NUM_TYPES] = { "mc6845", "c6545-1", "r6545-1" };
|
||||
|
||||
@ -49,10 +50,10 @@ static const int supports_status_reg_d5[NUM_TYPES] = { FALSE, TRUE, TRUE }
|
||||
static const int supports_status_reg_d6[NUM_TYPES] = { FALSE, TRUE, TRUE };
|
||||
|
||||
|
||||
typedef struct _mc6845_t mc6845_t;
|
||||
struct _mc6845_t
|
||||
{
|
||||
int device_type;
|
||||
running_machine *machine;
|
||||
const mc6845_interface *intf;
|
||||
|
||||
/* register file */
|
||||
@ -107,6 +108,19 @@ static void update_hsync_changed_timers(mc6845_t *mc6845);
|
||||
static void update_vsync_changed_timers(mc6845_t *mc6845);
|
||||
|
||||
|
||||
/* makes sure that the passed in device is the right type */
|
||||
INLINE mc6845_t *get_safe_token(const device_config *device)
|
||||
{
|
||||
assert(device != NULL);
|
||||
assert(device->token != NULL);
|
||||
assert((device->type == DEVICE_GET_INFO_NAME(mc6845)) ||
|
||||
(device->type == DEVICE_GET_INFO_NAME(c6545_1)) ||
|
||||
(device->type == DEVICE_GET_INFO_NAME(r6545_1)));
|
||||
|
||||
return (mc6845_t *)device->token;
|
||||
}
|
||||
|
||||
|
||||
static void mc6845_state_save_postload(void *param)
|
||||
{
|
||||
recompute_parameters(param, TRUE);
|
||||
@ -115,9 +129,7 @@ static void mc6845_state_save_postload(void *param)
|
||||
|
||||
WRITE8_DEVICE_HANDLER( mc6845_address_w )
|
||||
{
|
||||
mc6845_t *mc6845 = device->token;
|
||||
|
||||
assert(mc6845 != NULL);
|
||||
mc6845_t *mc6845 = get_safe_token(device);
|
||||
|
||||
mc6845->register_address_latch = data & 0x1f;
|
||||
}
|
||||
@ -125,11 +137,9 @@ WRITE8_DEVICE_HANDLER( mc6845_address_w )
|
||||
|
||||
READ8_DEVICE_HANDLER( mc6845_status_r )
|
||||
{
|
||||
mc6845_t *mc6845 = device->token;
|
||||
mc6845_t *mc6845 = get_safe_token(device);
|
||||
UINT8 ret = 0;
|
||||
|
||||
assert(mc6845 != NULL);
|
||||
|
||||
/* VBLANK bit */
|
||||
if (supports_status_reg_d5[mc6845->device_type] &&
|
||||
(video_screen_get_vpos(mc6845->intf->scrnum) > mc6845->max_visible_y))
|
||||
@ -145,11 +155,9 @@ READ8_DEVICE_HANDLER( mc6845_status_r )
|
||||
|
||||
READ8_DEVICE_HANDLER( mc6845_register_r )
|
||||
{
|
||||
mc6845_t *mc6845 = device->token;
|
||||
mc6845_t *mc6845 = get_safe_token(device);
|
||||
UINT8 ret = 0;
|
||||
|
||||
assert(mc6845 != NULL);
|
||||
|
||||
switch (mc6845->register_address_latch)
|
||||
{
|
||||
case 0x0c: ret = supports_disp_start_addr_r[mc6845->device_type] ? (mc6845->disp_start_addr >> 8) & 0xff : 0; break;
|
||||
@ -169,9 +177,7 @@ READ8_DEVICE_HANDLER( mc6845_register_r )
|
||||
|
||||
WRITE8_DEVICE_HANDLER( mc6845_register_w )
|
||||
{
|
||||
mc6845_t *mc6845 = device->token;
|
||||
|
||||
assert(mc6845 != NULL);
|
||||
mc6845_t *mc6845 = get_safe_token(device);
|
||||
|
||||
if (LOG) logerror("M6845 PC %04x: reg 0x%02x = 0x%02x\n", activecpu_get_pc(), mc6845->register_address_latch, data);
|
||||
|
||||
@ -387,10 +393,11 @@ static void update_vsync_changed_timers(mc6845_t *mc6845)
|
||||
|
||||
static TIMER_CALLBACK( de_changed_timer_cb )
|
||||
{
|
||||
mc6845_t *mc6845 = ptr;
|
||||
const device_config *device = ptr;
|
||||
mc6845_t *mc6845 = get_safe_token(device);
|
||||
|
||||
/* call the callback function -- we know it exists */
|
||||
mc6845->intf->on_de_changed(mc6845->machine, mc6845, is_display_enabled(mc6845));
|
||||
mc6845->intf->on_de_changed(device, is_display_enabled(mc6845));
|
||||
|
||||
update_de_changed_timer(mc6845);
|
||||
}
|
||||
@ -398,19 +405,21 @@ static TIMER_CALLBACK( de_changed_timer_cb )
|
||||
|
||||
static TIMER_CALLBACK( vsync_on_timer_cb )
|
||||
{
|
||||
mc6845_t *mc6845 = ptr;
|
||||
const device_config *device = ptr;
|
||||
mc6845_t *mc6845 = get_safe_token(device);
|
||||
|
||||
/* call the callback function -- we know it exists */
|
||||
mc6845->intf->on_vsync_changed(mc6845->machine, mc6845, TRUE);
|
||||
mc6845->intf->on_vsync_changed(device, TRUE);
|
||||
}
|
||||
|
||||
|
||||
static TIMER_CALLBACK( vsync_off_timer_cb )
|
||||
{
|
||||
mc6845_t *mc6845 = ptr;
|
||||
const device_config *device = ptr;
|
||||
mc6845_t *mc6845 = get_safe_token(device);
|
||||
|
||||
/* call the callback function -- we know it exists */
|
||||
mc6845->intf->on_vsync_changed(mc6845->machine, mc6845, FALSE);
|
||||
mc6845->intf->on_vsync_changed(device, FALSE);
|
||||
|
||||
update_vsync_changed_timers(mc6845);
|
||||
}
|
||||
@ -418,30 +427,31 @@ static TIMER_CALLBACK( vsync_off_timer_cb )
|
||||
|
||||
static TIMER_CALLBACK( hsync_on_timer_cb )
|
||||
{
|
||||
mc6845_t *mc6845 = ptr;
|
||||
const device_config *device = ptr;
|
||||
mc6845_t *mc6845 = get_safe_token(device);
|
||||
|
||||
/* call the callback function -- we know it exists */
|
||||
mc6845->intf->on_hsync_changed(mc6845->machine, mc6845, TRUE);
|
||||
mc6845->intf->on_hsync_changed(device, TRUE);
|
||||
}
|
||||
|
||||
|
||||
static TIMER_CALLBACK( hsync_off_timer_cb )
|
||||
{
|
||||
mc6845_t *mc6845 = ptr;
|
||||
const device_config *device = ptr;
|
||||
mc6845_t *mc6845 = get_safe_token(device);
|
||||
|
||||
/* call the callback function -- we know it exists */
|
||||
mc6845->intf->on_hsync_changed(mc6845->machine, mc6845, FALSE);
|
||||
mc6845->intf->on_hsync_changed(device, FALSE);
|
||||
|
||||
update_hsync_changed_timers(mc6845);
|
||||
}
|
||||
|
||||
|
||||
|
||||
UINT16 mc6845_get_ma(mc6845_t *mc6845)
|
||||
UINT16 mc6845_get_ma(const device_config *device)
|
||||
{
|
||||
UINT16 ret;
|
||||
|
||||
assert(mc6845 != NULL);
|
||||
mc6845_t *mc6845 = get_safe_token(device);
|
||||
|
||||
if (mc6845->has_valid_parameters)
|
||||
{
|
||||
@ -468,11 +478,10 @@ UINT16 mc6845_get_ma(mc6845_t *mc6845)
|
||||
}
|
||||
|
||||
|
||||
UINT8 mc6845_get_ra(mc6845_t *mc6845)
|
||||
UINT8 mc6845_get_ra(const device_config *device)
|
||||
{
|
||||
UINT8 ret;
|
||||
|
||||
assert(mc6845 != NULL);
|
||||
mc6845_t *mc6845 = get_safe_token(device);
|
||||
|
||||
if (mc6845->has_valid_parameters)
|
||||
{
|
||||
@ -493,19 +502,20 @@ UINT8 mc6845_get_ra(mc6845_t *mc6845)
|
||||
|
||||
static TIMER_CALLBACK( light_pen_latch_timer_cb )
|
||||
{
|
||||
mc6845_t *mc6845 = ptr;
|
||||
const device_config *device = ptr;
|
||||
mc6845_t *mc6845 = get_safe_token(device);
|
||||
|
||||
mc6845->light_pen_addr = mc6845_get_ma(mc6845);
|
||||
mc6845->light_pen_addr = mc6845_get_ma(device);
|
||||
mc6845->light_pen_latched = TRUE;
|
||||
}
|
||||
|
||||
|
||||
void mc6845_assert_light_pen_input(mc6845_t *mc6845)
|
||||
void mc6845_assert_light_pen_input(const device_config *device)
|
||||
{
|
||||
int y, x;
|
||||
int char_x;
|
||||
|
||||
assert(mc6845 != NULL);
|
||||
mc6845_t *mc6845 = get_safe_token(device);
|
||||
|
||||
if (mc6845->has_valid_parameters)
|
||||
{
|
||||
@ -564,9 +574,9 @@ static void update_cursor_state(mc6845_t *mc6845)
|
||||
}
|
||||
|
||||
|
||||
void mc6845_update(mc6845_t *mc6845, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
void mc6845_update(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
{
|
||||
assert(mc6845 != NULL);
|
||||
mc6845_t *mc6845 = get_safe_token(device);
|
||||
assert(bitmap != NULL);
|
||||
assert(cliprect != NULL);
|
||||
|
||||
@ -581,7 +591,7 @@ void mc6845_update(mc6845_t *mc6845, bitmap_t *bitmap, const rectangle *cliprect
|
||||
|
||||
/* call the set up function if any */
|
||||
if (mc6845->intf->begin_update != NULL)
|
||||
param = mc6845->intf->begin_update(mc6845->machine, mc6845, bitmap, cliprect);
|
||||
param = mc6845->intf->begin_update(device, bitmap, cliprect);
|
||||
|
||||
if (cliprect->min_y == 0)
|
||||
{
|
||||
@ -609,7 +619,7 @@ void mc6845_update(mc6845_t *mc6845, bitmap_t *bitmap, const rectangle *cliprect
|
||||
INT8 cursor_x = cursor_visible ? (mc6845->cursor_addr - mc6845->current_disp_addr) : -1;
|
||||
|
||||
/* call the external system to draw it */
|
||||
mc6845->intf->update_row(mc6845->machine, mc6845, bitmap, cliprect, mc6845->current_disp_addr, ra, y, mc6845->horiz_disp, cursor_x, param);
|
||||
mc6845->intf->update_row(device, bitmap, cliprect, mc6845->current_disp_addr, ra, y, mc6845->horiz_disp, cursor_x, param);
|
||||
|
||||
/* update MA if the last raster address */
|
||||
if (ra == mc6845->max_ras_addr)
|
||||
@ -618,7 +628,7 @@ void mc6845_update(mc6845_t *mc6845, bitmap_t *bitmap, const rectangle *cliprect
|
||||
|
||||
/* call the tear down function if any */
|
||||
if (mc6845->intf->end_update != NULL)
|
||||
mc6845->intf->end_update(mc6845->machine, mc6845, bitmap, cliprect, param);
|
||||
mc6845->intf->end_update(device, bitmap, cliprect, param);
|
||||
|
||||
popmessage(NULL);
|
||||
}
|
||||
@ -643,29 +653,28 @@ static void *common_start(const device_config *device, int device_type)
|
||||
memset(mc6845, 0, sizeof(*mc6845));
|
||||
|
||||
mc6845->device_type = device_type;
|
||||
mc6845->machine = device->machine;
|
||||
mc6845->intf = device->static_config;
|
||||
|
||||
/* create the timers */
|
||||
if (mc6845->intf != NULL)
|
||||
{
|
||||
if (mc6845->intf->on_de_changed != NULL)
|
||||
mc6845->de_changed_timer = timer_alloc(de_changed_timer_cb, mc6845);
|
||||
mc6845->de_changed_timer = timer_alloc(de_changed_timer_cb, (void *)device);
|
||||
|
||||
if (mc6845->intf->on_hsync_changed != NULL)
|
||||
{
|
||||
mc6845->hsync_on_timer = timer_alloc(hsync_on_timer_cb, mc6845);
|
||||
mc6845->hsync_off_timer = timer_alloc(hsync_off_timer_cb, mc6845);
|
||||
mc6845->hsync_on_timer = timer_alloc(hsync_on_timer_cb, (void *)device);
|
||||
mc6845->hsync_off_timer = timer_alloc(hsync_off_timer_cb, (void *)device);
|
||||
}
|
||||
|
||||
if (mc6845->intf->on_vsync_changed != NULL)
|
||||
{
|
||||
mc6845->vsync_on_timer = timer_alloc(vsync_on_timer_cb, mc6845);
|
||||
mc6845->vsync_off_timer = timer_alloc(vsync_off_timer_cb, mc6845);
|
||||
mc6845->vsync_on_timer = timer_alloc(vsync_on_timer_cb, (void *)device);
|
||||
mc6845->vsync_off_timer = timer_alloc(vsync_off_timer_cb, (void *)device);
|
||||
}
|
||||
}
|
||||
|
||||
mc6845->light_pen_latch_timer = timer_alloc(light_pen_latch_timer_cb, mc6845);
|
||||
mc6845->light_pen_latch_timer = timer_alloc(light_pen_latch_timer_cb, (void *)device);
|
||||
|
||||
/* register for state saving */
|
||||
state_save_combine_module_and_tag(unique_tag, device_tags[device_type], device->tag);
|
||||
@ -713,19 +722,19 @@ static DEVICE_START( r6545_1 )
|
||||
|
||||
static DEVICE_RESET( mc6845 )
|
||||
{
|
||||
mc6845_t *mc6845 = device->token;
|
||||
mc6845_t *mc6845 = get_safe_token(device);
|
||||
|
||||
/* internal registers other than status remain unchanged, all outputs go low */
|
||||
if (mc6845->intf != NULL)
|
||||
{
|
||||
if (mc6845->intf->on_de_changed != NULL)
|
||||
mc6845->intf->on_de_changed(device->machine, mc6845, FALSE);
|
||||
mc6845->intf->on_de_changed(device, FALSE);
|
||||
|
||||
if (mc6845->intf->on_hsync_changed != NULL)
|
||||
mc6845->intf->on_hsync_changed(device->machine, mc6845, FALSE);
|
||||
mc6845->intf->on_hsync_changed(device, FALSE);
|
||||
|
||||
if (mc6845->intf->on_vsync_changed != NULL)
|
||||
mc6845->intf->on_vsync_changed(device->machine, mc6845, FALSE);
|
||||
mc6845->intf->on_vsync_changed(device, FALSE);
|
||||
}
|
||||
|
||||
mc6845->light_pen_latched = FALSE;
|
||||
|
@ -11,41 +11,37 @@
|
||||
#define __MC6845__
|
||||
|
||||
|
||||
typedef struct _mc6845_t mc6845_t;
|
||||
typedef struct _mc6845_interface mc6845_interface;
|
||||
|
||||
#define MC6845 DEVICE_GET_INFO_NAME(mc6845)
|
||||
#define R6545_1 DEVICE_GET_INFO_NAME(r6545_1)
|
||||
#define C6545_1 DEVICE_GET_INFO_NAME(c6545_1)
|
||||
|
||||
|
||||
/* callback definitions */
|
||||
typedef void * (*mc6845_begin_update_func)(running_machine *machine, mc6845_t *mc6845, bitmap_t *bitmap, const rectangle *cliprect);
|
||||
#define MC6845_BEGIN_UPDATE(name) void *name(running_machine *machine, mc6845_t *mc6845, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
typedef void * (*mc6845_begin_update_func)(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect);
|
||||
#define MC6845_BEGIN_UPDATE(name) void *name(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
|
||||
typedef void (*mc6845_update_row_func)(running_machine *machine, mc6845_t *mc6845, bitmap_t *bitmap,
|
||||
typedef void (*mc6845_update_row_func)(const device_config *device, bitmap_t *bitmap,
|
||||
const rectangle *cliprect, UINT16 ma, UINT8 ra,
|
||||
UINT16 y, UINT8 x_count, INT8 cursor_x, void *param);
|
||||
#define MC6845_UPDATE_ROW(name) void name(running_machine *machine, mc6845_t *mc6845, bitmap_t *bitmap, \
|
||||
#define MC6845_UPDATE_ROW(name) void name(const device_config *device, bitmap_t *bitmap, \
|
||||
const rectangle *cliprect, UINT16 ma, UINT8 ra, \
|
||||
UINT16 y, UINT8 x_count, INT8 cursor_x, void *param)
|
||||
|
||||
typedef void (*mc6845_end_update_func)(running_machine *machine, mc6845_t *mc6845,
|
||||
bitmap_t *bitmap, const rectangle *cliprect, void *param);
|
||||
#define MC6845_END_UPDATE(name) void name(running_machine *machine, mc6845_t *mc6845, \
|
||||
bitmap_t *bitmap, const rectangle *cliprect, void *param)
|
||||
typedef void (*mc6845_end_update_func)(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect, void *param);
|
||||
#define MC6845_END_UPDATE(name) void name(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect, void *param)
|
||||
|
||||
typedef void (*mc6845_on_de_changed_func)(running_machine *machine, mc6845_t *mc6845, int display_enabled);
|
||||
#define MC6845_ON_DE_CHANGED(name) void name(running_machine *machine, mc6845_t *mc6845, int display_enabled)
|
||||
typedef void (*mc6845_on_de_changed_func)(const device_config *device, int display_enabled);
|
||||
#define MC6845_ON_DE_CHANGED(name) void name(const device_config *device, int display_enabled)
|
||||
|
||||
typedef void (*mc6845_on_hsync_changed_func)(running_machine *machine, mc6845_t *mc6845, int hsync);
|
||||
#define MC6845_ON_HSYNC_CHANGED(name) void name(running_machine *machine, mc6845_t *mc6845, int hsync)
|
||||
typedef void (*mc6845_on_hsync_changed_func)(const device_config *device, int hsync);
|
||||
#define MC6845_ON_HSYNC_CHANGED(name) void name(const device_config *device, int hsync)
|
||||
|
||||
typedef void (*mc6845_on_vsync_changed_func)(running_machine *machine, mc6845_t *mc6845, int vsync);
|
||||
#define MC6845_ON_VSYNC_CHANGED(name) void name(running_machine *machine, mc6845_t *mc6845, int vsync)
|
||||
typedef void (*mc6845_on_vsync_changed_func)(const device_config *device, int vsync);
|
||||
#define MC6845_ON_VSYNC_CHANGED(name) void name(const device_config *device, int vsync)
|
||||
|
||||
|
||||
/* interface */
|
||||
typedef struct _mc6845_interface mc6845_interface;
|
||||
struct _mc6845_interface
|
||||
{
|
||||
int scrnum; /* screen we are acting on */
|
||||
@ -95,18 +91,18 @@ READ8_DEVICE_HANDLER( mc6845_register_r );
|
||||
WRITE8_DEVICE_HANDLER( mc6845_register_w );
|
||||
|
||||
/* return the current value on the MA0-MA13 pins */
|
||||
UINT16 mc6845_get_ma(mc6845_t *mc6845);
|
||||
UINT16 mc6845_get_ma(const device_config *device);
|
||||
|
||||
/* return the current value on the RA0-RA4 pins */
|
||||
UINT8 mc6845_get_ra(mc6845_t *mc6845);
|
||||
UINT8 mc6845_get_ra(const device_config *device);
|
||||
|
||||
/* simulates the LO->HI clocking of the light pen pin (pin 3) */
|
||||
void mc6845_assert_light_pen_input(mc6845_t *mc6845);
|
||||
void mc6845_assert_light_pen_input(const device_config *device);
|
||||
|
||||
/* updates the screen -- this will call begin_update(),
|
||||
followed by update_row() reapeatedly and after all row
|
||||
updating is complete, end_update() */
|
||||
void mc6845_update(mc6845_t *mc6845, bitmap_t *bitmap, const rectangle *cliprect);
|
||||
void mc6845_update(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -83,7 +83,6 @@
|
||||
#define AUDIO_CPU_2_CLOCK (AUDIO_2_MASTER_CLOCK)
|
||||
|
||||
|
||||
static mc6845_t *mc6845;
|
||||
static UINT8 *nyny_videoram_1;
|
||||
static UINT8 *nyny_videoram_2;
|
||||
static UINT8 *nyny_colorram_1;
|
||||
@ -416,14 +415,9 @@ static const mc6845_interface mc6845_intf =
|
||||
};
|
||||
|
||||
|
||||
static VIDEO_START( nyny )
|
||||
{
|
||||
mc6845 = devtag_get_token(machine, MC6845, "crtc");
|
||||
}
|
||||
|
||||
|
||||
static VIDEO_UPDATE( nyny )
|
||||
{
|
||||
const device_config *mc6845 = device_list_find_by_tag(machine->config->devicelist, MC6845, "crtc");
|
||||
mc6845_update(mc6845, bitmap, cliprect);
|
||||
|
||||
return 0;
|
||||
@ -680,7 +674,6 @@ static MACHINE_DRIVER_START( nyny )
|
||||
MDRV_NVRAM_HANDLER(generic_0fill)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_VIDEO_START(nyny)
|
||||
MDRV_VIDEO_UPDATE(nyny)
|
||||
|
||||
MDRV_SCREEN_ADD("main", RASTER)
|
||||
|
@ -48,7 +48,6 @@ RAM = 4116 (x11)
|
||||
#define CRTC_CLOCK (MAIN_CPU_MASTER_CLOCK / 16)
|
||||
|
||||
|
||||
static mc6845_t *mc6845;
|
||||
static UINT8 *r2dtank_videoram;
|
||||
static UINT8 *r2dtank_colorram;
|
||||
static UINT8 flipscreen;
|
||||
@ -394,14 +393,9 @@ static const mc6845_interface mc6845_intf =
|
||||
};
|
||||
|
||||
|
||||
static VIDEO_START( r2dtank )
|
||||
{
|
||||
mc6845 = devtag_get_token(machine, MC6845, "crtc");
|
||||
}
|
||||
|
||||
|
||||
static VIDEO_UPDATE( r2dtank )
|
||||
{
|
||||
const device_config *mc6845 = device_list_find_by_tag(machine->config->devicelist, MC6845, "crtc");
|
||||
mc6845_update(mc6845, bitmap, cliprect);
|
||||
|
||||
return 0;
|
||||
@ -546,7 +540,6 @@ static MACHINE_DRIVER_START( r2dtank )
|
||||
MDRV_NVRAM_HANDLER(generic_0fill)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_VIDEO_START(r2dtank)
|
||||
MDRV_VIDEO_UPDATE(r2dtank)
|
||||
|
||||
MDRV_SCREEN_ADD("main", RASTER)
|
||||
|
@ -203,7 +203,6 @@
|
||||
#define CRTC_CLOCK (MAIN_CPU_MASTER_CLOCK / 16)
|
||||
|
||||
|
||||
static mc6845_t *mc6845;
|
||||
static UINT8 *spiders_ram;
|
||||
static UINT8 flipscreen;
|
||||
static UINT16 gfx_rom_address;
|
||||
@ -510,14 +509,9 @@ static const mc6845_interface mc6845_intf =
|
||||
};
|
||||
|
||||
|
||||
static VIDEO_START( spiders )
|
||||
{
|
||||
mc6845 = devtag_get_token(machine, MC6845, "crtc");
|
||||
}
|
||||
|
||||
|
||||
static VIDEO_UPDATE( spiders )
|
||||
{
|
||||
const device_config *mc6845 = device_list_find_by_tag(machine->config->devicelist, MC6845, "crtc");
|
||||
mc6845_update(mc6845, bitmap, cliprect);
|
||||
|
||||
return 0;
|
||||
@ -708,7 +702,6 @@ static MACHINE_DRIVER_START( spiders )
|
||||
MDRV_NVRAM_HANDLER(generic_0fill)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_VIDEO_START(spiders)
|
||||
MDRV_VIDEO_UPDATE(spiders)
|
||||
|
||||
MDRV_SCREEN_ADD("main", RASTER)
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "sound/ay8910.h"
|
||||
#include "video/mc6845.h"
|
||||
|
||||
static mc6845_t *mc6845;
|
||||
static UINT8 *ssingles_videoram;
|
||||
static UINT8 *ssingles_colorram;
|
||||
static UINT8 prot_data;
|
||||
@ -109,8 +108,6 @@ static WRITE8_HANDLER(ssingles_colorram_w)
|
||||
|
||||
static VIDEO_START(ssingles)
|
||||
{
|
||||
mc6845 = devtag_get_token(machine, MC6845, "crtc");
|
||||
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<NUM_PENS;++i)
|
||||
@ -123,6 +120,7 @@ static VIDEO_START(ssingles)
|
||||
|
||||
static VIDEO_UPDATE( ssingles )
|
||||
{
|
||||
const device_config *mc6845 = device_list_find_by_tag(machine->config->devicelist, MC6845, "crtc");
|
||||
mc6845_update(mc6845, bitmap, cliprect);
|
||||
|
||||
return 0;
|
||||
|
@ -26,7 +26,6 @@ struct _qix_state
|
||||
UINT8 coinctrl;
|
||||
|
||||
/* video state */
|
||||
mc6845_t *mc6845;
|
||||
UINT8 *videoram;
|
||||
UINT8 *videoram_address;
|
||||
UINT8 *videoram_mask;
|
||||
|
@ -263,7 +263,7 @@ MACHINE_START( slither )
|
||||
|
||||
MC6845_ON_VSYNC_CHANGED( qix_vsync_changed )
|
||||
{
|
||||
pia_3_cb1_w(machine, 0, vsync);
|
||||
pia_3_cb1_w(device->machine, 0, vsync);
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,8 +24,6 @@ UINT8 *madalien_edge1_pos;
|
||||
UINT8 *madalien_edge2_pos;
|
||||
UINT8 *madalien_headlight_pos;
|
||||
|
||||
static mc6845_t *mc6845;
|
||||
|
||||
static tilemap *tilemap_fg;
|
||||
|
||||
static tilemap *tilemap_edge1[4];
|
||||
@ -144,8 +142,6 @@ static VIDEO_START( madalien )
|
||||
16, 16, 32, 32
|
||||
};
|
||||
|
||||
mc6845 = devtag_get_token(machine, MC6845, "crtc");
|
||||
|
||||
tilemap_fg = tilemap_create(get_tile_info_FG, tilemap_scan_cols_flip_x, 8, 8, 32, 32);
|
||||
tilemap_set_transparent_pen(tilemap_fg, 0);
|
||||
tilemap_set_scrolldx(tilemap_fg, 0, 0x50);
|
||||
@ -395,8 +391,6 @@ static const mc6845_interface mc6845_intf =
|
||||
|
||||
|
||||
MACHINE_DRIVER_START( madalien_video )
|
||||
|
||||
|
||||
MDRV_SCREEN_ADD("main", RASTER)
|
||||
MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 336, 0, 256, 288, 0, 256)
|
||||
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
||||
|
@ -12,6 +12,16 @@
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Device tag
|
||||
*
|
||||
*************************************/
|
||||
|
||||
#define MC6845_TAG ("vid-u18")
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Static function prototypes
|
||||
@ -34,9 +44,6 @@ static VIDEO_START( qix )
|
||||
{
|
||||
qix_state *state = machine->driver_data;
|
||||
|
||||
/* get the pointer to the mc6845 object */
|
||||
state->mc6845 = devtag_get_token(machine, MC6845, "vid-u18");
|
||||
|
||||
/* allocate memory for the full video RAM */
|
||||
state->videoram = auto_malloc(256 * 256);
|
||||
|
||||
@ -57,13 +64,13 @@ static VIDEO_START( qix )
|
||||
|
||||
static MC6845_ON_DE_CHANGED( display_enable_changed )
|
||||
{
|
||||
qix_state *state = machine->driver_data;
|
||||
qix_state *state = device->machine->driver_data;
|
||||
|
||||
/* on the rising edge, latch the scanline */
|
||||
if (display_enabled)
|
||||
{
|
||||
UINT16 ma = mc6845_get_ma(mc6845);
|
||||
UINT8 ra = mc6845_get_ra(mc6845);
|
||||
UINT16 ma = mc6845_get_ma(device);
|
||||
UINT8 ra = mc6845_get_ra(device);
|
||||
|
||||
/* RA0-RA2 goes to D0-D2 and MA5-MA9 goes to D3-D7 */
|
||||
*state->scanline_latch = ((ma >> 2) & 0xf8) | (ra & 0x07);
|
||||
@ -300,7 +307,7 @@ static void get_pens(qix_state *state, pen_t *pens)
|
||||
|
||||
static MC6845_BEGIN_UPDATE( begin_update )
|
||||
{
|
||||
qix_state *state = machine->driver_data;
|
||||
qix_state *state = device->machine->driver_data;
|
||||
|
||||
#if 0
|
||||
// note the confusing bit order!
|
||||
@ -318,7 +325,7 @@ static MC6845_BEGIN_UPDATE( begin_update )
|
||||
|
||||
static MC6845_UPDATE_ROW( update_row )
|
||||
{
|
||||
qix_state *state = machine->driver_data;
|
||||
qix_state *state = device->machine->driver_data;
|
||||
UINT16 x;
|
||||
UINT8 scanline[256];
|
||||
|
||||
@ -344,9 +351,8 @@ static MC6845_UPDATE_ROW( update_row )
|
||||
|
||||
static VIDEO_UPDATE( qix )
|
||||
{
|
||||
qix_state *state = machine->driver_data;
|
||||
|
||||
mc6845_update(state->mc6845, bitmap, cliprect);
|
||||
const device_config *mc6845 = device_list_find_by_tag(machine->config->devicelist, MC6845, MC6845_TAG);
|
||||
mc6845_update(mc6845, bitmap, cliprect);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -441,7 +447,7 @@ MACHINE_DRIVER_START( qix_video )
|
||||
MDRV_VIDEO_START(qix)
|
||||
MDRV_VIDEO_UPDATE(qix)
|
||||
|
||||
MDRV_DEVICE_ADD("vid-u18", MC6845)
|
||||
MDRV_DEVICE_ADD(MC6845_TAG, MC6845)
|
||||
MDRV_DEVICE_CONFIG(mc6845_intf)
|
||||
|
||||
MDRV_SCREEN_ADD("main", RASTER)
|
||||
|
Loading…
Reference in New Issue
Block a user