Subversion Repositories SvarDOS

Rev

Rev 1797 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1797 Rev 1798
Line 231... Line 231...
231
    while ((*cmdline != 0) && (*cmdline != ' ') && (*cmdline != '/')) cmdline++;
231
    while ((*cmdline != 0) && (*cmdline != ' ') && (*cmdline != '/')) cmdline++;
232
  }
232
  }
233
}
233
}
234
 
234
 
235
 
235
 
-
 
236
/* returns current DOS drive (0 = A: ; 1 = B: etc) */
-
 
237
static unsigned char _dosgetcurdrive(void);
-
 
238
#pragma aux _dosgetcurdrive = \
-
 
239
"mov ah, 0x19"    /* DOS 1+ - GET CURRENT DRIVE */ \
-
 
240
"int 0x21" \
-
 
241
modify [ah] \
-
 
242
value [al]
-
 
243
 
-
 
244
 
-
 
245
static void _dosgetcurdir(char near *s);
-
 
246
#pragma aux _dosgetcurdir = \
-
 
247
"mov ah, 0x47"    /* DOS 2+ - CWD - GET CURRENT DIRECTORY */ \
-
 
248
"xor dl, dl"      /* DL = drive number (00h = default, 01h = A:, etc) */ \
-
 
249
"int 0x21" \
-
 
250
parm [si] \
-
 
251
modify [ax dl]
-
 
252
 
-
 
253
 
236
/* builds the prompt string and displays it. buff is filled with a zero-terminated copy of the prompt. */
254
/* builds the prompt string and displays it. buff is filled with a zero-terminated copy of the prompt. */
237
static void build_and_display_prompt(char *buff, unsigned short envseg) {
255
static void build_and_display_prompt(char *buff, unsigned short envseg) {
238
  char *s = buff;
256
  char *s = buff;
239
  /* locate the prompt variable or use the default pattern */
257
  /* locate the prompt variable or use the default pattern */
240
  const char far *fmt = env_lookup_val(envseg, "PROMPT");
258
  const char far *fmt = env_lookup_val(envseg, "PROMPT");
Line 266... Line 284...
266
      case 'd':
284
      case 'd':
267
        s += sprintf(s, "1985-07-29"); /* TODO */
285
        s += sprintf(s, "1985-07-29"); /* TODO */
268
        break;
286
        break;
269
      case 'P':  /* $P = current drive and path */
287
      case 'P':  /* $P = current drive and path */
270
      case 'p':
288
      case 'p':
271
        _asm {
-
 
272
          mov ah, 0x19    /* DOS 1+ - GET CURRENT DRIVE */
-
 
273
          int 0x21
-
 
274
          mov bx, s
-
 
275
          mov [bx], al  /* AL = drive (00 = A:, 01 = B:, etc */
-
 
276
        }
-
 
277
        *s += 'A';
289
        *s = _dosgetcurdrive() + 'A';
278
        s++;
290
        s++;
279
        *s = ':';
291
        *s = ':';
280
        s++;
292
        s++;
281
        *s = '\\';
293
        *s = '\\';
282
        s++;
294
        s++;
283
        _asm {
-
 
284
          mov ah, 0x47    /* DOS 2+ - CWD - GET CURRENT DIRECTORY */
-
 
285
          xor dl,dl       /* DL = drive number (00h = default, 01h = A:, etc) */
-
 
286
          mov si, s       /* DS:SI -> 64-byte buffer for ASCIZ pathname */
-
 
287
          int 0x21
295
        _dosgetcurdir(s);
288
          jc DONE         /* leave path empty on error */
-
 
289
          /* move s ptr forward to end (0-termintor) of pathname */
296
        /* move s ptr forward to end (0-termintor) of pathname */
290
          NEXTBYTE:
-
 
291
          mov si, s
-
 
292
          cmp byte ptr [si], 0
297
        while (*s != 0) s++;
293
          je DONE
-
 
294
          inc s
-
 
295
          jmp NEXTBYTE
-
 
296
          DONE:
-
 
297
        }
-
 
298
        break;
298
        break;
299
      case 'V':  /* $V = DOS version number */
299
      case 'V':  /* $V = DOS version number */
300
      case 'v':
300
      case 'v':
301
        s += sprintf(s, "VER"); /* TODO */
301
        s += sprintf(s, "VER"); /* TODO */
302
        break;
302
        break;
303
      case 'N':  /* $N = current drive */
303
      case 'N':  /* $N = current drive */
304
      case 'n':
304
      case 'n':
305
        _asm {
-
 
306
          mov ah, 0x19    /* DOS 1+ - GET CURRENT DRIVE */
-
 
307
          int 0x21
-
 
308
          mov bx, s
-
 
309
          mov [bx], al  /* AL = drive (00 = A:, 01 = B:, etc */
-
 
310
        }
-
 
311
        *s += 'A';
305
        *s = _dosgetcurdrive() + 'A';
312
        s++;
306
        s++;
313
        break;
307
        break;
314
      case 'G':  /* $G = > (greater-than sign) */
308
      case 'G':  /* $G = > (greater-than sign) */
315
      case 'g':
309
      case 'g':
316
        *s = '>';
310
        *s = '>';