mirror of
https://github.com/holub/mame
synced 2025-07-04 17:38:08 +03:00
sunplus_gcm394.cpp : wrlshunt / smartfp, continued research (#5972)
* fix opcode (nw) * (nw) * allow wrlshunt to move forward (nw) * more ops (nw) * more ops (nw) * (nw) * more dma fixes (nw) * (nw) * (nw)
This commit is contained in:
parent
6a42b2e152
commit
67da095637
@ -398,6 +398,7 @@ inline void unsp_device::trigger_fiq()
|
||||
push(m_core->m_r[REG_SR], &m_core->m_r[REG_SP]);
|
||||
m_core->m_r[REG_PC] = read16(0xfff6);
|
||||
m_core->m_r[REG_SR] = 0;
|
||||
standard_irq_callback(UNSP_FIQ_LINE);
|
||||
}
|
||||
|
||||
inline void unsp_device::trigger_irq(int line)
|
||||
@ -414,6 +415,7 @@ inline void unsp_device::trigger_irq(int line)
|
||||
push(m_core->m_r[REG_SR], &m_core->m_r[REG_SP]);
|
||||
m_core->m_r[REG_PC] = read16(0xfff8 + line);
|
||||
m_core->m_r[REG_SR] = 0;
|
||||
standard_irq_callback(UNSP_IRQ0_LINE+line);
|
||||
}
|
||||
|
||||
void unsp_device::check_irqs()
|
||||
|
@ -110,17 +110,28 @@ void unsp_12_device::execute_exxx_group(uint16_t op)
|
||||
// MUL operations
|
||||
// MUL 1 1 1 0* r r r S* 0 0 0 0 1 r r r (* = sign bit, fixed here)
|
||||
/*
|
||||
print_mul(stream, op); // MUL uu or MUL su (invalid?)
|
||||
print_mul(stream, op); // MUL uu or MUL su
|
||||
*/
|
||||
|
||||
if (op & 0x0100)
|
||||
{
|
||||
// MUL su ( unsigned * signed )
|
||||
logerror("MUL su\n");
|
||||
fatalerror("UNSP: unknown opcode MUL su (invalid?) (%04x) at %04x\n", op, UNSP_LPC);
|
||||
const uint16_t opa = (op >> 9) & 7;
|
||||
const uint16_t opb = op & 7;
|
||||
m_core->m_icount -= 12;
|
||||
uint32_t lres = m_core->m_r[opa] * m_core->m_r[opb];
|
||||
if (m_core->m_r[opa] & 0x8000)
|
||||
{
|
||||
lres -= m_core->m_r[opb] << 16;
|
||||
}
|
||||
m_core->m_r[REG_R4] = lres >> 16;
|
||||
m_core->m_r[REG_R3] = (uint16_t)lres;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// MUL uu (unsigned * unsigned)
|
||||
uint32_t lres = 0;
|
||||
const uint16_t opa = (op >> 9) & 7;
|
||||
const uint16_t opb = op & 7;
|
||||
@ -169,9 +180,14 @@ void unsp_12_device::execute_exxx_group(uint16_t op)
|
||||
return;
|
||||
|
||||
case 0x03:
|
||||
logerror("%s = %s lslor %s\n", regs[rd], regs[rd], regs[rs]);
|
||||
unimplemented_opcode(op);
|
||||
{
|
||||
// wrlshunt uses this
|
||||
logerror("pc:%06x: %s = %s lslor %s (%04x %04x)\n", UNSP_LPC, regs[rd], regs[rd], regs[rs], m_core->m_r[rd], m_core->m_r[rs]);
|
||||
uint16_t tmp = m_core->m_r[rd];
|
||||
m_core->m_r[rd] = m_core->m_r[rd] << m_core->m_r[rs];
|
||||
m_core->m_r[rd] |= tmp; // guess
|
||||
return;
|
||||
}
|
||||
|
||||
case 0x04:
|
||||
// smartfp loops increasing shift by 4 up to values of 28? (but regs are 16-bit?)
|
||||
|
@ -54,7 +54,7 @@ inline void unsp_device::execute_fxxx_000_group(uint16_t op)
|
||||
|
||||
// everything else falls through to the multiply
|
||||
|
||||
// signed * unsigned
|
||||
// MUL us ( signed * unsigned )
|
||||
// MUL 1 1 1 1* r r r 0* 0 0 0 0 1 r r r (** = sign bits, fixed here)
|
||||
const uint16_t opa = (op >> 9) & 7;
|
||||
const uint16_t opb = op & 7;
|
||||
@ -287,24 +287,30 @@ void unsp_12_device::execute_fxxx_101_group(uint16_t op)
|
||||
case 0xf174: case 0xf374: case 0xf574: case 0xf774: case 0xf974: case 0xfb74: case 0xfd74: case 0xff74:
|
||||
case 0xf17c: case 0xf37c: case 0xf57c: case 0xf77c: case 0xf97c: case 0xfb7c: case 0xfd7c: case 0xff7c:
|
||||
{
|
||||
//unimplemented_opcode(op);
|
||||
// what is this, sign extend / sign expand / zero expand? it doesn't seem to be exponent
|
||||
// palette uploads in smartfp depend on this, however this logic only works for the first few, so isn't correct
|
||||
uint16_t result = m_core->m_r[REG_R4];// rand();
|
||||
uint16_t temp = m_core->m_r[REG_R4];
|
||||
uint16_t r4 = m_core->m_r[REG_R4];
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
// this could be optimized, but logic is correct for use cases seen
|
||||
if (r4 & 0x8000)
|
||||
{
|
||||
int bit = (temp << i) & 0x8000;
|
||||
|
||||
if (bit)
|
||||
break;
|
||||
|
||||
result |= 1 << (15 - i);
|
||||
// r2 undefined (code will check for this and avoid calculations
|
||||
}
|
||||
else if (r4 & 0x4000) { m_core->m_r[REG_R2] = 0x0000; }
|
||||
else if (r4 & 0x2000) { m_core->m_r[REG_R2] = 0x0001; }
|
||||
else if (r4 & 0x1000) { m_core->m_r[REG_R2] = 0x0002; }
|
||||
else if (r4 & 0x0800) { m_core->m_r[REG_R2] = 0x0003; }
|
||||
else if (r4 & 0x0400) { m_core->m_r[REG_R2] = 0x0004; }
|
||||
else if (r4 & 0x0200) { m_core->m_r[REG_R2] = 0x0005; }
|
||||
else if (r4 & 0x0100) { m_core->m_r[REG_R2] = 0x0006; }
|
||||
else if (r4 & 0x0080) { m_core->m_r[REG_R2] = 0x0007; }
|
||||
else if (r4 & 0x0040) { m_core->m_r[REG_R2] = 0x0008; }
|
||||
else if (r4 & 0x0020) { m_core->m_r[REG_R2] = 0x0009; }
|
||||
else if (r4 & 0x0010) { m_core->m_r[REG_R2] = 0x000a; }
|
||||
else if (r4 & 0x0008) { m_core->m_r[REG_R2] = 0x000b; }
|
||||
else if (r4 & 0x0004) { m_core->m_r[REG_R2] = 0x000c; }
|
||||
else if (r4 & 0x0002) { m_core->m_r[REG_R2] = 0x000d; }
|
||||
else if (r4 & 0x0001) { m_core->m_r[REG_R2] = 0x000e; }
|
||||
else { m_core->m_r[REG_R2] = 0x000f; }
|
||||
|
||||
logerror("pc:%06x: r2 = exp r4 (with r2 = %04x r4 = %04x) (returning %04x)\n", UNSP_LPC, m_core->m_r[REG_R2], m_core->m_r[REG_R4], result);
|
||||
m_core->m_r[REG_R2] = result;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -149,6 +149,28 @@ void unsp_device::execute_jumps(const uint16_t op)
|
||||
m_core->m_icount -= 2;
|
||||
}
|
||||
return;
|
||||
case 12: // JVC (overflow clear, N == S)
|
||||
if (((m_core->m_r[REG_SR] & UNSP_N) >> UNSP_N_SHIFT) == ((m_core->m_r[REG_SR] & UNSP_S) >> UNSP_S_SHIFT))
|
||||
{
|
||||
m_core->m_icount -= 4;
|
||||
add_lpc((op1 == 0) ? opimm : (0 - opimm));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_core->m_icount -= 2;
|
||||
}
|
||||
return;
|
||||
case 13: // JVS (overflow set, N != S) (Wrlshunt uses this)
|
||||
if (((m_core->m_r[REG_SR] & UNSP_N) >> UNSP_N_SHIFT) != ((m_core->m_r[REG_SR] & UNSP_S) >> UNSP_S_SHIFT))
|
||||
{
|
||||
m_core->m_icount -= 4;
|
||||
add_lpc((op1 == 0) ? opimm : (0 - opimm));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_core->m_icount -= 2;
|
||||
}
|
||||
return;
|
||||
case 14: // JMP
|
||||
add_lpc((op1 == 0) ? opimm : (0 - opimm));
|
||||
m_core->m_icount -= 4;
|
||||
|
@ -15,7 +15,7 @@
|
||||
#define LOG_GCM394 (1U << 1)
|
||||
#define LOG_GCM394_UNMAPPED (1U << 0)
|
||||
|
||||
#define VERBOSE (LOG_GCM394_UNMAPPED | LOG_GCM394_SYSDMA)
|
||||
#define VERBOSE (LOG_GCM394 | LOG_GCM394_UNMAPPED | LOG_GCM394_SYSDMA)
|
||||
#include "logmacro.h"
|
||||
|
||||
|
||||
@ -143,7 +143,12 @@ WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7810_w) { LOGMASKED(LOG_GCM39
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7816_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7816_w %04x\n", machine().describe_context(), data); m_7816 = data; }
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7817_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7817_w %04x\n", machine().describe_context(), data); m_7817 = data; }
|
||||
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7820_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7820_w %04x\n", machine().describe_context(), data); m_7820 = data; }
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7820_w)
|
||||
{
|
||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7820_w (Rom Mapping control?) %04x\n", machine().describe_context(), data);
|
||||
m_7820 = data;
|
||||
m_mapping_write_cb(data);
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7821_w)
|
||||
{
|
||||
@ -208,7 +213,7 @@ WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_78b1_w) { LOGMASKED(LOG_GCM39
|
||||
READ16_MEMBER(sunplus_gcm394_base_device::unkarea_78b2_r)
|
||||
{
|
||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78b2_r\n", machine().describe_context());
|
||||
return machine().rand();
|
||||
return m_78b2;
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_78b2_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78b2_w %04x\n", machine().describe_context(), data); m_78b2 = data; }
|
||||
@ -227,7 +232,7 @@ WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7935_w)
|
||||
{
|
||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7935_w %04x\n", machine().describe_context(), data);
|
||||
m_7935 &= ~data;
|
||||
checkirq6();
|
||||
//checkirq6();
|
||||
}
|
||||
|
||||
READ16_MEMBER(sunplus_gcm394_base_device::unkarea_7936_r) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7936_r\n", machine().describe_context()); return 0x0000; }
|
||||
@ -281,16 +286,16 @@ void sunplus_gcm394_base_device::internal_map(address_map &map)
|
||||
map(0x007010, 0x007015).rw(m_spg_video, FUNC(gcm394_base_video_device::tmap0_regs_r), FUNC(gcm394_base_video_device::tmap0_regs_w));
|
||||
map(0x007016, 0x00701b).rw(m_spg_video, FUNC(gcm394_base_video_device::tmap1_regs_r), FUNC(gcm394_base_video_device::tmap1_regs_w));
|
||||
|
||||
map(0x007020, 0x007020).w(m_spg_video, FUNC(gcm394_base_video_device::tmap0_unk0_w)); // probably tilebase, written with other tmap0 regs
|
||||
map(0x007021, 0x007021).w(m_spg_video, FUNC(gcm394_base_video_device::tmap1_unk0_w)); // probably tilebase, written with other tmap1 regs
|
||||
map(0x007020, 0x007020).w(m_spg_video, FUNC(gcm394_base_video_device::tmap0_tilebase_lsb_w)); // probably tilebase, written with other tmap0 regs
|
||||
map(0x007021, 0x007021).w(m_spg_video, FUNC(gcm394_base_video_device::tmap1_tilebase_lsb_w)); // probably tilebase, written with other tmap1 regs
|
||||
map(0x007022, 0x007022).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device2_unk0_w)); // another tilebase? maybe sprites? written as 7022, 702d and 7042 group
|
||||
map(0x007023, 0x007023).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device0_unk0_w)); // written with other unknown_video_device0 regs
|
||||
map(0x007024, 0x007024).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device1_unk0_w)); // written with other unknown_video_device1 regs
|
||||
|
||||
map(0x00702a, 0x00702a).w(m_spg_video, FUNC(gcm394_base_video_device::video_702a_w));
|
||||
|
||||
map(0x00702b, 0x00702b).w(m_spg_video, FUNC(gcm394_base_video_device::tmap0_unk1_w)); // written with other tmap0 regs
|
||||
map(0x00702c, 0x00702c).w(m_spg_video, FUNC(gcm394_base_video_device::tmap1_unk1_w)); // written with other tmap1 regs
|
||||
map(0x00702b, 0x00702b).w(m_spg_video, FUNC(gcm394_base_video_device::tmap0_tilebase_msb_w)); // written with other tmap0 regs
|
||||
map(0x00702c, 0x00702c).w(m_spg_video, FUNC(gcm394_base_video_device::tmap1_tilebase_msb_w)); // written with other tmap1 regs
|
||||
map(0x00702d, 0x00702d).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device2_unk1_w)); // maybe sprites? written as 7022, 702d and 7042 group
|
||||
map(0x00702e, 0x00702e).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device0_unk1_w)); // written with other unknown_video_device0 regs
|
||||
map(0x00702f, 0x00702f).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device1_unk1_w)); // written with other unknown_video_device1 regs
|
||||
@ -310,6 +315,7 @@ void sunplus_gcm394_base_device::internal_map(address_map &map)
|
||||
map(0x007072, 0x007072).rw(m_spg_video, FUNC(gcm394_base_video_device::video_dma_size_r), FUNC(gcm394_base_video_device::video_dma_size_w)); //
|
||||
map(0x00707e, 0x00707e).w(m_spg_video, FUNC(gcm394_base_video_device::video_dma_unk_w)); // written around same time as DMA, seems to select alt sprite bank
|
||||
|
||||
map(0x00707c, 0x00707c).r(m_spg_video, FUNC(gcm394_base_video_device::video_707c_r)); // wrlshunt polls this waiting for 0x8000, is this some kind of manual port based data upload?
|
||||
map(0x00707f, 0x00707f).rw(m_spg_video, FUNC(gcm394_base_video_device::video_707f_r), FUNC(gcm394_base_video_device::video_707f_w));
|
||||
|
||||
// another set of registers for something?
|
||||
@ -327,6 +333,9 @@ void sunplus_gcm394_base_device::internal_map(address_map &map)
|
||||
// 73xx-77xx = video ram
|
||||
// ######################################################################################################################################################################################
|
||||
|
||||
map(0x007100, 0x0071ef).ram().share("unkram1"); // maybe a line table? (assuming DMA isn't writing to wrong place)
|
||||
map(0x007200, 0x0072ef).ram().share("unkram2"); // ^^
|
||||
|
||||
map(0x007300, 0x0073ff).rw(m_spg_video, FUNC(gcm394_base_video_device::palette_r), FUNC(gcm394_base_video_device::palette_w));
|
||||
|
||||
map(0x007400, 0x0077ff).ram().share("spriteram");
|
||||
@ -348,12 +357,12 @@ void sunplus_gcm394_base_device::internal_map(address_map &map)
|
||||
map(0x007816, 0x007816).w(FUNC(sunplus_gcm394_base_device::unkarea_7816_w));
|
||||
map(0x007817, 0x007817).w(FUNC(sunplus_gcm394_base_device::unkarea_7817_w));
|
||||
|
||||
|
||||
map(0x007820, 0x007820).w(FUNC(sunplus_gcm394_base_device::unkarea_7820_w));
|
||||
map(0x007821, 0x007821).w(FUNC(sunplus_gcm394_base_device::unkarea_7821_w));
|
||||
map(0x007822, 0x007822).w(FUNC(sunplus_gcm394_base_device::unkarea_7822_w));
|
||||
map(0x007823, 0x007823).w(FUNC(sunplus_gcm394_base_device::unkarea_7823_w));
|
||||
map(0x007824, 0x007824).w(FUNC(sunplus_gcm394_base_device::unkarea_7824_w));
|
||||
// wrlshunt | smartfp
|
||||
map(0x007820, 0x007820).w(FUNC(sunplus_gcm394_base_device::unkarea_7820_w)); // 7f8a (7f8a before DMA from ROM to RAM, 008a after DMA from ROM to RAM) | 3f04
|
||||
map(0x007821, 0x007821).w(FUNC(sunplus_gcm394_base_device::unkarea_7821_w)); // 7f47 | 0044
|
||||
map(0x007822, 0x007822).w(FUNC(sunplus_gcm394_base_device::unkarea_7822_w)); // 0047 | 1f44
|
||||
map(0x007823, 0x007823).w(FUNC(sunplus_gcm394_base_device::unkarea_7823_w)); // 0047 | 0044
|
||||
map(0x007824, 0x007824).w(FUNC(sunplus_gcm394_base_device::unkarea_7824_w)); // 0047 | 0044
|
||||
|
||||
map(0x00782d, 0x00782d).rw(FUNC(sunplus_gcm394_base_device::unkarea_782d_r), FUNC(sunplus_gcm394_base_device::unkarea_782d_w)); // on startup
|
||||
|
||||
@ -437,7 +446,7 @@ void sunplus_gcm394_base_device::device_start()
|
||||
|
||||
m_space_read_cb.resolve_safe(0);
|
||||
m_space_write_cb.resolve();
|
||||
m_bank_write_cb.resolve();
|
||||
m_mapping_write_cb.resolve();
|
||||
|
||||
|
||||
m_unk_timer = timer_alloc(0);
|
||||
@ -524,12 +533,25 @@ void sunplus_gcm394_base_device::device_reset()
|
||||
|
||||
}
|
||||
|
||||
IRQ_CALLBACK_MEMBER(sunplus_gcm394_base_device::irq_vector_cb)
|
||||
{
|
||||
//printf("irq_vector_cb %d\n", irqline);
|
||||
|
||||
if (irqline == UNSP_IRQ6_LINE)
|
||||
set_state_unsynced(UNSP_IRQ6_LINE, CLEAR_LINE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void sunplus_gcm394_base_device::checkirq6()
|
||||
{
|
||||
/*
|
||||
if (m_7935 & 0x0100)
|
||||
set_state_unsynced(UNSP_IRQ6_LINE, ASSERT_LINE);
|
||||
else
|
||||
set_state_unsynced(UNSP_IRQ6_LINE, CLEAR_LINE);
|
||||
*/
|
||||
}
|
||||
|
||||
void sunplus_gcm394_base_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||
@ -539,7 +561,8 @@ void sunplus_gcm394_base_device::device_timer(emu_timer &timer, device_timer_id
|
||||
case 0:
|
||||
{
|
||||
m_7935 |= 0x0100;
|
||||
checkirq6();
|
||||
set_state_unsynced(UNSP_IRQ6_LINE, ASSERT_LINE);
|
||||
// checkirq6();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
m_porta_out(*this),
|
||||
m_space_read_cb(*this),
|
||||
m_space_write_cb(*this),
|
||||
m_bank_write_cb(*this)
|
||||
m_mapping_write_cb(*this)
|
||||
{
|
||||
}
|
||||
|
||||
@ -43,16 +43,17 @@ public:
|
||||
|
||||
auto porta_out() { return m_porta_out.bind(); }
|
||||
|
||||
|
||||
auto space_read_callback() { return m_space_read_cb.bind(); }
|
||||
auto space_write_callback() { return m_space_write_cb.bind(); }
|
||||
auto bank_write_callback() { return m_bank_write_cb.bind(); }
|
||||
auto mapping_write_callback() { return m_mapping_write_cb.bind(); }
|
||||
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(vblank) { m_spg_video->vblank(state); }
|
||||
|
||||
virtual void device_add_mconfig(machine_config& config) override;
|
||||
|
||||
IRQ_CALLBACK_MEMBER(irq_vector_cb);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void device_start() override;
|
||||
@ -140,7 +141,7 @@ protected:
|
||||
private:
|
||||
devcb_read16 m_space_read_cb;
|
||||
devcb_write16 m_space_write_cb;
|
||||
devcb_write16 m_bank_write_cb;
|
||||
devcb_write16 m_mapping_write_cb;
|
||||
|
||||
DECLARE_READ16_MEMBER(unk_r);
|
||||
DECLARE_WRITE16_MEMBER(unk_w);
|
||||
|
@ -285,7 +285,7 @@ void gcm394_base_video_device::draw(const rectangle &cliprect, uint32_t line, ui
|
||||
}
|
||||
else
|
||||
{
|
||||
pen = machine().rand() & 0x1f;
|
||||
//pen = machine().rand() & 0x1f;
|
||||
// 8bpp
|
||||
}
|
||||
|
||||
@ -518,10 +518,10 @@ uint32_t gcm394_base_video_device::screen_update(screen_device &screen, bitmap_r
|
||||
{
|
||||
memset(&m_screenbuf[320 * cliprect.min_y], 0, 4 * 320 * ((cliprect.max_y - cliprect.min_y) + 1));
|
||||
|
||||
const uint32_t page1_addr = 0x40 * m_page1_addr;
|
||||
const uint32_t page2_addr = 0x40 * m_page2_addr;
|
||||
uint16_t* page1_regs = m_tmap0_regs;
|
||||
uint16_t* page2_regs = m_tmap1_regs;
|
||||
const uint32_t page0_addr = 0x40 * (m_page0_addr | (m_page0_addr_msb<<16));
|
||||
const uint32_t page1_addr = 0x40 * (m_page1_addr | (m_page1_addr_msb<<16));
|
||||
uint16_t* page0_regs = m_tmap0_regs;
|
||||
uint16_t* page1_regs = m_tmap1_regs;
|
||||
|
||||
for (uint32_t scanline = (uint32_t)cliprect.min_y; scanline <= (uint32_t)cliprect.max_y; scanline++)
|
||||
{
|
||||
@ -529,8 +529,8 @@ uint32_t gcm394_base_video_device::screen_update(screen_device &screen, bitmap_r
|
||||
{
|
||||
if (1)
|
||||
{
|
||||
draw_page(cliprect, scanline, i, page0_addr, page0_regs);
|
||||
draw_page(cliprect, scanline, i, page1_addr, page1_regs);
|
||||
draw_page(cliprect, scanline, i, page2_addr, page2_regs);
|
||||
}
|
||||
draw_sprites(cliprect, scanline, i);
|
||||
}
|
||||
@ -595,15 +595,16 @@ WRITE16_MEMBER(gcm394_base_video_device::tmap0_regs_w)
|
||||
write_tmap_regs(0, m_tmap0_regs, offset, data);
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(gcm394_base_video_device::tmap0_unk0_w)
|
||||
WRITE16_MEMBER(gcm394_base_video_device::tmap0_tilebase_lsb_w)
|
||||
{
|
||||
LOGMASKED(LOG_GCM394_TMAP, "%s:gcm394_base_video_device::tmap0_unk0_w %04x\n", machine().describe_context(), data);
|
||||
m_page1_addr = data;
|
||||
LOGMASKED(LOG_GCM394_TMAP, "%s:gcm394_base_video_device::tmap0_tilebase_lsb_w %04x\n", machine().describe_context(), data);
|
||||
m_page0_addr = data;
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(gcm394_base_video_device::tmap0_unk1_w)
|
||||
WRITE16_MEMBER(gcm394_base_video_device::tmap0_tilebase_msb_w)
|
||||
{
|
||||
LOGMASKED(LOG_GCM394_TMAP, "%s:gcm394_base_video_device::tmap0_unk1_w %04x\n", machine().describe_context(), data);
|
||||
LOGMASKED(LOG_GCM394_TMAP, "%s:gcm394_base_video_device::tmap0_tilebase_msb_w %04x\n", machine().describe_context(), data);
|
||||
m_page0_addr_msb = data;
|
||||
}
|
||||
|
||||
// **************************************** TILEMAP 1 *************************************************
|
||||
@ -616,15 +617,16 @@ WRITE16_MEMBER(gcm394_base_video_device::tmap1_regs_w)
|
||||
write_tmap_regs(1, m_tmap1_regs, offset, data);
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(gcm394_base_video_device::tmap1_unk0_w)
|
||||
WRITE16_MEMBER(gcm394_base_video_device::tmap1_tilebase_lsb_w)
|
||||
{
|
||||
LOGMASKED(LOG_GCM394_TMAP, "%s:gcm394_base_video_device::tmap1_unk0_w %04x\n", machine().describe_context(), data);
|
||||
m_page2_addr = data;
|
||||
LOGMASKED(LOG_GCM394_TMAP, "%s:gcm394_base_video_device::tmap1_tilebase_lsb_w %04x\n", machine().describe_context(), data);
|
||||
m_page1_addr = data;
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(gcm394_base_video_device::tmap1_unk1_w)
|
||||
WRITE16_MEMBER(gcm394_base_video_device::tmap1_tilebase_msb_w)
|
||||
{
|
||||
LOGMASKED(LOG_GCM394_TMAP, "%s:gcm394_base_video_device::tmap1_unk1_w %04x\n", machine().describe_context(), data);
|
||||
LOGMASKED(LOG_GCM394_TMAP, "%s:gcm394_base_video_device::tmap1_tilebase_msb_w %04x\n", machine().describe_context(), data);
|
||||
m_page1_addr_msb = data;
|
||||
}
|
||||
|
||||
// **************************************** unknown video device 0 (another tilemap? sprite layer?) *************************************************
|
||||
@ -757,6 +759,11 @@ WRITE16_MEMBER(gcm394_base_video_device::video_dma_unk_w)
|
||||
}
|
||||
|
||||
|
||||
READ16_MEMBER(gcm394_base_video_device::video_707c_r)
|
||||
{
|
||||
LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_707c_r\n", machine().describe_context());
|
||||
return 0x8000;
|
||||
}
|
||||
|
||||
|
||||
READ16_MEMBER(gcm394_base_video_device::video_707f_r) { LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_707f_r\n", machine().describe_context()); return m_707f; }
|
||||
@ -791,7 +798,12 @@ WRITE16_MEMBER(gcm394_base_video_device::video_7063_w)
|
||||
WRITE16_MEMBER(gcm394_base_video_device::video_702a_w) { LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_702a_w %04x\n", machine().describe_context(), data); m_702a = data; }
|
||||
|
||||
// read in IRQ
|
||||
READ16_MEMBER(gcm394_base_video_device::video_7030_r) { LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_7030_r\n", machine().describe_context()); return m_7030; }
|
||||
READ16_MEMBER(gcm394_base_video_device::video_7030_r)
|
||||
{
|
||||
LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_7030_r\n", machine().describe_context());
|
||||
return 0x0000; /* wrlshunt ends up doing an explicit jump to 0000 shortly after boot if you just return the value written here, what is it? do we want to be returning non-zero to continue, with the problem being elsewhere, or is this the problem? */
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(gcm394_base_video_device::video_7030_w) { LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_7030_w %04x\n", machine().describe_context(), data); m_7030 = data; }
|
||||
WRITE16_MEMBER(gcm394_base_video_device::video_703c_w) { LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_703c_w %04x\n", machine().describe_context(), data); m_703c = data; }
|
||||
|
||||
|
@ -29,13 +29,13 @@ public:
|
||||
|
||||
DECLARE_READ16_MEMBER(tmap0_regs_r);
|
||||
DECLARE_WRITE16_MEMBER(tmap0_regs_w);
|
||||
DECLARE_WRITE16_MEMBER(tmap0_unk0_w);
|
||||
DECLARE_WRITE16_MEMBER(tmap0_unk1_w);
|
||||
DECLARE_WRITE16_MEMBER(tmap0_tilebase_lsb_w);
|
||||
DECLARE_WRITE16_MEMBER(tmap0_tilebase_msb_w);
|
||||
|
||||
DECLARE_READ16_MEMBER(tmap1_regs_r);
|
||||
DECLARE_WRITE16_MEMBER(tmap1_regs_w);
|
||||
DECLARE_WRITE16_MEMBER(tmap1_unk0_w);
|
||||
DECLARE_WRITE16_MEMBER(tmap1_unk1_w);
|
||||
DECLARE_WRITE16_MEMBER(tmap1_tilebase_lsb_w);
|
||||
DECLARE_WRITE16_MEMBER(tmap1_tilebase_msb_w);
|
||||
|
||||
DECLARE_WRITE16_MEMBER(unknown_video_device0_regs_w);
|
||||
DECLARE_WRITE16_MEMBER(unknown_video_device0_unk0_w);
|
||||
@ -69,6 +69,7 @@ public:
|
||||
DECLARE_WRITE16_MEMBER(video_7030_w);
|
||||
DECLARE_WRITE16_MEMBER(video_703c_w);
|
||||
|
||||
DECLARE_READ16_MEMBER(video_707c_r);
|
||||
|
||||
DECLARE_READ16_MEMBER(video_707f_r);
|
||||
DECLARE_WRITE16_MEMBER(video_707f_w);
|
||||
@ -155,8 +156,11 @@ protected:
|
||||
// required_shared_ptr<uint16_t> m_scrollram;
|
||||
required_shared_ptr<uint16_t> m_spriteram;
|
||||
|
||||
uint16_t m_page0_addr;
|
||||
uint16_t m_page0_addr_msb;
|
||||
|
||||
uint16_t m_page1_addr;
|
||||
uint16_t m_page2_addr;
|
||||
uint16_t m_page1_addr_msb;
|
||||
|
||||
uint16_t m_videodma_bank;
|
||||
uint16_t m_videodma_size;
|
||||
|
@ -53,18 +53,20 @@ protected:
|
||||
|
||||
virtual void mem_map_4m(address_map &map);
|
||||
|
||||
virtual DECLARE_WRITE16_MEMBER(write_external_space);
|
||||
|
||||
private:
|
||||
required_region_ptr<uint16_t> m_romregion;
|
||||
private:
|
||||
|
||||
uint32_t m_current_bank;
|
||||
int m_numbanks;
|
||||
|
||||
DECLARE_READ16_MEMBER(porta_r);
|
||||
DECLARE_READ16_MEMBER(portb_r);
|
||||
DECLARE_WRITE16_MEMBER(porta_w);
|
||||
|
||||
DECLARE_READ16_MEMBER(read_external_space);
|
||||
virtual DECLARE_WRITE16_MEMBER(mapping_w) {}
|
||||
|
||||
virtual DECLARE_READ16_MEMBER(read_external_space);
|
||||
virtual DECLARE_WRITE16_MEMBER(write_external_space);
|
||||
};
|
||||
|
||||
class wrlshunt_game_state : public gcm394_game_state
|
||||
@ -72,6 +74,7 @@ class wrlshunt_game_state : public gcm394_game_state
|
||||
public:
|
||||
wrlshunt_game_state(const machine_config& mconfig, device_type type, const char* tag) :
|
||||
gcm394_game_state(mconfig, type, tag),
|
||||
m_mapping(0),
|
||||
m_mainram(*this, "mainram")
|
||||
{
|
||||
}
|
||||
@ -84,14 +87,18 @@ protected:
|
||||
|
||||
void wrlshunt_map(address_map &map);
|
||||
|
||||
virtual DECLARE_WRITE16_MEMBER(write_external_space) override;
|
||||
|
||||
private:
|
||||
|
||||
DECLARE_READ16_MEMBER(hunt_porta_r);
|
||||
DECLARE_WRITE16_MEMBER(hunt_porta_w);
|
||||
|
||||
virtual DECLARE_WRITE16_MEMBER(mapping_w) override;
|
||||
uint16_t m_mapping;
|
||||
|
||||
required_shared_ptr<u16> m_mainram;
|
||||
|
||||
virtual DECLARE_READ16_MEMBER(read_external_space) override;
|
||||
virtual DECLARE_WRITE16_MEMBER(write_external_space) override;
|
||||
};
|
||||
|
||||
READ16_MEMBER(gcm394_game_state::read_external_space)
|
||||
@ -105,6 +112,37 @@ WRITE16_MEMBER(gcm394_game_state::write_external_space)
|
||||
logerror("DMA writing to external space (RAM?) %08x %04x\n", offset, data);
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(wrlshunt_game_state::mapping_w)
|
||||
{
|
||||
m_mapping = data;
|
||||
logerror("change mapping %04x\n", data);
|
||||
}
|
||||
|
||||
READ16_MEMBER(wrlshunt_game_state::read_external_space)
|
||||
{
|
||||
if (m_mapping == 0x7f8a)
|
||||
{
|
||||
//logerror("reading offset %04x\n", offset * 2);
|
||||
return m_romregion[offset];
|
||||
}
|
||||
else if (m_mapping == 0x008a)
|
||||
{
|
||||
address_space& mem = m_maincpu->space(AS_PROGRAM);
|
||||
uint16_t retdata = mem.read_word(offset + 0x20000);
|
||||
logerror("reading from RAM instead offset %08x returning %04x\n", offset * 2, retdata);
|
||||
return retdata;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16_t retdata = 0x0000;
|
||||
logerror("reading from unknown source instead offset %08x returning %04x\n", offset * 2, retdata);
|
||||
return retdata;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
WRITE16_MEMBER(wrlshunt_game_state::write_external_space)
|
||||
{
|
||||
// logerror("DMA writing to external space (RAM?) %08x %04x\n", offset, data);
|
||||
@ -146,6 +184,11 @@ READ16_MEMBER(gcm394_game_state::portb_r)
|
||||
return data;
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(gcm394_game_state::porta_w)
|
||||
{
|
||||
logerror("%s: Port A:WRITE %04x\n", machine().describe_context(), data);
|
||||
}
|
||||
|
||||
|
||||
void gcm394_game_state::base(machine_config &config)
|
||||
{
|
||||
@ -153,8 +196,11 @@ void gcm394_game_state::base(machine_config &config)
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &gcm394_game_state::mem_map_4m);
|
||||
m_maincpu->porta_in().set(FUNC(gcm394_game_state::porta_r));
|
||||
m_maincpu->portb_in().set(FUNC(gcm394_game_state::portb_r));
|
||||
m_maincpu->porta_out().set(FUNC(gcm394_game_state::porta_w));
|
||||
m_maincpu->space_read_callback().set(FUNC(gcm394_game_state::read_external_space));
|
||||
m_maincpu->space_write_callback().set(FUNC(gcm394_game_state::write_external_space));
|
||||
m_maincpu->set_irq_acknowledge_callback(m_maincpu, FUNC(sunplus_gcm394_base_device::irq_vector_cb));
|
||||
m_maincpu->mapping_write_callback().set(FUNC(gcm394_game_state::mapping_w));
|
||||
|
||||
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
|
||||
m_screen->set_refresh_hz(60);
|
||||
@ -456,7 +502,7 @@ GLB_GP-FS1_0405L_SPU_1.0.2.3
|
||||
SPF2ALP
|
||||
|
||||
"GPnandnand" as a required signature appears to be referenced right here, in page 19 of a GeneralPlus document;
|
||||
http://www.lcis.com.tw/paper_store/paper_store/GPL162004A-507A_162005A-707AV10_code_reference-20147131205102.pdf (this link is no longer valid)
|
||||
https://web.archive.org/web/20180106005235/http://www.lcis.com.tw/paper_store/paper_store/GPL162004A-507A_162005A-707AV10_code_reference-20147131205102.pdf
|
||||
|
||||
*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user