]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/MAPPER/QHANDTYP.ASM

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / MAPPER / QHANDTYP.ASM
1 ;
2 page 60,132
3 ;
4 title CP/DOS DOSQhandtype mapper
5 ;
6 dosxxx segment byte public 'dos'
7 assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing
8 ;
9 ; ************************************************************************* *
10 ; *
11 ; * MODULE: DosQhandtype
12 ; *
13 ; * FILE NAME: DosQhandtype
14 ; *
15 ; * FUNCTION: Determine whether a handle is file or device
16 ; *
17 ; * CALLING SEQUENCE:
18 ; *
19 ; * push handle ; file handle
20 ; * push@ handtype ; handle type
21 ; * push@ flagword ; device descriptor word
22 ; * call dosqhandtype
23 ; *
24 ; * RETURN SEQUENCE:
25 ; *
26 ; * handle type: 0 - if a file
27 ; * 1 - if a device
28 ; * MODULES CALLED:
29 ; *
30 ; *
31 ; *************************************************************************
32
33 public dosqhandtype
34 .sall
35 .xlist
36 include macros.inc
37 .list
38
39
40 str struc
41 old_bp dw ?
42 return dd ?
43 AttributePtr dd ? ; Device descriptor word returned if device
44 HandleTypePtr dd ? ; handle type; 0 = file handle, 1 = device handle
45 Handle dw ? ; file handle
46 str ends
47
48
49 dosqhandtype proc far
50
51 Enter dosqhandtype ; push registers
52
53 mov bx,[bp].Handle ; get file handle
54 mov ax,4400h
55 int 21h ; get handle type
56
57 lds si,[bp].AttributePtr ; setup area for attribute return
58 mov ds:[si],dx
59
60 lds si,[bp].HandleTypePtr
61 mov ds:word ptr [si],0 ; assume it is a file
62
63 test dx,00080h ; test for file
64 jz ItIsAFile ; jump if true
65
66 mov ds:word ptr [si],1 ; else, it is a device, set flag
67
68 ItIsAFile:
69 Mexit ; pop registers
70 ret size str - 6 ; return
71
72 dosqhandtype endp
73
74 dosxxx ends
75
76 end