diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 88fbd22fa..380fb8a82 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -372,8 +372,8 @@ cpu_set(void) CPUID = cpu_s->cpuid_model; is8086 = (cpu_s->cpu_type > CPU_8088); - is_nec = (cpu->type == CPU_NEC); - is186 = (cpu->type == CPU_186); + is_nec = (cpu->type == CPU_V20) || (cpu->type == CPU_V30); + is186 = (cpu->type == CPU_186) || (cpu->type == CPU_V30); is286 = (cpu_s->cpu_type >= CPU_286); is386 = (cpu_s->cpu_type >= CPU_386SX); israpidcad = (cpu_s->cpu_type == CPU_RAPIDCAD); @@ -531,8 +531,16 @@ cpu_set(void) switch (cpu_s->cpu_type) { case CPU_8088: case CPU_8086: - case CPU_NEC: + break; + + case CPU_V20: + case CPU_V30: case CPU_186: +#ifdef USE_DYNAREC + x86_setopcodes(ops_186, ops_186_0f, dynarec_ops_186, dynarec_ops_186_0f); +#else + x86_setopcodes(ops_186, ops_186_0f); +#endif break; case CPU_286: diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index fc89d84ef..9b91e3315 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -24,6 +24,7 @@ enum { FPU_NONE, FPU_8087, + FPU_80187, FPU_287, FPU_287XL, FPU_387, @@ -34,10 +35,10 @@ enum { enum { CPU_8088 = 1, /* 808x class CPUs */ CPU_8086, -#ifdef USE_NEC_808X +//#ifdef USE_NEC_808X CPU_V20, /* NEC 808x class CPUs - future proofing */ CPU_V30, -#endif +//#endif CPU_188, /* 18x class CPUs */ CPU_186, CPU_286, /* 286 class CPUs */ diff --git a/src/cpu/cpu_table.c b/src/cpu/cpu_table.c index e9433f76a..6c4311398 100644 --- a/src/cpu/cpu_table.c +++ b/src/cpu/cpu_table.c @@ -43,6 +43,13 @@ FPU fpus_8088[] = {"8087", "8087", FPU_8087}, {NULL, NULL, 0} }; +FPU fpus_80186[] = +{ + {"None", "none", FPU_NONE}, + {"8087", "8087", FPU_8087}, + {"80187", "80187", FPU_80187}, + {NULL, NULL, 0} +}; FPU fpus_80286[] = { {"None", "none", FPU_NONE}, @@ -116,19 +123,19 @@ const cpu_family_t cpu_families[] = { .name = "80188", .internal_name = "80188", .cpus = (const CPU[]) { - {"6", CPU_188, fpus_80186, 6000000, 1, 5000, 0, 0, 0, 0, 0,0,0,0, 1}, - {"7.16", CPU_188, fpus_80186, 7159092, 1, 5000, 0, 0, 0, CPU_ALTERNATE_XTAL, 0,0,0,0, 1}, - {"8", CPU_188, fpus_80186, 8000000, 1, 5000, 0, 0, 0, 0, 0,0,0,0, 1}, - {"9.54", CPU_188, fpus_80186, 9545456, 1, 5000, 0, 0, 0, CPU_ALTERNATE_XTAL, 0,0,0,0, 1}, - {"10", CPU_188, fpus_80186, 10000000, 1, 5000, 0, 0, 0, 0, 0,0,0,0, 1}, - {"12", CPU_188, fpus_80186, 12000000, 1, 5000, 0, 0, 0, 0, 0,0,0,0, 1}, - {"16", CPU_188, fpus_80186, 16000000, 1, 5000, 0, 0, 0, 0, 0,0,0,0, 2}, - {"20", CPU_188, fpus_80186, 20000000, 1, 5000, 0, 0, 0, 0, 0,0,0,0, 3}, - {"25", CPU_188, fpus_80186, 25000000, 1, 5000, 0, 0, 0, 0, 0,0,0,0, 3}, + {"6", CPU_188, fpus_8088, 6000000, 1, 5000, 0, 0, 0, 0, 0,0,0,0, 1}, + {"7.16", CPU_188, fpus_8088, 7159092, 1, 5000, 0, 0, 0, CPU_ALTERNATE_XTAL, 0,0,0,0, 1}, + {"8", CPU_188, fpus_8088, 8000000, 1, 5000, 0, 0, 0, 0, 0,0,0,0, 1}, + {"9.54", CPU_188, fpus_8088, 9545456, 1, 5000, 0, 0, 0, CPU_ALTERNATE_XTAL, 0,0,0,0, 1}, + {"10", CPU_188, fpus_8088, 10000000, 1, 5000, 0, 0, 0, 0, 0,0,0,0, 1}, + {"12", CPU_188, fpus_8088, 12000000, 1, 5000, 0, 0, 0, 0, 0,0,0,0, 1}, + {"16", CPU_188, fpus_8088, 16000000, 1, 5000, 0, 0, 0, 0, 0,0,0,0, 2}, + {"20", CPU_188, fpus_8088, 20000000, 1, 5000, 0, 0, 0, 0, 0,0,0,0, 3}, + {"25", CPU_188, fpus_8088, 25000000, 1, 5000, 0, 0, 0, 0, 0,0,0,0, 3}, {"", 0} } }, { - .package = CPU_PKG_NECV20, + .package = CPU_PKG_8088, .manufacturer = "NEC", .name = "NEC V20", .internal_name = "necv20", @@ -158,7 +165,7 @@ const cpu_family_t cpu_families[] = { {"", 0} } }, { - .package = CPU_PKG_NECV30, + .package = CPU_PKG_186, .manufacturer = "NEC", .name = "NEC V30", .internal_name = "necv30", diff --git a/src/cpu/x86_ops.h b/src/cpu/x86_ops.h index 2c8812570..6afac81f2 100644 --- a/src/cpu/x86_ops.h +++ b/src/cpu/x86_ops.h @@ -72,6 +72,9 @@ extern const OpFn *x86_dynarec_opcodes_REPE; extern const OpFn *x86_dynarec_opcodes_REPNE; extern const OpFn *x86_dynarec_opcodes_3DNOW; +extern const OpFn dynarec_ops_186[1024]; +extern const OpFn dynarec_ops_186_0f[1024]; + extern const OpFn dynarec_ops_286[1024]; extern const OpFn dynarec_ops_286_0f[1024]; @@ -171,6 +174,9 @@ extern const OpFn *x86_opcodes_REPE; extern const OpFn *x86_opcodes_REPNE; extern const OpFn *x86_opcodes_3DNOW; +extern const OpFn ops_186[1024]; +extern const OpFn ops_186_0f[1024]; + extern const OpFn ops_286[1024]; extern const OpFn ops_286_0f[1024]; diff --git a/src/cpu/x87_timings.c b/src/cpu/x87_timings.c index ca207cc17..51ba9eb87 100644 --- a/src/cpu/x87_timings.c +++ b/src/cpu/x87_timings.c @@ -86,6 +86,82 @@ const x87_timings_t x87_timings_8087 = .fyl2xp1 = (700 + 1000) / 2 }; +const x87_timings_t x87_timings_80187 = +{ + .f2xm1 = (310 + 630) / 2, + .fabs = (10 + 17) / 2, + .fadd = (70 + 100) / 2, + .fadd_32 = (90 + 120) / 2, + .fadd_64 = (95 + 125) / 2, + .fbld = (290 + 310) / 2, + .fbstp = (520 + 540) / 2, + .fchs = (10 + 17) / 2, + .fclex = (2 + 8) / 2, + .fcom = (40 + 50) / 2, + .fcom_32 = (60 + 70) / 2, + .fcom_64 = (65 + 75) / 2, + .fcos = 0, /*387+*/ + .fincdecstp = (6 + 12) / 2, + .fdisi_eni = (6 + 12) / 2, + .fdiv = (193 + 203) / 2, + .fdiv_32 = (215 + 225) / 2, + .fdiv_64 = (220 + 230) / 2, + .ffree = (9 + 16) / 2, + .fadd_i16 = (102 + 137) / 2, + .fadd_i32 = (108 + 143) / 2, + .fcom_i16 = (72 + 86) / 2, + .fcom_i32 = (78 + 91) / 2, + .fdiv_i16 = (224 + 238) / 2, + .fdiv_i32 = (230 + 243) / 2, + .fild_16 = (46 + 54) / 2, + .fild_32 = (50 + 60) / 2, + .fild_64 = (60 + 68) / 2, + .fmul_i16 = (124 + 138) / 2, + .fmul_i32 = (130 + 144) / 2, + .finit = (2 + 8) / 2, + .fist_16 = (80 + 90) / 2, + .fist_32 = (82 + 92) / 2, + .fist_64 = (94 + 105) / 2, + .fld = (17 + 22) / 2, + .fld_32 = (38 + 56) / 2, + .fld_64 = (40 + 60) / 2, + .fld_80 = (53 + 65) / 2, + .fld_z1 = (11 + 21) / 2, + .fld_const = (15 + 24) / 2, + .fldcw = (7 + 14) / 2, + .fldenv = (35 + 45) / 2, + .fmul = (90 + 145) / 2, + .fmul_32 = (110 + 125) / 2, + .fmul_64 = (154 + 168) / 2, + .fnop = (10 + 16) / 2, + .fpatan = (250 + 800) / 2, + .fprem = (15 + 190) / 2, + .fprem1 = 0, /*387+*/ + .fptan = (30 + 540) / 2, + .frndint = (16 + 50) / 2, + .frstor = (197 + 207) / 2, + .fsave = (197 + 207) / 2, + .fscale = (32 + 38) / 2, + .fsetpm = 0, /*287+*/ + .fsin_cos = 0, /*387+*/ + .fsincos = 0, /*387+*/ + .fsqrt = (180 + 186) / 2, + .fst = (15 + 22) / 2, + .fst_32 = (84 + 90) / 2, + .fst_64 = (96 + 104) / 2, + .fst_80 = (52 + 58) / 2, + .fstcw_sw = (12 + 18) / 2, + .fstenv = (40 + 50) / 2, + .ftst = (38 + 48) / 2, + .fucom = 0, /*387+*/ + .fwait = 4, + .fxam = (12 + 23) / 2, + .fxch = (10 + 15) / 2, + .fxtract = (27 + 55) / 2, + .fyl2x = (900 + 1100) / 2, + .fyl2xp1 = (700 + 1000) / 2 +}; + /*Mostly the same as 8087*/ const x87_timings_t x87_timings_287 = { diff --git a/src/cpu/x87_timings.h b/src/cpu/x87_timings.h index 6396fcb06..17ead17bf 100644 --- a/src/cpu/x87_timings.h +++ b/src/cpu/x87_timings.h @@ -49,6 +49,7 @@ typedef struct } x87_timings_t; extern const x87_timings_t x87_timings_8087; +extern const x87_timings_t x87_timings_80187; extern const x87_timings_t x87_timings_287; extern const x87_timings_t x87_timings_387; extern const x87_timings_t x87_timings_486;