source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Menus/DriveXlate.asm@ 406

Last change on this file since 406 was 397, checked in by aitotat@…, 13 years ago

Changes to XTIDE Universal BIOS:

  • Cleaned some code concerning recent module changes.
  • Removed drive number translation flag from ROMVARS.
  • BOOTMENUINFO is now DRVDETECTINFO.
  • Makefile now builds tiny binary (XT build with minimal features).
File size: 2.8 KB
Line 
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
21SECTION .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;--------------------------------------------------------------------
33ALIGN JUMP_ALIGN
34DriveXlate_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
44ALIGN 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
51ALIGN JUMP_ALIGN
52.SwapToXXhInAL:
53 mov dl, al
54ALIGN 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;--------------------------------------------------------------------
71DriveXlate_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;--------------------------------------------------------------------
88DriveXlate_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
Note: See TracBrowser for help on using the repository browser.