jhallen / exorsim

Motorola M6800 (6800) Exorciser / SWTPC emulator
Other
43 stars 10 forks source link

Mdos.c has "put" and "rm" problems #2

Closed crestr1 closed 1 year ago

crestr1 commented 1 year ago

There are problems in mdos.c which i have discovered using it to recover files from 40 year old systems derived from Motorola mdos.

A colleague and I have made lots of experiments producing a text file that outline the problem symptoms. it would probably be faster for Mr Allen to look at the issues if i could paste a zip file of the source code we are using and the windows Pelles C compiled version.

basically the serious problems are: It allows the same file to be "put" a second time creating a duplicate index entry The "rm" command does not work

Auto file re-write changes the size of disk file images after a "put"

i look forward to some suggestions or even a way of directly communicating the voluminous data we have showing the problem. it will wind up making many pages here and i do know how to encapsulate the windows compiled .exe code for mdos.c to make it acceptable here.

crestr1 commented 1 year ago

Test files put and double put ss and ds disk imges Multiple Put.txt

crestr1 commented 1 year ago

Tried to upload compiled exe version. Not allowed.

crestr1 commented 1 year ago

Lots of data type warning compiling mdos,c , mostly stuff that got by old C compilers.

source line numbers in brackets:- mdos.c(NNN)

pocc.exe -Tx64-coff -Ot -W1 -std:C17 -Ze "C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c" -Fo"C:\Users\dellman\Documents\Pelles C Projects\Mdos\output\mdos.obj" C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(150): warning #2115: Local 'len' is initialized but never used. C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(148): warning #2115: Local 'sect' is initialized but never used. C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(314): warning #2229: Local 'cursize' is potentially used without being initialized (or using a dangling value). C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(302): warning #2229: Local 'cursize' is potentially used without being initialized (or using a dangling value). C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(301): warning #2229: Local 'cursize' is potentially used without being initialized (or using a dangling value). C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(300): warning #2229: Local 'cursize' is potentially used without being initialized (or using a dangling value). C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(330): warning #2229: Local 'cursize' is potentially used without being initialized (or using a dangling value). C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(328): warning #2229: Local 'cursize' is potentially used without being initialized (or using a dangling value). C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(327): warning #2229: Local 'cursize' is potentially used without being initialized (or using a dangling value). C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(387): warning #2235: Not all control paths in 'lsn_to_psn' return a value. C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(575): warning #2154: Unreachable code. C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(691): warning #2018: Undeclared function 'strdup' (did you mean: _strdup?); assuming 'extern' returning 'int'. C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(691): error #2168: Operands of '=' have incompatible types 'char *' and 'int'. C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(819): warning #2115: Local 'rib' is initialized but never used. C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(818): warning #2114: Local 'nam' is not referenced. C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(811): warning #2114: Local 'y' is not referenced. Error code: 1 Done.

Compile with 691 strdup changed to _strdup for windows

pocc.exe -Tx64-coff -Ot -W1 -std:C17 -Ze "C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c" -Fo"C:\Users\dellman\Documents\Pelles C Projects\Mdos\output\mdos.obj" C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(150): warning #2115: Local 'len' is initialized but never used. C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(148): warning #2115: Local 'sect' is initialized but never used. C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(314): warning #2229: Local 'cursize' is potentially used without being initialized (or using a dangling value). C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(302): warning #2229: Local 'cursize' is potentially used without being initialized (or using a dangling value). C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(301): warning #2229: Local 'cursize' is potentially used without being initialized (or using a dangling value). C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(300): warning #2229: Local 'cursize' is potentially used without being initialized (or using a dangling value). C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(330): warning #2229: Local 'cursize' is potentially used without being initialized (or using a dangling value). C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(328): warning #2229: Local 'cursize' is potentially used without being initialized (or using a dangling value). C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(327): warning #2229: Local 'cursize' is potentially used without being initialized (or using a dangling value). C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(387): warning #2235: Not all control paths in 'lsn_to_psn' return a value. C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(575): warning #2154: Unreachable code. C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(819): warning #2115: Local 'rib' is initialized but never used. C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(818): warning #2114: Local 'nam' is not referenced. C:\Users\dellman\Documents\Pelles C Projects\Mdos\mdos.c(811): warning #2114: Local 'y' is not referenced. Building Mdos.tag. Done.

crestr1 commented 1 year ago

We compiled mdos.c on Windows 10 and used it to recover several thousand files successfully from 8" floppy disk images. However we run into problems whenever we try to release space in the disk image for reallocation's using rm — to add a new file to a disk image — using put.

The log below shows mdos.exe operating on a double-sided disk image diskDS.dsk. The first four commands work as expected.

put writes a file (localFN1.txt) to the disk image as an mdos file (mdosFN1.sa) mdos.exe diskDS.dsk put localFN1.txt mdosFN1.sa

ls lists a detailed list of all files in the disk image file (diskDS.dsk) mdos.exe diskDS.dsk ls -al

cat reads the file from the disk image and displays it mdos.exe diskDS.dsk cat mdosFN1.sa

get retrieves the file from the disk image and saves it in the local directory. mdos.exe diskDS.dsk get mdosFN1.sa

There are two problems.

Firstly, the rm command fails to remove a file from the disk image mdos.exe diskDS.img rm mdosFN1.sa

Secondly, if a further put command is attempted with the same file name, a duplicate version of mdosFN1.sa automatically appears in the disk image.

The following log shows highlighted values for the size of the disk image before and after the put command. All commands behave the same way on either a single-sided and a double-sided disk image so the log only shows operations for the double-sided disk image.

LOG FILE FOLLOWS

crestr1 commented 1 year ago

LOG TEXT FILE mdos_ exe _log.txt

crestr1 commented 1 year ago

Handling "put" same file second time: Simplest way - throw a file exists error and do nothing else More useful way - offer "-v " overwrite if exists option

jhallen commented 1 year ago

You are probably the first to use mdos.c so extensively.. Can you try this in Linux or Cygwin (so that gcc is used)? Can you put the files in a google drive or something and post a shared link? Maybe I can get them that way.

Anyway, I tried deleting some files. It does seem to work, so I am wondering if there is a compiling problem with Pelles C. Does "rm" always fail for you?

jhallen commented 1 year ago

I've fixed some of the compiler warnings you are seeing. One thing you could try: leave out the "-Ot" when compiling.

crestr1 commented 1 year ago

mdos.c source and object.zip

crestr1 commented 1 year ago

Make .hat suffix .exe in previous

crestr1 commented 1 year ago

Thanks Joe, we really appreciate you putting an oar into the water on this.

We are old timers with Motorola mdos and Exorciser stuff and thankfully there was a version of RASM09 that runs in your 6800 emulation.

"rm" has never worked in windows, but we have a cygwin compiler version done with an old version compiler we will try, we did a lot of recovery work using this object but other pressures cause us to want to use windows 7 and 10 for remaking 6809 recovered sources into human readable assembly listings with symbol tables and cross refs,

crestr1 commented 1 year ago

Did a quick hack in windows, Source and result in attached zip: needs rework for window version of exe. SWTP not a lot of use to our group, basic Exorciser is all we need to solve our problem with double sided 8" archives

new compilers give it a rough time but some actual errors too from transport to windows

Quick hack for windows.zip

I think this has a good future under windows but It's all beyond my capability to make a good clever job of its intricacies.

crestr1 commented 1 year ago

for the casual observer: the command line stuff from the exe. printf("EXORciser emulator\n"); printf("\n"); printf("exor [options] [disk0 [disk1 [disk2 [disk3]]]]\n"); printf("\n"); printf(" --trace Produce instruction trace on stderr\n"); printf(" --dtrace Produce disk access trace on stderr\n"); printf(" --skip nnn Skip first nnn insns in trace\n"); printf(" --swtpc Simulate SWTPC instead of EXORciser\n"); printf(" --exbug name Give name for ROM if not 'exbug.bin'\n"); printf(" -x Go into EXBUG/SWTBUG instead of MDOS/FLEX\n"); printf(" --facts file Process facts files for commented disassembly\n"); printf(" --lower Allow lowercase\n"); printf(" --mon Start at monitor prompt\n"); printf("\n"); printf("Default disk0 is mdos.dsk/flex.dsk\n"); printf("\n"); printf("Hints:\n"); printf(" To load MDOS from EXBUG, type MAID followed by E800;G\n"); printf("\n"); printf(" To load FLEX2 from SWTBUG, type D\n"); printf("\n"); exit(-1);

crestr1 commented 1 year ago

Resolved compiling under cygwin. this is a really impressive Exorciser emulation, having the running screen based Exorterm makes an incredible and easily usable package. It actually betters the performance of the real Exorciser. Works far better that the GUI version that was around, now sorry I did not try it years ago..