summaryrefslogtreecommitdiff
path: root/v4.0/src/MAPPER/IOCTL.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/IOCTL.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/IOCTL.ASM')
-rw-r--r--v4.0/src/MAPPER/IOCTL.ASM93
1 files changed, 93 insertions, 0 deletions
diff --git a/v4.0/src/MAPPER/IOCTL.ASM b/v4.0/src/MAPPER/IOCTL.ASM
new file mode 100644
index 0000000..03302db
--- /dev/null
+++ b/v4.0/src/MAPPER/IOCTL.ASM
@@ -0,0 +1,93 @@
1page 80,132
2
3title CP/DOS DosDevIOCTl mapper
4
5dosxxx 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
34str struc
35Old_bp dw ?
36Return dd ?
37Handle dw ? ; handle
38Category dw ? ; device category
39Function dw ? ; device function
40Parmlist dd ? ; command arguments
41Data dd ? ; data area
42str ends
43
44dosdevioctl 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
64filehandle:
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
71continue1: ; 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
81continue:
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
86exit: mexit ; pop registers
87 ret size str - 6 ; return
88
89dosdevioctl endp
90
91dosxxx ends
92
93 end