Subversion Repositories SvarDOS

Rev

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

Rev 415 Rev 416
Line 358... Line 358...
358
    path[len++] = '\\';
358
    path[len++] = '\\';
359
    path[len] = 0;
359
    path[len] = 0;
360
  }
360
  }
361
  return(len);
361
  return(len);
362
}
362
}
-
 
363
 
-
 
364
 
-
 
365
/* get current path drive d (A=1, B=2, etc - 0 is "current drive")
-
 
366
 * returns 0 on success, doserr otherwise */
-
 
367
unsigned short curpathfordrv(char *buff, unsigned char d) {
-
 
368
  unsigned short r = 0;
-
 
369
 
-
 
370
  _asm {
-
 
371
    /* is d == 0? then I need to resolve current drive */
-
 
372
    cmp byte ptr [d], 0
-
 
373
    jne GETCWD
-
 
374
    /* resolve cur drive */
-
 
375
    mov ah, 0x19  /* get current default drive */
-
 
376
    int 0x21      /* al = drive (00h = A:, 01h = B:, etc) */
-
 
377
    inc al        /* convert to 1=A, 2=B, etc */
-
 
378
    mov [d], al
-
 
379
 
-
 
380
    GETCWD:
-
 
381
    /* prepend buff with drive:\ */
-
 
382
    mov si, buff
-
 
383
    mov dl, [d]
-
 
384
    mov [si], dl
-
 
385
    add byte ptr [si], 'A' - 1
-
 
386
    inc si
-
 
387
    mov [si], ':'
-
 
388
    inc si
-
 
389
    mov [si], '\\'
-
 
390
    inc si
-
 
391
 
-
 
392
    mov ah, 0x47      /* get current directory of drv DL into DS:SI */
-
 
393
    int 0x21
-
 
394
    jnc DONE
-
 
395
    mov [r], ax       /* copy result from ax */
-
 
396
 
-
 
397
    DONE:
-
 
398
  }
-
 
399
 
-
 
400
  return(r);
-
 
401
}