From 9aafc9ae6fd38a05bb699026b73fe4e4fb0a6a62 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Wed, 11 Dec 2002 19:54:45 +0000 Subject: [PATCH] fixed fcb random block read/write. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@566 --- src/dos/dos_files.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/dos/dos_files.cpp b/src/dos/dos_files.cpp index d8e2a3af..3dc25faf 100644 --- a/src/dos/dos_files.cpp +++ b/src/dos/dos_files.cpp @@ -720,13 +720,19 @@ Bit8u DOS_FCBWrite(Bit16u seg,Bit16u offset,Bit16u recno) } Bit8u DOS_FCBRandomRead(Bit16u seg,Bit16u offset,Bit16u numRec,bool restore) { +/* if restore is true :random read else random blok read. + * random read updates old block and old record to reflect the random data + * before the read!!!!!!!!! and the random data is not updated! (user must do this) + * Random block read updates these fields to reflect the state after the read! + */ DOS_FCB fcb(seg,offset); Bit32u random;Bit16u old_block;Bit8u old_rec;Bit8u error; + /* Set the correct record from the random data */ fcb.GetRandom(random); - if (restore) fcb.GetRecord(old_block,old_rec); fcb.SetRecord((Bit16u)(random / 128),(Bit8u)(random & 127)); + if (restore) fcb.GetRecord(old_block,old_rec);//store this for after the read. // Read records for (int i=0; i