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 $
28 ! $DragonFly: src/usr.bin/doscmd/emsdriv.S,v 1.2 2003/06/17 04:29:26 dillon Exp $
32 ! This driver is needed for Expanded Memory emulation (EMS). A driver
33 ! is needed here, because EMS drivers are installed as DOS devices
34 ! with the name "EMMXXXX0" and programs look for such a device while
35 ! checking the existence of EMS.
36 ! The driver is installed by CONFIG.SYS, it has no options. It uses
37 ! the emulator callback interrupt 0xff to initialize the EMS subsystem.
38 ! If EMS is not configured or if there is an error inside the emulator
39 ! the driver reports failure and does not install itself.
40 ! If all works, the driver changes the interrupt vector for int 0x67 to
41 ! point at itself. The resident part of the drivers simlpy routes calls
42 ! to int 0x67 to the correct subfunction of the emulator callback interrupt.
55 ! Emulator interrupt entry
58 ! Emulator EMS callback function
68 eom = '$' ! DOS end of string
71 Intoffset = (EMSintnum * 4)
77 .long -1 ! link to next device driver
78 .word 0xC000 ! attribute word for driver
79 .word Strategy ! ptr to strategy routine
80 .word Interrupt ! ptr to interrupt service routine
81 .ascii "EMMXXXX0" ! logical device name
87 .word 0 ! != 0 , if vector installed
90 .word InitDrv ! initialize driver
91 .word Noop ! media Check
92 .word Noop ! build BPB
95 .word Noop ! non destructive read
96 .word Noop ! input status
97 .word Noop ! flush input
99 .word Noop ! write with verify
100 .word Noop ! output status
101 .word Noop ! flush output
102 .word Noop ! ioctl output
103 .word Noop ! open device
104 .word Noop ! close device
105 .word Noop ! removeable media check
128 les di,[reqhead] ! load pointer to request header
141 les di,[reqhead] ! load pointer to request header
144 or ax,#0x100 ! done bit
160 mov ax,#0x8003 ! report error to caller
164 ! This is done for all functions except init. It supports the different
165 ! methods for an EMS installation check described in the LIM EMS 4.0 spec
171 ! The interrupt vector installed for int 0x67 points to this routine
173 push ax ! Save original AX
174 mov ah, #EMU_EMS ! Emuint function
175 mov al, #EMU_EMS_CALL ! Emuint subfunction
176 int EmulatorINT ! Call emulator for EMS
181 pop ds ! load DS to use local data
184 jne isinstalled ! already installed
186 push di ! save request header pointer
189 mov ax, #0 ! write the new interrupt vector
210 mov ah, #EMU_EMS ! Emuint function
211 mov al, #EMU_EMS_CTL ! Emuint subfunction
213 cmp ax,#0 ! check if successful
226 mov [di+14], #InitDrv ! address break for driver
245 mov [di+14],#0 ! address break == 0, no driver
252 .ascii "Doscmd EMS 4.0 driver installed"
257 .ascii "EMS emulation is disabled"
259 .ascii "Driver not installed"