|
|
| version 1.11, 2004/01/13 05:30:58 | version 1.12, 2004/01/22 01:10:04 |
|---|---|
| Line 4 | Line 4 |
| #include "cpucore.h" | #include "cpucore.h" |
| #include "pccore.h" | #include "pccore.h" |
| #include "iocore.h" | #include "iocore.h" |
| #include "bios.h" | #include "sxsibios.h" |
| #include "sxsi.h" | |
| #if defined(SUPPORT_HOSTDRV) | #if defined(SUPPORT_HOSTDRV) |
| #include "hostdrv.h" | #include "hostdrv.h" |
| #endif | #endif |
| Line 45 static const char str_pentium[] = "PENTI | Line 44 static const char str_pentium[] = "PENTI |
| static const char str_mhz[] = "%uMHz"; | static const char str_mhz[] = "%uMHz"; |
| static void cmd_outstr(const void *arg1, long arg2) { | void np2sysp_outstr(const void *arg1, long arg2) { |
| milstr_ncpy(np2sysp.outstr, (char *)arg1, sizeof(np2sysp.outstr)); | milstr_ncpy(np2sysp.outstr, (char *)arg1, sizeof(np2sysp.outstr)); |
| np2sysp.outpos = 0; | np2sysp.outpos = 0; |
| (void)arg2; | (void)arg2; |
| } | } |
| static void cmd_poweroff(const void *arg1, long arg2) { | static void np2sysp_poweroff(const void *arg1, long arg2) { |
| taskmng_exit(); | taskmng_exit(); |
| (void)arg1; | (void)arg1; |
| (void)arg2; | (void)arg2; |
| } | } |
| static void cmd_cpu(const void *arg1, long arg2) { | static void np2sysp_cpu(const void *arg1, long arg2) { |
| // CPUを返す | // CPUを返す |
| #if 1 // 80286 or V30 | #if 1 // 80286 or V30 |
| if (!(CPU_TYPE & CPUTYPE_V30)) { | if (!(CPU_TYPE & CPUTYPE_V30)) { |
| cmd_outstr(str_80286, 0); | np2sysp_outstr(str_80286, 0); |
| } | } |
| else { | else { |
| cmd_outstr(str_v30, 0); | np2sysp_outstr(str_v30, 0); |
| } | } |
| #else | #else |
| // 386機以降の場合 V30モードはエミュレーションだから固定(?) | // 386機以降の場合 V30モードはエミュレーションだから固定(?) |
| cmd_outstr(str_pentium, 0); | np2sysp_outstr(str_pentium, 0); |
| #endif | #endif |
| (void)arg1; | (void)arg1; |
| (void)arg2; | (void)arg2; |
| } | } |
| static void cmd_clock(const void *arg1, long arg2) { | static void np2sysp_clock(const void *arg1, long arg2) { |
| SPRINTF(np2sysp.outstr, str_mhz, (pccore.realclock + 500000) / 1000000); | SPRINTF(np2sysp.outstr, str_mhz, (pccore.realclock + 500000) / 1000000); |
| np2sysp.outpos = 0; | np2sysp.outpos = 0; |
| Line 85 static void cmd_clock(const void *arg1, | Line 84 static void cmd_clock(const void *arg1, |
| (void)arg2; | (void)arg2; |
| } | } |
| static void cmd_multiple(const void *arg1, long arg2) { | static void np2sysp_multiple(const void *arg1, long arg2) { |
| SPRINTF(np2sysp.outstr, str_u, pccore.multiple); | SPRINTF(np2sysp.outstr, str_u, pccore.multiple); |
| np2sysp.outpos = 0; | np2sysp.outpos = 0; |
| Line 94 static void cmd_multiple(const void *arg | Line 93 static void cmd_multiple(const void *arg |
| } | } |
| // ---- SXSI BIOS | |
| typedef struct { | |
| BYTE r_ax[2]; | |
| BYTE r_bx[2]; | |
| BYTE r_cx[2]; | |
| BYTE r_dx[2]; | |
| BYTE r_bp[2]; | |
| BYTE r_es[2]; | |
| } B1BREG; | |
| static void cmd_sxsibios(const void *arg1, long arg2) { | |
| UINT16 org_ax, org_cx, org_dx, org_bx, org_bp, org_es; | |
| UINT32 org_esbase; | |
| B1BREG r; | |
| REG16 tmp; | |
| UINT8 ret; | |
| REG8 flag; | |
| org_ax = CPU_AX; | |
| org_cx = CPU_CX; | |
| org_dx = CPU_DX; | |
| org_bx = CPU_BX; | |
| org_bp = CPU_BP; | |
| org_es = CPU_ES; | |
| org_esbase = ES_BASE; | |
| i286_memstr_read(CPU_SS, CPU_SP, &r, sizeof(r)); | |
| CPU_AX = LOADINTELWORD(r.r_ax); | |
| CPU_BX = LOADINTELWORD(r.r_bx); | |
| CPU_CX = LOADINTELWORD(r.r_cx); | |
| CPU_DX = LOADINTELWORD(r.r_dx); | |
| CPU_BP = LOADINTELWORD(r.r_bp); | |
| tmp = LOADINTELWORD(r.r_es); | |
| CPU_ES = tmp; | |
| ES_BASE = tmp << 4; | |
| switch(CPU_AX & 0xf0) { | |
| case 0x00: | |
| case 0x20: | |
| ret = sxsi_operate(HDDTYPE_SASI); | |
| break; | |
| case 0x80: | |
| case 0xa0: | |
| ret = sxsi_operate(HDDTYPE_SCSI); | |
| break; | |
| default: | |
| ret = 0x40; | |
| break; | |
| } | |
| r.r_ax[0] = CPU_AL; | |
| r.r_ax[1] = ret; | |
| STOREINTELWORD(r.r_bx, CPU_BX); | |
| STOREINTELWORD(r.r_cx, CPU_CX); | |
| STOREINTELWORD(r.r_dx, CPU_DX); | |
| i286_memstr_write(CPU_SS, CPU_SP, &r, 8); | |
| flag = i286_membyte_read(CPU_SS, CPU_SP + 0x16) & 0xfe; | |
| if (ret >= 0x20) { | |
| flag += 1; | |
| } | |
| i286_membyte_write(CPU_SS, CPU_SP + 0x16, flag); | |
| CPU_AX = org_ax; | |
| CPU_CX = org_cx; | |
| CPU_DX = org_dx; | |
| CPU_BX = org_bx; | |
| CPU_BP = org_bp; | |
| CPU_ES = org_es; | |
| ES_BASE = org_esbase; | |
| (void)arg1; | |
| (void)arg2; | |
| } | |
| #if defined(SUPPORT_HOSTDRV) | |
| // ---- hostdrv | |
| enum { | |
| OPEN_HOSTDRV = 0, | |
| CLOSE_HOSTDRV = 1, | |
| INTR_HOSTDRV = 2 | |
| }; | |
| static void cmd_hostdrv(const void *arg1, long arg2) { | |
| switch(arg2) { | |
| case OPEN_HOSTDRV: | |
| if (hostdrv_mount() == SUCCESS) { | |
| cmd_outstr("ok", 0); | |
| } | |
| else { | |
| cmd_outstr("ng", 0); | |
| } | |
| break; | |
| case CLOSE_HOSTDRV: | |
| hostdrv_unmount(); | |
| break; | |
| case INTR_HOSTDRV: | |
| hostdrv_intr(); | |
| break; | |
| } | |
| (void)arg1; | |
| } | |
| #endif | |
| // ---- | // ---- |
| static const char str_np2[] = "NP2"; | static const char str_np2[] = "NP2"; |
| Line 214 static const char str_credit[] = "credit | Line 102 static const char str_credit[] = "credit |
| static const char str_cpu[] = "cpu"; | static const char str_cpu[] = "cpu"; |
| static const char str_clock[] = "clock"; | static const char str_clock[] = "clock"; |
| static const char str_multiple[] = "multiple"; | static const char str_multiple[] = "multiple"; |
| static const char str_sxsibios[] = "sxsibios"; | static const char str_sasibios[] = "sasibios"; |
| static const char str_scsibios[] = "scsibios"; | |
| static const char str_scsidev[] = "scsi_dev"; | |
| static const char str_hdrvcheck[] = "check_hostdrv"; | static const char str_hdrvcheck[] = "check_hostdrv"; |
| static const char str_hdrvopen[] = "open_hostdrv"; | static const char str_hdrvopen[] = "open_hostdrv"; |
| static const char str_hdrvclose[] = "close_hostdrv"; | static const char str_hdrvclose[] = "close_hostdrv"; |
| Line 235 static const char str_syspcredit[] = NP2 | Line 125 static const char str_syspcredit[] = NP2 |
| static const SYSPCMD np2spcmd[] = { | static const SYSPCMD np2spcmd[] = { |
| {str_np2, cmd_outstr, str_np2, 0}, | {str_np2, np2sysp_outstr, str_np2, 0}, |
| {str_ver, cmd_outstr, str_syspver, 0}, | {str_ver, np2sysp_outstr, str_syspver, 0}, |
| // version:A | // version:A |
| {str_poweroff, cmd_poweroff, NULL, 0}, | {str_poweroff, np2sysp_poweroff, NULL, 0}, |
| // version:B | // version:B |
| {str_credit, cmd_outstr, str_syspcredit, 0}, | {str_credit, np2sysp_outstr, str_syspcredit, 0}, |
| {str_cpu, cmd_cpu, NULL, 0}, | {str_cpu, np2sysp_cpu, NULL, 0}, |
| {str_clock, cmd_clock, NULL, 0}, | {str_clock, np2sysp_clock, NULL, 0}, |
| {str_multiple, cmd_multiple, NULL, 0}, | {str_multiple, np2sysp_multiple, NULL, 0}, |
| // extension | // extension |
| {str_sxsibios, cmd_sxsibios, NULL, 0}, | #if defined(SUPPORT_SASI) |
| {str_sasibios, np2sysp_sasi, NULL, 0}, | |
| #endif | |
| #if defined(SUPPORT_SCSI) | |
| {str_scsibios, np2sysp_scsi, NULL, 0}, | |
| {str_scsidev, np2sysp_scsidev, NULL, 0}, | |
| #endif | |
| #if defined(SUPPORT_HOSTDRV) | #if defined(SUPPORT_HOSTDRV) |
| {str_hdrvcheck, cmd_outstr, "supported", 0}, | {str_hdrvcheck, np2sysp_outstr, "supported", 0}, |
| {str_hdrvopen, cmd_hostdrv, NULL, OPEN_HOSTDRV}, | {str_hdrvopen, hostdrv_mount, NULL, 0}, |
| {str_hdrvclose, cmd_hostdrv, NULL, CLOSE_HOSTDRV}, | {str_hdrvclose, hostdrv_unmount, NULL, 0}, |
| {str_hdrvintr, cmd_hostdrv, NULL, INTR_HOSTDRV}, | {str_hdrvintr, hostdrv_intr, NULL, 0}, |
| #endif | #endif |
| }; | }; |