source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Initialization/DriveXlate.asm@ 385

Last change on this file since 385 was 376, checked in by gregli@…, 13 years ago

WIDE checkin... Added copyright and license information to sorce files, as per the GPL instructions for usage.

File size: 2.9 KB
RevLine 
[99]1; Project name : XTIDE Universal BIOS
[3]2; Description : Functions for swapping drive letters.
3
[376]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
[3]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 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_DRVXLAT
36 jz SHORT .Return ; Return if translation disabled
37 xchg di, ax ; Backup AX
38
[126]39 mov ah, 80h ; Assume hard disk
[294]40 mov al, [RAMVARS.xlateVars+XLATEVARS.bHDSwap]
[126]41 test dl, ah ; Hard disk?
[322]42 jnz SHORT .SwapDrive ; If so, jump to swap
[294]43 mov al, [RAMVARS.xlateVars+XLATEVARS.bFDSwap]
[126]44 cbw
[3]45
[126]46ALIGN JUMP_ALIGN
[322]47.SwapDrive:
48 cmp ah, dl ; Swap DL from 00h/80h to xxh?
[3]49 je SHORT .SwapToXXhInAL
[322]50 cmp al, dl ; Swap DL from xxh to 00h/80h?
51 jne SHORT .RestoreAXandReturn
[181]52 mov al, ah
[3]53ALIGN JUMP_ALIGN
54.SwapToXXhInAL:
55 mov dl, al
[322]56ALIGN JUMP_ALIGN
57.RestoreAXandReturn:
58 xchg ax, di ; Restore AX
[181]59ALIGN JUMP_ALIGN, ret
60.Return:
[3]61 ret
62
63
64;--------------------------------------------------------------------
65; Resets drive swapping variables to defaults (no swapping).
66;
67; DriveXlate_Reset
68; Parameters:
69; DS: RAMVARS segment
70; Returns:
71; Nothing
72; Corrupts registers:
[181]73; Nothing
[128]74;--------------------------------------------------------------------
[3]75ALIGN JUMP_ALIGN
76DriveXlate_Reset:
[248]77 mov WORD [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap], 8000h
[3]78 ret
79
80
81;--------------------------------------------------------------------
82; Stores drive to be swapped.
83;
84; DriveXlate_SetDriveToSwap
85; Parameters:
86; DL: Drive to swap to 00h or 80h
87; DS: RAMVARS segment
88; Returns:
89; Nothing
90; Corrupts registers:
91; Nothing
[128]92;--------------------------------------------------------------------
[3]93ALIGN JUMP_ALIGN
94DriveXlate_SetDriveToSwap:
[128]95 test dl, dl ; Floppy drive?
96 js SHORT .SetHardDiskToSwap
[99]97.SetFloppyDriveToSwap:
[3]98 mov [RAMVARS.xlateVars+XLATEVARS.bFDSwap], dl
99 ret
100ALIGN JUMP_ALIGN
[99]101.SetHardDiskToSwap:
[3]102 mov [RAMVARS.xlateVars+XLATEVARS.bHDSwap], dl
103 ret
Note: See TracBrowser for help on using the repository browser.