mirror of
https://github.com/holub/mame
synced 2025-04-19 23:12:11 +03:00
further shared code into devices (nw)
This commit is contained in:
parent
9661f1d1ea
commit
a9e3982e90
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -6434,6 +6434,8 @@ src/mame/machine/igs036crypt.c svneol=native#text/plain
|
||||
src/mame/machine/igs036crypt.h svneol=native#text/plain
|
||||
src/mame/machine/inder_sb.c svneol=native#text/plain
|
||||
src/mame/machine/inder_sb.h svneol=native#text/plain
|
||||
src/mame/machine/inder_vid.c svneol=native#text/plain
|
||||
src/mame/machine/inder_vid.h svneol=native#text/plain
|
||||
src/mame/machine/irem_cpu.c svneol=native#text/plain
|
||||
src/mame/machine/irem_cpu.h svneol=native#text/plain
|
||||
src/mame/machine/irobot.c svneol=native#text/plain
|
||||
|
@ -66,9 +66,8 @@ Dip sw.2
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "video/ramdac.h"
|
||||
#include "sound/dac.h"
|
||||
#include "cpu/tms34010/tms34010.h"
|
||||
#include "machine/inder_vid.h"
|
||||
|
||||
class littlerb_state : public driver_device
|
||||
{
|
||||
@ -76,14 +75,10 @@ public:
|
||||
littlerb_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_screen(*this, "screen"),
|
||||
m_indervid(*this, "inder_vid"),
|
||||
m_dacl(*this, "dacl"),
|
||||
m_dacr(*this, "dacr"),
|
||||
|
||||
m_vram(*this, "vram"),
|
||||
m_palette(*this, "palette"),
|
||||
m_shiftfull(0)
|
||||
|
||||
m_soundframe(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -91,41 +86,29 @@ public:
|
||||
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<inder_vid_device> m_indervid;
|
||||
|
||||
|
||||
required_device<dac_device> m_dacl;
|
||||
required_device<dac_device> m_dacr;
|
||||
UINT8 m_sound_index_l,m_sound_index_r;
|
||||
UINT16 m_sound_pointer_l,m_sound_pointer_r;
|
||||
int m_soundframe;
|
||||
|
||||
DECLARE_CUSTOM_INPUT_MEMBER(littlerb_frame_step_r);
|
||||
DECLARE_WRITE16_MEMBER(littlerb_l_sound_w);
|
||||
DECLARE_WRITE16_MEMBER(littlerb_r_sound_w);
|
||||
UINT8 sound_data_shift();
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(littlerb_scanline);
|
||||
|
||||
|
||||
required_shared_ptr<UINT16> m_vram;
|
||||
required_device<palette_device> m_palette;
|
||||
int m_shiftfull; // this might be a driver specific hack for a TMS bug.
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(littlerb_scanline_sound);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( ramdac_map, AS_0, 8, littlerb_state )
|
||||
AM_RANGE(0x000, 0x3ff) AM_DEVREADWRITE("ramdac",ramdac_device,ramdac_pal_r,ramdac_rgb888_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static RAMDAC_INTERFACE( ramdac_intf )
|
||||
{
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* could be slightly different (timing wise, directly related to the irqs), but certainly they smoked some bad pot for this messy way ... */
|
||||
UINT8 littlerb_state::sound_data_shift()
|
||||
{
|
||||
return ((m_screen->frame_number() % 16) == 0) ? 8 : 0;
|
||||
return ((m_soundframe % 16) == 0) ? 8 : 0;
|
||||
}
|
||||
|
||||
/* l is SFX, r is BGM (they doesn't seem to share the same data ROM) */
|
||||
@ -151,7 +134,7 @@ static ADDRESS_MAP_START( littlerb_main, AS_PROGRAM, 16, littlerb_state )
|
||||
AM_RANGE(0x000000, 0x0fffff) AM_ROM
|
||||
AM_RANGE(0x200000, 0x203fff) AM_RAM // main ram?
|
||||
|
||||
AM_RANGE(0x700000, 0x700007) AM_DEVREADWRITE("tms", tms34010_device, host_r, host_w)
|
||||
AM_RANGE(0x700000, 0x700007) AM_DEVREADWRITE("inder_vid:tms", tms34010_device, host_r, host_w)
|
||||
|
||||
AM_RANGE(0x740000, 0x740001) AM_WRITE(littlerb_l_sound_w)
|
||||
AM_RANGE(0x760000, 0x760001) AM_WRITE(littlerb_r_sound_w)
|
||||
@ -164,7 +147,7 @@ ADDRESS_MAP_END
|
||||
/* guess according to DASM code and checking the gameplay speed, could be different */
|
||||
CUSTOM_INPUT_MEMBER(littlerb_state::littlerb_frame_step_r)
|
||||
{
|
||||
UINT32 ret = m_screen->frame_number();
|
||||
UINT32 ret = m_soundframe;
|
||||
|
||||
return (ret) & 7;
|
||||
}
|
||||
@ -246,7 +229,7 @@ static INPUT_PORTS_START( littlerb )
|
||||
PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
INPUT_PORTS_END
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(littlerb_state::littlerb_scanline)
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(littlerb_state::littlerb_scanline_sound)
|
||||
{
|
||||
int scanline = param;
|
||||
|
||||
@ -265,111 +248,22 @@ TIMER_DEVICE_CALLBACK_MEMBER(littlerb_state::littlerb_scanline)
|
||||
m_sound_pointer_r&=0x3ff;
|
||||
}
|
||||
|
||||
if (scanline == 0) m_soundframe++;
|
||||
|
||||
// the TMS generates the main interrupt
|
||||
|
||||
// printf("scanline %d\n", scanline);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( littlerb_tms_map, AS_PROGRAM, 16, littlerb_state )
|
||||
AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_SHARE("vram")
|
||||
AM_RANGE(0x04000000, 0x0400000f) AM_DEVWRITE8("ramdac",ramdac_device,index_w,0x00ff)
|
||||
AM_RANGE(0x04000010, 0x0400001f) AM_DEVREADWRITE8("ramdac",ramdac_device,pal_r,pal_w,0x00ff)
|
||||
AM_RANGE(0x04000030, 0x0400003f) AM_DEVWRITE8("ramdac",ramdac_device,index_r_w,0x00ff)
|
||||
AM_RANGE(0xc0000000, 0xc00001ff) AM_DEVREADWRITE("tms", tms34010_device, io_register_r, io_register_w)
|
||||
AM_RANGE(0xffc00000, 0xffffffff) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
static void littlerb_scanline(screen_device &screen, bitmap_rgb32 &bitmap, int scanline, const tms34010_display_params *params)
|
||||
{
|
||||
littlerb_state *state = screen.machine().driver_data<littlerb_state>();
|
||||
|
||||
UINT16 *vram = &state->m_vram[(((params->rowaddr << 8)) & 0x3ff00) ];
|
||||
UINT32 *dest = &bitmap.pix32(scanline);
|
||||
|
||||
const pen_t *paldata = state->m_palette->pens();
|
||||
|
||||
int coladdr = params->coladdr;
|
||||
int x;
|
||||
|
||||
for (x = params->heblnk; x < params->hsblnk; x += 2)
|
||||
{
|
||||
UINT16 pixels = vram[coladdr++ & 0xff];
|
||||
dest[x + 0] = paldata[pixels & 0xff];
|
||||
dest[x + 1] = paldata[pixels >> 8];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void littlerb_to_shiftreg(address_space &space, UINT32 address, UINT16 *shiftreg)
|
||||
{
|
||||
littlerb_state *state = space.machine().driver_data<littlerb_state>();
|
||||
|
||||
if (state->m_shiftfull == 0)
|
||||
{
|
||||
//printf("read to shift regs address %08x (%08x)\n", address, TOWORD(address) * 2);
|
||||
memcpy(shiftreg, &state->m_vram[TOWORD(address) & ~TOWORD(0x1fff)], TOBYTE(0x2000));
|
||||
state->m_shiftfull = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void littlerb_from_shiftreg(address_space &space, UINT32 address, UINT16 *shiftreg)
|
||||
{
|
||||
littlerb_state *state = space.machine().driver_data<littlerb_state>();
|
||||
memcpy(&state->m_vram[TOWORD(address) & ~TOWORD(0x1fff)], shiftreg, TOBYTE(0x2000));
|
||||
|
||||
state->m_shiftfull = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void m68k_gen_int(device_t *device, int state)
|
||||
{
|
||||
littlerb_state *drvstate = device->machine().driver_data<littlerb_state>();
|
||||
if (state) drvstate->m_maincpu->set_input_line(4, ASSERT_LINE);
|
||||
else drvstate->m_maincpu->set_input_line(4, CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
static const tms34010_config tms_config_littlerb =
|
||||
{
|
||||
TRUE, /* halt on reset */
|
||||
"screen", /* the screen operated on */
|
||||
XTAL_40MHz/12, /* pixel clock */
|
||||
2, /* pixels per clock */
|
||||
NULL, /* scanline callback (indexed16) */
|
||||
littlerb_scanline, /* scanline callback (rgb32) */
|
||||
m68k_gen_int, /* generate interrupt */
|
||||
littlerb_to_shiftreg, /* write to shiftreg function */
|
||||
littlerb_from_shiftreg /* read from shiftreg function */
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( littlerb, littlerb_state )
|
||||
MCFG_CPU_ADD("maincpu", M68000, 12000000)
|
||||
MCFG_CPU_PROGRAM_MAP(littlerb_main)
|
||||
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", littlerb_state, littlerb_scanline, "screen", 0, 1)
|
||||
|
||||
MCFG_INDER_VIDEO_ADD("inder_vid")
|
||||
|
||||
MCFG_CPU_ADD("tms", TMS34010, XTAL_40MHz)
|
||||
MCFG_CPU_CONFIG(tms_config_littlerb)
|
||||
MCFG_CPU_PROGRAM_MAP(littlerb_tms_map)
|
||||
// should probably be done with a timer rather than relying on screen(!)
|
||||
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", littlerb_state, littlerb_scanline_sound, "inder_vid:inder_screen", 0, 1)
|
||||
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_RAW_PARAMS(XTAL_40MHz/12, 424, 0, 338-1, 262, 0, 246-1)
|
||||
MCFG_SCREEN_UPDATE_DEVICE("tms", tms34010_device, tms340x0_rgb32)
|
||||
|
||||
|
||||
MCFG_PALETTE_ADD("palette", 0x100)
|
||||
|
||||
MCFG_RAMDAC_ADD("ramdac", ramdac_intf, ramdac_map, "palette")
|
||||
|
||||
// MCFG_PALETTE_INIT_OWNER(littlerb_state,littlerb)
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker")
|
||||
|
||||
MCFG_DAC_ADD("dacl")
|
||||
|
@ -55,13 +55,14 @@
|
||||
*/
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/tms34010/tms34010.h"
|
||||
#include "cpu/m68000/m68000.h"
|
||||
|
||||
|
||||
#include "video/ramdac.h"
|
||||
|
||||
|
||||
#include "machine/i8255.h"
|
||||
#include "machine/inder_sb.h"
|
||||
#include "machine/inder_vid.h"
|
||||
|
||||
|
||||
|
||||
@ -72,32 +73,22 @@ public:
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_mainram(*this, "mainram"),
|
||||
m_vram(*this, "vram"),
|
||||
port_c_value(0),
|
||||
m_palette(*this, "palette"),
|
||||
m_tms(*this, "tms"),
|
||||
m_indersb(*this, "inder_sb")
|
||||
m_indersb(*this, "inder_sb"),
|
||||
m_indervid(*this, "inder_vid")
|
||||
|
||||
{
|
||||
m_shiftfull = 0;
|
||||
|
||||
}
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_shared_ptr<UINT16> m_mainram;
|
||||
required_shared_ptr<UINT16> m_vram;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DECLARE_DRIVER_INIT(megaphx);
|
||||
DECLARE_MACHINE_RESET(megaphx);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DECLARE_READ8_MEMBER(port_c_r);
|
||||
DECLARE_WRITE8_MEMBER(port_c_w);
|
||||
@ -112,29 +103,21 @@ public:
|
||||
UINT16 m_pic_result;
|
||||
|
||||
UINT8 port_c_value;
|
||||
required_device<palette_device> m_palette;
|
||||
required_device<tms34010_device> m_tms;
|
||||
|
||||
required_device<inder_sb_device> m_indersb;
|
||||
|
||||
|
||||
int m_shiftfull; // this might be a driver specific hack for a TMS bug.
|
||||
|
||||
required_device<inder_vid_device> m_indervid;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( megaphx_68k_map, AS_PROGRAM, 16, megaphx_state )
|
||||
AM_RANGE(0x000000, 0x0013ff) AM_RAM AM_SHARE("mainram") // maps over part of the rom??
|
||||
|
||||
AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_REGION("roms67", 0x00000) // or the rom doesn't map here? it contains the service mode grid amongst other things..
|
||||
|
||||
AM_RANGE(0x040000, 0x040007) AM_DEVREADWRITE("tms", tms34010_device, host_r, host_w)
|
||||
AM_RANGE(0x040000, 0x040007) AM_DEVREADWRITE("inder_vid:tms", tms34010_device, host_r, host_w)
|
||||
|
||||
AM_RANGE(0x050000, 0x050001) AM_DEVWRITE("inder_sb", inder_sb_device, megaphx_0x050000_w)
|
||||
AM_RANGE(0x050002, 0x050003) AM_DEVREAD("inder_sb", inder_sb_device, megaphx_0x050002_r)
|
||||
@ -151,94 +134,6 @@ static ADDRESS_MAP_START( megaphx_68k_map, AS_PROGRAM, 16, megaphx_state )
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( megaphx_tms_map, AS_PROGRAM, 16, megaphx_state )
|
||||
|
||||
AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_SHARE("vram") // vram?
|
||||
// AM_RANGE(0x00100000, 0x002fffff) AM_RAM // vram?
|
||||
// AM_RANGE(0x00300000, 0x003fffff) AM_RAM
|
||||
// AM_RANGE(0x04000000, 0x040000ff) AM_WRITENOP
|
||||
|
||||
AM_RANGE(0x04000000, 0x0400000f) AM_DEVWRITE8("ramdac",ramdac_device,index_w,0x00ff)
|
||||
AM_RANGE(0x04000010, 0x0400001f) AM_DEVREADWRITE8("ramdac",ramdac_device,pal_r,pal_w,0x00ff)
|
||||
AM_RANGE(0x04000030, 0x0400003f) AM_DEVWRITE8("ramdac",ramdac_device,index_r_w,0x00ff)
|
||||
AM_RANGE(0x04000090, 0x0400009f) AM_WRITENOP
|
||||
|
||||
AM_RANGE(0xc0000000, 0xc00001ff) AM_DEVREADWRITE("tms", tms34010_device, io_register_r, io_register_w)
|
||||
AM_RANGE(0xffc00000, 0xffffffff) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
static void megaphx_scanline(screen_device &screen, bitmap_rgb32 &bitmap, int scanline, const tms34010_display_params *params)
|
||||
{
|
||||
megaphx_state *state = screen.machine().driver_data<megaphx_state>();
|
||||
|
||||
UINT16 *vram = &state->m_vram[(params->rowaddr << 8) & 0x3ff00];
|
||||
UINT32 *dest = &bitmap.pix32(scanline);
|
||||
|
||||
const pen_t *paldata = state->m_palette->pens();
|
||||
|
||||
int coladdr = params->coladdr;
|
||||
int x;
|
||||
|
||||
for (x = params->heblnk; x < params->hsblnk; x += 2)
|
||||
{
|
||||
UINT16 pixels = vram[coladdr++ & 0xff];
|
||||
dest[x + 0] = paldata[pixels & 0xff];
|
||||
dest[x + 1] = paldata[pixels >> 8];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void megaphx_to_shiftreg(address_space &space, UINT32 address, UINT16 *shiftreg)
|
||||
{
|
||||
megaphx_state *state = space.machine().driver_data<megaphx_state>();
|
||||
|
||||
if (state->m_shiftfull == 0)
|
||||
{
|
||||
//printf("read to shift regs address %08x (%08x)\n", address, TOWORD(address) * 2);
|
||||
|
||||
memcpy(shiftreg, &state->m_vram[TOWORD(address) & ~TOWORD(0x1fff)], TOBYTE(0x2000)); // & ~TOWORD(0x1fff) is needed for round 6
|
||||
state->m_shiftfull = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void megaphx_from_shiftreg(address_space &space, UINT32 address, UINT16 *shiftreg)
|
||||
{
|
||||
// printf("write from shift regs address %08x (%08x)\n", address, TOWORD(address) * 2);
|
||||
|
||||
megaphx_state *state = space.machine().driver_data<megaphx_state>();
|
||||
memcpy(&state->m_vram[TOWORD(address) & ~TOWORD(0x1fff)], shiftreg, TOBYTE(0x2000));
|
||||
|
||||
state->m_shiftfull = 0;
|
||||
}
|
||||
|
||||
MACHINE_RESET_MEMBER(megaphx_state,megaphx)
|
||||
{
|
||||
}
|
||||
|
||||
static void m68k_gen_int(device_t *device, int state)
|
||||
{
|
||||
megaphx_state *drvstate = device->machine().driver_data<megaphx_state>();
|
||||
if (state) drvstate->m_maincpu->set_input_line(4, ASSERT_LINE);
|
||||
else drvstate->m_maincpu->set_input_line(4, CLEAR_LINE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static const tms34010_config tms_config_megaphx =
|
||||
{
|
||||
TRUE, /* halt on reset */
|
||||
"screen", /* the screen operated on */
|
||||
XTAL_40MHz/12, /* pixel clock */
|
||||
2, /* pixels per clock */
|
||||
NULL, /* scanline callback (indexed16) */
|
||||
megaphx_scanline, /* scanline callback (rgb32) */
|
||||
m68k_gen_int, /* generate interrupt */
|
||||
megaphx_to_shiftreg, /* write to shiftreg function */
|
||||
megaphx_from_shiftreg /* read from shiftreg function */
|
||||
};
|
||||
|
||||
|
||||
|
||||
static INPUT_PORTS_START( megaphx )
|
||||
@ -336,14 +231,7 @@ static INPUT_PORTS_START( megaphx )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
INPUT_PORTS_END
|
||||
|
||||
static ADDRESS_MAP_START( ramdac_map, AS_0, 8, megaphx_state )
|
||||
AM_RANGE(0x000, 0x3ff) AM_DEVREADWRITE("ramdac",ramdac_device,ramdac_pal_r,ramdac_rgb888_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static RAMDAC_INTERFACE( ramdac_intf )
|
||||
{
|
||||
1
|
||||
};
|
||||
|
||||
/* why don't the port_c read/writes work properly when hooked through the 8255? */
|
||||
|
||||
@ -482,23 +370,14 @@ static MACHINE_CONFIG_START( megaphx, megaphx_state )
|
||||
MCFG_CPU_ADD("maincpu", M68000, 8000000) // ?? can't read xtal due to reflections, CPU is an 8Mhz part
|
||||
MCFG_CPU_PROGRAM_MAP(megaphx_68k_map)
|
||||
|
||||
MCFG_CPU_ADD("tms", TMS34010, XTAL_40MHz)
|
||||
MCFG_CPU_CONFIG(tms_config_megaphx)
|
||||
MCFG_CPU_PROGRAM_MAP(megaphx_tms_map)
|
||||
|
||||
MCFG_INDER_AUDIO_ADD("inder_sb")
|
||||
|
||||
MCFG_I8255A_ADD( "ppi8255_0", ppi8255_intf_0 )
|
||||
|
||||
MCFG_MACHINE_RESET_OVERRIDE(megaphx_state,megaphx)
|
||||
MCFG_INDER_VIDEO_ADD("inder_vid")
|
||||
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_RAW_PARAMS(XTAL_40MHz/12, 424, 0, 338-1, 262, 0, 246-1)
|
||||
MCFG_SCREEN_UPDATE_DEVICE("tms", tms34010_device, tms340x0_rgb32)
|
||||
|
||||
MCFG_PALETTE_ADD("palette", 256)
|
||||
|
||||
MCFG_RAMDAC_ADD("ramdac", ramdac_intf, ramdac_map, "palette")
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
DRIVER_INIT_MEMBER(megaphx_state,megaphx)
|
||||
|
147
src/mame/machine/inder_vid.c
Normal file
147
src/mame/machine/inder_vid.c
Normal file
@ -0,0 +1,147 @@
|
||||
/* Inder / Dinamic Video */
|
||||
|
||||
/* Inder / Dinamic Sound Board */
|
||||
|
||||
|
||||
#include "emu.h"
|
||||
#include "machine/inder_vid.h"
|
||||
|
||||
|
||||
|
||||
extern const device_type INDER_VIDEO = &device_creator<inder_vid_device>;
|
||||
|
||||
|
||||
inder_vid_device::inder_vid_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, INDER_VIDEO, "Inder / Dinamic TMS Video", tag, owner, clock, "indervd", __FILE__),
|
||||
/* device_video_interface(mconfig, *this, false), */
|
||||
m_vram(*this, "vram"),
|
||||
m_palette(*this, "palette"),
|
||||
m_tms(*this, "tms")
|
||||
{
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( megaphx_tms_map, AS_PROGRAM, 16, inder_vid_device )
|
||||
|
||||
AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_SHARE("vram") // vram?
|
||||
|
||||
AM_RANGE(0x04000000, 0x0400000f) AM_DEVWRITE8("ramdac",ramdac_device,index_w,0x00ff)
|
||||
AM_RANGE(0x04000010, 0x0400001f) AM_DEVREADWRITE8("ramdac",ramdac_device,pal_r,pal_w,0x00ff)
|
||||
AM_RANGE(0x04000030, 0x0400003f) AM_DEVWRITE8("ramdac",ramdac_device,index_r_w,0x00ff)
|
||||
AM_RANGE(0x04000090, 0x0400009f) AM_WRITENOP
|
||||
|
||||
AM_RANGE(0xc0000000, 0xc00001ff) AM_DEVREADWRITE("tms", tms34010_device, io_register_r, io_register_w)
|
||||
AM_RANGE(0xffc00000, 0xffffffff) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
static void megaphx_scanline(screen_device &screen, bitmap_rgb32 &bitmap, int scanline, const tms34010_display_params *params)
|
||||
{
|
||||
inder_vid_device *state = (inder_vid_device*)screen.machine().device("inder_vid");
|
||||
|
||||
UINT16 *vram = &state->m_vram[(params->rowaddr << 8) & 0x3ff00];
|
||||
UINT32 *dest = &bitmap.pix32(scanline);
|
||||
|
||||
const pen_t *paldata = state->m_palette->pens();
|
||||
|
||||
int coladdr = params->coladdr;
|
||||
int x;
|
||||
|
||||
for (x = params->heblnk; x < params->hsblnk; x += 2)
|
||||
{
|
||||
UINT16 pixels = vram[coladdr++ & 0xff];
|
||||
dest[x + 0] = paldata[pixels & 0xff];
|
||||
dest[x + 1] = paldata[pixels >> 8];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void megaphx_to_shiftreg(address_space &space, UINT32 address, UINT16 *shiftreg)
|
||||
{
|
||||
inder_vid_device *state = (inder_vid_device*)space.machine().device("inder_vid");
|
||||
|
||||
if (state->m_shiftfull == 0)
|
||||
{
|
||||
//printf("read to shift regs address %08x (%08x)\n", address, TOWORD(address) * 2);
|
||||
|
||||
memcpy(shiftreg, &state->m_vram[TOWORD(address) & ~TOWORD(0x1fff)], TOBYTE(0x2000)); // & ~TOWORD(0x1fff) is needed for round 6
|
||||
state->m_shiftfull = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void megaphx_from_shiftreg(address_space &space, UINT32 address, UINT16 *shiftreg)
|
||||
{
|
||||
// printf("write from shift regs address %08x (%08x)\n", address, TOWORD(address) * 2);
|
||||
|
||||
inder_vid_device *state = (inder_vid_device*)space.machine().device("inder_vid");
|
||||
|
||||
memcpy(&state->m_vram[TOWORD(address) & ~TOWORD(0x1fff)], shiftreg, TOBYTE(0x2000));
|
||||
|
||||
state->m_shiftfull = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void m68k_gen_int(device_t *device, int state)
|
||||
{
|
||||
cpu_device *maincpu = (cpu_device*)device->machine().device("maincpu");
|
||||
if (state) maincpu->set_input_line(4, ASSERT_LINE);
|
||||
else maincpu->set_input_line(4, CLEAR_LINE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static const tms34010_config tms_config_megaphx =
|
||||
{
|
||||
TRUE, /* halt on reset */
|
||||
"inder_vid:inder_screen", /* the screen operated on */
|
||||
XTAL_40MHz/12, /* pixel clock */
|
||||
2, /* pixels per clock */
|
||||
NULL, /* scanline callback (indexed16) */
|
||||
megaphx_scanline, /* scanline callback (rgb32) */
|
||||
m68k_gen_int, /* generate interrupt */
|
||||
megaphx_to_shiftreg, /* write to shiftreg function */
|
||||
megaphx_from_shiftreg /* read from shiftreg function */
|
||||
};
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( ramdac_map, AS_0, 8, inder_vid_device )
|
||||
AM_RANGE(0x000, 0x3ff) AM_DEVREADWRITE("ramdac",ramdac_device,ramdac_pal_r,ramdac_rgb888_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static RAMDAC_INTERFACE( ramdac_intf )
|
||||
{
|
||||
1
|
||||
};
|
||||
|
||||
static MACHINE_CONFIG_FRAGMENT( inder_vid )
|
||||
MCFG_CPU_ADD("tms", TMS34010, XTAL_40MHz)
|
||||
MCFG_CPU_CONFIG(tms_config_megaphx)
|
||||
MCFG_CPU_PROGRAM_MAP(megaphx_tms_map)
|
||||
|
||||
MCFG_SCREEN_ADD("inder_screen", RASTER)
|
||||
MCFG_SCREEN_RAW_PARAMS(XTAL_40MHz/12, 424, 0, 338-1, 262, 0, 246-1)
|
||||
MCFG_SCREEN_UPDATE_DEVICE("tms", tms34010_device, tms340x0_rgb32)
|
||||
|
||||
|
||||
MCFG_PALETTE_ADD("palette", 256)
|
||||
|
||||
MCFG_RAMDAC_ADD("ramdac", ramdac_intf, ramdac_map, "palette")
|
||||
|
||||
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
machine_config_constructor inder_vid_device::device_mconfig_additions() const
|
||||
{
|
||||
return MACHINE_CONFIG_NAME( inder_vid );
|
||||
}
|
||||
|
||||
void inder_vid_device::device_start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void inder_vid_device::device_reset()
|
||||
{
|
||||
m_shiftfull = 0;
|
||||
}
|
47
src/mame/machine/inder_vid.h
Normal file
47
src/mame/machine/inder_vid.h
Normal file
@ -0,0 +1,47 @@
|
||||
/* Inder / Dinamic Video */
|
||||
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __INDER_VIDEO__
|
||||
#define __INDER_VIDEO__
|
||||
|
||||
|
||||
#include "video/ramdac.h"
|
||||
#include "cpu/tms34010/tms34010.h"
|
||||
|
||||
extern const device_type INDER_VIDEO;
|
||||
|
||||
#define MCFG_INDER_VIDEO_ADD(_tag) \
|
||||
MCFG_DEVICE_ADD(_tag, INDER_VIDEO, 0)
|
||||
|
||||
|
||||
class inder_vid_device : public device_t
|
||||
/* public device_video_interface */
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
inder_vid_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
required_shared_ptr<UINT16> m_vram;
|
||||
required_device<palette_device> m_palette;
|
||||
required_device<tms34010_device> m_tms;
|
||||
|
||||
int m_shiftfull; // this might be a driver specific hack for a TMS bug.
|
||||
|
||||
protected:
|
||||
virtual machine_config_constructor device_mconfig_additions() const;
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -2084,6 +2084,7 @@ $(MAMEOBJ)/misc.a: \
|
||||
$(DRIVERS)/coolpool.o \
|
||||
$(DRIVERS)/megaphx.o \
|
||||
$(MACHINE)/inder_sb.o \
|
||||
$(MACHINE)/inder_vid.o \
|
||||
$(DRIVERS)/corona.o \
|
||||
$(DRIVERS)/crystal.o $(VIDEO)/vrender0.o \
|
||||
$(DRIVERS)/cubeqst.o \
|
||||
|
Loading…
Reference in New Issue
Block a user