From f1a7e6f501773485c922965a38a8a490ccf65adf Mon Sep 17 00:00:00 2001 From: Jim Date: Thu, 24 Nov 2011 00:10:12 -0500 Subject: [PATCH] -cpuid takes model numbers too, STPM stores emulator version --- em.c | 16 ++++++++++++++-- regs.h | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 2 deletions(-) diff --git a/em.c b/em.c index ca3551b..8f96729 100644 --- a/em.c +++ b/em.c @@ -4422,6 +4422,7 @@ main (int argc, char **argv) { struct timezone tz; printf("[Prime Emulator ver %s %s]\n", REV, __DATE__); + printf("[Copyright (C) 2005-2011 Prirun LLC]\n"); if (argc > 1 && (strcmp(argv[1],"--version") == 0)) { exit(0); } @@ -4605,8 +4606,17 @@ main (int argc, char **argv) { sscanf(argv[++i],"%d", &templ); if (0 <= templ && templ <= 44) cpuid = templ; - else - fatal("-cpuid arg range is 0 to 44\n"); + else { + cpuid = 9999; + for (j=0; cputab[j].cpumodel; j++) { + if (templ == cputab[j].cpumodel) { + cpuid = cputab[j].cputype; + break; + } + } + if (cpuid > 44) + fatal("-cpuid arg range is 0 to 44 or model name: 400, 550, 9950, etc\n"); + } } else fatal("-cpuid needs an argument\n"); @@ -6187,6 +6197,8 @@ d_stpm: /* 000024 */ for (i=0; i<8; i++) put16(0, ea+i); put16(cpuid, ea+1); + if (sscanf(REV, "%d", &templ)) + put16((short)templ, ea+3); goto fetch; } diff --git a/regs.h b/regs.h index 27f17c1..e813817 100644 --- a/regs.h +++ b/regs.h @@ -108,6 +108,62 @@ #define OWNER32 (OWNERH/2) #define TIMER32 (TIMERH/2) +/* table of CPU names & types */ + +static struct { + short cputype; + short cpumodel; +} cputab[45] = { \ + {1, 400}, + {3, 350}, + {4, 450}, + {5, 750}, + {7, 150}, + {7, 250}, + {8, 850}, + {9, 550}, + {10, 650}, + {11, 2250}, + {15, 9950}, + {16, 9650}, + {17, 2550}, + {19, 9750}, + {21, 2350}, + {22, 2655}, + {23, 9655}, + {24, 9955}, + {25, 2450}, + {26, 4050}, + {27, 4150}, + {28, 6350}, + {29, 6550}, + {31, 2755}, + {32, 2455}, + {33, 5310}, + {34, 9755}, + {35, 2850}, + {36, 2950}, + {37, 5330}, + {38, 4450}, + {39, 5370}, + {40, 6650}, + {41, 6450}, + {42, 6150}, + {43, 5320}, + {44, 5340}, +#if 0 + {45, 5510), + {46, 5520), + {47, 5530), + {48, 5540), + {49, 5550), + {50, 5560), + {51, 5570), + {52, 5580), + {0, 0}, +#endif +}; + /* this is the number of user register sets for this cpuid */ static short regsets[] = { \