|
|
| version 1.2, 2004/01/22 04:59:48 | version 1.7, 2004/01/27 03:24:19 |
|---|---|
| Line 6 | Line 6 |
| #include "sxsibios.h" | #include "sxsibios.h" |
| #include "scsicmd.h" | #include "scsicmd.h" |
| #include "sxsi.h" | #include "sxsi.h" |
| #include "timing.h" | |
| typedef REG8 (*SXSIFUNC)(UINT type, SXSIDEV sxsi); | typedef REG8 (*SXSIFUNC)(UINT type, SXSIDEV sxsi); |
| Line 111 static REG8 sxsibios_format(UINT type, S | Line 112 static REG8 sxsibios_format(UINT type, S |
| long pos; | long pos; |
| if (CPU_AH & 0x80) { | if (CPU_AH & 0x80) { |
| ret = 0xd0; | if (type == SXSIBIOS_SCSI) { // とりあえずSCSIのみ |
| UINT count; | |
| long posmax; | |
| count = timing_getcount(); // 時間を止める | |
| ret = 0; | |
| pos = 0; | |
| posmax = sxsi->surfaces * sxsi->cylinders; | |
| while(pos < posmax) { | |
| ret = sxsi_format(CPU_AL, pos * sxsi->sectors); | |
| if (ret) { | |
| break; | |
| } | |
| pos++; | |
| } | |
| timing_setcount(count); // 再開 | |
| } | |
| else { | |
| ret = 0xd0; | |
| } | |
| } | } |
| else { | else { |
| if (CPU_DL) { | if (CPU_DL) { |
| Line 167 static REG8 sasibios_init(UINT type, SXS | Line 186 static REG8 sasibios_init(UINT type, SXS |
| static REG8 sasibios_sense(UINT type, SXSIDEV sxsi) { | static REG8 sasibios_sense(UINT type, SXSIDEV sxsi) { |
| TRACEOUT(("sasibios_sense type=%d", type)); | |
| if (type == SXSIBIOS_SASI) { | if (type == SXSIBIOS_SASI) { |
| return((REG8)((sxsi->type >> 8) & 7)); | return((REG8)((sxsi->type >> 8) & 7)); |
| } | } |
| Line 177 static REG8 sasibios_sense(UINT type, SX | Line 197 static REG8 sasibios_sense(UINT type, SX |
| CPU_DH = sxsi->surfaces; | CPU_DH = sxsi->surfaces; |
| CPU_DL = sxsi->sectors; | CPU_DL = sxsi->sectors; |
| } | } |
| return(0x00); | return(0x0f); |
| } | } |
| } | } |
| Line 201 static const SXSIFUNC sasifunc[16] = { | Line 221 static const SXSIFUNC sasifunc[16] = { |
| REG8 sasibios_operate(void) { | REG8 sasibios_operate(void) { |
| SXSIDEV sxsi; | |
| UINT type; | UINT type; |
| SXSIDEV sxsi; | |
| sxsi = sxsi_getptr(CPU_AL); | if (pccore.hddif & PCHDD_IDE) { |
| if (sxsi == NULL) { | type = SXSIBIOS_IDE; |
| return(0x60); | |
| } | } |
| type = SXSIBIOS_IDE; | |
| #if defined(SUPPORT_SASI) | #if defined(SUPPORT_SASI) |
| if (pccore.hddif & PCHDD_SASI) { | else if (pccore.hddif & PCHDD_SASI) { |
| type = SXSIBIOS_SASI; | type = SXSIBIOS_SASI; |
| } | } |
| #endif | #endif |
| else { | |
| return(0x60); | |
| } | |
| sxsi = sxsi_getptr(CPU_AL); | |
| if (sxsi == NULL) { | |
| return(0x60); | |
| } | |
| return((*sasifunc[CPU_AH & 0x0f])(type, sxsi)); | return((*sasifunc[CPU_AH & 0x0f])(type, sxsi)); |
| } | } |
| Line 225 static REG8 scsibios_init(UINT type, SXS | Line 250 static REG8 scsibios_init(UINT type, SXS |
| UINT8 i; | UINT8 i; |
| UINT8 bit; | UINT8 bit; |
| UINT16 w; | UINT32 dat; |
| mem[MEMB_DISK_EQUIPS] = 0; | mem[MEMB_DISK_EQUIPS] = 0; |
| ZeroMemory(&mem[0x00460], 0x20); | ZeroMemory(&mem[0x00460], 0x20); |
| Line 233 static REG8 scsibios_init(UINT type, SXS | Line 258 static REG8 scsibios_init(UINT type, SXS |
| sxsi = sxsi_getptr((REG8)(0x20 + i)); | sxsi = sxsi_getptr((REG8)(0x20 + i)); |
| if ((sxsi) && (sxsi->fname[0])) { | if ((sxsi) && (sxsi->fname[0])) { |
| mem[MEMB_DISK_EQUIPS] |= bit; | mem[MEMB_DISK_EQUIPS] |= bit; |
| mem[0x00460+i*4] = sxsi->sectors; | dat = sxsi->sectors; |
| mem[0x00461+i*4] = sxsi->surfaces; | dat |= (sxsi->surfaces << 8); |
| dat |= sxsi->cylinders & 0xf000; | |
| dat |= (sxsi->cylinders & 0xfff) << 16; | |
| switch(sxsi->size) { | switch(sxsi->size) { |
| case 256: | case 256: |
| w = 0 << 12; | // dat |= 0 << (12 + 16); |
| break; | break; |
| case 512: | case 512: |
| w = 1 << 12; | dat |= 1 << (12 + 16); |
| break; | break; |
| default: | default: |
| w = 2 << 12; | dat |= 2 << (12 + 16); |
| break; | break; |
| } | } |
| w |= 0xc000; | dat |= 0xc0000000; |
| w |= sxsi->cylinders; | SETBIOSMEM32(0x00460+i*4, dat); |
| SETBIOSMEM16(0x00462+i*4, w); | |
| } | } |
| } | } |
| (void)type; | (void)type; |
| Line 311 REG8 scsibios_operate(void) { | Line 337 REG8 scsibios_operate(void) { |
| SXSIDEV sxsi; | SXSIDEV sxsi; |
| if (!(pccore.hddif & PCHDD_SCSI)) { | |
| return(0x60); | |
| } | |
| sxsi = sxsi_getptr(CPU_AL); | sxsi = sxsi_getptr(CPU_AL); |
| if (sxsi == NULL) { | if (sxsi == NULL) { |
| return(0x60); | return(0x60); |