summaryrefslogtreecommitdiff
path: root/v4.0/src/MAPPER/QCURDIR.ASM
diff options
context:
space:
mode:
Diffstat (limited to 'v4.0/src/MAPPER/QCURDIR.ASM')
-rw-r--r--v4.0/src/MAPPER/QCURDIR.ASM104
1 files changed, 104 insertions, 0 deletions
diff --git a/v4.0/src/MAPPER/QCURDIR.ASM b/v4.0/src/MAPPER/QCURDIR.ASM
new file mode 100644
index 0000000..9853d89
--- /dev/null
+++ b/v4.0/src/MAPPER/QCURDIR.ASM
@@ -0,0 +1,104 @@
1;
2page 80,132
3;
4title CP/DOS DosQCurDir mapper
5
6buffer segment word public 'buffer'
7CurrentDirectoryBuffer db 128 dup(?)
8buffer ends
9
10dosxxx segment byte public 'dos'
11 assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing
12
13;**********************************************************************
14;*
15;* MODULE: dosqcurdir
16;*
17;* FILE NAME: dos036.asm
18;*
19;* CALLING SEQUENCE:
20;*
21;* push word drive number (0=default, 1=a, etc.)
22;* push@ other dirpath
23;* push@ other dirpathlen
24;*
25;* call doqcurdir
26;*
27;* MODULES CALLED: PC-DOS Int 21h, ah=47h, get current directory
28;*
29;*********************************************************************
30
31 public dosqcurdir
32 .sall
33 include macros.inc
34
35str struc
36old_bp dw ?
37return dd ?
38BufferLengthPtr dd ? ; directory path buffer length pointer
39BufferPtr dd ? ; directory path buffer pointer
40Drive dw ? ; driver number
41str ends
42
43
44dosqcurdir proc far
45
46 Enter Dosqcurdir ; push registers
47
48 mov ax,seg buffer ; set temporary buffer to receive
49 mov ds,ax ; dircetory path information
50 assume ds:buffer
51 mov si,offset buffer:CurrentDirectoryBuffer
52 mov dx,[bp].drive ; set driver number
53
54 mov ah,47h
55 int 21h ; get directory path information
56 jc ErrorExit ; check for error
57
58 mov di,ds
59 mov es,di
60 assume es:buffer
61
62; next calculate the size of the path name just received
63
64 mov di,offset buffer:CurrentDirectoryBuffer
65 mov cx,128
66 mov al,0 ; look for the non-ascii chara
67 cld ; in the buffer indciates the
68 repne scasb ; end of the path.
69
70 mov dx,128
71 sub dx,cx ; calculate actual path length
72
73 les di,[bp].BufferLengthPtr ; set path buffer lenght pointer
74 assume es:nothing
75 mov cx,es:[di] ; check for directory path
76 ; buffe size
77 cmp cx,dx ; compare with needed length
78 jnc HaveThePathLength ; branch if length is ok
79
80 mov ax,8 ; else, set error code
81 jmp ErrorExit ; return
82
83HaveThePathLength:
84 mov cx,dx
85 mov es:[di],dx ; return path length
86
87 les di,[bp].BufferPtr ; prepare to move directory path name
88 ; into return buffer
89 mov si,offset buffer:CurrentDirectoryBuffer
90
91 rep movsb ; copy dir path to return buffer
92
93 sub ax,ax ; set good return
94
95ErrorExit:
96 mexit ; pop registers
97 ret size str - 6 ; return
98
99dosqcurdir endp
100
101dosxxx ends
102
103 end
104