Changeset 492 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Menus/DriveXlate.asm


Ignore:
Timestamp:
Dec 21, 2012, 1:01:55 AM (11 years ago)
Author:
gregli@…
google:author:
gregli@hotmail.com
Message:

Removed the dependency between MODULE_BOOT_MENU and MODULE_HOTKEYS. With these changes, 0, 1, or 2 of them can be included in a build. This change also means that the hotkeys don't work while the menu is up. But the most important hotkey there was for Rom Boot, and that has been added to the menu as a choice proper. Lots of changes across the board in the hotkeys code - even if we eventually back this change out (becaue, for example we want hotkeys to work in the menu) we should probably start from this base and add that functionality back in, as these changes results in approximately 120 bytes of savings and includes new functionality, such as the Rom Boot menu item and the Com Detect hotkey.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Menus/DriveXlate.asm

    r397 r492  
    2020; Section containing code
    2121SECTION .text
     22
     23;--------------------------------------------------------------------
     24; DriveXlate_ConvertDriveLetterInDLtoDriveNumber
     25;   Parameters:
     26;       DS:     RAMVARS segment
     27;       DL:     Drive letter ('A'...)
     28;   Returns:
     29;       DL:     Drive number (0xh for Floppy Drives, 8xh for Hard Drives)
     30;   Corrupts registers:
     31;       AX
     32;--------------------------------------------------------------------
     33DriveXlate_ConvertDriveLetterInDLtoDriveNumber:
     34    call    DriveXlate_GetLetterForFirstHardDriveToAX
     35    cmp     dl, al
     36    jb      SHORT .ConvertLetterInDLtoFloppyDriveNumber
     37
     38    ; Convert letter in DL to Hard Drive number
     39    sub     dl, al
     40    or      dl, 80h
     41    ret
     42
     43.ConvertLetterInDLtoFloppyDriveNumber:
     44    sub     dl, DEFAULT_FLOPPY_DRIVE_LETTER
     45    ret
     46
     47%ifdef MODULE_HOTKEY
     48%if HotkeyBar_FallThroughTo_DriveXlate_ConvertDriveLetterInDLtoDriveNumber <> DriveXlate_ConvertDriveLetterInDLtoDriveNumber
     49    %error "DriveXlate_ConvertDriveLetterInDLtoDriveNumber must be at the top of DriveXlate.asm, and that file must immediately follow HotKeys.asm"
     50%endif     
     51%endif
     52       
     53;--------------------------------------------------------------------
     54; DriveXlate_ConvertDriveNumberFromDLtoDriveLetter
     55;   Parameters:
     56;       DL:     Drive number (0xh for Floppy Drives, 8xh for Hard Drives)
     57;       DS:     RAMVARS Segment
     58;   Returns:
     59;       DL:     Drive letter ('A'...)
     60;       CF:     Set if Hard Drive
     61;               Clear if Floppy Drive
     62;   Corrupts registers:
     63;       AX
     64;--------------------------------------------------------------------
     65DriveXlate_ConvertDriveNumberFromDLtoDriveLetter:
     66    test    dl, dl
     67    jns     SHORT .GetDefaultFloppyDrive
     68
     69    ; Store default hard drive to boot from
     70    call    DriveXlate_GetLetterForFirstHardDriveToAX
     71    sub     dl, 80h
     72    add     dl, al
     73    stc
     74    ret
     75
     76.GetDefaultFloppyDrive:
     77    add     dl, DEFAULT_FLOPPY_DRIVE_LETTER     ; Clears CF
     78    ret
     79
     80
     81;--------------------------------------------------------------------
     82; Returns letter for first hard disk. Usually it will be 'C' but it
     83; can be higher if more than two floppy drives are found.
     84;
     85; DriveXlate_GetLetterForFirstHardDriveToAX
     86;   Parameters:
     87;       DS:     RAMVARS segment
     88;   Returns:
     89;       AX:     Upper case letter for first hard disk
     90;   Corrupts registers:
     91;       Nothing
     92;--------------------------------------------------------------------
     93DriveXlate_GetLetterForFirstHardDriveToAX:
     94    call    FloppyDrive_GetCountToAX
     95    add     al, DEFAULT_FLOPPY_DRIVE_LETTER
     96    MAX_U   al, DEFAULT_HARD_DRIVE_LETTER
     97    ret
     98               
    2299
    23100;--------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.