Changeset 492 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu
- Timestamp:
- Dec 21, 2012, 1:01:55 AM (12 years ago)
- google:author:
- gregli@hotmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenu.asm
r392 r492 24 24 ; Displays Boot Menu and returns Drive or Function number. 25 25 ; 26 ; BootMenu_DisplayAnd ReturnSelectionInDX26 ; BootMenu_DisplayAndStoreSelection 27 27 ; Parameters: 28 28 ; DS: RAMVARS segment 29 29 ; Returns: 30 ; Nothing, selected drive is converted to hotkey 30 ; DL: Drive number selected 31 ; CF: Set if selected item is an actual drive, DL is valid 32 ; Clear if selected item is Rom Boot, DL is invalid 31 33 ; Corrupts registers: 32 34 ; All General Purpose Registers 33 35 ;-------------------------------------------------------------------- 34 BootMenu_DisplayAnd StoreSelectionAsHotkey:36 BootMenu_DisplayAndReturnDriveInDLRomBootClearCF: 35 37 call DriveXlate_Reset 36 38 … … 38 40 CALL_MENU_LIBRARY DisplayWithHandlerInBXandUserDataInDXAX 39 41 42 xchg cx, ax 43 40 44 ; Clear Boot Menu from screen 41 45 mov ax, ' ' | (MONO_NORMAL<<8) 42 46 CALL_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH 43 ret44 47 48 ; fall through to BootMenu_GetDriveToDXforMenuitemInCX 45 49 46 50 ;-------------------------------------------------------------------- … … 52 56 ; DS: RAMVARS segment 53 57 ; CF: Set: There is a selected menu item, DL is valid 54 ; Clear: The re is no selected menu item, DL is not valid58 ; Clear: The item selected is Rom Boot, DL is not valid 55 59 ; Corrupts registers: 56 ; AX, DI 60 ; AX, BX, DI 61 ; 62 ; NOTE: We can't use the menu structure in here, as we are falling through 63 ; through from BootMenu_DisplayAndReturnDriveInDLRomBootClearCF when the 64 ; menu structure has already been destroyed. 57 65 ;-------------------------------------------------------------------- 58 66 BootMenu_GetDriveToDXforMenuitemInCX: 59 cmp cl, NO_ITEM_HIGHLIGHTED60 je SHORT .ReturnFloppyDriveInDX ; Clear CF if branch taken61 62 67 mov dl, cl ; Copy menuitem index to DX 63 68 call FloppyDrive_GetCountToAX … … 65 70 jb SHORT .ReturnFloppyDriveInDX ; Set CF if branch taken 66 71 or al, 80h ; Or 80h into AL before the sub 67 ; to cause CF to be set after 68 ; and result has high order bit set 72 ; shorter instruction than or'ing it in afterward 69 73 sub dl, al ; Remove floppy drives from index 70 74 call RamVars_GetHardDiskCountFromBDAtoAX 75 or al, 80h ; Or 80h into AL before the sub 76 cmp dl, al ; Set CF if hard disk 77 ; Clear CF if last item, beyond hard disk list, which indicates ROM boot 71 78 .ReturnFloppyDriveInDX: 72 79 ret -
trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuEvent.asm
r489 r492 21 21 SECTION .text 22 22 23 24 ;--------------------------------------------------------------------25 ; GetDefaultMenuitemToDL26 ; Parameters:27 ; DL: Drive number28 ; ES: Ptr to BDA (zero)29 ; Returns:30 ; DL: Menuitem index (assuming drive is available)31 ; Corrupts registers:32 ; AX, DH33 ;--------------------------------------------------------------------34 GetDefaultMenuitemToDX:35 mov dx, [es:BOOTVARS.hotkeyVars+HOTKEYVARS.wHddAndFddLetters]36 test BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bFlags], FLG_HOTKEY_HD_FIRST37 eCMOVZ dl, dh38 call IsDriveDLinSystem39 jnc SHORT BootMenuEvent_Handler.DoNotSetDefaultMenuitem40 call DriveXlate_SetDriveToSwap41 ; Fall to GetMenuitemToDXforDriveInDL42 43 44 23 ;-------------------------------------------------------------------- 45 24 ; GetMenuitemToDXforDriveInDL … … 63 42 64 43 ;-------------------------------------------------------------------- 65 ; IsDriveDLinSystem66 ; Parameters:67 ; DL: Drive number68 ; DS: RAMVARS segment69 ; Returns:70 ; CF: Set if drive number is valid71 ; Clear if drive is not present in system72 ; Corrupts registers:73 ; AX, CX74 ;--------------------------------------------------------------------75 IsDriveDLinSystem:76 test dl, dl ; Floppy drive?77 jns SHORT .IsFloppyDriveInSystem78 call RamVars_GetHardDiskCountFromBDAtoAX ; Hard Disk count to AX79 or al, 80h ; Set Hard Disk bit to AX80 jmp SHORT .CompareDriveNumberToDriveCount81 .IsFloppyDriveInSystem:82 call FloppyDrive_GetCountToAX83 .CompareDriveNumberToDriveCount:84 cmp dl, al ; Set CF when DL is smaller85 ret86 87 88 ;--------------------------------------------------------------------89 44 ; BootMenuEvent_Handler 90 45 ; Common parameters for all events: … … 115 70 MENUEVENT_ItemHighlightedFromCX equ (EventItemHighlightedFromCX - FirstEvent) 116 71 MENUEVENT_ItemSelectedFromCX equ (EventItemSelectedFromCX - FirstEvent) 117 MENUEVENT_KeyStrokeInAX equ (EventKeyStrokeInAX - FirstEvent)118 72 MENUEVENT_RefreshTitle equ (BootMenuPrint_TitleStrings - FirstEvent) 119 73 MENUEVENT_RefreshInformation equ (BootMenuPrint_RefreshInformation - FirstEvent) … … 164 118 EventInitializeMenuinitFromSSBP: 165 119 ; Store default Menuitem (=default drive to boot from) 166 call GetDefaultMenuitemToDX120 xor dx, dx 167 121 mov [bp+MENUINIT.wHighlightedItem], dx 168 122 … … 172 126 call FloppyDrive_GetCountToAX 173 127 add ax, cx 128 inc ax ; extra entry for ROM Boot item 174 129 mov [bp+MENUINIT.wItems], ax 175 130 176 131 ; Store menu size 177 132 mov WORD [bp+MENUINIT.wTitleAndInfoLines], BOOT_MENU_TITLE_AND_INFO_LINES … … 180 135 xchg cx, ax 181 136 CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH 182 sub ah, MENU_SCREEN_BOTTOM_LINES*2 ; Leave space for Hotkey Bar183 137 MIN_U ah, cl 184 138 mov [bp+MENUINIT.bHeight], ah … … 207 161 EventItemHighlightedFromCX: 208 162 push cx 163 call DriveXlate_Reset 209 164 call BootMenu_GetDriveToDXforMenuitemInCX 210 call DriveXlate_Reset165 jnc .noDriveSwap 211 166 call DriveXlate_SetDriveToSwap 212 213 ; We need to generate keystroke so selection two drives is possible. 214 ; The secondary boot drive is selected by highlighting it using menu keys 215 ; and the primary boot drive is selected by pressing drive letter hotkey. 216 call BootVars_StoreHotkeyForDriveNumberInDL 217 call RedrawHotkeyBarFromInsideMenuEventHandler 218 167 .noDriveSwap: 168 219 169 ; Redraw changes in drive numbers 220 170 xor ax, ax ; Update first floppy drive (for translated drive number) … … 230 180 ret 231 181 232 233 ;-------------------------------------------------------------------- 234 ; EventKeyStrokeInAX 235 ; Parameters 236 ; AL: ASCII character for the key 237 ; AH: Keyboard library scan code for the key 238 ; DS: Ptr to RAMVARS 239 ; ES: Ptr to BDA (zero) 240 ; SS:BP: Menu library handle 241 ; Returns: 242 ; CF: Set if event processed 243 ; Cleared if event not processed 244 ; Corrupts registers: 245 ; Does not matter 246 ;-------------------------------------------------------------------- 247 EventKeyStrokeInAX: 248 cmp ah, BOOT_MENU_HOTKEY_SCANCODE 249 je SHORT BootMenuEvent_Completed ; Ignore Boot Menu hotkey 250 call HotkeyBar_StoreHotkeyToBootvarsIfValidKeystrokeInAX 251 jnc SHORT BootMenuEvent_Completed 252 253 ; Hotkey is now stored to BOOTVARS and menu can be closed 254 jmp SHORT CloseBootMenu 255 256 182 257 183 ;-------------------------------------------------------------------- 258 184 ; EventItemSelectedFromCX … … 269 195 ;-------------------------------------------------------------------- 270 196 EventItemSelectedFromCX: 271 call BootMenu_GetDriveToDXforMenuitemInCX272 jnc SHORT BootMenuEvent_Completed ; No menuitem selected273 274 ; Convert selected drive to hotkey keystroke275 call HotkeyBar_StoreHotkeyToBootvarsForDriveLetterInDL276 197 ; Fall to CloseBootMenu 277 198 … … 290 211 call DriveXlate_Reset 291 212 CALL_MENU_LIBRARY Close 292 ; Fall to RedrawHotkeyBarFromInsideMenuEventHandler293 294 295 ;--------------------------------------------------------------------296 ; RedrawHotkeyBarFromInsideMenuEventHandler297 ; Parameters298 ; DS: RAMVARS segment299 ; ES: BDA segment (zero)300 ; Returns:301 ; Nothing302 ; Corrupts registers:303 ; AX, BX, CX, DX, SI, DI304 ;--------------------------------------------------------------------305 RedrawHotkeyBarFromInsideMenuEventHandler:306 mov al, MONO_NORMAL307 CALL_DISPLAY_LIBRARY SetCharacterAttributeFromAL308 309 mov bl, ATTRIBUTES_ARE_USED310 mov ax, TELETYPE_OUTPUT_WITH_ATTRIBUTE311 CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInBL312 call HotkeyBar_DrawToTopOfScreen313 213 ; Fall to BootMenuEvent_Completed 314 214 315 215 316 216 ;-------------------------------------------------------------------- 317 217 ; BootMenuEvent_Completed -
trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuPrint.asm
r491 r492 33 33 ;-------------------------------------------------------------------- 34 34 BootMenuPrint_RefreshItem: 35 call BootMenu_GetDriveToDXforMenuitemInCX36 jnc BootMenuEvent_Completed ; if no menu item selected, out we go37 38 35 push bp 39 36 mov bp, sp 37 38 call BootMenu_GetDriveToDXforMenuitemInCX 39 mov si, g_szRomBootDash ; Standard "Rom Boot" but with a "-" at the front 40 mov al, 20h ; The space between "Rom" and "Boot" 41 jnc .ROMBoot ; display "Rom Boot" option for last entry 40 42 41 43 call FindDPT_ForDriveNumberInDL … … 57 59 mov ax, dx ; preserve DL for the floppy drive letter addition 58 60 call DriveXlate_ToOrBack 61 62 test dl, 0f0h ; if there is a character in the upper nibble 63 jnz .noSpace 64 dec si ; backup a character to a leading space 65 .noSpace: 66 59 67 push dx ; translated drive number 60 68 push bx ; sub string 61 69 add al, 'A' ; floppy drive letter (we always push this although 62 push ax ; the hard disks don't ever use it, but it does no harm) 70 ; the hard disks don't ever use it, but it does no harm) 71 .ROMBoot: 72 push ax 63 73 64 74 jmp SHORT BootMenuPrint_RefreshInformation.FormatRelay … … 95 105 96 106 call BootMenu_GetDriveToDXforMenuitemInCX 97 jnc BootMenuEvent_Completed ; if no menu selection, abort107 jnc BootMenuEvent_Completed ; nothing to display if "Rom Boot" option 98 108 99 109 push bp
Note:
See TracChangeset
for help on using the changeset viewer.