Skip to content

various plug and play additions / fixes #13235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions hash/super_tv_pc_cart.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ license:CC0-1.0
<info name="alt_title" value="ダブルマウスパーティー" />
<part name="cart" interface="super_tv_pc_cart">
<dataarea name="prg" size="0x200000">
<!-- baddump because code seems to be corrupt in places -->
<rom name="c-03.u1" size="0x200000" crc="94634a7b" sha1="d69ec0a8c6061e749206927ee68dbcf852fcc03e" status="baddump" />
<rom name="c-03.u1" size="0x200000" crc="94634a7b" sha1="d69ec0a8c6061e749206927ee68dbcf852fcc03e" />
</dataarea>
</part>
</software>
Expand Down
8 changes: 4 additions & 4 deletions src/devices/cpu/m6502/oxavix.lst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

callf_xa3
read_stack(SP);
write_special_stack(get_codebank());
write_special_stack(SP, get_codebank());
dec_special_stack();
TMP2 = read_pc();
PC++;
Expand Down Expand Up @@ -40,7 +40,7 @@ retf_imp
inc_SP();
PC = set_h(PC, read_stack(SP));
inc_special_stack();
TMP2 = read_special_stack();
TMP2 = read_special_stack(SP);
set_codebank(TMP2);
read_pc();
PC++;
Expand All @@ -55,7 +55,7 @@ brk_xav_imp
read_pc();
PC++;
}
write_special_stack(get_codebank());
write_special_stack(SP, get_codebank());
set_codebank(0x00); // epo_efdx, rad_ping and rad_mtrk strongly suggest that interrupts must force bank 0 as code jumps to a ROM pointer stored earlier / a fixed pointer to a rom address in bank 0
dec_special_stack();
write_stack(SP, PC >> 8);
Expand Down Expand Up @@ -123,7 +123,7 @@ rti_xav_imp
inc_SP();
PC = set_h(PC, read_stack(SP));
inc_special_stack();
TMP2 = read_special_stack();
TMP2 = read_special_stack(SP);
set_codebank(TMP2);
prefetch();

Expand Down
40 changes: 34 additions & 6 deletions src/devices/cpu/m6502/xavix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,52 @@ xavix_device::mi_xavix::mi_xavix(xavix_device *_base)
base = _base;
}

void xavix_device::write_special_stack(uint8_t data)
void xavix_device::write_special_stack(uint32_t addr, uint8_t data)
{
m_special_stack[m_special_stackpos&0xff] = data;
if (m_use_private_stack_for_extra_callf_byte)
{
m_special_stack[m_special_stackpos & 0xff] = data;
}
else
{
write_stack(addr, data);
}
}

void xavix_device::dec_special_stack()
{
m_special_stackpos--;
if (m_use_private_stack_for_extra_callf_byte)
{
m_special_stackpos--;
}
else
{
dec_SP();
}
}

void xavix_device::inc_special_stack()
{
m_special_stackpos++;
if (m_use_private_stack_for_extra_callf_byte)
{
m_special_stackpos++;
}
else
{
inc_SP();
}
}

uint8_t xavix_device::read_special_stack()
uint8_t xavix_device::read_special_stack(uint32_t addr)
{
return m_special_stack[m_special_stackpos&0xff];
if (m_use_private_stack_for_extra_callf_byte)
{
return m_special_stack[m_special_stackpos & 0xff];
}
else
{
return read_stack(addr);
}
}


Expand Down
14 changes: 12 additions & 2 deletions src/devices/cpu/m6502/xavix.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,10 @@ class xavix_device : public m6502_device {
void set_databank(uint8_t bank);
uint8_t get_databank();

void write_special_stack(uint8_t data);
void write_special_stack(uint32_t addr, uint8_t data);
void dec_special_stack();
void inc_special_stack();
uint8_t read_special_stack();
uint8_t read_special_stack(uint32_t addr);

/* we store the additional 'codebank' used for far calls in a different, private stack
this seems to be neccessary for 'rad_hnt2' not to crash when bringing up the calibration / score table screens
Expand All @@ -211,6 +211,16 @@ class xavix_device : public m6502_device {
uint8_t read_zeropage(uint32_t addr);
void write_zeropage(uint32_t addr, uint8_t val);

// Some original XaviX games seemed to suggest that the extra byte of the far calls went to a different
// stack, but dblmouse on suprtvpc does direct stack manipulation which challenges this assumption.
// It could be a SuperXaviX vs XaviX differences however, so currently leaving this as a toggle for testing.
//
// pausing in rad_hnt2 (press shift when on the map) is broken without this logic as the stack becomes too
// big with the extra bytes
//
// we currently use the private stack for regular XaviX but not for the later CPUs, however the root cause
// of needing it for regular XaviX could be somewhere else
bool m_use_private_stack_for_extra_callf_byte = true;
};

enum {
Expand Down
1 change: 1 addition & 0 deletions src/devices/cpu/m6502/xavix2000.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ DEFINE_DEVICE_TYPE(XAVIX2002, xavix2002_device, "xavix2002", "XaviX (SSD 2002) (
xavix2000_device::xavix2000_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
xavix_device(mconfig, type, tag, owner, clock)
{
m_use_private_stack_for_extra_callf_byte = false;
}

xavix2000_device::xavix2000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
Expand Down
5 changes: 5 additions & 0 deletions src/devices/machine/generalplus_gpl16250soc_video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,11 @@ void gcm394_base_video_device::video_dma_size_trigger_w(address_space &space, ui

LOGMASKED(LOG_GCM394_VIDEO_DMA, "%s: doing sprite / video DMA source %04x dest %04x size %04x value of 707e (bank) %04x value of 707f %04x\n", machine().describe_context(), m_videodma_source, m_videodma_dest, m_videodma_size, m_707e_spritebank, m_707f );

// jak_spmm sets dest to 0 when it wants to write to spriteram, looks intentional?
// does something else force writes to go to spriteram or does 0 always just mean there?
if (m_videodma_dest == 0)
m_videodma_dest = 0x7400;

for (int i = 0; i <= m_videodma_size; i++)
{
uint16_t dat = space.read_word(m_videodma_source+i);
Expand Down
41 changes: 26 additions & 15 deletions src/devices/machine/spg_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ void spg_renderer_device::draw_linemap(bool has_extended_tilemaps, const rectang
uint32_t tilemap = tilemapregs[2];
uint32_t palette_map = tilemapregs[3];

//popmessage("draw draw_linemap bases %04x %04x\n", tilemap, palette_map);
//if (scanline == 128)
// popmessage("draw draw_linemap reg0 %04x reg1 %04x bases %04x %04x\n", tilemapregs[0], tilemapregs[1], tilemap, palette_map);

//uint32_t xscroll = scrollregs[0];
uint32_t yscroll = scrollregs[1];
Expand Down Expand Up @@ -294,26 +295,36 @@ void spg_renderer_device::draw_linemap(bool has_extended_tilemaps, const rectang
}
else
{
for (int i = 0; i < 320 / 2; i++)
{
uint8_t palette_entry;
uint16_t color;
const uint16_t data = spc.read_word(sourcebase + i);
const uint32_t attr = tilemapregs[0];
const uint8_t bpp = attr & 0x0003;
const uint32_t nc_bpp = ((bpp)+1) << 1;
uint32_t palette_offset = (attr & 0x0f00) >> 4;
palette_offset >>= nc_bpp;
palette_offset <<= nc_bpp;

palette_entry = (data & 0x00ff);
color = paletteram[palette_entry];
uint32_t bits = 0;
uint32_t nbits = 0;

if (!(color & 0x8000))
{
m_linebuf[(i * 2) + 0] = color & 0x7fff;
for (int i = 0; i < 320; i++)
{
bits <<= nc_bpp;
if (nbits < nc_bpp)
{
uint16_t b = spc.read_word(sourcebase++ & 0x3fffff);
b = (b << 8) | (b >> 8);
bits |= b << (nc_bpp - nbits);
nbits += 16;
}
nbits -= nc_bpp;

uint32_t pal = palette_offset + (bits >> 16);
bits &= 0xffff;

palette_entry = (data & 0xff00) >> 8;
color = paletteram[palette_entry];
uint16_t rgb = paletteram[pal];

if (!(color & 0x8000))
if (!(rgb & 0x8000))
{
m_linebuf[(i * 2) + 1] = color & 0x7fff;
m_linebuf[i] = rgb;
}
}
}
Expand Down
13 changes: 13 additions & 0 deletions src/mame/mame.lst
Original file line number Diff line number Diff line change
Expand Up @@ -42701,6 +42701,9 @@ dbzscout
@source:skeleton/kron.cpp
kron180 // 1995 Kron Ltd, Ukraine

@source:skeleton/leadsinger2.cpp
leadsng2

@source:skeleton/lee1214.cpp
lee1214d //

Expand Down Expand Up @@ -45865,6 +45868,7 @@ batvgc
rad_gtg
rad_rsg
rad_rsgp
rad_rsgpa
rad_foot
rad_bb3
rad_bb3p
Expand Down Expand Up @@ -45908,6 +45912,7 @@ gameu50
gameu108
gormiti
imgame
jak_spmm
myac220
smartfp // Smart Fit Park
smartfpf
Expand Down Expand Up @@ -46012,10 +46017,12 @@ zone3d
ablkickb
abltenni //
anpantv
ban_krkk
comil //
ddr33v
decathln
decathlna
dmbtjunc
doraglob // (c) 2007 VTech
doraglobf
doraglobg
Expand Down Expand Up @@ -46058,6 +46065,7 @@ virtbb
virtten
vtechtvsgr // (c) 2006 VTech
vtechtvssp // (c) 2006 VTech
wfart
wfcentro

@source:tvgames/spg2xx_digimake.cpp
Expand Down Expand Up @@ -46338,6 +46346,7 @@ tak_gin //
tak_geig //
tak_hamr //
tak_town //
tak_wdg //
tak_zuba //
tcarnavi //
tom_tvho //
Expand All @@ -46355,6 +46364,7 @@ ltv_naru //
domfitad //
dombikec //
epo_dabj
epo_dtcj

@source:tvgames/xavix_2000.cpp
ban_omt //
Expand All @@ -46379,9 +46389,12 @@ ttv_swj //
@source:tvgames/xavix_2002.cpp
anpanmdx
apmj2009
ban_bkgj
ban_dn1j
ban_kksj
ban_utmj
epo_ntpj
epo_rgfj
ban_ordj
domdance //
domfitch //
Expand Down
Loading
Loading