--- np2/bios/sxsibios.c 2004/01/22 08:40:30 1.3 +++ np2/bios/sxsibios.c 2004/01/23 16:57:20 1.5 @@ -6,6 +6,7 @@ #include "sxsibios.h" #include "scsicmd.h" #include "sxsi.h" +#include "timing.h" typedef REG8 (*SXSIFUNC)(UINT type, SXSIDEV sxsi); @@ -111,7 +112,25 @@ static REG8 sxsibios_format(UINT type, S long pos; 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 { if (CPU_DL) { @@ -230,7 +249,7 @@ static REG8 scsibios_init(UINT type, SXS UINT8 i; UINT8 bit; - UINT16 w; + UINT32 dat; mem[MEMB_DISK_EQUIPS] = 0; ZeroMemory(&mem[0x00460], 0x20); @@ -238,24 +257,25 @@ static REG8 scsibios_init(UINT type, SXS sxsi = sxsi_getptr((REG8)(0x20 + i)); if ((sxsi) && (sxsi->fname[0])) { mem[MEMB_DISK_EQUIPS] |= bit; - mem[0x00460+i*4] = sxsi->sectors; - mem[0x00461+i*4] = sxsi->surfaces; + dat = sxsi->sectors; + dat |= (sxsi->surfaces << 8); + dat |= sxsi->cylinders & 0xf000; + dat |= (sxsi->cylinders & 0xfff) << 16; switch(sxsi->size) { case 256: - w = 0 << 12; + // dat |= 0 << (12 + 16); break; case 512: - w = 1 << 12; + dat |= 1 << (12 + 16); break; default: - w = 2 << 12; + dat |= 2 << (12 + 16); break; } - w |= 0xc000; - w |= sxsi->cylinders; - SETBIOSMEM16(0x00462+i*4, w); + dat |= 0xc0000000; + SETBIOSMEM32(0x00460+i*4, dat); } } (void)type;