2018
2018
if (device->static_config)
2019
2019
cpustate->daisy = z80daisy_init(device, (const z80_daisy_chain *)device->static_config);
2020
2020
cpustate->irq_callback = irqcallback;
2021
cpustate->device = device;
2022
cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
2023
cpustate->iospace = memory_find_address_space(device, ADDRESS_SPACE_IO);
2025
2022
/* set up the state table */
2026
2023
cpustate->state = state_table_template;
2143
2140
save_irqcallback = cpustate->irq_callback;
2144
2141
save_table = cpustate->state;
2145
2142
memset(cpustate, 0, sizeof(*cpustate));
2144
memcpy(cpustate->cc, (UINT8 *)cc_default, sizeof(cpustate->cc));
2146
2145
cpustate->daisy = save_daisy;
2147
2146
cpustate->irq_callback = save_irqcallback;
2148
2147
cpustate->state = save_table;
2163
2162
cpustate->read_tcr_tmdr[1] = 0;
2164
2163
cpustate->tmdr_value[0] = 0xffff;
2165
2164
cpustate->tmdr_value[1] = 0xffff;
2166
cpustate->device = device;
2168
2166
/* reset io registers */
2169
2167
cpustate->IO_CNTLA0 = Z180_CNTLA0_RESET;
2517
2515
case CPUINFO_INT_INPUT_STATE + Z180_INT0: set_irq_line(cpustate, Z180_INT0, info->i); break;
2519
2517
/* --- the following bits of info are set as pointers to data or functions --- */
2520
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_op: cc[Z180_TABLE_op] = (const UINT8 *)info->p; break;
2521
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_cb: cc[Z180_TABLE_cb] = (const UINT8 *)info->p; break;
2522
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_ed: cc[Z180_TABLE_ed] = (const UINT8 *)info->p; break;
2523
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_xy: cc[Z180_TABLE_xy] = (const UINT8 *)info->p; break;
2524
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_xycb: cc[Z180_TABLE_xycb] = (const UINT8 *)info->p; break;
2525
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_ex: cc[Z180_TABLE_ex] = (const UINT8 *)info->p; break;
2518
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_op: cpustate->cc[Z180_TABLE_op] = info->p; break;
2519
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_cb: cpustate->cc[Z180_TABLE_cb] = info->p; break;
2520
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_ed: cpustate->cc[Z180_TABLE_ed] = info->p; break;
2521
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_xy: cpustate->cc[Z180_TABLE_xy] = info->p; break;
2522
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_xycb: cpustate->cc[Z180_TABLE_xycb] = info->p; break;
2523
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_ex: cpustate->cc[Z180_TABLE_ex] = info->p; break;
2540
2538
case CPUINFO_INT_CONTEXT_SIZE: info->i = sizeof(z180_state); break;
2541
2539
case CPUINFO_INT_INPUT_LINES: info->i = 3; break;
2542
2540
case CPUINFO_INT_DEFAULT_IRQ_VECTOR: info->i = 0xff; break;
2543
case CPUINFO_INT_ENDIANNESS: info->i = ENDIANNESS_LITTLE; break;
2541
case DEVINFO_INT_ENDIANNESS: info->i = ENDIANNESS_LITTLE; break;
2544
2542
case CPUINFO_INT_CLOCK_MULTIPLIER: info->i = 1; break;
2545
2543
case CPUINFO_INT_CLOCK_DIVIDER: info->i = 1; break;
2546
2544
case CPUINFO_INT_MIN_INSTRUCTION_BYTES: info->i = 1; break;
2575
2573
case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &cpustate->icount; break;
2576
2574
case CPUINFO_PTR_STATE_TABLE: info->state_table = &cpustate->state; break;
2578
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_op: info->p = (void *)cc[Z180_TABLE_op]; break;
2579
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_cb: info->p = (void *)cc[Z180_TABLE_cb]; break;
2580
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_ed: info->p = (void *)cc[Z180_TABLE_ed]; break;
2581
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_xy: info->p = (void *)cc[Z180_TABLE_xy]; break;
2582
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_xycb: info->p = (void *)cc[Z180_TABLE_xycb]; break;
2583
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_ex: info->p = (void *)cc[Z180_TABLE_ex]; break;
2576
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_op: info->p = (void *)cpustate->cc[Z180_TABLE_op]; break;
2577
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_cb: info->p = (void *)cpustate->cc[Z180_TABLE_cb]; break;
2578
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_ed: info->p = (void *)cpustate->cc[Z180_TABLE_ed]; break;
2579
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_xy: info->p = (void *)cpustate->cc[Z180_TABLE_xy]; break;
2580
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_xycb: info->p = (void *)cpustate->cc[Z180_TABLE_xycb]; break;
2581
case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_ex: info->p = (void *)cpustate->cc[Z180_TABLE_ex]; break;
2585
2583
/* --- the following bits of info are returned as NULL-terminated strings --- */
2586
case CPUINFO_STR_NAME: strcpy(info->s, "Z180"); break;
2587
case CPUINFO_STR_CORE_FAMILY: strcpy(info->s, "Zilog Z8x180"); break;
2588
case CPUINFO_STR_CORE_VERSION: strcpy(info->s, "0.4"); break;
2589
case CPUINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
2590
case CPUINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Juergen Buchmueller, all rights reserved."); break;
2584
case DEVINFO_STR_NAME: strcpy(info->s, "Z180"); break;
2585
case DEVINFO_STR_FAMILY: strcpy(info->s, "Zilog Z8x180"); break;
2586
case DEVINFO_STR_VERSION: strcpy(info->s, "0.4"); break;
2587
case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
2588
case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Juergen Buchmueller, all rights reserved."); break;
2592
2590
case CPUINFO_STR_FLAGS:
2593
2591
sprintf(info->s, "%c%c%c%c%c%c%c%c",