summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/machine
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2022-06-15 08:29:55 +0200
committer Miodrag Milanovic <mmicko@gmail.com>2022-06-15 08:29:55 +0200
commit62fd9b344d3f97e3e5e68fc833e2d9be75bc2427 (patch)
tree971f63ab219a20dde00cf8b58d9c783d84c6de5d /src/mame/machine
parent321bdd5e582bc147789001c09ec43e44bc244fe1 (diff)
Cleanup using state object
Diffstat (limited to 'src/mame/machine')
-rw-r--r--src/mame/machine/amstrad.cpp14
-rw-r--r--src/mame/machine/bebox.cpp13
-rw-r--r--src/mame/machine/dgn_beta.cpp12
-rw-r--r--src/mame/machine/n64.cpp2
4 files changed, 18 insertions, 23 deletions
diff --git a/src/mame/machine/amstrad.cpp b/src/mame/machine/amstrad.cpp
index 0910624225e..5e53da7cd68 100644
--- a/src/mame/machine/amstrad.cpp
+++ b/src/mame/machine/amstrad.cpp
@@ -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 */
-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 = state->m_exp;
-
+ cpc_expansion_slot_device* exp_port = m_exp;
while (exp_port != nullptr)
{
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 ) );
}
- 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->multiface_io_write(offset, data) != 0)
@@ -2399,7 +2397,7 @@ void amstrad_state::amstrad_rethinkMemory()
}
/* 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->multiface_hardware_enabled())
@@ -2432,7 +2430,7 @@ WRITE_LINE_MEMBER(amstrad_state::screen_vblank_amstrad)
// rising edge
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)
{
@@ -2975,7 +2973,7 @@ void amstrad_state::enumerate_roms()
/* add ROMs from ROMbox expansion */
- device_t* romexp = get_expansion_device(machine(),"rom");
+ device_t* romexp = get_expansion_device("rom");
if(romexp)
{
for(int i = 0; i < 8; i++)
diff --git a/src/mame/machine/bebox.cpp b/src/mame/machine/bebox.cpp
index dda04ddb2b0..204fc095cc9 100644
--- a/src/mame/machine/bebox.cpp
+++ b/src/mame/machine/bebox.cpp
@@ -551,16 +551,15 @@ WRITE_LINE_MEMBER(bebox_state::bebox_dma8237_out_eop){
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) drvstate->m_dma_channel = channel;
+ if (!state) m_dma_channel = channel;
}
-WRITE_LINE_MEMBER(bebox_state::pc_dack0_w){ set_dma_channel(machine(), 0, state); }
-WRITE_LINE_MEMBER(bebox_state::pc_dack1_w){ set_dma_channel(machine(), 1, state); }
-WRITE_LINE_MEMBER(bebox_state::pc_dack2_w){ set_dma_channel(machine(), 2, state); }
-WRITE_LINE_MEMBER(bebox_state::pc_dack3_w){ set_dma_channel(machine(), 3, 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(1, 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(3, state); }
/*************************************
*
diff --git a/src/mame/machine/dgn_beta.cpp b/src/mame/machine/dgn_beta.cpp
index 57ef3ec8fc7..564609d8c5b 100644
--- a/src/mame/machine/dgn_beta.cpp
+++ b/src/mame/machine/dgn_beta.cpp
@@ -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
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 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 */
/* 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)
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;
- Selected = SelectedKeyrow(this, m_RowShifter);
+ Selected = SelectedKeyrow(m_RowShifter);
/* Scan the whole keyboard, if output shifter is all low */
/* 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 */
{
- if(GetKeyRow(this, Selected) != NO_KEY_PRESSED)
+ if(GetKeyRow(Selected) != NO_KEY_PRESSED)
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 */
if((state==1) && (m_d_pia0_cb2_last==0))
{
- RowNo=SelectedKeyrow(this, m_RowShifter);
- m_Keyrow=GetKeyRow(this, RowNo);
+ RowNo=SelectedKeyrow(m_RowShifter);
+ m_Keyrow=GetKeyRow(RowNo);
/* 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 */
diff --git a/src/mame/machine/n64.cpp b/src/mame/machine/n64.cpp
index ea066f44335..7aabc803b7f 100644
--- a/src/mame/machine/n64.cpp
+++ b/src/mame/machine/n64.cpp
@@ -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)
{
- //n64_state *state = machine().driver_data<n64_state>();
-
switch (offset)
{
case 0x00/4: // VI_CONTROL_REG