1
0
Fork 0

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
This commit is contained in:
Peter Veenstra 2002-11-04 19:04:13 +00:00
parent 4f86bdfe26
commit a3c48a1303
3 changed files with 7 additions and 8 deletions

View file

@ -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);

View file

@ -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 */

View file

@ -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<numRec; i++) {
noerror = DOS_FCBWrite(seg,offset,i);
if (!noerror) break;
error = DOS_FCBWrite(seg,offset,i);// dos_fcbwrite return 0 false when true...
if (error!=0x00) break;
}
Bit16u new_block;Bit8u new_rec;
fcb.GetRecord(new_block,new_rec);
if (restore) fcb.SetRecord(old_block,old_rec);
/* Update the random record pointer with new position */
fcb.SetRandom(new_block*128+new_rec);
return noerror;
return error;
}
bool DOS_FCBGetFileSize(Bit16u seg,Bit16u offset,Bit16u numRec) {