mirror of
https://github.com/holub/mame
synced 2025-05-18 19:49:35 +03:00
Merge pull request #4828 from cam900/deco146_args
deco146.cpp : Simplify handlers, Reduce some unnecessary lines
This commit is contained in:
commit
7090a679c6
@ -112,7 +112,7 @@ WRITE16_MEMBER( boogwing_state::boogwing_protection_region_0_104_w )
|
||||
int real_address = 0 + (offset *2);
|
||||
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 );
|
||||
m_deco104->write_data( deco146_addr, data, mem_mask, cs );
|
||||
}
|
||||
|
||||
WRITE16_MEMBER( boogwing_state::priority_w )
|
||||
|
@ -77,7 +77,7 @@ WRITE16_MEMBER( cninja_state::cninja_protection_region_0_104_w )
|
||||
int real_address = 0 + (offset *2);
|
||||
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_ioprot->write_data( space, deco146_addr, data, mem_mask, cs );
|
||||
m_ioprot->write_data( deco146_addr, data, mem_mask, cs );
|
||||
}
|
||||
|
||||
READ16_MEMBER(cninja_state::cninjabl2_sprite_dma_r)
|
||||
@ -159,7 +159,7 @@ WRITE16_MEMBER( cninja_state::edrandy_protection_region_8_146_w )
|
||||
int real_address = 0x1a0000 + (offset *2);
|
||||
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_ioprot->write_data( space, deco146_addr, data, mem_mask, cs );
|
||||
m_ioprot->write_data( deco146_addr, data, mem_mask, cs );
|
||||
}
|
||||
|
||||
READ16_MEMBER( cninja_state::edrandy_protection_region_6_146_r )
|
||||
@ -186,7 +186,7 @@ WRITE16_MEMBER( cninja_state::edrandy_protection_region_6_146_w )
|
||||
int real_address = 0x198000 + (offset *2);
|
||||
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_ioprot->write_data( space, deco146_addr, data, mem_mask, cs );
|
||||
m_ioprot->write_data( deco146_addr, data, mem_mask, cs );
|
||||
}
|
||||
|
||||
void cninja_state::edrandy_map(address_map &map)
|
||||
@ -268,7 +268,7 @@ WRITE16_MEMBER( cninja_state::mutantf_protection_region_0_146_w )
|
||||
int real_address = 0 + (offset *2);
|
||||
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_ioprot->write_data( space, deco146_addr, data, mem_mask, cs );
|
||||
m_ioprot->write_data( deco146_addr, data, mem_mask, cs );
|
||||
}
|
||||
|
||||
READ16_MEMBER( cninja_state::mutantf_71_r )
|
||||
|
@ -168,7 +168,7 @@ WRITE16_MEMBER( dblewing_state::wf_protection_region_0_104_w )
|
||||
int real_address = 0 + (offset *2);
|
||||
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 );
|
||||
m_deco104->write_data( deco146_addr, data, mem_mask, cs );
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( dblewing_state::soundlatch_irq_w )
|
||||
|
@ -709,7 +709,7 @@ WRITE16_MEMBER( deco32_state::ioprot_w )
|
||||
offs_t 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_ioprot->write_data( space, deco146_addr, data, mem_mask, cs );
|
||||
m_ioprot->write_data( deco146_addr, data, mem_mask, cs );
|
||||
}
|
||||
|
||||
|
||||
@ -788,7 +788,7 @@ WRITE_LINE_MEMBER( nslasher_state::tattass_sound_irq_w )
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
uint8_t data = m_ioprot->soundlatch_r(machine().dummy_space(), 0);
|
||||
uint8_t data = m_ioprot->soundlatch_r();
|
||||
// Swap bits 0 and 3 to correct for design error from BSMT schematic
|
||||
data = bitswap<8>(data, 7, 6, 5, 4, 0, 2, 1, 3);
|
||||
m_decobsmt->bsmt_comms_w(data);
|
||||
|
@ -288,7 +288,7 @@ WRITE16_MEMBER( deco_mlc_state::sh96_protection_region_0_146_w )
|
||||
int real_address = 0 + (offset *2);
|
||||
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 );
|
||||
m_deco146->write_data( deco146_addr, data, mem_mask, cs );
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,7 +48,7 @@ WRITE16_MEMBER( dietgo_state::dietgo_protection_region_0_104_w )
|
||||
int real_address = 0 + (offset *2);
|
||||
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 );
|
||||
m_deco104->write_data( deco146_addr, data, mem_mask, cs );
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,7 +112,7 @@ WRITE16_MEMBER( dreambal_state::dreambal_protection_region_0_104_w )
|
||||
int real_address = 0 + (offset *2);
|
||||
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 );
|
||||
m_deco104->write_data( deco146_addr, data, mem_mask, cs );
|
||||
}
|
||||
|
||||
void dreambal_state::dreambal_map(address_map &map)
|
||||
|
@ -125,7 +125,7 @@ WRITE16_MEMBER( funkyjet_state::funkyjet_protection_region_0_146_w )
|
||||
int real_address = 0 + (offset *2);
|
||||
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, /* note, same bitswap as fghthist */ 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 );
|
||||
m_deco146->write_data( deco146_addr, data, mem_mask, cs );
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@ WRITE16_MEMBER( lemmings_state::lem_protection_region_0_146_w )
|
||||
int real_address = 0 + (offset *2);
|
||||
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 );
|
||||
m_deco146->write_data( deco146_addr, data, mem_mask, cs );
|
||||
}
|
||||
|
||||
|
||||
|
@ -88,7 +88,7 @@ WRITE16_MEMBER( pktgaldx_state::pktgaldx_protection_region_f_104_w )
|
||||
{
|
||||
int real_address = 0 + (offset *2);
|
||||
uint8_t cs = 0;
|
||||
m_deco104->write_data( space, real_address&0x7fff, data, mem_mask, cs );
|
||||
m_deco104->write_data( real_address&0x7fff, data, mem_mask, cs );
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( pktgaldx_state::vblank_w )
|
||||
|
@ -155,7 +155,7 @@ WRITE16_MEMBER( rohga_state::ioprot_w )
|
||||
int real_address = 0 + (offset *2);
|
||||
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_ioprot->write_data( space, deco146_addr, data, mem_mask, cs );
|
||||
m_ioprot->write_data( deco146_addr, data, mem_mask, cs );
|
||||
}
|
||||
|
||||
|
||||
|
@ -134,7 +134,7 @@ WRITE16_MEMBER( sshangha_state::sshangha_protection_region_d_146_w )
|
||||
int real_address = 0x3f4000 + (offset *2);
|
||||
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 );
|
||||
m_deco146->write_data( deco146_addr, data, mem_mask, cs );
|
||||
}
|
||||
|
||||
READ16_MEMBER( sshangha_state::sshangha_protection_region_8_146_r )
|
||||
@ -151,7 +151,7 @@ WRITE16_MEMBER( sshangha_state::sshangha_protection_region_8_146_w )
|
||||
int real_address = 0x3e0000 + (offset *2);
|
||||
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 );
|
||||
m_deco146->write_data( deco146_addr, data, mem_mask, cs );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1136,11 +1136,10 @@ inline uint16_t reorder(uint16_t input, uint8_t const *weights)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* there are probably less dumb ways of doing the CS logic, it could be hooked up
|
||||
more like the system16 mapper chips */
|
||||
|
||||
void deco_146_base_device::write_data(address_space &space, uint16_t address, uint16_t data, uint16_t mem_mask, uint8_t &csflags)
|
||||
void deco_146_base_device::write_data(uint16_t address, uint16_t data, uint16_t mem_mask, uint8_t &csflags)
|
||||
{
|
||||
address = bitswap<16>(address>>1, 15,14,13,12,11,10, m_external_addrswap[9],m_external_addrswap[8] ,m_external_addrswap[7],m_external_addrswap[6],m_external_addrswap[5],m_external_addrswap[4],m_external_addrswap[3],m_external_addrswap[2],m_external_addrswap[1],m_external_addrswap[0]) << 1;
|
||||
|
||||
@ -1177,7 +1176,7 @@ void deco_146_base_device::write_data(address_space &space, uint16_t address, ui
|
||||
if (i==0) // the first cs is our internal protection area
|
||||
{
|
||||
// logerror("write matches cs table (protection) %01x %04x %04x %04x\n", i, real_address, data, mem_mask);
|
||||
write_protport(space, real_address, data, mem_mask);
|
||||
write_protport(real_address, data, mem_mask);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1193,10 +1192,6 @@ void deco_146_base_device::write_data(address_space &space, uint16_t address, ui
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
uint16_t deco_146_base_device::read_protport(uint16_t address, uint16_t mem_mask)
|
||||
{
|
||||
// if we read the last written address immediately after then ignore all other logic and just return what was written unmodified
|
||||
@ -1214,11 +1209,6 @@ uint16_t deco_146_base_device::read_protport(uint16_t address, uint16_t mem_mask
|
||||
int location = 0;
|
||||
uint16_t realret = read_data_getloc(address, location);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (location == m_bankswitch_swap_read_address) // this has a special meaning
|
||||
{
|
||||
// logerror("(bankswitch) %04x %04x\n", address, mem_mask);
|
||||
@ -1239,7 +1229,7 @@ TIMER_CALLBACK_MEMBER(deco_146_base_device::write_soundlatch)
|
||||
m_soundlatch_irq_cb(ASSERT_LINE);
|
||||
}
|
||||
|
||||
void deco_146_base_device::write_protport(address_space &space, uint16_t address, uint16_t data, uint16_t mem_mask)
|
||||
void deco_146_base_device::write_protport(uint16_t address, uint16_t data, uint16_t mem_mask)
|
||||
{
|
||||
m_latchaddr = address;
|
||||
m_latchdata = data;
|
||||
@ -1270,7 +1260,6 @@ void deco_146_base_device::write_protport(address_space &space, uint16_t address
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint16_t deco_146_base_device::read_data(uint16_t address, uint16_t mem_mask, uint8_t &csflags)
|
||||
{
|
||||
address = bitswap<16>(address>>1, 15,14,13,12,11,10, m_external_addrswap[9],m_external_addrswap[8] ,m_external_addrswap[7],m_external_addrswap[6],m_external_addrswap[5],m_external_addrswap[4],m_external_addrswap[3],m_external_addrswap[2],m_external_addrswap[1],m_external_addrswap[0]) << 1;
|
||||
@ -1316,7 +1305,7 @@ uint16_t deco_146_base_device::read_data(uint16_t address, uint16_t mem_mask, ui
|
||||
return retdata;
|
||||
}
|
||||
|
||||
READ8_MEMBER( deco_146_base_device::soundlatch_r )
|
||||
u8 deco_146_base_device::soundlatch_r()
|
||||
{
|
||||
m_soundlatch_irq_cb(CLEAR_LINE);
|
||||
return m_soundlatch;
|
||||
@ -1430,7 +1419,6 @@ uint16_t deco_146_base_device::read_data_getloc(uint16_t address, int& location)
|
||||
}
|
||||
|
||||
|
||||
|
||||
DEFINE_DEVICE_TYPE(DECO146PROT, deco146_device, "deco146", "DECO 146 Protection")
|
||||
|
||||
|
||||
|
@ -50,7 +50,7 @@ struct deco146port_xx
|
||||
class deco_146_base_device : public device_t
|
||||
{
|
||||
public:
|
||||
void write_data(address_space &space, uint16_t address, uint16_t data, uint16_t mem_mask, uint8_t &csflags);
|
||||
void write_data(uint16_t address, uint16_t data, uint16_t mem_mask, uint8_t &csflags);
|
||||
uint16_t read_data(uint16_t address, uint16_t mem_mask, uint8_t &csflags);
|
||||
|
||||
auto port_a_cb() { return m_port_a_r.bind(); }
|
||||
@ -77,7 +77,7 @@ public:
|
||||
|
||||
auto soundlatch_irq_cb() { return m_soundlatch_irq_cb.bind(); }
|
||||
|
||||
DECLARE_READ8_MEMBER( soundlatch_r );
|
||||
u8 soundlatch_r();
|
||||
|
||||
devcb_read16 m_port_a_r;
|
||||
devcb_read16 m_port_b_r;
|
||||
@ -101,7 +101,7 @@ protected:
|
||||
virtual void device_reset() override;
|
||||
|
||||
uint16_t read_protport(uint16_t address, uint16_t mem_mask);
|
||||
virtual void write_protport(address_space &space, uint16_t address, uint16_t data, uint16_t mem_mask);
|
||||
virtual void write_protport(uint16_t address, uint16_t data, uint16_t mem_mask);
|
||||
virtual uint16_t read_data_getloc(uint16_t address, int& location);
|
||||
|
||||
uint16_t m_rambank0[0x80];
|
||||
|
Loading…
Reference in New Issue
Block a user