Subversion Repositories SvarDOS

Rev

Rev 397 | Rev 533 | 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
 * verify
26
 * verify
3
 */
27
 */
4
 
28
 
5
static int cmd_verify(struct cmd_funcparam *p) {
29
static int cmd_verify(struct cmd_funcparam *p) {
6
 
30
 
7
  if (cmd_ishlp(p)) {
31
  if (cmd_ishlp(p)) {
8
    outputnl("Tells DOS whether to verify that files are written correctly to disk.");
32
    outputnl("Tells DOS whether to verify that files are written correctly to disk.");
9
    outputnl("\r\nVERIFY [ON | OFF]\r\n");
33
    outputnl("\r\nVERIFY [ON | OFF]\r\n");
10
    outputnl("Type VERIFY without a parameter to display its current setting.");
34
    outputnl("Type VERIFY without a parameter to display its current setting.");
11
    return(-1);
35
    return(-1);
12
  }
36
  }
13
 
37
 
14
  if (p->argc > 1) {
38
  if (p->argc > 1) {
15
    outputnl("Too many parameters");
39
    outputnl("Too many parameters");
16
    return(-1);
40
    return(-1);
17
  }
41
  }
18
 
42
 
19
  if (p->argc == 0) {
43
  if (p->argc == 0) {
20
    unsigned char verstate = 0;
44
    unsigned char verstate = 0;
21
    _asm {
45
    _asm {
22
      push ax
46
      push ax
23
      mov ah, 0x54   /* Get VERIFY status */
47
      mov ah, 0x54   /* Get VERIFY status */
24
      int 0x21       /* AL == 0 (off) or AL == 1 (on) */
48
      int 0x21       /* AL == 0 (off) or AL == 1 (on) */
25
      mov [verstate], al
49
      mov [verstate], al
26
      pop ax
50
      pop ax
27
    }
51
    }
28
    if (verstate == 0) {
52
    if (verstate == 0) {
29
      outputnl("VERIFY is off");
53
      outputnl("VERIFY is off");
30
    } else {
54
    } else {
31
      outputnl("VERIFY is on");
55
      outputnl("VERIFY is on");
32
    }
56
    }
33
    return(-1);
57
    return(-1);
34
  }
58
  }
35
 
59
 
36
  /* argc == 1*/
60
  /* argc == 1*/
37
  if (imatch(p->argv[0], "on")) {
61
  if (imatch(p->argv[0], "on")) {
38
    _asm {
62
    _asm {
39
      push ax
63
      push ax
40
      push dx
64
      push dx
41
      mov ax, 0x2e01  /* set verify ON */
65
      mov ax, 0x2e01  /* set verify ON */
42
      xor dl, dl      /* apparently required by MS-DOS 2.x */
66
      xor dl, dl      /* apparently required by MS-DOS 2.x */
43
      int 0x21
67
      int 0x21
44
      pop dx
68
      pop dx
45
      pop ax
69
      pop ax
46
    }
70
    }
47
  } else if (imatch(p->argv[0], "off")) {
71
  } else if (imatch(p->argv[0], "off")) {
48
    _asm {
72
    _asm {
49
      push ax
73
      push ax
50
      push dx
74
      push dx
51
      mov ax, 0x2e00  /* set verify OFF */
75
      mov ax, 0x2e00  /* set verify OFF */
52
      xor dl, dl      /* apparently required by MS-DOS 2.x */
76
      xor dl, dl      /* apparently required by MS-DOS 2.x */
53
      int 0x21
77
      int 0x21
54
      pop dx
78
      pop dx
55
      pop ax
79
      pop ax
56
    }
80
    }
57
  } else {
81
  } else {
58
    outputnl("Must specify ON or OFF");
82
    outputnl("Must specify ON or OFF");
59
  }
83
  }
60
 
84
 
61
  return(-1);
85
  return(-1);
62
}
86
}
63
 
87