1 | ; Project name : XTIDE Universal BIOS
|
---|
2 | ; Description : Functions for swapping drive letters.
|
---|
3 |
|
---|
4 | ;
|
---|
5 | ; XTIDE Universal BIOS and Associated Tools
|
---|
6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
|
---|
7 | ;
|
---|
8 | ; This program is free software; you can redistribute it and/or modify
|
---|
9 | ; it under the terms of the GNU General Public License as published by
|
---|
10 | ; the Free Software Foundation; either version 2 of the License, or
|
---|
11 | ; (at your option) any later version.
|
---|
12 | ;
|
---|
13 | ; This program is distributed in the hope that it will be useful,
|
---|
14 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
15 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
16 | ; GNU General Public License for more details.
|
---|
17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
---|
18 | ;
|
---|
19 |
|
---|
20 | ; Section containing code
|
---|
21 | SECTION .text
|
---|
22 |
|
---|
23 | ;--------------------------------------------------------------------
|
---|
24 | ; DriveXlate_ToOrBack
|
---|
25 | ; Parameters:
|
---|
26 | ; DL: Drive number to be possibly translated
|
---|
27 | ; DS: RAMVARS segment
|
---|
28 | ; Returns:
|
---|
29 | ; DL: Translated drive number
|
---|
30 | ; Corrupts registers:
|
---|
31 | ; DI
|
---|
32 | ;--------------------------------------------------------------------
|
---|
33 | ALIGN JUMP_ALIGN
|
---|
34 | DriveXlate_ToOrBack:
|
---|
35 | xchg di, ax ; Backup AX
|
---|
36 |
|
---|
37 | mov ah, 80h ; Assume hard disk
|
---|
38 | mov al, [RAMVARS.xlateVars+XLATEVARS.bHDSwap]
|
---|
39 | test dl, ah ; Hard disk?
|
---|
40 | jnz SHORT .SwapDrive ; If so, jump to swap
|
---|
41 | mov al, [RAMVARS.xlateVars+XLATEVARS.bFDSwap]
|
---|
42 | cbw
|
---|
43 |
|
---|
44 | ALIGN JUMP_ALIGN
|
---|
45 | .SwapDrive:
|
---|
46 | cmp ah, dl ; Swap DL from 00h/80h to xxh?
|
---|
47 | je SHORT .SwapToXXhInAL
|
---|
48 | cmp al, dl ; Swap DL from xxh to 00h/80h?
|
---|
49 | jne SHORT .RestoreAXandReturn
|
---|
50 | mov al, ah
|
---|
51 | ALIGN JUMP_ALIGN
|
---|
52 | .SwapToXXhInAL:
|
---|
53 | mov dl, al
|
---|
54 | ALIGN JUMP_ALIGN
|
---|
55 | .RestoreAXandReturn:
|
---|
56 | xchg ax, di ; Restore AX
|
---|
57 | ret
|
---|
58 |
|
---|
59 |
|
---|
60 | ;--------------------------------------------------------------------
|
---|
61 | ; Resets drive swapping variables to defaults (no swapping).
|
---|
62 | ;
|
---|
63 | ; DriveXlate_Reset
|
---|
64 | ; Parameters:
|
---|
65 | ; DS: RAMVARS segment
|
---|
66 | ; Returns:
|
---|
67 | ; Nothing
|
---|
68 | ; Corrupts registers:
|
---|
69 | ; Nothing
|
---|
70 | ;--------------------------------------------------------------------
|
---|
71 | DriveXlate_Reset:
|
---|
72 | mov WORD [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap], 8000h
|
---|
73 | ret
|
---|
74 |
|
---|
75 |
|
---|
76 | ;--------------------------------------------------------------------
|
---|
77 | ; Stores drive to be swapped.
|
---|
78 | ;
|
---|
79 | ; DriveXlate_SetDriveToSwap
|
---|
80 | ; Parameters:
|
---|
81 | ; DL: Drive to swap to 00h or 80h
|
---|
82 | ; DS: RAMVARS segment
|
---|
83 | ; Returns:
|
---|
84 | ; Nothing
|
---|
85 | ; Corrupts registers:
|
---|
86 | ; Nothing
|
---|
87 | ;--------------------------------------------------------------------
|
---|
88 | DriveXlate_SetDriveToSwap:
|
---|
89 | test dl, dl ; Floppy drive?
|
---|
90 | js SHORT .SetHardDriveToSwap
|
---|
91 |
|
---|
92 | ; Set Floppy Drive to swap
|
---|
93 | mov [RAMVARS.xlateVars+XLATEVARS.bFDSwap], dl
|
---|
94 | ret
|
---|
95 |
|
---|
96 | .SetHardDriveToSwap:
|
---|
97 | mov [RAMVARS.xlateVars+XLATEVARS.bHDSwap], dl
|
---|
98 | ret
|
---|