1 ! Copyright (c) 1997 Helmut Wirth <hfwirth@ping.at>
4 ! Redistribution and use in source and binary forms, with or without
5 ! modification, are permitted provided that the following conditions
7 ! 1. Redistributions of source code must retain the above copyright
8 ! notice immediately at the beginning of the file, witout modification,
9 ! this list of conditions, and the following disclaimer.
10 ! 2. Redistributions in binary form must reproduce the above copyright
11 ! notice, this list of conditions and the following disclaimer in the
12 ! documentation and/or other materials provided with the distribution.
13 ! 3. The name of the author may not be used to endorse or promote products
14 ! derived from this software without specific prior written permission.
16 ! THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 ! IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 ! OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 ! IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 ! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 ! NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 ! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 ! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 ! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 ! THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 ! $FreeBSD: src/usr.bin/doscmd/emsdriv.S,v 1.2 1999/08/28 01:00:14 peter Exp $
31 ! This driver is needed for Expanded Memory emulation (EMS). A driver
32 ! is needed here, because EMS drivers are installed as DOS devices
33 ! with the name "EMMXXXX0" and programs look for such a device while
34 ! checking the existence of EMS.
35 ! The driver is installed by CONFIG.SYS, it has no options. It uses
36 ! the emulator callback interrupt 0xff to initialize the EMS subsystem.
37 ! If EMS is not configured or if there is an error inside the emulator
38 ! the driver reports failure and does not install itself.
39 ! If all works, the driver changes the interrupt vector for int 0x67 to
40 ! point at itself. The resident part of the drivers simlpy routes calls
41 ! to int 0x67 to the correct subfunction of the emulator callback interrupt.
54 ! Emulator interrupt entry
57 ! Emulator EMS callback function
67 eom = '$' ! DOS end of string
70 Intoffset = (EMSintnum * 4)
76 .long -1 ! link to next device driver
77 .word 0xC000 ! attribute word for driver
78 .word Strategy ! ptr to strategy routine
79 .word Interrupt ! ptr to interrupt service routine
80 .ascii "EMMXXXX0" ! logical device name
86 .word 0 ! != 0 , if vector installed
89 .word InitDrv ! initialize driver
90 .word Noop ! media Check
91 .word Noop ! build BPB
94 .word Noop ! non destructive read
95 .word Noop ! input status
96 .word Noop ! flush input
98 .word Noop ! write with verify
99 .word Noop ! output status
100 .word Noop ! flush output
101 .word Noop ! ioctl output
102 .word Noop ! open device
103 .word Noop ! close device
104 .word Noop ! removeable media check
127 les di,[reqhead] ! load pointer to request header
140 les di,[reqhead] ! load pointer to request header
143 or ax,#0x100 ! done bit
159 mov ax,#0x8003 ! report error to caller
163 ! This is done for all functions except init. It supports the different
164 ! methods for an EMS installation check described in the LIM EMS 4.0 spec
170 ! The interrupt vector installed for int 0x67 points to this routine
172 push ax ! Save original AX
173 mov ah, #EMU_EMS ! Emuint function
174 mov al, #EMU_EMS_CALL ! Emuint subfunction
175 int EmulatorINT ! Call emulator for EMS
180 pop ds ! load DS to use local data
183 jne isinstalled ! already installed
185 push di ! save request header pointer
188 mov ax, #0 ! write the new interrupt vector
209 mov ah, #EMU_EMS ! Emuint function
210 mov al, #EMU_EMS_CTL ! Emuint subfunction
212 cmp ax,#0 ! check if successful
225 mov [di+14], #InitDrv ! address break for driver
244 mov [di+14],#0 ! address break == 0, no driver
251 .ascii "Doscmd EMS 4.0 driver installed"
256 .ascii "EMS emulation is disabled"
258 .ascii "Driver not installed"