summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Angelo Salese <angelosa@users.noreply.github.com>2012-08-29 19:24:36 +0000
committer Angelo Salese <angelosa@users.noreply.github.com>2012-08-29 19:24:36 +0000
commit17d5c79fca560d09baa6c6e6ac31265b9ffdf2a6 (patch)
treeeed162b819646a1884b425729d51071dd32f1733
parentd0bae5a59d540ce5e79de2ff421a82d0b29347f9 (diff)
Some changes, MB90082 != MB90092
-rw-r--r--.gitattributes4
-rw-r--r--src/emu/cpu/z180/z180.c2
-rw-r--r--src/emu/emu.mak2
-rw-r--r--src/emu/video/mb90082.c (renamed from src/emu/video/mb90092.c)119
-rw-r--r--src/emu/video/mb90082.h (renamed from src/emu/video/mb90092.h)22
-rw-r--r--src/mame/drivers/sfcbox.c14
6 files changed, 98 insertions, 65 deletions
diff --git a/.gitattributes b/.gitattributes
index eacfdf876e5..e5fe291de34 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1601,8 +1601,8 @@ src/emu/video/k053250.c svneol=native#text/plain
src/emu/video/k053250.h svneol=native#text/plain
src/emu/video/m50458.c svneol=native#text/plain
src/emu/video/m50458.h svneol=native#text/plain
-src/emu/video/mb90092.c svneol=native#text/plain
-src/emu/video/mb90092.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/mc6845.c svneol=native#text/plain
src/emu/video/mc6845.h svneol=native#text/plain
src/emu/video/msm6255.c svneol=native#text/plain
diff --git a/src/emu/cpu/z180/z180.c b/src/emu/cpu/z180/z180.c
index 3b543aab443..c04f9a2f3e3 100644
--- a/src/emu/cpu/z180/z180.c
+++ b/src/emu/cpu/z180/z180.c
@@ -903,7 +903,7 @@ data |= 0x02; // kludge for 20pacgal
case Z180_CNTR:
data = cpustate->IO_CNTR & Z180_CNTR_RMASK;
data &= ~0x10; // Super Famicom Box sets the TE bit then wants it to be toggled after 8 bits transmitted
- logerror("Z180 '%s' CNTR rd $%02x ($%02x)\n", cpustate->device->tag(), data, cpustate->io[port & 0x3f]);
+ LOG(("Z180 '%s' CNTR rd $%02x ($%02x)\n", cpustate->device->tag(), data, cpustate->io[port & 0x3f]));
break;
case Z180_TRDR:
diff --git a/src/emu/emu.mak b/src/emu/emu.mak
index 3904ff3e81e..1ce507cd309 100644
--- a/src/emu/emu.mak
+++ b/src/emu/emu.mak
@@ -295,7 +295,7 @@ EMUVIDEOOBJS = \
$(EMUVIDEO)/i8275.o \
$(EMUVIDEO)/k053250.o \
$(EMUVIDEO)/m50458.o \
- $(EMUVIDEO)/mb90092.o \
+ $(EMUVIDEO)/mb90082.o \
$(EMUVIDEO)/mc6845.o \
$(EMUVIDEO)/msm6255.o \
$(EMUVIDEO)/pc_cga.o \
diff --git a/src/emu/video/mb90092.c b/src/emu/video/mb90082.c
index 5560f539937..19bedfc3371 100644
--- a/src/emu/video/mb90092.c
+++ b/src/emu/video/mb90082.c
@@ -1,6 +1,6 @@
/***************************************************************************
- Fujitsu MB90092 OSD
+ Fujitsu MB90082 OSD
preliminary device by Angelo Salese
@@ -10,7 +10,7 @@
***************************************************************************/
#include "emu.h"
-#include "video/mb90092.h"
+#include "video/mb90082.h"
@@ -19,25 +19,28 @@
//**************************************************************************
// device type definition
-const device_type MB90092 = &device_creator<mb90092_device>;
+const device_type MB90082 = &device_creator<mb90082_device>;
-static ADDRESS_MAP_START( mb90092_vram, AS_0, 16, mb90092_device )
- AM_RANGE(0x0000, 0x023f) AM_RAM // vram
+static ADDRESS_MAP_START( mb90082_vram, AS_0, 16, mb90082_device )
+ AM_RANGE(0x0000, 0x023f) AM_RAM // main screen vram
+ AM_RANGE(0x0400, 0x063f) AM_RAM // main screen attr
+// AM_RANGE(0x0800, 0x0a3f) AM_RAM // sub screen vram
+// AM_RANGE(0x0c00, 0x0e3f) AM_RAM // sub screen attr
ADDRESS_MAP_END
/* charset is undumped, but apparently a normal ASCII one is enough for the time being (for example "fnt0808.x1" in Sharp X1) */
-ROM_START( mb90092 )
- ROM_REGION( 0x0800, "mb90092", 0 )
- ROM_LOAD("mb90092_char.bin", 0x0000, 0x0800, NO_DUMP )
+ROM_START( mb90082 )
+ ROM_REGION( 0x2000, "mb90082", ROMREGION_ERASEFF )
+ ROM_LOAD("mb90082_char.bin", 0x0000, 0x0800, NO_DUMP )
ROM_END
//-------------------------------------------------
// rom_region - device-specific ROM region
//-------------------------------------------------
-const rom_entry *mb90092_device::device_rom_region() const
+const rom_entry *mb90082_device::device_rom_region() const
{
- return ROM_NAME( mb90092 );
+ return ROM_NAME( mb90082 );
}
//-------------------------------------------------
@@ -45,7 +48,7 @@ const rom_entry *mb90092_device::device_rom_region() const
// any address spaces owned by this device
//-------------------------------------------------
-const address_space_config *mb90092_device::memory_space_config(address_spacenum spacenum) const
+const address_space_config *mb90082_device::memory_space_config(address_spacenum spacenum) const
{
return (spacenum == AS_0) ? &m_space_config : NULL;
}
@@ -58,7 +61,7 @@ const address_space_config *mb90092_device::memory_space_config(address_spacenum
// readbyte - read a byte at the given address
//-------------------------------------------------
-inline UINT16 mb90092_device::read_word(offs_t address)
+inline UINT16 mb90082_device::read_word(offs_t address)
{
return space()->read_word(address << 1);
}
@@ -67,7 +70,7 @@ inline UINT16 mb90092_device::read_word(offs_t address)
// writebyte - write a byte at the given address
//-------------------------------------------------
-inline void mb90092_device::write_word(offs_t address, UINT16 data)
+inline void mb90082_device::write_word(offs_t address, UINT16 data)
{
space()->write_word(address << 1, data);
}
@@ -77,15 +80,15 @@ inline void mb90092_device::write_word(offs_t address, UINT16 data)
//**************************************************************************
//-------------------------------------------------
-// mb90092_device - constructor
+// mb90082_device - constructor
//-------------------------------------------------
-mb90092_device::mb90092_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : device_t(mconfig, MB90092, "mb90092", tag, owner, clock),
+mb90082_device::mb90082_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, MB90082, "mb90082", tag, owner, clock),
device_memory_interface(mconfig, *this),
- m_space_config("videoram", ENDIANNESS_LITTLE, 16, 16, 0, NULL, *ADDRESS_MAP_NAME(mb90092_vram))
+ m_space_config("videoram", ENDIANNESS_LITTLE, 16, 16, 0, NULL, *ADDRESS_MAP_NAME(mb90082_vram))
{
- m_shortname = "mb90092";
+ m_shortname = "mb90082";
}
@@ -95,7 +98,7 @@ mb90092_device::mb90092_device(const machine_config &mconfig, const char *tag, d
// on this device
//-------------------------------------------------
-void mb90092_device::device_validity_check(validity_checker &valid) const
+void mb90082_device::device_validity_check(validity_checker &valid) const
{
}
@@ -104,7 +107,7 @@ void mb90092_device::device_validity_check(validity_checker &valid) const
// device_start - device-specific startup
//-------------------------------------------------
-void mb90092_device::device_start()
+void mb90082_device::device_start()
{
}
@@ -114,13 +117,9 @@ void mb90092_device::device_start()
// device_reset - device-specific reset
//-------------------------------------------------
-void mb90092_device::device_reset()
+void mb90082_device::device_reset()
{
- int i;
m_cmd_ff = 0;
-
- for(i=0;i<0x120;i++)
- write_word(i,0x00ff);
}
@@ -128,7 +127,7 @@ void mb90092_device::device_reset()
// READ/WRITE HANDLERS
//**************************************************************************
-WRITE_LINE_MEMBER( mb90092_device::set_cs_line )
+WRITE_LINE_MEMBER( mb90082_device::set_cs_line )
{
m_reset_line = state;
@@ -139,7 +138,7 @@ WRITE_LINE_MEMBER( mb90092_device::set_cs_line )
}
-WRITE8_MEMBER( mb90092_device::write )
+WRITE8_MEMBER( mb90082_device::write )
{
UINT16 dat;
@@ -156,23 +155,42 @@ WRITE8_MEMBER( mb90092_device::write )
{
case 0x80: // Preset VRAM address
m_osd_addr = dat & 0x1ff;
- //m_vsl = (dat & 0x200) >> 9);
+ m_fil = (dat & 0x200) >> 9;
break;
- case 0x88: //
+ case 0x88: // Attribute select
+ m_attr = dat;
break;
case 0x90: // Write Character
int x,y;
x = (m_osd_addr & 0x01f);
y = (m_osd_addr & 0x1e0) >> 5;
- //printf("%d %d\n",x,y);
- write_word(x+y*24,dat);
-
- /* handle address increments */
- x = ((x + 1) % 24);
- if(x == 0)
- y = ((y + 1) % 12);
- m_osd_addr = x + (y << 5);
+ if(m_fil)
+ {
+ int i;
+ if(x != 0)
+ printf("FIL with %d %d\n",x,y);
+
+ for(i=0;i<24;i++)
+ {
+ write_word((i+y*24)|0x000,dat);
+ write_word((i+y*24)|0x200,m_attr);
+ }
+ }
+ else
+ {
+ write_word((x+y*24)|0x000,dat);
+ write_word((x+y*24)|0x200,m_attr);
+
+ /* handle address increments */
+ x = ((x + 1) % 24);
+ if(x == 0)
+ y = ((y + 1) % 12);
+ m_osd_addr = x + (y << 5);
+ }
+ break;
+ case 0xd0: // Set Under Color
+ m_uc = dat & 7;
break;
}
@@ -182,11 +200,18 @@ WRITE8_MEMBER( mb90092_device::write )
m_cmd_ff ^= 1;
}
-UINT32 mb90092_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+UINT32 mb90082_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
int x,y;
- UINT8 *pcg = memregion("mb90092")->base();
- UINT16 tile;
+ UINT8 *pcg = memregion("mb90082")->base();
+ UINT16 tile,attr;
+ UINT8 bg_r,bg_g,bg_b;
+
+ /* TODO: there's probably a way to control the brightness in this */
+ bg_b = m_uc & 1 ? 0xdf : 0;
+ bg_g = m_uc & 2 ? 0xdf : 0;
+ bg_r = m_uc & 4 ? 0xdf : 0;
+ bitmap.fill(MAKE_ARGB(0xff,bg_r,bg_g,bg_b),cliprect);
for(y=0;y<12;y++)
{
@@ -195,6 +220,7 @@ UINT32 mb90092_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap
int xi,yi;
tile = read_word(x+y*24);
+ attr = read_word((x+y*24)|0x200);
/* TODO: charset hook-up is obviously WRONG so following mustn't be trusted at all */
for(yi=0;yi<16;yi++)
@@ -202,15 +228,18 @@ UINT32 mb90092_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap
for(xi=0;xi<16;xi++)
{
UINT8 pix;
- UINT32 pen;
+ UINT8 color = (attr & 0x70) >> 4;
+ UINT8 r,g,b;
pix = (pcg[(tile*8)+(yi >> 1)] >> (7-(xi >> 1))) & 1;
- pen = pix ? 0xffffff : 0;
- if(tile == 0xff)
- pen = 0;
+ /* TODO: check this */
+ b = (color & 1) ? 0xff : 0;
+ g = (color & 2) ? 0xff : 0;
+ r = (color & 4) ? 0xff : 0;
- bitmap.pix32(y*16+yi,x*16+xi) = pen;
+ if(tile != 0xff && pix != 0)
+ bitmap.pix32(y*16+yi,x*16+xi) = r << 16 | g << 8 | b;
}
}
}
diff --git a/src/emu/video/mb90092.h b/src/emu/video/mb90082.h
index af6e4e69070..7799ab79684 100644
--- a/src/emu/video/mb90092.h
+++ b/src/emu/video/mb90082.h
@@ -6,8 +6,8 @@ Template for skeleton device
#pragma once
-#ifndef __MB90092DEV_H__
-#define __MB90092DEV_H__
+#ifndef __MB90082DEV_H__
+#define __MB90082DEV_H__
@@ -15,8 +15,8 @@ Template for skeleton device
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define MCFG_MB90092_ADD(_tag,_freq) \
- MCFG_DEVICE_ADD(_tag, MB90092, _freq) \
+#define MCFG_MB90082_ADD(_tag,_freq) \
+ MCFG_DEVICE_ADD(_tag, MB90082, _freq) \
//**************************************************************************
@@ -30,14 +30,14 @@ enum
};
-// ======================> mb90092_device
+// ======================> mb90082_device
-class mb90092_device : public device_t,
+class mb90082_device : public device_t,
public device_memory_interface
{
public:
// construction/destruction
- mb90092_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ mb90082_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// I/O operations
DECLARE_WRITE8_MEMBER( write );
@@ -56,9 +56,13 @@ protected:
private:
UINT8 m_cmd_ff;
UINT8 m_cmd,m_cmd_param;
- UINT16 m_osd_addr;
UINT8 m_reset_line;
+ UINT16 m_osd_addr;
+ UINT8 m_fil;
+ UINT8 m_uc;
+ UINT8 m_attr;
+
inline UINT16 read_word(offs_t address);
inline void write_word(offs_t address, UINT16 data);
@@ -67,7 +71,7 @@ private:
// device type definition
-extern const device_type MB90092;
+extern const device_type MB90082;
diff --git a/src/mame/drivers/sfcbox.c b/src/mame/drivers/sfcbox.c
index 92b2de7ce1c..c01963c56a8 100644
--- a/src/mame/drivers/sfcbox.c
+++ b/src/mame/drivers/sfcbox.c
@@ -119,7 +119,7 @@ How does the Super Famicom Box operates
#include "cpu/g65816/g65816.h"
#include "cpu/z180/z180.h"
#include "machine/s3520cf.h"
-#include "video/mb90092.h"
+#include "video/mb90082.h"
#include "includes/snes.h"
#include "audio/snes_snd.h"
#include "rendlay.h"
@@ -130,12 +130,12 @@ public:
sfcbox_state(const machine_config &mconfig, device_type type, const char *tag)
: snes_state(mconfig, type, tag),
m_bios(*this, "bios"),
- m_mb90092(*this,"mb90092"),
+ m_mb90082(*this,"mb90082"),
m_s3520cf(*this, "s3520cf")
{ }
required_device<cpu_device> m_bios;
- required_device<mb90092_device> m_mb90092;
+ required_device<mb90082_device> m_mb90082;
required_device<s3520cf_device> m_s3520cf;
UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
@@ -151,7 +151,7 @@ public:
UINT32 sfcbox_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect )
{
- m_mb90092->screen_update(screen,bitmap,cliprect);
+ m_mb90082->screen_update(screen,bitmap,cliprect);
return 0;
}
@@ -280,7 +280,7 @@ WRITE8_MEMBER( sfcbox_state::snes_map_1_w )
}
static ADDRESS_MAP_START( sfcbox_io, AS_IO, 8, sfcbox_state )
- AM_RANGE(0x0b, 0x0b) AM_DEVWRITE("mb90092",mb90092_device,write)
+ AM_RANGE(0x0b, 0x0b) AM_DEVWRITE("mb90082",mb90082_device,write)
AM_RANGE(0x00, 0x3f) AM_RAM // internal i/o
AM_RANGE(0x80, 0x80) AM_READ_PORT("KEY") AM_WRITE(port_80_w) // Keyswitch and Button Inputs / SNES Transfer and Misc Output
AM_RANGE(0x81, 0x81) AM_READWRITE(port_81_r,port_81_w) // SNES Transfer and Misc Input / Misc Output
@@ -318,7 +318,7 @@ static INPUT_PORTS_START( snes )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Play Mode 1 Button")
PORT_START("OSD_CS")
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("mb90092", mb90092_device, set_cs_line)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("mb90082", mb90082_device, set_cs_line)
PORT_START("SERIAL1_DATA1_L")
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Button A") PORT_PLAYER(1)
@@ -489,7 +489,7 @@ static MACHINE_CONFIG_DERIVED( sfcbox, snes )
MCFG_CPU_PROGRAM_MAP(sfcbox_map)
MCFG_CPU_IO_MAP(sfcbox_io)
- MCFG_MB90092_ADD("mb90092",XTAL_12MHz / 2) /* TODO: correct clock */
+ MCFG_MB90082_ADD("mb90082",XTAL_12MHz / 2) /* TODO: correct clock */
MCFG_S3520CF_ADD("s3520cf") /* RTC */
MCFG_MACHINE_START( sfcbox )