From 8f4eaf16a2fb0a5b85cc97e84726a6fade629ad8 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Mon, 2 Dec 2002 18:56:53 +0000 Subject: [PATCH] fixed int 21 1c and changed sectors allocation to bit8 instead of bit16 Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@555 --- include/dos_inc.h | 4 ++-- include/dos_system.h | 2 +- src/dos/dos.cpp | 21 ++++++++++++++------- src/dos/dos_files.cpp | 4 ++-- src/dos/dos_programs.cpp | 3 ++- src/dos/drive_local.cpp | 4 ++-- src/dos/drive_virtual.cpp | 2 +- src/dos/drives.h | 8 ++++---- 8 files changed, 28 insertions(+), 20 deletions(-) diff --git a/include/dos_inc.h b/include/dos_inc.h index 346c5a26..b5f31a81 100644 --- a/include/dos_inc.h +++ b/include/dos_inc.h @@ -119,7 +119,7 @@ bool DOS_ChangeDir(char * dir); bool DOS_MakeDir(char * dir); bool DOS_RemoveDir(char * dir); bool DOS_Rename(char * oldname,char * newname); -bool DOS_GetFreeDiskSpace(Bit8u drive,Bit16u * bytes,Bit16u * sectors,Bit16u * clusters,Bit16u * free); +bool DOS_GetFreeDiskSpace(Bit8u drive,Bit16u * bytes,Bit8u * sectors,Bit16u * clusters,Bit16u * free); bool DOS_GetFileAttr(char * name,Bit16u * attr); /* IOCTL Stuff */ @@ -158,7 +158,7 @@ bool DOS_FCBDeleteFile(Bit16u seg,Bit16u offset); bool DOS_FCBRenameFile(Bit16u seg, Bit16u offset); void DOS_FCBSetRandomRecord(Bit16u seg, Bit16u offset); Bit8u FCB_Parsename(Bit16u seg,Bit16u offset,Bit8u parser ,char *string, Bit8u *change); -bool DOS_GetAllocationInfo(Bit8u drive,Bit16u * _bytes_sector,Bit16u * _sectors_cluster,Bit16u * _total_clusters); +bool DOS_GetAllocationInfo(Bit8u drive,Bit16u * _bytes_sector,Bit8u * _sectors_cluster,Bit16u * _total_clusters); /* Extra DOS Interrupts */ void DOS_SetupMisc(void); diff --git a/include/dos_system.h b/include/dos_system.h index 0223a9a6..545f6612 100644 --- a/include/dos_system.h +++ b/include/dos_system.h @@ -84,7 +84,7 @@ public: virtual bool FindNext(DOS_DTA & dta)=0; virtual bool GetFileAttr(char * name,Bit16u * attr)=0; virtual bool Rename(char * oldname,char * newname)=0; - virtual bool AllocationInfo(Bit16u * _bytes_sector,Bit16u * _sectors_cluster,Bit16u * _total_clusters,Bit16u * _free_clusters)=0; + virtual bool AllocationInfo(Bit16u * _bytes_sector,Bit8u * _sectors_cluster,Bit16u * _total_clusters,Bit16u * _free_clusters)=0; virtual bool FileExists(const char* name)=0; virtual bool FileStat(const char* name, FileStat_Block * const stat_block)=0; virtual Bit8u GetMediaByte(void)=0; diff --git a/src/dos/dos.cpp b/src/dos/dos.cpp index b65ad676..36d58f0c 100644 --- a/src/dos/dos.cpp +++ b/src/dos/dos.cpp @@ -32,7 +32,7 @@ DOS_Block dos; DOS_InfoBlock dos_infoblock; Bit8u dos_copybuf[0x10000]; -static Bitu call_20,call_21,call_27; +static Bitu call_20,call_21,call_27,call_28; void DOS_SetError(Bit16u code) { dos.errorcode=code; @@ -215,10 +215,10 @@ static Bitu DOS_21Handler(void) { else reg_al = 0xFF; break; case 0x1b: /* Get allocation info for default drive */ - if (!DOS_GetAllocationInfo(0,®_cx,®_ax,®_dx)) reg_al=0xff; + if (!DOS_GetAllocationInfo(0,®_cx,®_al,®_dx)) reg_al=0xff; break; case 0x1c: /* Get allocation info for specific drive */ - if (!DOS_GetAllocationInfo(reg_dl,®_cx,®_ax,®_dx)) reg_al=0xff; + if (!DOS_GetAllocationInfo(reg_dl,®_cx,®_al,®_dx)) reg_al=0xff; break; case 0x21: /* Read random record from FCB */ reg_al = DOS_FCBRandomRead(SegValue(ds),reg_dx,1,true); @@ -359,7 +359,8 @@ static Bitu DOS_21Handler(void) { break; case 0x36: /* Get Free Disk Space */ { - Bit16u bytes,sectors,clusters,free; + Bit16u bytes,clusters,free; + Bit8u sectors; if (DOS_GetFreeDiskSpace(reg_dl,&bytes,§ors,&clusters,&free)) { reg_ax=sectors; reg_bx=free; @@ -783,9 +784,6 @@ static Bitu DOS_21Handler(void) { LOG_DEBUG("DOS:67:Set Handle Count not working"); CALLBACK_SCF(false); break; - case 0x68: /* FFLUSH Commit file */ - E_Exit("Unhandled Dos 21 call %02X",reg_ah); - break; case 0x69: /* Get/Set disk serial number */ { switch(reg_al) { @@ -808,6 +806,7 @@ static Bitu DOS_21Handler(void) { CALLBACK_SCF(true); LOG_WARN("DOS:Windows long file name support call %2X",reg_al); break; + case 0x68: /* FFLUSH Commit file */ 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 */ @@ -844,6 +843,10 @@ static Bitu DOS_27Handler(void) return CBRET_NONE; } +static Bitu DOS_28Handler(void) { + return CBRET_NONE; +} + void DOS_Init(Section* sec) { MSG_Add("DOS_CONFIGFILE_HELP","Setting a memory size to 0 will disable it.\n"); call_20=CALLBACK_Allocate(); @@ -858,6 +861,10 @@ void DOS_Init(Section* sec) { CALLBACK_Setup(call_27,DOS_27Handler,CB_IRET); RealSetVec(0x27,CALLBACK_RealPointer(call_27)); + call_28=CALLBACK_Allocate(); + CALLBACK_Setup(call_28,DOS_28Handler,CB_IRET); + RealSetVec(0x28,CALLBACK_RealPointer(call_28)); + DOS_SetupFiles(); /* Setup system File tables */ DOS_SetupDevices(); /* Setup dos devices */ DOS_SetupTables(); diff --git a/src/dos/dos_files.cpp b/src/dos/dos_files.cpp index 42b64502..eb4ba80b 100644 --- a/src/dos/dos_files.cpp +++ b/src/dos/dos_files.cpp @@ -400,7 +400,7 @@ bool DOS_Canonicalize(char * name,char * big) { return true; } -bool DOS_GetFreeDiskSpace(Bit8u drive,Bit16u * bytes,Bit16u * sectors,Bit16u * clusters,Bit16u * free) { +bool DOS_GetFreeDiskSpace(Bit8u drive,Bit16u * bytes,Bit8u * sectors,Bit16u * clusters,Bit16u * free) { if (drive==0) drive=DOS_GetDefaultDrive(); else drive--; if ((drive>DOS_DRIVES) || (!Drives[drive])) { @@ -807,7 +807,7 @@ bool DOS_FileExists(char * name) { return Drives[drive]->FileExists(fullname); } -bool DOS_GetAllocationInfo(Bit8u drive,Bit16u * _bytes_sector,Bit16u * _sectors_cluster,Bit16u * _total_clusters) { +bool DOS_GetAllocationInfo(Bit8u drive,Bit16u * _bytes_sector,Bit8u * _sectors_cluster,Bit16u * _total_clusters) { if (!drive) drive=dos.current_drive; else drive--; if (!Drives[drive]) return false; diff --git a/src/dos/dos_programs.cpp b/src/dos/dos_programs.cpp index 2a811abc..24b1ce81 100644 --- a/src/dos/dos_programs.cpp +++ b/src/dos/dos_programs.cpp @@ -85,7 +85,8 @@ public: return; } if (temp_line[temp_line.size()-1]!=CROSS_FILESPLIT) temp_line+=CROSS_FILESPLIT; - newdrive=new localDrive(temp_line.c_str(),sizes[0],sizes[1],sizes[2],sizes[3],mediaid); + Bit8u bit8size=(Bit8u) sizes[1]; + newdrive=new localDrive(temp_line.c_str(),sizes[0],bit8size,sizes[2],sizes[3],mediaid); } cmd->FindCommand(1,temp_line); if (temp_line.size()>1) goto showusage; diff --git a/src/dos/drive_local.cpp b/src/dos/drive_local.cpp index 7e79cd2e..a12c504b 100644 --- a/src/dos/drive_local.cpp +++ b/src/dos/drive_local.cpp @@ -214,7 +214,7 @@ bool localDrive::Rename(char * oldname,char * newname) { }; -bool localDrive::AllocationInfo(Bit16u * _bytes_sector,Bit16u * _sectors_cluster,Bit16u * _total_clusters,Bit16u * _free_clusters) { +bool localDrive::AllocationInfo(Bit16u * _bytes_sector,Bit8u * _sectors_cluster,Bit16u * _total_clusters,Bit16u * _free_clusters) { /* Always report 100 mb free should be enough */ /* Total size is always 1 gb */ *_bytes_sector=allocation.bytes_sector; @@ -259,7 +259,7 @@ Bit8u localDrive::GetMediaByte(void) { return allocation.mediaid; } -localDrive::localDrive(const char * startdir,Bit16u _bytes_sector,Bit16u _sectors_cluster,Bit16u _total_clusters,Bit16u _free_clusters,Bit8u _mediaid) { +localDrive::localDrive(const char * startdir,Bit16u _bytes_sector,Bit8u _sectors_cluster,Bit16u _total_clusters,Bit16u _free_clusters,Bit8u _mediaid) { strcpy(basedir,startdir); sprintf(info,"local directory %s",startdir); srch_opendir=NULL; diff --git a/src/dos/drive_virtual.cpp b/src/dos/drive_virtual.cpp index 84235e3b..f697c598 100644 --- a/src/dos/drive_virtual.cpp +++ b/src/dos/drive_virtual.cpp @@ -204,7 +204,7 @@ bool Virtual_Drive::Rename(char * oldname,char * newname) { return false; } -bool Virtual_Drive::AllocationInfo(Bit16u * _bytes_sector,Bit16u * _sectors_cluster,Bit16u * _total_clusters,Bit16u * _free_clusters) { +bool Virtual_Drive::AllocationInfo(Bit16u * _bytes_sector,Bit8u * _sectors_cluster,Bit16u * _total_clusters,Bit16u * _free_clusters) { /* Always report 100 mb free should be enough */ /* Total size is always 1 gb */ *_bytes_sector=512; diff --git a/src/dos/drives.h b/src/dos/drives.h index 910f147d..90c8fce6 100644 --- a/src/dos/drives.h +++ b/src/dos/drives.h @@ -29,7 +29,7 @@ bool WildFileCmp(const char * file, const char * wild); class localDrive : public DOS_Drive { public: - localDrive(const char * startdir,Bit16u _bytes_sector,Bit16u _sectors_cluster,Bit16u _total_clusters,Bit16u _free_clusters,Bit8u _mediaid); + localDrive(const char * startdir,Bit16u _bytes_sector,Bit8u _sectors_cluster,Bit16u _total_clusters,Bit16u _free_clusters,Bit8u _mediaid); bool FileOpen(DOS_File * * file,char * name,Bit32u flags); bool FileCreate(DOS_File * * file,char * name,Bit16u attributes); bool FileUnlink(char * name); @@ -40,7 +40,7 @@ public: bool FindNext(DOS_DTA & dta); bool GetFileAttr(char * name,Bit16u * attr); bool Rename(char * oldname,char * newname); - bool AllocationInfo(Bit16u * _bytes_sector,Bit16u * _sectors_cluster,Bit16u * _total_clusters,Bit16u * _free_clusters); + bool AllocationInfo(Bit16u * _bytes_sector,Bit8u * _sectors_cluster,Bit16u * _total_clusters,Bit16u * _free_clusters); bool FileExists(const char* name); bool FileStat(const char* name, FileStat_Block * const stat_block); Bit8u GetMediaByte(void); @@ -50,7 +50,7 @@ private: DIR * srch_opendir; struct { Bit16u bytes_sector; - Bit16u sectors_cluster; + Bit8u sectors_cluster; Bit16u total_clusters; Bit16u free_clusters; Bit8u mediaid; @@ -73,7 +73,7 @@ public: bool FindNext(DOS_DTA & dta); bool GetFileAttr(char * name,Bit16u * attr); bool Rename(char * oldname,char * newname); - bool AllocationInfo(Bit16u * _bytes_sector,Bit16u * _sectors_cluster,Bit16u * _total_clusters,Bit16u * _free_clusters); + bool AllocationInfo(Bit16u * _bytes_sector,Bit8u * _sectors_cluster,Bit16u * _total_clusters,Bit16u * _free_clusters); bool FileExists(const char* name); bool FileStat(const char* name, FileStat_Block* const stat_block); Bit8u GetMediaByte(void);