get rid of legacy BITSWAP* (nw)

This commit is contained in:
Vas Crabb 2017-12-13 17:32:17 +11:00
parent bb524ec858
commit 9bf81912d3
375 changed files with 1295 additions and 1305 deletions

View File

@ -37,10 +37,10 @@
//**************************************************************************
#define UNSCRAMBLE_ADDRESS(_offset) \
BITSWAP16(_offset,15,14,13,12,1,0,2,3,11,10,9,8,7,6,5,4)
bitswap<16>(_offset,15,14,13,12,1,0,2,3,11,10,9,8,7,6,5,4)
#define UNSCRAMBLE_DATA(_data) \
BITSWAP8(_data,7,6,5,4,0,1,2,3)
bitswap<8>(_data,7,6,5,4,0,1,2,3)

View File

@ -142,7 +142,7 @@ uint8_t c64_stardos_cartridge_device::c64_cd_r(address_space &space, offs_t offs
{
if (!roml || !romh)
{
// TODO BITSWAP8(7,6,5,4,3,1,2,0) ?
// TODO bitswap<8>(7,6,5,4,3,1,2,0) ?
data = m_roml[offset & 0x3fff];
}
else if (!io1)

View File

@ -36,10 +36,10 @@
//**************************************************************************
#define UNSCRAMBLE_ADDRESS(_offset) \
BITSWAP16(_offset,15,14,13,12,5,0,7,10,11,9,8,6,4,3,2,1)
bitswap<16>(_offset,15,14,13,12,5,0,7,10,11,9,8,6,4,3,2,1)
#define UNSCRAMBLE_DATA(_data) \
BITSWAP8(_data,7,6,0,5,1,4,2,3)
bitswap<8>(_data,7,6,0,5,1,4,2,3)

View File

@ -40,10 +40,10 @@
//**************************************************************************
#define UNSCRAMBLE_ADDRESS(_offset) \
BITSWAP16(_offset,15,14,13,12,6,2,8,10,11,9,7,5,4,3,1,0)
bitswap<16>(_offset,15,14,13,12,6,2,8,10,11,9,7,5,4,3,1,0)
#define UNSCRAMBLE_DATA(_data) \
BITSWAP8(_data,7,6,0,5,1,4,2,3)
bitswap<8>(_data,7,6,0,5,1,4,2,3)
// 74LS122 tW=0.45*R*C = 1.1844s

View File

@ -38,10 +38,10 @@
//**************************************************************************
#define UNSCRAMBLE_ADDRESS(_offset) \
BITSWAP16(_offset,15,14,12,13,5,2,7,9,11,10,8,6,4,3,1,0)
bitswap<16>(_offset,15,14,12,13,5,2,7,9,11,10,8,6,4,3,1,0)
#define UNSCRAMBLE_DATA(_data) \
BITSWAP8(_data,7,6,5,0,1,4,2,3)
bitswap<8>(_data,7,6,5,0,1,4,2,3)

View File

@ -1071,7 +1071,7 @@ void fsd2_device::device_start()
for (offs_t offset = 0; offset < 0x4000; offset++)
{
uint8_t data = BITSWAP8(rom[offset], 7, 6, 5, 3, 4, 2, 1, 0);
uint8_t data = bitswap<8>(rom[offset], 7, 6, 5, 3, 4, 2, 1, 0);
rom[offset] = data;
}

View File

@ -192,7 +192,7 @@ void chanf_rom_device::common_write_2102(uint32_t offset, uint8_t data)
m_latch[1] = data;
// all bits but 2,3 come from this write, but they are shuffled
// notice that data is 8bits, so when swapping bit8 & bit9 are always 0!
m_addr_latch = (m_addr_latch & 0x0c) | (BITSWAP16((uint16_t) data, 15, 14, 13, 12, 11, 10, 7, 6, 5, 3, 2, 1, 9, 8, 4, 0));
m_addr_latch = (m_addr_latch & 0x0c) | (bitswap<16>((uint16_t) data, 15, 14, 13, 12, 11, 10, 7, 6, 5, 3, 2, 1, 9, 8, 4, 0));
}
}

View File

@ -1057,26 +1057,26 @@ WRITE8_MEMBER(gb_rom_sintax_device::write_bank)
switch (m_sintax_mode & 0x0f)
{
case 0x0d:
data = BITSWAP8(data, 1,0,7,6,5,4,3,2);
data = bitswap<8>(data, 1,0,7,6,5,4,3,2);
break;
case 0x09:
//data = BITSWAP8(data, 3,2,5,4,0,1,6,7); // Monkey..no
data = BITSWAP8(data, 4,5,2,3,0,1,6,7);
//data = bitswap<8>(data, 3,2,5,4,0,1,6,7); // Monkey..no
data = bitswap<8>(data, 4,5,2,3,0,1,6,7);
break;
case 0x00: // 0x10=lion 0x00 hmmmmm // 1 and 0 unconfirmed
data = BITSWAP8(data, 7,0,5,6,3,4,1,2);
data = bitswap<8>(data, 7,0,5,6,3,4,1,2);
break;
case 0x01:
data = BITSWAP8(data, 0,1,6,7,4,5,2,3);
data = bitswap<8>(data, 0,1,6,7,4,5,2,3);
break;
case 0x05:
data = BITSWAP8(data, 7,6,1,0,3,2,5,4); // Not 100% on this one
data = bitswap<8>(data, 7,6,1,0,3,2,5,4); // Not 100% on this one
break;
case 0x07:
data = BITSWAP8(data, 2,0,3,1,5,4,7,6); // 5 and 7 unconfirmed
data = bitswap<8>(data, 2,0,3,1,5,4,7,6); // 5 and 7 unconfirmed
break;
case 0x0b:
data = BITSWAP8(data, 2,3,0,1,6,7,4,5); // 5 and 6 unconfirmed
data = bitswap<8>(data, 2,3,0,1,6,7,4,5); // 5 and 6 unconfirmed
break;
}
m_latch_bank2 = (m_latch_bank2 & 0x100) | data;

View File

@ -45,7 +45,7 @@ READ8_MEMBER(msx_cart_dooly_device::read_cart)
switch (m_prot)
{
case 0x04:
data = BITSWAP8(data, 7, 6, 5, 4, 3, 1, 0, 2);
data = bitswap<8>(data, 7, 6, 5, 4, 3, 1, 0, 2);
break;
}
return data;

View File

@ -102,7 +102,7 @@ WRITE16_MEMBER(neogeo_kof10th_cart_device::protection_w)
if (!m_cart_ram[0xffe])
COMBINE_DATA(&m_cart_ram2[(0x00000/2) + (offset & 0xffff)]); // Write to RAM bank A
else
m_fixed[offset] = BITSWAP8(data, 7,6,0,4,3,2,1,5); // Write S data on-the-fly
m_fixed[offset] = bitswap<8>(data, 7,6,0,4,3,2,1,5); // Write S data on-the-fly
}
else if (offset >= 0xfe000/2)
{

View File

@ -689,15 +689,15 @@ int cmc_prot_device::m1_address_scramble(int address, uint16_t key)
int block = (address >> 16) & 7;
int aux = address & 0xffff;
aux ^= BITSWAP16(key,12,0,2,4,8,15,7,13,10,1,3,6,11,9,14,5);
aux = BITSWAP16(aux,
aux ^= bitswap<16>(key,12,0,2,4,8,15,7,13,10,1,3,6,11,9,14,5);
aux = bitswap<16>(aux,
p1[block][15], p1[block][14], p1[block][13], p1[block][12],
p1[block][11], p1[block][10], p1[block][9], p1[block][8],
p1[block][7], p1[block][6], p1[block][5], p1[block][4],
p1[block][3], p1[block][2], p1[block][1], p1[block][0]);
aux ^= m1_address_0_7_xor[(aux >> 8) & 0xff];
aux ^= m1_address_8_15_xor[aux & 0xff] << 8;
aux = BITSWAP16(aux, 7,15,14,6,5,13,12,4,11,3,10,2,9,1,8,0);
aux = bitswap<16>(aux, 7,15,14,6,5,13,12,4,11,3,10,2,9,1,8,0);
return (block << 16) | aux;
}

View File

@ -189,7 +189,7 @@ void cthd_prot_device::ct2k3sp_sx_decrypt( uint8_t* fixedrom, uint32_t fixedrom_
for (int i = 0; i < rom_size; i++)
{
int ofst = BITSWAP24((i & 0x1ffff), 23, 22, 21, 20, 19, 18, 17, 3,
int ofst = bitswap<24>((i & 0x1ffff), 23, 22, 21, 20, 19, 18, 17, 3,
0, 1, 4, 2, 13, 14, 16, 15,
5, 6, 11, 10, 9, 8, 7, 12 );
ofst += (i >> 17) << 17;
@ -275,7 +275,7 @@ void cthd_prot_device::patch_ct2k3sa(uint8_t* cpurom, uint32_t cpurom_size)
/* Matrimelee / Shin Gouketsuji Ichizoku Toukon (bootleg) */
#define MATRIMBLZ80(i) (i ^ (BITSWAP8(i & 0x3,4,3,1,2,0,7,6,5) << 8))
#define MATRIMBLZ80(i) (i ^ (bitswap<8>(i & 0x3,4,3,1,2,0,7,6,5) << 8))
void cthd_prot_device::matrimbl_decrypt(uint8_t* sprrom, uint32_t sprrom_size, uint8_t* audiorom, uint32_t audiorom_size)
{

View File

@ -102,7 +102,7 @@ void kof2k3bl_prot_device::pl_px_decrypt(uint8_t* cpurom, uint32_t cpurom_size)
{
memcpy(&tmp[0], &rom16[i], 0x100000);
for (int j = 0; j < 0x100000/2; j++)
rom16[i+j] = tmp[BITSWAP24(j,23,22,21,20,19,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18)];
rom16[i+j] = tmp[bitswap<24>(j,23,22,21,20,19,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18)];
}
/* patched by Altera protection chip on PCB */
@ -124,7 +124,7 @@ void kof2k3bl_prot_device::upl_px_decrypt(uint8_t* cpurom, uint32_t cpurom_size)
uint8_t *buf = cpurom + 0xd0610;
for (int i = 0; i < 0x2000 / 2; i++)
{
int ofst = (i & 0xff00) + BITSWAP8((i & 0x00ff), 7, 6, 0, 4, 3, 2, 1, 5);
int ofst = (i & 0xff00) + bitswap<8>((i & 0x00ff), 7, 6, 0, 4, 3, 2, 1, 5);
memcpy(&rom[i * 2], &buf[ofst * 2], 2);
}

View File

@ -77,7 +77,7 @@ void neoboot_prot_device::sx_decrypt(uint8_t* fixed, uint32_t fixed_size, int va
else if (value == 2)
{
for (int i = 0; i < sx_size; i++)
rom[i] = BITSWAP8(rom[i], 7, 6, 0, 4, 3, 2, 1, 5);
rom[i] = bitswap<8>(rom[i], 7, 6, 0, 4, 3, 2, 1, 5);
}
}
@ -139,7 +139,7 @@ void neoboot_prot_device::kf2k5uni_px_decrypt(uint8_t* cpurom, uint32_t cpurom_s
{
for (int j = 0; j < 0x80; j += 2)
{
int ofst = BITSWAP8(j, 0, 3, 4, 5, 6, 1, 2, 7);
int ofst = bitswap<8>(j, 0, 3, 4, 5, 6, 1, 2, 7);
memcpy(&dst[j], src + i + ofst, 2);
}
memcpy(src + i, &dst[0], 0x80);
@ -154,7 +154,7 @@ void neoboot_prot_device::kf2k5uni_sx_decrypt(uint8_t* fixedrom, uint32_t fixedr
uint8_t *srom = fixedrom;
for (int i = 0; i < 0x20000; i++)
srom[i] = BITSWAP8(srom[i], 4, 5, 6, 7, 0, 1, 2, 3);
srom[i] = bitswap<8>(srom[i], 4, 5, 6, 7, 0, 1, 2, 3);
}
void neoboot_prot_device::kf2k5uni_mx_decrypt(uint8_t* audiorom, uint32_t audiorom_size)
@ -162,7 +162,7 @@ void neoboot_prot_device::kf2k5uni_mx_decrypt(uint8_t* audiorom, uint32_t audior
uint8_t *mrom = audiorom;
for (int i = 0; i < 0x30000; i++)
mrom[i] = BITSWAP8(mrom[i], 4, 5, 6, 7, 0, 1, 2, 3);
mrom[i] = bitswap<8>(mrom[i], 4, 5, 6, 7, 0, 1, 2, 3);
}
@ -187,7 +187,7 @@ void neoboot_prot_device::lans2004_vx_decrypt(uint8_t* ymsndrom, uint32_t ymsndr
{
uint8_t *rom = ymsndrom;
for (int i = 0; i < 0xA00000; i++)
rom[i] = BITSWAP8(rom[i], 0, 1, 5, 4, 3, 2, 6, 7);
rom[i] = bitswap<8>(rom[i], 0, 1, 5, 4, 3, 2, 6, 7);
}
void neoboot_prot_device::lans2004_decrypt_68k(uint8_t* cpurom, uint32_t cpurom_size)
@ -239,7 +239,7 @@ void neoboot_prot_device::samsho5b_px_decrypt(uint8_t* cpurom, uint32_t cpurom_s
for (int i = 0; i < px_size / 2; i++)
{
int ofst = BITSWAP8((i & 0x000ff), 7, 6, 5, 4, 3, 0, 1, 2);
int ofst = bitswap<8>((i & 0x000ff), 7, 6, 5, 4, 3, 0, 1, 2);
ofst += (i & 0xfffff00);
ofst ^= 0x060005;
@ -259,7 +259,7 @@ void neoboot_prot_device::samsho5b_vx_decrypt(uint8_t* ymsndrom, uint32_t ymsndr
uint8_t *rom = ymsndrom;
for (int i = 0; i < vx_size; i++)
rom[i] = BITSWAP8(rom[i], 0, 1, 5, 4, 3, 2, 6, 7);
rom[i] = bitswap<8>(rom[i], 0, 1, 5, 4, 3, 2, 6, 7);
}
@ -381,7 +381,7 @@ void neoboot_prot_device::svcboot_px_decrypt(uint8_t* cpurom, uint32_t cpurom_si
for (int i = 0; i < size / 2; i++)
{
int ofst = BITSWAP8((i & 0x0000ff), 7, 6, 1, 0, 3, 2, 5, 4);
int ofst = bitswap<8>((i & 0x0000ff), 7, 6, 1, 0, 3, 2, 5, 4);
ofst += (i & 0xffff00);
memcpy(&src[i * 2], &dst[ofst * 2], 0x02);
}
@ -410,7 +410,7 @@ void neoboot_prot_device::svcboot_cx_decrypt(uint8_t* sprrom, uint32_t sprrom_si
int bit1 = bitswap4_tbl[idx][1];
int bit2 = bitswap4_tbl[idx][2];
int bit3 = bitswap4_tbl[idx][3];
int ofst = BITSWAP8((i & 0x0000ff), 7, 6, 5, 4, bit3, bit2, bit1, bit0);
int ofst = bitswap<8>((i & 0x0000ff), 7, 6, 5, 4, bit3, bit2, bit1, bit0);
ofst += (i & 0xfffff00);
memcpy(&src[i * 0x80], &dst[ofst * 0x80], 0x80);
}
@ -429,7 +429,7 @@ void neoboot_prot_device::svcplus_px_decrypt(uint8_t* cpurom, uint32_t cpurom_si
memcpy(&dst[0], src, size);
for (int i = 0; i < size / 2; i++)
{
int ofst = BITSWAP24((i & 0xfffff), 0x17, 0x16, 0x15, 0x14, 0x13, 0x00, 0x01, 0x02,
int ofst = bitswap<24>((i & 0xfffff), 0x17, 0x16, 0x15, 0x14, 0x13, 0x00, 0x01, 0x02,
0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
0x07, 0x06, 0x05, 0x04, 0x03, 0x10, 0x11, 0x12);
ofst ^= 0x0f0007;
@ -478,7 +478,7 @@ void neoboot_prot_device::svcsplus_px_decrypt(uint8_t* cpurom, uint32_t cpurom_s
memcpy(&dst[0], src, size);
for (int i = 0; i < size / 2; i++)
{
int ofst = BITSWAP16((i & 0x007fff), 0x0f, 0x00, 0x08, 0x09, 0x0b, 0x0a, 0x0c, 0x0d,
int ofst = bitswap<16>((i & 0x007fff), 0x0f, 0x00, 0x08, 0x09, 0x0b, 0x0a, 0x0c, 0x0d,
0x04, 0x03, 0x01, 0x07, 0x06, 0x02, 0x05, 0x0e);
ofst += (i & 0x078000);
@ -524,7 +524,7 @@ void neoboot_prot_device::kof2002b_gfx_decrypt(uint8_t *src, int size)
for (int j = 0; j < 0x200; j++)
{
int n = (j & 0x38) >> 3;
int ofst = BITSWAP16(j, 15, 14, 13, 12, 11, 10, 9, t[n][0], t[n][1], t[n][2], 5, 4, 3, t[n][3], t[n][4], t[n][5]);
int ofst = bitswap<16>(j, 15, 14, 13, 12, 11, 10, 9, t[n][0], t[n][1], t[n][2], 5, 4, 3, t[n][3], t[n][4], t[n][5]);
memcpy(src + i + ofst * 128, &dst[j * 128], 128);
}
}
@ -544,7 +544,7 @@ void neoboot_prot_device::kf2k2mp_decrypt(uint8_t* cpurom, uint32_t cpurom_size)
{
for (int j = 0; j < 0x80 / 2; j++)
{
int ofst = BITSWAP8( j, 6, 7, 2, 3, 4, 5, 0, 1 );
int ofst = bitswap<8>( j, 6, 7, 2, 3, 4, 5, 0, 1 );
memcpy(dst + j * 2, src + i + ofst * 2, 2);
}
memcpy(src + i, dst, 0x80);
@ -580,7 +580,7 @@ void neoboot_prot_device::kof10th_decrypt(uint8_t* cpurom, uint32_t cpurom_size)
for (int i = 0; i < 0x900000; i++)
{
int j = BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12,11,2,9,8,7,1,5,4,3,10,6,0);
int j = bitswap<24>(i,23,22,21,20,19,18,17,16,15,14,13,12,11,2,9,8,7,1,5,4,3,10,6,0);
src[j] = dst[i];
}

View File

@ -82,7 +82,7 @@ void pcm2_prot_device::swap(uint8_t* ymrom, uint32_t ymsize, int value)
for (int i = 0; i < 0x1000000; i++)
{
j = BITSWAP24(i,23,22,21,20,19,18,17,0,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,16);
j = bitswap<24>(i,23,22,21,20,19,18,17,0,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,16);
j ^= addrs[value][1];
d = ((i + addrs[value][0]) & 0xffffff);
src[j] = buf[d] ^ xordata[value][j & 0x7];

View File

@ -112,7 +112,7 @@ void pvc_prot_device::mslug5_decrypt_68k(uint8_t* rom, uint32_t size)
for (int i = 0x100000; i < 0x0800000; i += 4)
{
uint16_t rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)] << 8;
rom16 = BITSWAP16(rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0);
rom16 = bitswap<16>(rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0);
rom[BYTE_XOR_LE(i+1)] = rom16 & 0xff;
rom[BYTE_XOR_LE(i+2)] = rom16 >> 8;
}
@ -120,12 +120,12 @@ void pvc_prot_device::mslug5_decrypt_68k(uint8_t* rom, uint32_t size)
memcpy(&buf[0], rom, rom_size);
for (int i = 0; i < 0x0100000 / 0x10000; i++)
{
int ofst = (i & 0xf0) + BITSWAP8((i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2);
int ofst = (i & 0xf0) + bitswap<8>((i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2);
memcpy(&rom[i * 0x10000], &buf[ofst * 0x10000], 0x10000);
}
for (int i = 0x100000; i < 0x800000; i += 0x100)
{
int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00700) + (BITSWAP8(((i & 0x0ff000) >> 12), 5, 4, 7, 6, 1, 0, 3, 2) << 12);
int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00700) + (bitswap<8>(((i & 0x0ff000) >> 12), 5, 4, 7, 6, 1, 0, 3, 2) << 12);
memcpy(&rom[i], &buf[ofst], 0x100);
}
@ -151,7 +151,7 @@ void pvc_prot_device::svc_px_decrypt(uint8_t* rom, uint32_t size)
for (int i = 0x100000; i < 0x0800000; i += 4)
{
uint16_t rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)] << 8;
rom16 = BITSWAP16(rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0);
rom16 = bitswap<16>(rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0);
rom[BYTE_XOR_LE(i+1)] = rom16 & 0xff;
rom[BYTE_XOR_LE(i+2)] = rom16 >> 8;
}
@ -159,13 +159,13 @@ void pvc_prot_device::svc_px_decrypt(uint8_t* rom, uint32_t size)
memcpy(&buf[0], rom, rom_size);
for (int i = 0; i < 0x0100000 / 0x10000; i++)
{
int ofst = (i & 0xf0) + BITSWAP8((i & 0x0f), 7, 6, 5, 4, 2, 3, 0, 1);
int ofst = (i & 0xf0) + bitswap<8>((i & 0x0f), 7, 6, 5, 4, 2, 3, 0, 1);
memcpy(&rom[i * 0x10000], &buf[ofst * 0x10000], 0x10000);
}
for (int i = 0x100000; i < 0x800000; i += 0x100)
{
int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00a00) + (BITSWAP8(((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2) << 12);
int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00a00) + (bitswap<8>(((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2) << 12);
memcpy(&rom[i], &buf[ofst], 0x100);
}
memcpy(&buf[0], rom, rom_size );
@ -189,20 +189,20 @@ void pvc_prot_device::kf2k3pcb_decrypt_68k(uint8_t* rom, uint32_t size)
for (int i = 0x100000; i < 0x800000; i += 4)
{
uint16_t rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)] << 8;
rom16 = BITSWAP16(rom16, 15, 14, 13, 12, 4, 5, 6, 7, 8, 9, 10, 11, 3, 2, 1, 0);
rom16 = bitswap<16>(rom16, 15, 14, 13, 12, 4, 5, 6, 7, 8, 9, 10, 11, 3, 2, 1, 0);
rom[BYTE_XOR_LE(i+1)] = rom16 & 0xff;
rom[BYTE_XOR_LE(i+2)] = rom16 >> 8;
}
for (int i = 0; i < 0x0100000 / 0x10000; i++)
{
int ofst = (i & 0xf0) + BITSWAP8((i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2);
int ofst = (i & 0xf0) + bitswap<8>((i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2);
memcpy(&buf[i * 0x10000], &rom[ofst * 0x10000], 0x10000);
}
for (int i = 0x100000; i < 0x900000; i += 0x100)
{
int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00300) + (BITSWAP8(((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2) << 12);
int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00300) + (bitswap<8>(((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2) << 12);
memcpy(&buf[i], &rom[ofst], 0x100);
}
memcpy(&rom[0x000000], &buf[0x000000], 0x100000);
@ -230,20 +230,20 @@ void pvc_prot_device::kof2003_decrypt_68k(uint8_t* rom, uint32_t size)
for (int i = 0x100000; i < 0x800000; i += 4)
{
uint16_t rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)] << 8;
rom16 = BITSWAP16(rom16, 15, 14, 13, 12, 5, 4, 7, 6, 9, 8, 11, 10, 3, 2, 1, 0);
rom16 = bitswap<16>(rom16, 15, 14, 13, 12, 5, 4, 7, 6, 9, 8, 11, 10, 3, 2, 1, 0);
rom[BYTE_XOR_LE(i+1)] = rom16 & 0xff;
rom[BYTE_XOR_LE(i+2)] = rom16 >> 8;
}
for (int i = 0; i < 0x0100000 / 0x10000; i++)
{
int ofst = (i & 0xf0) + BITSWAP8((i & 0x0f), 7, 6, 5, 4, 0, 1, 2, 3);
int ofst = (i & 0xf0) + bitswap<8>((i & 0x0f), 7, 6, 5, 4, 0, 1, 2, 3);
memcpy(&buf[i * 0x10000], &rom[ofst * 0x10000], 0x10000);
}
for (int i = 0x100000; i < 0x900000; i += 0x100)
{
int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00800) + (BITSWAP8(((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2) << 12);
int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00800) + (bitswap<8>(((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2) << 12);
memcpy(&buf[i], &rom[ofst], 0x100);
}
memcpy(&rom[0x000000], &buf[0x000000], 0x100000);
@ -271,19 +271,19 @@ void pvc_prot_device::kof2003h_decrypt_68k(uint8_t* rom, uint32_t size)
for (int i = 0x100000; i < 0x800000; i += 4)
{
uint16_t rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)] << 8;
rom16 = BITSWAP16(rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0);
rom16 = bitswap<16>(rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0);
rom[BYTE_XOR_LE(i+1)] = rom16 & 0xff;
rom[BYTE_XOR_LE(i+2)] = rom16 >> 8;
}
for (int i = 0; i < 0x0100000 / 0x10000; i++)
{
int ofst = (i & 0xf0) + BITSWAP8((i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2);
int ofst = (i & 0xf0) + bitswap<8>((i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2);
memcpy(&buf[i * 0x10000], &rom[ofst * 0x10000], 0x10000);
}
for (int i = 0x100000; i < 0x900000; i += 0x100)
{
int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00400) + (BITSWAP8(((i & 0x0ff000) >> 12), 6, 7, 4, 5, 0, 1, 2, 3) << 12);
int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00400) + (bitswap<8>(((i & 0x0ff000) >> 12), 6, 7, 4, 5, 0, 1, 2, 3) << 12);
memcpy(&buf[i], &rom[ofst], 0x100);
}
memcpy(&rom[0x000000], &buf[0x000000], 0x100000);

View File

@ -398,7 +398,7 @@ void sma_prot_device::kof99_decrypt_68k(uint8_t* base)
// swap data lines on the whole ROMs
for (int i = 0; i < 0x800000/2; i++)
rom[i] = BITSWAP16(rom[i],13,7,3,0,9,4,5,6,1,12,8,14,10,11,2,15);
rom[i] = bitswap<16>(rom[i],13,7,3,0,9,4,5,6,1,12,8,14,10,11,2,15);
// swap address lines for the banked part
for (int i = 0; i < 0x600000/2; i += 0x800/2)
@ -406,13 +406,13 @@ void sma_prot_device::kof99_decrypt_68k(uint8_t* base)
uint16_t buffer[0x800/2];
memcpy(buffer, &rom[i], 0x800);
for (int j = 0; j < 0x800/2; j++)
rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,14,13,12,11,10,6,2,4,9,8,3,1,7,0,5)];
rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,14,13,12,11,10,6,2,4,9,8,3,1,7,0,5)];
}
// swap address lines & relocate fixed part
rom = (uint16_t *)base;
for (int i = 0; i < 0x0c0000/2; i++)
rom[i] = rom[0x700000/2 + BITSWAP24(i,23,22,21,20,19,18,11,6,14,17,16,5,8,10,12,0,4,3,2,7,9,15,13,1)];
rom[i] = rom[0x700000/2 + bitswap<24>(i,23,22,21,20,19,18,11,6,14,17,16,5,8,10,12,0,4,3,2,7,9,15,13,1)];
}
@ -423,12 +423,12 @@ void sma_prot_device::garou_decrypt_68k(uint8_t* base)
// swap data lines on the whole ROMs
for (int i = 0; i < 0x800000/2; i++)
rom[i] = BITSWAP16(rom[i],13,12,14,10,8,2,3,1,5,9,11,4,15,0,6,7);
rom[i] = bitswap<16>(rom[i],13,12,14,10,8,2,3,1,5,9,11,4,15,0,6,7);
// swap address lines & relocate fixed part
rom = (uint16_t *)base;
for (int i = 0; i < 0x0c0000/2; i++)
rom[i] = rom[0x710000/2 + BITSWAP24(i,23,22,21,20,19,18,4,5,16,14,7,9,6,13,17,15,3,1,2,12,11,8,10,0)];
rom[i] = rom[0x710000/2 + bitswap<24>(i,23,22,21,20,19,18,4,5,16,14,7,9,6,13,17,15,3,1,2,12,11,8,10,0)];
// swap address lines for the banked part
rom = (uint16_t *)(base + 0x100000);
@ -437,7 +437,7 @@ void sma_prot_device::garou_decrypt_68k(uint8_t* base)
uint16_t buffer[0x8000/2];
memcpy(buffer, &rom[i], 0x8000);
for (int j = 0; j < 0x8000/2; j++)
rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,14,9,4,8,3,13,6,2,7,0,12,1,11,10,5)];
rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,14,9,4,8,3,13,6,2,7,0,12,1,11,10,5)];
}
}
@ -449,12 +449,12 @@ void sma_prot_device::garouh_decrypt_68k(uint8_t* base)
// swap data lines on the whole ROMs
for (int i = 0; i < 0x800000/2; i++)
rom[i] = BITSWAP16(rom[i],14,5,1,11,7,4,10,15,3,12,8,13,0,2,9,6);
rom[i] = bitswap<16>(rom[i],14,5,1,11,7,4,10,15,3,12,8,13,0,2,9,6);
// swap address lines & relocate fixed part
rom = (uint16_t *)base;
for (int i = 0; i < 0x0c0000/2; i++)
rom[i] = rom[0x7f8000/2 + BITSWAP24(i,23,22,21,20,19,18,5,16,11,2,6,7,17,3,12,8,14,4,0,9,1,10,15,13)];
rom[i] = rom[0x7f8000/2 + bitswap<24>(i,23,22,21,20,19,18,5,16,11,2,6,7,17,3,12,8,14,4,0,9,1,10,15,13)];
// swap address lines for the banked part
rom = (uint16_t *)(base + 0x100000);
@ -463,7 +463,7 @@ void sma_prot_device::garouh_decrypt_68k(uint8_t* base)
uint16_t buffer[0x8000/2];
memcpy(buffer, &rom[i], 0x8000);
for (int j = 0; j < 0x8000/2; j++)
rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,14,12,8,1,7,11,3,13,10,6,9,5,4,0,2)];
rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,14,12,8,1,7,11,3,13,10,6,9,5,4,0,2)];
}
}
@ -475,12 +475,12 @@ void sma_prot_device::mslug3_decrypt_68k(uint8_t* base)
// swap data lines on the whole ROMs
for (int i = 0; i < 0x800000/2; i++)
rom[i] = BITSWAP16(rom[i],4,11,14,3,1,13,0,7,2,8,12,15,10,9,5,6);
rom[i] = bitswap<16>(rom[i],4,11,14,3,1,13,0,7,2,8,12,15,10,9,5,6);
// swap address lines & relocate fixed part
rom = (uint16_t *)base;
for (int i = 0; i < 0x0c0000/2; i++)
rom[i] = rom[0x5d0000/2 + BITSWAP24(i,23,22,21,20,19,18,15,2,1,13,3,0,9,6,16,4,11,5,7,12,17,14,10,8)];
rom[i] = rom[0x5d0000/2 + bitswap<24>(i,23,22,21,20,19,18,15,2,1,13,3,0,9,6,16,4,11,5,7,12,17,14,10,8)];
// swap address lines for the banked part
rom = (uint16_t *)(base + 0x100000);
@ -489,7 +489,7 @@ void sma_prot_device::mslug3_decrypt_68k(uint8_t* base)
uint16_t buffer[0x10000/2];
memcpy(buffer, &rom[i], 0x10000);
for (int j = 0; j < 0x10000/2; j++)
rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,2,11,0,14,6,4,13,8,9,3,10,7,5,12,1)];
rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,2,11,0,14,6,4,13,8,9,3,10,7,5,12,1)];
}
}
@ -501,7 +501,7 @@ void sma_prot_device::kof2000_decrypt_68k(uint8_t* base)
// swap data lines on the whole ROMs
for (int i = 0; i < 0x800000/2; i++)
rom[i] = BITSWAP16(rom[i],12,8,11,3,15,14,7,0,10,13,6,5,9,2,1,4);
rom[i] = bitswap<16>(rom[i],12,8,11,3,15,14,7,0,10,13,6,5,9,2,1,4);
// swap address lines for the banked part
for (int i = 0; i < 0x63a000/2; i += 0x800/2)
@ -509,11 +509,11 @@ void sma_prot_device::kof2000_decrypt_68k(uint8_t* base)
uint16_t buffer[0x800/2];
memcpy(buffer, &rom[i], 0x800);
for (int j = 0; j < 0x800/2; j++)
rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,14,13,12,11,10,4,1,3,8,6,2,7,0,9,5)];
rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,14,13,12,11,10,4,1,3,8,6,2,7,0,9,5)];
}
// swap address lines & relocate fixed part
rom = (uint16_t *)base;
for (int i = 0; i < 0x0c0000/2; i++)
rom[i] = rom[0x73a000/2 + BITSWAP24(i,23,22,21,20,19,18,8,4,15,13,3,14,16,2,6,17,7,12,10,0,5,11,1,9)];
rom[i] = rom[0x73a000/2 + bitswap<24>(i,23,22,21,20,19,18,8,4,15,13,3,14,16,2,6,17,7,12,10,0,5,11,1,9)];
}

View File

@ -36,7 +36,7 @@ READ16_MEMBER( neogeo_sbp_cart_device::protection_r )
{
uint16_t* rom = (get_rom_size()) ? get_rom_base() : get_region_rom_base();
uint16_t origdata = rom[offset + (0x200/2)];
uint16_t data = BITSWAP16(origdata, 11,10,9,8,15,14,13,12,3,2,1,0,7,6,5,4);
uint16_t data = bitswap<16>(origdata, 11,10,9,8,15,14,13,12,3,2,1,0,7,6,5,4);
int realoffset = 0x200 + (offset * 2);
logerror("sbp_lowerrom_r offset %08x data %04x\n", realoffset, data);

View File

@ -296,7 +296,7 @@ READ8_MEMBER(nes_jy_typea_device::read_m)
inline uint8_t nes_jy_typea_device::unscramble(uint8_t bank)
{
return BITSWAP8(bank & 0x7f,7,0,1,2,3,4,5,6);
return bitswap<8>(bank & 0x7f,7,0,1,2,3,4,5,6);
}
void nes_jy_typea_device::update_prg()

View File

@ -2565,7 +2565,7 @@ void nes_a9746_device::pcb_reset()
void nes_a9746_device::update_banks(uint8_t value)
{
uint8_t bank = BITSWAP8(value & 0x3c,7,6,0,1,2,3,4,5);
uint8_t bank = bitswap<8>(value & 0x3c,7,6,0,1,2,3,4,5);
switch (m_reg[0])
{

View File

@ -929,7 +929,7 @@ READ8_MEMBER(nes_waixing_sh2_device::chr_r)
void nes_waixing_sec_device::prg_cb(int start, int bank)
{
if (m_reg)
bank = BITSWAP8(bank & 0x1f,7,6,5,2,1,3,4,0);
bank = bitswap<8>(bank & 0x1f,7,6,5,2,1,3,4,0);
prg8_x(start, bank);
}
@ -937,7 +937,7 @@ void nes_waixing_sec_device::prg_cb(int start, int bank)
void nes_waixing_sec_device::chr_cb(int start, int bank, int source)
{
if (m_reg)
bank = BITSWAP8(bank, 5,4,2,6,7,3,1,0);
bank = bitswap<8>(bank, 5,4,2,6,7,3,1,0);
chr1_x(start, bank, source);
}

View File

@ -257,7 +257,7 @@ WRITE32_MEMBER( nubus_spec8s3_device::spec8s3_w )
if (m_count == 3)
{
int actual_color = BITSWAP8(m_clutoffs, 0, 1, 2, 3, 4, 5, 6, 7);
int actual_color = bitswap<8>(m_clutoffs, 0, 1, 2, 3, 4, 5, 6, 7);
// printf("RAMDAC: color %d = %02x %02x %02x (PC=%x)\n", actual_color, m_colors[0], m_colors[1], m_colors[2], space.device().safe_pc() );
m_palette[actual_color] = rgb_t(m_colors[0], m_colors[1], m_colors[2]);

View File

@ -272,7 +272,7 @@ WRITE32_MEMBER( nubus_procolor816_device::procolor816_w )
if (mem_mask == 0x00ff0000)
{
// printf("%08x to DAC control (PC=%x)\n", data, space.device().safe_pc());
m_clutoffs = BITSWAP8((data>>16)&0xff, 0, 1, 2, 3, 4, 5, 6, 7);
m_clutoffs = bitswap<8>((data>>16)&0xff, 0, 1, 2, 3, 4, 5, 6, 7);
}
else if (mem_mask == 0x000000ff)
{

View File

@ -345,7 +345,7 @@ uint8_t s100_wunderbus_device::s100_sinp_r(address_space &space, offs_t offset)
*/
data = BITSWAP8(m_10a->read(),0,1,2,3,4,5,6,7) & 0xfc;
data = bitswap<8>(m_10a->read(),0,1,2,3,4,5,6,7) & 0xfc;
break;
case 2: // R.T. Clock IN/RESET CLK. Int.

View File

@ -156,7 +156,7 @@ image_init_result sat_cart_slot_device::call_load()
// fix endianness....
for (int i = 0; i < len/4; i ++)
ROM[i] = BITSWAP32(ROM[i],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24);
ROM[i] = bitswap<32>(ROM[i],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24);
// {
// uint8_t tempa = ROM[i+0];
// uint8_t tempb = ROM[i+1];

View File

@ -871,7 +871,7 @@ READ8_MEMBER(sega8_janggun_device::read_cart)
if (m_rom_bank_base[bank] < 0x80)
return m_rom[(m_rom_bank_base[bank] & 0x3f) * 0x2000 + (offset & 0x1fff)];
else
return BITSWAP8(m_rom[(m_rom_bank_base[bank] & 0x3f) * 0x2000 + (offset & 0x1fff)], 0, 1, 2, 3, 4, 5, 6, 7);
return bitswap<8>(m_rom[(m_rom_bank_base[bank] & 0x3f) * 0x2000 + (offset & 0x1fff)], 0, 1, 2, 3, 4, 5, 6, 7);
}

View File

@ -291,7 +291,7 @@ WRITE8_MEMBER( sns_rom_obc1_device::chip_write )
// Address range for read/write depends on the game (check snes.xml)
READ8_MEMBER( sns_rom_pokemon_device::chip_read )
{
return BITSWAP8(m_latch,0,6,7,1,2,3,4,5);
return bitswap<8>(m_latch,0,6,7,1,2,3,4,5);
}
WRITE8_MEMBER( sns_rom_pokemon_device::chip_write )
@ -488,7 +488,7 @@ WRITE8_MEMBER( sns_rom_20col_device::chip_write )
READ8_MEMBER( sns_rom_banana_device::chip_read )
{
return BITSWAP8(m_latch[0xf],0,6,7,1,2,3,4,5);
return bitswap<8>(m_latch[0xf],0,6,7,1,2,3,4,5);
}
WRITE8_MEMBER( sns_rom_banana_device::chip_write )
@ -499,7 +499,7 @@ WRITE8_MEMBER( sns_rom_banana_device::chip_write )
READ8_MEMBER( sns_rom_bugs_device::chip_read )
{
return BITSWAP8(m_latch[offset & 0xff],0,6,7,1,2,3,4,5);
return bitswap<8>(m_latch[offset & 0xff],0,6,7,1,2,3,4,5);
}
WRITE8_MEMBER( sns_rom_bugs_device::chip_write )

View File

@ -83,7 +83,7 @@ void snes_pachinko_device::device_reset()
void snes_pachinko_device::port_poll()
{
uint8_t dial = BITSWAP8(m_dial->read() ^ 0xff,7,6,5,4,3,2,1,0);
uint8_t dial = bitswap<8>(m_dial->read() ^ 0xff,7,6,5,4,3,2,1,0);
m_latch = m_button->read() | (dial << 25) | 0xee7000; // add ID
}

View File

@ -160,10 +160,10 @@ READ8_MEMBER(dpc_device::read)
data = m_df[data_fetcher].flag ? display_data : 0x00;
break;
case 0x18: // display data AND'd w/flag, nibbles swapped
data = m_df[data_fetcher].flag ? BITSWAP8(display_data,3,2,1,0,7,6,5,4) : 0x00;
data = m_df[data_fetcher].flag ? bitswap<8>(display_data,3,2,1,0,7,6,5,4) : 0x00;
break;
case 0x20: // display data AND'd w/flag, byte reversed
data = m_df[data_fetcher].flag ? BITSWAP8(display_data,0,1,2,3,4,5,6,7) : 0x00;
data = m_df[data_fetcher].flag ? bitswap<8>(display_data,0,1,2,3,4,5,6,7) : 0x00;
break;
case 0x28: // display data AND'd w/flag, rotated right
data = m_df[data_fetcher].flag ? (display_data >> 1) : 0x00;

View File

@ -620,7 +620,7 @@ void hmcs40_cpu_device::execute_run()
debugger_instruction_hook(this, m_pc);
m_icount--;
m_op = m_program->read_word(m_pc) & 0x3ff;
m_i = BITSWAP8(m_op,7,6,5,4,0,1,2,3) & 0xf; // reversed bit-order for 4-bit immediate param (except for XAMR)
m_i = bitswap<8>(m_op,7,6,5,4,0,1,2,3) & 0xf; // reversed bit-order for 4-bit immediate param (except for XAMR)
increment_pc();
// handle opcode

View File

@ -181,7 +181,7 @@ offs_t hmcs40_disassembler::disassemble(std::ostream &stream, offs_t pc, const d
// reverse bits
if (bits < 0)
{
param = BITSWAP8(param,0,1,2,3,4,5,6,7);
param = bitswap<8>(param,0,1,2,3,4,5,6,7);
param >>= (8 + bits);
bits = -bits;
}

View File

@ -669,13 +669,13 @@ void hmcs40_cpu_device::op_p()
if (o & 0x100)
{
// B3 B2 B1 B0 A0 A1 A2 A3
m_a = BITSWAP8(o,7,6,5,4,0,1,2,3) & 0xf;
m_a = bitswap<8>(o,7,6,5,4,0,1,2,3) & 0xf;
m_b = o >> 4 & 0xf;
}
if (o & 0x200)
{
// R20 R21 R22 R23 R30 R31 R32 R33
o = BITSWAP8(o,0,1,2,3,4,5,6,7);
o = bitswap<8>(o,0,1,2,3,4,5,6,7);
write_r(2, o & 0xf);
write_r(3, o >> 4 & 0xf);
}

View File

@ -110,7 +110,7 @@ void tms0970_cpu_device::device_reset()
if (imask & 0x40 && (imask & 0x20) == 0)
msel = (op & 0xf) | (op >> 1 & 0x10);
msel = BITSWAP8(msel,7,6,5,0,1,2,3,4); // lines are reversed
msel = bitswap<8>(msel,7,6,5,0,1,2,3,4); // lines are reversed
u32 mmask = m_mpla->read(msel);
mmask ^= 0x09fe; // invert active-negative

View File

@ -110,7 +110,7 @@ u32 tms0980_cpu_device::decode_fixed(u16 op)
u32 tms0980_cpu_device::decode_micro(u8 sel)
{
u32 decode = 0;
sel = BITSWAP8(sel,7,6,0,1,2,3,4,5); // lines are reversed
sel = bitswap<8>(sel,7,6,0,1,2,3,4,5); // lines are reversed
u32 mask = m_mpla->read(sel);
mask ^= 0x43fc3; // invert active-negative
@ -175,7 +175,7 @@ void tms0980_cpu_device::read_opcode()
{
debugger_instruction_hook(this, m_rom_address);
m_opcode = m_program->read_word(m_rom_address) & 0x1ff;
m_c4 = BITSWAP8(m_opcode,7,6,5,4,0,1,2,3) & 0xf; // opcode operand is bitswapped for most opcodes
m_c4 = bitswap<8>(m_opcode,7,6,5,4,0,1,2,3) & 0xf; // opcode operand is bitswapped for most opcodes
m_fixed = m_fixed_decode[m_opcode];
m_micro = read_micro();

View File

@ -294,7 +294,7 @@ void tms1k_base_device::read_opcode()
{
debugger_instruction_hook(this, m_rom_address);
m_opcode = m_program->read_byte(m_rom_address);
m_c4 = BITSWAP8(m_opcode,7,6,5,4,0,1,2,3) & 0xf; // opcode operand is bitswapped for most opcodes
m_c4 = bitswap<8>(m_opcode,7,6,5,4,0,1,2,3) & 0xf; // opcode operand is bitswapped for most opcodes
m_fixed = m_fixed_decode[m_opcode];
m_micro = m_micro_decode[m_opcode];

View File

@ -67,7 +67,7 @@ u32 tp0320_cpu_device::decode_micro(u8 sel)
{
u32 decode = 0;
sel = BITSWAP8(sel,7,6,0,1,2,3,4,5); // lines are reversed
sel = bitswap<8>(sel,7,6,0,1,2,3,4,5); // lines are reversed
u32 mask = m_mpla->read(sel);
mask ^= 0x0bff0; // invert active-negative

View File

@ -398,7 +398,7 @@ void necdsp_device::exec_op(uint32_t opcode) {
case 9: regs.idb = regs.dr; break;
case 10: regs.idb = regs.sr; break;
case 11: regs.idb = regs.si; break; //MSB = first bit in from serial, 'natural' SI register order
case 12: regs.idb = BITSWAP16(regs.si, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); break; //LSB = first bit in from serial, 'reversed' SI register order
case 12: regs.idb = bitswap<16>(regs.si, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); break; //LSB = first bit in from serial, 'reversed' SI register order
case 13: regs.idb = regs.k; break;
case 14: regs.idb = regs.l; break;
case 15: regs.idb = dataRAM[regs.dp]; break;
@ -586,7 +586,7 @@ void necdsp_device::exec_ld(uint32_t opcode) {
m_out_p0_cb(regs.sr.p0);
m_out_p1_cb(regs.sr.p1);
break;
case 8: regs.so = BITSWAP16(id, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); break; //LSB first output, output tapped at bit 15 shifting left
case 8: regs.so = bitswap<16>(id, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); break; //LSB first output, output tapped at bit 15 shifting left
case 9: regs.so = id; break; //MSB first output, output tapped at bit 15 shifting left
case 10: regs.k = id; break;
case 11: regs.k = id; regs.l = m_data->read_word(regs.rp); break;

View File

@ -1007,9 +1007,9 @@ void eeprom_serial_x24c44_device::handle_event(eeprom_event event)
if (bit_index % m_data_bits == 0 && (bit_index == 0 || m_streaming_enabled)){
m_shift_register=m_ram_data[m_address];
//m_shift_register=BITSWAP16(m_shift_register,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
//m_shift_register=BITSWAP16(m_shift_register,7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8);
m_shift_register= BITSWAP16(m_shift_register,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
//m_shift_register=bitswap<16>(m_shift_register,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
//m_shift_register=bitswap<16>(m_shift_register,7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8);
m_shift_register= bitswap<16>(m_shift_register,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
m_shift_register=m_shift_register<<16;
@ -1046,9 +1046,9 @@ void eeprom_serial_x24c44_device::handle_event(eeprom_event event)
m_shift_register = (m_shift_register << 1) | m_di_state;
if (++m_bits_accum == m_data_bits)
{
//m_shift_register=BITSWAP16(m_shift_register, 0, 1, 2, 3, 4, 5,6,7, 8, 9,10,11,12,13,14,15);
//m_shift_register=BITSWAP16(m_shift_register, 7, 6, 5, 4, 3, 2,1,0,15,14,13,12,11,10, 9, 8);
m_shift_register=BITSWAP16(m_shift_register,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
//m_shift_register=bitswap<16>(m_shift_register, 0, 1, 2, 3, 4, 5,6,7, 8, 9,10,11,12,13,14,15);
//m_shift_register=bitswap<16>(m_shift_register, 7, 6, 5, 4, 3, 2,1,0,15,14,13,12,11,10, 9, 8);
m_shift_register=bitswap<16>(m_shift_register,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
m_ram_data[m_address]=m_shift_register;
LOG1("write to RAM addr=%02X data=%04X\n",m_address,m_shift_register);

View File

@ -236,7 +236,7 @@ void pioneer_pr8210_device::control_w(uint8_t data)
{
// data is stored to the PIA in bit-reverse order
uint8_t newcommand = (m_accumulator >> 2) & 0x1f;
m_pia.porta = BITSWAP8(newcommand, 0,1,2,3,4,5,6,7);
m_pia.porta = bitswap<8>(newcommand, 0,1,2,3,4,5,6,7);
// the MCU logic requires a 0 to execute many commands; however, nobody
// consistently sends a 0, whereas they do tend to send duplicate commands...

View File

@ -180,7 +180,7 @@ void rocvfd_device::device_reset()
///////////////////////////////////////////////////////////////////////////
uint32_t rocvfd_device::set_display(uint32_t segin)
{
return BITSWAP32(segin, 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,11,9,15,13,12,8,10,14,7,6,5,4,3,2,1,0);
return bitswap<32>(segin, 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,11,9,15,13,12,8,10,14,7,6,5,4,3,2,1,0);
}

View File

@ -282,7 +282,7 @@ void sdlc_logger_device::log_frame(bool partial) const
fcs |= std::uint16_t(m_buffer[frame_bytes - 1]) << (8 - residual_bits);
if (residual_bits)
fcs |= (std::uint16_t(m_buffer[frame_bytes]) & ((1U << residual_bits) - 1U)) << (16 - residual_bits);
fcs = ~BITSWAP16(fcs, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
fcs = ~bitswap<16>(fcs, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
util::stream_format(msg, " FCS=%04X", fcs);
if (!is_frame_check_good())
util::stream_format(msg, " (expected %04X)", m_expected_fcs);

View File

@ -100,7 +100,7 @@ int saturn_state::get_track_index(uint32_t fad)
int saturn_state::sega_cdrom_get_adr_control(cdrom_file *file, int track)
{
return BITSWAP8(cdrom_get_adr_control(file, cur_track),3,2,1,0,7,6,5,4);
return bitswap<8>(cdrom_get_adr_control(file, cur_track),3,2,1,0,7,6,5,4);
}
void saturn_state::cr_standard_return(uint16_t cur_status)

View File

@ -182,7 +182,7 @@ void tms6100_device::handle_command(u8 cmd)
// M58819S reads serial data reversed
if (m_reverse_bits)
m_sa = BITSWAP8(m_sa,0,1,2,3,4,5,6,7);
m_sa = bitswap<8>(m_sa,0,1,2,3,4,5,6,7);
}
else
{

View File

@ -1128,7 +1128,7 @@ void z80sio_channel::sync_tx_sr_empty()
LOGTX("%s() Channel %c Transmit FCS '%04x' m_wr5:%02x\n", FUNCNAME, 'A' + m_index, m_tx_crc, m_wr5);
// just for fun, SDLC sends the FCS inverted in reverse bit order
uint16_t const fcs(BITSWAP16(m_tx_crc, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15));
uint16_t const fcs(bitswap<16>(m_tx_crc, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15));
tx_setup(((m_wr4 & WR4_SYNC_MODE_MASK) == WR4_SYNC_MODE_SDLC) ? ~fcs : fcs, 16, 0, false, true);
// set the underrun flag so it will send sync next time

View File

@ -87,7 +87,7 @@ void astrocade_device::device_start()
/* generate a bitswap table for the noise */
for (i = 0; i < 256; i++)
m_bitswap[i] = BITSWAP8(i, 0,1,2,3,4,5,6,7);
m_bitswap[i] = bitswap<8>(i, 0,1,2,3,4,5,6,7);
/* allocate a stream for output */
m_stream = stream_alloc(0, 1, clock());

View File

@ -1345,7 +1345,7 @@ void tmsprom_device::device_timer(emu_timer &timer, device_timer_id id, int para
if (ctrl & (1 << m_reset_bit))
m_address = 0;
m_ctl_cb((offs_t)0, BITSWAP8(ctrl,0,0,0,0,m_ctl8_bit,
m_ctl_cb((offs_t)0, bitswap<8>(ctrl,0,0,0,0,m_ctl8_bit,
m_ctl4_bit,m_ctl2_bit,m_ctl1_bit));
m_pdc_cb((ctrl >> m_pdc_bit) & 0x01);

View File

@ -213,7 +213,7 @@ void ef9340_1_device::ef9341_write( uint8_t command, uint8_t b, uint8_t data )
if ( b >= 0xa0 )
{
m_ef934x_ext_char_ram[ ( ( a & 0x80 ) << 3 ) | external_chargen_address( b, slice ) ] = BITSWAP8(m_ef9341.TA,0,1,2,3,4,5,6,7);
m_ef934x_ext_char_ram[ ( ( a & 0x80 ) << 3 ) | external_chargen_address( b, slice ) ] = bitswap<8>(m_ef9341.TA,0,1,2,3,4,5,6,7);
}
// Increment slice number

View File

@ -255,6 +255,7 @@ template <typename T, typename U, typename... V> constexpr T bitswap(T val, U b,
return (BIT(val, b) << sizeof...(c)) | bitswap(val, c...);
}
// explicit version that checks number of bit position arguments
template <unsigned B, typename T, typename... U> T bitswap(T val, U... b)
{
static_assert(sizeof...(b) == B, "wrong number of bits");
@ -262,16 +263,6 @@ template <unsigned B, typename T, typename... U> T bitswap(T val, U... b)
return bitswap(val, b...);
}
// explicit versions that check number of bit position arguments
template <typename T, typename... U> constexpr T BITSWAP8(T val, U... b) { return bitswap<8U>(val, b...); }
template <typename T, typename... U> constexpr T BITSWAP16(T val, U... b) { return bitswap<16U>(val, b...); }
template <typename T, typename... U> constexpr T BITSWAP24(T val, U... b) { return bitswap<24U>(val, b...); }
template <typename T, typename... U> constexpr T BITSWAP32(T val, U... b) { return bitswap<32U>(val, b...); }
template <typename T, typename... U> constexpr T BITSWAP40(T val, U... b) { return bitswap<40U>(val, b...); }
template <typename T, typename... U> constexpr T BITSWAP48(T val, U... b) { return bitswap<48U>(val, b...); }
template <typename T, typename... U> constexpr T BITSWAP56(T val, U... b) { return bitswap<56U>(val, b...); }
template <typename T, typename... U> constexpr T BITSWAP64(T val, U... b) { return bitswap<64U>(val, b...); }
//**************************************************************************

View File

@ -337,8 +337,8 @@ READ8_MEMBER(sei80bu_device::data_r)
if ( BIT(a,13) & ~BIT(a,6) & BIT(a,4)) src ^= 0x02;
if (~BIT(a,11) & BIT(a,9) & BIT(a,2)) src ^= 0x01;
if (BIT(a,13) & BIT(a,4)) src = BITSWAP8(src,7,6,5,4,3,2,0,1);
if (BIT(a, 8) & BIT(a,4)) src = BITSWAP8(src,7,6,5,4,2,3,1,0);
if (BIT(a,13) & BIT(a,4)) src = bitswap<8>(src,7,6,5,4,3,2,0,1);
if (BIT(a, 8) & BIT(a,4)) src = bitswap<8>(src,7,6,5,4,2,3,1,0);
return src;
}
@ -357,10 +357,10 @@ READ8_MEMBER(sei80bu_device::opcode_r)
if ( BIT(a,13) & ~BIT(a,6) & BIT(a,4)) src ^= 0x02;
if (~BIT(a,11) & BIT(a,9) & BIT(a,2)) src ^= 0x01;
if (BIT(a,13) & BIT(a,4)) src = BITSWAP8(src,7,6,5,4,3,2,0,1);
if (BIT(a, 8) & BIT(a,4)) src = BITSWAP8(src,7,6,5,4,2,3,1,0);
if (BIT(a,12) & BIT(a,9)) src = BITSWAP8(src,7,6,4,5,3,2,1,0);
if (BIT(a,11) & ~BIT(a,6)) src = BITSWAP8(src,6,7,5,4,3,2,1,0);
if (BIT(a,13) & BIT(a,4)) src = bitswap<8>(src,7,6,5,4,3,2,0,1);
if (BIT(a, 8) & BIT(a,4)) src = bitswap<8>(src,7,6,5,4,2,3,1,0);
if (BIT(a,12) & BIT(a,9)) src = bitswap<8>(src,7,6,4,5,3,2,1,0);
if (BIT(a,11) & ~BIT(a,6)) src = bitswap<8>(src,6,7,5,4,3,2,1,0);
return src;
}
@ -410,7 +410,7 @@ void seibu_adpcm_device::decrypt()
{
for (int i = 0; i < m_base.length(); i++)
{
m_base[i] = BITSWAP8(m_base[i], 7, 5, 3, 1, 6, 4, 2, 0);
m_base[i] = bitswap<8>(m_base[i], 7, 5, 3, 1, 6, 4, 2, 0);
}
}

View File

@ -116,7 +116,7 @@ WRITE8_MEMBER(midcoin24cdjuke_state::digit_w)
{
uint16_t char_data = m_charset[((data & 0x60) << 1) | (data & 0x1f)];
char_data = BITSWAP16(char_data, 13,11,9,15,14,10,12,8,7,6,5,4,3,2,1,0);
char_data = bitswap<16>(char_data, 13,11,9,15,14,10,12,8,7,6,5,4,3,2,1,0);
output().set_digit_value(offset, char_data ^ 0xffff);
}

View File

@ -1550,7 +1550,7 @@ void _39in1_state::machine_start()
for (i = 0; i < 0x80000; i += 2)
{
ROM[i] = BITSWAP8(ROM[i],7,2,5,6,0,3,1,4) ^ BITSWAP8((i>>3)&0xf, 3,2,4,1,4,4,0,4) ^ 0x90;
ROM[i] = bitswap<8>(ROM[i],7,2,5,6,0,3,1,4) ^ bitswap<8>((i>>3)&0xf, 3,2,4,1,4,4,0,4) ^ 0x90;
}
pxa255_start();
@ -1565,7 +1565,7 @@ MACHINE_START_MEMBER(_39in1_state,60in1)
{
if ((i%2)==0)
{
ROM[i] = BITSWAP8(ROM[i],5,1,4,2,0,7,6,3)^BITSWAP8(i, 6,0,4,13,0,5,3,11);
ROM[i] = bitswap<8>(ROM[i],5,1,4,2,0,7,6,3)^bitswap<8>(i, 6,0,4,13,0,5,3,11);
}
}

View File

@ -636,7 +636,7 @@ DRIVER_INIT_MEMBER(_4enraya_state, unkpacg)
// descramble rom
uint8_t *rom = memregion("maincpu")->base();
for (int i = 0x8000; i < 0xa000; i++)
rom[i] = BITSWAP8(rom[i], 7,6,5,4,3,2,0,1);
rom[i] = bitswap<8>(rom[i], 7,6,5,4,3,2,0,1);
}

View File

@ -3284,7 +3284,7 @@ DRIVER_INIT_MEMBER(_8080bw_state,attackfc)
// swap a8/a9
for (int i = 0; i < len; i++)
buffer[BITSWAP16(i, 15,14,13,12,11,10,8,9, 7,6,5,4,3,2,1,0)] = rom[i];
buffer[bitswap<16>(i, 15,14,13,12,11,10,8,9, 7,6,5,4,3,2,1,0)] = rom[i];
memcpy(rom, &buffer[0], len);
}
@ -3419,7 +3419,7 @@ DRIVER_INIT_MEMBER(_8080bw_state,invmulti)
// decrypt rom
for (int i = 0; i < len; i++)
dest[i] = BITSWAP8(src[(i & 0x100ff) | (BITSWAP8(i >> 8 & 0xff, 7,3,4,5,0,6,1,2) << 8)],0,6,5,7,4,3,1,2);
dest[i] = bitswap<8>(src[(i & 0x100ff) | (bitswap<8>(i >> 8 & 0xff, 7,3,4,5,0,6,1,2) << 8)],0,6,5,7,4,3,1,2);
membank("bank1")->configure_entries(0, 8, memregion("maincpu")->base(), 0x4000);
membank("bank1")->set_entry(0);

View File

@ -3856,13 +3856,13 @@ static void descramble_crystal( uint8_t* region, int start, int end, uint8_t ext
switch (i & 0x58)
{
case 0x00: // same as 0x08
case 0x08: x = BITSWAP8( x^0xca , 3,2,1,0,7,4,6,5 ); break;
case 0x10: x = BITSWAP8( x^0x30 , 3,0,4,6,1,5,7,2 ); break;
case 0x18: x = BITSWAP8( x^0x89 , 4,1,2,5,7,0,6,3 ); break;
case 0x40: x = BITSWAP8( x^0x14 , 6,1,4,3,2,5,0,7 ); break;
case 0x48: x = BITSWAP8( x^0x40 , 1,0,3,2,5,4,7,6 ); break;
case 0x50: x = BITSWAP8( x^0xcb , 3,2,1,0,7,6,5,4 ); break;
case 0x58: x = BITSWAP8( x^0xc0 , 2,3,6,0,5,1,7,4 ); break;
case 0x08: x = bitswap<8>( x^0xca , 3,2,1,0,7,4,6,5 ); break;
case 0x10: x = bitswap<8>( x^0x30 , 3,0,4,6,1,5,7,2 ); break;
case 0x18: x = bitswap<8>( x^0x89 , 4,1,2,5,7,0,6,3 ); break;
case 0x40: x = bitswap<8>( x^0x14 , 6,1,4,3,2,5,0,7 ); break;
case 0x48: x = bitswap<8>( x^0x40 , 1,0,3,2,5,4,7,6 ); break;
case 0x50: x = bitswap<8>( x^0xcb , 3,2,1,0,7,6,5,4 ); break;
case 0x58: x = bitswap<8>( x^0xc0 , 2,3,6,0,5,1,7,4 ); break;
}
region[i] = x ^ extra_xor;
}

View File

@ -3027,7 +3027,7 @@ DRIVER_INIT_MEMBER(aerofgt_state, kickball)
uint8_t *src = memregion( "gfx2" )->base();
for (int i = 0;i < 0x80000;i++)
{
src[i] = BITSWAP8(src[i], 7, 5, 6, 4, 3, 2, 1, 0);
src[i] = bitswap<8>(src[i], 7, 5, 6, 4, 3, 2, 1, 0);
}
}

View File

@ -601,14 +601,14 @@ DRIVER_INIT_MEMBER(airraid_state,cshootere)
m_decrypted_opcodes[A] ^= 0x02;
if (BIT(A,9) || !BIT(A,5) || BIT(A,3))
m_decrypted_opcodes[A] = BITSWAP8(m_decrypted_opcodes[A],7,6,1,4,3,2,5,0);
m_decrypted_opcodes[A] = bitswap<8>(m_decrypted_opcodes[A],7,6,1,4,3,2,5,0);
/* decode the data */
if (BIT(A,5))
rom[A] ^= 0x40;
if (BIT(A,9) || !BIT(A,5))
rom[A] = BITSWAP8(rom[A],7,6,1,4,3,2,5,0);
rom[A] = bitswap<8>(rom[A],7,6,1,4,3,2,5,0);
}
DRIVER_INIT_CALL(cshooter);

View File

@ -472,7 +472,7 @@ DRIVER_INIT_MEMBER(alesis_state,hr16)
uint8_t *orig = memregion("user1")->base();
for (i = 0; i < 0x8000; i++)
{
ROM[BITSWAP16(i,15,14,13,12,11,10,9,8,0,1,2,3,4,5,6,7)] = orig[i];
ROM[bitswap<16>(i,15,14,13,12,11,10,9,8,0,1,2,3,4,5,6,7)] = orig[i];
}
}

View File

@ -126,9 +126,9 @@ void altos5_state::setup_banks(uint8_t source)
// WPRT | template | dma bank / cpu bank
if (source == 1) // use DMA banks only if BUSACK is asserted
offs = ((BITSWAP8(m_port09, 0, 0, 0, 5, 1, 2, 7, 6) << 4) & 0x1f0) ^ 0x100;
offs = ((bitswap<8>(m_port09, 0, 0, 0, 5, 1, 2, 7, 6) << 4) & 0x1f0) ^ 0x100;
else
offs = ((BITSWAP8(m_port09, 0, 0, 0, 5, 1, 2, 4, 3) << 4) & 0x1f0) ^ 0x100;
offs = ((bitswap<8>(m_port09, 0, 0, 0, 5, 1, 2, 4, 3) << 4) & 0x1f0) ^ 0x100;
temp = offs;
if ((source == 2) || (temp != m_curr_bank))

View File

@ -1055,7 +1055,7 @@ void amaticmg_state::encf(uint8_t ciphertext, int address, uint8_t &plaintext, i
int aux = address & 0xfff;
aux = aux ^ (aux>>6);
aux = ((aux<<6) | (aux>>6)) & 0xfff;
uint8_t aux2 = BITSWAP8(aux, 9,10,4,1,6,0,7,3);
uint8_t aux2 = bitswap<8>(aux, 9,10,4,1,6,0,7,3);
aux2 ^= aux2>>4;
aux2 = (aux2<<4) | (aux2>>4);
ciphertext ^= ciphertext<<4;

View File

@ -1392,7 +1392,7 @@ DRIVER_INIT_MEMBER(ampoker2_state, rabbitpk)
for (i = start; i < size; i++)
{
rom[i] = BITSWAP8(rom[i], 1, 2, 5, 4, 3, 0, 7, 6) ^ dec_base[(i >> 2) & 0x1f];
rom[i] = bitswap<8>(rom[i], 1, 2, 5, 4, 3, 0, 7, 6) ^ dec_base[(i >> 2) & 0x1f];
}
}

View File

@ -394,12 +394,12 @@ CH3_EXA == 0X3E ; CH-3 extended address (W)
READ8_MEMBER(apc_state::apc_dma_r)
{
return m_dmac->read(space, BITSWAP8(offset,7,6,5,4,2,1,0,3), 0xff);
return m_dmac->read(space, bitswap<8>(offset,7,6,5,4,2,1,0,3), 0xff);
}
WRITE8_MEMBER(apc_state::apc_dma_w)
{
m_dmac->write(space, BITSWAP8(offset,7,6,5,4,2,1,0,3), data, 0xff);
m_dmac->write(space, bitswap<8>(offset,7,6,5,4,2,1,0,3), data, 0xff);
}
WRITE8_MEMBER(apc_state::apc_irq_ack_w)

View File

@ -743,7 +743,7 @@ void apple2e_state::machine_start()
// let's do that in the modern MAME way
for (int i=0; i<0x040000; i++)
{
m_cec_remap[i] = BITSWAP8(m_cec_ptr[i], 0, 1, 2, 3, 4, 5, 6, 7);
m_cec_remap[i] = bitswap<8>(m_cec_ptr[i], 0, 1, 2, 3, 4, 5, 6, 7);
}
// remap cec gfx1 rom

View File

@ -68,7 +68,7 @@ WRITE8_MEMBER(aquarium_state::aquarium_watchdog_w)
WRITE8_MEMBER(aquarium_state::aquarium_z80_bank_w)
{
// uses bits ---x --xx
data = BITSWAP8(data, 7, 6, 5, 2, 3, 1, 4, 0);
data = bitswap<8>(data, 7, 6, 5, 2, 3, 1, 4, 0);
//printf("aquarium bank %04x %04x\n", data, mem_mask);
// aquarium bank 0003 00ff - correct (title) 011
@ -82,7 +82,7 @@ WRITE8_MEMBER(aquarium_state::aquarium_z80_bank_w)
uint8_t aquarium_state::aquarium_snd_bitswap( uint8_t scrambled_data )
{
return BITSWAP8(scrambled_data, 0, 1, 2, 3, 4, 5, 6, 7);
return bitswap<8>(scrambled_data, 0, 1, 2, 3, 4, 5, 6, 7);
}
READ8_MEMBER(aquarium_state::aquarium_oki_r)

View File

@ -2116,12 +2116,12 @@ DRIVER_INIT_MEMBER(arkanoid_state,block2)
int srctile;
// combine these into a single swap..
srctile = BITSWAP16(tile,15,14,13,12,
srctile = bitswap<16>(tile,15,14,13,12,
11,10,9,8,
7,5,6,3,
1,2,4,0);
srctile = BITSWAP16(srctile,15,14,13,12,
srctile = bitswap<16>(srctile,15,14,13,12,
11,9,10,5,
7,6,8,4,
3,2,1,0);

View File

@ -896,7 +896,7 @@ void arcadia_amiga_state::generic_decode(const char *tag, int bit7, int bit6, in
/* only the low byte of ROMs are encrypted in these games */
for (i = 0; i < 0x20000/2; i++)
rom[i] = BITSWAP16(rom[i], 15,14,13,12,11,10,9,8, bit7,bit6,bit5,bit4,bit3,bit2,bit1,bit0);
rom[i] = bitswap<16>(rom[i], 15,14,13,12,11,10,9,8, bit7,bit6,bit5,bit4,bit3,bit2,bit1,bit0);
#if 0
{

View File

@ -453,7 +453,7 @@ READ8_MEMBER(astrof_state::afire_coin_prot_r)
READ8_MEMBER(astrof_state::tomahawk_protection_r)
{
/* flip the byte */
return BITSWAP8(*m_tomahawk_protection, 0, 1, 2, 3, 4, 5, 6, 7);
return bitswap<8>(*m_tomahawk_protection, 0, 1, 2, 3, 4, 5, 6, 7);
}

View File

@ -296,7 +296,7 @@ WRITE16_MEMBER(atarisy2_state::bankselect_w)
};*/
int banknumber = ((data >> 10) & 0x3f) ^ 0x03;
banknumber = BITSWAP16(banknumber, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 1, 0, 3, 2);
banknumber = bitswap<16>(banknumber, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 1, 0, 3, 2);
if (offset)
m_rombank2->set_entry(banknumber);

View File

@ -438,7 +438,7 @@ void get_altera10ke_eab(u8* dst, u8 *pof, int eab)
for (u32 bit = 0; bit < 4096; bit++)
{
u32 tbit = BITSWAP16(bit, 15, 14, 13, 12,
u32 tbit = bitswap<16>(bit, 15, 14, 13, 12,
9, 8, 7, 6, 5, 4, 3,
11, 10,
2, 1, 0);
@ -471,8 +471,8 @@ void atvtrack_state::machine_reset()
{
u16 lword = tdata[i * 2 + 512] | (tdata[i * 2 + 513] << 8);
u16 hword = tdata[i * 2] | (tdata[i * 2 + 1] << 8);
lword = BITSWAP16(lword, 7, 9, 0, 10, 3, 11, 4, 12, 2, 15, 1, 13, 6, 8, 5, 14);
hword = BITSWAP16(hword, 5, 10, 7, 9, 6, 13, 3, 15, 2, 11, 1, 8, 0, 12, 4, 14);
lword = bitswap<16>(lword, 7, 9, 0, 10, 3, 11, 4, 12, 2, 15, 1, 13, 6, 8, 5, 14);
hword = bitswap<16>(hword, 5, 10, 7, 9, 6, 13, 3, 15, 2, 11, 1, 8, 0, 12, 4, 14);
dst[i * 4 + 0] = lword & 0xff;
dst[i * 4 + 1] = lword >> 8;
dst[i * 4 + 2] = hword & 0xff;

View File

@ -687,7 +687,7 @@ void backfire_state::descramble_sound()
{
uint32_t addr;
addr = BITSWAP24 (x,23,22,21,0, 20,
addr = bitswap<24> (x,23,22,21,0, 20,
19,18,17,16,
15,14,13,12,
11,10,9, 8,

View File

@ -392,7 +392,7 @@ WRITE8_MEMBER(berzerk_state::magicram_w)
uint8_t shift_flop_output = (((uint16_t)m_last_shift_data << 8) | data) >> (m_magicram_control & 0x07);
if (m_magicram_control & 0x08)
shift_flop_output = BITSWAP8(shift_flop_output, 0, 1, 2, 3, 4, 5, 6, 7);
shift_flop_output = bitswap<8>(shift_flop_output, 0, 1, 2, 3, 4, 5, 6, 7);
/* collision detection - AND gate output goes to the K pin of the flip-flop,
while J is LO, therefore, it only resets, never sets */

View File

@ -217,7 +217,7 @@ WRITE8_MEMBER( beta_state::riot_pa_w )
// logerror("PA %02x\n", data);
/* display */
m_segment = BITSWAP8(data, 7, 3, 4, 1, 0, 2, 5, 6) & 0x7f;
m_segment = bitswap<8>(data, 7, 3, 4, 1, 0, 2, 5, 6) & 0x7f;
m_led_refresh_timer->adjust(attotime::from_usec(70));
/* EPROM data */

View File

@ -493,7 +493,7 @@ WRITE8_MEMBER(bfm_sc45_state::mux_output2_w)
}
else
{
uint8_t bf7segdata = BITSWAP8(data,0,7,6,5,4,3,2,1);
uint8_t bf7segdata = bitswap<8>(data,0,7,6,5,4,3,2,1);
output().set_digit_value(offset, bf7segdata);
}
}

View File

@ -482,7 +482,7 @@ u8 bigbord2_state::crt8002(u8 ac_ra, u8 ac_chr, u8 ac_attr, uint16_t ac_cnt, boo
}
break;
case 1: // external mode
gfx = BITSWAP8(ac_chr, 0,1,2,3,4,5,6,7);
gfx = bitswap<8>(ac_chr, 0,1,2,3,4,5,6,7);
break;
case 2: // thin gfx
break;

View File

@ -42,7 +42,7 @@ WRITE8_MEMBER(bking_state::bking_sndnmi_enable_w)
WRITE8_MEMBER(bking_state::bking_soundlatch_w)
{
m_soundlatch->write(space, offset, BITSWAP8(data, 0, 1, 2, 3, 4, 5, 6, 7));
m_soundlatch->write(space, offset, bitswap<8>(data, 0, 1, 2, 3, 4, 5, 6, 7));
}
WRITE8_MEMBER(bking_state::bking3_addr_l_w)

View File

@ -608,7 +608,7 @@ DRIVER_INIT_MEMBER(blktiger_state,blktigerb3)
{
int addr;
addr = BITSWAP16(i, 15,14,13,12,11,10,9,8, 3,4,5,6, 7,2,1,0);
addr = bitswap<16>(i, 15,14,13,12,11,10,9,8, 3,4,5,6, 7,2,1,0);
buffer[i] = src[addr];
}

View File

@ -860,7 +860,7 @@ DRIVER_INIT_MEMBER(bloodbro_state,weststry)
{
/* sprite roms ws25 and ws26 have 2 bits swapped
there is also an address swap but that is currently handled in the video implementation */
sprites[i] = BITSWAP8(sprites[i],7,6,4,5,3,2,1,0);
sprites[i] = bitswap<8>(sprites[i],7,6,4,5,3,2,1,0);
}
m_weststry_opl_irq = false;

View File

@ -137,7 +137,7 @@ READ8_MEMBER(bob85_state::bob85_keyboard_r)
WRITE8_MEMBER(bob85_state::bob85_7seg_w)
{
output().set_digit_value(offset, BITSWAP8( data,3,2,1,0,7,6,5,4 ));
output().set_digit_value(offset, bitswap<8>( data,3,2,1,0,7,6,5,4 ));
}
static ADDRESS_MAP_START( bob85_mem, AS_PROGRAM, 8, bob85_state )

View File

@ -97,7 +97,7 @@
READ16_MEMBER( boogwing_state::boogwing_protection_region_0_104_r )
{
int real_address = 0 + (offset *2);
int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco104->read_data( deco146_addr, mem_mask, cs );
return data;
@ -106,7 +106,7 @@ READ16_MEMBER( boogwing_state::boogwing_protection_region_0_104_r )
WRITE16_MEMBER( boogwing_state::boogwing_protection_region_0_104_w )
{
int real_address = 0 + (offset *2);
int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco104->write_data( space, deco146_addr, data, mem_mask, cs );
}

View File

@ -2007,10 +2007,10 @@ DRIVER_INIT_MEMBER(bublbobl_state,dland)
int i;
uint8_t* src = memregion("gfx1")->base();
for (i = 0; i < 0x40000; i++)
src[i] = BITSWAP8(src[i],7,6,5,4,0,1,2,3);
src[i] = bitswap<8>(src[i],7,6,5,4,0,1,2,3);
for (i = 0x40000; i < 0x80000; i++)
src[i] = BITSWAP8(src[i],7,4,5,6,3,0,1,2);
src[i] = bitswap<8>(src[i],7,4,5,6,3,0,1,2);
DRIVER_INIT_CALL(common);
}

View File

@ -885,7 +885,7 @@ TIMER_DEVICE_CALLBACK_MEMBER( by35_state::timer_as2888 )
{
m_snd_sel = m_snd_prom[offs];
// logerror("SndSel read %02x from PROM addr %02x\n",m_snd_sel, offs );
m_snd_sel = BITSWAP8(m_snd_sel,0,1,2,3,4,5,6,7);
m_snd_sel = bitswap<8>(m_snd_sel,0,1,2,3,4,5,6,7);
m_snd_tone_gen = m_snd_sel;
// logerror("SndSel=%02x, Tone=%02x, Div=%02x\n",m_snd_sel, m_snd_tone_gen, m_snd_div);

View File

@ -156,12 +156,12 @@ ADDRESS_MAP_END
READ8_MEMBER(cabal_state::cabalbl_snd2_r)
{
return BITSWAP8(m_sound_command2, 7,2,4,5,3,6,1,0);
return bitswap<8>(m_sound_command2, 7,2,4,5,3,6,1,0);
}
READ8_MEMBER(cabal_state::cabalbl_snd1_r)
{
return BITSWAP8(m_sound_command1, 7,2,4,5,3,6,1,0);
return bitswap<8>(m_sound_command1, 7,2,4,5,3,6,1,0);
}
WRITE8_MEMBER(cabal_state::cabalbl_coin_w)

View File

@ -319,9 +319,9 @@ d0 = read from bank 4 */
m_bankdata = data;
data ^= 0x8c; // make all lines active high
// do writes
m_wbyte = BITSWAP8(data, 0, 0, 0, 0, 4, 5, 6, 7) & 0x0f; // rearrange to 1,2,3,4
m_wbyte = bitswap<8>(data, 0, 0, 0, 0, 4, 5, 6, 7) & 0x0f; // rearrange to 1,2,3,4
// do reads
uint8_t rbyte = BITSWAP8(data, 0, 0, 0, 0, 0, 1, 2, 3) & 0x0f; // rearrange to 0,1,2,4
uint8_t rbyte = bitswap<8>(data, 0, 0, 0, 0, 0, 1, 2, 3) & 0x0f; // rearrange to 0,1,2,4
if (BIT(rbyte, 1))
rbyte &= 0x07; // remove 4 if 1 selected (AND gate in IC82)
//printf("%s:%X:%X:%X\n", machine().describe_context(), data, rbyte, m_wbyte);

View File

@ -5200,7 +5200,7 @@ DRIVER_INIT_MEMBER(cave_state,mazinger)
{
int i;
for (i = 0; i < len; i++)
buffer[i ^ 0xdf88] = src[BITSWAP24(i,23,22,21,20,19,9,7,3,15,4,17,14,18,2,16,5,11,8,6,13,1,10,12,0)];
buffer[i ^ 0xdf88] = src[bitswap<24>(i,23,22,21,20,19,9,7,3,15,4,17,14,18,2,16,5,11,8,6,13,1,10,12,0)];
memcpy(src, &buffer[0], len);
}
@ -5262,7 +5262,7 @@ DRIVER_INIT_MEMBER(cave_state,pwrinst2j)
{
for(i = 0; i < len/2; i++)
{
j = BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7, 2,4,6,1,5,3, 0);
j = bitswap<24>(i,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7, 2,4,6,1,5,3, 0);
if(((j & 6) == 0) || ((j & 6) == 6))
j ^= 6;
buffer[j ^ 7] = (src[i] >> 4) | (src[i] << 4);
@ -5315,7 +5315,7 @@ DRIVER_INIT_MEMBER(cave_state,sailormn)
{
int i;
for (i = 0; i < len; i++)
buffer[i ^ 0x950c4] = src[BITSWAP24(i,23,22,21,20,15,10,12,6,11,1,13,3,16,17,2,5,14,7,18,8,4,19,9,0)];
buffer[i ^ 0x950c4] = src[bitswap<24>(i,23,22,21,20,15,10,12,6,11,1,13,3,16,17,2,5,14,7,18,8,4,19,9,0)];
memcpy(src, &buffer[0], len);
}

View File

@ -167,7 +167,7 @@ uint32_t cd2650_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap
chr = m_p_videoram[mem] & 0x3f;
gfx = m_p_chargen[(BITSWAP8(chr,7,6,2,1,0,3,4,5)<<3) | ra];
gfx = m_p_chargen[(bitswap<8>(chr,7,6,2,1,0,3,4,5)<<3) | ra];
}
/* Display a scanline of a character */

View File

@ -2233,7 +2233,7 @@ DRIVER_INIT_MEMBER(centiped_state,multiped)
// descramble rom and put in maincpu region
for (int i = 0; i < 0x10000; i++)
dest[0x10000 + (i ^ (~i << 4 & 0x1000) ^ (~i >> 3 & 0x400))] = BITSWAP8(src[BITSWAP16(i,15,14,13,1,8,11,4,7,10,5,6,9,12,0,3,2)],0,2,1,3,4,5,6,7);
dest[0x10000 + (i ^ (~i << 4 & 0x1000) ^ (~i >> 3 & 0x400))] = bitswap<8>(src[bitswap<16>(i,15,14,13,1,8,11,4,7,10,5,6,9,12,0,3,2)],0,2,1,3,4,5,6,7);
// (this can be removed when prg bankswitch is implemented)
memmove(dest+0x0000, dest+0x10000, 0x8000);

View File

@ -253,7 +253,7 @@ void chessmst_state::update_display()
for(int i=0; i<4; i++)
{
if (BIT(m_digit_matrix, i))
output().set_indexed_value("digit", i, BITSWAP16(m_digit, 3,5,12,10,14,1,2,13,8,6,11,15,7,9,4,0) | (m_digit_dot << 16));
output().set_indexed_value("digit", i, bitswap<16>(m_digit, 3,5,12,10,14,1,2,13,8,6,11,15,7,9,4,0) | (m_digit_dot << 16));
}
}

View File

@ -64,7 +64,7 @@ WRITE8_MEMBER( chesstrv_state::ram_w )
WRITE8_MEMBER( chesstrv_state::display_w )
{
uint8_t seg_data = BITSWAP8(data,0,1,2,3,4,5,6,7);
uint8_t seg_data = bitswap<8>(data,0,1,2,3,4,5,6,7);
if(!(m_matrix & 0x01))
output().set_digit_value( 3, seg_data );

View File

@ -528,9 +528,9 @@ DRIVER_INIT_MEMBER(chsuper_state,chmpnum)
j = i ^ (m_tilexor << 5);
j = BITSWAP24(j,23,22,21,20,19,18,17,13, 15,14,16,12, 11,10,9,8, 7,6,5,4, 3,2,1,0);
j = BITSWAP24(j,23,22,21,20,19,18,17,14, 15,16,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0);
j = BITSWAP24(j,23,22,21,20,19,18,17,15, 16,14,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0);
j = bitswap<24>(j,23,22,21,20,19,18,17,13, 15,14,16,12, 11,10,9,8, 7,6,5,4, 3,2,1,0);
j = bitswap<24>(j,23,22,21,20,19,18,17,14, 15,16,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0);
j = bitswap<24>(j,23,22,21,20,19,18,17,15, 16,14,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0);
buffer[j] = rom[i];
}

View File

@ -85,7 +85,7 @@ WRITE16_MEMBER(cninja_state::cninja_pf34_control_w)
READ16_MEMBER( cninja_state::cninja_protection_region_0_104_r )
{
int real_address = 0 + (offset *2);
int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco104->read_data( deco146_addr, mem_mask, cs );
return data;
@ -94,7 +94,7 @@ READ16_MEMBER( cninja_state::cninja_protection_region_0_104_r )
WRITE16_MEMBER( cninja_state::cninja_protection_region_0_104_w )
{
int real_address = 0 + (offset *2);
int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco104->write_data( space, deco146_addr, data, mem_mask, cs );
}
@ -167,7 +167,7 @@ ADDRESS_MAP_END
READ16_MEMBER( cninja_state::sshangha_protection_region_8_146_r )
{
int real_address = 0x1a0000 + (offset *2);
int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco146->read_data( deco146_addr, mem_mask, cs );
return data;
@ -176,7 +176,7 @@ READ16_MEMBER( cninja_state::sshangha_protection_region_8_146_r )
WRITE16_MEMBER( cninja_state::sshangha_protection_region_8_146_w )
{
int real_address = 0x1a0000 + (offset *2);
int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco146->write_data( space, deco146_addr, data, mem_mask, cs );
}
@ -186,7 +186,7 @@ READ16_MEMBER( cninja_state::sshangha_protection_region_6_146_r )
// uint16_t realdat = deco16_60_prot_r(space,offset&0x3ff,mem_mask);
int real_address = 0x198000 + (offset *2);
int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco146->read_data( deco146_addr, mem_mask, cs );
@ -203,7 +203,7 @@ WRITE16_MEMBER( cninja_state::sshangha_protection_region_6_146_w )
int real_address = 0x198000 + (offset *2);
int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco146->write_data( space, deco146_addr, data, mem_mask, cs );
}
@ -273,7 +273,7 @@ ADDRESS_MAP_END
READ16_MEMBER( cninja_state::mutantf_protection_region_0_146_r )
{
int real_address = 0 + (offset *2);
int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco146->read_data( deco146_addr, mem_mask, cs );
return data;
@ -282,7 +282,7 @@ READ16_MEMBER( cninja_state::mutantf_protection_region_0_146_r )
WRITE16_MEMBER( cninja_state::mutantf_protection_region_0_146_w )
{
int real_address = 0 + (offset *2);
int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco146->write_data( space, deco146_addr, data, mem_mask, cs );
}

View File

@ -488,7 +488,7 @@ WRITE8_MEMBER(cntsteer_state::cntsteer_background_w)
/* checks area 0x2000-0x2fff with this address config. */
READ8_MEMBER(cntsteer_state::cntsteer_background_mirror_r)
{
return m_videoram2[BITSWAP16(offset,15,14,13,12,5,4,3,2,1,0,11,10,9,8,7,6)];
return m_videoram2[bitswap<16>(offset,15,14,13,12,5,4,3,2,1,0,11,10,9,8,7,6)];
}
/*************************************

View File

@ -1540,8 +1540,8 @@ DRIVER_INIT_MEMBER(coinmstr_state,coinmstr)
for(i = 0; i < length; i++)
{
int adr = BITSWAP24(i, 23,22,21,20,19,18,17,16,15, 14,8,7,2,5,12,10,9,11,13,3,6,0,1,4);
rom[i] = BITSWAP8(buf[adr],3,2,4,1,5,0,6,7);
int adr = bitswap<24>(i, 23,22,21,20,19,18,17,16,15, 14,8,7,2,5,12,10,9,11,13,3,6,0,1,4);
rom[i] = bitswap<8>(buf[adr],3,2,4,1,5,0,6,7);
}
}

View File

@ -1145,13 +1145,13 @@ DRIVER_INIT_MEMBER(coolpool_state,9ballsht)
hi = rom[a] >> 8;
lo = rom[a] & 0xff;
nhi = BITSWAP8(hi,5,2,0,7,6,4,3,1) ^ 0x29;
nhi = bitswap<8>(hi,5,2,0,7,6,4,3,1) ^ 0x29;
if (hi & 0x01) nhi ^= 0x03;
if (hi & 0x10) nhi ^= 0xc1;
if (hi & 0x20) nhi ^= 0x40;
if (hi & 0x40) nhi ^= 0x12;
nlo = BITSWAP8(lo,5,3,4,6,7,1,2,0) ^ 0x80;
nlo = bitswap<8>(lo,5,3,4,6,7,1,2,0) ^ 0x80;
if ((lo & 0x02) && (lo & 0x04)) nlo ^= 0x01;
if (lo & 0x04) nlo ^= 0x0c;
if (lo & 0x08) nlo ^= 0x10;

View File

@ -200,7 +200,7 @@ uint32_t cops_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap,
WRITE8_MEMBER(cops_state::cdrom_data_w)
{
const char *regs[4] = { "CMD", "PARAM", "WRITE", "CTRL" };
m_cdrom_data = BITSWAP8(data,0,1,2,3,4,5,6,7);
m_cdrom_data = bitswap<8>(data,0,1,2,3,4,5,6,7);
uint8_t reg = ((m_cdrom_ctrl & 4) >> 1) | ((m_cdrom_ctrl & 8) >> 3);
if (LOG_CDROM) logerror("%s:cdrom_data_w(reg = %s, data = %02x)\n", machine().describe_context(), regs[reg & 0x03], m_cdrom_data);
}
@ -647,7 +647,7 @@ WRITE8_MEMBER(cops_state::io1_w)
{
sprintf(output_name, "digit%d", i);
display_data = m_lcd_data_l | (m_lcd_data_h << 8);
display_data = BITSWAP16(display_data, 4, 5, 12, 1, 0, 11, 10, 6, 7, 2, 9, 3, 15, 8, 14, 13);
display_data = bitswap<16>(display_data, 4, 5, 12, 1, 0, 11, 10, 6, 7, 2, 9, 3, 15, 8, 14, 13);
output().set_value(output_name, display_data);
}
}
@ -757,7 +757,7 @@ WRITE_LINE_MEMBER(cops_state::via1_irq)
WRITE8_MEMBER(cops_state::via1_b_w)
{
m_sn_data = BITSWAP8(data,0,1,2,3,4,5,6,7);
m_sn_data = bitswap<8>(data,0,1,2,3,4,5,6,7);
if (m_sn_cb1)
{
m_sn->write(space,0,m_sn_data);

View File

@ -1572,7 +1572,7 @@ DRIVER_INIT_MEMBER(cvs_state,hunchbaka)
/* data lines D2 and D5 swapped */
for (offs = 0; offs < 0x7400; offs++)
ROM[offs] = BITSWAP8(ROM[offs],7,6,2,4,3,5,1,0);
ROM[offs] = bitswap<8>(ROM[offs],7,6,2,4,3,5,1,0);
}
@ -1638,7 +1638,7 @@ DRIVER_INIT_MEMBER(cvs_state,raiders)
/* data lines D1 and D6 swapped */
for (offs = 0; offs < 0x7400; offs++)
ROM[offs] = BITSWAP8(ROM[offs],7,1,5,4,3,2,6,0);
ROM[offs] = bitswap<8>(ROM[offs],7,1,5,4,3,2,6,0);
/* patch out protection */
ROM[0x010a] = 0xc0;

View File

@ -982,7 +982,7 @@ DRIVER_INIT_MEMBER(cybertnk_state,cybertnk)
// reorder the data to simplify sprite drawing
// we draw 8 pixels at a time, each each nibble contains a pixel, however the original order of 32-bits (8 pixels)
// is along the lines of 04 15 26 37 which is awkward to use
spr[x] = BITSWAP32(spr[x], 27,26,25,24, 19,18,17,16, 11,10,9,8, 3,2,1,0, 31,30,29,28, 23,22,21,20, 15,14,13,12, 7,6,5,4 );
spr[x] = bitswap<32>(spr[x], 27,26,25,24, 19,18,17,16, 11,10,9,8, 3,2,1,0, 31,30,29,28, 23,22,21,20, 15,14,13,12, 7,6,5,4 );
}
}

View File

@ -220,7 +220,7 @@ DRIVER_INIT_MEMBER(dambustr_state,dambustr)
// Bit swap addresses
for(i=0; i<4096*4; i++) {
rom[i] = usr[BITSWAP16(i,15,14,13,12, 4,10,9,8,7,6,5,3,11,2,1,0)];
rom[i] = usr[bitswap<16>(i,15,14,13,12, 4,10,9,8,7,6,5,3,11,2,1,0)];
};
// Swap program ROMs
@ -233,9 +233,9 @@ DRIVER_INIT_MEMBER(dambustr_state,dambustr)
// Bit swap in $1000-$1fff and $4000-$5fff
for(i=0; i<0x1000; i++) {
rom[0x1000+i] = BITSWAP8(rom[0x1000+i],7,6,5,1,3,2,4,0);
rom[0x4000+i] = BITSWAP8(rom[0x4000+i],7,6,5,1,3,2,4,0);
rom[0x5000+i] = BITSWAP8(rom[0x5000+i],7,6,5,1,3,2,4,0);
rom[0x1000+i] = bitswap<8>(rom[0x1000+i],7,6,5,1,3,2,4,0);
rom[0x4000+i] = bitswap<8>(rom[0x4000+i],7,6,5,1,3,2,4,0);
rom[0x5000+i] = bitswap<8>(rom[0x5000+i],7,6,5,1,3,2,4,0);
};
// Swap graphics ROMs

View File

@ -336,7 +336,7 @@ void darkmist_state::decrypt_fgbgtiles(uint8_t* rom, int size)
w1 = (rom[i + 0*size/2] << 8) + rom[i + 1*size/2];
w1 = BITSWAP16(w1, 9,14,7,2, 6,8,3,15, 10,13,5,12, 0,11,4,1);
w1 = bitswap<16>(w1, 9,14,7,2, 6,8,3,15, 10,13,5,12, 0,11,4,1);
buf[i + 0*size/2] = w1 >> 8;
buf[i + 1*size/2] = w1 & 0xff;
@ -345,7 +345,7 @@ void darkmist_state::decrypt_fgbgtiles(uint8_t* rom, int size)
/* address lines */
for (int i = 0;i < size;i++)
{
rom[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13, 5,4,3,2, 12,11,10,9,8, 1,0, 7,6)];
rom[i] = buf[bitswap<24>(i,23,22,21,20,19,18,17,16,15,14,13, 5,4,3,2, 12,11,10,9,8, 1,0, 7,6)];
}
}
@ -368,7 +368,7 @@ void darkmist_state::decrypt_gfx()
w1 = (rom[i + 0*size/2] << 8) + rom[i + 1*size/2];
w1 = BITSWAP16(w1, 9,14,7,2, 6,8,3,15, 10,13,5,12, 0,11,4,1);
w1 = bitswap<16>(w1, 9,14,7,2, 6,8,3,15, 10,13,5,12, 0,11,4,1);
buf[i + 0*size/2] = w1 >> 8;
buf[i + 1*size/2] = w1 & 0xff;
@ -377,7 +377,7 @@ void darkmist_state::decrypt_gfx()
/* address lines */
for (i = 0;i < size;i++)
{
rom[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12, 3,2,1, 11,10,9,8, 0, 7,6,5,4)];
rom[i] = buf[bitswap<24>(i,23,22,21,20,19,18,17,16,15,14,13,12, 3,2,1, 11,10,9,8, 0, 7,6,5,4)];
}
decrypt_fgbgtiles(memregion("bg_gfx")->base(), memregion("bg_gfx")->bytes());
@ -394,7 +394,7 @@ void darkmist_state::decrypt_gfx()
w1 = (rom[i + 0*size/2] << 8) + rom[i + 1*size/2];
w1 = BITSWAP16(w1, 9,14,7,2, 6,8,3,15, 10,13,5,12, 0,11,4,1);
w1 = bitswap<16>(w1, 9,14,7,2, 6,8,3,15, 10,13,5,12, 0,11,4,1);
buf[i + 0*size/2] = w1 >> 8;
buf[i + 1*size/2] = w1 & 0xff;
@ -403,7 +403,7 @@ void darkmist_state::decrypt_gfx()
/* address lines */
for (i = 0;i < size;i++)
{
rom[i] = buf[BITSWAP24(i, 23,22,21,20,19,18,17,16,15,14, 12,11,10,9,8, 5,4,3, 13, 7,6, 1,0, 2)];
rom[i] = buf[bitswap<24>(i, 23,22,21,20,19,18,17,16,15,14, 12,11,10,9,8, 5,4,3, 13, 7,6, 1,0, 2)];
}
}
@ -412,7 +412,7 @@ void darkmist_state::decrypt_snd()
uint8_t *ROM = memregion("t5182_z80")->base();
for (int i = 0x0000; i < 0x8000; i++)
ROM[i] = BITSWAP8(ROM[i], 7, 1, 2, 3, 4, 5, 6, 0);
ROM[i] = bitswap<8>(ROM[i], 7, 1, 2, 3, 4, 5, 6, 0);
}
DRIVER_INIT_MEMBER(darkmist_state,darkmist)
@ -441,8 +441,8 @@ DRIVER_INIT_MEMBER(darkmist_state,darkmist)
if((i & 0x220) != 0x200)
{
p = BITSWAP8(p, 7,6,5,2,3,4,1,0);
d = BITSWAP8(d, 7,6,5,2,3,4,1,0);
p = bitswap<8>(p, 7,6,5,2,3,4,1,0);
d = bitswap<8>(d, 7,6,5,2,3,4,1,0);
}
ROM[i] = d;
@ -458,7 +458,7 @@ DRIVER_INIT_MEMBER(darkmist_state,darkmist)
for(i=0;i<len;i++)
{
ROM[i]=buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,7,6,5,4,3,15,14,13,12,9,8,2,1,11,10, 0)];
ROM[i]=buffer[bitswap<24>(i,23,22,21,20,19,18,17,16,7,6,5,4,3,15,14,13,12,9,8,2,1,11,10, 0)];
}
@ -467,7 +467,7 @@ DRIVER_INIT_MEMBER(darkmist_state,darkmist)
memcpy( &buffer[0], ROM, len );
for(i=0;i<len;i++)
{
ROM[i]=buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,15 ,6,5,4,3,12,11,10,9,14,13,2,1,8,7 ,0 )];
ROM[i]=buffer[bitswap<24>(i,23,22,21,20,19,18,17,16,15 ,6,5,4,3,12,11,10,9,14,13,2,1,8,7 ,0 )];
}
}

View File

@ -161,7 +161,7 @@ WRITE8_MEMBER( datum_state::pa_w )
data ^= 0xff;
if (m_keydata > 3)
{
output().set_digit_value(m_keydata, BITSWAP8(data & 0x7f, 7, 0, 5, 6, 4, 2, 1, 3));
output().set_digit_value(m_keydata, bitswap<8>(data & 0x7f, 7, 0, 5, 6, 4, 2, 1, 3));
m_keydata = 0;
}
@ -171,7 +171,7 @@ WRITE8_MEMBER( datum_state::pa_w )
// select keyboard row, select a digit
WRITE8_MEMBER( datum_state::pb_w )
{
m_keydata = BITSWAP8(data, 7, 6, 5, 4, 0, 1, 2, 3) & 15;
m_keydata = bitswap<8>(data, 7, 6, 5, 4, 0, 1, 2, 3) & 15;
return;
}

View File

@ -148,7 +148,7 @@ uint32_t dblewing_state::screen_update_dblewing(screen_device &screen, bitmap_in
READ16_MEMBER( dblewing_state::wf_protection_region_0_104_r )
{
int real_address = 0 + (offset *2);
int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco104->read_data( deco146_addr, mem_mask, cs );
return data;
@ -157,7 +157,7 @@ READ16_MEMBER( dblewing_state::wf_protection_region_0_104_r )
WRITE16_MEMBER( dblewing_state::wf_protection_region_0_104_w )
{
int real_address = 0 + (offset *2);
int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco104->write_data( space, deco146_addr, data, mem_mask, cs );
}

View File

@ -231,7 +231,7 @@ WRITE8_MEMBER(darktowr_state::darktowr_mcu_bank_w)
if (offset == 0x1400 || offset == 0)
{
uint8_t const value(BITSWAP8(data, 0, 1, 2, 3, 4, 5, 6, 7));
uint8_t const value(bitswap<8>(data, 0, 1, 2, 3, 4, 5, 6, 7));
m_mcu->pb_w(space, 0, value);
logerror("MCU PORT 1 -> %04x (from %04x)\n", value, data);
}
@ -2116,27 +2116,27 @@ DRIVER_INIT_MEMBER(toffy_state, toffy)
rom = memregion("maincpu")->base();
length = memregion("maincpu")->bytes();
for (i = 0; i < length; i++)
rom[i] = BITSWAP8(rom[i], 6,7,5,4,3,2,1,0);
rom[i] = bitswap<8>(rom[i], 6,7,5,4,3,2,1,0);
/* and the fg gfx ... */
rom = memregion("gfx1")->base();
length = memregion("gfx1")->bytes();
for (i = 0; i < length; i++)
rom[i] = BITSWAP8(rom[i], 7,6,5,3,4,2,1,0);
rom[i] = bitswap<8>(rom[i], 7,6,5,3,4,2,1,0);
/* and the sprites gfx */
rom = memregion("gfx2")->base();
length = memregion("gfx2")->bytes();
for (i = 0; i < length; i++)
rom[i] = BITSWAP8(rom[i], 7,6,5,4,3,2,0,1);
rom[i] = bitswap<8>(rom[i], 7,6,5,4,3,2,0,1);
/* and the bg gfx */
rom = memregion("gfx3")->base();
length = memregion("gfx3")->bytes();
for (i = 0; i < length / 2; i++)
{
rom[i + 0*length/2] = BITSWAP8(rom[i + 0*length/2], 7,6,1,4,3,2,5,0);
rom[i + 1*length/2] = BITSWAP8(rom[i + 1*length/2], 7,6,2,4,3,5,1,0);
rom[i + 0*length/2] = bitswap<8>(rom[i + 0*length/2], 7,6,1,4,3,2,5,0);
rom[i + 1*length/2] = bitswap<8>(rom[i + 1*length/2], 7,6,2,4,3,5,1,0);
}
/* should the sound rom be bitswapped too? */

Some files were not shown because too many files have changed in this diff Show More