fix broken dma mode (nw)

This commit is contained in:
David Haywood 2013-10-07 21:11:04 +00:00
parent 91fe9b59cb
commit 1fc225121b

View File

@ -69,8 +69,11 @@ void igs022_device::IGS022_do_dma(UINT16 src, UINT16 dst, UINT16 size, UINT16 mo
*/ */
param = mode >> 8; param = mode >> 8;
if (mode & 0x00f0) printf("IGS022_do_dma mode bits %04x set\n", mode & 0x00f0);
mode &=0xf; // what are the other bits? mode &=0xf; // what are the other bits?
if ((mode == 0) || (mode == 1) || (mode == 2) || (mode == 3) || (mode == 4)) if ((mode == 0) || (mode == 1) || (mode == 2) || (mode == 3) || (mode == 4))
{ {
/* mode3 applies a xor from a 0x100 byte table to the data being /* mode3 applies a xor from a 0x100 byte table to the data being
@ -128,29 +131,28 @@ void igs022_device::IGS022_do_dma(UINT16 src, UINT16 dst, UINT16 size, UINT16 mo
} }
else if (mode == 5) else if (mode == 5)
{ {
/* mode 5 seems to be a straight copy, byteswap */ /* mode 5 seems to be a byteswapped copy */
int x; int x;
UINT16 *PROTROM = (UINT16*)memregion(":igs022data")->base(); UINT16 *PROTROM = (UINT16*)memregion(":igs022data")->base();
for (x = 0; x < size; x++) for (x = 0; x < size; x++)
{ {
UINT16 dat = PROTROM[src + x]; UINT16 dat = PROTROM[src + x];
dat = ((dat &0x00ff) << 8) | ((dat &0xff00) >> 8);
m_sharedprotram[dst + x] = (dat << 8) | (dat >> 8); m_sharedprotram[dst + x] = dat;
} }
} }
else if (mode == 6) else if (mode == 6)
{ {
/* mode 6 seems to swap bytes and nibbles */ /* mode 6 seems to be a nibble swapped copy */
int x; int x;
UINT16 *PROTROM = (UINT16*)memregion(":igs022data")->base(); UINT16 *PROTROM = (UINT16*)memregion(":igs022data")->base();
for (x = 0; x < size; x++) for (x = 0; x < size; x++)
{ {
UINT16 dat = PROTROM[src + x]; UINT16 dat = PROTROM[src + x];
dat = ((dat & 0xf000) >> 12)| dat = ((dat & 0xf0f0) >> 4)|
((dat & 0x0f00) >> 4)| ((dat & 0x0f0f) << 4);
((dat & 0x00f0) << 4)|
((dat & 0x000f) << 12);
m_sharedprotram[dst + x] = dat; m_sharedprotram[dst + x] = dat;
} }