summaryrefslogtreecommitdiff
path: root/v4.0/src/MAPPER/QFILEINF.ASM
diff options
context:
space:
mode:
authorGravatar Mark Zbikowski2024-04-25 21:24:10 +0100
committerGravatar Microsoft Open Source2024-04-25 22:32:27 +0000
commit2d04cacc5322951f187bb17e017c12920ac8ebe2 (patch)
tree80ee017efa878dfd5344b44249e6a241f2a7f6e2 /v4.0/src/MAPPER/QFILEINF.ASM
parentMerge pull request #430 from jpbaltazar/typoptbr (diff)
downloadms-dos-main.tar.gz
ms-dos-main.tar.xz
ms-dos-main.zip
MZ is back!HEADmain
Diffstat (limited to 'v4.0/src/MAPPER/QFILEINF.ASM')
-rw-r--r--v4.0/src/MAPPER/QFILEINF.ASM146
1 files changed, 146 insertions, 0 deletions
diff --git a/v4.0/src/MAPPER/QFILEINF.ASM b/v4.0/src/MAPPER/QFILEINF.ASM
new file mode 100644
index 0000000..b35bdbb
--- /dev/null
+++ b/v4.0/src/MAPPER/QFILEINF.ASM
@@ -0,0 +1,146 @@
1; 0
2page 80,132
3;
4title CP/DOS DosQFileInfo mapper
5;
6
7FileAttributeSegment segment word public 'fat'
8
9 extrn FileAttributeTable:word
10
11FileAttributeSegment ends
12
13dosxxx segment byte public 'dos'
14 assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing
15;
16;**********************************************************************
17;*
18;* MODULE: dosQfileinfo
19;*
20;* FILE NAME: dos052.asm
21;*
22;* CALLING SEQUENCE:
23;*
24;* push word filehandle
25;* push word fileinfolevel
26;* push@ other fileinfobuffer
27;* push word filebuffersize
28;* call dossetfileinfo
29;*
30;* MODULES CALLED: PC-DOS Int 21h, ah=57h, set file's date/time
31;*
32;*********************************************************************
33
34 public dosQfileinfo
35 .sall
36 .xlist
37 include macros.inc
38 .list
39
40
41FileInfo struc
42CreateDate dw ?
43CreateTime dw ?
44LastAccessDate dw ?
45LastAccessTime dw ?
46LastWriteDate dw ?
47LastWriteTime dw ?
48DataLength dd ? ; File size
49FileSpace dd ? ; falloc_size
50Attributes dw ? ; attributes
51FileInfo ends
52
53
54str struc
55old_bp dw ?
56return dd ?
57BufferSize dw ? ; file data buffer size
58BufferPtr dd ? ; file data buffer
59Level dw ? ; file data info level
60Handle dw ? ; file handle
61str ends
62
63dosQfileinfo proc far
64 Enter dosQfileinfo ; save registers
65
66 mov bx,[bp].handle ;fill registers for function call
67
68 mov ax,05700h
69 int 21h ; get file date and time
70 jc ErrorExit ; jump if error
71
72 lds si,[bp].BufferPtr ; copy date and time to
73 mov ds:[si].CreateDate,dx ; file info return data area
74 mov ds:[si].CreateTime,cx
75 mov ds:[si].LastAccessDate,dx
76 mov ds:[si].LastAccessTime,cx
77 mov ds:[si].LastWriteDate,dx
78 mov ds:[si].LastWriteTime,cx
79
80; Calculate the file length and file space and save in the file info data area
81
82 mov cx,0 ; get the current position
83 mov dx,0
84 mov bx,[bp].handle ; get file handle
85
86 mov ax,04201h
87 int 21h ; move file pointer to the
88 jc ErrorExit ; current position
89
90 push dx
91 push ax
92
93 mov cx,0
94 mov dx,0
95 mov bx,[bp].Handle
96
97 mov ax,04202h ; move file pointer to end-of-file
98 int 21h
99
100 lds si,[bp].BufferPtr ; save the file length in
101 mov ds:word ptr DataLength[si+0],ax ; file info data area
102 mov ds:word ptr DataLength[si+2],dx
103
104 test ax,511
105 jz HaveSpace
106
107 and ax,not 511
108 add ax,512
109 adc dx,0
110
111HaveSpace:
112 mov ds:word ptr FileSpace[si+0],ax ; save file space
113 mov ds:word ptr FileSpace[si+2],dx ; in return data area
114
115; calculate the file attribute and save
116
117 pop dx
118 pop cx
119
120 mov bx,[bp].Handle
121
122 mov ax,04200h
123 int 21h ; move the file pointer
124 jc ErrorExit
125
126 mov ax,seg FileAttributeSegment
127 mov ds,ax
128 assume ds:FileAttributeSegment
129
130 mov bx,[bp].Handle
131 add bx,bx
132
133 mov ax,FileAttributeTable[bx]
134 mov [bp].Attributes,ax ; save file attribute
135
136 sub ax,ax ; set good return code
137
138ErrorExit:
139 mexit ; restore registers
140 ret size str - 6 ; return
141
142dosqfileinfo endp
143
144dosxxx ends
145
146 end