Subversion Repositories SvarDOS

Rev

Rev 533 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 533 Rev 534
Line 25... Line 25...
25
/*
25
/*
26
 * echo
26
 * echo
27
 */
27
 */
28
 
28
 
29
static enum cmd_result cmd_echo(struct cmd_funcparam *p) {
29
static enum cmd_result cmd_echo(struct cmd_funcparam *p) {
30
  unsigned short offs = FP_OFF(p->cmdline) + 5;
30
  const char *arg = p->cmdline + 5;
31
  unsigned short segm = FP_SEG(p->cmdline);
-
 
32
 
31
 
33
  /* display help only if /? is the only argument */
32
  /* display help only if /? is the only argument */
34
  if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) {
33
  if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) {
35
    outputnl("Displays messages, or turns command-echoing on or off");
34
    outputnl("Displays messages, or turns command-echoing on or off");
36
    outputnl("");
35
    outputnl("");
Line 65... Line 64...
65
 
64
 
66
  /* ECHO MSG (start at cmdline+5 since first 5 are "ECHO" + separator) */
65
  /* ECHO MSG (start at cmdline+5 since first 5 are "ECHO" + separator) */
67
  _asm {
66
  _asm {
68
    push ax
67
    push ax
69
    push dx
68
    push dx
70
    push ds
-
 
71
    push si
69
    push si
72
 
70
 
73
    mov si, [offs]
71
    mov si, [arg]
74
    cld           /* clear direction flag (DF) so lodsb increments SI */
72
    cld           /* clear direction flag (DF) so lodsb increments SI */
75
    mov ah, 0x02  /* display char from DL */
73
    mov ah, 0x02  /* display char from DL */
76
    mov ds, [segm]
-
 
77
    NEXTYBTE:
74
    NEXTYBTE:
78
    lodsb         /* load byte at DS:[SI] into AL and inc SI (if DF clear) */
75
    lodsb         /* load byte at DS:[SI] into AL and inc SI (if DF clear) */
79
    or al, al     /* is AL == 0? then end of string reached */
76
    or al, al     /* is AL == 0? then end of string reached */
80
    jz DONE
77
    jz DONE
81
    mov dl, al
78
    mov dl, al
Line 88... Line 85...
88
    int 0x21
85
    int 0x21
89
    mov dl, 0x0A
86
    mov dl, 0x0A
90
    int 0x21
87
    int 0x21
91
 
88
 
92
    pop si
89
    pop si
93
    pop ds
-
 
94
    pop dx
90
    pop dx
95
    pop ax
91
    pop ax
96
  }
92
  }
97
 
93
 
98
  return(CMD_OK);
94
  return(CMD_OK);