summaryrefslogtreecommitdiff
path: root/v4.0/src/MAPPER/CHDIR.ASM
blob: 5143b26a80217ed529506927f9010d26e27e6e17 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
;
page 80,132
;
title CP/DOS  DosChDir  mapper
;
dosxxx  segment byte public 'dos'
        assume  cs:dosxxx,ds:nothing,es:nothing,ss:nothing
;
; ************************************************************************* *
; *
; *      MODULE: DosChDir
; *
; *      FUNCTION: change directory name
; *
; *      FUNCTION: This module will change the current directory for the
; *                requesting process.
; *
; *
; *      CALLING SEQUENCE:
; *
; *                PUSH@ ASCIIZ Dirname ; Directory path name
; *                PUSH  DWORD  0       ; Reserved (must be zero)  took out @
; *                                     ; 5/28 to match 3/25 spec
; *                CALL DosChDir
; *
; *
; *      RETURN SEQUENCE:
; *
; *                IF ERROR (AX NOT = 0)
; *
; *                   AX = Error Code:
; *
; *                   o   Invalid directory path
; *
; *      MODULES CALLED:
; *                     DOS int 21h   function 3Bh ; Change current directory
; *
; *************************************************************************

        public  DosChDir
        .sall
        .xlist
        include macros.inc
        .list

str     struc
old_bp  dw      ?
return  dd      ?
dtrm006 dd      0h           ;reserved  (must be zero)
dnam006 dd      ?            ;address of directory path name
str     ends

DosChDir  proc   far
        Enter   DosChDir                 ; push registers

        mov     dx, word ptr [bp].dnam006    ;load directory name offset
        mov     ax, word ptr [bp].dnam006+2  ;load directory name segment

        push    ax                       ; set segment in DS
        pop     ds

        mov     ax,03b00h                ; load chdir op code
        int     21h                      ; call dos to change the directory
        jc      exit                     ; jump if error

        xor     ax,ax                    ; else, good return code
exit:   mexit                            ; pop registers
        ret     size str - 6             ; return

DosChDir  endp

dosxxx  ends

        end