summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu/h6280/h6280.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/cpu/h6280/h6280.c')
-rw-r--r--src/emu/cpu/h6280/h6280.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/emu/cpu/h6280/h6280.c b/src/emu/cpu/h6280/h6280.c
index 496caad3c01..03077fb098d 100644
--- a/src/emu/cpu/h6280/h6280.c
+++ b/src/emu/cpu/h6280/h6280.c
@@ -120,10 +120,9 @@ static void set_irq_line(h6280_Regs* cpustate, int irqline, int state);
INLINE h6280_Regs *get_safe_token(running_device *device)
{
assert(device != NULL);
- assert(device->token != NULL);
- assert(device->type == CPU);
+ assert(device->type() == CPU);
assert(cpu_get_type(device) == CPU_H6280);
- return (h6280_Regs *)device->token;
+ return (h6280_Regs *)downcast<cpu_device *>(device)->token();
}
/* include the opcode macros, functions and function pointer tables */
@@ -163,15 +162,15 @@ static CPU_INIT( h6280 )
cpustate->irq_callback = irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
}
static CPU_RESET( h6280 )
{
h6280_Regs* cpustate = get_safe_token(device);
- cpu_irq_callback save_irqcallback;
+ device_irq_callback save_irqcallback;
int i;
/* wipe out the h6280 structure */
@@ -179,8 +178,8 @@ static CPU_RESET( h6280 )
memset(cpustate, 0, sizeof(h6280_Regs));
cpustate->irq_callback = save_irqcallback;
cpustate->device = device;
- cpustate->program = device->space(AS_PROGRAM);
- cpustate->io = device->space(AS_IO);
+ cpustate->program = device_memory(device)->space(AS_PROGRAM);
+ cpustate->io = device_memory(device)->space(AS_IO);
/* set I and B flags */
P = _fI | _fB;
@@ -292,7 +291,7 @@ static void set_irq_line(h6280_Regs* cpustate, int irqline, int state)
READ8_HANDLER( h6280_irq_status_r )
{
int status;
- h6280_Regs *cpustate = (h6280_Regs*)space->cpu->token;
+ h6280_Regs *cpustate = get_safe_token(space->cpu);
switch (offset&3)
{
@@ -311,7 +310,7 @@ READ8_HANDLER( h6280_irq_status_r )
WRITE8_HANDLER( h6280_irq_status_w )
{
- h6280_Regs *cpustate = (h6280_Regs*)space->cpu->token;
+ h6280_Regs *cpustate = get_safe_token(space->cpu);
cpustate->io_buffer=data;
switch (offset&3)
{
@@ -330,13 +329,13 @@ WRITE8_HANDLER( h6280_irq_status_w )
READ8_HANDLER( h6280_timer_r )
{
/* only returns countdown */
- h6280_Regs *cpustate = (h6280_Regs*)space->cpu->token;
+ h6280_Regs *cpustate = get_safe_token(space->cpu);
return ((cpustate->timer_value/1024)&0x7F)|(cpustate->io_buffer&0x80);
}
WRITE8_HANDLER( h6280_timer_w )
{
- h6280_Regs *cpustate = (h6280_Regs*)space->cpu->token;
+ h6280_Regs *cpustate = get_safe_token(space->cpu);
cpustate->io_buffer=data;
switch (offset) {
case 0: /* Counter preload */
@@ -426,7 +425,7 @@ static CPU_SET_INFO( h6280 )
CPU_GET_INFO( h6280 )
{
- h6280_Regs* cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
+ h6280_Regs* cpustate = (device != NULL && downcast<cpu_device *>(device)->token() != NULL) ? get_safe_token(device) : NULL;
switch (state)
{