summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--.gitattributes2
-rw-r--r--src/emu/emu.mak1
-rw-r--r--src/emu/video/m50458.c2
-rw-r--r--src/emu/video/mb90092.c207
-rw-r--r--src/emu/video/mb90092.h78
-rw-r--r--src/mame/drivers/sfcbox.c32
6 files changed, 314 insertions, 8 deletions
diff --git a/.gitattributes b/.gitattributes
index 04f33915d7b..47cd1358879 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1599,6 +1599,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/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/emu.mak b/src/emu/emu.mak
index 8e25353c25c..a5e574c7958 100644
--- a/src/emu/emu.mak
+++ b/src/emu/emu.mak
@@ -295,6 +295,7 @@ EMUVIDEOOBJS = \
$(EMUVIDEO)/i8275.o \
$(EMUVIDEO)/k053250.o \
$(EMUVIDEO)/m50458.o \
+ $(EMUVIDEO)/mb90092.o \
$(EMUVIDEO)/mc6845.o \
$(EMUVIDEO)/msm6255.o \
$(EMUVIDEO)/pc_cga.o \
diff --git a/src/emu/video/m50458.c b/src/emu/video/m50458.c
index 603976b079c..4880d5f9734 100644
--- a/src/emu/video/m50458.c
+++ b/src/emu/video/m50458.c
@@ -2,7 +2,7 @@
Mitsubishi M50458 OSD chip
- preliminary device by Angelo Salese
+ device by Angelo Salese
TODO:
- vertical scrolling needs references (might work differently and/or in
diff --git a/src/emu/video/mb90092.c b/src/emu/video/mb90092.c
new file mode 100644
index 00000000000..f38199522e2
--- /dev/null
+++ b/src/emu/video/mb90092.c
@@ -0,0 +1,207 @@
+/***************************************************************************
+
+ Fujitsu MB90092 OSD
+
+ preliminary device by Angelo Salese
+
+ TODO:
+ - get a real charset ROM;
+
+***************************************************************************/
+
+#include "emu.h"
+#include "video/mb90092.h"
+
+
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+// device type definition
+const device_type MB90092 = &device_creator<mb90092_device>;
+
+static ADDRESS_MAP_START( mb90092_vram, AS_0, 16, mb90092_device )
+ AM_RANGE(0x0000, 0x023f) AM_RAM // vram
+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_END
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const rom_entry *mb90092_device::device_rom_region() const
+{
+ return ROM_NAME( mb90092 );
+}
+
+//-------------------------------------------------
+// memory_space_config - return a description of
+// any address spaces owned by this device
+//-------------------------------------------------
+
+const address_space_config *mb90092_device::memory_space_config(address_spacenum spacenum) const
+{
+ return (spacenum == AS_0) ? &m_space_config : NULL;
+}
+
+//**************************************************************************
+// INLINE HELPERS
+//**************************************************************************
+
+//-------------------------------------------------
+// readbyte - read a byte at the given address
+//-------------------------------------------------
+
+inline UINT16 mb90092_device::read_word(offs_t address)
+{
+ return space()->read_word(address << 1);
+}
+
+//-------------------------------------------------
+// writebyte - write a byte at the given address
+//-------------------------------------------------
+
+inline void mb90092_device::write_word(offs_t address, UINT16 data)
+{
+ space()->write_word(address << 1, data);
+}
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// mb90092_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),
+ device_memory_interface(mconfig, *this),
+ m_space_config("videoram", ENDIANNESS_LITTLE, 16, 16, 0, NULL, *ADDRESS_MAP_NAME(mb90092_vram))
+{
+ m_shortname = "mb90092";
+
+}
+
+
+//-------------------------------------------------
+// device_validity_check - perform validity checks
+// on this device
+//-------------------------------------------------
+
+void mb90092_device::device_validity_check(validity_checker &valid) const
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void mb90092_device::device_start()
+{
+
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void mb90092_device::device_reset()
+{
+ int i;
+ m_cmd_ff = 0;
+
+ for(i=0;i<0x120;i++)
+ write_word(i,0x00ff);
+}
+
+
+//**************************************************************************
+// READ/WRITE HANDLERS
+//**************************************************************************
+
+WRITE8_MEMBER( mb90092_device::write )
+{
+ UINT16 dat;
+
+ switch(m_cmd_ff)
+ {
+ case OSD_COMMAND:
+ m_cmd = data & 0xf8;
+ m_cmd_param = data & 7;
+ //printf("cmd %02x\n",data);
+ break;
+ case OSD_DATA:
+ dat = ((m_cmd_param & 7)<<7) | (data & 0x7f);
+ switch(m_cmd)
+ {
+ case 0x80: // preset VRAM address
+ m_osd_addr = dat;
+ //printf("%04x %d %d\n",m_osd_addr,(m_osd_addr & 0x1f),(m_osd_addr & 0x1e0) >> 5);
+ break;
+ case 0x90: // write Character
+ int x,y;
+ x = (m_osd_addr & 0x1f);
+ 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);
+
+ break;
+
+ }
+ break;
+ }
+
+ m_cmd_ff ^= 1;
+}
+
+UINT32 mb90092_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+{
+ int x,y;
+ UINT8 *pcg = memregion("mb90092")->base();
+ UINT16 tile;
+
+ for(y=0;y<12;y++)
+ {
+ for(x=0;x<24;x++)
+ {
+ int xi,yi;
+
+ tile = read_word(x+y*24);
+
+ /* TODO: charset hook-up is obviously WRONG so following mustn't be trusted at all */
+ for(yi=0;yi<16;yi++)
+ {
+ for(xi=0;xi<16;xi++)
+ {
+ UINT8 pix;
+ UINT32 pen;
+
+ pix = (pcg[(tile*8)+(yi >> 1)] >> (7-(xi >> 1))) & 1;
+
+ pen = pix ? 0xffffff : 0;
+ if(tile == 0xff)
+ pen = 0;
+
+ bitmap.pix32(y*16+yi,x*16+xi) = pen;
+ }
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/src/emu/video/mb90092.h b/src/emu/video/mb90092.h
new file mode 100644
index 00000000000..0a30051d39f
--- /dev/null
+++ b/src/emu/video/mb90092.h
@@ -0,0 +1,78 @@
+/***************************************************************************
+
+Template for skeleton device
+
+***************************************************************************/
+
+#pragma once
+
+#ifndef __MB90092DEV_H__
+#define __MB90092DEV_H__
+
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_MB90092_ADD(_tag,_freq) \
+ MCFG_DEVICE_ADD(_tag, MB90092, _freq) \
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+enum
+{
+ OSD_COMMAND = 0,
+ OSD_DATA
+};
+
+
+// ======================> mb90092_device
+
+class mb90092_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);
+
+ // I/O operations
+ DECLARE_WRITE8_MEMBER( write );
+
+ UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ virtual const rom_entry *device_rom_region() const;
+
+protected:
+ // device-level overrides
+ virtual void device_validity_check(validity_checker &valid) const;
+ virtual void device_start();
+ virtual void device_reset();
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
+
+private:
+ UINT8 m_cmd_ff;
+ UINT8 m_cmd,m_cmd_param;
+ UINT16 m_osd_addr;
+
+ inline UINT16 read_word(offs_t address);
+ inline void write_word(offs_t address, UINT16 data);
+
+ const address_space_config m_space_config;
+};
+
+
+// device type definition
+extern const device_type MB90092;
+
+
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+
+
+#endif
diff --git a/src/mame/drivers/sfcbox.c b/src/mame/drivers/sfcbox.c
index 89ee72b0f05..05a096d0820 100644
--- a/src/mame/drivers/sfcbox.c
+++ b/src/mame/drivers/sfcbox.c
@@ -117,22 +117,31 @@ How does the Super Famicom Box operates
#include "cpu/spc700/spc700.h"
#include "cpu/g65816/g65816.h"
#include "cpu/z180/z180.h"
+#include "video/mb90092.h"
#include "includes/snes.h"
#include "audio/snes_snd.h"
+#include "rendlay.h"
class sfcbox_state : public snes_state
{
public:
sfcbox_state(const machine_config &mconfig, device_type type, const char *tag)
: snes_state(mconfig, type, tag),
- m_bios(*this, "bios")
+ m_bios(*this, "bios"),
+ m_mb90092(*this,"mb90092")
{ }
required_device <cpu_device> m_bios;
+ required_device <mb90092_device> m_mb90092;
- DECLARE_WRITE8_MEMBER(tx_w);
+ UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
};
+UINT32 sfcbox_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect )
+{
+ m_mb90092->screen_update(screen,bitmap,cliprect);
+ return 0;
+}
static ADDRESS_MAP_START( snes_map, AS_PROGRAM, 8, sfcbox_state )
AM_RANGE(0x000000, 0x2fffff) AM_READWRITE_LEGACY(snes_r_bank1, snes_w_bank1) /* I/O and ROM (repeats for each bank) */
@@ -171,13 +180,9 @@ static ADDRESS_MAP_START( sfcbox_map, AS_PROGRAM, 8, sfcbox_state )
ADDRESS_MAP_END
-WRITE8_MEMBER( sfcbox_state::tx_w )
-{
- printf("%02x\n",data);
-}
static ADDRESS_MAP_START( sfcbox_io, AS_IO, 8, sfcbox_state )
- AM_RANGE(0x0b, 0x0b) AM_WRITE(tx_w)
+ AM_RANGE(0x0b, 0x0b) AM_DEVWRITE("mb90092",mb90092_device,write)
AM_RANGE(0x00, 0x3f) AM_RAM // internal i/o
// AM_RANGE(0x80, 0x80) // Keyswitch and Button Inputs / SNES Transfer and Misc Output
// AM_RANGE(0x81, 0x81) // SNES Transfer and Misc Input / Misc Output
@@ -343,6 +348,19 @@ 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: pixel clock */
+
+ /* TODO: the screen should actually superimpose, but for the time being let's just separate outputs for now */
+ MCFG_DEFAULT_LAYOUT(layout_dualhsxs)
+
+ MCFG_SCREEN_ADD("osd", RASTER)
+ MCFG_SCREEN_REFRESH_RATE(60)
+ MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
+// MCFG_SCREEN_SIZE(24*12+22, 12*18+22)
+// MCFG_SCREEN_VISIBLE_AREA(0*8, 24*12-1, 0*8, 12*18-1)
+ MCFG_SCREEN_SIZE(24*16+22, 12*16+22)
+ MCFG_SCREEN_VISIBLE_AREA(0*8, 24*16-1, 0*8, 12*16-1)
+ MCFG_SCREEN_UPDATE_DRIVER(sfcbox_state,screen_update)
MACHINE_CONFIG_END
/***************************************************************************