aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Serpell <daniel.serpell@gmail.com>2020-05-04 22:00:00 -0400
committerDaniel Serpell <daniel.serpell@gmail.com>2020-05-04 22:00:00 -0400
commitbd9966f130d9b25844f12542c0e7e8984615a788 (patch)
tree3b7052fa5961448e0e298a6f2491b44614eaa9f8
parent457cb38efc705b99c10b54d8933c34959fca6c12 (diff)
downloademu2-bd9966f130d9b25844f12542c0e7e8984615a788.tar.gz
Adds delete file using FCB (AH=13h) function.
Tested with DOS 1.25 command.com, this closes #12. Based on an implementation by Thierry Supplisson <ts@js353.com>
-rw-r--r--src/dos.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/dos.c b/src/dos.c
index c5c9830..7a79054 100644
--- a/src/dos.c
+++ b/src/dos.c
@@ -995,6 +995,33 @@ void int21()
case 0x12: // FIND NEXT FILE USING FCB
dos_find_next_fcb();
break;
+ case 0x13: // DELETE FILE USING FCB
+ {
+ dos_show_fcb();
+ /* TODO: Limited support. No wild cards */
+ int fcb_addr = get_fcb();
+ char *fname = dos_unix_path_fcb(fcb_addr, 0);
+ if(!fname)
+ {
+ debug(debug_dos, "\t(file not found)\n");
+ cpuSetAL(0xFF);
+ break;
+ }
+ debug(debug_dos, "\tdelete fcb '%s'\n", fname);
+ int e = unlink(fname);
+ free(fname);
+ if(e)
+ {
+ debug(debug_dos, "\tcould not delete file (%d).\n",errno);
+ cpuSetAL(0xFF);
+ }
+ else
+ {
+ memory[fcb_addr+0x1]=0xE5; // Marker for file deleted
+ cpuSetAL(0x00);
+ }
+ break;
+ }
case 0x14: // SEQUENTIAL READ USING FCB
dos_show_fcb();
cpuSetAL(dos_read_record_fcb(dosDTA, 1));
Un proyecto texto-plano.xyz