Skip to content
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

neogeo/neogeo_v.cpp: Make palette byte access behave the same as on real hardware #11869

Merged
merged 1 commit into from Dec 23, 2023

Conversation

zardam
Copy link
Contributor

@zardam zardam commented Dec 23, 2023

On real hardware, a byte written in palette RAM is repeated in the whole word (CPU UDS/LDS signals seems to be ignored for palette access). This is used by some software to detect emulation.

@happppp
Copy link
Member

happppp commented Dec 23, 2023

Or is it like video_register_w/r where accessing the LSB only is not mapped, accessing the MSB only stores same data in MSB and LSB?

@rb6502
Copy link
Contributor

rb6502 commented Dec 23, 2023

This is known as "byte smearing", and MAME's 68000 core already does it (byte-wide writes put the same byte on both byte lanes of the 16-bit data bus). So this should be able to be simplified to:

	case 0xff00:
		data = (data & 0xff00) | (data & 0x00ff);
		break;
	case 0x00ff:
		data = (data & 0xff00) | (data & 0x00ff);
		break;

@zardam
Copy link
Contributor Author

zardam commented Dec 23, 2023

I tried writing bytes manually to palette RAM using unibios. Writing to even or odd addresses gives the same result, the value is repeated in the two bytes of the word.

I guess that for 8 bits access the CPU just repeats the byte on D0-D7 and D8-D15, and asserts UDS/LDS according to the address parity. UDS/LDS seems to be ignored for palette access, and maybe not for video register ? I did not find the information on the exact behavior of the CPU data bus in this case.

@rb6502
Copy link
Contributor

rb6502 commented Dec 23, 2023

Actually never mind, you should be able to delete the switch statement entirely and just let the m_paletteram[offset] = data; do the work.

@zardam
Copy link
Contributor Author

zardam commented Dec 23, 2023

@rb6502, that is equivalent to not masking at all data. You're right !

…eal hardware

On real hardware, a byte writen in palette RAM is repeated in the whole word. This is used by some software to detect emulation.
@rb6502 rb6502 merged commit 81650bc into mamedev:master Dec 23, 2023
5 checks passed
einstein95 pushed a commit to einstein95/mame that referenced this pull request Mar 2, 2024
…eal hardware (mamedev#11869)

On real hardware, a byte writen in palette RAM is repeated in the whole word. This is used by some software to detect emulation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants