summaryrefslogtreecommitdiff
path: root/v4.0/src/MAPPER/QFILEMOD.ASM
blob: 59fc70c0332293a7fda85f56e921164594833e97 (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
page 80,132

title CP/DOS DosQFileMode mapper

dosxxx	segment byte public 'dos'
	assume	cs:dosxxx,ds:nothing,es:nothing,ss:nothing
;
;**********************************************************************
;*
;*   MODULE:   dosqfilemode	Read file attribute
;*
;*   FUNCTION:	Query file mode
;*
;*   CALLING SEQUENCE:
;*
;*	 push@	   asciiz   file path name
;*	 push@	   word     attribute return area
;*	 push	   dword    reserved
;*	 call	   dosqfilemode
;*
;*   MODULES CALLED:  PC-DOS Int 21h, ah=43h, change file mode
;*
;*********************************************************************

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

error_code  equ      0002h

str	    struc
old_bp	    dw	     ?
return	    dd	     ?
rsrvd	    dd	     ?
Attrib	    dd	     ?	     ; current attribute pointer
Path	    dd	     ?	     ; file path name pointer
str	    ends

dosqfilemode proc    far
	    Enter    dosqfilemode	 ; push registers

	    lds      dx,[bp].path	 ; set path name

	    mov      ax,4300h		 ; set op code
	    int      21h		 ; get file mode
	    jc	     error		 ; jump if error

	    lds      si,[bp].attrib	 ; setup return data area
	    mov      word ptr [si],cx	 ; save attribute there
	    sub      ax,ax		 ; set good return code
	    jmp      short exit 	 ; return

error:	    mov      ax,error_code	 ; set error code

exit:	    mexit			 ; pop registers
	    ret      size str - 6	 ; return

dosqfilemode endp

dosxxx	    ends

	    end