Changeset 88 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenu.asm
- Timestamp:
- Jan 27, 2011, 8:14:13 AM (14 years ago)
- google:author:
- aitotat
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenu.asm
r84 r88 1 ; File name : BootMenu.asm 2 ; Project name : IDE BIOS 3 ; Created date : 25.3.2010 4 ; Last update : 14.1.2011 5 ; Author : Tomi Tilli, 6 ; : Krister Nordvall (optimizations) 1 ; Project name : XTIDE Universal BIOS 7 2 ; Description : Displays Boot Menu. 8 3 … … 28 23 call DriveXlate_Reset 29 24 call BootMenuPrint_TheBottomOfScreen 30 call BootMenu_GetMenuitemCount31 mov di, BootMenuEvent_Handler32 25 call BootMenu_Enter ; Get selected menuitem index to CX 33 26 call BootMenuPrint_ClearScreen 34 test cx, cx ; -1 if nothing selected (ESC pressed) 35 js SHORT BootMenu_DisplayAndReturnSelection 36 call BootMenu_CheckAndConvertHotkeyToMenuitem 37 jc SHORT .SetDriveTranslationForHotkey 27 cmp cx, BYTE NO_ITEM_SELECTED 28 je SHORT BootMenu_DisplayAndReturnSelection 38 29 jmp BootMenu_ConvertMenuitemToDriveOrFunction 39 ALIGN JUMP_ALIGN 40 .SetDriveTranslationForHotkey: 41 call BootMenu_ConvertMenuitemToDriveOrFunction 42 call DriveXlate_SetDriveToSwap 43 clc 30 31 32 ;-------------------------------------------------------------------- 33 ; Enters Boot Menu or submenu. 34 ; 35 ; BootMenu_Enter 36 ; Parameters: 37 ; Nothing 38 ; Returns: 39 ; CX: Index of selected item or NO_ITEM_SELECTED 40 ; Corrupts registers: 41 ; BX, DI 42 ;-------------------------------------------------------------------- 43 ALIGN JUMP_ALIGN 44 BootMenu_Enter: 45 mov bx, BootMenuEvent_Handler 46 CALL_MENU_LIBRARY DisplayWithHandlerInBXandUserDataInDXAX 47 xchg cx, ax 44 48 ret 45 49 … … 48 52 ; Returns number of menuitems in Boot Menu. 49 53 ; 50 ; BootMenu_GetMenuitemCount 54 ; BootMenu_GetMenuitemCountToCX 51 55 ; Parameters: 52 56 ; DS: RAMVARS segment … … 57 61 ;-------------------------------------------------------------------- 58 62 ALIGN JUMP_ALIGN 59 BootMenu_GetMenuitemCount :63 BootMenu_GetMenuitemCountToCX: 60 64 call RamVars_GetHardDiskCountFromBDAtoCX 61 65 xchg ax, cx … … 89 93 90 94 ;-------------------------------------------------------------------- 91 ; Enters Boot Menu or submenu. 92 ; 93 ; BootMenu_Enter 94 ; Parameters: 95 ; CX: Number of menuitems in menu 96 ; DS:SI: User specific far pointer 97 ; CS:DI: Pointer to menu event handler function 98 ; Returns: 99 ; CX: Index of last pointed Menuitem (not necessary selected with ENTER) 100 ; FFFFh if cancelled with ESC 101 ; Corrupts registers: 102 ; AX, BX, DX 103 ;-------------------------------------------------------------------- 104 ALIGN JUMP_ALIGN 105 BootMenu_Enter: 106 call BootMenu_GetSelectionTimeout 107 call BootMenu_GetSize 108 MIN_U ah, [cs:ROMVARS.bBootMnuH] ; Limit to max height 109 jmp Menu_Enter 110 111 ;-------------------------------------------------------------------- 112 ; Returns Boot Menu selection timeout in milliseconds. 113 ; 114 ; BootMenu_GetSelectionTimeout 115 ; Parameters: 116 ; Nothing 117 ; Returns: 118 ; DX: Selection timeout in millisecs 119 ; Corrupts registers: 120 ; AX 121 ;-------------------------------------------------------------------- 122 ALIGN JUMP_ALIGN 123 BootMenu_GetSelectionTimeout: 124 mov ax, 1000 ; Seconds to milliseconds 125 eMOVZX dx, BYTE [cs:ROMVARS.bBootDelay] 126 mul dx ; AX = seconds * milliseconds_per_second 127 xchg ax, dx ; DX = Timeout in millisecs 128 ret 129 130 ;-------------------------------------------------------------------- 131 ; Returns Boot Menu size. 132 ; 133 ; BootMenu_GetSize 134 ; Parameters: 135 ; Nothing 136 ; Returns: 137 ; AL: Menu width with borders included (characters) 138 ; AH: Menu height with borders included (characters) 139 ; BL: Title line count 140 ; BH: Info line count 141 ; Corrupts registers: 142 ; Nothing 143 ;-------------------------------------------------------------------- 144 ALIGN JUMP_ALIGN 145 BootMenu_GetSize: 146 mov al, MENU_WIDTH_IN_CHARS 147 mov ah, cl ; Copy menuitem count to AH 148 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_DRVNFO 149 jz SHORT .GetHeightWithoutInfoArea 150 ;.GetHeightWithInfoArea: 151 add ah, MENU_HEIGHT_IN_CHARS_WITH_INFO 152 mov bx, (MENU_INFO_LINE_CNT<<8) | MENU_TITLE_LINE_CNT 153 ret 154 ALIGN JUMP_ALIGN 155 .GetHeightWithoutInfoArea: 156 add ah, MENU_HEIGHT_IN_CHARS_WITHOUT_INFO 157 mov bx, MENU_TITLE_LINE_CNT 158 ret 159 160 161 ;-------------------------------------------------------------------- 162 ; Checks if hotkey has been pressed on Boot Menu. 163 ; If it has been, it will be converted to menuitem index. 164 ; 165 ; BootMenu_CheckAndConvertHotkeyToMenuitem 166 ; Parameters: 167 ; CX: Menuitem index (if no hotkey) 168 ; Returns: 169 ; CX: Menuitem index 170 ; CF: Set if hotkey has been pressed 171 ; Cleared if no hotkey selection 172 ; Corrupts registers: 173 ; AX 174 ;-------------------------------------------------------------------- 175 ALIGN JUMP_ALIGN 176 BootMenu_CheckAndConvertHotkeyToMenuitem: 177 push es 178 LOAD_BDA_SEGMENT_TO es, ax ; Zero AX 179 xchg al, [es:BOOTVARS.bMenuHotkey] ; Load and clear hotkey 180 test al, al ; No hotkey? (clears CF) 181 jz SHORT .Return 182 call BootMenu_ConvertHotkeyToMenuitem 183 stc 184 ALIGN JUMP_ALIGN 185 .Return: 186 pop es 187 ret 95 ; BootMenu_GetHeightToALwithItemCountInCL 96 ; Parameters: 97 ; CL: Number of menuitems 98 ; Returns: 99 ; AH: Boot menu height 100 ; Corrupts registers: 101 ; AL, CL, DI 102 ;-------------------------------------------------------------------- 103 ALIGN JUMP_ALIGN 104 BootMenu_GetHeightToAHwithItemCountInCL: 105 add cl, BOOT_MENU_HEIGHT_WITHOUT_ITEMS 106 CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH 107 MIN_U ah, cl 108 ret 109 188 110 189 111 ;--------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.