summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2012-09-11 15:58:04 +0000
committer Aaron Giles <aaron@aarongiles.com>2012-09-11 15:58:04 +0000
commit0aa418e85b7f7aad5088bc96c9da0c371b15b2f2 (patch)
treee13bbdf8a2ff82faf97aaa23351668d817628966 /src/mess
parent6d8c3c9f2d5d30848751a12c2925fbe53ac8bfec (diff)
In device_state_interface, rename state() to state_int()
and set_state() to set_state_int() for consistency. Update all callers. Also add set_pc() helper and updated all callers to use that instead of set_state_int(STATE_GENPC) [Aaron Giles] Added device_t::state() method to get the state interface. Added redundant device_state_interface::state() method to catch redundant use of it. [Aaron Giles] Removed cpu_get_reg() and cpu_set_reg() macros in favor of using the above methods. [Aaron Giles]
Diffstat (limited to 'src/mess')
-rw-r--r--src/mess/drivers/alphatro.c2
-rw-r--r--src/mess/drivers/altair.c2
-rw-r--r--src/mess/drivers/apexc.c12
-rw-r--r--src/mess/drivers/atm.c2
-rw-r--r--src/mess/drivers/bigbord2.c16
-rw-r--r--src/mess/drivers/bw2.c2
-rw-r--r--src/mess/drivers/ccs2810.c2
-rw-r--r--src/mess/drivers/cd2650.c2
-rw-r--r--src/mess/drivers/cxhumax.c2
-rw-r--r--src/mess/drivers/d6800.c2
-rw-r--r--src/mess/drivers/gba.c4
-rw-r--r--src/mess/drivers/gmaster.c18
-rw-r--r--src/mess/drivers/horizon.c4
-rw-r--r--src/mess/drivers/instruct.c2
-rw-r--r--src/mess/drivers/ipc.c2
-rw-r--r--src/mess/drivers/jupiter.c2
-rw-r--r--src/mess/drivers/lynx.c2
-rw-r--r--src/mess/drivers/mmodular.c2
-rw-r--r--src/mess/drivers/mpf1.c2
-rw-r--r--src/mess/drivers/mz2500.c16
-rw-r--r--src/mess/drivers/p8k.c10
-rw-r--r--src/mess/drivers/pda600.c2
-rw-r--r--src/mess/drivers/pdp1.c82
-rw-r--r--src/mess/drivers/pdp11.c4
-rw-r--r--src/mess/drivers/pegasus.c2
-rw-r--r--src/mess/drivers/pentagon.c2
-rw-r--r--src/mess/drivers/pipbug.c2
-rw-r--r--src/mess/drivers/pockstat.c2
-rw-r--r--src/mess/drivers/psx.c24
-rw-r--r--src/mess/drivers/scorpion.c2
-rw-r--r--src/mess/drivers/smc777.c4
-rw-r--r--src/mess/drivers/spectrum.c4
-rw-r--r--src/mess/drivers/ssem.c6
-rw-r--r--src/mess/drivers/ti89.c2
-rw-r--r--src/mess/drivers/tx0.c106
-rw-r--r--src/mess/drivers/unior.c2
-rw-r--r--src/mess/drivers/vc4000.c4
-rw-r--r--src/mess/drivers/vector4.c2
-rw-r--r--src/mess/drivers/vii.c6
-rw-r--r--src/mess/drivers/vtech1.c2
-rw-r--r--src/mess/drivers/x07.c4
-rw-r--r--src/mess/drivers/xerox820.c4
-rw-r--r--src/mess/drivers/z1013.c4
-rw-r--r--src/mess/drivers/z9001.c2
-rw-r--r--src/mess/formats/ace_ace.c34
-rw-r--r--src/mess/formats/atom_atm.c2
-rw-r--r--src/mess/formats/m65_snqk.c12
-rw-r--r--src/mess/formats/spec_snqk.c56
-rw-r--r--src/mess/formats/trs_cmd.c2
-rw-r--r--src/mess/formats/z80bin.c8
-rw-r--r--src/mess/machine/amstrad.c42
-rw-r--r--src/mess/machine/apple2.c2
-rw-r--r--src/mess/machine/at.c2
-rw-r--r--src/mess/machine/bebox.c4
-rw-r--r--src/mess/machine/c128.c4
-rw-r--r--src/mess/machine/c64_cpm.c2
-rw-r--r--src/mess/machine/dai.c2
-rw-r--r--src/mess/machine/galaxy.c80
-rw-r--r--src/mess/machine/intv.c4
-rw-r--r--src/mess/machine/isa_aha1542.c4
-rw-r--r--src/mess/machine/isa_fdc.c4
-rw-r--r--src/mess/machine/isa_hdc.c8
-rw-r--r--src/mess/machine/kaypro.c6
-rw-r--r--src/mess/machine/kc.c4
-rw-r--r--src/mess/machine/lisa.c6
-rw-r--r--src/mess/machine/lviv.c24
-rw-r--r--src/mess/machine/mac.c4
-rw-r--r--src/mess/machine/mbc55x.c24
-rw-r--r--src/mess/machine/mbee.c4
-rw-r--r--src/mess/machine/mz700.c2
-rw-r--r--src/mess/machine/pc.c6
-rw-r--r--src/mess/machine/pc_fdc.c6
-rw-r--r--src/mess/machine/pecom.c2
-rw-r--r--src/mess/machine/poly88.c2
-rw-r--r--src/mess/machine/primo.c30
-rw-r--r--src/mess/machine/radio86.c2
-rw-r--r--src/mess/machine/rmnimbus.c34
-rw-r--r--src/mess/machine/sorcerer.c34
-rw-r--r--src/mess/machine/ti85.c42
-rw-r--r--src/mess/video/galaxy.c6
-rw-r--r--src/mess/video/pdp1.c56
-rw-r--r--src/mess/video/tx0.c44
-rw-r--r--src/mess/video/vc4000.c10
-rw-r--r--src/mess/video/zx.c10
84 files changed, 506 insertions, 506 deletions
diff --git a/src/mess/drivers/alphatro.c b/src/mess/drivers/alphatro.c
index a02d2bc189f..866613afb88 100644
--- a/src/mess/drivers/alphatro.c
+++ b/src/mess/drivers/alphatro.c
@@ -352,7 +352,7 @@ void alphatro_state::machine_reset()
// do what the IPL does
// UINT8* RAM = machine().device<ram_device>("ram")->pointer();
UINT8* ROM = memregion("maincpu")->base();
- cpu_set_reg(m_maincpu, STATE_GENPC, 0xe000);
+ m_maincpu->set_pc(0xe000);
memcpy(m_p_ram, ROM, 0xf000); // copy BASIC to RAM, which the undumped IPL is supposed to do.
memcpy(m_p_videoram, ROM+0x1000, 0x1000);
// membank("bank1")->set_base(RAM);
diff --git a/src/mess/drivers/altair.c b/src/mess/drivers/altair.c
index 7debe14d708..bb65b2c5aa5 100644
--- a/src/mess/drivers/altair.c
+++ b/src/mess/drivers/altair.c
@@ -107,7 +107,7 @@ static MACHINE_RESET(altair)
{
altair_state *state = machine.driver_data<altair_state>();
// Set startup addess done by turn-key
- cpu_set_reg(machine.device("maincpu"), I8085_PC, 0xFD00);
+ machine.device("maincpu")->state().set_state_int(I8085_PC, 0xFD00);
state->m_term_data = 0;
}
diff --git a/src/mess/drivers/apexc.c b/src/mess/drivers/apexc.c
index 2337d50912e..359e4a8f82a 100644
--- a/src/mess/drivers/apexc.c
+++ b/src/mess/drivers/apexc.c
@@ -421,7 +421,7 @@ static INTERRUPT_GEN( apexc_interrupt )
if (control_transitions & panel_run)
{ /* toggle run/stop state */
- cpu_set_reg(device, APEXC_STATE, ! cpu_get_reg(device, APEXC_STATE));
+ device->state().set_state_int(APEXC_STATE, ! device->state().state_int(APEXC_STATE));
}
while (control_transitions & (panel_CR | panel_A | panel_R | panel_ML | panel_HB))
@@ -463,10 +463,10 @@ static INTERRUPT_GEN( apexc_interrupt )
/* read/write register #reg_id */
if (control_keys & panel_write)
/* write reg */
- cpu_set_reg(device, reg_id, state->m_panel_data_reg);
+ device->state().set_state_int(reg_id, state->m_panel_data_reg);
else
/* read reg */
- state->m_panel_data_reg = cpu_get_reg(device, reg_id);
+ state->m_panel_data_reg = device->state().state_int(reg_id);
}
}
@@ -475,11 +475,11 @@ static INTERRUPT_GEN( apexc_interrupt )
if (control_keys & panel_write) {
/* write memory */
- space->write_dword(cpu_get_reg(device, APEXC_ML_FULL)<<2, state->m_panel_data_reg);
+ space->write_dword(device->state().state_int(APEXC_ML_FULL)<<2, state->m_panel_data_reg);
}
else {
/* read memory */
- state->m_panel_data_reg = space->read_dword(cpu_get_reg(device, APEXC_ML_FULL)<<2);
+ state->m_panel_data_reg = space->read_dword(device->state().state_int(APEXC_ML_FULL)<<2);
}
}
@@ -605,7 +605,7 @@ static SCREEN_UPDATE_IND16( apexc )
apexc_draw_led(bitmap, 0, 0, 1);
- apexc_draw_led(bitmap, 0, 8, cpu_get_reg(screen.machine().device("maincpu"), APEXC_STATE));
+ apexc_draw_led(bitmap, 0, 8, screen.machine().device("maincpu")->state().state_int(APEXC_STATE));
for (i=0; i<32; i++)
{
diff --git a/src/mess/drivers/atm.c b/src/mess/drivers/atm.c
index 16b2e2ea4f4..066ab5217fb 100644
--- a/src/mess/drivers/atm.c
+++ b/src/mess/drivers/atm.c
@@ -35,7 +35,7 @@ public:
DIRECT_UPDATE_MEMBER(atm_state::atm_direct)
{
device_t *beta = machine().device(BETA_DISK_TAG);
- UINT16 pc = cpu_get_reg(machine().device("maincpu"), STATE_GENPCBASE);
+ UINT16 pc = machine().device("maincpu")->state().state_int(STATE_GENPCBASE);
if (beta->started() && betadisk_is_active(beta))
{
diff --git a/src/mess/drivers/bigbord2.c b/src/mess/drivers/bigbord2.c
index 0552a7ebaed..33eefd55694 100644
--- a/src/mess/drivers/bigbord2.c
+++ b/src/mess/drivers/bigbord2.c
@@ -185,14 +185,14 @@ WRITE8_MEMBER( bigbord2_state::bigbord2_kbd_put )
{
// simulate interrupt by saving current pc on
// the stack and jumping to interrupt handler.
- UINT16 spreg = cpu_get_reg(m_maincpu, Z80_SP);
- UINT16 pcreg = cpu_get_reg(m_maincpu, Z80_PC);
+ UINT16 spreg = m_maincpu->state_int(Z80_SP);
+ UINT16 pcreg = m_maincpu->state_int(Z80_PC);
spreg--;
space.write_byte(spreg, pcreg >> 8);
spreg--;
space.write_byte(spreg, pcreg);
- cpu_set_reg(m_maincpu, Z80_SP, spreg);
- cpu_set_reg(m_maincpu, Z80_PC, 0xF120);
+ m_maincpu->set_state_int(Z80_SP, spreg);
+ m_maincpu->set_state_int(Z80_PC, 0xF120);
}
}
}
@@ -424,14 +424,14 @@ WRITE_LINE_MEMBER( bigbord2_state::frame )
framecnt = 0;
// simulate interrupt by saving current pc on
// the stack and jumping to interrupt handler.
- UINT16 spreg = cpu_get_reg(m_maincpu, Z80_SP);
- UINT16 pcreg = cpu_get_reg(m_maincpu, Z80_PC);
+ UINT16 spreg = m_maincpu->state_int(Z80_SP);
+ UINT16 pcreg = m_maincpu->state_int(Z80_PC);
spreg--;
space->write_byte(spreg, pcreg >> 8);
spreg--;
space->write_byte(spreg, pcreg);
- cpu_set_reg(m_maincpu, Z80_SP, spreg);
- cpu_set_reg(m_maincpu, Z80_PC, 0xF18E);
+ m_maincpu->set_state_int(Z80_SP, spreg);
+ m_maincpu->set_state_int(Z80_PC, 0xF18E);
}
}
diff --git a/src/mess/drivers/bw2.c b/src/mess/drivers/bw2.c
index fabe5736224..e724fe1e632 100644
--- a/src/mess/drivers/bw2.c
+++ b/src/mess/drivers/bw2.c
@@ -224,7 +224,7 @@ WRITE_LINE_MEMBER( bw2_state::fdc_drq_w )
{
if (state)
{
- if (cpu_get_reg(m_maincpu, Z80_HALT))
+ if (m_maincpu->state_int(Z80_HALT))
{
device_set_input_line(m_maincpu, INPUT_LINE_NMI, HOLD_LINE);
}
diff --git a/src/mess/drivers/ccs2810.c b/src/mess/drivers/ccs2810.c
index 160b1cc40b4..56b1b4e9318 100644
--- a/src/mess/drivers/ccs2810.c
+++ b/src/mess/drivers/ccs2810.c
@@ -112,7 +112,7 @@ static GENERIC_TERMINAL_INTERFACE( terminal_intf )
MACHINE_RESET_MEMBER(ccs2810_state)
{
- cpu_set_reg(m_maincpu, Z80_PC, 0xf000);
+ m_maincpu->set_state_int(Z80_PC, 0xf000);
m_26_count = 0x41;
}
diff --git a/src/mess/drivers/cd2650.c b/src/mess/drivers/cd2650.c
index 72791ef8e87..1cf4c1b82b1 100644
--- a/src/mess/drivers/cd2650.c
+++ b/src/mess/drivers/cd2650.c
@@ -247,7 +247,7 @@ QUICKLOAD_LOAD( cd2650 )
image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr);
// Start the quickload
- cpu_set_reg(image.device().machine().device("maincpu"), STATE_GENPC, exec_addr);
+ image.device().machine().device("maincpu")->state().set_pc(exec_addr);
return IMAGE_INIT_PASS;
}
diff --git a/src/mess/drivers/cxhumax.c b/src/mess/drivers/cxhumax.c
index f82247ee089..5a42354d15f 100644
--- a/src/mess/drivers/cxhumax.c
+++ b/src/mess/drivers/cxhumax.c
@@ -159,7 +159,7 @@ READ32_MEMBER( cxhumax_state::cx_scratch_r )
memset(buf,0,200);
int i = 0;
- while ((temp=program->read_byte(cpu_get_reg(m_maincpu, ARM7_R0)+i))) {
+ while ((temp=program->read_byte(m_maincpu->state_int(ARM7_R0)+i))) {
buf[i++]=temp;
//m_terminal->write(space, 0, temp);
}
diff --git a/src/mess/drivers/d6800.c b/src/mess/drivers/d6800.c
index 471566b7a3f..2db7581020e 100644
--- a/src/mess/drivers/d6800.c
+++ b/src/mess/drivers/d6800.c
@@ -350,7 +350,7 @@ static QUICKLOAD_LOAD( d6800 )
image.message(" Quickload: size=%04X : start=%04X : end=%04X : exec=%04X",quick_length,quick_addr,quick_addr+quick_length,exec_addr);
// Start the quickload
- cpu_set_reg(image.device().machine().device("maincpu"), STATE_GENPC, exec_addr);
+ image.device().machine().device("maincpu")->state().set_pc(exec_addr);
return IMAGE_INIT_PASS;
}
diff --git a/src/mess/drivers/gba.c b/src/mess/drivers/gba.c
index db265e819f2..38452d36fc7 100644
--- a/src/mess/drivers/gba.c
+++ b/src/mess/drivers/gba.c
@@ -1959,8 +1959,8 @@ READ32_MEMBER(gba_state::gba_10000000_r)
{
UINT32 data, cpsr, pc;
cpu_device *cpu = downcast<cpu_device *>(machine().device( "maincpu"));
- pc = cpu_get_reg( cpu, ARM7_PC);
- cpsr = cpu_get_reg( cpu, ARM7_CPSR);
+ pc = cpu->state_int( ARM7_PC);
+ cpsr = cpu->state_int( ARM7_CPSR);
if (T_IS_SET( cpsr))
{
data = space.read_dword( pc + 8);
diff --git a/src/mess/drivers/gmaster.c b/src/mess/drivers/gmaster.c
index cd2fdd67c7a..515290c7696 100644
--- a/src/mess/drivers/gmaster.c
+++ b/src/mess/drivers/gmaster.c
@@ -18,7 +18,7 @@ READ8_MEMBER(gmaster_state::gmaster_io_r)
if (m_gmachine.ports[2] & 1)
{
data = memregion("maincpu")->base()[0x4000 + offset];
- logerror("%.4x external memory %.4x read %.2x\n", (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), 0x4000 + offset, data);
+ logerror("%.4x external memory %.4x read %.2x\n", (int)space.device().state().state_int(CPUINFO_INT_PC), 0x4000 + offset, data);
}
else
{
@@ -26,13 +26,13 @@ READ8_MEMBER(gmaster_state::gmaster_io_r)
{
case 1:
data=m_video.pixels[m_video.y][m_video.x];
- logerror("%.4x lcd x:%.2x y:%.2x %.4x read %.2x\n", (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), m_video.x, m_video.y, 0x4000 + offset, data);
+ logerror("%.4x lcd x:%.2x y:%.2x %.4x read %.2x\n", (int)space.device().state().state_int(CPUINFO_INT_PC), m_video.x, m_video.y, 0x4000 + offset, data);
if (!(m_video.mode) && m_video.delayed)
m_video.x++;
m_video.delayed = TRUE;
break;
default:
- logerror("%.4x memory %.4x read %.2x\n", (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), 0x4000 + offset, data);
+ logerror("%.4x memory %.4x read %.2x\n", (int)space.device().state().state_int(CPUINFO_INT_PC), 0x4000 + offset, data);
}
}
return data;
@@ -45,7 +45,7 @@ WRITE8_MEMBER(gmaster_state::gmaster_io_w)
if (m_gmachine.ports[2] & 1)
{
memregion("maincpu")->base()[0x4000 + offset] = data;
- logerror("%.4x external memory %.4x written %.2x\n", (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), 0x4000 + offset, data);
+ logerror("%.4x external memory %.4x written %.2x\n", (int)space.device().state().state_int(CPUINFO_INT_PC), 0x4000 + offset, data);
}
else
{
@@ -53,7 +53,7 @@ WRITE8_MEMBER(gmaster_state::gmaster_io_w)
{
case 0:
m_video.delayed=FALSE;
- logerror("%.4x lcd %.4x written %.2x\n", (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), 0x4000 + offset, data);
+ logerror("%.4x lcd %.4x written %.2x\n", (int)space.device().state().state_int(CPUINFO_INT_PC), 0x4000 + offset, data);
// e2 af a4 a0 a9 falling block init for both halves
if ((data & 0xfc) == 0xb8)
{
@@ -77,7 +77,7 @@ WRITE8_MEMBER(gmaster_state::gmaster_io_w)
if (m_video.x < ARRAY_LENGTH(m_video.pixels[0])) // continental galaxy flutlicht
m_video.pixels[m_video.y][m_video.x] = data;
logerror("%.4x lcd x:%.2x y:%.2x %.4x written %.2x\n",
- (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), m_video.x, m_video.y, 0x4000 + offset, data);
+ (int)space.device().state().state_int(CPUINFO_INT_PC), m_video.x, m_video.y, 0x4000 + offset, data);
m_video.x++;
/* 02 b8 1a
02 bb 1a
@@ -95,7 +95,7 @@ WRITE8_MEMBER(gmaster_state::gmaster_io_w)
*/
break;
default:
- logerror("%.4x memory %.4x written %.2x\n", (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), 0x4000 + offset, data);
+ logerror("%.4x memory %.4x written %.2x\n", (int)space.device().state().state_int(CPUINFO_INT_PC), 0x4000 + offset, data);
}
}
}
@@ -110,7 +110,7 @@ READ8_MEMBER(gmaster_state::gmaster_port_r)
data = ioport("JOY")->read();
break;
default:
- logerror("%.4x port %d read %.2x\n", (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), offset, data);
+ logerror("%.4x port %d read %.2x\n", (int)space.device().state().state_int(CPUINFO_INT_PC), offset, data);
}
return data;
}
@@ -118,7 +118,7 @@ READ8_MEMBER(gmaster_state::gmaster_port_r)
WRITE8_MEMBER(gmaster_state::gmaster_port_w)
{
m_gmachine.ports[offset] = data;
- logerror("%.4x port %d written %.2x\n", (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), offset, data);
+ logerror("%.4x port %d written %.2x\n", (int)space.device().state().state_int(CPUINFO_INT_PC), offset, data);
switch (offset)
{
case UPD7810_PORTC:
diff --git a/src/mess/drivers/horizon.c b/src/mess/drivers/horizon.c
index 512cc3576c6..965c07e9d3e 100644
--- a/src/mess/drivers/horizon.c
+++ b/src/mess/drivers/horizon.c
@@ -62,12 +62,12 @@ INPUT_PORTS_END
static MACHINE_RESET(horizon)
{
- cpu_set_reg(machine.device("maincpu"), Z80_PC, 0xe800);
+ machine.device("maincpu")->state().set_state_int(Z80_PC, 0xe800);
}
static MACHINE_RESET(horizon_sd)
{
- cpu_set_reg(machine.device("maincpu"), Z80_PC, 0xe900);
+ machine.device("maincpu")->state().set_state_int(Z80_PC, 0xe900);
}
WRITE8_MEMBER( horizon_state::kbd_put )
diff --git a/src/mess/drivers/instruct.c b/src/mess/drivers/instruct.c
index a1564e115a0..d717eb1fd50 100644
--- a/src/mess/drivers/instruct.c
+++ b/src/mess/drivers/instruct.c
@@ -282,7 +282,7 @@ QUICKLOAD_LOAD( instruct )
image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr);
// Start the quickload
- cpu_set_reg(image.device().machine().device("maincpu"), STATE_GENPC, exec_addr);
+ image.device().machine().device("maincpu")->state().set_pc(exec_addr);
return IMAGE_INIT_PASS;
}
diff --git a/src/mess/drivers/ipc.c b/src/mess/drivers/ipc.c
index 232f5429d23..41ca1b9d3c8 100644
--- a/src/mess/drivers/ipc.c
+++ b/src/mess/drivers/ipc.c
@@ -97,7 +97,7 @@ INPUT_PORTS_END
MACHINE_RESET_MEMBER(ipc_state)
{
- cpu_set_reg(machine().device("maincpu"), I8085_PC, 0xE800);
+ machine().device("maincpu")->state().set_state_int(I8085_PC, 0xE800);
}
WRITE8_MEMBER( ipc_state::kbd_put )
diff --git a/src/mess/drivers/jupiter.c b/src/mess/drivers/jupiter.c
index b9bbc7b02c2..99d54e0d686 100644
--- a/src/mess/drivers/jupiter.c
+++ b/src/mess/drivers/jupiter.c
@@ -242,7 +242,7 @@ void jupiter3_state::machine_reset()
{
UINT8* ROM = memregion(Z80_TAG)->base();
memcpy(m_p_ram, ROM, 0x1000);
- cpu_set_reg(m_maincpu, STATE_GENPC, 0xe000);
+ m_maincpu->set_pc(0xe000);
}
diff --git a/src/mess/drivers/lynx.c b/src/mess/drivers/lynx.c
index 18241ac884a..7e37373f729 100644
--- a/src/mess/drivers/lynx.c
+++ b/src/mess/drivers/lynx.c
@@ -177,7 +177,7 @@ static QUICKLOAD_LOAD( lynx )
space->write_byte(0x1fc, start & 0xff);
space->write_byte(0x1fd, start >> 8);
- cpu_set_reg(cpu, STATE_GENPC, start);
+ cpu->state().set_pc(start);
return IMAGE_INIT_PASS;
}
diff --git a/src/mess/drivers/mmodular.c b/src/mess/drivers/mmodular.c
index dce6abbb48c..2ff253b204a 100644
--- a/src/mess/drivers/mmodular.c
+++ b/src/mess/drivers/mmodular.c
@@ -947,7 +947,7 @@ WRITE16_MEMBER(polgar_state::write_unknown2)
READ32_MEMBER(polgar_state::read_unknown3_32)
{
- logerror("Read from unknown3 offset: %x %08x\n",offset,(unsigned int) cpu_get_reg(machine().device("maincpu"), M68K_PC));
+ logerror("Read from unknown3 offset: %x %08x\n",offset,(unsigned int) machine().device("maincpu")->state().state_int(M68K_PC));
return 0xffffffff;
//return unknown2_data|unknown2_data<<24;
diff --git a/src/mess/drivers/mpf1.c b/src/mess/drivers/mpf1.c
index 46a324c8c8b..9533fecd929 100644
--- a/src/mess/drivers/mpf1.c
+++ b/src/mess/drivers/mpf1.c
@@ -340,7 +340,7 @@ static TIMER_DEVICE_CALLBACK( check_halt_callback )
// halt-LED; the red one, is turned on when the processor is halted
// TODO: processor seems to halt, but restarts(?) at 0x0000 after a while -> fix
- INT64 led_halt = cpu_get_reg(state->m_maincpu, Z80_HALT);
+ INT64 led_halt = state->m_maincpu->state_int(Z80_HALT);
set_led_status(timer.machine(), 1, led_halt);
}
diff --git a/src/mess/drivers/mz2500.c b/src/mess/drivers/mz2500.c
index 344e981d26b..71514fe3071 100644
--- a/src/mess/drivers/mz2500.c
+++ b/src/mess/drivers/mz2500.c
@@ -1210,7 +1210,7 @@ READ8_MEMBER(mz2500_state::mz2500_rom_r)
UINT8 *rom = memregion("rom")->base();
UINT8 res;
- m_lrom_index = (cpu_get_reg(machine().device("maincpu"), Z80_B));
+ m_lrom_index = (machine().device("maincpu")->state().state_int(Z80_B));
m_rom_index = (m_rom_index & 0xffff00) | (m_lrom_index & 0xff);
@@ -1221,7 +1221,7 @@ READ8_MEMBER(mz2500_state::mz2500_rom_r)
WRITE8_MEMBER(mz2500_state::mz2500_rom_w)
{
- m_hrom_index = (cpu_get_reg(machine().device("maincpu"), Z80_B));
+ m_hrom_index = (machine().device("maincpu")->state().state_int(Z80_B));
m_rom_index = (data << 8) | (m_rom_index & 0x0000ff) | ((m_hrom_index & 0xff)<<16);
//printf("%02x\n",data);
@@ -1233,7 +1233,7 @@ WRITE8_MEMBER(mz2500_state::palette4096_io_w)
UINT8 pal_index;
UINT8 pal_entry;
- pal_index = cpu_get_reg(machine().device("maincpu"), Z80_B);
+ pal_index = machine().device("maincpu")->state().state_int(Z80_B);
pal_entry = (pal_index & 0x1e) >> 1;
if(pal_index & 1)
@@ -1440,14 +1440,14 @@ WRITE8_MEMBER(mz2500_state::mz2500_kanji_w)
READ8_MEMBER(mz2500_state::rp5c15_8_r)
{
- UINT8 rtc_index = (cpu_get_reg(machine().device("maincpu"), Z80_B));
+ UINT8 rtc_index = (machine().device("maincpu")->state().state_int(Z80_B));
return m_rtc->read(space, rtc_index);
}
WRITE8_MEMBER(mz2500_state::rp5c15_8_w)
{
- UINT8 rtc_index = (cpu_get_reg(machine().device("maincpu"), Z80_B));
+ UINT8 rtc_index = (machine().device("maincpu")->state().state_int(Z80_B));
m_rtc->write(space, rtc_index, data);
}
@@ -1458,7 +1458,7 @@ READ8_MEMBER(mz2500_state::mz2500_emm_data_r)
UINT8 *emm_ram = memregion("emm")->base();
UINT8 emm_lo_index;
- emm_lo_index = (cpu_get_reg(machine().device("maincpu"), Z80_B));
+ emm_lo_index = (machine().device("maincpu")->state().state_int(Z80_B));
m_emm_offset = (m_emm_offset & 0xffff00) | (emm_lo_index & 0xff);
@@ -1472,7 +1472,7 @@ WRITE8_MEMBER(mz2500_state::mz2500_emm_addr_w)
{
UINT8 emm_hi_index;
- emm_hi_index = (cpu_get_reg(machine().device("maincpu"), Z80_B));
+ emm_hi_index = (machine().device("maincpu")->state().state_int(Z80_B));
m_emm_offset = ((emm_hi_index & 0xff) << 16) | ((data & 0xff) << 8) | (m_emm_offset & 0xff);
}
@@ -1482,7 +1482,7 @@ WRITE8_MEMBER(mz2500_state::mz2500_emm_data_w)
UINT8 *emm_ram = memregion("emm")->base();
UINT8 emm_lo_index;
- emm_lo_index = (cpu_get_reg(machine().device("maincpu"), Z80_B));
+ emm_lo_index = (machine().device("maincpu")->state().state_int(Z80_B));
m_emm_offset = (m_emm_offset & 0xffff00) | (emm_lo_index & 0xff);
diff --git a/src/mess/drivers/p8k.c b/src/mess/drivers/p8k.c
index fb82f62b6e1..08cb4310a65 100644
--- a/src/mess/drivers/p8k.c
+++ b/src/mess/drivers/p8k.c
@@ -133,7 +133,7 @@ READ8_MEMBER( p8k_state::p8k_port0_r )
// see memory explanation above
WRITE8_MEMBER( p8k_state::p8k_port0_w )
{
- UINT8 breg = cpu_get_reg(m_maincpu, Z80_B) >> 4;
+ UINT8 breg = m_maincpu->state_int(Z80_B) >> 4;
if ((data==1) || (data==2) || (data==4))
{
char banknum[8];
@@ -177,14 +177,14 @@ WRITE8_MEMBER( p8k_state::kbd_put )
// This is a dreadful hack..
// simulate interrupt by saving current pc on
// the stack and jumping to interrupt handler.
- UINT16 spreg = cpu_get_reg(m_maincpu, Z80_SP);
- UINT16 pcreg = cpu_get_reg(m_maincpu, Z80_PC);
+ UINT16 spreg = m_maincpu->state_int(Z80_SP);
+ UINT16 pcreg = m_maincpu->state_int(Z80_PC);
spreg--;
space.write_byte(spreg, pcreg >> 8);
spreg--;
space.write_byte(spreg, pcreg);
- cpu_set_reg(m_maincpu, Z80_SP, spreg);
- cpu_set_reg(m_maincpu, Z80_PC, 0x078A);
+ m_maincpu->set_state_int(Z80_SP, spreg);
+ m_maincpu->set_state_int(Z80_PC, 0x078A);
}
static GENERIC_TERMINAL_INTERFACE( terminal_intf )
diff --git a/src/mess/drivers/pda600.c b/src/mess/drivers/pda600.c
index 78ca5567a23..79a10ed773b 100644
--- a/src/mess/drivers/pda600.c
+++ b/src/mess/drivers/pda600.c
@@ -104,7 +104,7 @@ void pda600_state::machine_reset()
{
// the PDA600 soon after start waits for something from the Z180 CSIO, I do not know exactly for what
// the CSIO is used and for now I forced the CNTR End-Flag bit to 1 for allow the emulation to continue.
- cpu_set_reg(m_maincpu, Z180_CNTR, cpu_get_reg(m_maincpu, Z180_CNTR) | 0x80);
+ m_maincpu->set_state_int(Z180_CNTR, m_maincpu->state_int(Z180_CNTR) | 0x80);
}
void pda600_state::video_start()
diff --git a/src/mess/drivers/pdp1.c b/src/mess/drivers/pdp1.c
index 721ed0f4d07..8316f4ec30f 100644
--- a/src/mess/drivers/pdp1.c
+++ b/src/mess/drivers/pdp1.c
@@ -935,7 +935,7 @@ static TIMER_CALLBACK(reader_callback)
state->m_tape_reader.rcl = 0;
if (state->m_tape_reader.rcp)
{
- cpu_set_reg(machine.device("maincpu"), PDP1_IO, state->m_tape_reader.rb); /* transfer reader buffer to IO */
+ machine.device("maincpu")->state().set_state_int(PDP1_IO, state->m_tape_reader.rb); /* transfer reader buffer to IO */
pdp1_pulse_iot_done(machine.device("maincpu"));
}
else
@@ -1444,7 +1444,7 @@ static void iot_dpy(device_t *device, int op2, int nac, int mb, int *io, int ac)
{
state->m_io_status |= io_st_pen;
- cpu_set_reg(device->machine().device("maincpu"), PDP1_PF3, 1);
+ device->machine().device("maincpu")->state().set_state_int(PDP1_PF3, 1);
}
if (nac)
@@ -1606,7 +1606,7 @@ static void iot_dcc(device_t *device, int op2, int nac, int mb, int *io, int ac)
} while (state->m_parallel_drum.wc);
device_adjust_icount(device->machine().device("maincpu"),-device->machine().device<cpu_device>("maincpu")->attotime_to_cycles(delay));
/* if no error, skip */
- cpu_set_reg(device->machine().device("maincpu"), PDP1_PC, cpu_get_reg(device->machine().device("maincpu"), PDP1_PC)+1);
+ device->machine().device("maincpu")->state().set_state_int(PDP1_PC, device->machine().device("maincpu")->state().state_int(PDP1_PC)+1);
}
static void iot_dra(device_t *device, int op2, int nac, int mb, int *io, int ac)
@@ -1737,7 +1737,7 @@ static void pdp1_keyboard(running_machine &machine)
#if USE_SBS
cputag_set_input_line_and_vector(machine, "maincpu", 0, ASSERT_LINE, 0); /* interrupt it, baby */
#endif
- cpu_set_reg(machine.device("maincpu"), PDP1_PF1, 1);
+ machine.device("maincpu")->state().set_state_int(PDP1_PF1, 1);
pdp1_typewriter_drawchar(machine, state->m_typewriter.tb); /* we want to echo input */
break;
}
@@ -1816,7 +1816,7 @@ INTERRUPT_GEN( pdp1_interrupt )
int ta_transitions;
- cpu_set_reg(device, PDP1_SS, device->machine().root_device().ioport("SENSE")->read());
+ device->state().set_state_int(PDP1_SS, device->machine().root_device().ioport("SENSE")->read());
/* read new state of control keys */
control_keys = state->ioport("CSW")->read();
@@ -1828,68 +1828,68 @@ INTERRUPT_GEN( pdp1_interrupt )
if (control_transitions & pdp1_extend)
{
- cpu_set_reg(device, PDP1_EXTEND_SW, ! cpu_get_reg(device, PDP1_EXTEND_SW));
+ device->state().set_state_int(PDP1_EXTEND_SW, ! device->state().state_int(PDP1_EXTEND_SW));
}
if (control_transitions & pdp1_start_nobrk)
{
pdp1_pulse_start_clear(device); /* pulse Start Clear line */
- cpu_set_reg(device, PDP1_EXD, cpu_get_reg(device, PDP1_EXTEND_SW));
- cpu_set_reg(device, PDP1_SBM, (UINT64)0);
- cpu_set_reg(device, PDP1_OV, (UINT64)0);
- cpu_set_reg(device, PDP1_PC, cpu_get_reg(device, PDP1_TA));
- cpu_set_reg(device, PDP1_RUN, 1);
+ device->state().set_state_int(PDP1_EXD, device->state().state_int(PDP1_EXTEND_SW));
+ device->state().set_state_int(PDP1_SBM, (UINT64)0);
+ device->state().set_state_int(PDP1_OV, (UINT64)0);
+ device->state().set_state_int(PDP1_PC, device->state().state_int(PDP1_TA));
+ device->state().set_state_int(PDP1_RUN, 1);
}
if (control_transitions & pdp1_start_brk)
{
pdp1_pulse_start_clear(device); /* pulse Start Clear line */
- cpu_set_reg(device, PDP1_EXD, cpu_get_reg(device, PDP1_EXTEND_SW));
- cpu_set_reg(device, PDP1_SBM, 1);
- cpu_set_reg(device, PDP1_OV, (UINT64)0);
- cpu_set_reg(device, PDP1_PC, cpu_get_reg(device, PDP1_TA));
- cpu_set_reg(device, PDP1_RUN, 1);
+ device->state().set_state_int(PDP1_EXD, device->state().state_int(PDP1_EXTEND_SW));
+ device->state().set_state_int(PDP1_SBM, 1);
+ device->state().set_state_int(PDP1_OV, (UINT64)0);
+ device->state().set_state_int(PDP1_PC, device->state().state_int(PDP1_TA));
+ device->state().set_state_int(PDP1_RUN, 1);
}
if (control_transitions & pdp1_stop)
{
- cpu_set_reg(device, PDP1_RUN, (UINT64)0);
- cpu_set_reg(device, PDP1_RIM, (UINT64)0); /* bug : we stop after reading an even-numbered word
+ device->state().set_state_int(PDP1_RUN, (UINT64)0);
+ device->state().set_state_int(PDP1_RIM, (UINT64)0); /* bug : we stop after reading an even-numbered word
(i.e. data), whereas a real pdp-1 stops after reading
an odd-numbered word (i.e. dio instruciton) */
}
if (control_transitions & pdp1_continue)
{
- cpu_set_reg(device, PDP1_RUN, 1);
+ device->state().set_state_int(PDP1_RUN, 1);
}
if (control_transitions & pdp1_examine)
{
pdp1_pulse_start_clear(device); /* pulse Start Clear line */
- cpu_set_reg(device, PDP1_PC, cpu_get_reg(device, PDP1_TA));
- cpu_set_reg(device, PDP1_MA, cpu_get_reg(device, PDP1_PC));
- cpu_set_reg(device, PDP1_IR, LAC); /* this instruction is actually executed */
+ device->state().set_state_int(PDP1_PC, device->state().state_int(PDP1_TA));
+ device->state().set_state_int(PDP1_MA, device->state().state_int(PDP1_PC));
+ device->state().set_state_int(PDP1_IR, LAC); /* this instruction is actually executed */
- cpu_set_reg(device, PDP1_MB, (signed)device->memory().space(AS_PROGRAM)->read_dword(PDP1_MA<<2));
- cpu_set_reg(device, PDP1_AC, cpu_get_reg(device, PDP1_MB));
+ device->state().set_state_int(PDP1_MB, (signed)device->memory().space(AS_PROGRAM)->read_dword(PDP1_MA<<2));
+ device->state().set_state_int(PDP1_AC, device->state().state_int(PDP1_MB));
}
if (control_transitions & pdp1_deposit)
{
pdp1_pulse_start_clear(device); /* pulse Start Clear line */
- cpu_set_reg(device, PDP1_PC, cpu_get_reg(device, PDP1_TA));
- cpu_set_reg(device, PDP1_MA, cpu_get_reg(device, PDP1_PC));
- cpu_set_reg(device, PDP1_AC, cpu_get_reg(device, PDP1_TW));
- cpu_set_reg(device, PDP1_IR, DAC); /* this instruction is actually executed */
+ device->state().set_state_int(PDP1_PC, device->state().state_int(PDP1_TA));
+ device->state().set_state_int(PDP1_MA, device->state().state_int(PDP1_PC));
+ device->state().set_state_int(PDP1_AC, device->state().state_int(PDP1_TW));
+ device->state().set_state_int(PDP1_IR, DAC); /* this instruction is actually executed */
- cpu_set_reg(device, PDP1_MB, cpu_get_reg(device, PDP1_AC));
- device->memory().space(AS_PROGRAM)->write_dword(cpu_get_reg(device, PDP1_MA)<<2, cpu_get_reg(device, PDP1_MB));
+ device->state().set_state_int(PDP1_MB, device->state().state_int(PDP1_AC));
+ device->memory().space(AS_PROGRAM)->write_dword(device->state().state_int(PDP1_MA)<<2, device->state().state_int(PDP1_MB));
}
if (control_transitions & pdp1_read_in)
{ /* set cpu to read instructions from perforated tape */
pdp1_pulse_start_clear(device); /* pulse Start Clear line */
- cpu_set_reg(device, PDP1_PC, ( cpu_get_reg(device, PDP1_TA) & 0170000)
- | (cpu_get_reg(device, PDP1_PC) & 0007777)); /* transfer ETA to EPC */
- /*cpu_set_reg(machine.device("maincpu"), PDP1_MA, cpu_get_reg(machine.device("maincpu"), PDP1_PC));*/
- cpu_set_reg(device, PDP1_EXD, cpu_get_reg(device, PDP1_EXTEND_SW));
- cpu_set_reg(device, PDP1_OV, (UINT64)0); /* right??? */
- cpu_set_reg(device, PDP1_RUN, (UINT64)0);
- cpu_set_reg(device, PDP1_RIM, 1);
+ device->state().set_state_int(PDP1_PC, ( device->state().state_int(PDP1_TA) & 0170000)
+ | (device->state().state_int(PDP1_PC) & 0007777)); /* transfer ETA to EPC */
+ /*machine.device("maincpu")->state().set_state_int(PDP1_MA, machine.device("maincpu")->state().state_int(PDP1_PC));*/
+ device->state().set_state_int(PDP1_EXD, device->state().state_int(PDP1_EXTEND_SW));
+ device->state().set_state_int(PDP1_OV, (UINT64)0); /* right??? */
+ device->state().set_state_int(PDP1_RUN, (UINT64)0);
+ device->state().set_state_int(PDP1_RIM, 1);
}
if (control_transitions & pdp1_reader)
{
@@ -1899,11 +1899,11 @@ INTERRUPT_GEN( pdp1_interrupt )
}
if (control_transitions & pdp1_single_step)
{
- cpu_set_reg(device, PDP1_SNGL_STEP, ! cpu_get_reg(device, PDP1_SNGL_STEP));
+ device->state().set_state_int(PDP1_SNGL_STEP, ! device->state().state_int(PDP1_SNGL_STEP));
}
if (control_transitions & pdp1_single_inst)
{
- cpu_set_reg(device, PDP1_SNGL_INST, ! cpu_get_reg(device, PDP1_SNGL_INST));
+ device->state().set_state_int(PDP1_SNGL_INST, ! device->state().state_int(PDP1_SNGL_INST));
}
/* remember new state of control keys */
@@ -1917,7 +1917,7 @@ INTERRUPT_GEN( pdp1_interrupt )
tw_transitions = tw_keys & (~ state->m_old_tw_keys);
if (tw_transitions)
- cpu_set_reg(device, PDP1_TW, cpu_get_reg(device, PDP1_TW) ^ tw_transitions);
+ device->state().set_state_int(PDP1_TW, device->state().state_int(PDP1_TW) ^ tw_transitions);
/* remember new state of test word keys */
state->m_old_tw_keys = tw_keys;
@@ -1930,7 +1930,7 @@ INTERRUPT_GEN( pdp1_interrupt )
ta_transitions = ta_keys & (~ state->m_old_ta_keys);
if (ta_transitions)
- cpu_set_reg(device, PDP1_TA, cpu_get_reg(device, PDP1_TA) ^ ta_transitions);
+ device->state().set_state_int(PDP1_TA, device->state().state_int(PDP1_TA) ^ ta_transitions);
/* remember new state of test word keys */
state->m_old_ta_keys = ta_keys;
diff --git a/src/mess/drivers/pdp11.c b/src/mess/drivers/pdp11.c
index 027c4bbc58c..598264e8794 100644
--- a/src/mess/drivers/pdp11.c
+++ b/src/mess/drivers/pdp11.c
@@ -280,7 +280,7 @@ static MACHINE_RESET(pdp11ub2)
addr = 0165000;
}
addr += machine.root_device().ioport("S1_2")->read() * 2;
- cpu_set_reg(machine.device("maincpu"), T11_PC, addr);
+ machine.device("maincpu")->state().set_state_int(T11_PC, addr);
}
//0173000
@@ -296,7 +296,7 @@ static MACHINE_RESET(pdp11ub2)
static MACHINE_RESET(pdp11qb)
{
- cpu_set_reg(machine.device("maincpu"), T11_PC, 0xea00);
+ machine.device("maincpu")->state().set_state_int(T11_PC, 0xea00);
}
static const struct t11_setup pdp11_data =
diff --git a/src/mess/drivers/pegasus.c b/src/mess/drivers/pegasus.c
index eda2ad87dc6..48d8d8b8a9e 100644
--- a/src/mess/drivers/pegasus.c
+++ b/src/mess/drivers/pegasus.c
@@ -160,7 +160,7 @@ WRITE8_MEMBER( pegasus_state::pegasus_pcg_w )
/* Must return the A register except when it is doing a rom search */
READ8_MEMBER( pegasus_state::pegasus_protection_r )
{
- UINT8 data = cpu_get_reg(m_maincpu, M6809_A);
+ UINT8 data = m_maincpu->state_int(M6809_A);
if (data == 0x20) data = 0xff;
return data;
}
diff --git a/src/mess/drivers/pentagon.c b/src/mess/drivers/pentagon.c
index aa392750504..b04f339ab7f 100644
--- a/src/mess/drivers/pentagon.c
+++ b/src/mess/drivers/pentagon.c
@@ -22,7 +22,7 @@ public:
DIRECT_UPDATE_MEMBER(pentagon_state::pentagon_direct)
{
device_t *beta = machine().device(BETA_DISK_TAG);
- UINT16 pc = cpu_get_reg(machine().device("maincpu"), STATE_GENPCBASE);
+ UINT16 pc = machine().device("maincpu")->safe_pcbase();
if (beta->started() && betadisk_is_active(beta))
{
diff --git a/src/mess/drivers/pipbug.c b/src/mess/drivers/pipbug.c
index cad3c20df48..0e1d2d812df 100644
--- a/src/mess/drivers/pipbug.c
+++ b/src/mess/drivers/pipbug.c
@@ -156,7 +156,7 @@ QUICKLOAD_LOAD( pipbug )
image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr);
// Start the quickload
- cpu_set_reg(image.device().machine().device("maincpu"), STATE_GENPC, exec_addr);
+ image.device().machine().device("maincpu")->state().set_pc(exec_addr);
return IMAGE_INIT_PASS;
}
diff --git a/src/mess/drivers/pockstat.c b/src/mess/drivers/pockstat.c
index 32b2d3b134a..2c53019aa50 100644
--- a/src/mess/drivers/pockstat.c
+++ b/src/mess/drivers/pockstat.c
@@ -919,7 +919,7 @@ static MACHINE_START( pockstat )
static MACHINE_RESET( pockstat )
{
pockstat_state *state = machine.driver_data<pockstat_state>();
- cpu_set_reg(machine.device("maincpu"), STATE_GENPC, 0x4000000);
+ machine.device("maincpu")->state().set_pc(0x4000000);
state->m_ps_flash_write_enable_count = 0;
state->m_ps_flash_write_count = 0;
diff --git a/src/mess/drivers/psx.c b/src/mess/drivers/psx.c
index 45f2cd987e3..b3469ace327 100644
--- a/src/mess/drivers/psx.c
+++ b/src/mess/drivers/psx.c
@@ -164,13 +164,13 @@ static int load_psxexe( device_t *cpu, unsigned char *p_n_file, int n_len )
n_size--;
}
- cpu_set_reg( cpu, PSXCPU_PC, psxexe_header->pc0 );
- cpu_set_reg( cpu, PSXCPU_R28, psxexe_header->gp0 );
+ cpu->state().set_state_int( PSXCPU_PC, psxexe_header->pc0 );
+ cpu->state().set_state_int( PSXCPU_R28, psxexe_header->gp0 );
n_stack = psxexe_header->s_addr + psxexe_header->s_size;
if( n_stack != 0 )
{
- cpu_set_reg( cpu, PSXCPU_R29, n_stack );
- cpu_set_reg( cpu, PSXCPU_R30, n_stack );
+ cpu->state().set_state_int( PSXCPU_R29, n_stack );
+ cpu->state().set_state_int( PSXCPU_R30, n_stack );
}
return 1;
@@ -183,37 +183,37 @@ static void cpe_set_register( device_t *cpu, int n_reg, int n_value )
if( n_reg < 0x80 && ( n_reg % 4 ) == 0 )
{
logerror( "psx_exe_load: r%-2d %08x\n", n_reg / 4, n_value );
- cpu_set_reg( cpu, PSXCPU_R0 + ( n_reg / 4 ), n_value );
+ cpu->state().set_state_int( PSXCPU_R0 + ( n_reg / 4 ), n_value );
}
else if( n_reg == 0x80 )
{
logerror( "psx_exe_load: lo %08x\n", n_value );
- cpu_set_reg( cpu, PSXCPU_LO, n_value );
+ cpu->state().set_state_int( PSXCPU_LO, n_value );
}
else if( n_reg == 0x84 )
{
logerror( "psx_exe_load: hi %08x\n", n_value );
- cpu_set_reg( cpu, PSXCPU_HI, n_value );
+ cpu->state().set_state_int( PSXCPU_HI, n_value );
}
else if( n_reg == 0x88 )
{
logerror( "psx_exe_load: sr %08x\n", n_value );
- cpu_set_reg( cpu, PSXCPU_CP0R12, n_value );
+ cpu->state().set_state_int( PSXCPU_CP0R12, n_value );
}
else if( n_reg == 0x8c )
{
logerror( "psx_exe_load: cause %08x\n", n_value );
- cpu_set_reg( cpu, PSXCPU_CP0R13, n_value );
+ cpu->state().set_state_int( PSXCPU_CP0R13, n_value );
}
else if( n_reg == 0x90 )
{
logerror( "psx_exe_load: pc %08x\n", n_value );
- cpu_set_reg( cpu, PSXCPU_PC, n_value );
+ cpu->state().set_state_int( PSXCPU_PC, n_value );
}
else if( n_reg == 0x94 )
{
logerror( "psx_exe_load: prid %08x\n", n_value );
- cpu_set_reg( cpu, PSXCPU_CP0R15, n_value );
+ cpu->state().set_state_int( PSXCPU_CP0R15, n_value );
}
else
{
@@ -438,7 +438,7 @@ DIRECT_UPDATE_MEMBER(psx1_state::psx_setopbase)
{
/* DEBUGGER_BREAK; */
- address = cpu_get_reg( cpu, PSXCPU_PC );
+ address = cpu->state().state_int( PSXCPU_PC );
}
else
{
diff --git a/src/mess/drivers/scorpion.c b/src/mess/drivers/scorpion.c
index 8451aa81e30..72e0eda25e5 100644
--- a/src/mess/drivers/scorpion.c
+++ b/src/mess/drivers/scorpion.c
@@ -242,7 +242,7 @@ WRITE8_MEMBER(scorpion_state::scorpion_0000_w)
DIRECT_UPDATE_MEMBER(scorpion_state::scorpion_direct)
{
device_t *beta = machine().device(BETA_DISK_TAG);
- UINT16 pc = cpu_get_reg(machine().device("maincpu"), STATE_GENPCBASE);
+ UINT16 pc = machine().device("maincpu")->safe_pcbase();
m_ram_disabled_by_beta = 0;
if (betadisk_is_active(beta))
diff --git a/src/mess/drivers/smc777.c b/src/mess/drivers/smc777.c
index f60072525ac..109db93057a 100644
--- a/src/mess/drivers/smc777.c
+++ b/src/mess/drivers/smc777.c
@@ -499,7 +499,7 @@ WRITE8_MEMBER(smc777_state::system_output_w)
{
case 0x00:
m_raminh_pending_change = ((data & 0x10) >> 4) ^ 1;
- m_raminh_prefetch = (UINT8)(cpu_get_reg(&space.device(), Z80_R)) & 0x7f;
+ m_raminh_prefetch = (UINT8)(space.device().state().state_int(Z80_R)) & 0x7f;
break;
case 0x02: printf("Interlace %s\n",data & 0x10 ? "on" : "off"); break;
case 0x05: beep_set_state(machine().device(BEEPER_TAG),data & 0x10); break;
@@ -579,7 +579,7 @@ READ8_MEMBER(smc777_state::smc777_mem_r)
if(m_raminh_prefetch != 0xff) //do the bankswitch AFTER that the prefetch instruction is executed (FIXME: this is an hackish implementation)
{
- z80_r = (UINT8)cpu_get_reg(&space.device(), Z80_R);
+ z80_r = (UINT8)space.device().state().state_int(Z80_R);
if(z80_r == ((m_raminh_prefetch+2) & 0x7f))
{
diff --git a/src/mess/drivers/spectrum.c b/src/mess/drivers/spectrum.c
index ca8dcec104e..b498eff0ead 100644
--- a/src/mess/drivers/spectrum.c
+++ b/src/mess/drivers/spectrum.c
@@ -325,9 +325,9 @@ DIRECT_UPDATE_MEMBER(spectrum_state::spectrum_direct)
{
/* Hack for correct handling 0xffff interrupt vector */
if (address == 0x0001)
- if (cpu_get_reg(machine().device("maincpu"), STATE_GENPCBASE)==0xffff)
+ if (machine().device("maincpu")->safe_pcbase()==0xffff)
{
- cpu_set_reg(machine().device("maincpu"), Z80_PC, 0xfff4);
+ machine().device("maincpu")->state().set_state_int(Z80_PC, 0xfff4);
return 0xfff4;
}
return address;
diff --git a/src/mess/drivers/ssem.c b/src/mess/drivers/ssem.c
index 659e1d3fbee..7bafe52e713 100644
--- a/src/mess/drivers/ssem.c
+++ b/src/mess/drivers/ssem.c
@@ -202,7 +202,7 @@ static INPUT_CHANGED( panel_check )
case PANEL_HALT:
if(misc_state & 0x04)
{
- cpu_set_reg(ssem_cpu, SSEM_HALT, 1 - cpu_get_reg(ssem_cpu, SSEM_HALT));
+ ssem_cpu->state().set_state_int(SSEM_HALT, 1 - ssem_cpu->state().state_int(SSEM_HALT));
}
break;
}
@@ -446,7 +446,7 @@ static SCREEN_UPDATE_RGB32( ssem )
ssem_state *state = screen.machine().driver_data<ssem_state>();
UINT32 line = 0;
device_t *ssem_cpu = screen.machine().device("maincpu");
- UINT32 accum = cpu_get_reg(ssem_cpu, SSEM_A);
+ UINT32 accum = ssem_cpu->state().state_int(SSEM_A);
UINT32 bit = 0;
UINT32 word = 0;
@@ -485,7 +485,7 @@ static SCREEN_UPDATE_RGB32( ssem )
(state->m_store[(state->m_store_line << 2) | 1] << 16) |
(state->m_store[(state->m_store_line << 2) | 2] << 8) |
(state->m_store[(state->m_store_line << 2) | 3] << 0));
- glyph_print(screen.machine(), bitmap, 0, 272, "LINE:%02d VALUE:%08x HALT:%d", state->m_store_line, word, cpu_get_reg(ssem_cpu, SSEM_HALT));
+ glyph_print(screen.machine(), bitmap, 0, 272, "LINE:%02d VALUE:%08x HALT:%d", state->m_store_line, word, ssem_cpu->state().state_int(SSEM_HALT));
return 0;
}
diff --git a/src/mess/drivers/ti89.c b/src/mess/drivers/ti89.c
index 32e95deb39a..3686180a2d2 100644
--- a/src/mess/drivers/ti89.c
+++ b/src/mess/drivers/ti89.c
@@ -464,7 +464,7 @@ void ti68k_state::machine_start()
void ti68k_state::machine_reset()
{
- m_maincpu->set_state(M68K_PC, m_initial_pc);
+ m_maincpu->set_state_int(M68K_PC, m_initial_pc);
m_kb_mask = 0xff;
m_on_key = 0;
diff --git a/src/mess/drivers/tx0.c b/src/mess/drivers/tx0.c
index b6149ef4d4b..50a4b5708e0 100644
--- a/src/mess/drivers/tx0.c
+++ b/src/mess/drivers/tx0.c
@@ -652,20 +652,20 @@ static TIMER_CALLBACK(reader_callback)
if (data & 0100)
{
/* read current AC */
- ac = cpu_get_reg(machine.device("maincpu"), TX0_AC);
+ ac = machine.device("maincpu")->state().state_int(TX0_AC);
/* cycle right */
ac = (ac >> 1) | ((ac & 1) << 17);
/* shuffle and insert data into AC */
ac = (ac /*& 0333333*/) | ((data & 001) << 17) | ((data & 002) << 13) | ((data & 004) << 9) | ((data & 010) << 5) | ((data & 020) << 1) | ((data & 040) >> 3);
/* write modified AC */
- cpu_set_reg(machine.device("maincpu"), TX0_AC, ac);
+ machine.device("maincpu")->state().set_state_int(TX0_AC, ac);
state->m_tape_reader.rc = (state->m_tape_reader.rc+1) & 3;
if (state->m_tape_reader.rc == 0)
{ /* IO complete */
state->m_tape_reader.rcl = 0;
- cpu_set_reg(machine.device("maincpu"), TX0_IO_COMPLETE, (UINT64)0);
+ machine.device("maincpu")->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0);
}
}
}
@@ -701,7 +701,7 @@ void tx0_punchtape_image_device::call_unload()
static TIMER_CALLBACK(puncher_callback)
{
- cpu_set_reg(machine.device("maincpu"), TX0_IO_COMPLETE, (UINT64)0);
+ machine.device("maincpu")->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0);
}
/*
@@ -731,7 +731,7 @@ static void tx0_io_p6h(device_t *device)
int ac;
/* read current AC */
- ac = cpu_get_reg(device, TX0_AC);
+ ac = device->state().state_int(TX0_AC);
/* shuffle and punch 6-bit word */
tape_write(state, ((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5));
@@ -747,7 +747,7 @@ static void tx0_io_p7h(device_t *device)
int ac;
/* read current AC */
- ac = cpu_get_reg(device, TX0_AC);
+ ac = device->state().state_int(TX0_AC);
/* shuffle and punch 6-bit word */
tape_write(state, ((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5) | 0100);
@@ -796,7 +796,7 @@ static void typewriter_out(running_machine &machine, UINT8 data)
*/
static TIMER_CALLBACK(prt_callback)
{
- cpu_set_reg(machine.device("maincpu"), TX0_IO_COMPLETE, (UINT64)0);
+ machine.device("maincpu")->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0);
}
/*
@@ -809,7 +809,7 @@ static void tx0_io_prt(device_t *device)
int ch;
/* read current AC */
- ac = cpu_get_reg(device, TX0_AC);
+ ac = device->state().state_int(TX0_AC);
/* shuffle and print 6-bit word */
ch = ((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5);
typewriter_out(device->machine(), ch);
@@ -823,7 +823,7 @@ static void tx0_io_prt(device_t *device)
*/
static TIMER_CALLBACK(dis_callback)
{
- cpu_set_reg(machine.device("maincpu"), TX0_IO_COMPLETE, (UINT64)0);
+ machine.device("maincpu")->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0);
}
/*
@@ -836,7 +836,7 @@ static void tx0_io_dis(device_t *device)
int x;
int y;
- ac = cpu_get_reg(device, TX0_AC);
+ ac = device->state().state_int(TX0_AC);
x = ac >> 9;
y = ac & 0777;
tx0_plot(device->machine(), x, y);
@@ -941,7 +941,7 @@ void tx0_magtape_image_device::call_unload()
if ((state->m_magtape.state == MTS_SELECTED) || ((state->m_magtape.state == MTS_SELECTING) && (state->m_magtape.command == 2)))
{ /* unit has become unavailable */
state->m_magtape.state = MTS_UNSELECTING;
- cpu_set_reg(machine().device("maincpu"), TX0_PF, cpu_get_reg(machine().device("maincpu"), TX0_PF) | PF_RWC);
+ machine().device("maincpu")->state().set_state_int(TX0_PF, machine().device("maincpu")->state().state_int(TX0_PF) | PF_RWC);
schedule_unselect(state);
}
}
@@ -963,12 +963,12 @@ static void magtape_callback(device_t *device)
{
int mar;
- mar = cpu_get_reg(device, TX0_MAR);
+ mar = device->state().state_int(TX0_MAR);
if ((mar & 03) != 1)
{ /* unimplemented device: remain in unselected state and set rwc
flag? */
- cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_RWC);
+ device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_RWC);
}
else
{
@@ -983,7 +983,7 @@ static void magtape_callback(device_t *device)
}
state->m_magtape.sel_pending = FALSE;
- cpu_set_reg(device, TX0_IO_COMPLETE, (UINT64)0);
+ device->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0);
}
break;
@@ -1026,7 +1026,7 @@ static void magtape_callback(device_t *device)
if (state->m_magtape.img->ftell() == 0)
{ /* tape at ldp */
state->m_magtape.state = MTS_UNSELECTING;
- cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_RWC);
+ device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_RWC);
schedule_unselect(state);
}
else if (state->m_magtape.img->fseek( -1, SEEK_CUR))
@@ -1095,7 +1095,7 @@ static void magtape_callback(device_t *device)
logerror("invalid longitudinal parity\n");
/* set EOR and unselect... */
state->m_magtape.state = MTS_UNSELECTING;
- cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_EOR);
+ device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_EOR);
schedule_unselect(state);
state->m_magtape.irg_pos = MTIRGP_ENDMINUS1;
}
@@ -1151,7 +1151,7 @@ static void magtape_callback(device_t *device)
/*state->m_magtape.img->unload();*/
/* Or do we stop at EOT mark??? */
state->m_magtape.state = MTS_UNSELECTING;
- cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_EOT);
+ device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_EOT);
schedule_unselect(state);
}
}
@@ -1168,12 +1168,12 @@ static void magtape_callback(device_t *device)
if (state->m_magtape.cpy_pending)
{ /* read command */
state->m_magtape.u.read.space_flag = FALSE;
- cpu_set_reg(device, TX0_IO_COMPLETE, (UINT64)0);
- cpu_set_reg(device, TX0_LR, ((cpu_get_reg(device, TX0_LR) >> 1) & 0333333)
+ device->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0);
+ device->state().set_state_int(TX0_LR, ((device->state().state_int(TX0_LR) >> 1) & 0333333)
| ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2));
/* check parity */
if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ state->m_magtape.binary_flag))
- cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_PC);
+ device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_PC);
}
else
{ /* space command */
@@ -1192,11 +1192,11 @@ static void magtape_callback(device_t *device)
}
if (!state->m_magtape.u.read.space_flag)
{
- cpu_set_reg(device, TX0_LR, ((cpu_get_reg(device, TX0_LR) >> 1) & 0333333)
+ device->state().set_state_int(TX0_LR, ((device->state().state_int(TX0_LR) >> 1) & 0333333)
| ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2));
/* check parity */
if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ state->m_magtape.binary_flag))
- cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_PC);
+ device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_PC);
}
state->m_magtape.u.read.state = MTRDS_STATE2;
break;
@@ -1210,16 +1210,16 @@ static void magtape_callback(device_t *device)
}
if (!state->m_magtape.u.read.space_flag)
{
- cpu_set_reg(device, TX0_LR, ((cpu_get_reg(device, TX0_LR) >> 1) & 0333333)
+ device->state().set_state_int(TX0_LR, ((device->state().state_int(TX0_LR) >> 1) & 0333333)
| ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2));
/* check parity */
if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ state->m_magtape.binary_flag))
- cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_PC);
+ device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_PC);
/* synchronize with cpy instruction */
if (state->m_magtape.cpy_pending)
- cpu_set_reg(device, TX0_IO_COMPLETE, (UINT64)0);
+ device->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0);
else
- cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_RWC);
+ device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_RWC);
}
state->m_magtape.u.read.state = MTRDS_STATE3;
break;
@@ -1231,11 +1231,11 @@ static void magtape_callback(device_t *device)
state->m_magtape.u.read.state = MTRDS_STATE1;
if (!state->m_magtape.u.read.space_flag)
{
- cpu_set_reg(device, TX0_LR, ((cpu_get_reg(device, TX0_LR) >> 1) & 0333333)
+ device->state().set_state_int(TX0_LR, ((device->state().state_int(TX0_LR) >> 1) & 0333333)
| ((buf & 040) << 12) | ((buf & 020) << 10) | ((buf & 010) << 8) | ((buf & 004) << 6) | ((buf & 002) << 4) | ((buf & 001) << 2));
/* check parity */
if (! (((buf ^ (buf >> 1) ^ (buf >> 2) ^ (buf >> 3) ^ (buf >> 4) ^ (buf >> 5) ^ (buf >> 6) ^ (buf >> 7)) & 1) ^ state->m_magtape.binary_flag))
- cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_PC);
+ device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_PC);
}
}
else
@@ -1275,11 +1275,11 @@ static void magtape_callback(device_t *device)
logerror("invalid longitudinal parity\n");
/* no idea if the original tx-0 magtape controller
checks parity, but can't harm if we do */
- cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_PC);
+ device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_PC);
}
/* set EOR and unselect... */
state->m_magtape.state = MTS_UNSELECTING;
- cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_EOR);
+ device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_EOR);
schedule_unselect(state);
state->m_magtape.irg_pos = MTIRGP_START;
break;
@@ -1317,20 +1317,20 @@ static void magtape_callback(device_t *device)
if (state->m_magtape.u.write.counter)
{
state->m_magtape.u.write.counter--;
- lr = cpu_get_reg(device, TX0_LR);
+ lr = device->state().state_int(TX0_LR);
buf = ((lr >> 10) & 040) | ((lr >> 8) & 020) | ((lr >> 6) & 010) | ((lr >> 4) & 004) | ((lr >> 2) & 002) | (lr & 001);
buf |= ((buf << 1) ^ (buf << 2) ^ (buf << 3) ^ (buf << 4) ^ (buf << 5) ^ (buf << 6) ^ ((!state->m_magtape.binary_flag) << 6)) & 0100;
- cpu_set_reg(device, TX0_LR, lr >> 1);
+ device->state().set_state_int(TX0_LR, lr >> 1);
}
else
{
if (state->m_magtape.cpy_pending)
{
- cpu_set_reg(device, TX0_IO_COMPLETE, (UINT64)0);
- lr = cpu_get_reg(device, TX0_LR);
+ device->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0);
+ lr = device->state().state_int(TX0_LR);
buf = ((lr >> 10) & 040) | ((lr >> 8) & 020) | ((lr >> 6) & 010) | ((lr >> 4) & 004) | ((lr >> 2) & 002) | (lr & 001);
buf |= ((buf << 1) ^ (buf << 2) ^ (buf << 3) ^ (buf << 4) ^ (buf << 5) ^ (buf << 6) ^ ((!state->m_magtape.binary_flag) << 6)) & 0100;
- cpu_set_reg(device, TX0_LR, lr >> 1);
+ device->state().set_state_int(TX0_LR, lr >> 1);
state->m_magtape.u.write.counter = 2;
break;
}
@@ -1409,7 +1409,7 @@ static void tx0_io_cpy(device_t *device)
case MTS_UNSELECTED:
case MTS_UNSELECTING:
/* ignore instruction and set rwc flag? */
- cpu_set_reg(device, TX0_IO_COMPLETE, (UINT64)0);
+ device->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0);
break;
case MTS_SELECTING:
@@ -1419,7 +1419,7 @@ static void tx0_io_cpy(device_t *device)
case 0: /* backspace */
case 2: /* rewind */
/* ignore instruction and set rwc flag? */
- cpu_set_reg(device, TX0_IO_COMPLETE, (UINT64)0);
+ device->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0);
break;
case 1: /* read */
case 3: /* write */
@@ -1487,7 +1487,7 @@ static void tx0_keyboard(running_machine &machine)
previous LR */
lr = (1 << 17) | ((charcode & 040) << 10) | ((charcode & 020) << 8) | ((charcode & 010) << 6) | ((charcode & 004) << 4) | ((charcode & 002) << 2) | ((charcode & 001) << 1);
/* write modified LR */
- cpu_set_reg(machine.device("maincpu"), TX0_LR, lr);
+ machine.device("maincpu")->state().set_state_int(TX0_LR, lr);
tx0_typewriter_drawchar(machine, charcode); /* we want to echo input */
break;
}
@@ -1520,31 +1520,31 @@ static INTERRUPT_GEN( tx0_interrupt )
if (control_transitions & tx0_stop_cyc0)
{
- cpu_set_reg(device->machine().device("maincpu"), TX0_STOP_CYC0, !cpu_get_reg(device->machine().device("maincpu"), TX0_STOP_CYC0));
+ device->machine().device("maincpu")->state().set_state_int(TX0_STOP_CYC0, !device->machine().device("maincpu")->state().state_int(TX0_STOP_CYC0));
}
if (control_transitions & tx0_stop_cyc1)
{
- cpu_set_reg(device->machine().device("maincpu"), TX0_STOP_CYC1, !cpu_get_reg(device->machine().device("maincpu"), TX0_STOP_CYC1));
+ device->machine().device("maincpu")->state().set_state_int(TX0_STOP_CYC1, !device->machine().device("maincpu")->state().state_int(TX0_STOP_CYC1));
}
if (control_transitions & tx0_gbl_cm_sel)
{
- cpu_set_reg(device->machine().device("maincpu"), TX0_GBL_CM_SEL, !cpu_get_reg(device->machine().device("maincpu"), TX0_GBL_CM_SEL));
+ device->machine().device("maincpu")->state().set_state_int(TX0_GBL_CM_SEL, !device->machine().device("maincpu")->state().state_int(TX0_GBL_CM_SEL));
}
if (control_transitions & tx0_stop)
{
- cpu_set_reg(device->machine().device("maincpu"), TX0_RUN, (UINT64)0);
- cpu_set_reg(device->machine().device("maincpu"), TX0_RIM, (UINT64)0);
+ device->machine().device("maincpu")->state().set_state_int(TX0_RUN, (UINT64)0);
+ device->machine().device("maincpu")->state().set_state_int(TX0_RIM, (UINT64)0);
}
if (control_transitions & tx0_restart)
{
- cpu_set_reg(device->machine().device("maincpu"), TX0_RUN, 1);
- cpu_set_reg(device->machine().device("maincpu"), TX0_RIM, (UINT64)0);
+ device->machine().device("maincpu")->state().set_state_int(TX0_RUN, 1);
+ device->machine().device("maincpu")->state().set_state_int(TX0_RIM, (UINT64)0);
}
if (control_transitions & tx0_read_in)
{ /* set cpu to read instructions from perforated tape */
- cpu_set_reg(device->machine().device("maincpu"), TX0_RESET, (UINT64)0);
- cpu_set_reg(device->machine().device("maincpu"), TX0_RUN, (UINT64)0);
- cpu_set_reg(device->machine().device("maincpu"), TX0_RIM, 1);
+ device->machine().device("maincpu")->state().set_state_int(TX0_RESET, (UINT64)0);
+ device->machine().device("maincpu")->state().set_state_int(TX0_RUN, (UINT64)0);
+ device->machine().device("maincpu")->state().set_state_int(TX0_RIM, 1);
}
if (control_transitions & tx0_toggle_dn)
{
@@ -1562,16 +1562,16 @@ static INTERRUPT_GEN( tx0_interrupt )
{
if (state->m_tsr_index >= 2)
{
- UINT32 cm_sel = (UINT32) cpu_get_reg(device->machine().device("maincpu"), TX0_CM_SEL);
- cpu_set_reg(device->machine().device("maincpu"), TX0_CM_SEL, cm_sel ^ (1 << (state->m_tsr_index - 2)));
+ UINT32 cm_sel = (UINT32) device->machine().device("maincpu")->state().state_int(TX0_CM_SEL);
+ device->machine().device("maincpu")->state().set_state_int(TX0_CM_SEL, cm_sel ^ (1 << (state->m_tsr_index - 2)));
}
}
if (control_transitions & tx0_lr_sel)
{
if (state->m_tsr_index >= 2)
{
- UINT32 lr_sel = (UINT32) cpu_get_reg(device->machine().device("maincpu"), TX0_LR_SEL);
- cpu_set_reg(device->machine().device("maincpu"), TX0_LR_SEL, (lr_sel ^ (1 << (state->m_tsr_index - 2))));
+ UINT32 lr_sel = (UINT32) device->machine().device("maincpu")->state().state_int(TX0_LR_SEL);
+ device->machine().device("maincpu")->state().set_state_int(TX0_LR_SEL, (lr_sel ^ (1 << (state->m_tsr_index - 2))));
}
}
@@ -1587,7 +1587,7 @@ static INTERRUPT_GEN( tx0_interrupt )
/* update toggle switch register */
if (tsr_transitions)
- cpu_set_reg(device->machine().device("maincpu"), TX0_TBR+state->m_tsr_index, cpu_get_reg(device->machine().device("maincpu"), TX0_TBR+state->m_tsr_index) ^ tsr_transitions);
+ device->machine().device("maincpu")->state().set_state_int(TX0_TBR+state->m_tsr_index, device->machine().device("maincpu")->state().state_int(TX0_TBR+state->m_tsr_index) ^ tsr_transitions);
/* remember new state of toggle switch register keys */
state->m_old_tsr_keys = tsr_keys;
diff --git a/src/mess/drivers/unior.c b/src/mess/drivers/unior.c
index 520d76a6966..65ca0e5999b 100644
--- a/src/mess/drivers/unior.c
+++ b/src/mess/drivers/unior.c
@@ -238,7 +238,7 @@ INPUT_PORTS_END
static MACHINE_RESET(unior)
{
- cpu_set_reg(machine.device("maincpu"), I8085_PC, 0xF800);
+ machine.device("maincpu")->state().set_state_int(I8085_PC, 0xF800);
}
static VIDEO_START( unior )
diff --git a/src/mess/drivers/vc4000.c b/src/mess/drivers/vc4000.c
index 80117e3be23..9d93e843666 100644
--- a/src/mess/drivers/vc4000.c
+++ b/src/mess/drivers/vc4000.c
@@ -580,7 +580,7 @@ QUICKLOAD_LOAD(vc4000)
image.message(" Quickload: size=%04X : start=%04X : end=%04X : exec=%04X",quick_length-5,quick_addr,quick_addr+quick_length-5,exec_addr);
// Start the quickload
- cpu_set_reg(image.device().machine().device("maincpu"), STATE_GENPC, exec_addr);
+ image.device().machine().device("maincpu")->state().set_pc(exec_addr);
return IMAGE_INIT_PASS;
}
else
@@ -625,7 +625,7 @@ QUICKLOAD_LOAD(vc4000)
image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr);
// Start the quickload
- cpu_set_reg(image.device().machine().device("maincpu"), STATE_GENPC, exec_addr);
+ image.device().machine().device("maincpu")->state().set_pc(exec_addr);
return IMAGE_INIT_PASS;
}
else
diff --git a/src/mess/drivers/vector4.c b/src/mess/drivers/vector4.c
index 17d63ec9743..b310edfebf9 100644
--- a/src/mess/drivers/vector4.c
+++ b/src/mess/drivers/vector4.c
@@ -74,7 +74,7 @@ static MACHINE_RESET(vector4)
{
vector4_state *state = machine.driver_data<vector4_state>();
state->m_term_data = 0;
- cpu_set_reg(machine.device("maincpu"), Z80_PC, 0xe000);
+ machine.device("maincpu")->state().set_state_int(Z80_PC, 0xe000);
}
WRITE8_MEMBER( vector4_state::kbd_put )
diff --git a/src/mess/drivers/vii.c b/src/mess/drivers/vii.c
index 9b407893a90..a955210106e 100644
--- a/src/mess/drivers/vii.c
+++ b/src/mess/drivers/vii.c
@@ -666,7 +666,7 @@ READ16_MEMBER( vii_state::vii_io_r )
break;
case 0x2f: // Data Segment
- val = cpu_get_reg(machine().device("maincpu"), UNSP_SR) >> 10;
+ val = machine().device("maincpu")->state().state_int(UNSP_SR) >> 10;
verboselog(machine(), 3, "vii_io_r: Data Segment = %04x (%04x)\n", val, mem_mask);
break;
@@ -757,8 +757,8 @@ WRITE16_MEMBER( vii_state::vii_io_w )
break;
case 0x2f: // Data Segment
- temp = cpu_get_reg(machine().device("maincpu"), UNSP_SR);
- cpu_set_reg(machine().device("maincpu"), UNSP_SR, (temp & 0x03ff) | ((data & 0x3f) << 10));
+ temp = machine().device("maincpu")->state().state_int(UNSP_SR);
+ machine().device("maincpu")->state().set_state_int(UNSP_SR, (temp & 0x03ff) | ((data & 0x3f) << 10));
verboselog(machine(), 3, "vii_io_w: Data Segment = %04x (%04x)\n", data, mem_mask);
break;
diff --git a/src/mess/drivers/vtech1.c b/src/mess/drivers/vtech1.c
index a5ec81b29b5..c05af7292c4 100644
--- a/src/mess/drivers/vtech1.c
+++ b/src/mess/drivers/vtech1.c
@@ -256,7 +256,7 @@ static SNAPSHOT_LOAD( vtech1 )
space->write_byte(0x788e, start % 256); /* usr subroutine address */
space->write_byte(0x788f, start / 256);
image.message(" %s (M)\nsize=%04X : start=%04X : end=%04X",pgmname,size,start,end);
- cpu_set_reg(image.device().machine().device("maincpu"), STATE_GENPC, start); /* start program */
+ image.device().machine().device("maincpu")->state().set_pc(start); /* start program */
break;
default:
diff --git a/src/mess/drivers/x07.c b/src/mess/drivers/x07.c
index d35bb832df7..af4ba357c47 100644
--- a/src/mess/drivers/x07.c
+++ b/src/mess/drivers/x07.c
@@ -975,7 +975,7 @@ INPUT_CHANGED_MEMBER( x07_state::kb_break )
if (!m_lcd_on)
{
m_lcd_on = 1;
- cpu_set_reg(m_maincpu, Z80_PC, 0xc3c3);
+ m_maincpu->set_state_int(Z80_PC, 0xc3c3);
}
else
{
@@ -1489,7 +1489,7 @@ void x07_state::machine_reset()
m_regs_r[2] = ioport("CARDBATTERY")->read();
- cpu_set_reg(m_maincpu, Z80_PC, 0xc3c3);
+ m_maincpu->set_state_int(Z80_PC, 0xc3c3);
}
static const cassette_interface x07_cassette_interface =
diff --git a/src/mess/drivers/xerox820.c b/src/mess/drivers/xerox820.c
index 2603ddea2ee..00374dcf478 100644
--- a/src/mess/drivers/xerox820.c
+++ b/src/mess/drivers/xerox820.c
@@ -594,7 +594,7 @@ static const z80_daisy_config xerox820_daisy_chain[] =
WRITE_LINE_MEMBER( xerox820_state::intrq_w )
{
- int halt = cpu_get_reg(m_maincpu, Z80_HALT);
+ int halt = m_maincpu->state_int(Z80_HALT);
m_fdc_irq = state;
@@ -606,7 +606,7 @@ WRITE_LINE_MEMBER( xerox820_state::intrq_w )
WRITE_LINE_MEMBER( xerox820_state::drq_w )
{
- int halt = cpu_get_reg(m_maincpu, Z80_HALT);
+ int halt = m_maincpu->state_int(Z80_HALT);
m_fdc_drq = state;
diff --git a/src/mess/drivers/z1013.c b/src/mess/drivers/z1013.c
index 37c850c0846..062e50310c3 100644
--- a/src/mess/drivers/z1013.c
+++ b/src/mess/drivers/z1013.c
@@ -257,7 +257,7 @@ SCREEN_UPDATE_IND16( z1013 )
MACHINE_RESET( z1013 )
{
z1013_state *state = machine.driver_data<z1013_state>();
- cpu_set_reg(machine.device("maincpu"), Z80_PC, 0xF000);
+ machine.device("maincpu")->state().set_state_int(Z80_PC, 0xF000);
state->m_keyboard_part = 0;
state->m_keyboard_line = 0;
}
@@ -352,7 +352,7 @@ SNAPSHOT_LOAD( z1013 )
data+0x20, endaddr - startaddr + 1);
if (runaddr)
- cpu_set_reg(image.device().machine().device("maincpu"), Z80_PC, runaddr);
+ image.device().machine().device("maincpu")->state().set_state_int(Z80_PC, runaddr);
else
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Loaded but cannot run");
diff --git a/src/mess/drivers/z9001.c b/src/mess/drivers/z9001.c
index 6f01e1a622a..4d82b537da6 100644
--- a/src/mess/drivers/z9001.c
+++ b/src/mess/drivers/z9001.c
@@ -153,7 +153,7 @@ static TIMER_DEVICE_CALLBACK( timer_callback )
MACHINE_RESET_MEMBER( z9001_state )
{
beep_set_frequency(m_beeper, 800);
- cpu_set_reg(m_maincpu, Z80_PC, 0xf000);
+ m_maincpu->set_state_int(Z80_PC, 0xf000);
}
VIDEO_START_MEMBER( z9001_state )
diff --git a/src/mess/formats/ace_ace.c b/src/mess/formats/ace_ace.c
index a7bd4547341..267441c2344 100644
--- a/src/mess/formats/ace_ace.c
+++ b/src/mess/formats/ace_ace.c
@@ -85,25 +85,25 @@ SNAPSHOT_LOAD( ace )
if ((ace_index & 0x3FFF)==0)
{
- cpu_set_reg(cpu, Z80_AF, RAM[0x2100] | (RAM[0x2101] << 8));
- cpu_set_reg(cpu, Z80_BC, RAM[0x2104] | (RAM[0x2105] << 8));
- cpu_set_reg(cpu, Z80_DE, RAM[0x2108] | (RAM[0x2109] << 8));
- cpu_set_reg(cpu, Z80_HL, RAM[0x210c] | (RAM[0x210d] << 8));
- cpu_set_reg(cpu, Z80_IX, RAM[0x2110] | (RAM[0x2111] << 8));
- cpu_set_reg(cpu, Z80_IY, RAM[0x2114] | (RAM[0x2115] << 8));
- cpu_set_reg(cpu, STATE_GENPC, RAM[0x211c] | (RAM[0x211d] << 8));
- cpu_set_reg(cpu, Z80_AF2, RAM[0x2120] | (RAM[0x2121] << 8));
- cpu_set_reg(cpu, Z80_BC2, RAM[0x2124] | (RAM[0x2125] << 8));
- cpu_set_reg(cpu, Z80_DE2, RAM[0x2128] | (RAM[0x2129] << 8));
- cpu_set_reg(cpu, Z80_HL2, RAM[0x212c] | (RAM[0x212d] << 8));
- cpu_set_reg(cpu, Z80_IM, RAM[0x2130]);
- cpu_set_reg(cpu, Z80_IFF1, RAM[0x2134]);
- cpu_set_reg(cpu, Z80_IFF2, RAM[0x2138]);
- cpu_set_reg(cpu, Z80_I, RAM[0x213c]);
- cpu_set_reg(cpu, Z80_R, RAM[0x2140]);
+ cpu->set_state_int(Z80_AF, RAM[0x2100] | (RAM[0x2101] << 8));
+ cpu->set_state_int(Z80_BC, RAM[0x2104] | (RAM[0x2105] << 8));
+ cpu->set_state_int(Z80_DE, RAM[0x2108] | (RAM[0x2109] << 8));
+ cpu->set_state_int(Z80_HL, RAM[0x210c] | (RAM[0x210d] << 8));
+ cpu->set_state_int(Z80_IX, RAM[0x2110] | (RAM[0x2111] << 8));
+ cpu->set_state_int(Z80_IY, RAM[0x2114] | (RAM[0x2115] << 8));
+ cpu->set_pc(RAM[0x211c] | (RAM[0x211d] << 8));
+ cpu->set_state_int(Z80_AF2, RAM[0x2120] | (RAM[0x2121] << 8));
+ cpu->set_state_int(Z80_BC2, RAM[0x2124] | (RAM[0x2125] << 8));
+ cpu->set_state_int(Z80_DE2, RAM[0x2128] | (RAM[0x2129] << 8));
+ cpu->set_state_int(Z80_HL2, RAM[0x212c] | (RAM[0x212d] << 8));
+ cpu->set_state_int(Z80_IM, RAM[0x2130]);
+ cpu->set_state_int(Z80_IFF1, RAM[0x2134]);
+ cpu->set_state_int(Z80_IFF2, RAM[0x2138]);
+ cpu->set_state_int(Z80_I, RAM[0x213c]);
+ cpu->set_state_int(Z80_R, RAM[0x2140]);
if ((RAM[0x2119] < 0x80) || !ace_index)
- cpu_set_reg(cpu, STATE_GENSP, RAM[0x2118] | (RAM[0x2119] << 8));
+ cpu->set_state_int(STATE_GENSP, RAM[0x2118] | (RAM[0x2119] << 8));
}
/* Copy data to the address space */
diff --git a/src/mess/formats/atom_atm.c b/src/mess/formats/atom_atm.c
index fbaba0f4ed3..88f7bef2a94 100644
--- a/src/mess/formats/atom_atm.c
+++ b/src/mess/formats/atom_atm.c
@@ -70,7 +70,7 @@ QUICKLOAD_LOAD( atom_atm )
image_fread_memory(image, start_address, size);
- cpu_set_reg(image.device().machine().firstcpu, STATE_GENPC, run_address);
+ image.device().machine().firstcpu->set_pc(run_address);
return IMAGE_INIT_PASS;
}
diff --git a/src/mess/formats/m65_snqk.c b/src/mess/formats/m65_snqk.c
index 4a48588802e..2a2b6bfed86 100644
--- a/src/mess/formats/m65_snqk.c
+++ b/src/mess/formats/m65_snqk.c
@@ -207,12 +207,12 @@ static void microtan_set_cpu_regs(running_machine &machine,const UINT8 *snapshot
logerror("microtan_snapshot_copy: PC:%02X%02X P:%02X A:%02X X:%02X Y:%02X SP:1%02X",
snapshot_buff[base+1], snapshot_buff[base+0], snapshot_buff[base+2], snapshot_buff[base+3],
snapshot_buff[base+4], snapshot_buff[base+5], snapshot_buff[base+6]);
- cpu_set_reg(machine.device("maincpu"), M6502_PC, snapshot_buff[base+0] + 256 * snapshot_buff[base+1]);
- cpu_set_reg(machine.device("maincpu"), M6502_P, snapshot_buff[base+2]);
- cpu_set_reg(machine.device("maincpu"), M6502_A, snapshot_buff[base+3]);
- cpu_set_reg(machine.device("maincpu"), M6502_X, snapshot_buff[base+4]);
- cpu_set_reg(machine.device("maincpu"), M6502_Y, snapshot_buff[base+5]);
- cpu_set_reg(machine.device("maincpu"), M6502_S, snapshot_buff[base+6]);
+ machine.device("maincpu")->state().set_state_int(M6502_PC, snapshot_buff[base+0] + 256 * snapshot_buff[base+1]);
+ machine.device("maincpu")->state().set_state_int(M6502_P, snapshot_buff[base+2]);
+ machine.device("maincpu")->state().set_state_int(M6502_A, snapshot_buff[base+3]);
+ machine.device("maincpu")->state().set_state_int(M6502_X, snapshot_buff[base+4]);
+ machine.device("maincpu")->state().set_state_int(M6502_Y, snapshot_buff[base+5]);
+ machine.device("maincpu")->state().set_state_int(M6502_S, snapshot_buff[base+6]);
}
static void microtan_snapshot_copy(running_machine &machine, UINT8 *snapshot_buff, int snapshot_size)
diff --git a/src/mess/formats/spec_snqk.c b/src/mess/formats/spec_snqk.c
index 959d8dd6895..7a6f7726117 100644
--- a/src/mess/formats/spec_snqk.c
+++ b/src/mess/formats/spec_snqk.c
@@ -34,7 +34,7 @@
#define LOAD_REG(_cpu, _reg, _data) \
do { \
- cpu_set_reg(_cpu, _reg, (_data)); \
+ _cpu->state().set_state_int(_reg, (_data)); \
} while (0)
#define EXEC_NA "N/A"
@@ -609,7 +609,7 @@ void spectrum_setup_sna(running_machine &machine, UINT8 *snapdata, UINT32 snapsi
space->write_byte(BASE_RAM + i, snapdata[SNA48_HDR + i]);
/* Get PC from stack */
- addr = cpu_get_reg(cpu, Z80_SP);
+ addr = cpu->state().state_int(Z80_SP);
if (addr < BASE_RAM || addr > 4*SPECTRUM_BANK - 2)
logerror("Corrupted SP out of range:%04X", addr);
@@ -626,7 +626,7 @@ void spectrum_setup_sna(running_machine &machine, UINT8 *snapdata, UINT32 snapsi
addr += 2;
logerror("Fixing SP:%04X\n", addr);
- cpu_set_reg(cpu, Z80_SP, addr);
+ cpu->state().set_state_int(Z80_SP, addr);
/* Set border color */
data = snapdata[SNA48_OFFSET + 26] & 0x07;
@@ -951,7 +951,7 @@ void spectrum_setup_prg(running_machine &machine, UINT8 *snapdata, UINT32 snapsi
addr += 6;
logerror("Fixing SP:%04X\n", addr);
- cpu_set_reg(cpu, Z80_SP, addr);
+ cpu->state().set_state_int(Z80_SP, addr);
/* Set border color */
data = (space->read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable.
@@ -1153,7 +1153,7 @@ void spectrum_setup_plusd(running_machine &machine, UINT8 *snapdata, UINT32 snap
addr += 6;
logerror("Fixing SP:%04X\n", addr);
- cpu_set_reg(cpu, Z80_SP, addr);
+ cpu->state().set_state_int(Z80_SP, addr);
/* Set border color */
data = (space->read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable.
@@ -1886,7 +1886,7 @@ void spectrum_setup_snx(running_machine &machine, UINT8 *snapdata, UINT32 snapsi
spectrum_snx_decompress_block(machine, snapdata, BASE_RAM, 3*SPECTRUM_BANK);
/* get pc from stack */
- addr = cpu_get_reg(cpu, Z80_SP);
+ addr = cpu->state().state_int(Z80_SP);
if (addr < BASE_RAM || addr > 4*SPECTRUM_BANK - 2)
logerror("Corrupted SP out of range:%04X", addr);
@@ -1902,7 +1902,7 @@ void spectrum_setup_snx(running_machine &machine, UINT8 *snapdata, UINT32 snapsi
addr += 2;
logerror("Fixed the stack at SP:%04X\n", addr);
- cpu_set_reg(cpu, Z80_SP, addr);
+ cpu->state().set_state_int(Z80_SP, addr);
/* Set border color */
data = snapdata[SNX_OFFSET + 32] & 0x07;
@@ -2235,27 +2235,27 @@ void spectrum_setup_z80(running_machine &machine, UINT8 *snapdata, UINT32 snapsi
/* AF */
hi = snapdata[0] & 0x0ff;
lo = snapdata[1] & 0x0ff;
- cpu_set_reg(machine.device("maincpu"), Z80_AF, (hi << 8) | lo);
+ machine.device("maincpu")->state().set_state_int(Z80_AF, (hi << 8) | lo);
/* BC */
lo = snapdata[2] & 0x0ff;
hi = snapdata[3] & 0x0ff;
- cpu_set_reg(machine.device("maincpu"), Z80_BC, (hi << 8) | lo);
+ machine.device("maincpu")->state().set_state_int(Z80_BC, (hi << 8) | lo);
/* HL */
lo = snapdata[4] & 0x0ff;
hi = snapdata[5] & 0x0ff;
- cpu_set_reg(machine.device("maincpu"), Z80_HL, (hi << 8) | lo);
+ machine.device("maincpu")->state().set_state_int(Z80_HL, (hi << 8) | lo);
/* SP */
lo = snapdata[8] & 0x0ff;
hi = snapdata[9] & 0x0ff;
- cpu_set_reg(machine.device("maincpu"), Z80_SP, (hi << 8) | lo);
+ machine.device("maincpu")->state().set_state_int(Z80_SP, (hi << 8) | lo);
/* I */
- cpu_set_reg(machine.device("maincpu"), Z80_I, (snapdata[10] & 0x0ff));
+ machine.device("maincpu")->state().set_state_int(Z80_I, (snapdata[10] & 0x0ff));
/* R */
data = (snapdata[11] & 0x07f) | ((snapdata[12] & 0x01) << 7);
- cpu_set_reg(machine.device("maincpu"), Z80_R, data);
+ machine.device("maincpu")->state().set_state_int(Z80_R, data);
/* Set border color */
state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | ((snapdata[12] & 0x0e) >> 1);
@@ -2263,42 +2263,42 @@ void spectrum_setup_z80(running_machine &machine, UINT8 *snapdata, UINT32 snapsi
lo = snapdata[13] & 0x0ff;
hi = snapdata[14] & 0x0ff;
- cpu_set_reg(machine.device("maincpu"), Z80_DE, (hi << 8) | lo);
+ machine.device("maincpu")->state().set_state_int(Z80_DE, (hi << 8) | lo);
lo = snapdata[15] & 0x0ff;
hi = snapdata[16] & 0x0ff;
- cpu_set_reg(machine.device("maincpu"), Z80_BC2, (hi << 8) | lo);
+ machine.device("maincpu")->state().set_state_int(Z80_BC2, (hi << 8) | lo);
lo = snapdata[17] & 0x0ff;
hi = snapdata[18] & 0x0ff;
- cpu_set_reg(machine.device("maincpu"), Z80_DE2, (hi << 8) | lo);
+ machine.device("maincpu")->state().set_state_int(Z80_DE2, (hi << 8) | lo);
lo = snapdata[19] & 0x0ff;
hi = snapdata[20] & 0x0ff;
- cpu_set_reg(machine.device("maincpu"), Z80_HL2, (hi << 8) | lo);
+ machine.device("maincpu")->state().set_state_int(Z80_HL2, (hi << 8) | lo);
hi = snapdata[21] & 0x0ff;
lo = snapdata[22] & 0x0ff;
- cpu_set_reg(machine.device("maincpu"), Z80_AF2, (hi << 8) | lo);
+ machine.device("maincpu")->state().set_state_int(Z80_AF2, (hi << 8) | lo);
lo = snapdata[23] & 0x0ff;
hi = snapdata[24] & 0x0ff;
- cpu_set_reg(machine.device("maincpu"), Z80_IY, (hi << 8) | lo);
+ machine.device("maincpu")->state().set_state_int(Z80_IY, (hi << 8) | lo);
lo = snapdata[25] & 0x0ff;
hi = snapdata[26] & 0x0ff;
- cpu_set_reg(machine.device("maincpu"), Z80_IX, (hi << 8) | lo);
+ machine.device("maincpu")->state().set_state_int(Z80_IX, (hi << 8) | lo);
/* Interrupt Flip/Flop */
if (snapdata[27] == 0)
{
- cpu_set_reg(machine.device("maincpu"), Z80_IFF1, (UINT64)0);
- /* cpu_set_reg(machine.device("maincpu"), Z80_IRQ_STATE, 0); */
+ machine.device("maincpu")->state().set_state_int(Z80_IFF1, (UINT64)0);
+ /* machine.device("maincpu")->state().set_state_int(Z80_IRQ_STATE, 0); */
}
else
{
- cpu_set_reg(machine.device("maincpu"), Z80_IFF1, 1);
- /* cpu_set_reg(machine.device("maincpu"), Z80_IRQ_STATE, 1); */
+ machine.device("maincpu")->state().set_state_int(Z80_IFF1, 1);
+ /* machine.device("maincpu")->state().set_state_int(Z80_IRQ_STATE, 1); */
}
cputag_set_input_line(machine, "maincpu", INPUT_LINE_IRQ0, CLEAR_LINE);
@@ -2314,16 +2314,16 @@ void spectrum_setup_z80(running_machine &machine, UINT8 *snapdata, UINT32 snapsi
{
data = 0;
}
- cpu_set_reg(machine.device("maincpu"), Z80_IFF2, data);
+ machine.device("maincpu")->state().set_state_int(Z80_IFF2, data);
/* Interrupt Mode */
- cpu_set_reg(machine.device("maincpu"), Z80_IM, (snapdata[29] & 0x03));
+ machine.device("maincpu")->state().set_state_int(Z80_IM, (snapdata[29] & 0x03));
if (z80_type == SPECTRUM_Z80_SNAPSHOT_48K_OLD)
{
lo = snapdata[6] & 0x0ff;
hi = snapdata[7] & 0x0ff;
- cpu_set_reg(machine.device("maincpu"), Z80_PC, (hi << 8) | lo);
+ machine.device("maincpu")->state().set_state_int(Z80_PC, (hi << 8) | lo);
spectrum_page_basicrom(machine);
@@ -2348,7 +2348,7 @@ void spectrum_setup_z80(running_machine &machine, UINT8 *snapdata, UINT32 snapsi
lo = snapdata[32] & 0x0ff;
hi = snapdata[33] & 0x0ff;
- cpu_set_reg(machine.device("maincpu"), Z80_PC, (hi << 8) | lo);
+ machine.device("maincpu")->state().set_state_int(Z80_PC, (hi << 8) | lo);
if ((z80_type == SPECTRUM_Z80_SNAPSHOT_128K) || ((z80_type == SPECTRUM_Z80_SNAPSHOT_TS2068) && !strcmp(machine.system().name,"ts2068")))
{
diff --git a/src/mess/formats/trs_cmd.c b/src/mess/formats/trs_cmd.c
index a537a5674cd..90dd6b57b94 100644
--- a/src/mess/formats/trs_cmd.c
+++ b/src/mess/formats/trs_cmd.c
@@ -67,7 +67,7 @@ QUICKLOAD_LOAD( trs80_cmd )
image.fread( &addr, 2);
UINT16 address = (addr[1] << 8) | addr[0];
if (LOG) logerror("/CMD transfer address %04x\n", address);
- cpu_set_reg(image.device().machine().firstcpu, Z80_PC, address);
+ image.device().machine().firstcpu->set_state_int(Z80_PC, address);
}
break;
diff --git a/src/mess/formats/z80bin.c b/src/mess/formats/z80bin.c
index a95823f0814..363fdaad98d 100644
--- a/src/mess/formats/z80bin.c
+++ b/src/mess/formats/z80bin.c
@@ -96,7 +96,7 @@ QUICKLOAD_LOAD( super80 )
autorun = image.device().machine().root_device().ioport("CONFIG")->read_safe(0xFF) & 1;
if (autorun)
- cpu_set_reg(image.device().machine().device("maincpu"), STATE_GENPC, exec_addr);
+ image.device().machine().device("maincpu")->state().set_pc(exec_addr);
}
return IMAGE_INIT_PASS;
@@ -129,7 +129,7 @@ QUICKLOAD_LOAD( mbee_z80bin )
if (autorun)
{
space->write_word(0xa2, execute_address); /* fix warm-start vector to get around some copy-protections */
- cpu_set_reg(cpu, STATE_GENPC, execute_address);
+ cpu->state().set_pc(execute_address);
}
else
{
@@ -194,12 +194,12 @@ QUICKLOAD_LOAD( sorcerer )
if ((execute_address != 0xc858) && autorun)
space->write_word(0xf028, execute_address);
- cpu_set_reg(image.device().machine().device("maincpu"), STATE_GENPC, 0xf01f);
+ image.device().machine().device("maincpu")->state().set_pc(0xf01f);
}
else
{
if (autorun)
- cpu_set_reg(image.device().machine().device("maincpu"), STATE_GENPC, execute_address);
+ image.device().machine().device("maincpu")->state().set_pc(execute_address);
}
}
diff --git a/src/mess/machine/amstrad.c b/src/mess/machine/amstrad.c
index dfe7e5a5bce..b82010070aa 100644
--- a/src/mess/machine/amstrad.c
+++ b/src/mess/machine/amstrad.c
@@ -2184,70 +2184,70 @@ static void amstrad_handle_snapshot(running_machine &machine, unsigned char *pSn
/* init Z80 */
RegData = (pSnapshot[0x011] & 0x0ff) | ((pSnapshot[0x012] & 0x0ff)<<8);
- cpu_set_reg(state->m_maincpu, Z80_AF, RegData);
+ state->m_maincpu->set_state_int(Z80_AF, RegData);
RegData = (pSnapshot[0x013] & 0x0ff) | ((pSnapshot[0x014] & 0x0ff)<<8);
- cpu_set_reg(state->m_maincpu, Z80_BC, RegData);
+ state->m_maincpu->set_state_int(Z80_BC, RegData);
RegData = (pSnapshot[0x015] & 0x0ff) | ((pSnapshot[0x016] & 0x0ff)<<8);
- cpu_set_reg(state->m_maincpu, Z80_DE, RegData);
+ state->m_maincpu->set_state_int(Z80_DE, RegData);
RegData = (pSnapshot[0x017] & 0x0ff) | ((pSnapshot[0x018] & 0x0ff)<<8);
- cpu_set_reg(state->m_maincpu, Z80_HL, RegData);
+ state->m_maincpu->set_state_int(Z80_HL, RegData);
RegData = (pSnapshot[0x019] & 0x0ff) ;
- cpu_set_reg(state->m_maincpu, Z80_R, RegData);
+ state->m_maincpu->set_state_int(Z80_R, RegData);
RegData = (pSnapshot[0x01a] & 0x0ff);
- cpu_set_reg(state->m_maincpu, Z80_I, RegData);
+ state->m_maincpu->set_state_int(Z80_I, RegData);
if ((pSnapshot[0x01b] & 1)==1)
{
- cpu_set_reg(state->m_maincpu, Z80_IFF1, (UINT64)1);
+ state->m_maincpu->set_state_int(Z80_IFF1, (UINT64)1);
}
else
{
- cpu_set_reg(state->m_maincpu, Z80_IFF1, (UINT64)0);
+ state->m_maincpu->set_state_int(Z80_IFF1, (UINT64)0);
}
if ((pSnapshot[0x01c] & 1)==1)
{
- cpu_set_reg(state->m_maincpu, Z80_IFF2, (UINT64)1);
+ state->m_maincpu->set_state_int(Z80_IFF2, (UINT64)1);
}
else
{
- cpu_set_reg(state->m_maincpu, Z80_IFF2, (UINT64)0);
+ state->m_maincpu->set_state_int(Z80_IFF2, (UINT64)0);
}
RegData = (pSnapshot[0x01d] & 0x0ff) | ((pSnapshot[0x01e] & 0x0ff)<<8);
- cpu_set_reg(state->m_maincpu, Z80_IX, RegData);
+ state->m_maincpu->set_state_int(Z80_IX, RegData);
RegData = (pSnapshot[0x01f] & 0x0ff) | ((pSnapshot[0x020] & 0x0ff)<<8);
- cpu_set_reg(state->m_maincpu, Z80_IY, RegData);
+ state->m_maincpu->set_state_int(Z80_IY, RegData);
RegData = (pSnapshot[0x021] & 0x0ff) | ((pSnapshot[0x022] & 0x0ff)<<8);
- cpu_set_reg(state->m_maincpu, Z80_SP, RegData);
- cpu_set_reg(state->m_maincpu, STATE_GENSP, RegData);
+ state->m_maincpu->set_state_int(Z80_SP, RegData);
+ state->m_maincpu->set_state_int(STATE_GENSP, RegData);
RegData = (pSnapshot[0x023] & 0x0ff) | ((pSnapshot[0x024] & 0x0ff)<<8);
- cpu_set_reg(state->m_maincpu, Z80_PC, RegData);
-// cpu_set_reg(state->m_maincpu, REG_SP, RegData);
+ state->m_maincpu->set_state_int(Z80_PC, RegData);
+// state->m_maincpu->set_state_int(REG_SP, RegData);
RegData = (pSnapshot[0x025] & 0x0ff);
- cpu_set_reg(state->m_maincpu, Z80_IM, RegData);
+ state->m_maincpu->set_state_int(Z80_IM, RegData);
RegData = (pSnapshot[0x026] & 0x0ff) | ((pSnapshot[0x027] & 0x0ff)<<8);
- cpu_set_reg(state->m_maincpu, Z80_AF2, RegData);
+ state->m_maincpu->set_state_int(Z80_AF2, RegData);
RegData = (pSnapshot[0x028] & 0x0ff) | ((pSnapshot[0x029] & 0x0ff)<<8);
- cpu_set_reg(state->m_maincpu, Z80_BC2, RegData);
+ state->m_maincpu->set_state_int(Z80_BC2, RegData);
RegData = (pSnapshot[0x02a] & 0x0ff) | ((pSnapshot[0x02b] & 0x0ff)<<8);
- cpu_set_reg(state->m_maincpu, Z80_DE2, RegData);
+ state->m_maincpu->set_state_int(Z80_DE2, RegData);
RegData = (pSnapshot[0x02c] & 0x0ff) | ((pSnapshot[0x02d] & 0x0ff)<<8);
- cpu_set_reg(state->m_maincpu, Z80_HL2, RegData);
+ state->m_maincpu->set_state_int(Z80_HL2, RegData);
/* init GA */
for (i=0; i<17; i++)
diff --git a/src/mess/machine/apple2.c b/src/mess/machine/apple2.c
index 8a8a0086a13..039071a8521 100644
--- a/src/mess/machine/apple2.c
+++ b/src/mess/machine/apple2.c
@@ -1002,7 +1002,7 @@ void apple2_setvar(running_machine &machine, UINT32 val, UINT32 mask)
{
apple2_state *state = machine.driver_data<apple2_state>();
LOG(("apple2_setvar(): val=0x%06x mask=0x%06x pc=0x%04x\n", val, mask,
- (unsigned int) cpu_get_reg(machine.device("maincpu"), STATE_GENPC)));
+ (unsigned int) machine.device("maincpu")->safe_pc()));
assert((val & mask) == val);
diff --git a/src/mess/machine/at.c b/src/mess/machine/at.c
index 1c184079d0c..e5ef24e96e2 100644
--- a/src/mess/machine/at.c
+++ b/src/mess/machine/at.c
@@ -132,7 +132,7 @@ WRITE8_MEMBER( at_state::at_page8_w )
if (LOG_PORT80 && (offset == 0))
{
logerror(" at_page8_w(): Port 80h <== 0x%02x (PC=0x%08x)\n", data,
- (unsigned) cpu_get_reg(m_maincpu, STATE_GENPC));
+ (unsigned) m_maincpu->pc());
}
switch(offset % 8)
diff --git a/src/mess/machine/bebox.c b/src/mess/machine/bebox.c
index c65a2d83079..416cd1124e5 100644
--- a/src/mess/machine/bebox.c
+++ b/src/mess/machine/bebox.c
@@ -333,8 +333,8 @@ void bebox_set_irq_bit(running_machine &machine, unsigned int interrupt_bit, int
assert_always((interrupt_bit < ARRAY_LENGTH(interrupt_names)) && (interrupt_names[interrupt_bit] != NULL), "Raising invalid interrupt");
logerror("bebox_set_irq_bit(): pc[0]=0x%08x pc[1]=0x%08x %s interrupt #%u (%s)\n",
- (unsigned) cpu_get_reg(machine.device("ppc1"), STATE_GENPC),
- (unsigned) cpu_get_reg(machine.device("ppc2"), STATE_GENPC),
+ (unsigned) machine.device("ppc1")->safe_pc(),
+ (unsigned) machine.device("ppc2")->safe_pc(),
val ? "Asserting" : "Clearing",
interrupt_bit, interrupt_names[interrupt_bit]);
}
diff --git a/src/mess/machine/c128.c b/src/mess/machine/c128.c
index 2840c08c4c0..d51f38e080d 100644
--- a/src/mess/machine/c128.c
+++ b/src/mess/machine/c128.c
@@ -758,8 +758,8 @@ void c128_state::bankswitch(int reset)
* driver used to work with this behavior, so I am doing this hack
* where I set CPU #1's PC to 0x1100 on reset.
*/
- if (cpu_get_reg(m_subcpu, STATE_GENPC) == 0x0000)
- cpu_set_reg(m_subcpu, STATE_GENPC, 0x1100);
+ if (m_subcpu->pc() == 0x0000)
+ m_subcpu->set_pc(0x1100);
}
m_mmu_cpu = MMU_CPU8502;
return;
diff --git a/src/mess/machine/c64_cpm.c b/src/mess/machine/c64_cpm.c
index 4885893ebb6..197d9f3e4ff 100644
--- a/src/mess/machine/c64_cpm.c
+++ b/src/mess/machine/c64_cpm.c
@@ -95,7 +95,7 @@ inline void c64_cpm_cartridge_device::update_signals()
if (m_reset)
{
m_maincpu->reset();
- m_maincpu->set_state(Z80_PC, 0);
+ m_maincpu->set_state_int(Z80_PC, 0);
m_reset = 0;
}
}
diff --git a/src/mess/machine/dai.c b/src/mess/machine/dai.c
index 9ee389ae3ba..d16301ea8ca 100644
--- a/src/mess/machine/dai.c
+++ b/src/mess/machine/dai.c
@@ -36,7 +36,7 @@ static void dai_update_memory(running_machine &machine, int dai_rom_bank)
static TIMER_CALLBACK(dai_bootstrap_callback)
{
- cpu_set_reg(machine.device("maincpu"), STATE_GENPC, 0xc000);
+ machine.device("maincpu")->state().set_pc(0xc000);
}
diff --git a/src/mess/machine/galaxy.c b/src/mess/machine/galaxy.c
index 57392644ec6..4962afab2c2 100644
--- a/src/mess/machine/galaxy.c
+++ b/src/mess/machine/galaxy.c
@@ -72,51 +72,51 @@ static void galaxy_setup_snapshot (running_machine &machine, const UINT8 * data,
switch (size)
{
case GALAXY_SNAPSHOT_V1_SIZE:
- cpu_set_reg(cpu, Z80_AF, data[0x00] | data[0x01] << 8);
- cpu_set_reg(cpu, Z80_BC, data[0x04] | data[0x05] << 8);
- cpu_set_reg(cpu, Z80_DE, data[0x08] | data[0x09] << 8);
- cpu_set_reg(cpu, Z80_HL, data[0x0c] | data[0x0d] << 8);
- cpu_set_reg(cpu, Z80_IX, data[0x10] | data[0x11] << 8);
- cpu_set_reg(cpu, Z80_IY, data[0x14] | data[0x15] << 8);
- cpu_set_reg(cpu, Z80_PC, data[0x18] | data[0x19] << 8);
- cpu_set_reg(cpu, Z80_SP, data[0x1c] | data[0x1d] << 8);
- cpu_set_reg(cpu, Z80_AF2, data[0x20] | data[0x21] << 8);
- cpu_set_reg(cpu, Z80_BC2, data[0x24] | data[0x25] << 8);
- cpu_set_reg(cpu, Z80_DE2, data[0x28] | data[0x29] << 8);
- cpu_set_reg(cpu, Z80_HL2, data[0x2c] | data[0x2d] << 8);
- cpu_set_reg(cpu, Z80_IFF1, data[0x30]);
- cpu_set_reg(cpu, Z80_IFF2, data[0x34]);
- cpu_set_reg(cpu, Z80_HALT, data[0x38]);
- cpu_set_reg(cpu, Z80_IM, data[0x3c]);
- cpu_set_reg(cpu, Z80_I, data[0x40]);
- cpu_set_reg(cpu, Z80_R, (data[0x44] & 0x7f) | (data[0x48] & 0x80));
+ cpu->state().set_state_int(Z80_AF, data[0x00] | data[0x01] << 8);
+ cpu->state().set_state_int(Z80_BC, data[0x04] | data[0x05] << 8);
+ cpu->state().set_state_int(Z80_DE, data[0x08] | data[0x09] << 8);
+ cpu->state().set_state_int(Z80_HL, data[0x0c] | data[0x0d] << 8);
+ cpu->state().set_state_int(Z80_IX, data[0x10] | data[0x11] << 8);
+ cpu->state().set_state_int(Z80_IY, data[0x14] | data[0x15] << 8);
+ cpu->state().set_state_int(Z80_PC, data[0x18] | data[0x19] << 8);
+ cpu->state().set_state_int(Z80_SP, data[0x1c] | data[0x1d] << 8);
+ cpu->state().set_state_int(Z80_AF2, data[0x20] | data[0x21] << 8);
+ cpu->state().set_state_int(Z80_BC2, data[0x24] | data[0x25] << 8);
+ cpu->state().set_state_int(Z80_DE2, data[0x28] | data[0x29] << 8);
+ cpu->state().set_state_int(Z80_HL2, data[0x2c] | data[0x2d] << 8);
+ cpu->state().set_state_int(Z80_IFF1, data[0x30]);
+ cpu->state().set_state_int(Z80_IFF2, data[0x34]);
+ cpu->state().set_state_int(Z80_HALT, data[0x38]);
+ cpu->state().set_state_int(Z80_IM, data[0x3c]);
+ cpu->state().set_state_int(Z80_I, data[0x40]);
+ cpu->state().set_state_int(Z80_R, (data[0x44] & 0x7f) | (data[0x48] & 0x80));
memcpy (machine.device<ram_device>(RAM_TAG)->pointer(), data + 0x084c, (machine.device<ram_device>(RAM_TAG)->size() < 0x1800) ? machine.device<ram_device>(RAM_TAG)->size() : 0x1800);
break;
case GALAXY_SNAPSHOT_V2_SIZE:
- cpu_set_reg(cpu, Z80_AF, data[0x00] | data[0x01] << 8);
- cpu_set_reg(cpu, Z80_BC, data[0x02] | data[0x03] << 8);
- cpu_set_reg(cpu, Z80_DE, data[0x04] | data[0x05] << 8);
- cpu_set_reg(cpu, Z80_HL, data[0x06] | data[0x07] << 8);
- cpu_set_reg(cpu, Z80_IX, data[0x08] | data[0x09] << 8);
- cpu_set_reg(cpu, Z80_IY, data[0x0a] | data[0x0b] << 8);
- cpu_set_reg(cpu, Z80_PC, data[0x0c] | data[0x0d] << 8);
- cpu_set_reg(cpu, Z80_SP, data[0x0e] | data[0x0f] << 8);
- cpu_set_reg(cpu, Z80_AF2, data[0x10] | data[0x11] << 8);
- cpu_set_reg(cpu, Z80_BC2, data[0x12] | data[0x13] << 8);
- cpu_set_reg(cpu, Z80_DE2, data[0x14] | data[0x15] << 8);
- cpu_set_reg(cpu, Z80_HL2, data[0x16] | data[0x17] << 8);
-
- cpu_set_reg(cpu, Z80_IFF1, data[0x18] & 0x01);
- cpu_set_reg(cpu, Z80_IFF2, (UINT64)0);
-
- cpu_set_reg(cpu, Z80_HALT, (UINT64)0);
-
- cpu_set_reg(cpu, Z80_IM, (data[0x18] >> 1) & 0x03);
-
- cpu_set_reg(cpu, Z80_I, data[0x19]);
- cpu_set_reg(cpu, Z80_R, data[0x1a]);
+ cpu->state().set_state_int(Z80_AF, data[0x00] | data[0x01] << 8);
+ cpu->state().set_state_int(Z80_BC, data[0x02] | data[0x03] << 8);
+ cpu->state().set_state_int(Z80_DE, data[0x04] | data[0x05] << 8);
+ cpu->state().set_state_int(Z80_HL, data[0x06] | data[0x07] << 8);
+ cpu->state().set_state_int(Z80_IX, data[0x08] | data[0x09] << 8);
+ cpu->state().set_state_int(Z80_IY, data[0x0a] | data[0x0b] << 8);
+ cpu->state().set_state_int(Z80_PC, data[0x0c] | data[0x0d] << 8);
+ cpu->state().set_state_int(Z80_SP, data[0x0e] | data[0x0f] << 8);
+ cpu->state().set_state_int(Z80_AF2, data[0x10] | data[0x11] << 8);
+ cpu->state().set_state_int(Z80_BC2, data[0x12] | data[0x13] << 8);
+ cpu->state().set_state_int(Z80_DE2, data[0x14] | data[0x15] << 8);
+ cpu->state().set_state_int(Z80_HL2, data[0x16] | data[0x17] << 8);
+
+ cpu->state().set_state_int(Z80_IFF1, data[0x18] & 0x01);
+ cpu->state().set_state_int(Z80_IFF2, (UINT64)0);
+
+ cpu->state().set_state_int(Z80_HALT, (UINT64)0);
+
+ cpu->state().set_state_int(Z80_IM, (data[0x18] >> 1) & 0x03);
+
+ cpu->state().set_state_int(Z80_I, data[0x19]);
+ cpu->state().set_state_int(Z80_R, data[0x1a]);
memcpy (machine.device<ram_device>(RAM_TAG)->pointer(), data + 0x0834, (machine.device<ram_device>(RAM_TAG)->size() < 0x1800) ? machine.device<ram_device>(RAM_TAG)->size() : 0x1800);
diff --git a/src/mess/machine/intv.c b/src/mess/machine/intv.c
index 47dff96e5d3..ef286d09274 100644
--- a/src/mess/machine/intv.c
+++ b/src/mess/machine/intv.c
@@ -625,7 +625,7 @@ MACHINE_RESET( intv )
device_set_input_line_vector(machine.device("maincpu"), CP1610_INT_INTR, 0x1004);
/* Set initial PC */
- cpu_set_reg(machine.device("maincpu"), CP1610_R7, 0x1000);
+ machine.device("maincpu")->state().set_state_int(CP1610_R7, 0x1000);
return;
}
@@ -645,7 +645,7 @@ MACHINE_RESET( intvecs )
device_set_input_line_vector(machine.device("maincpu"), CP1610_INT_INTR, 0x1004);
/* Set initial PC */
- cpu_set_reg(machine.device("maincpu"), CP1610_R7, 0x1000);
+ machine.device("maincpu")->state().set_state_int(CP1610_R7, 0x1000);
return;
}
diff --git a/src/mess/machine/isa_aha1542.c b/src/mess/machine/isa_aha1542.c
index 2b12335fc5b..225f2d22d0d 100644
--- a/src/mess/machine/isa_aha1542.c
+++ b/src/mess/machine/isa_aha1542.c
@@ -140,13 +140,13 @@ const device_type AHA1542 = &device_creator<aha1542_device>;
READ8_MEMBER( aha1542_device::aha1542_r )
{
- printf("aha1542_r(): pc=0x%08x offset=%d\n", (unsigned) cpu_get_reg(machine().firstcpu, STATE_GENPC), offset);
+ printf("aha1542_r(): pc=0x%08x offset=%d\n", (unsigned) machine().firstcpu->pc(), offset);
return 0xff;
}
WRITE8_MEMBER( aha1542_device::aha1542_w )
{
- printf("aha1542_w(): pc=0x%08x offset=%d data=0x%02x\n", (unsigned) cpu_get_reg(machine().firstcpu, STATE_GENPC), offset, data);
+ printf("aha1542_w(): pc=0x%08x offset=%d data=0x%02x\n", (unsigned) machine().firstcpu->pc(), offset, data);
}
//-------------------------------------------------
diff --git a/src/mess/machine/isa_fdc.c b/src/mess/machine/isa_fdc.c
index dda0c2a0a43..980539a78ca 100644
--- a/src/mess/machine/isa_fdc.c
+++ b/src/mess/machine/isa_fdc.c
@@ -371,7 +371,7 @@ static READ8_DEVICE_HANDLER ( pc_fdc_r )
}
if (LOG_FDC)
- logerror("pc_fdc_r(): pc=0x%08x offset=%d result=0x%02X\n", (unsigned) cpu_get_reg(device->machine().firstcpu,STATE_GENPC), offset, data);
+ logerror("pc_fdc_r(): pc=0x%08x offset=%d result=0x%02X\n", (unsigned) device->machine().firstcpu->pc(), offset, data);
return data;
}
@@ -382,7 +382,7 @@ static WRITE8_DEVICE_HANDLER ( pc_fdc_w )
isa8_fdc_device *fdc = downcast<isa8_fdc_device *>(device);
if (LOG_FDC)
- logerror("pc_fdc_w(): pc=0x%08x offset=%d data=0x%02X\n", (unsigned) cpu_get_reg(device->machine().firstcpu,STATE_GENPC), offset, data);
+ logerror("pc_fdc_w(): pc=0x%08x offset=%d data=0x%02X\n", (unsigned) device->machine().firstcpu->pc(), offset, data);
pc_fdc_check_data_rate(fdc,device->machine()); // check every time a command may start
device_t *hdd = NULL;
diff --git a/src/mess/machine/isa_hdc.c b/src/mess/machine/isa_hdc.c
index 91ea75ca038..70076459c4a 100644
--- a/src/mess/machine/isa_hdc.c
+++ b/src/mess/machine/isa_hdc.c
@@ -506,7 +506,7 @@ void isa8_hdc_device::hdc_command()
{
command_name = hdc_command_names[cmd] ? hdc_command_names[cmd] : "Unknown";
logerror("pc_hdc_command(): Executing command; pc=0x%08x cmd=0x%02x (%s) drv=%d\n",
- (unsigned) cpu_get_reg(machine().firstcpu, STATE_GENPC), cmd, command_name, drv);
+ (unsigned) machine().firstcpu->pc(), cmd, command_name, drv);
}
switch (cmd)
@@ -544,7 +544,7 @@ void isa8_hdc_device::hdc_command()
if (LOG_HDC_STATUS)
{
logerror("hdc read pc=0x%08x D:%d C:%d H:%d S:%d N:%d CTL:$%02x\n",
- (unsigned) cpu_get_reg(machine().firstcpu, STATE_GENPC), drv, cylinder[drv], head[drv], sector[drv], sector_cnt[drv], control[drv]);
+ (unsigned) machine().firstcpu->pc(), drv, cylinder[drv], head[drv], sector[drv], sector_cnt[drv], control[drv]);
}
if (test_ready())
@@ -559,7 +559,7 @@ void isa8_hdc_device::hdc_command()
if (LOG_HDC_STATUS)
{
logerror("hdc write pc=0x%08x D:%d C:%d H:%d S:%d N:%d CTL:$%02x\n",
- (unsigned) cpu_get_reg(machine().firstcpu, STATE_GENPC), drv, cylinder[drv], head[drv], sector[drv], sector_cnt[drv], control[drv]);
+ (unsigned) machine().firstcpu->pc(), drv, cylinder[drv], head[drv], sector[drv], sector_cnt[drv], control[drv]);
}
if (test_ready())
@@ -673,7 +673,7 @@ void isa8_hdc_device::pc_hdc_data_w(int data)
if (--data_cnt == 0)
{
if (LOG_HDC_STATUS)
- logerror("pc_hdc_data_w(): Launching command; pc=0x%08x\n", (unsigned) cpu_get_reg(machine().firstcpu, STATE_GENPC));
+ logerror("pc_hdc_data_w(): Launching command; pc=0x%08x\n", (unsigned) machine().firstcpu->pc());
status &= ~STA_COMMAND;
status &= ~STA_REQUEST;
diff --git a/src/mess/machine/kaypro.c b/src/mess/machine/kaypro.c
index a136becf37d..e8f3f6596be 100644
--- a/src/mess/machine/kaypro.c
+++ b/src/mess/machine/kaypro.c
@@ -280,7 +280,7 @@ WRITE8_DEVICE_HANDLER( kaypro_sio_w )
static TIMER_CALLBACK( kaypro_timer_callback )
{
- if (cpu_get_reg(machine.device("maincpu"), Z80_HALT))
+ if (machine.device("maincpu")->state().state_int(Z80_HALT))
cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE);
}
@@ -364,7 +364,7 @@ QUICKLOAD_LOAD( kayproii )
state->common_pio_system_w(*space, 0, state->m_system_port & 0x7f); // switch TPA in
RAM[0x80]=0; // clear out command tail
RAM[0x81]=0;
- cpu_set_reg(state->m_maincpu, STATE_GENPC, 0x100); // start program
+ state->m_maincpu->set_pc(0x100); // start program
return IMAGE_INIT_PASS;
}
@@ -386,6 +386,6 @@ QUICKLOAD_LOAD( kaypro2x )
state->kaypro2x_system_port_w(*space, 0, state->m_system_port & 0x7f);
RAM[0x80]=0;
RAM[0x81]=0;
- cpu_set_reg(state->m_maincpu, STATE_GENPC, 0x100);
+ state->m_maincpu->set_pc(0x100);
return IMAGE_INIT_PASS;
}
diff --git a/src/mess/machine/kc.c b/src/mess/machine/kc.c
index c3cf9020c8c..40f1f52f840 100644
--- a/src/mess/machine/kc.c
+++ b/src/mess/machine/kc.c
@@ -69,7 +69,7 @@ QUICKLOAD_LOAD(kc)
if (execution_address != 0 && header->number_addresses >= 3 )
{
// if specified, jumps to the quickload start address
- cpu_set_reg(state->m_maincpu, STATE_GENPC, execution_address);
+ state->m_maincpu->set_pc(execution_address);
}
auto_free(image.device().machine(), data);
@@ -790,7 +790,7 @@ void kc_state::machine_reset()
at address 0x0000-0x01000 which has a single jump in it,
can't see yet where it disables it later!!!! so for now
here will be a override */
- cpu_set_reg(m_maincpu, STATE_GENPC, 0x0f000);
+ m_maincpu->set_pc(0x0f000);
}
void kc85_4_state::machine_reset()
diff --git a/src/mess/machine/lisa.c b/src/mess/machine/lisa.c
index 8da893e2da6..145ec313905 100644
--- a/src/mess/machine/lisa.c
+++ b/src/mess/machine/lisa.c
@@ -879,7 +879,7 @@ DIRECT_UPDATE_HANDLER (lisa_OPbaseoverride)
}
- if (cpu_get_reg(machine.device("maincpu"), M68K_SR) & 0x2000)
+ if (machine.device("maincpu")->state().state_int(M68K_SR) & 0x2000)
{
/* supervisor mode -> force register file 0 */
the_seg = 0;
@@ -1412,7 +1412,7 @@ READ16_MEMBER(lisa_state::lisa_r)
}
}
- if (cpu_get_reg(machine().device("maincpu"), M68K_SR) & 0x2000)
+ if (machine().device("maincpu")->state().state_int(M68K_SR) & 0x2000)
/* supervisor mode -> force register file 0 */
the_seg = 0;
@@ -1619,7 +1619,7 @@ WRITE16_MEMBER(lisa_state::lisa_w)
}
}
- if (cpu_get_reg(machine().device("maincpu"), M68K_SR) & 0x2000)
+ if (machine().device("maincpu")->state().state_int(M68K_SR) & 0x2000)
/* supervisor mode -> force register file 0 */
the_seg = 0;
diff --git a/src/mess/machine/lviv.c b/src/mess/machine/lviv.c
index c628005c836..11c09325858 100644
--- a/src/mess/machine/lviv.c
+++ b/src/mess/machine/lviv.c
@@ -282,22 +282,22 @@ static void lviv_setup_snapshot (running_machine &machine,UINT8 * data)
/* Set registers */
lo = data[0x14112] & 0x0ff;
hi = data[0x14111] & 0x0ff;
- cpu_set_reg(machine.device("maincpu"), I8085_BC, (hi << 8) | lo);
+ machine.device("maincpu")->state().set_state_int(I8085_BC, (hi << 8) | lo);
lo = data[0x14114] & 0x0ff;
hi = data[0x14113] & 0x0ff;
- cpu_set_reg(machine.device("maincpu"), I8085_DE, (hi << 8) | lo);
+ machine.device("maincpu")->state().set_state_int(I8085_DE, (hi << 8) | lo);
lo = data[0x14116] & 0x0ff;
hi = data[0x14115] & 0x0ff;
- cpu_set_reg(machine.device("maincpu"), I8085_HL, (hi << 8) | lo);
+ machine.device("maincpu")->state().set_state_int(I8085_HL, (hi << 8) | lo);
lo = data[0x14118] & 0x0ff;
hi = data[0x14117] & 0x0ff;
- cpu_set_reg(machine.device("maincpu"), I8085_AF, (hi << 8) | lo);
+ machine.device("maincpu")->state().set_state_int(I8085_AF, (hi << 8) | lo);
lo = data[0x14119] & 0x0ff;
hi = data[0x1411a] & 0x0ff;
- cpu_set_reg(machine.device("maincpu"), I8085_SP, (hi << 8) | lo);
+ machine.device("maincpu")->state().set_state_int(I8085_SP, (hi << 8) | lo);
lo = data[0x1411b] & 0x0ff;
hi = data[0x1411c] & 0x0ff;
- cpu_set_reg(machine.device("maincpu"), I8085_PC, (hi << 8) | lo);
+ machine.device("maincpu")->state().set_state_int(I8085_PC, (hi << 8) | lo);
/* Memory dump */
memcpy (machine.device<ram_device>(RAM_TAG)->pointer(), data+0x0011, 0xc000);
@@ -313,12 +313,12 @@ static void lviv_setup_snapshot (running_machine &machine,UINT8 * data)
static void dump_registers(running_machine &machine)
{
- logerror("PC = %04x\n", (unsigned) cpu_get_reg(machine.device("maincpu"), I8085_PC));
- logerror("SP = %04x\n", (unsigned) cpu_get_reg(machine.device("maincpu"), I8085_SP));
- logerror("AF = %04x\n", (unsigned) cpu_get_reg(machine.device("maincpu"), I8085_AF));
- logerror("BC = %04x\n", (unsigned) cpu_get_reg(machine.device("maincpu"), I8085_BC));
- logerror("DE = %04x\n", (unsigned) cpu_get_reg(machine.device("maincpu"), I8085_DE));
- logerror("HL = %04x\n", (unsigned) cpu_get_reg(machine.device("maincpu"), I8085_HL));
+ logerror("PC = %04x\n", (unsigned) machine.device("maincpu")->state().state_int(I8085_PC));
+ logerror("SP = %04x\n", (unsigned) machine.device("maincpu")->state().state_int(I8085_SP));
+ logerror("AF = %04x\n", (unsigned) machine.device("maincpu")->state().state_int(I8085_AF));
+ logerror("BC = %04x\n", (unsigned) machine.device("maincpu")->state().state_int(I8085_BC));
+ logerror("DE = %04x\n", (unsigned) machine.device("maincpu")->state().state_int(I8085_DE));
+ logerror("HL = %04x\n", (unsigned) machine.device("maincpu")->state().state_int(I8085_HL));
}
static int lviv_verify_snapshot (UINT8 * data, UINT32 size)
diff --git a/src/mess/machine/mac.c b/src/mess/machine/mac.c
index c459a9e8ae6..54bf66dafd8 100644
--- a/src/mess/machine/mac.c
+++ b/src/mess/machine/mac.c
@@ -3216,7 +3216,7 @@ static void mac_tracetrap(const char *cpu_name_local, int addr, int trap)
s = &buf[strlen(buf)];
mem = mac_ram_ptr;
- a0 = cpu_get_reg(M68K_A0);
+ a0 = M68K_A0);
a7 = cpu_get_reg(M68K_A7);
d0 = cpu_get_reg(M68K_D0);
d1 = cpu_get_reg(M68K_D1);
@@ -3227,7 +3227,7 @@ static void mac_tracetrap(const char *cpu_name_local, int addr, int trap)
ioVRefNum = *((INT16*) (mem + a0 + 22));
ioCRefNum = *((INT16*) (mem + a0 + 24));
csCode = *((UINT16*) (mem + a0 + 26));
- sprintf(s, " ioVRefNum=%i ioCRefNum=%i csCode=%i", ioVRefNum, ioCRefNum, csCode);
+ sprintf(s->state().state_int(" ioVRefNum=%i ioCRefNum=%i csCode=%i", ioVRefNum, ioCRefNum, csCode);
for (i = 0; i < ARRAY_LENGTH(cscodes); i++)
{
diff --git a/src/mess/machine/mbc55x.c b/src/mess/machine/mbc55x.c
index b023b4a1eb4..465e86c063b 100644
--- a/src/mess/machine/mbc55x.c
+++ b/src/mess/machine/mbc55x.c
@@ -455,18 +455,18 @@ static void decode_dos21(device_t *device,offs_t pc)
{
device_t *cpu = device->machine().device(MAINCPU_TAG);
- UINT16 ax = cpu_get_reg(cpu,I8086_AX);
- UINT16 bx = cpu_get_reg(cpu,I8086_BX);
- UINT16 cx = cpu_get_reg(cpu,I8086_CX);
- UINT16 dx = cpu_get_reg(cpu,I8086_DX);
- UINT16 cs = cpu_get_reg(cpu,I8086_CS);
- UINT16 ds = cpu_get_reg(cpu,I8086_DS);
- UINT16 es = cpu_get_reg(cpu,I8086_ES);
- UINT16 ss = cpu_get_reg(cpu,I8086_SS);
-
- UINT16 si = cpu_get_reg(cpu,I8086_SI);
- UINT16 di = cpu_get_reg(cpu,I8086_DI);
- UINT16 bp = cpu_get_reg(cpu,I8086_BP);
+ UINT16 ax = cpu->state().state_int(I8086_AX);
+ UINT16 bx = cpu->state().state_int(I8086_BX);
+ UINT16 cx = cpu->state().state_int(I8086_CX);
+ UINT16 dx = cpu->state().state_int(I8086_DX);
+ UINT16 cs = cpu->state().state_int(I8086_CS);
+ UINT16 ds = cpu->state().state_int(I8086_DS);
+ UINT16 es = cpu->state().state_int(I8086_ES);
+ UINT16 ss = cpu->state().state_int(I8086_SS);
+
+ UINT16 si = cpu->state().state_int(I8086_SI);
+ UINT16 di = cpu->state().state_int(I8086_DI);
+ UINT16 bp = cpu->state().state_int(I8086_BP);
logerror("=======================================================================\n");
logerror("DOS Int 0x21 call at %05X\n",pc);
diff --git a/src/mess/machine/mbee.c b/src/mess/machine/mbee.c
index 948abcfc7ae..461fe628d14 100644
--- a/src/mess/machine/mbee.c
+++ b/src/mess/machine/mbee.c
@@ -789,7 +789,7 @@ QUICKLOAD_LOAD( mbee )
if (sw)
{
space->write_word(0xa2,0x801e); /* fix warm-start vector to get around some copy-protections */
- cpu_set_reg(cpu, STATE_GENPC, 0x801e);
+ cpu->state().set_pc(0x801e);
}
else
space->write_word(0xa2,0x8517);
@@ -816,7 +816,7 @@ QUICKLOAD_LOAD( mbee )
}
}
- if (sw) cpu_set_reg(cpu, STATE_GENPC, 0x100);
+ if (sw) cpu->state().set_pc(0x100);
}
return IMAGE_INIT_PASS;
diff --git a/src/mess/machine/mz700.c b/src/mess/machine/mz700.c
index 601949f77c5..9bef533eb92 100644
--- a/src/mess/machine/mz700.c
+++ b/src/mess/machine/mz700.c
@@ -651,7 +651,7 @@ WRITE8_MEMBER(mz_state::mz800_ramdisk_w)
/* port EB */
WRITE8_MEMBER(mz_state::mz800_ramaddr_w)
{
- m_mz800_ramaddr = (cpu_get_reg(machine().device("maincpu"), Z80_BC) & 0xff00) | (data & 0xff);
+ m_mz800_ramaddr = (machine().device("maincpu")->state().state_int(Z80_BC) & 0xff00) | (data & 0xff);
LOG(1,"mz800_ramaddr_w",("%04X\n", m_mz800_ramaddr),machine());
}
diff --git a/src/mess/machine/pc.c b/src/mess/machine/pc.c
index 951466d8f9c..a26f9cfb3e3 100644
--- a/src/mess/machine/pc.c
+++ b/src/mess/machine/pc.c
@@ -296,7 +296,7 @@ static TIMER_CALLBACK( pcjr_delayed_pic8259_irq )
static WRITE_LINE_DEVICE_HANDLER( pcjr_pic8259_set_int_line )
{
- if ( cpu_get_reg( device->machine().firstcpu, STATE_GENPC ) == 0xF0454 )
+ if ( device->machine().firstcpu->pc() == 0xF0454 )
{
pc_int_delay_timer->adjust( device->machine().firstcpu->cycles_to_attotime(1), state );
}
@@ -1265,8 +1265,8 @@ READ8_DEVICE_HANDLER( mc1502_wd17xx_drq_r )
data = wd17xx_drq_r(device);
if (!data && !wd17xx_intrq_r(device)) {
/* fake cpu halt by resetting PC one insn back */
- newpc = cpu_get_reg( device->machine().firstcpu, STATE_GENPC );
- cpu_set_reg( device->machine().firstcpu, STATE_GENPC, newpc - 1 );
+ newpc = device->machine().firstcpu->pc();
+ device->machine().firstcpu->set_pc( newpc - 1 );
}
return data;
diff --git a/src/mess/machine/pc_fdc.c b/src/mess/machine/pc_fdc.c
index 0a90aa9c722..fdf43632a86 100644
--- a/src/mess/machine/pc_fdc.c
+++ b/src/mess/machine/pc_fdc.c
@@ -513,7 +513,7 @@ READ8_HANDLER ( pc_fdc_r )
}
if (LOG_FDC)
- logerror("pc_fdc_r(): pc=0x%08x offset=%d result=0x%02X\n", (unsigned) cpu_get_reg(space->machine().firstcpu,STATE_GENPC), offset, data);
+ logerror("pc_fdc_r(): pc=0x%08x offset=%d result=0x%02X\n", (unsigned) space->machine().firstcpu->pc(), offset, data);
return data;
}
@@ -522,7 +522,7 @@ READ8_HANDLER ( pc_fdc_r )
WRITE8_HANDLER ( pc_fdc_w )
{
if (LOG_FDC)
- logerror("pc_fdc_w(): pc=0x%08x offset=%d data=0x%02X\n", (unsigned) cpu_get_reg(space->machine().firstcpu,STATE_GENPC), offset, data);
+ logerror("pc_fdc_w(): pc=0x%08x offset=%d data=0x%02X\n", (unsigned) space->machine().firstcpu->pc(), offset, data);
pc_fdc_check_data_rate(space->machine()); // check every time a command may start
switch(offset)
@@ -563,7 +563,7 @@ WRITE8_HANDLER ( pc_fdc_w )
WRITE8_HANDLER ( pcjr_fdc_w )
{
if (LOG_FDC)
- logerror("pcjr_fdc_w(): pc=0x%08x offset=%d data=0x%02X\n", (unsigned) cpu_get_reg(space->machine().firstcpu,STATE_GENPC), offset, data);
+ logerror("pcjr_fdc_w(): pc=0x%08x offset=%d data=0x%02X\n", (unsigned) space->machine().firstcpu->pc(), offset, data);
switch(offset)
{
diff --git a/src/mess/machine/pecom.c b/src/mess/machine/pecom.c
index 4e590321996..9c0a8d7a6cd 100644
--- a/src/mess/machine/pecom.c
+++ b/src/mess/machine/pecom.c
@@ -106,7 +106,7 @@ READ8_MEMBER(pecom_state::pecom_keyboard_r)
Address is available on address bus during reading of value from port, and that is
used to determine keyboard line reading
*/
- UINT16 addr = cpu_get_reg(machine().device(CDP1802_TAG), COSMAC_R0 + cpu_get_reg(machine().device(CDP1802_TAG), COSMAC_X));
+ UINT16 addr = machine().device(CDP1802_TAG)->state().state_int(COSMAC_R0 + machine().device(CDP1802_TAG)->state().state_int(COSMAC_X));
/* just in case somone is reading non existing ports */
if (addr<0x7cca || addr>0x7ce3) return 0;
return ioport(keynames[addr - 0x7cca])->read() & 0x03;
diff --git a/src/mess/machine/poly88.c b/src/mess/machine/poly88.c
index d29ba6bc22f..5478deed04d 100644
--- a/src/mess/machine/poly88.c
+++ b/src/mess/machine/poly88.c
@@ -302,7 +302,7 @@ SNAPSHOT_LOAD( poly88 )
break;
case 3 :
/* 03 Auto Start @ Address */
- cpu_set_reg(image.device().machine().device("maincpu"), I8085_PC, address);
+ image.device().machine().device("maincpu")->state().set_state_int(I8085_PC, address);
theend = 1;
break;
case 4 :
diff --git a/src/mess/machine/primo.c b/src/mess/machine/primo.c
index ec5a70c6c41..b0ebe0b6eee 100644
--- a/src/mess/machine/primo.c
+++ b/src/mess/machine/primo.c
@@ -273,20 +273,20 @@ static void primo_setup_pss (running_machine &machine, UINT8* snapshot_data, UIN
/* Z80 registers */
- cpu_set_reg(machine.device("maincpu"), Z80_BC, snapshot_data[4] + snapshot_data[5]*256);
- cpu_set_reg(machine.device("maincpu"), Z80_DE, snapshot_data[6] + snapshot_data[7]*256);
- cpu_set_reg(machine.device("maincpu"), Z80_HL, snapshot_data[8] + snapshot_data[9]*256);
- cpu_set_reg(machine.device("maincpu"), Z80_AF, snapshot_data[10] + snapshot_data[11]*256);
- cpu_set_reg(machine.device("maincpu"), Z80_BC2, snapshot_data[12] + snapshot_data[13]*256);
- cpu_set_reg(machine.device("maincpu"), Z80_DE2, snapshot_data[14] + snapshot_data[15]*256);
- cpu_set_reg(machine.device("maincpu"), Z80_HL2, snapshot_data[16] + snapshot_data[17]*256);
- cpu_set_reg(machine.device("maincpu"), Z80_AF2, snapshot_data[18] + snapshot_data[19]*256);
- cpu_set_reg(machine.device("maincpu"), Z80_PC, snapshot_data[20] + snapshot_data[21]*256);
- cpu_set_reg(machine.device("maincpu"), Z80_SP, snapshot_data[22] + snapshot_data[23]*256);
- cpu_set_reg(machine.device("maincpu"), Z80_I, snapshot_data[24]);
- cpu_set_reg(machine.device("maincpu"), Z80_R, snapshot_data[25]);
- cpu_set_reg(machine.device("maincpu"), Z80_IX, snapshot_data[26] + snapshot_data[27]*256);
- cpu_set_reg(machine.device("maincpu"), Z80_IY, snapshot_data[28] + snapshot_data[29]*256);
+ machine.device("maincpu")->state().set_state_int(Z80_BC, snapshot_data[4] + snapshot_data[5]*256);
+ machine.device("maincpu")->state().set_state_int(Z80_DE, snapshot_data[6] + snapshot_data[7]*256);
+ machine.device("maincpu")->state().set_state_int(Z80_HL, snapshot_data[8] + snapshot_data[9]*256);
+ machine.device("maincpu")->state().set_state_int(Z80_AF, snapshot_data[10] + snapshot_data[11]*256);
+ machine.device("maincpu")->state().set_state_int(Z80_BC2, snapshot_data[12] + snapshot_data[13]*256);
+ machine.device("maincpu")->state().set_state_int(Z80_DE2, snapshot_data[14] + snapshot_data[15]*256);
+ machine.device("maincpu")->state().set_state_int(Z80_HL2, snapshot_data[16] + snapshot_data[17]*256);
+ machine.device("maincpu")->state().set_state_int(Z80_AF2, snapshot_data[18] + snapshot_data[19]*256);
+ machine.device("maincpu")->state().set_state_int(Z80_PC, snapshot_data[20] + snapshot_data[21]*256);
+ machine.device("maincpu")->state().set_state_int(Z80_SP, snapshot_data[22] + snapshot_data[23]*256);
+ machine.device("maincpu")->state().set_state_int(Z80_I, snapshot_data[24]);
+ machine.device("maincpu")->state().set_state_int(Z80_R, snapshot_data[25]);
+ machine.device("maincpu")->state().set_state_int(Z80_IX, snapshot_data[26] + snapshot_data[27]*256);
+ machine.device("maincpu")->state().set_state_int(Z80_IY, snapshot_data[28] + snapshot_data[29]*256);
/* IO ports */
@@ -349,7 +349,7 @@ static void primo_setup_pp (running_machine &machine,UINT8* quickload_data, UINT
for (i=4; i<quickload_size; i++)
machine.device("maincpu")->memory().space(AS_PROGRAM)->write_byte(start_addr+i-4, quickload_data[i]);
- cpu_set_reg(machine.device("maincpu"), Z80_PC, start_addr);
+ machine.device("maincpu")->state().set_state_int(Z80_PC, start_addr);
logerror ("Quickload .pp l: %04x r: %04x s: %04x\n", load_addr, start_addr, quickload_size-4);
}
diff --git a/src/mess/machine/radio86.c b/src/mess/machine/radio86.c
index 920a88a00a8..7c635b3cd54 100644
--- a/src/mess/machine/radio86.c
+++ b/src/mess/machine/radio86.c
@@ -163,7 +163,7 @@ static TIMER_CALLBACK( radio86_reset )
READ8_MEMBER(radio86_state::radio_cpu_state_r)
{
- return cpu_get_reg(&space.device(), I8085_STATUS);
+ return space.device().state().state_int(I8085_STATUS);
}
READ8_MEMBER(radio86_state::radio_io_r)
diff --git a/src/mess/machine/rmnimbus.c b/src/mess/machine/rmnimbus.c
index c03b97d012a..40e7329a2c7 100644
--- a/src/mess/machine/rmnimbus.c
+++ b/src/mess/machine/rmnimbus.c
@@ -1383,11 +1383,11 @@ static void decode_subbios(device_t *device,offs_t pc, UINT8 raw_flag)
device_t *cpu = device->machine().device(MAINCPU_TAG);
- UINT16 ax = cpu_get_reg(cpu,I8086_AX);
- UINT16 bx = cpu_get_reg(cpu,I8086_BX);
- UINT16 cx = cpu_get_reg(cpu,I8086_CX);
- UINT16 ds = cpu_get_reg(cpu,I8086_DS);
- UINT16 si = cpu_get_reg(cpu,I8086_SI);
+ UINT16 ax = cpu->state().state_int(I8086_AX);
+ UINT16 bx = cpu->state().state_int(I8086_BX);
+ UINT16 cx = cpu->state().state_int(I8086_CX);
+ UINT16 ds = cpu->state().state_int(I8086_DS);
+ UINT16 si = cpu->state().state_int(I8086_SI);
// *** TEMP Don't show f_enquire_display_line calls !
if((cx==6) && (ax==43))
@@ -1876,18 +1876,18 @@ static void decode_dos21(device_t *device,offs_t pc)
{
device_t *cpu = device->machine().device(MAINCPU_TAG);
- UINT16 ax = cpu_get_reg(cpu,I8086_AX);
- UINT16 bx = cpu_get_reg(cpu,I8086_BX);
- UINT16 cx = cpu_get_reg(cpu,I8086_CX);
- UINT16 dx = cpu_get_reg(cpu,I8086_DX);
- UINT16 cs = cpu_get_reg(cpu,I8086_CS);
- UINT16 ds = cpu_get_reg(cpu,I8086_DS);
- UINT16 es = cpu_get_reg(cpu,I8086_ES);
- UINT16 ss = cpu_get_reg(cpu,I8086_SS);
-
- UINT16 si = cpu_get_reg(cpu,I8086_SI);
- UINT16 di = cpu_get_reg(cpu,I8086_DI);
- UINT16 bp = cpu_get_reg(cpu,I8086_BP);
+ UINT16 ax = cpu->state().state_int(I8086_AX);
+ UINT16 bx = cpu->state().state_int(I8086_BX);
+ UINT16 cx = cpu->state().state_int(I8086_CX);
+ UINT16 dx = cpu->state().state_int(I8086_DX);
+ UINT16 cs = cpu->state().state_int(I8086_CS);
+ UINT16 ds = cpu->state().state_int(I8086_DS);
+ UINT16 es = cpu->state().state_int(I8086_ES);
+ UINT16 ss = cpu->state().state_int(I8086_SS);
+
+ UINT16 si = cpu->state().state_int(I8086_SI);
+ UINT16 di = cpu->state().state_int(I8086_DI);
+ UINT16 bp = cpu->state().state_int(I8086_BP);
logerror("=======================================================================\n");
logerror("DOS Int 0x21 call at %05X\n",pc);
diff --git a/src/mess/machine/sorcerer.c b/src/mess/machine/sorcerer.c
index 91b1a457cc0..b1f89e5365c 100644
--- a/src/mess/machine/sorcerer.c
+++ b/src/mess/machine/sorcerer.c
@@ -330,23 +330,23 @@ SNAPSHOT_LOAD(sorcerer)
image.fread( RAM+0xc000, 0x4000);
/* patch CPU registers */
- cpu_set_reg(cpu, Z80_I, header[0]);
- cpu_set_reg(cpu, Z80_HL2, header[1] | (header[2] << 8));
- cpu_set_reg(cpu, Z80_DE2, header[3] | (header[4] << 8));
- cpu_set_reg(cpu, Z80_BC2, header[5] | (header[6] << 8));
- cpu_set_reg(cpu, Z80_AF2, header[7] | (header[8] << 8));
- cpu_set_reg(cpu, Z80_HL, header[9] | (header[10] << 8));
- cpu_set_reg(cpu, Z80_DE, header[11] | (header[12] << 8));
- cpu_set_reg(cpu, Z80_BC, header[13] | (header[14] << 8));
- cpu_set_reg(cpu, Z80_IY, header[15] | (header[16] << 8));
- cpu_set_reg(cpu, Z80_IX, header[17] | (header[18] << 8));
- cpu_set_reg(cpu, Z80_IFF1, header[19]&2 ? 1 : 0);
- cpu_set_reg(cpu, Z80_IFF2, header[19]&4 ? 1 : 0);
- cpu_set_reg(cpu, Z80_R, header[20]);
- cpu_set_reg(cpu, Z80_AF, header[21] | (header[22] << 8));
- cpu_set_reg(cpu, STATE_GENSP, header[23] | (header[24] << 8));
- cpu_set_reg(cpu, Z80_IM, header[25]);
- cpu_set_reg(cpu, STATE_GENPC, header[26] | (header[27] << 8));
+ cpu->state().set_state_int(Z80_I, header[0]);
+ cpu->state().set_state_int(Z80_HL2, header[1] | (header[2] << 8));
+ cpu->state().set_state_int(Z80_DE2, header[3] | (header[4] << 8));
+ cpu->state().set_state_int(Z80_BC2, header[5] | (header[6] << 8));
+ cpu->state().set_state_int(Z80_AF2, header[7] | (header[8] << 8));
+ cpu->state().set_state_int(Z80_HL, header[9] | (header[10] << 8));
+ cpu->state().set_state_int(Z80_DE, header[11] | (header[12] << 8));
+ cpu->state().set_state_int(Z80_BC, header[13] | (header[14] << 8));
+ cpu->state().set_state_int(Z80_IY, header[15] | (header[16] << 8));
+ cpu->state().set_state_int(Z80_IX, header[17] | (header[18] << 8));
+ cpu->state().set_state_int(Z80_IFF1, header[19]&2 ? 1 : 0);
+ cpu->state().set_state_int(Z80_IFF2, header[19]&4 ? 1 : 0);
+ cpu->state().set_state_int(Z80_R, header[20]);
+ cpu->state().set_state_int(Z80_AF, header[21] | (header[22] << 8));
+ cpu->state().set_state_int(STATE_GENSP, header[23] | (header[24] << 8));
+ cpu->state().set_state_int(Z80_IM, header[25]);
+ cpu->state().set_pc(header[26] | (header[27] << 8));
return IMAGE_INIT_PASS;
}
diff --git a/src/mess/machine/ti85.c b/src/mess/machine/ti85.c
index 77290e41816..aa2b5734a0f 100644
--- a/src/mess/machine/ti85.c
+++ b/src/mess/machine/ti85.c
@@ -523,7 +523,7 @@ NVRAM_HANDLER( ti83p )
if (file)
{
file->read(state->m_ti8x_ram, sizeof(unsigned char)*32*1024);
- cpu_set_reg(state->m_maincpu, Z80_PC,0x0c59);
+ state->m_maincpu->set_state_int(Z80_PC,0x0c59);
}
else
memset(state->m_ti8x_ram, 0, sizeof(unsigned char)*32*1024);
@@ -542,7 +542,7 @@ NVRAM_HANDLER( ti86 )
if (file)
{
file->read(state->m_ti8x_ram, sizeof(unsigned char)*128*1024);
- cpu_set_reg(state->m_maincpu, Z80_PC,0x0c59);
+ state->m_maincpu->set_state_int(Z80_PC,0x0c59);
}
else
memset(state->m_ti8x_ram, 0, sizeof(unsigned char)*128*1024);
@@ -562,47 +562,47 @@ static void ti8x_snapshot_setup_registers (running_machine &machine, UINT8 * dat
/* Set registers */
lo = reg[0x00] & 0x0ff;
hi = reg[0x01] & 0x0ff;
- cpu_set_reg(state->m_maincpu, Z80_AF, (hi << 8) | lo);
+ state->m_maincpu->set_state_int(Z80_AF, (hi << 8) | lo);
lo = reg[0x04] & 0x0ff;
hi = reg[0x05] & 0x0ff;
- cpu_set_reg(state->m_maincpu, Z80_BC, (hi << 8) | lo);
+ state->m_maincpu->set_state_int(Z80_BC, (hi << 8) | lo);
lo = reg[0x08] & 0x0ff;
hi = reg[0x09] & 0x0ff;
- cpu_set_reg(state->m_maincpu, Z80_DE, (hi << 8) | lo);
+ state->m_maincpu->set_state_int(Z80_DE, (hi << 8) | lo);
lo = reg[0x0c] & 0x0ff;
hi = reg[0x0d] & 0x0ff;
- cpu_set_reg(state->m_maincpu, Z80_HL, (hi << 8) | lo);
+ state->m_maincpu->set_state_int(Z80_HL, (hi << 8) | lo);
lo = reg[0x10] & 0x0ff;
hi = reg[0x11] & 0x0ff;
- cpu_set_reg(state->m_maincpu, Z80_IX, (hi << 8) | lo);
+ state->m_maincpu->set_state_int(Z80_IX, (hi << 8) | lo);
lo = reg[0x14] & 0x0ff;
hi = reg[0x15] & 0x0ff;
- cpu_set_reg(state->m_maincpu, Z80_IY, (hi << 8) | lo);
+ state->m_maincpu->set_state_int(Z80_IY, (hi << 8) | lo);
lo = reg[0x18] & 0x0ff;
hi = reg[0x19] & 0x0ff;
- cpu_set_reg(state->m_maincpu, Z80_PC, (hi << 8) | lo);
+ state->m_maincpu->set_state_int(Z80_PC, (hi << 8) | lo);
lo = reg[0x1c] & 0x0ff;
hi = reg[0x1d] & 0x0ff;
- cpu_set_reg(state->m_maincpu, Z80_SP, (hi << 8) | lo);
+ state->m_maincpu->set_state_int(Z80_SP, (hi << 8) | lo);
lo = reg[0x20] & 0x0ff;
hi = reg[0x21] & 0x0ff;
- cpu_set_reg(state->m_maincpu, Z80_AF2, (hi << 8) | lo);
+ state->m_maincpu->set_state_int(Z80_AF2, (hi << 8) | lo);
lo = reg[0x24] & 0x0ff;
hi = reg[0x25] & 0x0ff;
- cpu_set_reg(state->m_maincpu, Z80_BC2, (hi << 8) | lo);
+ state->m_maincpu->set_state_int(Z80_BC2, (hi << 8) | lo);
lo = reg[0x28] & 0x0ff;
hi = reg[0x29] & 0x0ff;
- cpu_set_reg(state->m_maincpu, Z80_DE2, (hi << 8) | lo);
+ state->m_maincpu->set_state_int(Z80_DE2, (hi << 8) | lo);
lo = reg[0x2c] & 0x0ff;
hi = reg[0x2d] & 0x0ff;
- cpu_set_reg(state->m_maincpu, Z80_HL2, (hi << 8) | lo);
- cpu_set_reg(state->m_maincpu, Z80_IFF1, reg[0x30]&0x0ff);
- cpu_set_reg(state->m_maincpu, Z80_IFF2, reg[0x34]&0x0ff);
- cpu_set_reg(state->m_maincpu, Z80_HALT, reg[0x38]&0x0ff);
- cpu_set_reg(state->m_maincpu, Z80_IM, reg[0x3c]&0x0ff);
- cpu_set_reg(state->m_maincpu, Z80_I, reg[0x40]&0x0ff);
-
- cpu_set_reg(state->m_maincpu, Z80_R, (reg[0x44]&0x7f) | (reg[0x48]&0x80));
+ state->m_maincpu->set_state_int(Z80_HL2, (hi << 8) | lo);
+ state->m_maincpu->set_state_int(Z80_IFF1, reg[0x30]&0x0ff);
+ state->m_maincpu->set_state_int(Z80_IFF2, reg[0x34]&0x0ff);
+ state->m_maincpu->set_state_int(Z80_HALT, reg[0x38]&0x0ff);
+ state->m_maincpu->set_state_int(Z80_IM, reg[0x3c]&0x0ff);
+ state->m_maincpu->set_state_int(Z80_I, reg[0x40]&0x0ff);
+
+ state->m_maincpu->set_state_int(Z80_R, (reg[0x44]&0x7f) | (reg[0x48]&0x80));
device_set_input_line(state->m_maincpu, 0, 0);
device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, 0);
diff --git a/src/mess/video/galaxy.c b/src/mess/video/galaxy.c
index 52b5bd6aa17..c62c3922d95 100644
--- a/src/mess/video/galaxy.c
+++ b/src/mess/video/galaxy.c
@@ -25,11 +25,11 @@ static TIMER_CALLBACK( gal_video )
if ((state->m_gal_cnt >= 48 * 2) && (state->m_gal_cnt < 48 * 210)) // display on screen just state->m_first 208 lines
{
UINT8 mode = (state->m_latch_value >> 1) & 1; // bit 2 latch represents mode
- UINT16 addr = (cpu_get_reg(machine.device("maincpu"), Z80_I) << 8) | cpu_get_reg(machine.device("maincpu"), Z80_R) | ((state->m_latch_value & 0x80) ^ 0x80);
+ UINT16 addr = (machine.device("maincpu")->state().state_int(Z80_I) << 8) | machine.device("maincpu")->state().state_int(Z80_R) | ((state->m_latch_value & 0x80) ^ 0x80);
if (mode == 0)
{
// Text mode
- if (state->m_first == 0 && (cpu_get_reg(machine.device("maincpu"), Z80_R) & 0x1f) == 0)
+ if (state->m_first == 0 && (machine.device("maincpu")->state().state_int(Z80_R) & 0x1f) == 0)
{
// Due to a fact that on real processor latch value is set at
// the end of last cycle we need to skip dusplay of double
@@ -58,7 +58,7 @@ static TIMER_CALLBACK( gal_video )
}
else
{ // Graphics mode
- if (state->m_first < 4 && (cpu_get_reg(machine.device("maincpu"), Z80_R) & 0x1f) == 0)
+ if (state->m_first < 4 && (machine.device("maincpu")->state().state_int(Z80_R) & 0x1f) == 0)
{
// Due to a fact that on real processor latch value is set at
// the end of last cycle we need to skip dusplay of 4 times
diff --git a/src/mess/video/pdp1.c b/src/mess/video/pdp1.c
index 0fc917fd7fd..cd8e09bde8e 100644
--- a/src/mess/video/pdp1.c
+++ b/src/mess/video/pdp1.c
@@ -309,41 +309,41 @@ static void pdp1_draw_panel_backdrop(running_machine &machine, bitmap_ind16 &bit
static void pdp1_draw_panel(running_machine &machine, bitmap_ind16 &bitmap)
{
/* column 1: registers, test word, test address */
- pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset+16, y_panel_pc_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_PC), 16);
- pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset+16, y_panel_ma_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_MA), 16);
- pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_mb_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_MB), 18);
- pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_ac_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_AC), 18);
- pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_io_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_IO), 18);
- pdp1_draw_switch(machine, bitmap, x_panel_col1_offset, y_panel_ta_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_EXTEND_SW));
- pdp1_draw_multipleswitch(machine, bitmap, x_panel_col1_offset+16, y_panel_ta_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_TA), 16);
- pdp1_draw_multipleswitch(machine, bitmap, x_panel_col1_offset, y_panel_tw_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_TW), 18);
+ pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset+16, y_panel_pc_offset+8, machine.device("maincpu")->state().state_int(PDP1_PC), 16);
+ pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset+16, y_panel_ma_offset+8, machine.device("maincpu")->state().state_int(PDP1_MA), 16);
+ pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_mb_offset+8, machine.device("maincpu")->state().state_int(PDP1_MB), 18);
+ pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_ac_offset+8, machine.device("maincpu")->state().state_int(PDP1_AC), 18);
+ pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_io_offset+8, machine.device("maincpu")->state().state_int(PDP1_IO), 18);
+ pdp1_draw_switch(machine, bitmap, x_panel_col1_offset, y_panel_ta_offset+8, machine.device("maincpu")->state().state_int(PDP1_EXTEND_SW));
+ pdp1_draw_multipleswitch(machine, bitmap, x_panel_col1_offset+16, y_panel_ta_offset+8, machine.device("maincpu")->state().state_int(PDP1_TA), 16);
+ pdp1_draw_multipleswitch(machine, bitmap, x_panel_col1_offset, y_panel_tw_offset+8, machine.device("maincpu")->state().state_int(PDP1_TW), 18);
/* column 2: 1-bit indicators */
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, cpu_get_reg(machine.device("maincpu"), PDP1_RUN));
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cyc_offset, cpu_get_reg(machine.device("maincpu"), PDP1_CYC));
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_defer_offset, cpu_get_reg(machine.device("maincpu"), PDP1_DEFER));
+ pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, machine.device("maincpu")->state().state_int(PDP1_RUN));
+ pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cyc_offset, machine.device("maincpu")->state().state_int(PDP1_CYC));
+ pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_defer_offset, machine.device("maincpu")->state().state_int(PDP1_DEFER));
pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_hs_cyc_offset, 0); /* not emulated */
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_brk_ctr_1_offset, cpu_get_reg(machine.device("maincpu"), PDP1_BRK_CTR) & 1);
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_brk_ctr_2_offset, cpu_get_reg(machine.device("maincpu"), PDP1_BRK_CTR) & 2);
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ov_offset, cpu_get_reg(machine.device("maincpu"), PDP1_OV));
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, cpu_get_reg(machine.device("maincpu"), PDP1_RIM));
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_sbm_offset, cpu_get_reg(machine.device("maincpu"), PDP1_SBM));
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_exd_offset, cpu_get_reg(machine.device("maincpu"), PDP1_EXD));
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, cpu_get_reg(machine.device("maincpu"), PDP1_IOH));
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioc_offset, cpu_get_reg(machine.device("maincpu"), PDP1_IOC));
- pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, cpu_get_reg(machine.device("maincpu"), PDP1_IOS));
+ pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_brk_ctr_1_offset, machine.device("maincpu")->state().state_int(PDP1_BRK_CTR) & 1);
+ pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_brk_ctr_2_offset, machine.device("maincpu")->state().state_int(PDP1_BRK_CTR) & 2);
+ pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ov_offset, machine.device("maincpu")->state().state_int(PDP1_OV));
+ pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, machine.device("maincpu")->state().state_int(PDP1_RIM));
+ pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_sbm_offset, machine.device("maincpu")->state().state_int(PDP1_SBM));
+ pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_exd_offset, machine.device("maincpu")->state().state_int(PDP1_EXD));
+ pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, machine.device("maincpu")->state().state_int(PDP1_IOH));
+ pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioc_offset, machine.device("maincpu")->state().state_int(PDP1_IOC));
+ pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, machine.device("maincpu")->state().state_int(PDP1_IOS));
/* column 3: power, single step, single inst, sense, flags, instr... */
pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_power_offset, 1); /* always on */
pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_power_offset, 1); /* always on */
- pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_sngl_step_offset, cpu_get_reg(machine.device("maincpu"), PDP1_SNGL_STEP));
- pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_sngl_step_offset, cpu_get_reg(machine.device("maincpu"), PDP1_SNGL_STEP));
- pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_sngl_inst_offset, cpu_get_reg(machine.device("maincpu"), PDP1_SNGL_INST));
- pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_sngl_inst_offset, cpu_get_reg(machine.device("maincpu"), PDP1_SNGL_INST));
- pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_ss_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_SS), 6);
- pdp1_draw_multipleswitch(machine, bitmap, x_panel_col3_offset, y_panel_ss_offset+16, cpu_get_reg(machine.device("maincpu"), PDP1_SS), 6);
- pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_pf_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_PF), 6);
- pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_ir_offset+8, cpu_get_reg(machine.device("maincpu"), PDP1_IR), 5);
+ pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_sngl_step_offset, machine.device("maincpu")->state().state_int(PDP1_SNGL_STEP));
+ pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_sngl_step_offset, machine.device("maincpu")->state().state_int(PDP1_SNGL_STEP));
+ pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_sngl_inst_offset, machine.device("maincpu")->state().state_int(PDP1_SNGL_INST));
+ pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_sngl_inst_offset, machine.device("maincpu")->state().state_int(PDP1_SNGL_INST));
+ pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_ss_offset+8, machine.device("maincpu")->state().state_int(PDP1_SS), 6);
+ pdp1_draw_multipleswitch(machine, bitmap, x_panel_col3_offset, y_panel_ss_offset+16, machine.device("maincpu")->state().state_int(PDP1_SS), 6);
+ pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_pf_offset+8, machine.device("maincpu")->state().state_int(PDP1_PF), 6);
+ pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_ir_offset+8, machine.device("maincpu")->state().state_int(PDP1_IR), 5);
}
diff --git a/src/mess/video/tx0.c b/src/mess/video/tx0.c
index 750893aec91..00c791e063d 100644
--- a/src/mess/video/tx0.c
+++ b/src/mess/video/tx0.c
@@ -300,35 +300,35 @@ static void tx0_draw_panel(running_machine &machine, bitmap_ind16 &bitmap)
int i;
/* column 1: registers, test accumulator, test buffer, toggle switch storage */
- tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_pc_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_PC), 16);
- tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_mar_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_MAR), 16);
- tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_mbr_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_MBR), 18);
- tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_ac_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_AC), 18);
- tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_lr_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_LR), 18);
- tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+4*8, y_panel_xr_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_XR), 14);
- tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tbr_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_TBR), 18);
- tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tac_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_TAC), 18);
- cm_sel = cpu_get_reg(machine.device("maincpu"), TX0_CM_SEL);
- lr_sel = cpu_get_reg(machine.device("maincpu"), TX0_LR_SEL);
+ tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_pc_offset+8, machine.device("maincpu")->state().state_int(TX0_PC), 16);
+ tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_mar_offset+8, machine.device("maincpu")->state().state_int(TX0_MAR), 16);
+ tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_mbr_offset+8, machine.device("maincpu")->state().state_int(TX0_MBR), 18);
+ tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_ac_offset+8, machine.device("maincpu")->state().state_int(TX0_AC), 18);
+ tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_lr_offset+8, machine.device("maincpu")->state().state_int(TX0_LR), 18);
+ tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+4*8, y_panel_xr_offset+8, machine.device("maincpu")->state().state_int(TX0_XR), 14);
+ tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tbr_offset+8, machine.device("maincpu")->state().state_int(TX0_TBR), 18);
+ tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tac_offset+8, machine.device("maincpu")->state().state_int(TX0_TAC), 18);
+ cm_sel = machine.device("maincpu")->state().state_int(TX0_CM_SEL);
+ lr_sel = machine.device("maincpu")->state().state_int(TX0_LR_SEL);
for (i=0; i<16; i++)
{
tx0_draw_switch(machine, bitmap, x_panel_col1a_offset+16, y_panel_tss_offset+8+i*8, (cm_sel >> i) & 1);
- tx0_draw_multipleswitch(machine, bitmap, x_panel_col1a_offset+24, y_panel_tss_offset+8+i*8, cpu_get_reg(machine.device("maincpu"), TX0_TSS00+i), 18);
+ tx0_draw_multipleswitch(machine, bitmap, x_panel_col1a_offset+24, y_panel_tss_offset+8+i*8, machine.device("maincpu")->state().state_int(TX0_TSS00+i), 18);
tx0_draw_switch(machine, bitmap, x_panel_col1a_offset+168, y_panel_tss_offset+8+i*8, (lr_sel >> i) & 1);
}
/* column 2: stop c0, stop c1, cm sel, 1-bit indicators, instr, flags */
- tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c0_offset, cpu_get_reg(machine.device("maincpu"), TX0_STOP_CYC0));
- tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c1_offset, cpu_get_reg(machine.device("maincpu"), TX0_STOP_CYC1));
- tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_gbl_cm_sel_offset, cpu_get_reg(machine.device("maincpu"), TX0_GBL_CM_SEL));
- tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, cpu_get_reg(machine.device("maincpu"), TX0_RUN));
- tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle1_offset, cpu_get_reg(machine.device("maincpu"), TX0_CYCLE) & 1);
- tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle2_offset, cpu_get_reg(machine.device("maincpu"), TX0_CYCLE) & 2);
- tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, cpu_get_reg(machine.device("maincpu"), TX0_RIM));
- tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, cpu_get_reg(machine.device("maincpu"), TX0_IOH));
- tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, cpu_get_reg(machine.device("maincpu"), TX0_IOS));
- tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_ir_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_IR), 5);
- tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_pf_offset+8, cpu_get_reg(machine.device("maincpu"), TX0_PF), 6);
+ tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c0_offset, machine.device("maincpu")->state().state_int(TX0_STOP_CYC0));
+ tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c1_offset, machine.device("maincpu")->state().state_int(TX0_STOP_CYC1));
+ tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_gbl_cm_sel_offset, machine.device("maincpu")->state().state_int(TX0_GBL_CM_SEL));
+ tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, machine.device("maincpu")->state().state_int(TX0_RUN));
+ tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle1_offset, machine.device("maincpu")->state().state_int(TX0_CYCLE) & 1);
+ tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle2_offset, machine.device("maincpu")->state().state_int(TX0_CYCLE) & 2);
+ tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, machine.device("maincpu")->state().state_int(TX0_RIM));
+ tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, machine.device("maincpu")->state().state_int(TX0_IOH));
+ tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, machine.device("maincpu")->state().state_int(TX0_IOS));
+ tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_ir_offset+8, machine.device("maincpu")->state().state_int(TX0_IR), 5);
+ tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_pf_offset+8, machine.device("maincpu")->state().state_int(TX0_PF), 6);
}
diff --git a/src/mess/video/vc4000.c b/src/mess/video/vc4000.c
index ccf85be6dc3..b5d6906aef0 100644
--- a/src/mess/video/vc4000.c
+++ b/src/mess/video/vc4000.c
@@ -116,7 +116,7 @@ READ8_MEMBER( vc4000_state::vc4000_video_r )
#ifndef ANALOG_HACK
case 0xcc:
- if (!activecpu_get_reg(S2650_FO)) data=ioport("JOY1_X")->read();
+ if (!activeS2650_FO)) data=ioport("JOY1_X")->read();
else data=ioport("JOY1_Y")->read();
break;
case 0xcd:
@@ -128,7 +128,7 @@ READ8_MEMBER( vc4000_state::vc4000_video_r )
case 0xcc: /* left joystick */
if (ioport("CONFIG")->read()&1)
{ /* paddle */
- if (!cpu_get_reg(machine().device("maincpu"), S2650_FO))
+ if (!machine().device("maincpu")->state().state_int(S2650_FO))
{
data = ioport("JOYS")->read() & 0x03;
switch (data)
@@ -167,7 +167,7 @@ READ8_MEMBER( vc4000_state::vc4000_video_r )
}
else
{ /* buttons */
- if (!cpu_get_reg(machine().device("maincpu"), S2650_FO))
+ if (!machine().device("maincpu")->state().state_int(S2650_FO))
{
data = ioport("JOYS")->read() & 0x03;
switch (data)
@@ -205,7 +205,7 @@ READ8_MEMBER( vc4000_state::vc4000_video_r )
case 0xcd: /* right joystick */
if (ioport("CONFIG")->read()&1)
{
- if (!cpu_get_reg(machine().device("maincpu"), S2650_FO))
+ if (!machine().device("maincpu")->state().state_int(S2650_FO))
{
data = ioport("JOYS")->read() & 0x30;
switch (data)
@@ -244,7 +244,7 @@ READ8_MEMBER( vc4000_state::vc4000_video_r )
}
else
{
- if (!cpu_get_reg(machine().device("maincpu"), S2650_FO))
+ if (!machine().device("maincpu")->state().state_int(S2650_FO))
{
data = ioport("JOYS")->read() & 0x30;
switch (data)
diff --git a/src/mess/video/zx.c b/src/mess/video/zx.c
index 8edb75ba4f2..8a5ffb299eb 100644
--- a/src/mess/video/zx.c
+++ b/src/mess/video/zx.c
@@ -99,7 +99,7 @@ static TIMER_CALLBACK(zx_ula_nmi)
bitmap_ind16 &bitmap = state->m_bitmap;
r.set(r1.min_x, r1.max_x, state->m_ula_scanline_count, state->m_ula_scanline_count);
bitmap.fill(1, r);
-// logerror("ULA %3d[%d] NMI, R:$%02X, $%04x\n", machine.primary_screen->vpos(), ula_scancode_count, (unsigned) cpu_get_reg(machine.device("maincpu"), Z80_R), (unsigned) cpu_get_reg(machine.device("maincpu"), Z80_PC));
+// logerror("ULA %3d[%d] NMI, R:$%02X, $%04x\n", machine.primary_screen->vpos(), ula_scancode_count, (unsigned) machine.device("maincpu")->state().state_int(Z80_R), (unsigned) machine.device("maincpu")->state().state_int(Z80_PC));
cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
if (++state->m_ula_scanline_count == height)
state->m_ula_scanline_count = 0;
@@ -116,7 +116,7 @@ static TIMER_CALLBACK(zx_ula_irq)
*/
if (state->m_ula_irq_active)
{
-// logerror("ULA %3d[%d] IRQ, R:$%02X, $%04x\n", machine.primary_screen->vpos(), ula_scancode_count, (unsigned) cpu_get_reg(machine.device("maincpu"), Z80_R), (unsigned) cpu_get_reg(machine.device("maincpu"), Z80_PC));
+// logerror("ULA %3d[%d] IRQ, R:$%02X, $%04x\n", machine.primary_screen->vpos(), ula_scancode_count, (unsigned) machine.device("maincpu")->state().state_int(Z80_R), (unsigned) machine.device("maincpu")->state().state_int(Z80_PC));
state->m_ula_irq_active = 0;
cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
@@ -135,13 +135,13 @@ void zx_ula_r(running_machine &machine, int offs, const char *region, const UINT
{
bitmap_ind16 &bitmap = state->m_bitmap;
UINT16 y, *scanline;
- UINT16 ireg = cpu_get_reg(machine.device("maincpu"), Z80_I) << 8;
+ UINT16 ireg = machine.device("maincpu")->state().state_int(Z80_I) << 8;
UINT8 data, *chrgen, creg;
if (param)
- creg = cpu_get_reg(machine.device("maincpu"), Z80_B);
+ creg = machine.device("maincpu")->state().state_int(Z80_B);
else
- creg = cpu_get_reg(machine.device("maincpu"), Z80_C);
+ creg = machine.device("maincpu")->state().state_int(Z80_C);
chrgen = state->memregion(region)->base();