taitopjc: Preliminary text layer and I/O CPU hookup [Ville Linde]

This commit is contained in:
R. Belmont 2011-10-12 13:11:04 +00:00
parent 0367d7a349
commit 4c49649068

View File

@ -56,15 +56,14 @@
#include "emu.h"
#include "cpu/powerpc/ppc.h"
#include "cpu/tlcs900/tlcs900.h"
static UINT32 jc_char_ram[0x2000];
static UINT32 jc_tile_ram[0x4000];
//static UINT32 jc_pal_ram[0x8000];
static UINT32 jc_screen_ram[0x10000];
class taitopjc_state : public driver_device
{
public:
taitopjc_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag) { }
};
static UINT8 common_ram[0x2000];
static VIDEO_START( taitopjc )
@ -74,18 +73,309 @@ static VIDEO_START( taitopjc )
static SCREEN_UPDATE( taitopjc )
{
{
UINT8 *s = (UINT8*)jc_char_ram;
int x,y,t,u;
for (u=0; u < 48; u++)
{
for (t=0; t < 32; t++)
{
UINT32 tile = jc_tile_ram[((u*16)+(t/2)) ^ 0];
if (t & 1)
tile &= 0xffff;
else
tile >>= 16;
tile &= 0xff;
tile -= 0x40;
if (tile < 0) tile = 0;
if (tile > 127) tile = 127;
for (y=0; y < 16; y++)
{
UINT32 *fb = BITMAP_ADDR32(bitmap, y+(u*16), 0);
for (x=0; x < 16; x++)
{
UINT8 p = s[((tile*256) + ((y*16)+x)) ^3];
fb[x+(t*16)] = p ? 0xffffffff : 0;
}
}
}
}
}
return 0;
}
static UINT32 video_address;
static UINT32 videochip_r(address_space *space, offs_t address)
{
UINT32 r = 0;
if (address >= 0x10000000 && address < 0x10010000)
{
r = jc_screen_ram[address - 0x10000000];
}
return r;
}
static void videochip_w(address_space *space, offs_t address, UINT32 data)
{
if (address >= 0x20000000 && address < 0x20008000)
{
//UINT32 r = (data >> 16) & 0xff;
//UINT32 g = (data >> 8) & 0xff;
//UINT32 b = (data >> 0) & 0xff;
//palette_set_color_rgb(space->machine, address & 0x7fff, r, g, b);
}
else if (address >= 0x1003d000 && address < 0x1003f000)
{
jc_char_ram[address - 0x1003d000] = data;
}
else if (address >= 0x1003f000 && address < 0x10040000)
{
jc_tile_ram[address - 0x1003f000] = data;
}
else if (address >= 0x10000000 && address < 0x10010000)
{
jc_screen_ram[address - 0x10000000] = data;
}
else
{
printf("Address %08X = %08X\n", address, data);
}
}
static READ64_HANDLER(video_r)
{
UINT64 r = 0;
if (offset == 0)
{
if (ACCESSING_BITS_32_63)
{
r |= (UINT64)(videochip_r(space, video_address)) << 32;
}
}
return r;
}
static WRITE64_HANDLER(video_w)
{
if (offset == 0)
{
if (ACCESSING_BITS_32_63)
{
//printf("Address %08X = %08X\n", video_address, (UINT32)(data >> 32));
videochip_w(space, video_address, (UINT32)(data >> 32));
}
}
if (offset == 1)
{
if (ACCESSING_BITS_32_63)
{
video_address = (UINT32)(data >> 32);
}
}
}
/*
static UINT16 com_ram[256] =
{
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x434F, 0x4D4E, 0x4F4B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // COMNOK
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x574F, 0x524B, 0x4F4B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // WORKOK
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5355, 0x4E44, 0x4F4B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // SUNDOK
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
*/
static READ64_HANDLER(ppc_common_r)
{
UINT64 r = 0;
UINT32 address;
logerror("com_r: %08X, %08X%08X\n", offset, (UINT32)(mem_mask >> 32), (UINT32)(mem_mask));
address = offset * 4;
if (ACCESSING_BITS_48_63)
{
r |= (UINT64)(common_ram[address]) << 48;
r |= (UINT64)(common_ram[address+1]) << 56;
}
if (ACCESSING_BITS_16_31)
{
r |= (UINT64)(common_ram[address+2]) << 16;
r |= (UINT64)(common_ram[address+3]) << 24;
}
/*
if (offset < 0x7f)
{
int reg = (offset & 0x7f) * 2;
if (!(mem_mask & U64(0xffff000000000000)))
{
r |= (UINT64)(com_ram[reg + 0]) << 48;
}
if (!(mem_mask & U64(0x00000000ffff0000)))
{
r |= (UINT64)(com_ram[reg + 1]) << 16;
}
}
*/
return r;
}
static UINT32 dsp_value = 0x4f4b0000;
static UINT16 dsp_ram[0x1000];
static READ64_HANDLER(dsp_r)
{
UINT64 r = 0;
if (offset == 0x7fe)
{
if (!(mem_mask & U64(0xffffffff00000000)))
{
r |= (UINT64)(dsp_value) << 32;
}
}
return r;
}
static WRITE64_HANDLER(dsp_w)
{
logerror("dsp_w: %08X, %08X%08X, %08X%08X\n", offset, (UINT32)(data >> 32), (UINT32)(data), (UINT32)(mem_mask >> 32), (UINT32)(mem_mask));
if (offset == 0x7fe)
{
if (!(mem_mask & U64(0xffffffff00000000)))
{
dsp_value = data >> 32;
}
#if 0
{
int i;
FILE *f = fopen("dspram.bin", "wb");
for (i=0; i < 0x1000; i++)
{
fputc((dsp_ram[i] >> 0) & 0xff, f);
fputc((dsp_ram[i] >> 8) & 0xff, f);
}
fclose(f);
}
#endif
}
if (!(mem_mask & U64(0xffff000000000000)))
{
int addr = offset * 2;
dsp_ram[addr+0] = (data >> 48) & 0xffff;
}
if (!(mem_mask & U64(0x00000000ffff0000)))
{
int addr = offset * 2;
dsp_ram[addr+1] = (data >> 16) & 0xffff;
}
}
// BAT Config:
// IBAT0 U: 0x40000002 L: 0x40000022 (0x40000000...0x4001ffff)
// IBAT1 U: 0x0000007f L: 0x00000002 (0x00000000...0x003fffff)
// IBAT2 U: 0xc0000003 L: 0xc0000022 (0xc0000000...0xc001ffff)
// IBAT3 U: 0xfe0003ff L: 0xfe000022 (0xfe000000...0xffffffff)
// DBAT0 U: 0x40000002 L: 0x40000022 (0x40000000...0x4001ffff)
// DBAT1 U: 0x0000007f L: 0x00000002 (0x00000000...0x003fffff)
// DBAT2 U: 0xc0000003 L: 0xc0000022 (0xc0000000...0xc001ffff)
// DBAT3 U: 0xfe0003ff L: 0xfe000022 (0xfe000000...0xffffffff)
static ADDRESS_MAP_START( ppc603e_mem, AS_PROGRAM, 64)
AM_RANGE(0x00000000, 0x003fffff) AM_RAM // Work RAM
AM_RANGE(0x40000000, 0x40000007) AM_RAM // Screen RAM (+ others?) data port
AM_RANGE(0x40000008, 0x4000000f) AM_RAM // Screen RAM (+ others?) address port
AM_RANGE(0xc0000ff8, 0xc0000fff) AM_RAM
AM_RANGE(0x40000000, 0x4000000f) AM_READWRITE(video_r, video_w)
AM_RANGE(0x80000000, 0x80003fff) AM_READWRITE(dsp_r, dsp_w)
AM_RANGE(0xc0000000, 0xc000ffff) AM_READ(ppc_common_r)
AM_RANGE(0xff000000, 0xff01ffff) AM_ROM AM_REGION("user2", 0)
AM_RANGE(0xffe00000, 0xffffffff) AM_ROM AM_REGION("user1", 0)
ADDRESS_MAP_END
static READ8_HANDLER(tlcs_common_r)
{
return common_ram[offset];
}
static WRITE8_HANDLER(tlcs_common_w)
{
// printf("tlcs_common_w: %08X, %02X\n", offset, data);
common_ram[offset] = data;
}
static READ8_HANDLER(tlcs_sound_r)
{
if (offset == 0x17)
{
return 0x55;
}
return 0;
}
static WRITE8_HANDLER(tlcs_sound_w)
{
// printf("tlcs_sound_w: %08X, %02X\n", offset, data);
}
// TLCS900 interrupt vectors
// 0xfc0100: reset
// 0xfc00ea: INT0 (dummy)
// 0xfc00eb: INT1
// 0xfc00f0: INT2
// 0xfc00f5: INT3 (dummy)
// 0xfc00f6: INT4 (dummy)
// 0xfc00f7: INT5 (dummy)
// 0xfc00f8: INT6
// 0xfc00fd: INT7 (dummy)
// 0xfc00fe: INT8 (dummy)
// 0xfc0663: INTT1
// 0xfc0f7d: INTRX0
// 0xfc0f05: INTTX0
// 0xfc0fb5: INTRX1
// 0xfc0f41: INTTX1
static ADDRESS_MAP_START( tlcs900h_mem, AS_PROGRAM, 8)
AM_RANGE(0x010000, 0x02ffff) AM_RAM // Work RAM
AM_RANGE(0x040000, 0x0400ff) AM_READWRITE(tlcs_sound_r, tlcs_sound_w)
AM_RANGE(0x060000, 0x061fff) AM_READWRITE(tlcs_common_r, tlcs_common_w)
AM_RANGE(0xfc0000, 0xffffff) AM_ROM AM_REGION("io_cpu", 0)
ADDRESS_MAP_END
static WRITE8_DEVICE_HANDLER( taitopjc_tlcs900_to1 )
{
}
static WRITE8_DEVICE_HANDLER( taitopjc_tlcs900_to3 )
{
}
static INPUT_PORTS_START( taitopjc )
INPUT_PORTS_END
@ -95,21 +385,33 @@ static const powerpc_config ppc603e_config =
XTAL_66_6667MHz /* Multiplier 1.5, Bus = 66MHz, Core = 100MHz */
};
static MACHINE_CONFIG_START( taitopjc, taitopjc_state )
static const tlcs900_interface taitopjc_tlcs900_interface =
{
DEVCB_HANDLER( taitopjc_tlcs900_to1 ),
DEVCB_HANDLER( taitopjc_tlcs900_to3 )
};
static MACHINE_CONFIG_START( taitopjc, driver_device )
MCFG_CPU_ADD("maincpu", PPC603E, 100000000)
MCFG_CPU_CONFIG(ppc603e_config)
MCFG_CPU_PROGRAM_MAP(ppc603e_mem)
/* TMP95C063F I/O CPU */
MCFG_CPU_ADD("iocpu", TLCS900H, 25000000)
MCFG_CPU_CONFIG(taitopjc_tlcs900_interface)
MCFG_CPU_PROGRAM_MAP(tlcs900h_mem)
/* TMS320C53 DSP */
/* MN1020819DA sound CPU - NOTE: May have 64kB internal ROM */
MCFG_QUANTUM_TIME(attotime::from_hz(6000))
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(512, 384)
MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 383)
MCFG_SCREEN_SIZE(640, 768)
MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 767)
MCFG_SCREEN_UPDATE(taitopjc)
MCFG_VIDEO_START(taitopjc)