--- np2/pccore.c 2003/11/30 11:20:55 1.22 +++ np2/pccore.c 2003/12/15 11:26:04 1.32 @@ -1,9 +1,9 @@ #include "compiler.h" +#include "dosio.h" #include "soundmng.h" #include "sysmng.h" #include "timemng.h" -#include "i286.h" -#include "memory.h" +#include "cpucore.h" #include "np2ver.h" #include "pccore.h" #include "iocore.h" @@ -22,6 +22,7 @@ #include "sound.h" #include "fmboard.h" #include "beep.h" +#include "s98.h" #include "font.h" #include "diskdrv.h" #include "fddfile.h" @@ -31,7 +32,6 @@ #include "timing.h" //#include "hostdrv.h" #include "debugsub.h" -#include "dosio.h" const char np2version[] = NP2VER_CORE; @@ -51,7 +51,7 @@ 1, 0x82, 0, {0x17, 0x04, 0x1f}, {0x0c, 0x0c, 0x02, 0x10, 0x3f, 0x3f}, 1, 80, 0, - {"", ""}, ""}; + {"", ""}, "", ""}; PCCORE pc = { PCBASECLOCK25, 4, @@ -75,11 +75,29 @@ static const BYTE msw_default[8] = BOOL drawframe; UINT drawcount = 0; - BYTE mem[0x200000]; - // --------------------------------------------------------------------------- +void getbiospath(char *path, const char *fname, int maxlen) { + +const char *p; + + p = np2cfg.biospath; + + p = np2cfg.biospath; + if (p[0]) { + file_cpyname(path, p, maxlen); + file_setseparator(path, maxlen); + file_catname(path, fname, maxlen); + } + else { + file_cpyname(path, file_getcd(fname), maxlen); + } +} + + +// ---- + static void setvsyncclock(void) { UINT vfp; @@ -184,6 +202,8 @@ static void sound_term(void) { void pccore_init(void) { + CPU_INITIALIZE(); + pal_initlcdtable(); pal_makelcdpal(); pal_makeskiptable(); @@ -255,10 +275,10 @@ void pccore_reset(void) { ZeroMemory(mem + VRAM1_E, 0x08000); ZeroMemory(mem + FONT_ADRS, 0x08000); - i286_reset(); - CPUTYPE = 0; + CPU_RESET(); + CPU_TYPE = 0; if (np2cfg.dipsw[2] & 0x80) { - CPUTYPE = CPUTYPE_V30; + CPU_TYPE = CPUTYPE_V30; } //メモリスイッチ @@ -304,18 +324,18 @@ void pccore_reset(void) { if (np2cfg.ITF_WORK) { CS_BASE = 0xf0000; - I286_CS = 0xf000; - I286_IP = 0xfff0; + CPU_CS = 0xf000; + CPU_IP = 0xfff0; } else { for (i=0; i<8; i++) { mem[0xa3fe2 + i*4] = msw_default[i]; } CS_BASE = 0xfd800; - I286_CS = 0xfd80; - I286_IP = 0x0002; + CPU_CS = 0xfd80; + CPU_IP = 0x0002; } - i286_resetprefetch(); + CPU_CLEARPREFETCH(); sysmng_cpureset(); soundmng_play(); @@ -519,29 +539,29 @@ void pccore_exec(BOOL draw) { resetcnt++; #endif pic_irq(); - if (cpuio.reset_req) { - cpuio.reset_req = 0; - I286_CS = 0xf000; + if (CPU_RESETREQ) { + CPU_RESETREQ = 0; + CPU_CS = 0xf000; CS_BASE = 0xf0000; - I286_IP = 0xfff0; -#ifdef CPU386 // defineを変えてね - I286_DX = 0x0300; + CPU_IP = 0xfff0; +#if defined(CPUCORE_IA32) + CPU_DX = 0x0300; #endif - i286_resetprefetch(); + CPU_CLEARPREFETCH(); } -#if 1 // ndef TRACE - if (I286_REMCLOCK > 0) { - if (!(CPUTYPE & CPUTYPE_V30)) { - i286(); +#if 1 //ndef TRACE + if (CPU_REMCLOCK > 0) { + if (!(CPU_TYPE & CPUTYPE_V30)) { + CPU_EXEC(); } else { - v30(); + CPU_EXECV30(); } } #else - while(I286_REMCLOCK > 0) { - TRACEOUT(("%.4x:%.4x", I286_CS, I286_IP)); + while(CPU_REMCLOCK > 0) { + TRACEOUT(("%.4x:%.4x", CPU_CS, CPU_IP)); i286_step(); } #endif @@ -551,6 +571,7 @@ void pccore_exec(BOOL draw) { mpu98ii_callback(); diskdrv_callback(); calendar_inc(); + S98_sync(); sound_sync(); // happy! #if defined(TRACE)