diff --git a/src/emu/video/m50458.c b/src/emu/video/m50458.c index 6568ef2d82c..603976b079c 100644 --- a/src/emu/video/m50458.c +++ b/src/emu/video/m50458.c @@ -32,6 +32,8 @@ static ADDRESS_MAP_START( m50458_vram, AS_0, 16, m50458_device ) AM_RANGE(0x0242, 0x0243) AM_WRITE(vreg_121_w) AM_RANGE(0x0244, 0x0245) AM_WRITE(vreg_122_w) AM_RANGE(0x0246, 0x0247) AM_WRITE(vreg_123_w) + AM_RANGE(0x0248, 0x0249) AM_WRITE(vreg_124_w) + AM_RANGE(0x024a, 0x024b) AM_WRITE(vreg_125_w) AM_RANGE(0x024c, 0x024d) AM_WRITE(vreg_126_w) AM_RANGE(0x024e, 0x024f) AM_WRITE(vreg_127_w) ADDRESS_MAP_END @@ -86,6 +88,17 @@ WRITE16_MEMBER( m50458_device::vreg_123_w) // printf("%02x %02x %02x\n",m_scrr,m_scrf,m_space); } +WRITE16_MEMBER( m50458_device::vreg_124_w) +{ + +} + +WRITE16_MEMBER( m50458_device::vreg_125_w) +{ + /* blinking cycle */ + m_blink = data & 4 ? 0x20 : 0x40; +} + WRITE16_MEMBER( m50458_device::vreg_126_w) { /* Raster Color Setting */ @@ -175,6 +188,20 @@ void m50458_device::device_validity_check(validity_checker &valid) const } +void m50458_device::device_config_complete() +{ + // inherit a copy of the static data + const m50458_interface *intf = reinterpret_cast(static_config()); + if (intf != NULL) + *static_cast(this) = *intf; + + // or initialize to defaults if none provided + else + { + // ... + } +} + //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- @@ -222,6 +249,14 @@ void m50458_device::device_start() m_shadow_gfx[dst] |= (tmp >> 8); } } + + // find screen + m_screen = machine().device(m_screen_tag); + + if (m_screen == NULL) + { + m_screen = owner()->subdevice(m_screen_tag); + } } @@ -236,6 +271,8 @@ void m50458_device::device_reset() /* clear VRAM at boot */ for(i=0;i<0x120;i++) write_word(i,0x007f); + + m_blink = 0x40; } @@ -338,8 +375,6 @@ UINT32 m50458_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, int res_y,res_x; UINT8 xh,yh; - /* TODO: blinking, bit 7 (RTC test in NSS) */ - if(xi>=8) pix = ((pcg[offset+1] >> (7-(xi & 0x7))) & 1) << 1; else @@ -350,6 +385,10 @@ UINT32 m50458_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, else pix |= ((m_shadow_gfx[offset+0] >> (7-(xi & 0x7))) & 1); + /* blinking, VERY preliminary */ + if(tile & 0x800 && m_screen->frame_number() & m_blink) + pix = 0; + if(yi == 17 && tile & 0x1000) /* underline? */ pix |= 1; diff --git a/src/emu/video/m50458.h b/src/emu/video/m50458.h index d646bfb0b84..192b5cd2753 100644 --- a/src/emu/video/m50458.h +++ b/src/emu/video/m50458.h @@ -15,8 +15,13 @@ Mitsubishi M50458 OSD chip // INTERFACE CONFIGURATION MACROS //************************************************************************** -#define MCFG_M50458_ADD(_tag,_freq) \ +#define MCFG_M50458_ADD(_tag,_config,_freq) \ MCFG_DEVICE_ADD(_tag, M50458,_freq) \ + MCFG_DEVICE_CONFIG(_config) \ + + +#define M50458_INTERFACE(name) \ + const m50458_interface (name) = //************************************************************************** @@ -29,10 +34,18 @@ typedef enum OSD_SET_DATA } m50458_state_t; +// ======================> upd7220_interface + +struct m50458_interface +{ + const char *m_screen_tag; +}; + // ======================> m50458_device class m50458_device : public device_t, - public device_memory_interface + public device_memory_interface, + public m50458_interface { public: // construction/destruction @@ -46,6 +59,8 @@ public: DECLARE_WRITE16_MEMBER(vreg_121_w); DECLARE_WRITE16_MEMBER(vreg_122_w); DECLARE_WRITE16_MEMBER(vreg_123_w); + DECLARE_WRITE16_MEMBER(vreg_124_w); + DECLARE_WRITE16_MEMBER(vreg_125_w); DECLARE_WRITE16_MEMBER(vreg_126_w); DECLARE_WRITE16_MEMBER(vreg_127_w); @@ -58,6 +73,9 @@ protected: virtual void device_start(); virtual void device_reset(); virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; + virtual void device_config_complete(); + + screen_device *m_screen; int m_latch; int m_reset_line; @@ -73,6 +91,7 @@ protected: UINT8 m_space; UINT8 m_hsz1,m_hsz2,m_hsz3; UINT8 m_vsz1,m_vsz2,m_vsz3; + UINT8 m_blink; m50458_state_t m_osd_state; diff --git a/src/mame/drivers/nss.c b/src/mame/drivers/nss.c index 746c947ce40..0a885170937 100644 --- a/src/mame/drivers/nss.c +++ b/src/mame/drivers/nss.c @@ -844,6 +844,11 @@ static MACHINE_RESET( nss ) state->m_joy_flag = 1; } +static M50458_INTERFACE( m50458_intf ) +{ + "osd" +}; + static MACHINE_CONFIG_DERIVED( nss, snes ) MCFG_CPU_ADD("bios", Z80, 4000000) @@ -851,7 +856,7 @@ static MACHINE_CONFIG_DERIVED( nss, snes ) MCFG_CPU_IO_MAP(bios_io_map) MCFG_CPU_VBLANK_INT("screen", nss_vblank_irq) - MCFG_M50458_ADD("m50458",4000000) /* TODO: clock */ + MCFG_M50458_ADD("m50458",m50458_intf,4000000) /* TODO: clock */ MCFG_S3520CF_ADD("s3520cf") /* RTC */ MCFG_RP5H01_ADD("rp5h01") MCFG_M6M80011AP_ADD("m6m80011ap")