atlantis: Added dcs3 fifo reset to address map (nw)

dcs: Added internal ram memory bank for denver ADSP 2181 (nw)
adsp2100: Added callback for dmovlay instruction (nw)
zeus2: Update (nw)
This commit is contained in:
Ted Green 2016-06-17 18:49:41 -06:00
parent aae1cbb6d3
commit 2a16de421d
8 changed files with 140 additions and 63 deletions

View File

@ -380,7 +380,11 @@ void adsp21xx_device::write_reg1(int regnum, INT32 val)
break;
case 3:
logerror("ADSP %04x: Writing to an invalid register! RGP=01 RegCode=%1X Val=%04X\n", m_ppc, regnum, val);
// Check for DMOVLAY instruction callback
if (regnum == 0xf && !m_dmovlay_cb.isnull())
m_dmovlay_cb(val & 0x3fff);
else
logerror("ADSP %04x: Writing to an invalid register! RGP=01 RegCode=%1X Val=%04X\n", m_ppc, regnum, val);
break;
}
}

View File

@ -157,7 +157,8 @@ adsp21xx_device::adsp21xx_device(const machine_config &mconfig, device_type type
(m_chip_type >= CHIP_TYPE_ADSP2101) ? 0x3f : 0x0f),
m_sport_rx_cb(*this),
m_sport_tx_cb(*this),
m_timer_fired_cb(*this)
m_timer_fired_cb(*this),
m_dmovlay_cb(*this)
{
// initialize remaining state
memset(&m_core, 0, sizeof(m_core));
@ -405,6 +406,7 @@ void adsp21xx_device::device_start()
m_sport_rx_cb.resolve();
m_sport_tx_cb.resolve();
m_timer_fired_cb.resolve();
m_dmovlay_cb.resolve();
// get our address spaces
m_program = &space(AS_PROGRAM);

View File

@ -192,6 +192,9 @@ enum
#define MCFG_ADSP21XX_TIMER_FIRED_CB(_devcb) \
devcb = &adsp21xx_device::set_timer_fired_callback(*device, DEVCB_##_devcb);
#define MCFG_ADSP21XX_DMOVLAY_CB(_devcb) \
devcb = &adsp21xx_device::set_dmovlay_callback(*device, DEVCB_##_devcb);
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@ -220,6 +223,7 @@ public:
template<class _Object> static devcb_base &set_sport_rx_callback(device_t &device, _Object object) { return downcast<adsp21xx_device &>(device).m_sport_rx_cb.set_callback(object); }
template<class _Object> static devcb_base &set_sport_tx_callback(device_t &device, _Object object) { return downcast<adsp21xx_device &>(device).m_sport_tx_cb.set_callback(object); }
template<class _Object> static devcb_base &set_timer_fired_callback(device_t &device, _Object object) { return downcast<adsp21xx_device &>(device).m_timer_fired_cb.set_callback(object); }
template<class _Object> static devcb_base &set_dmovlay_callback(device_t &device, _Object object) { return downcast<adsp21xx_device &>(device).m_dmovlay_cb.set_callback(object); }
// public interfaces
void load_boot_data(UINT8 *srcdata, UINT32 *dstdata);
@ -459,6 +463,7 @@ protected:
devcb_read32 m_sport_rx_cb; // callback for serial receive
devcb_write32 m_sport_tx_cb; // callback for serial transmit
devcb_write_line m_timer_fired_cb; // callback for timer fired
devcb_write_line m_dmovlay_cb; // callback for DMOVLAY instruction
// debugging
#if ADSP_TRACK_HOTSPOTS

View File

@ -419,7 +419,7 @@ void zeus2_device::zeus2_register_update(offs_t offset, UINT32 oldval, int logit
m_zeusbase[0x38] = oldval;
m_screen->update_partial(m_screen->vpos());
log_fifo = machine().input().code_pressed(KEYCODE_L);
log_fifo = 1;
//log_fifo = 1;
m_zeusbase[0x38] = temp;
}
break;
@ -495,11 +495,11 @@ void zeus2_device::zeus2_register_update(offs_t offset, UINT32 oldval, int logit
case 0x50:
if ((m_zeusbase[0x50] & 0xffff0000) == 0x00980000) {
// Fast fill?
// Fast fill
// Unknow what the exact bit fields are, this is a just a guess
UINT32 lastRow = (((m_zeusbase[0x50] >> 8) & 0xff) << 3) | 0x7;
UINT32 lastCol = (((m_zeusbase[0x50] >> 0) & 0xff) << 2) | 0x3;
UINT32 fillColor = 0x004a4a4a;
UINT32 fillColor = m_zeusbase[0x5f]; // 0x004a4a4a;
void *base = waveram1_ptr_from_expanded_addr(m_zeusbase[0x51]);
for (int y = 0; y <= lastRow; y++)
for (int x = 0; x <= lastCol; x++)
@ -702,12 +702,18 @@ int zeus2_device::zeus2_fifo_process(const UINT32 *data, int numwords)
/* handle logging */
switch (data[0] >> 24)
{
// 0x00: write 32-bit value to low registers
case 0x00:
// Ignore the all zeros commmand
if (((data[0] >> 16) & 0x7f) == 0x0)
return TRUE;
// Drop through to 0x05 command
/* 0x05: write 32-bit value to low registers */
case 0x05:
if (numwords < 2)
return FALSE;
if (log_fifo)
log_fifo_command(data, numwords, " -- reg32");
log_fifo_command(data, numwords, " -- reg32\n");
if (((data[0] >> 16) & 0x7f) != 0x08)
zeus2_register32_w((data[0] >> 16) & 0x7f, data[1], log_fifo);
break;
@ -741,7 +747,7 @@ int zeus2_device::zeus2_fifo_process(const UINT32 *data, int numwords)
if (log_fifo)
{
log_fifo_command(data, numwords, "");
log_fifo_command(data, numwords, "\n");
logerror("\n\t\tmatrix ( %8.2f %8.2f %8.2f ) ( %8.2f %8.2f %8.2f ) ( %8.2f %8.2f %8.2f )\n\t\tvector %8.2f %8.2f %8.5f\n",
(double) zeus_matrix[0][0], (double) zeus_matrix[0][1], (double) zeus_matrix[0][2],
(double) zeus_matrix[1][0], (double) zeus_matrix[1][1], (double) zeus_matrix[1][2],
@ -766,7 +772,7 @@ int zeus2_device::zeus2_fifo_process(const UINT32 *data, int numwords)
if (log_fifo)
{
log_fifo_command(data, numwords, "");
log_fifo_command(data, numwords, "\n");
logerror("\n\t\tvector %8.2f %8.2f %8.5f\n",
(double) zeus_point[0],
(double) zeus_point[1],
@ -802,17 +808,30 @@ int zeus2_device::zeus2_fifo_process(const UINT32 *data, int numwords)
/* 0x23: render model in waveram (thegrid) */
/* 0x24: render model in waveram (crusnexo) */
// 0x17: ??? (atlantis)
case 0x17:
case 0x23:
case 0x24:
if (numwords < 2)
return FALSE;
if (log_fifo)
log_fifo_command(data, numwords, "");
log_fifo_command(data, numwords, "\n");
zeus2_draw_model(data[1], data[0] & 0xffff, log_fifo);
break;
// 0x2d; ??? (atlantis)
case 0x2d:
if (numwords < 2)
return FALSE;
if (log_fifo)
log_fifo_command(data, numwords, "\n");
//zeus2_draw_model(data[1], data[0] & 0xff, log_fifo);
break;
/* 0x31: sync pipeline? (thegrid) */
/* 0x32: sync pipeline? (crusnexo) */
// 0x25 ?? (atlantis)
case 0x25:
case 0x31:
case 0x32:
if (log_fifo)
@ -821,11 +840,13 @@ int zeus2_device::zeus2_fifo_process(const UINT32 *data, int numwords)
break;
/* 0x38: direct render quad (crusnexo) */
// 0x38: 3 words?? (atlantis)
case 0x38:
if (numwords < 12)
//if (numwords < 12)
if (numwords < 3)
return FALSE;
if (log_fifo)
log_fifo_command(data, numwords, "");
if (0 && log_fifo)
log_fifo_command(data, numwords, "\n");
break;
/* 0x40: ???? */
@ -837,7 +858,7 @@ int zeus2_device::zeus2_fifo_process(const UINT32 *data, int numwords)
default:
if (data[0] != 0x2c0)
{
printf("Unknown command %08X\n", data[0]);
//printf("Unknown command %08X\n", data[0]);
if (log_fifo)
log_fifo_command(data, numwords, "\n");
}

View File

@ -26,10 +26,8 @@
#define WAVERAM0_WIDTH 1024
#define WAVERAM0_HEIGHT 2048
//#define WAVERAM1_WIDTH 512
#define WAVERAM1_WIDTH 512
#define WAVERAM1_HEIGHT 1024
//#define WAVERAM1_HEIGHT 1024
/*************************************
* Type definitions
@ -148,6 +146,47 @@ public:
int texel_width;
float zbase;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_stop() override;
private:
TIMER_CALLBACK_MEMBER(int_timer_callback);
void zeus2_register32_w(offs_t offset, UINT32 data, int logit);
void zeus2_register_update(offs_t offset, UINT32 oldval, int logit);
int zeus2_fifo_process(const UINT32 *data, int numwords);
void zeus2_pointer_write(UINT8 which, UINT32 value);
void zeus2_draw_model(UINT32 baseaddr, UINT16 count, int logit);
void log_fifo_command(const UINT32 *data, int numwords, const char *suffix);
/*************************************
* Member variables
*************************************/
UINT8 log_fifo;
UINT32 zeus_fifo[20];
UINT8 zeus_fifo_words;
#if TRACK_REG_USAGE
struct reg_info
{
struct reg_info *next;
UINT32 value;
};
reg_info *regdata[0x80];
int regdata_count[0x80];
int regread_count[0x80];
int regwrite_count[0x80];
reg_info *subregdata[0x100];
int subregdata_count[0x80];
int subregwrite_count[0x100];
#endif
public:
/*************************************
* Inlines for block addressing
*************************************/
@ -236,48 +275,6 @@ public:
}
#endif
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_stop() override;
private:
TIMER_CALLBACK_MEMBER(int_timer_callback);
void zeus2_register32_w(offs_t offset, UINT32 data, int logit);
void zeus2_register_update(offs_t offset, UINT32 oldval, int logit);
int zeus2_fifo_process(const UINT32 *data, int numwords);
void zeus2_pointer_write(UINT8 which, UINT32 value);
void zeus2_draw_model(UINT32 baseaddr, UINT16 count, int logit);
void log_fifo_command(const UINT32 *data, int numwords, const char *suffix);
/*************************************
* Member variables
*************************************/
UINT8 log_fifo;
UINT32 zeus_fifo[20];
UINT8 zeus_fifo_words;
#if TRACK_REG_USAGE
struct reg_info
{
struct reg_info *next;
UINT32 value;
};
reg_info *regdata[0x80];
int regdata_count[0x80];
int regread_count[0x80];
int regwrite_count[0x80];
reg_info *subregdata[0x100];
int subregdata_count[0x80];
int subregwrite_count[0x100];
#endif
};
// device type definition

View File

@ -557,6 +557,7 @@ MACHINE_CONFIG_FRAGMENT( dcs2_audio_denver )
MCFG_CPU_ADD("denver", ADSP2181, XTAL_33_333MHz)
MCFG_ADSP21XX_SPORT_TX_CB(WRITE32(dcs_audio_device, sound_tx_callback)) /* callback for serial transmit */
MCFG_ADSP21XX_TIMER_FIRED_CB(WRITELINE(dcs_audio_device,timer_enable_callback)) /* callback for timer fired */
MCFG_ADSP21XX_DMOVLAY_CB(WRITE32(dcs_audio_device, dmovlay_callback)) // callback for adsp 2181 dmovlay instruction
MCFG_CPU_PROGRAM_MAP(denver_program_map)
MCFG_CPU_DATA_MAP(denver_data_map)
MCFG_CPU_IO_MAP(denver_io_map)
@ -688,6 +689,8 @@ TIMER_CALLBACK_MEMBER( dcs_audio_device::dcs_reset )
/* rev 4: reset the Denver ASIC */
case 4:
m_dmovlay_val = 0;
dmovlay_remap_memory();
denver_reset();
break;
}
@ -752,6 +755,7 @@ void dcs_audio_device::dcs_register_state()
save_item(NAME(m_control_regs));
save_item(NAME(m_sounddata_bank));
save_item(NAME(m_dmovlay_val));
save_item(NAME(m_auto_ack));
save_item(NAME(m_latch_control));
@ -786,6 +790,9 @@ void dcs_audio_device::dcs_register_state()
if (m_rev == 2)
machine().save().register_postload(save_prepost_delegate(FUNC(dcs_audio_device::sdrc_remap_memory), this));
if (m_rev == 4)
machine().save().register_postload(save_prepost_delegate(FUNC(dcs_audio_device::dmovlay_remap_memory), this));
}
@ -958,8 +965,12 @@ void dcs2_audio_device::device_start()
/* supports both RAM and ROM variants */
if (m_dram_in_mb != 0)
{
m_sounddata = auto_alloc_array(machine(), UINT16, m_dram_in_mb << (20-1));
save_pointer(NAME(m_sounddata), m_dram_in_mb << (20-1));
UINT32 ramSize = m_dram_in_mb << (20 - 1);
// Add one extra bank for internal ram in ADSP 2181
if (m_rev == 4)
ramSize += soundbank_words;
m_sounddata = auto_alloc_array(machine(), UINT16, ramSize);
save_pointer(NAME(m_sounddata), ramSize);
m_sounddata_words = (m_dram_in_mb << 20) / 2;
}
else
@ -973,6 +984,7 @@ void dcs2_audio_device::device_start()
m_data_bank->configure_entries(0, m_sounddata_banks, m_sounddata, soundbank_words*2);
}
/* allocate memory for the SRAM */
m_sram = auto_alloc_array(machine(), UINT16, 0x8000*4/2);
@ -1330,7 +1342,7 @@ WRITE16_MEMBER( dcs_audio_device::dsio_w )
/* offset 2 controls RAM pages */
case 2:
dsio.reg[2] = data;
m_data_bank->set_entry(DSIO_DM_PG % m_sounddata_banks);
dmovlay_remap_memory();
break;
}
}
@ -1399,7 +1411,6 @@ WRITE16_MEMBER( dcs_audio_device::denver_w )
dsio.reg[2] = data;
m_data_bank->set_entry(DENV_DM_PG % m_sounddata_banks);
break;
/* offset 3 controls FIFO reset */
case 3:
if (!m_fifo_reset_w.isnull())
@ -1460,6 +1471,32 @@ READ32_MEMBER( dcs_audio_device::dsio_idma_data_r )
return result;
}
void dcs_audio_device::dmovlay_remap_memory()
{
// Switch banks
// Internal ram is bank 0
int bankSel;
if (m_dmovlay_val == 0) {
bankSel = 0;
m_data_bank->set_entry(bankSel);
} else {
bankSel = 1 + (DSIO_DM_PG % m_sounddata_banks);
m_data_bank->set_entry(bankSel);
}
if (LOG_DCS_IO)
logerror("%s dmovlay_remap_memory: Switching data ram location bankSel = %i\n", machine().describe_context(), bankSel);
}
WRITE32_MEMBER(dcs_audio_device::dmovlay_callback)
{
// Do some checking first
if (data < 0 || data > 1) {
logerror("dmovlay_callback: Error! dmovlay called with value = %X\n", data);
} else {
m_dmovlay_val = data;
dmovlay_remap_memory();
}
}
/***************************************************************************

View File

@ -47,6 +47,8 @@ public:
DECLARE_WRITE32_MEMBER( dsio_idma_addr_w );
DECLARE_WRITE32_MEMBER( dsio_idma_data_w );
DECLARE_READ32_MEMBER( dsio_idma_data_r );
void dmovlay_remap_memory();
WRITE32_MEMBER(dmovlay_callback);
// non public
void dcs_boot();
@ -202,6 +204,8 @@ protected:
UINT32 *m_internal_program_ram;
UINT32 *m_external_program_ram;
int m_dmovlay_val;
sdrc_state m_sdrc;
dsio_state m_dsio;
hle_transfer_state m_transfer;

View File

@ -123,6 +123,7 @@ public:
UINT8 m_status_leds;
DECLARE_WRITE32_MEMBER(asic_fifo_w);
DECLARE_WRITE32_MEMBER(dcs3_fifo_full_w);
READ32_MEMBER (green_r);
WRITE32_MEMBER(green_w);
@ -388,6 +389,11 @@ WRITE32_MEMBER(atlantis_state::asic_fifo_w)
m_ioasic->fifo_w(data);
}
WRITE32_MEMBER(atlantis_state::dcs3_fifo_full_w)
{
m_ioasic->fifo_full_w(data);
}
/*************************************
* PCI9050 User I/O handlers
*************************************/
@ -649,7 +655,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( map1, AS_PROGRAM, 32, atlantis_state )
AM_RANGE(0x00000000, 0x0000003f) AM_DEVREADWRITE("ioasic", midway_ioasic_device, read, write)
// asic_fifo_w
AM_RANGE(0x00200000, 0x00200003) AM_WRITE(asic_fifo_w)
// dcs3_fifo_full_w
AM_RANGE(0x00200000, 0x00200003) AM_WRITE(dcs3_fifo_full_w)
AM_RANGE(0x00400000, 0x00400003) AM_DEVWRITE("dcs", dcs_audio_device, dsio_idma_addr_w)
AM_RANGE(0x00600000, 0x00600003) AM_DEVREADWRITE("dcs", dcs_audio_device, dsio_idma_data_r, dsio_idma_data_w)
AM_RANGE(0x00800000, 0x00900003) AM_READWRITE(port_ctrl_r, port_ctrl_w)
@ -823,7 +830,7 @@ static MACHINE_CONFIG_START( mwskins, atlantis_state )
/* sound hardware */
//MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_DSIO, 0)
MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_DENVER, 0)
MCFG_DCS2_AUDIO_DRAM_IN_MB(8)
MCFG_DCS2_AUDIO_DRAM_IN_MB(4)
MCFG_DCS2_AUDIO_POLLING_OFFSET(0) /* no place to hook :-( */
MCFG_DEVICE_ADD("ioasic", MIDWAY_IOASIC, 0)