// reset machine void zx_reset() { unsigned dev; z80ex_reset( zxcpu ); device_scan_asc(reset) zx_device[dev]->reset(); }
void primo_emulator_execute ( void ) { int a; /* Save state of various things to be able to revert into EP mode later, without any data lost */ memcpy(memory_backup, memory + 0xFA * 0x4000, MEMORY_BACKUP_SIZE); // save memory memcpy(ports_backup, ports, 0x100); // backup ports [note: on restore, we don't want to rewrite all values, maybe only Dave/Nick! memcpy(&z80ex_backup, &z80ex, sizeof(Z80EX_CONTEXT)); // memcpy(); // save Dave registers // memcpy(); // save Nick registers /* set an LPT */ memcpy(memory + (PRIMO_LPT_SEG << 14), primo_lpt, sizeof primo_lpt); z80ex_pwrite_cb(0x82, (PRIMO_LPT_SEG << 10) & 0xFF); // LPT address, low byte z80ex_pwrite_cb(0x83, ((PRIMO_LPT_SEG << 2) & 0xF)); z80ex_pwrite_cb(0x83, ((PRIMO_LPT_SEG << 2) & 0xF) | 64); z80ex_pwrite_cb(0x83, ((PRIMO_LPT_SEG << 2) & 0xF) | 64 | 128); z80ex_pwrite_cb(0x81, 0); // border color /* do our stuffs ... */ z80ex_pwrite_cb(0xA7, 8 | 16); // D/A mode for Dave audio for (a = 0xA8; a < 0xB0; a++) z80ex_pwrite_cb(a, 0); // volumes of L/H channels z80ex_pwrite_cb(0xB4, 0xAA); // disable all interrupts on Dave (z80 won't get INT but the cloned NMI directly from Nick "translated" from VINT) and reset latches z80ex_pwrite_cb(0xB0, PRIMO_ROM_SEG); // first segment is the Primo ROM now z80ex_pwrite_cb(0xB1, PRIMO_MEM1_SEG); // normal RAM segment z80ex_pwrite_cb(0xB2, PRIMO_MEM2_SEG); // normal RAM segment z80ex_pwrite_cb(0xB3, PRIMO_VID_SEG); // a video segment as the Primo video RAM primo_switch(128 | 64); // turn on Primo I/O mode Z80_PC = 0; // Z80 reset address to the Primo ROM z80ex_reset(); // reset the CPU only!! set_ep_cpu(CPU_Z80); // good old Z80 NMOS CPU is selected set_cpu_clock(2500000); }
LIB_EXPORT Z80EX_CONTEXT *z80ex_create( z80ex_mread_cb mrcb_fn, void *mrcb_data, z80ex_mwrite_cb mwcb_fn, void *mwcb_data, z80ex_pread_cb prcb_fn, void *prcb_data, z80ex_pwrite_cb pwcb_fn, void *pwcb_data, z80ex_intread_cb ircb_fn, void *ircb_data ) { Z80EX_CONTEXT *cpu; if((cpu=(Z80EX_CONTEXT *)malloc(sizeof(Z80EX_CONTEXT))) == NULL) return(NULL); memset(cpu,0x00,sizeof(Z80EX_CONTEXT)); z80ex_reset(cpu); cpu->mread_cb=mrcb_fn; cpu->mread_cb_user_data=mrcb_data; cpu->mwrite_cb=mwcb_fn; cpu->mwrite_cb_user_data=mwcb_data; cpu->pread_cb=prcb_fn; cpu->pread_cb_user_data=prcb_data; cpu->pwrite_cb=pwcb_fn; cpu->pwrite_cb_user_data=pwcb_data; cpu->intread_cb=ircb_fn; cpu->intread_cb_user_data=ircb_data; return(cpu); }
void Z80CPUBase::reset() { if (m_context == 0) return; z80ex_reset(m_context); m_isHalted = false; m_intPending=false; }
void z80ex_init ( void ) { memset(&z80ex, 0x00, sizeof(Z80EX_CONTEXT)); z80ex_reset(); z80ex.nmos = 1; #ifdef Z80EX_HAVE_TSTATE_CB_VAR z80ex.tstate_cb = 0; #endif #ifdef Z80EX_Z180_SUPPORT z80ex.internal_int_disable = 0; z80ex.z180 = 0; #endif }
void ResetSequence(void) { int cnt = cnt_reset; void (** ptr)(void) = hnd_reset; z80ex_reset(cpu); while (cnt) { (*ptr)(); ptr++; cnt--; } }