From 8293b1fab6b01632ce11ddcb14a3a7b3705308c4 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Wed, 28 May 2008 09:53:31 +0000 Subject: [PATCH] Correct dosbox internal startup time. Give correct errorcode for 5c (Beta1) Do some input checking and give errorcode for 68 (Beta1 fixed) Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3164 --- include/dos_inc.h | 3 ++- src/dos/dos.cpp | 21 ++++++++++++++++----- src/dos/dos_files.cpp | 15 ++++++++++++++- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/include/dos_inc.h b/include/dos_inc.h index 4f46a970..d113d392 100644 --- a/include/dos_inc.h +++ b/include/dos_inc.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_inc.h,v 1.73 2008-01-21 21:26:49 qbix79 Exp $ */ +/* $Id: dos_inc.h,v 1.74 2008-05-28 09:53:31 qbix79 Exp $ */ #ifndef DOSBOX_DOS_INC_H #define DOSBOX_DOS_INC_H @@ -110,6 +110,7 @@ bool DOS_ReadFile(Bit16u handle,Bit8u * data,Bit16u * amount); bool DOS_WriteFile(Bit16u handle,Bit8u * data,Bit16u * amount); bool DOS_SeekFile(Bit16u handle,Bit32u * pos,Bit32u type); bool DOS_CloseFile(Bit16u handle); +bool DOS_FlushFile(Bit16u handle); bool DOS_DuplicateEntry(Bit16u entry,Bit16u * newentry); bool DOS_ForceDuplicateEntry(Bit16u entry,Bit16u newentry); bool DOS_GetFileDate(Bit16u entry, Bit16u* otime, Bit16u* odate); diff --git a/src/dos/dos.cpp b/src/dos/dos.cpp index e32f9292..82b5d312 100644 --- a/src/dos/dos.cpp +++ b/src/dos/dos.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos.cpp,v 1.111 2008-04-07 19:11:48 c2woody Exp $ */ +/* $Id: dos.cpp,v 1.112 2008-05-28 09:53:31 qbix79 Exp $ */ #include #include @@ -849,6 +849,11 @@ static Bitu DOS_21Handler(void) { } break; } + case 0x5c: /* FLOCK File region locking */ + DOS_SetError(DOSERR_FUNCTION_NUMBER_INVALID); + reg_ax = dos.errorcode; + CALLBACK_SCF(true); + break; case 0x5d: /* Network Functions */ if(reg_al == 0x06) { SegSet16(ds,DOS_SDA_SEG); @@ -977,6 +982,14 @@ static Bitu DOS_21Handler(void) { CALLBACK_SCF(false); break; }; + case 0x68: /* FFLUSH Commit file */ + if(DOS_FlushFile(reg_bl)) { + CALLBACK_SCF(false); + } else { + reg_ax = dos.errorcode; + CALLBACK_SCF(true); + } + break; case 0x69: /* Get/Set disk serial number */ { switch(reg_al) { @@ -1000,14 +1013,13 @@ static Bitu DOS_21Handler(void) { CALLBACK_SCF(true); } break; + case 0x71: /* Unknown probably 4dos detection */ reg_ax=0x7100; CALLBACK_SCF(true); LOG(LOG_DOSMISC,LOG_NORMAL)("DOS:Windows long file name support call %2X",reg_al); break; - case 0x68: /* FFLUSH Commit file */ - CALLBACK_SCF(false); //mirek case 0xE0: case 0x18: /* NULL Function for CP/M compatibility or Extended rename FCB */ case 0x1d: /* NULL Function for CP/M compatibility or Extended rename FCB */ @@ -1016,7 +1028,6 @@ static Bitu DOS_21Handler(void) { case 0x6b: /* NULL Function */ case 0x61: /* UNUSED */ case 0xEF: /* Used in Ancient Art Of War CGA */ - case 0x5c: /* FLOCK File region locking */ case 0x5e: /* More Network Functions */ default: LOG(LOG_DOSMISC,LOG_ERROR)("DOS:Unhandled call %02X al=%02X. Set al to default of 0",reg_ah,reg_al); @@ -1116,7 +1127,7 @@ public: dos.date.day=(Bit8u)loctime->tm_mday; dos.date.month=(Bit8u)loctime->tm_mon+1; dos.date.year=(Bit16u)loctime->tm_year+1900; - Bit32u ticks=(Bit32u)((loctime->tm_hour*3600+loctime->tm_min*60+loctime->tm_sec)*18.2); + Bit32u ticks=(Bit32u)((loctime->tm_hour*3600+loctime->tm_min*60+loctime->tm_sec)*(float)PIT_TICK_RATE/65536.0); mem_writed(BIOS_TIMER,ticks); } ~DOS(){ diff --git a/src/dos/dos_files.cpp b/src/dos/dos_files.cpp index 8dbf5e83..cba56eb6 100644 --- a/src/dos/dos_files.cpp +++ b/src/dos/dos_files.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_files.cpp,v 1.96 2008-04-30 18:26:17 qbix79 Exp $ */ +/* $Id: dos_files.cpp,v 1.97 2008-05-28 09:53:31 qbix79 Exp $ */ #include #include @@ -391,6 +391,19 @@ bool DOS_CloseFile(Bit16u entry) { } return true; } +bool DOS_FlushFile(Bit16u entry) { + Bit32u handle=RealHandle(entry); + if (handle>=DOS_FILES) { + DOS_SetError(DOSERR_INVALID_HANDLE); + return false; + }; + if (!Files[handle] || !Files[handle]->IsOpen()) { + DOS_SetError(DOSERR_INVALID_HANDLE); + return false; + }; + LOG(LOG_DOSMISC,LOG_NORMAL)("FFlush used."); + return true; +} static bool PathExists(char const * const name) { const char* leading = strrchr(name,'\\');