summaryrefslogtreecommitdiff
path: root/v4.0/src/MAPPER/QHANDTYP.ASM
blob: e9fcaaf4e541a2e61c7ace4911e63112c26e5445 (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
75
76
;
page 60,132
;
title CP/DOS  DOSQhandtype  mapper
;
dosxxx  segment byte public 'dos'
        assume  cs:dosxxx,ds:nothing,es:nothing,ss:nothing
;
; ************************************************************************* *
; *
; *      MODULE: DosQhandtype
; *
; *      FILE NAME: DosQhandtype
; *
; *      FUNCTION: Determine whether a handle is file or device
; *
; *      CALLING SEQUENCE:
; *
; *             push    handle          ; file handle
; *             push@   handtype        ; handle type
; *             push@   flagword        ; device descriptor word
; *             call    dosqhandtype
; *
; *      RETURN SEQUENCE:
; *
; *             handle type:   0  - if a file
; *                            1  - if a device
; *      MODULES CALLED:
; *
; *
; *************************************************************************

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


str     struc
old_bp          dw    ?
return          dd    ?
AttributePtr    dd    ?      ; Device descriptor word returned if device
HandleTypePtr   dd    ?      ; handle type; 0 = file handle, 1 = device handle
Handle          dw    ?      ; file handle
str     ends


dosqhandtype proc   far

        Enter   dosqhandtype            ; push registers

        mov     bx,[bp].Handle          ; get file handle
        mov     ax,4400h
        int     21h                     ; get handle type

        lds     si,[bp].AttributePtr    ; setup area for attribute return
        mov     ds:[si],dx

        lds     si,[bp].HandleTypePtr
        mov     ds:word ptr [si],0      ; assume it is a file

        test    dx,00080h               ; test for file
        jz      ItIsAFile               ; jump if true

        mov     ds:word ptr [si],1      ; else, it is a device, set flag

ItIsAFile:
        Mexit                           ; pop registers
        ret     size str - 6            ; return

dosqhandtype  endp

dosxxx  ends

        end