Subversion Repositories SvarDOS

Rev

Rev 421 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
408 mateuszvis 1
/*
2
 * break
3
 */
4
 
5
static int cmd_break(struct cmd_funcparam *p) {
6
  unsigned char brkflag = 0;
7
 
8
  if (cmd_ishlp(p)) {
9
    outputnl("Sets or clears extended CTRL+C checking");
10
    outputnl("");
11
    outputnl("BREAK [ON | OFF]");
12
    outputnl("");
13
    outputnl("Type BREAK without a parameter to display the current BREAK setting.");
14
    return(-1);
15
  }
16
 
17
  /* no params: display current break state */
18
  if (p->argc == 0) {
19
    _asm {
20
      push ax
21
      push dx
22
 
23
      mov ax, 0x3300   /* query break-check flag */
24
      int 0x21         /* status (0=OFF, 1=ON) in DL */
25
      mov [brkflag], dl
26
 
27
      pop dx
28
      pop ax
29
    }
30
    if (brkflag == 0) {
31
      outputnl("BREAK is off");
32
    } else {
33
      outputnl("BREAK is on");
34
    }
35
    return(-1);
36
  }
37
 
38
  /* too many params? */
39
  if (p->argc > 1) {
40
    outputnl("Too many parameters");
41
    return(-1);
42
  }
43
 
44
  /* exactly 1 parameter - "on" or "off" */
45
  if (imatch(p->argv[0], "on")) {
46
    brkflag = 1;
47
  } else if (!imatch(p->argv[0], "off")) {
48
    outputnl("Invalid parameter");
49
    return(-1);
50
  }
51
 
52
  /* set break accordingly to brkflag */
53
  _asm {
54
    push ax
55
    push dx
56
 
57
    mov ax, 0x3301     /* set break-check level */
58
    mov dl, [brkflag]  /* 0=OFF 1=ON */
59
    int 0x21
60
 
61
    pop dx
62
    pop ax
63
  }
64
 
65
  return(-1);
66
}