--- np2/generic/hostdrv.c 2004/01/09 07:27:15 1.3 +++ np2/generic/hostdrv.c 2004/01/15 06:20:42 1.8 @@ -1,3 +1,6 @@ +#include "compiler.h" + +#if defined(SUPPORT_HOSTDRV) /* ゲストOS(DOS)からホストOS(Win)にアクセスするの〜 @@ -6,7 +9,6 @@ 更に、手抜き版だし(マテ */ -#include "compiler.h" #include "dosio.h" #include "cpucore.h" #include "pccore.h" @@ -22,9 +24,9 @@ #define ROOTPATH_SIZE (sizeof(ROOTPATH_NAME) - 1) static const char ROOTPATH[ROOTPATH_SIZE] = ROOTPATH_NAME; -static const HDRVDIR hdd_volume = {"_HOSTDRIVE_", 0, 0x08}; -static const HDRVDIR hdd_owner = {". ", 0, 0x10}; -static const HDRVDIR hdd_parent = {".. ", 0, 0x10}; +static const HDRVDIR hdd_volume = {"_HOSTDRIVE_", 0, 0, 0x08, {0}, {0}}; +static const HDRVDIR hdd_owner = {". ", 0, 0, 0x10, {0}, {0}}; +static const HDRVDIR hdd_parent = {".. ", 0, 0, 0x10, {0}, {0}}; // see int2159-BX0000 @@ -171,6 +173,7 @@ static void store_dir(INTRST is, const H DIRREC dirrec; UINT8 attr; + UINT16 reg; // SDA内のDIRRECにセット dirrec = is->dirrec_ptr; @@ -180,14 +183,28 @@ static void store_dir(INTRST is, const H attr |= 0x01; } dirrec->file_attr = attr; - STOREINTELDWORD(dirrec->file_time, 0); // di->datetime - STOREINTELDWORD(dirrec->start_sector, ((UINT32)-1)); + reg = 0; + if (di->caps & FLICAPS_TIME) { + reg |= (di->time.hour & 0x1f) << 11; + reg |= (di->time.minute & 0x3f) << 5; + reg |= (di->time.second & 0x3e) >> 1; + } + STOREINTELWORD(dirrec->file_time, reg); + reg = 0; + if (di->caps & FLICAPS_DATE) { + reg |= ((di->date.year - 1980) & 0x7f) << 9; + reg |= (di->date.month & 0x0f) << 5; + reg |= di->date.day & 0x1f; + } + STOREINTELWORD(dirrec->file_date, reg); + STOREINTELWORD(dirrec->start_sector, ((UINT16)-1)); STOREINTELDWORD(dirrec->file_size, di->size); } static void fill_sft(INTRST is, SFTREC sft, UINT num, HDRVDIR *di) { UINT8 attr; + UINT16 reg; attr = di->attr; if (!IS_PERMITWRITE) { @@ -195,7 +212,21 @@ static void fill_sft(INTRST is, SFTREC s } sft->file_attr = attr; STOREINTELWORD(sft->start_sector, (UINT16)num); - STOREINTELDWORD(sft->file_time, 0); // di->datetime + + reg = 0; + if (di->caps & FLICAPS_TIME) { + reg |= (di->time.hour & 0x1f) << 11; + reg |= (di->time.minute & 0x3f) << 5; + reg |= (di->time.second & 0x3e) >> 1; + } + STOREINTELWORD(sft->file_time, reg); + reg = 0; + if (di->caps & FLICAPS_DATE) { + reg |= ((di->date.year - 1980) & 0x7f) << 9; + reg |= (di->date.month & 0x0f) << 5; + reg |= di->date.day & 0x1f; + } + STOREINTELWORD(sft->file_date, reg); STOREINTELDWORD(sft->file_size, di->size); STOREINTELWORD(sft->dir_sector, (UINT16)-1); sft->dir_entry_no = (UINT8)-1; @@ -307,8 +338,7 @@ static BOOL pathishostdrv(INTRST is, SDA } -static BOOL read_data(UINT num, UINT32 pos, UINT size, - UINT16 seg, UINT16 off) { +static BOOL read_data(UINT num, UINT32 pos, UINT size, UINT seg, UINT off) { HDRVFILE hdf; FILEH fh; @@ -335,8 +365,7 @@ static BOOL read_data(UINT num, UINT32 p return(SUCCESS); } -static BOOL write_data(UINT num, UINT32 pos, UINT size, - UINT16 seg, UINT16 off) { +static BOOL write_data(UINT num, UINT32 pos, UINT size, UINT seg, UINT off) { HDRVFILE hdf; FILEH fh; @@ -441,6 +470,7 @@ static void change_currdir(INTRST intrst } ptr = intrst->filename_ptr; + TRACEOUT(("change_currdir %s", intrst->filename_ptr)); if (ptr[0] == '\0') { // るーと strcpy(intrst->filename_ptr, "\\"); strcpy(intrst->current_path, intrst->filename_ptr); @@ -448,7 +478,8 @@ static void change_currdir(INTRST intrst succeed(intrst); return; } - if ((is_wildcards(intrst->fcbname_ptr) != FALSE) || + if ((strlen(intrst->filename_ptr) >= (67 - ROOTPATH_SIZE)) || + (is_wildcards(intrst->fcbname_ptr) != FALSE) || (hostdrvs_getrealpath(&hdp, ptr) != SUCCESS) || (hdp.di.fcbname[0] == ' ') || (!(hdp.di.attr & 0x10))) { fail(intrst, ERR_PATHNOTFOUND); @@ -679,11 +710,13 @@ static void get_fileattr(INTRST intrst) return; } + TRACEOUT(("get_fileattr: ->%s", intrst->fcbname_ptr)); if ((is_wildcards(intrst->fcbname_ptr)) || (hostdrvs_getrealpath(&hdp, intrst->filename_ptr) != SUCCESS)) { fail(intrst, ERR_FILENOTFOUND); return; } + TRACEOUT(("get_fileattr: %s - %x", hdp.path, hdp.di.attr)); ax = hdp.di.attr & 0x37; if (!IS_PERMITWRITE) { ax |= 0x01; @@ -703,6 +736,7 @@ static void rename_file(INTRST intrst) { return; } + // ワイルドカードくるんで要修正… if ((hostdrvs_getrealpath(&hdp1, intrst->filename_ptr) != SUCCESS) || (hostdrvs_getrealpath(&hdp2, intrst->filename_ptr_2) != SUCCESS)) { fail(intrst, ERR_PATHNOTFOUND); @@ -712,7 +746,6 @@ static void rename_file(INTRST intrst) { fail(intrst, ERR_ACCESSDENIED); } - /* 13 */ static void delete_file(INTRST intrst) { @@ -723,6 +756,7 @@ static void delete_file(INTRST intrst) { return; } + // ワイルドカードくるんで要修正… if ((hostdrvs_getrealpath(&hdp, intrst->filename_ptr) != SUCCESS) || (hdp.di.attr & 0x10)) { fail(intrst, ERR_PATHNOTFOUND); @@ -747,6 +781,7 @@ static void open_file(INTRST intrst) { } fetch_sft(intrst, &sft); + TRACEOUT(("open_file: %s %d", hdp.path, sft.open_mode[0] & 7)); if ((is_wildcards(intrst->fcbname_ptr)) || (hostdrvs_getrealpath(&hdp, intrst->filename_ptr) != SUCCESS) || (hdp.di.attr & 0x10)) { @@ -1085,3 +1120,5 @@ void hostdrv_intr(void) { store_intr_regs(&intrst); } +#endif +