📄 mz80help.c
字号:
// THIRD EMULATED Z80void AddZ80CROMBase(UINT8 *d0, UINT16 d1, UINT16 d2){ Z80_context[2].z80Base=d0; z80_data[2].base_ram = Z80_context[2].z80Base; Z80_context[2].z80intAddr=d1; Z80_context[2].z80nmiAddr=d2;}void AddZ80CReadByte(UINT32 d0, UINT32 d1, void *d2, UINT8 *d3){ add_mz80_memory_region_rb(2, d0, d1, d2, d3);}void AddZ80CWriteByte(UINT32 d0, UINT32 d1, void *d2, UINT8 *d3){ add_mz80_memory_region_wb(2, d0, d1, d2, d3);}void AddZ80CReadPort(UINT16 d0, UINT16 d1, void *d2, UINT8 *d3){ add_mz80_port_region_rb(2, d0, d1, d2, d3);}void AddZ80CWritePort(UINT16 d0, UINT16 d1, void *d2, UINT8 *d3){ add_mz80_port_region_wb(2, d0, d1, d2, d3);}void AddZ80CInit(void){ Z80_context[2].z80MemRead = Z80_memory_rb[2]; Z80_context[2].z80MemWrite = Z80_memory_wb[2]; Z80_context[2].z80IoRead = Z80_port_rb[2]; Z80_context[2].z80IoWrite = Z80_port_wb[2]; AddLoadCallback(Z80C_load_update); AddSaveData(SAVE_Z80_2, (UINT8 *) &Z80_context[2], sizeof(Z80_context[2])); MZ80Engine=3;}/* * Fill in the basic structures via these functions... */// FOURTH EMULATED Z80void AddZ80DROMBase(UINT8 *d0, UINT16 d1, UINT16 d2){ Z80_context[3].z80Base=d0; z80_data[3].base_ram = Z80_context[3].z80Base; Z80_context[3].z80intAddr=d1; Z80_context[3].z80nmiAddr=d2;}void AddZ80DReadByte(UINT32 d0, UINT32 d1, void *d2, UINT8 *d3){ add_mz80_memory_region_rb(3, d0, d1, d2, d3);}void AddZ80DWriteByte(UINT32 d0, UINT32 d1, void *d2, UINT8 *d3){ add_mz80_memory_region_wb(3, d0, d1, d2, d3);}void AddZ80DReadPort(UINT16 d0, UINT16 d1, void *d2, UINT8 *d3){ add_mz80_port_region_rb(3, d0, d1, d2, d3);}void AddZ80DWritePort(UINT16 d0, UINT16 d1, void *d2, UINT8 *d3){ add_mz80_port_region_wb(3, d0, d1, d2, d3);}void AddZ80DInit(void){ Z80_context[3].z80MemRead = Z80_memory_rb[3]; Z80_context[3].z80MemWrite = Z80_memory_wb[3]; Z80_context[3].z80IoRead = Z80_port_rb[3]; Z80_context[3].z80IoWrite = Z80_port_wb[3]; AddLoadCallback(Z80D_load_update); AddSaveData(SAVE_Z80_3, (UINT8 *) &Z80_context[3], sizeof(Z80_context[3])); MZ80Engine=4;}void Z80A_load_update(void){ #ifdef RAINE_DEBUG print_debug("Z80A Load Callback()\n"); #endif Z80_context[0].z80MemRead = Z80_memory_rb[0]; Z80_context[0].z80MemWrite = Z80_memory_wb[0]; Z80_context[0].z80IoRead = Z80_port_rb[0]; Z80_context[0].z80IoWrite = Z80_port_wb[0]; Z80_context[0].z80Base = z80_data[0].base_ram;}void Z80B_load_update(void){ #ifdef RAINE_DEBUG print_debug("Z80B Load Callback()\n"); #endif Z80_context[1].z80MemRead = Z80_memory_rb[1]; Z80_context[1].z80MemWrite = Z80_memory_wb[1]; Z80_context[1].z80IoRead = Z80_port_rb[1]; Z80_context[1].z80IoWrite = Z80_port_wb[1]; Z80_context[1].z80Base = z80_data[1].base_ram;}void Z80C_load_update(void){ #ifdef RAINE_DEBUG print_debug("Z80C Load Callback()\n"); #endif Z80_context[2].z80MemRead = Z80_memory_rb[2]; Z80_context[2].z80MemWrite = Z80_memory_wb[2]; Z80_context[2].z80IoRead = Z80_port_rb[2]; Z80_context[2].z80IoWrite = Z80_port_wb[2]; Z80_context[2].z80Base = z80_data[2].base_ram;}void Z80D_load_update(void){ #ifdef RAINE_DEBUG print_debug("Z80D Load Callback()\n"); #endif Z80_context[3].z80MemRead = Z80_memory_rb[3]; Z80_context[3].z80MemWrite = Z80_memory_wb[3]; Z80_context[3].z80IoRead = Z80_port_rb[3]; Z80_context[3].z80IoWrite = Z80_port_wb[3]; Z80_context[3].z80Base = z80_data[3].base_ram;}void ClearZ80List(void){ UINT32 ta; for(ta = 0; ta < MAX_Z80; ta ++){ memory_count_rb[ta] = 0; memory_count_wb[ta] = 0; port_count_rb[ta] = 0; port_count_wb[ta] = 0; z80_data[ta].read_bank.count = 0; z80_data[ta].write_bank.count = 0; }}void StopZ80(UINT16 address, UINT8 data){ #ifdef RAINE_DEBUG print_debug("[StopZ80]\n"); #endif mz80ReleaseTimeslice();}static UINT16 StopAddress=0;void SetStopZ80Mode2(UINT16 address){ StopAddress=address;}void StopZ80Mode2(UINT16 address, UINT8 data){ #ifdef RAINE_DEBUG print_debug("[StopZ80]\n"); #endif z80pc=StopAddress; mz80ReleaseTimeslice();}static UINT16 StopAddressB=0;void SetStopZ80BMode2(UINT16 address){ StopAddressB=address;}void StopZ80BMode2(UINT16 address, UINT8 data){ #ifdef RAINE_DEBUG print_debug("[StopZ80B]\n"); #endif z80pc=StopAddressB; mz80ReleaseTimeslice();}static UINT16 StopAddressC=0;void SetStopZ80CMode2(UINT16 address){ StopAddressC=address;}void StopZ80CMode2(UINT16 address, UINT8 data){ #ifdef RAINE_DEBUG print_debug("[StopZ80C]\n"); #endif z80pc=StopAddressC; mz80ReleaseTimeslice();}static UINT16 StopAddressD=0;void SetStopZ80DMode2(UINT16 address){ StopAddressD=address;}void StopZ80DMode2(UINT16 address, UINT8 data){ #ifdef RAINE_DEBUG print_debug("[StopZ80D]\n"); #endif z80pc=StopAddressD; mz80ReleaseTimeslice();}UINT16 DefBadReadZ80(UINT16 offset){ #ifdef RAINE_DEBUG print_debug("Z80BadRead(%04x) [%04x]\n",offset,z80pc); #endif return(0xff);}void DefBadWriteZ80(UINT16 offset, UINT8 data){ #ifdef RAINE_DEBUG print_debug("Z80BadWrite(%04x,%02x) [%04x]\n",offset,data,z80pc); #endif}void WriteMZ80Byte(UINT32 address, UINT8 data){ int ta; int cpu; if (MZ80Engine == 1) cpu = 0; else cpu = 1; for(ta=0;ta<99;ta++){ if((Z80_memory_wb[cpu][ta].lowAddr)==-1){ ta=99; #ifdef RAINE_DEBUG print_debug("Wb(%04x,%02x) [Via WriteMZ80Byte]\n",address,data); #endif } else{ if((address>=Z80_memory_wb[cpu][ta].lowAddr)&&(Z80_memory_wb[cpu][ta].highAddr>=address)){ if(Z80_memory_wb[cpu][ta].memoryCall==NULL){#ifdef RAINE_DEBUG print_debug("WB(%04x) bank %d by WriteMZ80Byte\n",address,ta);#endif WriteByte( ((UINT8 *) Z80_memory_wb[cpu][ta].pUserArea) + address,data); ta=99; } //else{ // *MC68000A_memoryall[ta].memorycall(address,data); //} } } }}UINT8 ReadMZ80Byte(UINT32 address){ int ta; int cpu; if (MZ80Engine == 1) cpu = 0; else cpu = 1; for(ta=0;ta<99;ta++){ if((Z80_memory_rb[cpu][ta].lowAddr)==-1){ #ifdef RAINE_DEBUG print_debug("Rb(%04x) [Via ReadMZ80Byte]\n",address); #endif return(0x00); } else{ if((address>=Z80_memory_rb[cpu][ta].lowAddr)&&(Z80_memory_rb[cpu][ta].highAddr>=address)){ if(Z80_memory_rb[cpu][ta].memoryCall==NULL){ return ReadByte( ((UINT8 *) Z80_memory_rb[cpu][ta].pUserArea) + address); } } } } return 0x00;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -