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

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

Changes to XTIDE Universal BIOS:

  • Booting with hotkey now properly maintains FD and HD drive swappings (it is now again possible to boot with both translated FD and HD drives).
  • Had to change file orders so compressed strings could be included after recent changes to Assembly Library size.
File size: 3.0 KB
RevLine 
[99]1; Project name : XTIDE Universal BIOS
[3]2; Description : Functions for swapping drive letters.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; DriveXlate_ToOrBack
9; Parameters:
10; DL: Drive number to be possibly translated
11; DS: RAMVARS segment
12; Returns:
13; DL: Translated drive number
14; Corrupts registers:
15; DI
16;--------------------------------------------------------------------
17ALIGN JUMP_ALIGN
18DriveXlate_ToOrBack:
19 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_DRVXLAT
20 jz SHORT .Return ; Return if translation disabled
21 xchg di, ax ; Backup AX
[148]22 call SwapFloppyDriveOrHardDisk
[3]23 xchg ax, di
24.Return:
25 ret
26
27
28;--------------------------------------------------------------------
[148]29; SwapFloppyDriveOrHardDisk
[3]30; Parameters:
31; DL: Drive number to be possibly swapped
32; DS: RAMVARS segment
33; Returns:
34; DL: Translated drive number
35; Corrupts registers:
36; AX
37;--------------------------------------------------------------------
38ALIGN JUMP_ALIGN
[148]39SwapFloppyDriveOrHardDisk:
[126]40 mov ah, 80h ; Assume hard disk
[3]41 mov al, BYTE [RAMVARS.xlateVars+XLATEVARS.bHDSwap]
[126]42 test dl, ah ; Hard disk?
43 jnz SHORT SwapDrive ; If so, jump to swap
44 mov al, BYTE [RAMVARS.xlateVars+XLATEVARS.bFDSwap]
45 cbw
[99]46 ; Fall to SwapDrive
[3]47
48;--------------------------------------------------------------------
[99]49; SwapDrive
[3]50; Parameters:
51; AL: Drive number to swap to 00h/80h
52; AH: 00h/80h to be swapped to stored drive number
53; DL: Drive number to be possibly swapped
54; Returns:
55; DL: Translated drive number
56; Corrupts registers:
[181]57; AL
[3]58;--------------------------------------------------------------------
[126]59ALIGN JUMP_ALIGN
[99]60SwapDrive:
[3]61 cmp ah, dl ; Swap DL from 00h/80h to xxh?
62 je SHORT .SwapToXXhInAL
63 cmp al, dl ; Swap DL from xxh to 00h/80h?
[181]64 jne SHORT .Return
65 mov al, ah
[3]66ALIGN JUMP_ALIGN
67.SwapToXXhInAL:
68 mov dl, al
[181]69ALIGN JUMP_ALIGN, ret
70.Return:
[3]71 ret
72
73
74;--------------------------------------------------------------------
75; Resets drive swapping variables to defaults (no swapping).
76;
77; DriveXlate_Reset
78; Parameters:
79; DS: RAMVARS segment
80; Returns:
81; Nothing
82; Corrupts registers:
[181]83; Nothing
[128]84;--------------------------------------------------------------------
[3]85ALIGN JUMP_ALIGN
86DriveXlate_Reset:
[248]87 mov WORD [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap], 8000h
[3]88 ret
89
90
91;--------------------------------------------------------------------
92; Stores drive to be swapped.
93;
94; DriveXlate_SetDriveToSwap
95; Parameters:
96; DL: Drive to swap to 00h or 80h
97; DS: RAMVARS segment
98; Returns:
99; Nothing
100; Corrupts registers:
101; Nothing
[128]102;--------------------------------------------------------------------
[3]103ALIGN JUMP_ALIGN
104DriveXlate_SetDriveToSwap:
[128]105 test dl, dl ; Floppy drive?
106 js SHORT .SetHardDiskToSwap
[99]107.SetFloppyDriveToSwap:
[3]108 mov [RAMVARS.xlateVars+XLATEVARS.bFDSwap], dl
109 ret
110ALIGN JUMP_ALIGN
[99]111.SetHardDiskToSwap:
[3]112 mov [RAMVARS.xlateVars+XLATEVARS.bHDSwap], dl
113 ret
Note: See TracBrowser for help on using the repository browser.