From aa6def709eb886f3e6571fafc92cd3cf4a20a85e Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Thu, 31 Oct 2013 13:56:53 +0000 Subject: [PATCH] Confirmed that video register [1] controls upper color bank (fixes Mazer Blazer CRT test). Upcoming: device-ify custom VCU --- .gitattributes | 2 + src/emu/video/mb_vcu.c | 115 ++++++++++++++++++++++++++++++++++++ src/emu/video/mb_vcu.h | 74 +++++++++++++++++++++++ src/emu/video/video.mak | 9 +++ src/mame/drivers/mazerbla.c | 15 +++-- src/mame/mame.mak | 1 + 6 files changed, 208 insertions(+), 8 deletions(-) create mode 100644 src/emu/video/mb_vcu.c create mode 100644 src/emu/video/mb_vcu.h diff --git a/.gitattributes b/.gitattributes index 87092fc380b..855860c31ec 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2476,6 +2476,8 @@ src/emu/video/m50458.c svneol=native#text/plain src/emu/video/m50458.h svneol=native#text/plain src/emu/video/mb90082.c svneol=native#text/plain src/emu/video/mb90082.h svneol=native#text/plain +src/emu/video/mb_vcu.c svneol=native#text/plain +src/emu/video/mb_vcu.h svneol=native#text/plain src/emu/video/mc6845.c svneol=native#text/plain src/emu/video/mc6845.h svneol=native#text/plain src/emu/video/mc6847.c svneol=native#text/plain diff --git a/src/emu/video/mb_vcu.c b/src/emu/video/mb_vcu.c new file mode 100644 index 00000000000..88265eea847 --- /dev/null +++ b/src/emu/video/mb_vcu.c @@ -0,0 +1,115 @@ +// license: ? +// copyright-holders: Angelo Salese +/*************************************************************************** + +Device for Mazer Blazer/Great Guns custom Video Controller Unit + +***************************************************************************/ + +#include "emu.h" +#include "video/mb_vcu.h" + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +// device type definition +const device_type MB_VCU = &device_creator; + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// mb_vcu_device - constructor +//------------------------------------------------- + +mb_vcu_device::mb_vcu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MB_VCU, "Mazer Blazer custom VCU", tag, owner, clock, "mb_vcu", __FILE__), + device_video_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void mb_vcu_device::device_config_complete() +{ + // inherit a copy of the static data + const mb_vcu_interface *intf = reinterpret_cast(static_config()); + if (intf != NULL) + { + *static_cast(this) = *intf; + } + + // or initialize to defaults if none provided + else + { + m_cpu_tag = NULL; + } +} + +//------------------------------------------------- +// device_validity_check - perform validity checks +// on this device +//------------------------------------------------- + +void mb_vcu_device::device_validity_check(validity_checker &valid) const +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mb_vcu_device::device_start() +{ + if(m_cpu_tag) + { + m_cpu = machine().device(m_cpu_tag); + } + else + { + m_cpu = NULL; + } + +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void mb_vcu_device::device_reset() +{ +} + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + +READ8_MEMBER( mb_vcu_device::read ) +{ + return 0; +} + +WRITE8_MEMBER( mb_vcu_device::write ) +{ +} + +//------------------------------------------------- +// update_screen - +//------------------------------------------------- + +UINT32 mb_vcu_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} diff --git a/src/emu/video/mb_vcu.h b/src/emu/video/mb_vcu.h new file mode 100644 index 00000000000..b204e3281df --- /dev/null +++ b/src/emu/video/mb_vcu.h @@ -0,0 +1,74 @@ +// license: ? +// copyright-holders: Angelo Salese +/*************************************************************************** + +Template for skeleton device + +***************************************************************************/ + +#pragma once + +#ifndef __MB_VCUDEV_H__ +#define __MB_VCUDEV_H__ + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_MB_VCU_ADD(_tag,_freq,_config) \ + MCFG_DEVICE_ADD(_tag, MB_VCU, _freq) \ + MCFG_DEVICE_CONFIG(_config) + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> mb_vcu_interface + +struct mb_vcu_interface +{ + const char *m_cpu_tag; +}; + +// ======================> mb_vcu_device + +class mb_vcu_device : public device_t, + public device_video_interface, + public mb_vcu_interface +{ +public: + // construction/destruction + mb_vcu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // I/O operations + DECLARE_WRITE8_MEMBER( write ); + DECLARE_READ8_MEMBER( read ); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_validity_check(validity_checker &valid) const; + virtual void device_start(); + virtual void device_reset(); +private: + + device_t *m_cpu; +}; + + +// device type definition +extern const device_type MB_VCU; + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + + + +#endif diff --git a/src/emu/video/video.mak b/src/emu/video/video.mak index 5f35737d4f6..f3f56ba8d4c 100644 --- a/src/emu/video/video.mak +++ b/src/emu/video/video.mak @@ -268,6 +268,15 @@ ifneq ($(filter MB90082,$(VIDEOS)),) VIDEOOBJS+= $(VIDEOOBJ)/mb90082.o endif +#------------------------------------------------- +# +#@src/emu/video/mb_vcu.h,VIDEOS += MB_VCU +#------------------------------------------------- + +ifneq ($(filter MB_VCU,$(VIDEOS)),) +VIDEOOBJS+= $(VIDEOOBJ)/mb_vcu.o +endif + #------------------------------------------------- # #@src/emu/video/mc6845.h,VIDEOS += MC6845 diff --git a/src/mame/drivers/mazerbla.c b/src/mame/drivers/mazerbla.c index cf7a47e40c6..c483f1d3d9a 100644 --- a/src/mame/drivers/mazerbla.c +++ b/src/mame/drivers/mazerbla.c @@ -109,6 +109,9 @@ master z80 [0x0021]: clears i/o at 0x6a (lamps), clears 0xe563, 0xe004, 0xe000, 0xe001, 0xe007, 0xe002, 0xe003, 0xe005, 0xc04f, 0xe572, enables IM 2, clears 0xe581 / 0xe583 (word), puts default initials (0x2274->0xe058) +video z80 +[0x535]: +[0x03c]: start of proper code ****************************************************************************/ @@ -491,7 +494,7 @@ READ8_MEMBER(mazerbla_state::vcu_set_cmd_param_r) m_plane = m_mode & 3; - return 0; + return machine().rand(); } @@ -503,11 +506,7 @@ READ8_MEMBER(mazerbla_state::vcu_set_gfx_addr_r) int bits = 0; UINT8 color_base = 0; - if (m_game_id == MAZERBLA) - color_base = 0x80; /* 0x80 - good for Mazer Blazer: (only in game, CRT test mode is bad) */ - - if (m_game_id == GREATGUN) - color_base = 0x00; /* 0x00 - good for Great Guns: (both in game and CRT test mode) */ + color_base = m_vcu_video_reg[1] << 4; // if ((mode <= 0x07) || (mode >= 0x10)) /* @@ -660,7 +659,7 @@ READ8_MEMBER(mazerbla_state::vcu_set_gfx_addr_r) break; } - return 0; + return machine().rand(); } READ8_MEMBER(mazerbla_state::vcu_set_clr_addr_r) @@ -853,7 +852,7 @@ READ8_MEMBER(mazerbla_state::vcu_set_clr_addr_r) break; } - return 0; + return machine().rand(); } /************************************* diff --git a/src/mame/mame.mak b/src/mame/mame.mak index cf2557d38cf..d3fde95dd08 100644 --- a/src/mame/mame.mak +++ b/src/mame/mame.mak @@ -298,6 +298,7 @@ VIDEOS += I8275 VIDEOS += K053250 VIDEOS += M50458 VIDEOS += MB90082 +VIDEOS += MB_VCU VIDEOS += MC6845 #VIDEOS += MC6847 #VIDEOS += MSM6255