From a3c48a130315241412bd2653a7cbafc9fee81351 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Mon, 4 Nov 2002 19:04:13 +0000 Subject: [PATCH] fixed a bug. the return code of dos_fcbwrite was misinterpretted Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@476 --- include/dos_inc.h | 2 +- src/dos/dos.cpp | 3 +-- src/dos/dos_files.cpp | 10 +++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/include/dos_inc.h b/include/dos_inc.h index 6b99e6c0..3944d7e1 100644 --- a/include/dos_inc.h +++ b/include/dos_inc.h @@ -149,7 +149,7 @@ bool DOS_FCBFindNext(Bit16u seg,Bit16u offset); Bit8u DOS_FCBRead(Bit16u seg,Bit16u offset, Bit16u numBlocks); bool DOS_FCBWrite(Bit16u seg,Bit16u offset,Bit16u numBlocks); Bit8u DOS_FCBRandomRead(Bit16u seg,Bit16u offset,Bit16u numRec,bool restore); -bool DOS_FCBRandomWrite(Bit16u seg,Bit16u offset,Bit16u numRec,bool restore); +Bit8u DOS_FCBRandomWrite(Bit16u seg,Bit16u offset,Bit16u numRec,bool restore); bool DOS_FCBGetFileSize(Bit16u seg,Bit16u offset,Bit16u numRec); bool DOS_FCBDeleteFile(Bit16u seg,Bit16u offset); bool DOS_FCBRenameFile(Bit16u seg, Bit16u offset); diff --git a/src/dos/dos.cpp b/src/dos/dos.cpp index d289ce14..b6447aef 100644 --- a/src/dos/dos.cpp +++ b/src/dos/dos.cpp @@ -244,8 +244,7 @@ static Bitu DOS_21Handler(void) { LOG_DEBUG("DOS:0x27 FCB-Random read used, result:al=%d",reg_al); break; case 0x28: /* Random Block write to FCB */ - if (DOS_FCBRandomWrite(SegValue(ds),reg_dx,reg_cx,false)) reg_al = 0x00; - else reg_al = 0x01; + reg_al=DOS_FCBRandomWrite(SegValue(ds),reg_dx,reg_cx,false); LOG_DEBUG("DOS:0x28 FCB-Random write used, result:al=%d",reg_al); break; case 0x29: /* Parse filename into FCB */ diff --git a/src/dos/dos_files.cpp b/src/dos/dos_files.cpp index 5aa9b002..e4166a6d 100644 --- a/src/dos/dos_files.cpp +++ b/src/dos/dos_files.cpp @@ -738,9 +738,9 @@ Bit8u DOS_FCBRandomRead(Bit16u seg,Bit16u offset,Bit16u numRec,bool restore) { return error; } -bool DOS_FCBRandomWrite(Bit16u seg,Bit16u offset,Bit16u numRec,bool restore) { +Bit8u DOS_FCBRandomWrite(Bit16u seg,Bit16u offset,Bit16u numRec,bool restore) { DOS_FCB fcb(seg,offset); - Bit32u random;Bit16u old_block;Bit8u old_rec;bool noerror; + Bit32u random;Bit16u old_block;Bit8u old_rec;Bit8u error; /* Set the correct record from the random data */ fcb.GetRandom(random); @@ -748,15 +748,15 @@ bool DOS_FCBRandomWrite(Bit16u seg,Bit16u offset,Bit16u numRec,bool restore) { fcb.SetRecord((Bit16u)(random / 128),(Bit8u)(random & 127)); /* Write records */ for (int i=0; i