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

Last change on this file since 322 was 322, checked in by krille_n_@…, 12 years ago

Changes to XTIDE Universal BIOS:

  • Commented out the FS and GS segment registers from INTPACK since we never touch them anyway.
  • Minor changes to improve speed in the Int13h handler.
  • Changed Prepare_ByValidatingSectorsInALforOldInt13h so it really doesn't corrupt anything.
  • Changed the makefile so 'make strings' now works even if StringsCompressed.asm is missing or empty.
File size: 2.2 KB
Line 
1; Project name  :   XTIDE Universal BIOS
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
22
23    mov     ah, 80h                 ; Assume hard disk
24    mov     al, [RAMVARS.xlateVars+XLATEVARS.bHDSwap]
25    test    dl, ah                  ; Hard disk?
26    jnz     SHORT .SwapDrive        ; If so, jump to swap
27    mov     al, [RAMVARS.xlateVars+XLATEVARS.bFDSwap]
28    cbw
29
30ALIGN JUMP_ALIGN
31.SwapDrive:
32    cmp     ah, dl                  ; Swap DL from 00h/80h to xxh?
33    je      SHORT .SwapToXXhInAL
34    cmp     al, dl                  ; Swap DL from xxh to 00h/80h?
35    jne     SHORT .RestoreAXandReturn
36    mov     al, ah
37ALIGN JUMP_ALIGN
38.SwapToXXhInAL:
39    mov     dl, al
40ALIGN JUMP_ALIGN
41.RestoreAXandReturn:
42    xchg    ax, di                  ; Restore AX
43ALIGN JUMP_ALIGN, ret
44.Return:
45    ret
46
47
48;--------------------------------------------------------------------
49; Resets drive swapping variables to defaults (no swapping).
50;
51; DriveXlate_Reset
52;   Parameters:
53;       DS:     RAMVARS segment
54;   Returns:
55;       Nothing
56;   Corrupts registers:
57;       Nothing
58;--------------------------------------------------------------------
59ALIGN JUMP_ALIGN
60DriveXlate_Reset:
61    mov     WORD [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap], 8000h
62    ret
63
64
65;--------------------------------------------------------------------
66; Stores drive to be swapped.
67;
68; DriveXlate_SetDriveToSwap
69;   Parameters:
70;       DL:     Drive to swap to 00h or 80h
71;       DS:     RAMVARS segment
72;   Returns:
73;       Nothing
74;   Corrupts registers:
75;       Nothing
76;--------------------------------------------------------------------
77ALIGN JUMP_ALIGN
78DriveXlate_SetDriveToSwap:
79    test    dl, dl              ; Floppy drive?
80    js      SHORT .SetHardDiskToSwap
81.SetFloppyDriveToSwap:
82    mov     [RAMVARS.xlateVars+XLATEVARS.bFDSwap], dl
83    ret
84ALIGN JUMP_ALIGN
85.SetHardDiskToSwap:
86    mov     [RAMVARS.xlateVars+XLATEVARS.bHDSwap], dl
87    ret
Note: See TracBrowser for help on using the repository browser.