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

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / MAPPER / IOCTL.ASM
1 page 80,132
2
3 title CP/DOS DosDevIOCTl mapper
4
5 dosxxx segment byte public 'dos'
6 assume cs:dosxxx,ds:nothing,es:nothing,ss:nothing
7 ;
8 ;**********************************************************************
9 ;*
10 ;* MODULE: dosdevioctl
11 ;*
12 ;* FILE NAME: dos007.asm
13 ;*
14 ;* CALLING SEQUENCE:
15 ;*
16 ;* push@ dword Data
17 ;* push@ dword Paramlist
18 ;* push word Function
19 ;* push word Category
20 ;* push@ word Devicehandle
21 ;*
22 ;* call doschgfileptr
23 ;*
24 ;* MODULES CALLED: PC-DOS Int 21h, ah=42h, move file pointer
25 ;*
26 ;*********************************************************************
27
28 public dosdevioctl
29 .sall
30 .xlist
31 include macros.inc
32 .list
33
34 str struc
35 Old_bp dw ?
36 Return dd ?
37 Handle dw ? ; handle
38 Category dw ? ; device category
39 Function dw ? ; device function
40 Parmlist dd ? ; command arguments
41 Data dd ? ; data area
42 str ends
43
44 dosdevioctl proc far
45 Enter dosdevioctl ; push registers
46
47 mov bx,[bp].handle ; get handle
48
49 cmp bx,0ffe5h ; is it a device handle ??
50 jl filehandle ; branch if not
51
52 ; Convert DASD device handle to drive number as follows:
53 ; Drive Open IOCTL
54 ; Letter Handle DASD #
55 ; -----------------------------
56 ; A -2 1
57 ; B -3 2
58 ; C -4 3
59 ; D -5 4
60 ; E -6 5
61 neg bx ; convert dev handle to
62 dec bx ; drive number
63
64 filehandle:
65 mov ax,[bp].function ; get function code
66 cmp ax,020H ; check for right function
67 je continue1 ; continue if right function code
68 mov ax,01H ; else, load error code
69 jmp exit ; return
70
71 continue1: ; only category 8 is supported
72 mov ax,[bp].category ; set category
73
74 mov ah,44h
75 int 21h ; do ioctl
76 jnc continue ; check for error
77
78 cmp ax,1 ; if error and return code = 1
79 jne exit ; then it is network drive
80 ; therefore continue
81 continue:
82 lds si,[bp].data ; media changable
83 mov byte ptr [si],al ; save in data area
84 xor ax,ax ; set no error coe
85
86 exit: mexit ; pop registers
87 ret size str - 6 ; return
88
89 dosdevioctl endp
90
91 dosxxx ends
92
93 end