Subversion Repositories SvarDOS

Rev

Rev 397 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 397 Rev 421
-
 
1
/* This file is part of the SvarCOM project and is published under the terms
-
 
2
 * of the MIT license.
-
 
3
 *
-
 
4
 * Copyright (C) 2021 Mateusz Viste
-
 
5
 *
-
 
6
 * Permission is hereby granted, free of charge, to any person obtaining a
-
 
7
 * copy of this software and associated documentation files (the "Software"),
-
 
8
 * to deal in the Software without restriction, including without limitation
-
 
9
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
-
 
10
 * and/or sell copies of the Software, and to permit persons to whom the
-
 
11
 * Software is furnished to do so, subject to the following conditions:
-
 
12
 *
-
 
13
 * The above copyright notice and this permission notice shall be included in
-
 
14
 * all copies or substantial portions of the Software.
-
 
15
 *
-
 
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-
 
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-
 
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-
 
19
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-
 
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-
 
21
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-
 
22
 * DEALINGS IN THE SOFTWARE.
-
 
23
 */
-
 
24
 
1
/*
25
/*
2
 * translates a DOS extended error into a human string
26
 * translates a DOS extended error into a human string
3
 * (as defined by INT 21/AH=59h/BX=0000h)
27
 * (as defined by INT 21/AH=59h/BX=0000h)
4
 */
28
 */
5
 
29
 
6
#include <stdio.h>
30
#include <stdio.h>
7
 
31
 
8
#include "doserr.h"
32
#include "doserr.h"
9
 
33
 
10
const char *doserr(unsigned short err) {
34
const char *doserr(unsigned short err) {
11
  static char buf[24];
35
  static char buf[24];
12
  switch (err) {
36
  switch (err) {
13
    case 0x00: return("Success");
37
    case 0x00: return("Success");
14
    case 0x01: return("Function number invalid");
38
    case 0x01: return("Function number invalid");
15
    case 0x02: return("File not found");
39
    case 0x02: return("File not found");
16
    case 0x03: return("Path not found");
40
    case 0x03: return("Path not found");
17
    case 0x04: return("Too many open files (no handles available)");
41
    case 0x04: return("Too many open files (no handles available)");
18
    case 0x05: return("Access denied");
42
    case 0x05: return("Access denied");
19
    case 0x06: return("Invalid handle");
43
    case 0x06: return("Invalid handle");
20
    case 0x07: return("Memory control block destroyed");
44
    case 0x07: return("Memory control block destroyed");
21
    case 0x08: return("Insufficient memory");
45
    case 0x08: return("Insufficient memory");
22
    case 0x09: return("Memory block address invalid");
46
    case 0x09: return("Memory block address invalid");
23
    case 0x0A: return("Environment invalid");
47
    case 0x0A: return("Environment invalid");
24
    case 0x0B: return("Format invalid");
48
    case 0x0B: return("Format invalid");
25
    case 0x0C: return("Access code invalid");
49
    case 0x0C: return("Access code invalid");
26
    case 0x0D: return("Data invalid");
50
    case 0x0D: return("Data invalid");
27
    case 0x0F: return("Invalid drive");
51
    case 0x0F: return("Invalid drive");
28
    case 0x10: return("Attemted to remove current directory");
52
    case 0x10: return("Attemted to remove current directory");
29
    case 0x11: return("Not same device");
53
    case 0x11: return("Not same device");
30
    case 0x12: return("No more files");
54
    case 0x12: return("No more files");
31
    case 0x13: return("Disk write-protected");
55
    case 0x13: return("Disk write-protected");
32
    case 0x14: return("Unknown unit");
56
    case 0x14: return("Unknown unit");
33
    case 0x15: return("Drive not ready");
57
    case 0x15: return("Drive not ready");
34
    case 0x16: return("Unknown command");
58
    case 0x16: return("Unknown command");
35
    case 0x17: return("Data error (CRC)");
59
    case 0x17: return("Data error (CRC)");
36
    case 0x18: return("Bad request structure length");
60
    case 0x18: return("Bad request structure length");
37
    case 0x19: return("Seek error");
61
    case 0x19: return("Seek error");
38
    case 0x1A: return("Unknown media type (non-DOS disk)");
62
    case 0x1A: return("Unknown media type (non-DOS disk)");
39
    case 0x1B: return("Sector not found");
63
    case 0x1B: return("Sector not found");
40
    case 0x1C: return("Printer out of paper");
64
    case 0x1C: return("Printer out of paper");
41
    case 0x1D: return("Write fault");
65
    case 0x1D: return("Write fault");
42
    case 0x1E: return("Read fault");
66
    case 0x1E: return("Read fault");
43
    case 0x1F: return("General failure");
67
    case 0x1F: return("General failure");
44
    case 0x20: return("Sharing violation");
68
    case 0x20: return("Sharing violation");
45
    case 0x21: return("Lock violation");
69
    case 0x21: return("Lock violation");
46
    case 0x22: return("Disk change invalid");
70
    case 0x22: return("Disk change invalid");
47
    case 0x23: return("FCB unavailable");
71
    case 0x23: return("FCB unavailable");
48
    case 0x24: return("Sharing buffer overflow");
72
    case 0x24: return("Sharing buffer overflow");
49
    case 0x25: return("Code page mismatch");
73
    case 0x25: return("Code page mismatch");
50
    case 0x26: return("Cannot complete file operations (EOF / out of input)");
74
    case 0x26: return("Cannot complete file operations (EOF / out of input)");
51
    case 0x27: return("Insufficient disk space");
75
    case 0x27: return("Insufficient disk space");
52
    default:
76
    default:
53
      snprintf(buf, sizeof(buf), "DOS ERROR 0x%02X", err);
77
      snprintf(buf, sizeof(buf), "DOS ERROR 0x%02X", err);
54
      return(buf);
78
      return(buf);
55
  }
79
  }
56
}
80
}
57
 
81