3 * Copyright (C) 1998-2002 Brian Palmer <brianp@sginet.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 EXTERN(_DriveMapInt13HandlerStart)
38 /* Get callers flags from stack */
40 movw %ax,%cs:(CallersFlags - Int13Handler)
42 /* Save the drive number they passed in */
43 movb %dl,%cs:(PassedInDriveNumber - Int13Handler)
45 /* Now we need to perform the mapping */
47 movw $(Int13HandlerMapCount - Int13Handler),%si
48 /* Get the count of drives in the map list */
52 /* If the map list is empty then just call the old int 13h handler */
54 jz CallOldInt13Handler
56 GetMappedDriveNumberLoop:
58 /* Get the next drive number in the list */
60 /* Check to see if it's the one they are calling int 13h for */
62 /* If not get the next one */
63 jne GetMappedDriveNumberLoopNext
65 /* If we get here then we have found a mapped drive */
66 /* Send new drive number on to the old int 13h handler */
68 /* Call BIOS Int 13 Handler */
69 jmp CallOldInt13Handler
71 GetMappedDriveNumberLoopNext:
72 loop GetMappedDriveNumberLoop
75 /* Restore the registers we changed off the stack */
80 /* Put flags onto stack */
81 pushw %cs:(CallersFlags - Int13Handler)
83 /* Call old int 13h handler with new drive number */
84 .byte 0x9a /* lcall */
85 EXTERN(_DriveMapOldInt13HandlerAddress)
89 /* Update the callers flags with the values the BIOS returned */
95 /* Restore the callers drive number */
96 movb %cs:(PassedInDriveNumber - Int13Handler),%dl
108 EXTERN(_DriveMapInt13HandlerMapList)
109 Int13HandlerMapCount:
114 Int13HandlerDriveNew1:
119 Int13HandlerDriveNew2:
124 Int13HandlerDriveNew3:
129 Int13HandlerDriveNew4:
132 EXTERN(_DriveMapInt13HandlerEnd)