mirror of
https://github.com/holub/mame
synced 2025-04-18 22:49:58 +03:00
Cleanup using state object
This commit is contained in:
parent
321bdd5e58
commit
62fd9b344d
@ -250,6 +250,7 @@ private:
|
|||||||
uint8_t amstrad_ppi_portb_r();
|
uint8_t amstrad_ppi_portb_r();
|
||||||
void amstrad_ppi_portc_w(uint8_t data);
|
void amstrad_ppi_portc_w(uint8_t data);
|
||||||
|
|
||||||
|
device_t* get_expansion_device(const char* tag);
|
||||||
DECLARE_WRITE_LINE_MEMBER( cpc_romdis );
|
DECLARE_WRITE_LINE_MEMBER( cpc_romdis );
|
||||||
void rom_select(uint8_t data);
|
void rom_select(uint8_t data);
|
||||||
|
|
||||||
|
@ -105,6 +105,7 @@ private:
|
|||||||
void at_dma8237_1_w(offs_t offset, uint8_t data);
|
void at_dma8237_1_w(offs_t offset, uint8_t data);
|
||||||
uint8_t bebox_dma_read_byte(offs_t offset);
|
uint8_t bebox_dma_read_byte(offs_t offset);
|
||||||
void bebox_dma_write_byte(offs_t offset, uint8_t data);
|
void bebox_dma_write_byte(offs_t offset, uint8_t data);
|
||||||
|
inline void set_dma_channel(int channel, int state);
|
||||||
uint64_t scsi53c810_r(offs_t offset, uint64_t mem_mask = ~0);
|
uint64_t scsi53c810_r(offs_t offset, uint64_t mem_mask = ~0);
|
||||||
void scsi53c810_w(offs_t offset, uint64_t data, uint64_t mem_mask = ~0);
|
void scsi53c810_w(offs_t offset, uint64_t data, uint64_t mem_mask = ~0);
|
||||||
uint64_t bb_slave_64be_r(offs_t offset, uint64_t mem_mask = ~0);
|
uint64_t bb_slave_64be_r(offs_t offset, uint64_t mem_mask = ~0);
|
||||||
|
@ -215,8 +215,8 @@ private:
|
|||||||
void UpdateBanks(int first, int last);
|
void UpdateBanks(int first, int last);
|
||||||
void SetDefaultTask();
|
void SetDefaultTask();
|
||||||
void dgn_beta_bank_memory(int offset, int data, int bank);
|
void dgn_beta_bank_memory(int offset, int data, int bank);
|
||||||
int SelectedKeyrow(dgn_beta_state *state, int Rows);
|
int SelectedKeyrow(int Rows);
|
||||||
int GetKeyRow(dgn_beta_state *state, int RowNo);
|
int GetKeyRow(int RowNo);
|
||||||
void cpu0_recalc_irq(int state);
|
void cpu0_recalc_irq(int state);
|
||||||
void cpu0_recalc_firq(int state);
|
void cpu0_recalc_firq(int state);
|
||||||
void cpu1_recalc_firq(int state);
|
void cpu1_recalc_firq(int state);
|
||||||
|
@ -1069,11 +1069,9 @@ uint32_t amstrad_state::screen_update_amstrad(screen_device &screen, bitmap_ind1
|
|||||||
|
|
||||||
|
|
||||||
/* traverses the daisy-chain of expansion devices, looking for the specified device */
|
/* traverses the daisy-chain of expansion devices, looking for the specified device */
|
||||||
static device_t* get_expansion_device(running_machine &machine, const char* tag)
|
device_t* amstrad_state::get_expansion_device(const char* tag)
|
||||||
{
|
{
|
||||||
amstrad_state *state = machine.driver_data<amstrad_state>();
|
cpc_expansion_slot_device* exp_port = m_exp;
|
||||||
cpc_expansion_slot_device* exp_port = state->m_exp;
|
|
||||||
|
|
||||||
while (exp_port != nullptr)
|
while (exp_port != nullptr)
|
||||||
{
|
{
|
||||||
device_t* temp;
|
device_t* temp;
|
||||||
@ -2166,7 +2164,7 @@ The exception is the case where none of b7-b0 are reset (i.e. port &FBFF), which
|
|||||||
m_crtc->set_unscaled_clock( ( m_aleste_mode & 0x02 ) ? ( XTAL(16'000'000) / 8 ) : ( XTAL(16'000'000) / 16 ) );
|
m_crtc->set_unscaled_clock( ( m_aleste_mode & 0x02 ) ? ( XTAL(16'000'000) / 8 ) : ( XTAL(16'000'000) / 16 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
mface2 = dynamic_cast<cpc_multiface2_device*>(get_expansion_device(machine(),"multiface2"));
|
mface2 = dynamic_cast<cpc_multiface2_device*>(get_expansion_device("multiface2"));
|
||||||
if(mface2 != nullptr)
|
if(mface2 != nullptr)
|
||||||
{
|
{
|
||||||
if(mface2->multiface_io_write(offset, data) != 0)
|
if(mface2->multiface_io_write(offset, data) != 0)
|
||||||
@ -2399,7 +2397,7 @@ void amstrad_state::amstrad_rethinkMemory()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* multiface hardware enabled? */
|
/* multiface hardware enabled? */
|
||||||
mface2 = dynamic_cast<cpc_multiface2_device*>(get_expansion_device(machine(),"multiface2"));
|
mface2 = dynamic_cast<cpc_multiface2_device*>(get_expansion_device("multiface2"));
|
||||||
if(mface2 != nullptr)
|
if(mface2 != nullptr)
|
||||||
{
|
{
|
||||||
if (mface2->multiface_hardware_enabled())
|
if (mface2->multiface_hardware_enabled())
|
||||||
@ -2432,7 +2430,7 @@ WRITE_LINE_MEMBER(amstrad_state::screen_vblank_amstrad)
|
|||||||
// rising edge
|
// rising edge
|
||||||
if (state)
|
if (state)
|
||||||
{
|
{
|
||||||
cpc_multiface2_device* mface2 = dynamic_cast<cpc_multiface2_device*>(get_expansion_device(machine(),"multiface2"));
|
cpc_multiface2_device* mface2 = dynamic_cast<cpc_multiface2_device*>(get_expansion_device("multiface2"));
|
||||||
|
|
||||||
if(mface2 != nullptr)
|
if(mface2 != nullptr)
|
||||||
{
|
{
|
||||||
@ -2975,7 +2973,7 @@ void amstrad_state::enumerate_roms()
|
|||||||
|
|
||||||
|
|
||||||
/* add ROMs from ROMbox expansion */
|
/* add ROMs from ROMbox expansion */
|
||||||
device_t* romexp = get_expansion_device(machine(),"rom");
|
device_t* romexp = get_expansion_device("rom");
|
||||||
if(romexp)
|
if(romexp)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 8; i++)
|
for(int i = 0; i < 8; i++)
|
||||||
|
@ -551,16 +551,15 @@ WRITE_LINE_MEMBER(bebox_state::bebox_dma8237_out_eop){
|
|||||||
m_smc37c78->tc_w(state);
|
m_smc37c78->tc_w(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_dma_channel(running_machine &machine, int channel, int state)
|
inline void bebox_state::set_dma_channel(int channel, int state)
|
||||||
{
|
{
|
||||||
bebox_state *drvstate = machine.driver_data<bebox_state>();
|
if (!state) m_dma_channel = channel;
|
||||||
if (!state) drvstate->m_dma_channel = channel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE_LINE_MEMBER(bebox_state::pc_dack0_w){ set_dma_channel(machine(), 0, state); }
|
WRITE_LINE_MEMBER(bebox_state::pc_dack0_w){ set_dma_channel(0, state); }
|
||||||
WRITE_LINE_MEMBER(bebox_state::pc_dack1_w){ set_dma_channel(machine(), 1, state); }
|
WRITE_LINE_MEMBER(bebox_state::pc_dack1_w){ set_dma_channel(1, state); }
|
||||||
WRITE_LINE_MEMBER(bebox_state::pc_dack2_w){ set_dma_channel(machine(), 2, state); }
|
WRITE_LINE_MEMBER(bebox_state::pc_dack2_w){ set_dma_channel(2, state); }
|
||||||
WRITE_LINE_MEMBER(bebox_state::pc_dack3_w){ set_dma_channel(machine(), 3, state); }
|
WRITE_LINE_MEMBER(bebox_state::pc_dack3_w){ set_dma_channel(3, state); }
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
*
|
*
|
||||||
|
@ -260,7 +260,7 @@ than using a walking zero as the OS-9 driver does. This meant that SelectKeyrow
|
|||||||
never moved past the first row, by scanning for the last active row
|
never moved past the first row, by scanning for the last active row
|
||||||
the beta_test rom works, and it does not break the OS-9 driver :)
|
the beta_test rom works, and it does not break the OS-9 driver :)
|
||||||
*/
|
*/
|
||||||
int dgn_beta_state::SelectedKeyrow(dgn_beta_state *state, int Rows)
|
int dgn_beta_state::SelectedKeyrow(int Rows)
|
||||||
{
|
{
|
||||||
int Idx;
|
int Idx;
|
||||||
int Row; /* Row selected */
|
int Row; /* Row selected */
|
||||||
@ -288,7 +288,7 @@ int dgn_beta_state::SelectedKeyrow(dgn_beta_state *state, int Rows)
|
|||||||
|
|
||||||
/* GetKeyRow, returns the value of a keyrow, checking for invalid rows */
|
/* GetKeyRow, returns the value of a keyrow, checking for invalid rows */
|
||||||
/* and returning no key pressed if row is invalid */
|
/* and returning no key pressed if row is invalid */
|
||||||
int dgn_beta_state::GetKeyRow(dgn_beta_state *state, int RowNo)
|
int dgn_beta_state::GetKeyRow(int RowNo)
|
||||||
{
|
{
|
||||||
if(RowNo==INVALID_KEYROW)
|
if(RowNo==INVALID_KEYROW)
|
||||||
return NO_KEY_PRESSED; /* row is invalid, so return no key down */
|
return NO_KEY_PRESSED; /* row is invalid, so return no key down */
|
||||||
@ -336,7 +336,7 @@ uint8_t dgn_beta_state::d_pia0_pb_r()
|
|||||||
|
|
||||||
m_KAny_next = 0;
|
m_KAny_next = 0;
|
||||||
|
|
||||||
Selected = SelectedKeyrow(this, m_RowShifter);
|
Selected = SelectedKeyrow(m_RowShifter);
|
||||||
|
|
||||||
/* Scan the whole keyboard, if output shifter is all low */
|
/* Scan the whole keyboard, if output shifter is all low */
|
||||||
/* This actually scans in the keyboard */
|
/* This actually scans in the keyboard */
|
||||||
@ -352,7 +352,7 @@ uint8_t dgn_beta_state::d_pia0_pb_r()
|
|||||||
}
|
}
|
||||||
else /* Just scan current row, from previously read values */
|
else /* Just scan current row, from previously read values */
|
||||||
{
|
{
|
||||||
if(GetKeyRow(this, Selected) != NO_KEY_PRESSED)
|
if(GetKeyRow(Selected) != NO_KEY_PRESSED)
|
||||||
m_KAny_next = 1;
|
m_KAny_next = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,8 +398,8 @@ WRITE_LINE_MEMBER(dgn_beta_state::d_pia0_cb2_w)
|
|||||||
/* load keyrow on rising edge of CB2 */
|
/* load keyrow on rising edge of CB2 */
|
||||||
if((state==1) && (m_d_pia0_cb2_last==0))
|
if((state==1) && (m_d_pia0_cb2_last==0))
|
||||||
{
|
{
|
||||||
RowNo=SelectedKeyrow(this, m_RowShifter);
|
RowNo=SelectedKeyrow(m_RowShifter);
|
||||||
m_Keyrow=GetKeyRow(this, RowNo);
|
m_Keyrow=GetKeyRow(RowNo);
|
||||||
|
|
||||||
/* Output clock rising edge, clock CB2 value into rowshifterlow to high transition */
|
/* Output clock rising edge, clock CB2 value into rowshifterlow to high transition */
|
||||||
/* In the beta the shift registers are a cmos 4015, and a cmos 4013 in series */
|
/* In the beta the shift registers are a cmos 4015, and a cmos 4013 in series */
|
||||||
|
@ -1113,8 +1113,6 @@ uint32_t n64_periphs::vi_reg_r(offs_t offset, uint32_t mem_mask)
|
|||||||
|
|
||||||
void n64_periphs::vi_reg_w(offs_t offset, uint32_t data, uint32_t mem_mask)
|
void n64_periphs::vi_reg_w(offs_t offset, uint32_t data, uint32_t mem_mask)
|
||||||
{
|
{
|
||||||
//n64_state *state = machine().driver_data<n64_state>();
|
|
||||||
|
|
||||||
switch (offset)
|
switch (offset)
|
||||||
{
|
{
|
||||||
case 0x00/4: // VI_CONTROL_REG
|
case 0x00/4: // VI_CONTROL_REG
|
||||||
|
Loading…
Reference in New Issue
Block a user