Added terminal to Konami M2 (nw)

This commit is contained in:
angelosa 2017-01-28 03:19:57 +01:00
parent 6cd10fc080
commit 5a0a974897
2 changed files with 74 additions and 31 deletions

View File

@ -227,13 +227,7 @@ READ8_MEMBER( funkball_state::serial_r )
WRITE8_MEMBER( funkball_state::serial_w )
{
if(offset == 0)
{
// TODO: hack, main CPU sends a CR only here, actually expecting Windows-style newline.
if(data == 0x0d)
m_terminal->write(space,0,0x0a);
else
m_terminal->write(space,0,data);
}
m_terminal->write(space,0,data);
}
uint8_t funkball_state::funkball_config_reg_r()

View File

@ -192,6 +192,7 @@ Notes:
#include "cdrom.h"
#include "cpu/powerpc/ppc.h"
#include "imagedev/chd_cd.h"
#include "machine/terminal.h"
#include "softlist.h"
struct CDE_DMA
@ -209,10 +210,19 @@ public:
konamim2_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_main_ram(*this, "main_ram"),
m_terminal(*this, "terminal"),
m_in_country(*this, "COUNTRY"),
m_in_card(*this, "CARD"),
m_in_monitor(*this, "MONITOR"),
m_maincpu(*this, "maincpu"),
m_subcpu(*this, "sub") { }
required_shared_ptr<uint64_t> m_main_ram;
required_device<generic_terminal_device> m_terminal;
required_ioport m_in_country;
required_ioport m_in_card;
required_ioport m_in_monitor;
uint32_t m_vdl0_address;
uint32_t m_vdl1_address;
uint32_t m_irq_enable;
@ -244,13 +254,14 @@ public:
DECLARE_WRITE64_MEMBER(video_w);
DECLARE_WRITE64_MEMBER(video_irq_ack_w);
DECLARE_READ64_MEMBER(unk4000280_r);
DECLARE_WRITE64_MEMBER(unk4000010_w);
DECLARE_WRITE8_MEMBER(serial_w);
DECLARE_WRITE64_MEMBER(unk4000418_w);
DECLARE_WRITE64_MEMBER(reset_w);
DECLARE_READ64_MEMBER(cde_r);
DECLARE_WRITE64_MEMBER(cde_w);
DECLARE_READ64_MEMBER(device2_r);
DECLARE_READ64_MEMBER(cpu_r);
DECLARE_DRIVER_INIT(m2);
virtual void video_start() override;
uint32_t screen_update_m2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@ -271,21 +282,28 @@ void konamim2_state::video_start()
uint32_t konamim2_state::screen_update_m2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int i, j;
uint32_t fb_start = 0xffffffff;
uint32_t config;
int height = 384,width = 512;
if (m_vdl0_address != 0)
{
fb_start = *(uint32_t*)&m_main_ram[(m_vdl0_address - 0x40000000) / 8] - 0x40000000;
fb_start = *(uint32_t*)&m_main_ram[(m_vdl1_address - 0x40000000) / 8] - 0x40000000;
config = m_main_ram[(m_vdl0_address - 0x40000000) / 8] >> 32;
// config bits are a guess, and yes, pitch is doubled in low-res
height = config & 2 ? 384 : 240;
width = config & 4 ? 640*2 : 512;
}
if (fb_start <= 0x800000)
{
uint16_t *frame = (uint16_t*)&m_main_ram[fb_start/8];
for (j=0; j < 384; j++)
for (j=0; j < height; j++)
{
uint16_t *fb = &frame[(j*512)];
uint16_t *fb = &frame[(j*width)];
uint16_t *d = &bitmap.pix16(j);
for (i=0; i < 512; i++)
for (i=0; i < width; i++)
{
d[i^3] = *fb++ & 0x7fff;
}
@ -438,12 +456,12 @@ READ64_MEMBER(konamim2_state::unk4000280_r)
sys_config |= 0 << 0; // Bit 0: PAL/NTSC switch (default is selected by encoder)
sys_config |= 0 << 2; // Bit 2-3: Video Encoder (0 = MEIENC, 1 = VP536, 2 = BT9103, 3 = DENC)
sys_config |= 3 << 11; // Bit 11-12: Country
sys_config |= m_in_country->read() << 11; // Bit 11-12: Country
// 0 = ???
// 1 = UK
// 2 = Japan
// 3 = US
sys_config |= 0xb << 15; // Bit 15-18: 0x8 = AC-DevCard
sys_config |= m_in_card->read() << 15; // Bit 15-18: 0x8 = AC-DevCard
// 0xb = AC-CoreBoard
// 0xc = DevCard (not allowed)
// 0xe = Upgrade (not allowed)
@ -454,16 +472,9 @@ READ64_MEMBER(konamim2_state::unk4000280_r)
}
WRITE64_MEMBER(konamim2_state::unk4000010_w)
WRITE8_MEMBER(konamim2_state::serial_w)
{
if ((data & 0xff) == 0xd)
{
// osd_printf_debug("\n");
}
else
{
// osd_printf_debug("%c", (uint8_t)(data & 0xff));
}
m_terminal->write(space,0,data & 0xff);
}
WRITE64_MEMBER(konamim2_state::unk4000418_w)
@ -1115,7 +1126,7 @@ READ64_MEMBER(konamim2_state::cpu_r)
if (ACCESSING_BITS_32_63)
{
r = (uint64_t)((&space.device() != m_maincpu) ? 0x80000000 : 0);
//r |= 0x40000000; // sets Video-LowRes !?
r |= m_in_monitor->read() << 30;
return r << 32;
}
@ -1132,7 +1143,7 @@ static ADDRESS_MAP_START( m2_main, AS_PROGRAM, 64, konamim2_state )
AM_RANGE(0x00030400, 0x00030407) AM_WRITE(video_irq_ack_w)
AM_RANGE(0x01000000, 0x01000fff) AM_READWRITE(cde_r, cde_w)
AM_RANGE(0x02000000, 0x02000fff) AM_READ(device2_r)
AM_RANGE(0x04000010, 0x04000017) AM_WRITE(unk4000010_w)
AM_RANGE(0x04000010, 0x04000017) AM_WRITE8(serial_w,0x00000000000000ffU)
AM_RANGE(0x04000018, 0x0400001f) AM_READ(unk1_r)
AM_RANGE(0x04000020, 0x04000027) AM_WRITE(reset_w)
AM_RANGE(0x04000418, 0x0400041f) AM_WRITE(unk4000418_w)
@ -1145,7 +1156,33 @@ static ADDRESS_MAP_START( m2_main, AS_PROGRAM, 64, konamim2_state )
AM_RANGE(0xfff00000, 0xffffffff) AM_ROM AM_REGION("boot", 0) AM_SHARE("share2")
ADDRESS_MAP_END
static ADDRESS_MAP_START( 3do_m2_main, AS_PROGRAM, 64, konamim2_state )
AM_IMPORT_FROM( m2_main )
// AM_RANGE(0x00000000, 0x000cffff) AM_RAM devices?
ADDRESS_MAP_END
static INPUT_PORTS_START( m2 )
// TODO: it's unknown if these are actual dip-switches or internal to something
PORT_START("COUNTRY")
PORT_CONFNAME( 0x03, 0x03, "Country" )
PORT_CONFSETTING( 0x00, "<Invalid>" )
PORT_CONFSETTING( 0x01, "UK" )
PORT_CONFSETTING( 0x02, "Japan" )
PORT_CONFSETTING( 0x03, "US" )
PORT_START("CARD")
PORT_CONFNAME( 0x0f, 0x0b, "Card Type" )
PORT_CONFSETTING( 0x08, "AC-DevCard" )
PORT_CONFSETTING( 0x0b, "AC-CoreBoard" )
PORT_CONFSETTING( 0x0c, "DevCard (not allowed)" )
PORT_CONFSETTING( 0x0e, "Upgrade (not allowed)" )
PORT_CONFSETTING( 0x0f, "Multiplayer (not allowed)" )
PORT_START("MONITOR")
PORT_CONFNAME( 0x01, 0x00, "Monitor Type" )
PORT_CONFSETTING( 0x01, "15 KHz" )
PORT_CONFSETTING( 0x00, "24 KHz" )
INPUT_PORTS_END
@ -1154,6 +1191,8 @@ INTERRUPT_GEN_MEMBER(konamim2_state::m2)
if (m_irq_enable & 0x800000)
{
m_irq_active |= 0x800000;
device.execute().set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE);
}
/*if (m_irq_enable & 0x8)
@ -1161,7 +1200,7 @@ INTERRUPT_GEN_MEMBER(konamim2_state::m2)
m_irq_active |= 0x8;
}*/
device.execute().set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE);
}
static MACHINE_CONFIG_START( m2, konamim2_state )
@ -1176,18 +1215,22 @@ static MACHINE_CONFIG_START( m2, konamim2_state )
MCFG_PPC_BUS_FREQUENCY(33000000) /* Multiplier 2, Bus = 33MHz, Core = 66MHz */
MCFG_CPU_PROGRAM_MAP(m2_main)
// TODO: declaring as second screen causes palette confusion (wants to use palette from the other screen?)
MCFG_DEVICE_ADD("terminal", GENERIC_TERMINAL, 0)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
MCFG_SCREEN_SIZE(704, 512)
MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 383)
MCFG_SCREEN_UPDATE_DRIVER(konamim2_state, screen_update_m2)
MCFG_SCREEN_PALETTE("palette")
MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB("palette")
/*cd-rom*/
/*cd-rom*/
MCFG_CDROM_ADD( "cdrom" )
MCFG_CDROM_INTERFACE("3do_m2_cdrom")
@ -1195,6 +1238,12 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED_CLASS ( 3do_m2, m2, konamim2_state )
MCFG_CPU_MODIFY("maincpu")
MCFG_CPU_PROGRAM_MAP(3do_m2_main)
MCFG_CPU_MODIFY("sub")
MCFG_CPU_PROGRAM_MAP(3do_m2_main)
MCFG_SOFTWARE_LIST_ADD("cd_list","3do_m2")
MACHINE_CONFIG_END