From: K.Ohta Date: Mon, 2 Mar 2020 12:17:51 +0000 (+0900) Subject: [VM][JX][MZ2800] Fix FTBFS with I8088. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=24a74fdbe6a7472b85c03ba13ff634b71ac388f8;p=csp-qt%2Fcommon_source_project-fm7.git [VM][JX][MZ2800] Fix FTBFS with I8088. [VM][MZ6550] Fix FTBFS. --- diff --git a/source/src/vm/event.cpp b/source/src/vm/event.cpp index 9e05bd4be..cd0ab8dba 100644 --- a/source/src/vm/event.cpp +++ b/source/src/vm/event.cpp @@ -26,12 +26,8 @@ #endif #if defined(USE_CPU_I286) -#if defined(_JX) -#include "jx/i286.h" -#else #include "i286.h" #endif -#endif #if defined(USE_CPU_I386) || defined(USE_CPU_I486) || defined(USE_CPU_PENTIUM) #include "i386.h" diff --git a/source/src/vm/i86.cpp b/source/src/vm/i86.cpp index 4c6d06f9a..aa87856e4 100644 --- a/source/src/vm/i86.cpp +++ b/source/src/vm/i86.cpp @@ -204,7 +204,7 @@ int I86::run(int icount) case INTEL_8086: return CPU_EXECUTE_CALL(i8086); case INTEL_8088: - return CPU_EXECUTE_CALL(i8086); + return CPU_EXECUTE_CALL(i8088); case INTEL_80186: return CPU_EXECUTE_CALL(i80186); case NEC_V30: diff --git a/source/src/vm/jx/CMakeLists.txt b/source/src/vm/jx/CMakeLists.txt index d0729bba1..de9172188 100644 --- a/source/src/vm/jx/CMakeLists.txt +++ b/source/src/vm/jx/CMakeLists.txt @@ -8,7 +8,7 @@ set(BASIC_VM_FILES floppy.cpp keyboard.cpp speaker.cpp - + ./i86.cpp ) add_library(vm_jx ${BASIC_VM_FILES}) diff --git a/source/src/vm/jx/i86.cpp b/source/src/vm/jx/i86.cpp index affc91fce..2df255a3e 100644 --- a/source/src/vm/jx/i86.cpp +++ b/source/src/vm/jx/i86.cpp @@ -8,13 +8,13 @@ [ i86 ] */ -#include "i86.h" +#include "./i86.h" #ifdef USE_DEBUGGER #include "../debugger.h" #include "../i386_dasm.h" //#include "../v30_dasm.h" #endif - +namespace JX { /* ---------------------------------------------------------------------------- MAME i286 ---------------------------------------------------------------------------- */ @@ -195,7 +195,7 @@ int I86::run(int icount) if(cpustate->pc == 0xff17d) cpustate->pc = 0xff18f; #endif #ifdef KEYBOARD_HACK - if(cpustate->pc == 0xfa909) { cpustate->regs.b[BH] = read_port_byte(0xa1); cpustate->pc = 0xfa97c; } + if(cpustate->pc == 0xfa909) { cpustate->regs.b[BH] = read_port_byte(cpustate, 0xa1); cpustate->pc = 0xfa97c; } if(cpustate->pc == 0xff6e1) { cpustate->regs.b[AL] = 0x0d; cpustate->pc += 2; } #endif #endif @@ -486,3 +486,4 @@ bool I86::process_state(FILEIO* state_fio, bool loading) return true; } +} diff --git a/source/src/vm/jx/i86.h b/source/src/vm/jx/i86.h index a2dc1aa10..aa39a5de3 100644 --- a/source/src/vm/jx/i86.h +++ b/source/src/vm/jx/i86.h @@ -21,6 +21,7 @@ class DEBUGGER; #endif +namespace JX { //enum { // INTEL_8086 = 0, // INTEL_8088, @@ -135,5 +136,5 @@ public: #endif // int device_model; }; - +} #endif diff --git a/source/src/vm/jx/jx.cpp b/source/src/vm/jx/jx.cpp index 03f70d398..3ae6bc9b8 100644 --- a/source/src/vm/jx/jx.cpp +++ b/source/src/vm/jx/jx.cpp @@ -18,7 +18,7 @@ #include "../i8253.h" #include "../i8255.h" #include "../i8259.h" -#include "../i86.h" +#include "./i86.h" #include "../io.h" #include "../memory.h" #include "../noise.h" @@ -35,7 +35,7 @@ #include "keyboard.h" #include "speaker.h" -using JX::I286; +using JX::I86; using JX::DISPLAY; using JX::FLOPPY; using JX::KEYBOARD; diff --git a/source/src/vm/jx/jx.h b/source/src/vm/jx/jx.h index 6fee8251e..a429f8e53 100644 --- a/source/src/vm/jx/jx.h +++ b/source/src/vm/jx/jx.h @@ -65,7 +65,6 @@ class I8251; class I8253; class I8255; class I8259; -class I86; class IO; class MEMORY; class PCM1BIT; @@ -73,6 +72,7 @@ class SN76489AN; class UPD765A; namespace JX { + class I86; class DISPLAY; class FLOPPY; class KEYBOARD; @@ -91,7 +91,7 @@ protected: I8253* pit; I8255* pio; I8259* pic; - I86* cpu; + JX::I86* cpu; IO* io; MEMORY* mem; PCM1BIT* pcm; diff --git a/source/src/vm/mame/emu/cpu/i86/i86.c b/source/src/vm/mame/emu/cpu/i86/i86.c index 10b215e84..91dc4afd1 100644 --- a/source/src/vm/mame/emu/cpu/i86/i86.c +++ b/source/src/vm/mame/emu/cpu/i86/i86.c @@ -485,6 +485,183 @@ CPU_EXECUTE( i8086 ) return passed_icount; } +CPU_EXECUTE( i8088 ) +{ + if (cpustate->halted || cpustate->busreq || cpustate->haltreq) + { +//#ifdef SINGLE_MODE_DMA + if(!cpustate->haltreq) { + if(cpustate->dma != NULL) { + cpustate->dma->do_dma(); + } + } +//#endif + bool now_debugging = false; + if(cpustate->debugger != NULL) { + now_debugging = cpustate->debugger->now_debugging; + } + if(now_debugging) { + cpustate->debugger->check_break_points(cpustate->pc); + if(cpustate->debugger->now_suspended) { + cpustate->debugger->now_waiting = true; + cpustate->emu->start_waiting_in_debugger(); + while(cpustate->debugger->now_debugging && cpustate->debugger->now_suspended) { + cpustate->emu->process_waiting_in_debugger(); + } + cpustate->emu->finish_waiting_in_debugger(); + cpustate->debugger->now_waiting = false; + } + if(cpustate->debugger->now_debugging) { + cpustate->program = cpustate->io = cpustate->debugger; + } else { + now_debugging = false; + } + if(now_debugging) { + if(!cpustate->debugger->now_going) { + cpustate->debugger->now_suspended = true; + } + cpustate->program = cpustate->program_stored; + cpustate->io = cpustate->io_stored; + } + } + if (icount == -1) { + int passed_icount = max(1, cpustate->extra_cycles); + // this is main cpu, cpustate->icount is not used + /*cpustate->icount = */cpustate->extra_cycles = 0; +//#ifdef USE_DEBUGGER + cpustate->total_icount += passed_icount; +//#endif + cpu_wait_i86(cpustate, passed_icount); + return passed_icount; + } else { + cpustate->icount += icount; + int base_icount = cpustate->icount; + + /* adjust for any interrupts that came in */ + cpustate->icount -= cpustate->extra_cycles; + cpustate->extra_cycles = 0; + + /* if busreq is raised, spin cpu while remained clock */ + if (cpustate->icount > 0) { + cpustate->icount = 0; + } +//#ifdef USE_DEBUGGER + cpustate->total_icount += base_icount - cpustate->icount; +//#endif + cpu_wait_i86(cpustate, base_icount - cpustate->icount); + int passed_icount = base_icount - cpustate->icount; + cpustate->icount = 0; + return passed_icount; + } + } + + if (icount == -1) { + cpustate->icount = 1; + } else { + cpustate->icount += icount; + } + int base_icount = cpustate->icount; + + /* copy over the cycle counts if they're not correct */ + if (timing.id != 8086) + timing = i8086_cycles; + + /* adjust for any interrupts that came in */ +//#ifdef USE_DEBUGGER + cpustate->total_icount += cpustate->extra_cycles; +//#endif + cpustate->icount -= cpustate->extra_cycles; + cpustate->extra_cycles = 0; + + /* run until we're out */ + while (cpustate->icount > 0 && !cpustate->busreq && !cpustate->haltreq) + { +//#ifdef USE_DEBUGGER + bool now_debugging = false; + if(cpustate->debugger != NULL) { + now_debugging = cpustate->debugger->now_debugging; + } + if(now_debugging) { + cpustate->debugger->check_break_points(cpustate->pc); + if(cpustate->debugger->now_suspended) { + cpustate->debugger->now_waiting = true; + cpustate->emu->start_waiting_in_debugger(); + while(cpustate->debugger->now_debugging && cpustate->debugger->now_suspended) { + cpustate->emu->process_waiting_in_debugger(); + } + cpustate->emu->finish_waiting_in_debugger(); + cpustate->debugger->now_waiting = false; + } + if(cpustate->debugger->now_debugging) { + cpustate->program = cpustate->io = cpustate->debugger; + } else { + now_debugging = false; + } + cpustate->debugger->add_cpu_trace(cpustate->pc); + int first_icount = cpustate->icount; + cpustate->seg_prefix = FALSE; + cpustate->prevpc = cpustate->pc; + cpustate->MF = 1; /* bit15 in flags is always 1 */ + TABLE86; + cpustate->total_icount += first_icount - cpustate->icount; +//#ifdef SINGLE_MODE_DMA + if(!cpustate->haltreq) { + if(cpustate->dma != NULL) { + cpustate->dma->do_dma(); + } + } +//#endif + if(now_debugging) { + if(!cpustate->debugger->now_going) { + cpustate->debugger->now_suspended = true; + } + cpustate->program = cpustate->program_stored; + cpustate->io = cpustate->io_stored; + } + } else { + if(cpustate->debugger != NULL) { + cpustate->debugger->add_cpu_trace(cpustate->pc); + } + int first_icount = cpustate->icount; +//#endif + cpustate->seg_prefix = FALSE; + cpustate->prevpc = cpustate->pc; + cpustate->MF = 1; /* bit15 in flags is always 1 */ + TABLE86; +//#ifdef USE_DEBUGGER + cpustate->total_icount += first_icount - cpustate->icount; +//#endif +//#ifdef SINGLE_MODE_DMA + if(!cpustate->haltreq) { + if(cpustate->dma != NULL) { + cpustate->dma->do_dma(); + } + } +//#endif +//#ifdef USE_DEBUGGER + } +//#endif + /* adjust for any interrupts that came in */ +//#ifdef USE_DEBUGGER + cpustate->total_icount += cpustate->extra_cycles; +//#endif + cpustate->icount -= cpustate->extra_cycles; + cpustate->extra_cycles = 0; + } + + /* if busreq is raised, spin cpu while remained clock */ + if (cpustate->icount > 0 && (cpustate->busreq || cpustate->haltreq)) { +//#ifdef USE_DEBUGGER + cpustate->total_icount += cpustate->icount; +//#endif + cpustate->icount = 0; + } + cpu_wait_i86(cpustate, base_icount - cpustate->icount); + int passed_icount = base_icount - cpustate->icount; + cpustate->icount = 0; + return passed_icount; +} + #include "i86.h" #undef PREFIX diff --git a/source/src/vm/mz2800/mz2800.cpp b/source/src/vm/mz2800/mz2800.cpp index 4ea63b45f..65389ce9e 100644 --- a/source/src/vm/mz2800/mz2800.cpp +++ b/source/src/vm/mz2800/mz2800.cpp @@ -74,7 +74,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu) event = new EVENT(this, emu); // must be 2nd device dummy->set_device_name(_T("1st Dummy")); - cpu = new I80286(this, emu); + cpu = new I286(this, emu); pit = new I8253(this, emu); pio0 = new I8255(this, emu); pic = new I8259(this, emu); diff --git a/source/src/vm/mz2800/mz2800.h b/source/src/vm/mz2800/mz2800.h index 96db6ae2c..18927062c 100644 --- a/source/src/vm/mz2800/mz2800.h +++ b/source/src/vm/mz2800/mz2800.h @@ -61,7 +61,7 @@ class EVENT; class I8253; class I8255; class I8259; -class I80286; +class I286; class IO; class MB8877; class NOT; @@ -100,7 +100,7 @@ protected: I8253* pit; I8255* pio0; I8259* pic; - I80286* cpu; + I286* cpu; IO* io; MB8877* fdc; NOT* not_busy; diff --git a/source/src/vm/mz5500/mz5500.h b/source/src/vm/mz5500/mz5500.h index a733da859..43b501290 100644 --- a/source/src/vm/mz5500/mz5500.h +++ b/source/src/vm/mz5500/mz5500.h @@ -115,7 +115,7 @@ protected: I8237* dma; I8255* pio; I8259* pic; // includes 2chips -#if defined(HAS_I286) +#if defined(_MZ6550) I286* cpu; #else I86* cpu;