From b8868a4a3ab49a099e7caf63754dce417916c770 Mon Sep 17 00:00:00 2001 From: "K.Ohta" Date: Mon, 4 Dec 2017 13:49:14 +0900 Subject: [PATCH] [General] Fix more FTBFS. --- source/src/vm/fm16pi/fm16pi.cpp | 4 +- source/src/vm/fm7/vram.cpp | 191 +++++++++++---------- source/src/vm/libcpu_newdev/device.cpp | 11 ++ source/src/vm/libcpu_newdev/device.h | 1 + .../src/vm/libcpu_newdev/libcpu_i386/i386_real.cpp | 3 +- .../vm/libcpu_newdev/libcpu_i386/i386op16_real.cpp | 5 +- source/src/vm/mame/emu/cpu/i86/i286.c | 1 - 7 files changed, 114 insertions(+), 102 deletions(-) diff --git a/source/src/vm/fm16pi/fm16pi.cpp b/source/src/vm/fm16pi/fm16pi.cpp index 8d69877dd..bd3dfd644 100644 --- a/source/src/vm/fm16pi/fm16pi.cpp +++ b/source/src/vm/fm16pi/fm16pi.cpp @@ -16,7 +16,7 @@ #include "../i8253.h" #include "../i8255.h" #include "../i8259.h" -#include "../i86.h" +#include "../i286.h" #include "../io.h" #include "../mb8877.h" #include "../memory.h" @@ -46,7 +46,7 @@ VM::VM(EMU* parent_emu) : emu(parent_emu) pit = new I8253(this, emu); pio = new I8255(this, emu); // for system port pic = new I8259(this, emu); - cpu = new I86(this, emu); + cpu = new I286(this, emu); io = new IO(this, emu); fdc = new MB8877(this, emu); fdc->set_context_noise_seek(new NOISE(this, emu)); diff --git a/source/src/vm/fm7/vram.cpp b/source/src/vm/fm7/vram.cpp index ed30aa072..e44ff3cf4 100644 --- a/source/src/vm/fm7/vram.cpp +++ b/source/src/vm/fm7/vram.cpp @@ -9,7 +9,7 @@ #include "emu.h" #include "fm7_display.h" #if defined(_OPENMP) - #include +#include #endif uint8_t DISPLAY::read_vram_l4_400l(uint32_t addr, uint32_t offset) @@ -48,7 +48,7 @@ void DISPLAY::write_vram_l4_400l(uint32_t addr, uint32_t offset, uint32_t data) pagemod = addr & 0x4000; gvram[((addr + offset) & mask) | pagemod] = (uint8_t)data; } else if(addr < 0x9800) { - textvram[addr & 0x0fff] = (uint8_t)data; + textvram[addr & 0x0fff] = (uint8_t)data; } else { // $9800-$bfff //return subrom_l4[addr - 0x9800]; } @@ -645,7 +645,7 @@ void DISPLAY::draw_screen2() //if(!(vram_wrote_shadow)) return; yoff_d1 = yoff_d2 = offset_point; #endif - // Set blank + // Set blank if(!crt_flag) { if(crt_flag_bak) { scrntype_t *ppp; @@ -657,7 +657,7 @@ void DISPLAY::draw_screen2() #endif #if !defined(FIXED_FRAMEBUFFER_SIZE) #if defined(_OPENMP) - #pragma omp parallel for shared(vram_draw_table), private(ppp, yy) +#pragma omp parallel for shared(vram_draw_table), private(ppp, yy) #endif for(y = 0; y < 200; y += 8) { for(yy = 0; yy < 8; yy++) { @@ -668,7 +668,7 @@ void DISPLAY::draw_screen2() } #else #if defined(_OPENMP) - #pragma omp parallel for shared(vram_draw_table), private(ppp, yy) +#pragma omp parallel for shared(vram_draw_table), private(ppp, yy) #endif for(y = 0; y < 400; y += 8) { for(yy = 0; yy < 8; yy++) { @@ -681,7 +681,7 @@ void DISPLAY::draw_screen2() } else if(display_mode == DISPLAY_MODE_8_400L) { emu->set_vm_screen_size(640, 400, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH_ASPECT, WINDOW_HEIGHT_ASPECT); #if defined(_OPENMP) - #pragma omp parallel for shared(vram_draw_table), private(ppp, yy) +#pragma omp parallel for shared(vram_draw_table), private(ppp, yy) #endif for(y = 0; y < 400; y += 8) { for(yy = 0; yy < 8; yy++) { @@ -698,7 +698,7 @@ void DISPLAY::draw_screen2() #endif #if !defined(FIXED_FRAMEBUFFER_SIZE) #if defined(_OPENMP) - #pragma omp parallel for shared(vram_draw_table), private(ppp, yy) +#pragma omp parallel for shared(vram_draw_table), private(ppp, yy) #endif for(y = 0; y < 200; y += 8) { for(yy = 0; yy < 8; yy++) { @@ -709,7 +709,7 @@ void DISPLAY::draw_screen2() } #else #if defined(_OPENMP) - #pragma omp parallel for shared(vram_draw_table), private(ppp, yy) +#pragma omp parallel for shared(vram_draw_table), private(ppp, yy) #endif for(y = 0; y < 400; y++) { for(yy = 0; yy < 8; yy++) { @@ -743,24 +743,24 @@ void DISPLAY::draw_screen2() yoff = 0; //rgbmask = ~multimode_dispmask; #if defined(_OPENMP) - #pragma omp parallel for shared(vram_draw_table), private(p, p2, yoff, ii, x, yy) +#pragma omp parallel for shared(vram_draw_table), private(p, p2, yoff, ii, x, yy) #endif for(y = 0; y < 200; y += 8) { - for(yy = 0; yy < 8; yy++) { + for(yy = 0; yy < 8; yy++) { - if(!vram_draw_table[y + yy]) continue; - vram_draw_table[y + yy] = false; + if(!vram_draw_table[y + yy]) continue; + vram_draw_table[y + yy] = false; #if !defined(FIXED_FRAMEBUFFER_SIZE) - p = emu->get_screen_buffer(y + yy); - p2 = NULL; + p = emu->get_screen_buffer(y + yy); + p2 = NULL; #else - p = emu->get_screen_buffer((y + yy) * 2); - p2 = emu->get_screen_buffer((y + yy) * 2 + 1); + p = emu->get_screen_buffer((y + yy) * 2); + p2 = emu->get_screen_buffer((y + yy) * 2 + 1); #endif - if(p == NULL) continue; - yoff = (y + yy) * 80; + if(p == NULL) continue; + yoff = (y + yy) * 80; # if defined(_FM77AV40EX) || defined(_FM77AV40SX) - if(window_opened && (wy_low <= (y + yy)) && (wy_high > (y + yy))) { + if(window_opened && (wy_low <= (y + yy)) && (wy_high > (y + yy))) { for(x = 0; x < 80; x++) { if((x >= wx_begin) && (x < wx_end)) { GETVRAM_8_200L(yoff, p, p2, true, scan_line); @@ -773,21 +773,21 @@ void DISPLAY::draw_screen2() p += 8; yoff++; } - } else + } else # endif - { - for(x = 0; x < 10; x++) { - for(ii = 0; ii < 8; ii++) { - GETVRAM_8_200L(yoff + ii, p, p2, false, scan_line); + { + for(x = 0; x < 10; x++) { + for(ii = 0; ii < 8; ii++) { + GETVRAM_8_200L(yoff + ii, p, p2, false, scan_line); #if defined(FIXED_FRAMEBUFFER_SIZE) - p2 += 8; + p2 += 8; #endif - p += 8; + p += 8; + } + yoff += 8; } - yoff += 8; } } - } } return; @@ -806,24 +806,24 @@ void DISPLAY::draw_screen2() if(!multimode_dispflags[1]) mask = mask | 0x0f0; if(!multimode_dispflags[2]) mask = mask | 0xf00; #if defined(_OPENMP) - #pragma omp parallel for shared(vram_draw_table), private(p, p2, yoff, ii, x, yy) +#pragma omp parallel for shared(vram_draw_table), private(p, p2, yoff, ii, x, yy) #endif for(y = 0; y < 200; y += 4) { - for(yy = 0; yy < 4; yy++) { - if(!vram_draw_table[y + yy]) continue; - vram_draw_table[y + yy] = false; + for(yy = 0; yy < 4; yy++) { + if(!vram_draw_table[y + yy]) continue; + vram_draw_table[y + yy] = false; #if !defined(FIXED_FRAMEBUFFER_SIZE) - p = emu->get_screen_buffer(y + yy); - p2 = NULL; + p = emu->get_screen_buffer(y + yy); + p2 = NULL; #else - p = emu->get_screen_buffer((y + yy) * 2 ); - p2 = emu->get_screen_buffer((y + yy) * 2 + 1); + p = emu->get_screen_buffer((y + yy) * 2 ); + p2 = emu->get_screen_buffer((y + yy) * 2 + 1); #endif - if(p == NULL) continue; - yoff = (y + yy) * 40; + if(p == NULL) continue; + yoff = (y + yy) * 40; # if defined(_FM77AV40EX) || defined(_FM77AV40SX) - if(window_opened && (wy_low <= (y + yy)) && (wy_high > (y + yy))) { + if(window_opened && (wy_low <= (y + yy)) && (wy_high > (y + yy))) { for(x = 0; x < 40; x++) { if((x >= wx_begin) && (x < wx_end)) { GETVRAM_4096(yoff, p, p2, mask, true, scan_line); @@ -838,23 +838,23 @@ void DISPLAY::draw_screen2() #endif yoff++; } - } else + } else # endif - { - for(x = 0; x < 5; x++) { - for(ii = 0; ii < 8; ii++) { - GETVRAM_4096(yoff + ii, p, p2, mask, false, scan_line); + { + for(x = 0; x < 5; x++) { + for(ii = 0; ii < 8; ii++) { + GETVRAM_4096(yoff + ii, p, p2, mask, false, scan_line); #if defined(FIXED_FRAMEBUFFER_SIZE) - p2 += 16; - p += 16; + p2 += 16; + p += 16; #else - p += 8; + p += 8; #endif + } + yoff += 8; } - yoff += 8; } } - } } return; @@ -866,40 +866,40 @@ void DISPLAY::draw_screen2() yoff = 0; //rgbmask = ~multimode_dispmask; #if defined(_OPENMP) - #pragma omp parallel for shared(vram_draw_table), private(pp, p, yoff, x, ii, yy) +#pragma omp parallel for shared(vram_draw_table), private(pp, p, yoff, x, ii, yy) #endif for(y = 0; y < 400; y += 8) { - for(yy = 0; yy < 8; yy++) { - if(!vram_draw_table[y + yy]) continue; - vram_draw_table[y + yy] = false; + for(yy = 0; yy < 8; yy++) { + if(!vram_draw_table[y + yy]) continue; + vram_draw_table[y + yy] = false; - p = emu->get_screen_buffer(y + yy); - if(p == NULL) continue; - pp = p; - yoff = (y + yy) * 80; + p = emu->get_screen_buffer(y + yy); + if(p == NULL) continue; + pp = p; + yoff = (y + yy) * 80; # if defined(_FM77AV40EX) || defined(_FM77AV40SX) - if(window_opened && (wy_low <= (y + yy)) && (wy_high > (y + yy))) { - for(x = 0; x < 80; x++) { - if((x >= wx_begin) && (x < wx_end)) { - GETVRAM_8_400L(yoff, p, true); - } else { - GETVRAM_8_400L(yoff, p, false); + if(window_opened && (wy_low <= (y + yy)) && (wy_high > (y + yy))) { + for(x = 0; x < 80; x++) { + if((x >= wx_begin) && (x < wx_end)) { + GETVRAM_8_400L(yoff, p, true); + } else { + GETVRAM_8_400L(yoff, p, false); + } + p += 8; + yoff++; } - p += 8; - yoff++; - } - } else + } else # endif - for(x = 0; x < 10; x++) { + for(x = 0; x < 10; x++) { - for(ii = 0; ii < 8; ii++) { - GETVRAM_8_400L(yoff + ii, p); - p += 8; - } - yoff += 8; + for(ii = 0; ii < 8; ii++) { + GETVRAM_8_400L(yoff + ii, p); + p += 8; + } + yoff += 8; + } } } - } return; } else if(display_mode == DISPLAY_MODE_256k) { int ii; @@ -910,37 +910,38 @@ void DISPLAY::draw_screen2() #endif //rgbmask = ~multimode_dispmask; #if defined(_OPENMP) - #pragma omp parallel for +#pragma omp parallel for #endif #if defined(_OPENMP) - #pragma omp parallel for shared(vram_draw_table), private(pp, p, yoff, x, ii, yy) +#pragma omp parallel for shared(vram_draw_table), private(pp, p, yoff, x, ii, yy) #endif for(y = 0; y < 200; y += 4) { - for(yy = 0; yy < 4; yy++) { - if(!vram_draw_table[y + yy]) continue; - vram_draw_table[y + yy] = false; + for(yy = 0; yy < 4; yy++) { + if(!vram_draw_table[y + yy]) continue; + vram_draw_table[y + yy] = false; #if !defined(FIXED_FRAMEBUFFER_SIZE) - p = emu->get_screen_buffer(y + yy); - p2 = NULL; + p = emu->get_screen_buffer(y + yy); + p2 = NULL; #else - p = emu->get_screen_buffer((y + yy) * 2 ); - p2 = emu->get_screen_buffer((y + yy) * 2 + 1); -#endif - if(p == NULL) continue; - pp = p; - yoff = (y + yy) * 40; - { - for(x = 0; x < 5; x++) { - for(ii = 0; ii < 8; ii++) { - GETVRAM_256k(yoff + ii, p, p2, scan_line); + p = emu->get_screen_buffer((y + yy) * 2 ); + p2 = emu->get_screen_buffer((y + yy) * 2 + 1); +#endif + if(p == NULL) continue; + pp = p; + yoff = (y + yy) * 40; + { + for(x = 0; x < 5; x++) { + for(ii = 0; ii < 8; ii++) { + GETVRAM_256k(yoff + ii, p, p2, scan_line); #if !defined(FIXED_FRAMEBUFFER_SIZE) - p += 8; + p += 8; #else - p += 16; - p2 += 16; + p += 16; + p2 += 16; #endif + } + yoff += 8; } - yoff += 8; } } } diff --git a/source/src/vm/libcpu_newdev/device.cpp b/source/src/vm/libcpu_newdev/device.cpp index 16a5504e8..8f0a0ea29 100644 --- a/source/src/vm/libcpu_newdev/device.cpp +++ b/source/src/vm/libcpu_newdev/device.cpp @@ -220,6 +220,17 @@ void DEVICE::out_debug_log(const char *fmt, ...) va_end(ap); } +void DEVICE::force_out_debug_log(const char *fmt, ...) +{ + char strbuf[4096]; + va_list ap; + + va_start(ap, fmt); + vsnprintf(strbuf, 4095, fmt, ap); + emu->force_out_debug_log("%s", strbuf); + va_end(ap); +} + // debugger void *DEVICE::get_debugger() { diff --git a/source/src/vm/libcpu_newdev/device.h b/source/src/vm/libcpu_newdev/device.h index 9446e09ff..be6fa53d2 100644 --- a/source/src/vm/libcpu_newdev/device.h +++ b/source/src/vm/libcpu_newdev/device.h @@ -550,6 +550,7 @@ public: virtual void set_volume(int ch, int decibel_l, int decibel_r) {} // +1 equals +0.5dB (same as fmgen) virtual void set_device_name(const _TCHAR *format, ...); virtual void out_debug_log(const char *fmt, ...); + virtual void force_out_debug_log(const char *fmt, ...); #if 1 // debugger // DEBUGGER is enabled by default. diff --git a/source/src/vm/libcpu_newdev/libcpu_i386/i386_real.cpp b/source/src/vm/libcpu_newdev/libcpu_i386/i386_real.cpp index 8fecf918c..a9f684d25 100644 --- a/source/src/vm/libcpu_newdev/libcpu_i386/i386_real.cpp +++ b/source/src/vm/libcpu_newdev/libcpu_i386/i386_real.cpp @@ -774,8 +774,7 @@ void I386_OPS::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len) { #if defined(USE_DEBUGGER) my_stprintf_s(buffer, buffer_len, - _T("AX=%04X BX=%04X CX=%04X DX=%04X SP=%04X BP=%04X SI=%04X DI=%04X\nDS=%04X ES=%04X SS=%04X CS=%04X IP=%04X FLAG=[%c%c%c%c -%c%c%c%c%c]\nTotal CPU Clocks = %llu (%llu)"), + _T("AX=%04X BX=%04X CX=%04X DX=%04X SP=%04X BP=%04X SI=%04X DI=%04X\nDS=%04X ES=%04X SS=%04X CS=%04X IP=%04X FLAG=[%c%c%c%c%c%c%c%c%c]\nTotal CPU Clocks = %llu (%llu)"), cpustate->sreg[DS].selector, cpustate->sreg[ES].selector, cpustate->sreg[SS].selector, cpustate->sreg[CS].selector, cpustate->eip, cpustate->OF ? _T('O') : _T('-'), cpustate->DF ? _T('D') : _T('-'), cpustate->IF ? _T('I') : _T('-'), cpustate->TF ? _T('T') : _T('-'), cpustate->SF ? _T('S') : _T('-'), cpustate->ZF ? _T('Z') : _T('-'), cpustate->AF ? _T('A') : _T('-'), cpustate->PF ? _T('P') : _T('-'), diff --git a/source/src/vm/libcpu_newdev/libcpu_i386/i386op16_real.cpp b/source/src/vm/libcpu_newdev/libcpu_i386/i386op16_real.cpp index f551b6d5b..70c9aa84c 100644 --- a/source/src/vm/libcpu_newdev/libcpu_i386/i386op16_real.cpp +++ b/source/src/vm/libcpu_newdev/libcpu_i386/i386op16_real.cpp @@ -15,6 +15,7 @@ REG16(AX) = regs[0]; REG16(CX) = regs[1]; REG16(DX) = regs[2]; REG16(BX) = regs[3]; \ REG16(SP) = regs[4]; REG16(BP) = regs[5]; REG16(SI) = regs[6]; REG16(DI) = regs[7]; \ cpustate->ZF = (UINT8)ZeroFlag; cpustate->CF = (UINT8)CarryFlag; \ + CYCLES(CYCLES_IRET); \ return; \ } \ } @@ -30,7 +31,7 @@ REG16(AX) = regs[0]; REG16(CX) = regs[1]; REG16(DX) = regs[2]; REG16(BX) = regs[3]; \ REG16(SP) = regs[4]; REG16(BP) = regs[5]; REG16(SI) = regs[6]; REG16(DI) = regs[7]; \ cpustate->ZF = (UINT8)ZeroFlag; cpustate->CF = (UINT8)CarryFlag; \ - CYCLES(cpustate,CYCLES_RET_INTERSEG); \ + CYCLES(CYCLES_RET_INTERSEG); \ return; \ } \ } @@ -40,7 +41,7 @@ void I386_OPS::i386_call_abs16() // Opcode 0x9a { UINT16 offset = FETCH16(); UINT16 ptr = FETCH16(); - CYCLES(cpustate,CYCLES_CALL_INTERSEG); /* TODO: Timing = 17 + m */ + CYCLES(CYCLES_CALL_INTERSEG); /* TODO: Timing = 17 + m */ #ifdef I386_PSEUDO_BIOS BIOS_CALL_FAR(((ptr << 4) + offset) & cpustate->a20_mask) diff --git a/source/src/vm/mame/emu/cpu/i86/i286.c b/source/src/vm/mame/emu/cpu/i86/i286.c index 16a9b9bcb..6e0b5748c 100644 --- a/source/src/vm/mame/emu/cpu/i86/i286.c +++ b/source/src/vm/mame/emu/cpu/i86/i286.c @@ -110,7 +110,6 @@ bool i286_call_pseudo_bios(i80286_state *cpustate, uint32_t PC) if(cpustate->bios != NULL) { if(cpustate->bios->bios_call_far_i86(PC & AMASK, cpustate->regs.w, cpustate->sregs, &cpustate->ZeroVal, &cpustate->CarryVal)) return true; } - if(cpustate->bios != NULL) return cpustate->bios->bios_call_i86(PC, cpustate->regs.w, cpustate->sregs, &cpustate->ZeroVal, &cpustate->CarryVal); #endif return false; } -- 2.11.0