diff options
Diffstat (limited to 'docs/release/src/hbmame/drivers/cps2.cpp')
-rw-r--r-- | docs/release/src/hbmame/drivers/cps2.cpp | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/docs/release/src/hbmame/drivers/cps2.cpp b/docs/release/src/hbmame/drivers/cps2.cpp index a36d0b39748..abcf1a7ce73 100644 --- a/docs/release/src/hbmame/drivers/cps2.cpp +++ b/docs/release/src/hbmame/drivers/cps2.cpp @@ -766,7 +766,7 @@ static const int fn2_groupB[8] = { 3, 5, 9, 10, 8, 15, 12, 11 }; struct sbox { - const uint8_t table[64]; + const u8 table[64]; const int inputs[6]; // positions of the inputs bits, -1 means no input except from key const int outputs[2]; // positions of the output bits }; @@ -776,8 +776,8 @@ struct sbox // following one struct optimised_sbox { - uint8_t input_lookup[256]; - uint8_t output[64]; + u8 input_lookup[256]; + u8 output[64]; }; @@ -1074,7 +1074,7 @@ static const struct sbox fn2_r4_boxes[4] = /******************************************************************************/ -static uint8_t fn(uint8_t in, const struct optimised_sbox *sboxes, uint32_t key) +static u8 fn(u8 in, const struct optimised_sbox *sboxes, u32 key) { const struct optimised_sbox *sbox1 = &sboxes[0]; const struct optimised_sbox *sbox2 = &sboxes[1]; @@ -1092,7 +1092,7 @@ static uint8_t fn(uint8_t in, const struct optimised_sbox *sboxes, uint32_t key) // srckey is the 64-bit master key (2x32 bits) // dstkey will contain the 96-bit key for the 1st FN (4x24 bits) -static void expand_1st_key(uint32_t *dstkey, const uint32_t *srckey) +static void expand_1st_key(u32 *dstkey, const u32 *srckey) { static const int bits[96] = { @@ -1127,7 +1127,7 @@ static void expand_1st_key(uint32_t *dstkey, const uint32_t *srckey) // srckey is the 64-bit master key (2x32 bits) XORed with the subkey // dstkey will contain the 96-bit key for the 2nd FN (4x24 bits) -static void expand_2nd_key(uint32_t *dstkey, const uint32_t *srckey) +static void expand_2nd_key(u32 *dstkey, const u32 *srckey) { static const int bits[96] = { @@ -1164,7 +1164,7 @@ static void expand_2nd_key(uint32_t *dstkey, const uint32_t *srckey) // seed is the 16-bit seed generated by the first FN // subkey will contain the 64-bit key to be XORed with the master key // for the 2nd FN (2x32 bits) -static void expand_subkey(uint32_t* subkey, uint16_t seed) +static void expand_subkey(u32* subkey, u16 seed) { // Note that each row of the table is a permutation of the seed bits. static const int bits[64] = @@ -1185,12 +1185,12 @@ static void expand_subkey(uint32_t* subkey, uint16_t seed) -static uint16_t feistel(uint16_t val, const int *bitsA, const int *bitsB, +static u16 feistel(u16 val, const int *bitsA, const int *bitsB, const struct optimised_sbox* boxes1, const struct optimised_sbox* boxes2, const struct optimised_sbox* boxes3, const struct optimised_sbox* boxes4, - uint32_t key1, uint32_t key2, uint32_t key3, uint32_t key4) + u32 key1, u32 key2, u32 key3, u32 key4) { - uint8_t l = bitswap<8>(val, bitsB[7],bitsB[6],bitsB[5],bitsB[4],bitsB[3],bitsB[2],bitsB[1],bitsB[0]); - uint8_t r = bitswap<8>(val, bitsA[7],bitsA[6],bitsA[5],bitsA[4],bitsA[3],bitsA[2],bitsA[1],bitsA[0]); + u8 l = bitswap<8>(val, bitsB[7],bitsB[6],bitsB[5],bitsB[4],bitsB[3],bitsB[2],bitsB[1],bitsB[0]); + u8 r = bitswap<8>(val, bitsA[7],bitsA[6],bitsA[5],bitsA[4],bitsA[3],bitsA[2],bitsA[1],bitsA[0]); l ^= fn(r, boxes1, key1); r ^= fn(l, boxes2, key2); @@ -1218,7 +1218,7 @@ static uint16_t feistel(uint16_t val, const int *bitsA, const int *bitsB, -static int extract_inputs(uint32_t val, const int *inputs) +static int extract_inputs(u32 val, const int *inputs) { int i; int res = 0; @@ -1264,10 +1264,10 @@ static void optimise_sboxes(struct optimised_sbox* out, const struct sbox* in) -static void cps2_decrypt(running_machine &machine, uint16_t *rom, uint16_t *dec, int length, const uint32_t *master_key, uint32_t lower_limit, uint32_t upper_limit) +static void cps2_decrypt(running_machine &machine, u16 *rom, u16 *dec, int length, const u32 *master_key, u32 lower_limit, u32 upper_limit) { int i; - uint32_t key1[4]; + u32 key1[4]; struct optimised_sbox sboxes1[4*4]; struct optimised_sbox sboxes2[4*4]; @@ -1296,9 +1296,9 @@ static void cps2_decrypt(running_machine &machine, uint16_t *rom, uint16_t *dec, for (i = 0; i < 0x10000; ++i) { int a; - uint16_t seed; - uint32_t subkey[2]; - uint32_t key2[4]; + u16 seed; + u32 subkey[2]; + u32 key2[4]; if ((i & 0xff) == 0) { @@ -1355,17 +1355,17 @@ static void cps2_decrypt(running_machine &machine, uint16_t *rom, uint16_t *dec, struct game_keys { const char *name; /* game driver name */ - const uint32_t keys[2]; - uint32_t upper_limit; + const u32 keys[2]; + u32 upper_limit; }; void cps2_state::init_cps2crypt() { if (m_region_key) { - uint32_t key[2]; - uint32_t lower; - uint32_t upper; + u32 key[2]; + u32 lower; + u32 upper; int b; @@ -1405,7 +1405,7 @@ void cps2_state::init_cps2crypt() logerror("cps2 decrypt 0x%08x,0x%08x,0x%08x,0x%08x\n", key[0], key[1], lower, upper); // we have a proper key so use it to decrypt - cps2_decrypt(machine(), (uint16_t *)memregion("maincpu")->base(), m_decrypted_opcodes, memregion("maincpu")->bytes(), key, lower / 2, upper / 2); + cps2_decrypt(machine(), (u16 *)memregion("maincpu")->base(), m_decrypted_opcodes, memregion("maincpu")->bytes(), key, lower / 2, upper / 2); } } @@ -1422,29 +1422,29 @@ void cps2_state::init_cps2crypt() #undef CODE_SIZE #define CODE_SIZE 0x0400000 -READ16_MEMBER(cps2_state::qsound_sharedram1_r) +u16 cps2_state::qsound_sharedram1_r(offs_t offset) { return m_qsound_sharedram1[offset] | 0xff00; } -WRITE16_MEMBER(cps2_state::qsound_sharedram1_w) +void cps2_state::qsound_sharedram1_w(offs_t offset, u16 data, u16 mem_mask) { if (ACCESSING_BITS_0_7) m_qsound_sharedram1[offset] = data; } -READ16_MEMBER(cps2_state::qsound_sharedram2_r) +u16 cps2_state::qsound_sharedram2_r(offs_t offset) { return m_qsound_sharedram2[offset] | 0xff00; } -WRITE16_MEMBER(cps2_state::qsound_sharedram2_w) +void cps2_state::qsound_sharedram2_w(offs_t offset, u16 data, u16 mem_mask) { if (ACCESSING_BITS_0_7) m_qsound_sharedram2[offset] = data; } -WRITE8_MEMBER(cps2_state::qsound_banksw_w) +void cps2_state::qsound_banksw_w(u8 data) { /* Z80 bank register for music note data. */ int bank = data & 0x0f; @@ -1457,13 +1457,13 @@ WRITE8_MEMBER(cps2_state::qsound_banksw_w) membank("bank1")->set_entry(bank); } -READ16_MEMBER(cps2_state::cps1_in2_r) +u16 cps2_state::cps1_in2_r() { int in = ioport("IN2")->read(); return (in << 8) | in; } -READ16_MEMBER(cps2_state::cps1_in3_r) +u16 cps2_state::cps1_in3_r() { int in = ioport("IN3")->read(); return (in << 8) | in; @@ -1534,7 +1534,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(cps2_state::cps2_interrupt) * *************************************/ -WRITE16_MEMBER( cps2_state::cps2_eeprom_port_w ) +void cps2_state::cps2_eeprom_port_w(offs_t offset, u16 data, u16 mem_mask) { if (ACCESSING_BITS_8_15) { @@ -1627,9 +1627,9 @@ TIMER_CALLBACK_MEMBER(cps2_state::cps2_update_digital_volume) m_qsound->set_output_gain(1, m_cps2digitalvolumelevel / 39.0); } -READ16_MEMBER(cps2_state::cps2_qsound_volume_r) +u16 cps2_state::cps2_qsound_volume_r() { - static const uint16_t cps2_vol_states[40] = + static const u16 cps2_vol_states[40] = { 0xf010, 0xf008, 0xf004, 0xf002, 0xf001, 0xe810, 0xe808, 0xe804, 0xe802, 0xe801, 0xe410, 0xe408, 0xe404, 0xe402, 0xe401, 0xe210, 0xe208, 0xe204, 0xe202, 0xe201, @@ -1637,7 +1637,7 @@ READ16_MEMBER(cps2_state::cps2_qsound_volume_r) 0xe050, 0xe048, 0xe044, 0xe042, 0xe041, 0xe030, 0xe028, 0xe024, 0xe022, 0xe021 }; - uint16_t result; + u16 result; result = cps2_vol_states[m_cps2digitalvolumelevel]; @@ -1661,12 +1661,12 @@ READ16_MEMBER(cps2_state::cps2_qsound_volume_r) * *************************************/ -READ16_MEMBER(cps2_state::kludge_r) +u16 cps2_state::kludge_r() { return 0xffff; } -READ16_MEMBER(cps2_state::joy_or_paddle_r) +u16 cps2_state::joy_or_paddle_r() { if (m_readpaddle != 0) { @@ -1678,11 +1678,11 @@ READ16_MEMBER(cps2_state::joy_or_paddle_r) } } -READ16_MEMBER(cps2_state::joy_or_paddle_ecofghtr_r) +u16 cps2_state::joy_or_paddle_ecofghtr_r() { if (m_readpaddle == 0 || (m_io_in1->read() & 0x10) == 0x10) // ignore bit if spinner not enabled { - uint16_t ret = m_io_in0->read(); + u16 ret = m_io_in0->read(); if ((m_io_in1->read() & 0x10) == 0x00) { @@ -1699,7 +1699,7 @@ READ16_MEMBER(cps2_state::joy_or_paddle_ecofghtr_r) int dial0 = (ioport("DIAL0")->read()); int dial1 = (ioport("DIAL1")->read()); - uint16_t ret = (dial0 & 0xff) | ((dial1 & 0xff) << 8); + u16 ret = (dial0 & 0xff) | ((dial1 & 0xff) << 8); // 1st dial if ((dial0 & 0x800) == (m_ecofghtr_dial_last0 & 0x800)) @@ -10685,7 +10685,7 @@ void cps2_state::init_pzloop2() save_item(NAME(m_readpaddle)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x804000, 0x804001, read16_delegate(*this, FUNC(cps2_state::joy_or_paddle_r))); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x804000, 0x804001, read16smo_delegate(*this, FUNC(cps2_state::joy_or_paddle_r))); } void cps2_state::init_singbrd() @@ -10697,12 +10697,12 @@ void cps2_state::init_singbrd() m_digital_volume_timer->adjust(attotime::never, 0, attotime::never); } -READ16_MEMBER( cps2_state::gigaman2_dummyqsound_r ) +u16 cps2_state::gigaman2_dummyqsound_r(offs_t offset) { return m_gigaman2_dummyqsound_ram[offset]; } -WRITE16_MEMBER( cps2_state::gigaman2_dummyqsound_w ) +void cps2_state::gigaman2_dummyqsound_w(offs_t offset, u16 data) { m_gigaman2_dummyqsound_ram[offset] = data; } @@ -10712,8 +10712,8 @@ void cps2_state::gigaman2_gfx_reorder() { int i; int length = memregion( "gfx" )->bytes(); - uint16_t *rom = (uint16_t *)memregion("gfx")->base(); - std::vector<uint16_t> buf( length ); + u16 *rom = (u16 *)memregion("gfx")->base(); + std::vector<u16> buf( length ); memcpy (&buf[0], rom, length); @@ -10730,10 +10730,10 @@ void cps2_state::init_gigaman2() init_cps2nc(); - m_gigaman2_dummyqsound_ram = std::make_unique<uint16_t[]>(0x20000 / 2); + m_gigaman2_dummyqsound_ram = std::make_unique<u16[]>(0x20000 / 2); save_pointer(NAME(m_gigaman2_dummyqsound_ram.get()), 0x20000 / 2); - space.install_readwrite_handler(0x618000, 0x619fff, read16_delegate(*this, FUNC(cps2_state::gigaman2_dummyqsound_r)), write16_delegate(*this, FUNC(cps2_state::gigaman2_dummyqsound_w))); // no qsound.. + space.install_readwrite_handler(0x618000, 0x619fff, read16sm_delegate(*this, FUNC(cps2_state::gigaman2_dummyqsound_r)), write16sm_delegate(*this, FUNC(cps2_state::gigaman2_dummyqsound_w))); // no qsound.. memcpy(m_decrypted_opcodes, memregion("maincpu")->base()+0x200000, 0x200000); @@ -10750,7 +10750,7 @@ void cps2_state::init_ecofghtr() save_item(NAME(m_readpaddle)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x804000, 0x804001, read16_delegate(*this, FUNC(cps2_state::joy_or_paddle_ecofghtr_r))); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x804000, 0x804001, read16smo_delegate(*this, FUNC(cps2_state::joy_or_paddle_ecofghtr_r))); } |