diff options
author | Daniel Serpell <daniel.serpell@gmail.com> | 2020-05-04 22:00:00 -0400 |
---|---|---|
committer | Daniel Serpell <daniel.serpell@gmail.com> | 2020-05-04 22:00:00 -0400 |
commit | bd9966f130d9b25844f12542c0e7e8984615a788 (patch) | |
tree | 3b7052fa5961448e0e298a6f2491b44614eaa9f8 | |
parent | 457cb38efc705b99c10b54d8933c34959fca6c12 (diff) | |
download | emu2-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.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -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)); |