Changeset 88 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Boot
- Timestamp:
- Jan 27, 2011, 8:14:13 AM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Boot
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Boot/BootInfo.asm
r83 r88 1 1 ; File name : BootInfo.asm 2 ; Project name : IDE BIOS 3 ; Created date : 16.3.2010 4 ; Last update : 6.1.2011 5 ; Author : Tomi Tilli, 6 ; : Krister Nordvall (optimizations) 2 ; Project name : XTIDE Universal BIOS 7 3 ; Description : Functions for generating and accessing drive 8 4 ; information to be displayed on boot menu. … … 145 141 loop BootInfo_StoreAtaString ; Loop while words left 146 142 .Return: 147 mov al, STOP ; End string with STOP143 xor ax, ax ; Terminate string with NULL 148 144 stosb 149 145 ret -
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 ;-------------------------------------------------------------------- -
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuEvent.asm
r28 r88 1 ; File name : BootMenuEvent.asm 2 ; Project name : IDE BIOS 3 ; Created date : 26.3.2010 4 ; Last update : 1.4.2010 5 ; Author : Tomi Tilli 1 ; Project name : XTIDE Universal BIOS 6 2 ; Description : Boot Menu event handler for menu library callbacks. 7 3 … … 9 5 SECTION .text 10 6 7 struc ITEM_TYPE_REFRESH 8 .HardDisk resb 2 9 .FloppyDrive resb 2 10 .SpecialFunction resb 2 11 endstruc 12 13 11 14 ;-------------------------------------------------------------------- 12 ; Boot Menu event handler.13 ;14 15 ; BootMenuEvent_Handler 15 ; Parameters: 16 ; BX: Callback event 17 ; CX: Menuitem index (usually index of selected Menuitem) 18 ; DX: Event parameter (event specific) 19 ; SS:BP: Ptr to MENUVARS 20 ; Returns: 21 ; AH: Event specific or unused. Set to 0 if unused. 22 ; AL: 1=Event processed 23 ; 0=Event not processed (default action if any) 16 ; Common parameters for all events: 17 ; BX: Menu event (anything from MENUEVENT struct) 18 ; SS:BP: Menu library handle 19 ; Common return values for all events: 20 ; CF: Set if event processed 21 ; Cleared if event not processed 24 22 ; Corrupts registers: 25 ; BX, CX, DX23 ; All 26 24 ;-------------------------------------------------------------------- 27 25 ALIGN JUMP_ALIGN 28 26 BootMenuEvent_Handler: 29 push es 30 push ds 31 push di 32 push si 27 cmp bx, MENUEVENT.RefreshItemFromCX ; Above last supported item? 28 ja SHORT .EventNotHandled 29 jmp [bx+.rgfnEventSpecificHandlers] 30 .EventNotHandled: 31 .IdleProcessing: 32 clc 33 ret 33 34 34 xor ax, ax ; Event not processed35 cmp bx, BYTE EVNT_MNU_GETDEF ; Event in jump table?36 ja SHORT .Return37 shl bx, 138 call [cs:bx+.rgwEventJmp]39 .Return:40 pop si41 pop di42 pop ds43 pop es44 ret45 35 ALIGN WORD_ALIGN 46 .rgwEventJmp: 47 dw BootMenuEvent_Exit ; 0, EVNT_MNU_EXIT (Menu will quit) 48 dw BootMenuEvent_EventItemSelectionChanged ; 1, EVNT_MMU_SELCHG (Menuitem selection changed (with arrows)) 49 dw BootMenuEvent_EventItemSelected ; 2, EVNT_MNU_SELSET (Menuitem selected (with Enter)) 50 dw BootMenuEvent_EventKeyPressed ; 3, EVNT_MNU_KEY (Keyboard key pressed) 51 dw BootMenuEvent_EventMenuDraw ; 4, EVNT_MNU_UPD (Menu needs to be updated) 52 dw BootMenuEvent_EventGetDefaultMenuitem ; 5, EVNT_MNU_GETDEF (Request menuitem to be selected by default) 36 .rgfnEventSpecificHandlers: 37 dw .InitializeMenuinitFromDSSI 38 dw .EventCompleted 39 dw .IdleProcessing 40 dw .ItemHighlightedFromCX 41 dw .ItemSelectedFromCX 42 dw .KeyStrokeInAX 43 dw BootMenuPrint_TitleStrings 44 dw .RefreshInformation 45 dw .RefreshItemFromCX 53 46 54 47 55 ;-------------------------------------------------------------------- 56 ; Boot Menu event handler. 57 ; Handles Menu Exit notification (EVNT_MNU_EXIT). 58 ; 59 ; BootMenuEvent_Exit 60 ; Parameters: 61 ; SS:BP: Ptr to MENUVARS 62 ; Returns: 63 ; AH: 1 to cancel exit 64 ; 0 to allow menu exit 65 ; AL: 1 = Event processed 66 ; Corrupts registers: 67 ; Nothing 68 ;-------------------------------------------------------------------- 48 ; Parameters: 49 ; DS:SI: Ptr to MENUINIT struct to initialize 50 ; Returns: 51 ; DS:SI: Ptr to initialized MENUINIT struct 69 52 ALIGN JUMP_ALIGN 70 BootMenuEvent_Exit: 71 mov ax, 1 ; Event handled 53 .InitializeMenuinitFromDSSI: 54 push ds 55 call RamVars_GetSegmentToDS 56 call .GetDefaultMenuitemToDX 57 call BootMenu_GetMenuitemCountToCX 58 pop ds 59 mov [si+MENUINIT.wItems], cx 60 mov [si+MENUINIT.wHighlightedItem], dx 61 mov WORD [si+MENUINIT.wTitleAndInfoLines], BOOT_MENU_TITLE_AND_INFO_LINES 62 mov BYTE [si+MENUINIT.bWidth], BOOT_MENU_WIDTH 63 call BootMenu_GetHeightToAHwithItemCountInCL 64 mov [si+MENUINIT.bHeight], ah 65 stc 72 66 ret 73 67 74 75 ;--------------------------------------------------------------------76 ; Boot Menu event handler.77 ; Handles Menuitem Selection Changed notification (EVNT_MMU_SELCHG).78 ;79 ; BootMenuEvent_EventItemSelectionChanged80 ; Parameters:81 ; CX: Index of selected Menuitem82 ; SS:BP: Ptr to MENUVARS83 ; Returns:84 ; AX: 1 = Event processed85 ; Corrupts registers:86 ; BX, CX, DX, DI87 ;--------------------------------------------------------------------88 68 ALIGN JUMP_ALIGN 89 BootMenuEvent_EventItemSelectionChanged: 90 call RamVars_GetSegmentToDS 91 call DriveXlate_Reset 92 call BootMenu_ConvertMenuitemToDriveOrFunction 93 jc SHORT BootMenuEvent_UpdateAllMenuitems ; Selection changed to a function 94 call DriveXlate_SetDriveToSwap 95 ; Fall to BootMenuEvent_UpdateAllMenuitems 96 97 ;-------------------------------------------------------------------- 98 ; Redraws all menuitems. 99 ; 100 ; BootMenuEvent_UpdateAllMenuitems 101 ; Parameters: 102 ; SS:BP: Ptr to MENUVARS 103 ; Returns: 104 ; AX: 1 = Event processed 105 ; Corrupts registers: 106 ; BX, CX, DX 107 ;-------------------------------------------------------------------- 108 ALIGN JUMP_ALIGN 109 BootMenuEvent_UpdateAllMenuitems: 110 mov cx, -1 ; Update all items 111 mov dl, MFL_UPD_ITEM | MFL_UPD_NFO | MFL_UPD_NOCLEAR 112 call Menu_Invalidate 113 mov ax, 1 ; Event handled 114 ret 115 116 117 ;-------------------------------------------------------------------- 118 ; Boot Menu event handler. 119 ; Handles Menuitem Selected notification (EVNT_MNU_SELSET). 120 ; 121 ; BootMenuEvent_EventItemSelected 122 ; Parameters: 123 ; CX: Index of selected Menuitem 124 ; SS:BP: Ptr to MENUVARS 125 ; Returns: 126 ; AX: 1 = Event processed 127 ; Corrupts registers: 128 ; BX, CX, DX 129 ;-------------------------------------------------------------------- 130 ALIGN JUMP_ALIGN 131 BootMenuEvent_EventItemSelected: 132 call Menu_Exit ; Exit from menu 133 mov ax, 1 ; Event handled 134 ret 135 136 137 ;-------------------------------------------------------------------- 138 ; Boot Menu event handler. 139 ; Handles Key pressed notification (EVNT_MNU_KEY). 140 ; 141 ; BootMenuEvent_EventKeyPressed 142 ; Parameters: 143 ; CX: Index of currently selected Menuitem 144 ; DL: ASCII character 145 ; DH: BIOS Scan Code 146 ; SS:BP: Ptr to MENUVARS 147 ; Returns: 148 ; AX: 1 = Event processed 149 ; Corrupts registers: 150 ; BX, CX, DX, DS 151 ;-------------------------------------------------------------------- 152 ALIGN JUMP_ALIGN 153 BootMenuEvent_EventKeyPressed: 154 mov al, dl ; Copy ASCII char to AL 155 sub al, 'a'-'A' ; To upper case character 156 cmp al, 'A' ; First possible drive letter? 157 jb SHORT .Return ; If below, return 158 cmp al, 'Z' ; Last possible drive letter? 159 ja SHORT .Return ; If above, return 160 LOAD_BDA_SEGMENT_TO ds, dx 161 mov [BOOTVARS.bMenuHotkey], al 162 jmp SHORT BootMenuEvent_EventItemSelected 163 .Return: 164 mov ax, 1 165 ret 166 167 168 ;-------------------------------------------------------------------- 169 ; Boot Menu event handler. 170 ; Handles Menu Update notification (EVNT_MNU_UPD). 171 ; 172 ; BootMenuEvent_EventMenuDraw 173 ; Parameters: 174 ; CX: Index of Menuitem to update (if MFL_UPD_ITEM set) 175 ; DL: Update flag (only one): 176 ; MFL_UPD_TITLE Update Menu Title string(s) 177 ; MFL_UPD_NFO Update Menu Info string(s) 178 ; MFL_UPD_ITEM Update Menuitem string 179 ; SS:BP: Ptr to MENUVARS 180 ; Returns: 181 ; AX: Was event processed 182 ; Corrupts registers: 183 ; BX, CX, DX, SI, DI, DS 184 ;-------------------------------------------------------------------- 185 ALIGN JUMP_ALIGN 186 BootMenuEvent_EventMenuDraw: 187 test dl, MFL_UPD_ITEM ; Need to update Menuitem? 188 jnz SHORT BootMenuEvent_DrawMenuitem 189 test dl, MFL_UPD_NFO ; Need to update Info String(s)? 190 jnz SHORT BootMenuEvent_DrawInfo 191 test dl, MFL_UPD_TITLE ; Need to update Title String(s)? 192 jnz SHORT BootMenuEvent_DrawTitle 193 xor ax, ax 194 ret 195 196 ;-------------------------------------------------------------------- 197 ; Draws Menuitem string. Cursor is set to a menuitem location. 198 ; 199 ; BootMenuEvent_DrawMenuitem 200 ; Parameters: 201 ; CX: Index of Menuitem to draw 202 ; SS:BP: Ptr to MENUVARS 203 ; Returns: 204 ; AX: Was event processed 205 ; Corrupts registers: 206 ; BX, CX, DX, SI, DI, DS, ES 207 ;-------------------------------------------------------------------- 208 ALIGN JUMP_ALIGN 209 BootMenuEvent_DrawMenuitem: 210 call RamVars_GetSegmentToDS 211 call BootMenu_ConvertMenuitemToDriveOrFunction 212 jc SHORT .DrawFunctionItem 213 call BootMenuPrint_TranslatedDriveNumber 214 test dl, 80h ; Floppy drive? 215 jz SHORT .DrawFloppyDriveItem 216 jmp BootMenuPrint_HardDiskMenuitem 217 ALIGN JUMP_ALIGN 218 .DrawFunctionItem: 219 jmp BootMenuPrint_FunctionMenuitem 220 ALIGN JUMP_ALIGN 221 .DrawFloppyDriveItem: 222 jmp BootMenuPrint_FloppyMenuitem 223 224 ;-------------------------------------------------------------------- 225 ; Draws information strings. Cursor is set to a first information line. 226 ; 227 ; BootMenuEvent_DrawInfo 228 ; Parameters: 229 ; CX: Index of selected menuitem 230 ; SS:BP: Ptr to MENUVARS 231 ; Returns: 232 ; AX: Was event processed 233 ; Corrupts registers: 234 ; BX, CX, DX, SI, DI, DS, ES 235 ;-------------------------------------------------------------------- 236 ALIGN JUMP_ALIGN 237 BootMenuEvent_DrawInfo: 238 call RamVars_GetSegmentToDS 239 call BootMenu_ConvertMenuitemToDriveOrFunction 240 jc SHORT .DrawFunctionInfo 241 test dl, 80h ; Floppy drive? 242 jz SHORT .DrawFloppyDriveInfo 243 jmp BootMenuPrint_HardDiskMenuitemInformation 244 ALIGN JUMP_ALIGN 245 .DrawFunctionInfo: 246 jmp BootMenuPrint_FunctionMenuitemInformation 247 ALIGN JUMP_ALIGN 248 .DrawFloppyDriveInfo: 249 jmp BootMenuPrint_FloppyMenuitemInformation 250 251 ;-------------------------------------------------------------------- 252 ; Draws title strings. Cursor is set to a first title line. 253 ; 254 ; BootMenuEvent_DrawTitle 255 ; Parameters: 256 ; SS:BP: Ptr to MENUVARS 257 ; Returns: 258 ; AX: Was event processed 259 ; Corrupts registers: 260 ; CX, DX, SI 261 ;-------------------------------------------------------------------- 262 ALIGN JUMP_ALIGN 263 BootMenuEvent_DrawTitle: 264 jmp BootMenuPrint_TitleStrings 265 266 267 ;-------------------------------------------------------------------- 268 ; Boot Menu event handler. 269 ; Handles Get Default Menuitem notification (EVNT_MNU_GETDEF). 270 ; 271 ; BootMenuEvent_EventGetDefaultMenuitem 272 ; Parameters: 273 ; SS:BP: Ptr to MENUVARS 274 ; Returns: 275 ; AX: Was event processed 276 ; CX: Index of menuitem to set selected 277 ; Corrupts registers: 278 ; BX, CX, DX, DI, DS 279 ;-------------------------------------------------------------------- 280 ALIGN JUMP_ALIGN 281 BootMenuEvent_EventGetDefaultMenuitem: 282 call RamVars_GetSegmentToDS 69 .GetDefaultMenuitemToDX: 283 70 mov dl, [cs:ROMVARS.bBootDrv] ; Default boot drive 284 71 call BootMenu_IsDriveInSystem … … 286 73 call DriveXlate_SetDriveToSwap 287 74 call BootMenu_ConvertDriveToMenuitem 288 mov ax, 175 mov dx, cx 289 76 ret 290 77 ALIGN JUMP_ALIGN 291 78 .DoNotSetDefaultMenuitem: 292 xor ax, ax79 xor dx, dx ; Whatever appears first on boot menu 293 80 ret 81 82 83 ; Parameters: 84 ; CX: Index of new highlighted item 85 ; DX: Index of previously highlighted item or NO_ITEM_HIGHLIGHTED 86 ALIGN JUMP_ALIGN 87 .ItemHighlightedFromCX: 88 push cx 89 push dx 90 call RamVars_GetSegmentToDS 91 call DriveXlate_Reset 92 call BootMenu_ConvertMenuitemToDriveOrFunction 93 jc SHORT .UpdatePreviousAndNewMenuitem ; Selection changed to a function 94 call DriveXlate_SetDriveToSwap 95 96 .UpdatePreviousAndNewMenuitem: 97 pop ax ; Update previous item 98 CALL_MENU_LIBRARY RefreshItemFromAX 99 pop ax ; Update new item 100 CALL_MENU_LIBRARY RefreshItemFromAX 101 CALL_MENU_LIBRARY RefreshInformation 102 stc 103 ret 104 105 106 ; Parameters: 107 ; AL: ASCII character for the key 108 ; AH: Keyboard library scan code for the key 109 ALIGN JUMP_ALIGN 110 .KeyStrokeInAX: 111 xor ah, ah ; ASCII drive letter now in AX 112 call BootMenu_ConvertHotkeyToMenuitem 113 cmp cx, [bp+MENUINIT.wItems] 114 jae SHORT .EventNotHandled ; Invalid key 115 xchg ax, cx 116 CALL_MENU_LIBRARY HighlightItemFromAX 117 ; Fall to .ItemSelectedFromCX 118 119 120 ; Parameters: 121 ; CX: Index of selected item 122 ALIGN JUMP_ALIGN 123 .ItemSelectedFromCX: 124 CALL_MENU_LIBRARY Close 125 .EventCompleted: 126 stc 127 ret 128 129 130 ; Parameters: 131 ; CX: Index of item to refresh 132 ; Cursor has been positioned to the beginning of item line 133 ALIGN JUMP_ALIGN 134 .RefreshItemFromCX: 135 mov bx, .rgwItemTypeRefresh 136 jmp SHORT .RefreshItemOrInformationWithJumpTableInCSBX 137 138 139 ; Parameters: 140 ; CX: Index of highlighted item 141 ; Cursor has been positioned to the beginning of first line 142 ALIGN JUMP_ALIGN 143 .RefreshInformation: 144 mov bx, .rgwInformationItemTypeRefresh 145 ; Fall to .RefreshItemOrInformationWithJumpTableInCSBX 146 147 ;-------------------------------------------------------------------- 148 ; RefreshItemOrInformationWithJumpTableInCSBX 149 ; Parameters: 150 ; CX: Index of selected menuitem 151 ; CS:BX: Ptr to ITEM_TYPE_REFRESH jump table 152 ; Returns: 153 ; CF: set since event processed 154 ;-------------------------------------------------------------------- 155 ALIGN JUMP_ALIGN 156 .RefreshItemOrInformationWithJumpTableInCSBX: 157 cmp cl, NO_ITEM_HIGHLIGHTED 158 je SHORT .EventCompleted 159 160 call RamVars_GetSegmentToDS 161 call BootMenu_ConvertMenuitemToDriveOrFunction 162 jc SHORT .DrawFunction 163 test dl, 80h ; Floppy drive? 164 jz SHORT .DrawFloppyDrive 165 jmp [cs:bx+ITEM_TYPE_REFRESH.HardDisk] 166 ALIGN JUMP_ALIGN 167 .DrawFunction: 168 jmp [cs:bx+ITEM_TYPE_REFRESH.SpecialFunction] 169 ALIGN JUMP_ALIGN 170 .DrawFloppyDrive: 171 jmp [cs:bx+ITEM_TYPE_REFRESH.FloppyDrive] 172 173 ; Jump tables for .RefreshItemOrInformationWithJumpTableInCSBX 174 ALIGN WORD_ALIGN 175 .rgwItemTypeRefresh: 176 istruc ITEM_TYPE_REFRESH 177 at ITEM_TYPE_REFRESH.HardDisk, dw BootMenuPrint_HardDiskMenuitem 178 at ITEM_TYPE_REFRESH.FloppyDrive, dw BootMenuPrint_FloppyMenuitem 179 at ITEM_TYPE_REFRESH.SpecialFunction, dw BootMenuPrint_FunctionMenuitem 180 iend 181 .rgwInformationItemTypeRefresh: 182 istruc ITEM_TYPE_REFRESH 183 at ITEM_TYPE_REFRESH.HardDisk, dw BootMenuPrint_HardDiskMenuitemInformation 184 at ITEM_TYPE_REFRESH.FloppyDrive, dw BootMenuPrint_FloppyMenuitemInformation 185 at ITEM_TYPE_REFRESH.SpecialFunction, dw BootMenuPrint_ClearInformationArea 186 iend -
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm
r84 r88 1 ; File name : BootMenuPrint.asm 2 ; Project name : IDE BIOS 3 ; Created date : 26.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 : Functions for printing boot menu strings. 8 3 9 4 ; Section containing code 10 5 SECTION .text 6 7 ;-------------------------------------------------------------------- 8 ; Prints Boot Menu title strings. 9 ; 10 ; BootMenuPrint_TitleStrings 11 ; Parameters: 12 ; Nothing 13 ; Returns: 14 ; CF: Set since menu event handled 15 ; Corrupts registers: 16 ; AX, SI, DI 17 ;-------------------------------------------------------------------- 18 ALIGN JUMP_ALIGN 19 BootMenuPrint_TitleStrings: 20 mov si, ROMVARS.szTitle 21 call PrintNullTerminatedStringFromCSSIandSetCF 22 call BootMenuPrint_Newline 23 mov si, ROMVARS.szVersion 24 jmp PrintNullTerminatedStringFromCSSIandSetCF 25 26 27 ;-------------------------------------------------------------------- 28 ; BootMenuPrint_Newline 29 ; Parameters: 30 ; Nothing 31 ; Returns: 32 ; Nothing 33 ; Corrupts registers: 34 ; AX, DI 35 ;-------------------------------------------------------------------- 36 ALIGN JUMP_ALIGN 37 BootMenuPrint_Newline: 38 CALL_DISPLAY_LIBRARY PrintNewlineCharacters 39 ret 40 41 42 ;-------------------------------------------------------------------- 43 ; Prints Floppy Drive hotkey string. 44 ; 45 ; BootMenuPrint_FloppyHotkeyString 46 ; Parameters: 47 ; BL: Number of floppy drives in system 48 ; Returns: 49 ; Nothing 50 ; Corrupts registers: 51 ; AX, SI 52 ;-------------------------------------------------------------------- 53 ALIGN JUMP_ALIGN 54 BootMenuPrint_FloppyHotkeyString: 55 test bl, bl ; Any floppy drives? 56 jz SHORT NoFloppyDrivesOrHardDisksToPrint 57 push bp 58 59 mov bp, sp 60 mov al, 'A' 61 push ax ; 'A' 62 dec ax 63 add al, bl 64 push ax ; Last floppy drive letter 65 ePUSH_T ax, g_szFDD 66 ePUSH_T ax, g_szHDD 67 jmp SHORT PrintHotkeyString 68 69 ;-------------------------------------------------------------------- 70 ; Prints Hard Disk hotkey string. 71 ; 72 ; BootMenuPrint_FloppyHotkeyString 73 ; Parameters: 74 ; BH: Number of hard disks in system 75 ; Returns: 76 ; Nothing 77 ; Corrupts registers: 78 ; AX, CX, SI 79 ;-------------------------------------------------------------------- 80 ALIGN JUMP_ALIGN 81 BootMenuPrint_HardDiskHotkeyString: 82 test bh, bh ; Any hard disks? 83 jz SHORT NoFloppyDrivesOrHardDisksToPrint 84 push bp 85 86 mov bp, sp 87 call BootMenu_GetLetterForFirstHardDisk 88 push cx ; First hard disk letter 89 dec cx 90 add cl, bh 91 push cx ; Last hard disk letter 92 ePUSH_T ax, g_szHDD 93 ePUSH_T ax, g_szFDD 94 ; Fall to PrintHotkeyString 95 96 ALIGN JUMP_ALIGN 97 PrintHotkeyString: 98 mov si, g_szBottomScrn 99 jmp BootMenuPrint_FormatCSSIfromParamsInSSBP 100 NoFloppyDrivesOrHardDisksToPrint: 101 ret 102 103 ;-------------------------------------------------------------------- 104 ; BootMenuPrint_ClearScreen 105 ; Parameters: 106 ; Nothing 107 ; Returns: 108 ; Nothing 109 ; Corrupts registers: 110 ; AX 111 ;-------------------------------------------------------------------- 112 ALIGN JUMP_ALIGN 113 BootMenuPrint_ClearScreen: 114 push di 115 mov ax, ' ' | (MONO_NORMAL<<8) 116 CALL_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH 117 pop di 118 ret 119 120 121 ;-------------------------------------------------------------------- 122 ; Translates and prints drive number. 123 ; 124 ; BootMenuPrint_TranslatedDriveNumber 125 ; Parameters: 126 ; DL: Untranslated drive number 127 ; DS: RAMVARS segment 128 ; Returns: 129 ; Nothing 130 ; Corrupts registers: 131 ; AX, DI 132 ;-------------------------------------------------------------------- 133 ALIGN JUMP_ALIGN 134 BootMenuPrint_TranslatedDriveNumber: 135 push dx 136 push bx 137 138 call DriveXlate_ToOrBack 139 eMOVZX ax, dl ; Drive number to AL 140 CALL_DISPLAY_LIBRARY PrintWordFromAXwithBaseInBX 141 mov al, ' ' ; Print space 142 CALL_DISPLAY_LIBRARY PrintCharacterFromAL 143 144 pop bx 145 pop dx 146 ret 147 148 149 ;-------------------------------------------------------------------- 150 ; BootMenuPrint_FloppyMenuitem 151 ; Parameters: 152 ; DL: Untranslated Floppy Drive number 153 ; Returns: 154 ; Nothing 155 ; Corrupts registers: 156 ; AX, DX, SI 157 ;-------------------------------------------------------------------- 158 ALIGN JUMP_ALIGN 159 BootMenuPrint_FloppyMenuitem: 160 push bp 161 162 mov bp, sp 163 mov si, g_szFDLetter 164 ePUSH_T ax, g_szFloppyDrv 165 add dl, 'A' 166 push dx ; Drive letter 167 jmp BootMenuPrint_FormatCSSIfromParamsInSSBP 168 169 170 ;-------------------------------------------------------------------- 171 ; BootMenuPrint_HardDiskMenuitem 172 ; Parameters: 173 ; DL: Untranslated Hard Disk number 174 ; DS: RAMVARS segment 175 ; Returns: 176 ; CF: Set since menu event handled 177 ; Corrupts registers: 178 ; AX, BX, SI, DI 179 ;-------------------------------------------------------------------- 180 ALIGN JUMP_ALIGN 181 BootMenuPrint_HardDiskMenuitem: 182 call FindDPT_ForDriveNumber ; DS:DI to point DPT 183 jnc SHORT .HardDiskMenuitemForForeignDrive 184 ; Fall to .HardDiskMenuitemForOurDrive 185 186 ;-------------------------------------------------------------------- 187 ; .HardDiskMenuitemForOurDrive 188 ; Parameters: 189 ; DL: Untranslated Hard Disk number 190 ; DS: RAMVARS segment 191 ; Returns: 192 ; CF: Set since menu event handled 193 ; Corrupts registers: 194 ; AX, BX, SI, DI 195 ;-------------------------------------------------------------------- 196 ;ALIGN JUMP_ALIGN 197 .HardDiskMenuitemForOurDrive: 198 call BootInfo_GetOffsetToBX 199 lea si, [bx+BOOTNFO.szDrvName] 200 xor bx, bx ; BDA segment 201 CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromBXSI 202 stc 203 ret 204 205 ;-------------------------------------------------------------------- 206 ; BootMenuPrint_HardDiskMenuitemForForeignDrive 207 ; Parameters: 208 ; DL: Untranslated Hard Disk number 209 ; DS: RAMVARS segment 210 ; Returns: 211 ; CF: Set since menu event handled 212 ; Corrupts registers: 213 ; AX, SI, DI 214 ;-------------------------------------------------------------------- 215 ALIGN JUMP_ALIGN 216 .HardDiskMenuitemForForeignDrive: 217 mov si, g_szforeignHD 218 jmp PrintNullTerminatedStringFromCSSIandSetCF 219 220 221 ;-------------------------------------------------------------------- 222 ; BootMenuPrint_FunctionMenuitem 223 ; Parameters: 224 ; DX: Function ID 225 ; Returns: 226 ; CF: Set if menu event was handled successfully 227 ; Corrupts registers: 228 ; AX, DX, SI, DI 229 ;-------------------------------------------------------------------- 230 ALIGN JUMP_ALIGN 231 BootMenuPrint_FunctionMenuitem: 232 test dx, dx ; ID_BOOTFUNC_ROMBOOT 233 jz SHORT .PrintRomBootMenuitem 234 ret 235 236 ALIGN JUMP_ALIGN 237 .PrintRomBootMenuitem: 238 mov si, g_szRomBoot 239 jmp PrintNullTerminatedStringFromCSSIandSetCF 240 241 242 ;-------------------------------------------------------------------- 243 ; BootMenuPrint_FloppyMenuitemInformation 244 ; Parameters: 245 ; DL: Untranslated Floppy Drive number 246 ; DS: RAMVARS segment 247 ; Returns: 248 ; CF: Set since menu event was handled successfully 249 ; Corrupts registers: 250 ; AX, BX, CX, DX, SI, DI, ES 251 ;-------------------------------------------------------------------- 252 ALIGN JUMP_ALIGN 253 BootMenuPrint_FloppyMenuitemInformation: 254 call BootMenuPrint_ClearInformationArea 255 call FloppyDrive_GetType ; Get Floppy Drive type to BX 256 test bx, bx ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD) 257 jz SHORT .PrintXTFloppyType 258 cmp bl, FLOPPY_TYPE_35_ED 259 ja SHORT .PrintUnknownFloppyType 260 jmp SHORT .PrintKnownFloppyType 261 262 ;-------------------------------------------------------------------- 263 ; .PrintXTFloppyType 264 ; Parameters: 265 ; Nothing 266 ; Returns: 267 ; CF: Set since menu event was handled successfully 268 ; Corrupts registers: 269 ; AX, SI, DI 270 ;-------------------------------------------------------------------- 271 ALIGN JUMP_ALIGN 272 .PrintXTFloppyType: 273 push bp 274 mov si, g_szFddSizeOr 275 jmp SHORT .FormatXTorUnknownTypeFloppyDrive 276 277 ;-------------------------------------------------------------------- 278 ; .PrintUnknownFloppyType 279 ; Parameters: 280 ; Nothing 281 ; Returns: 282 ; CF: Set since menu event was handled successfully 283 ; Corrupts registers: 284 ; AX, SI, DI 285 ;-------------------------------------------------------------------- 286 ALIGN JUMP_ALIGN 287 .PrintUnknownFloppyType: 288 push bp 289 mov si, g_szFddUnknown 290 .FormatXTorUnknownTypeFloppyDrive: 291 mov bp, sp 292 ePUSH_T ax, g_szCapacity 293 jmp BootMenuPrint_FormatCSSIfromParamsInSSBP 294 295 ;-------------------------------------------------------------------- 296 ; .PrintKnownFloppyType 297 ; Parameters: 298 ; BX: Floppy drive type 299 ; Returns: 300 ; CF: Set since menu event was handled successfully 301 ; Corrupts registers: 302 ; AX, BX, SI, DI 303 ;-------------------------------------------------------------------- 304 ALIGN JUMP_ALIGN 305 .PrintKnownFloppyType: 306 push bp 307 308 mov bp, sp 309 mov si, g_szFddSize 310 ePUSH_T ax, g_szCapacity 311 dec bx ; Cannot be 0 (FLOPPY_TYPE_525_OR_35_DD) 312 shl bx, 1 ; Shift for WORD lookup 313 mov ax, [cs:bx+.rgwPhysicalSize] 314 push ax ; '5' or '3' 315 mov al, ah 316 push ax ; '1/4' or '1/2' 317 push WORD [cs:bx+.rgwCapacity] 318 jmp SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP 319 320 ALIGN WORD_ALIGN 321 .rgwCapacity: 322 dw 360 323 dw 1200 324 dw 720 325 dw 1440 326 dw 2880 327 dw 2880 328 .rgwPhysicalSize: 329 db '5', 172 ; 1, FLOPPY_TYPE_525_DD 330 db '5', 172 ; 2, FLOPPY_TYPE_525_HD 331 db '3', 171 ; 3, FLOPPY_TYPE_35_DD 332 db '3', 171 ; 4, FLOPPY_TYPE_35_HD 333 db '3', 171 ; 5, 3.5" ED on some BIOSes 334 db '3', 171 ; 6, FLOPPY_TYPE_35_ED 335 336 337 ;-------------------------------------------------------------------- 338 ; Prints Hard Disk Menuitem information strings. 339 ; 340 ; BootMenuPrint_HardDiskMenuitemInformation 341 ; Parameters: 342 ; DL: Untranslated Hard Disk number 343 ; DS: RAMVARS segment 344 ; Returns: 345 ; CF: Set since menu event was handled successfully 346 ; Corrupts registers: 347 ; BX, CX, DX, SI, DI, ES 348 ;-------------------------------------------------------------------- 349 ALIGN JUMP_ALIGN 350 BootMenuPrint_HardDiskMenuitemInformation: 351 call FindDPT_ForDriveNumber ; DS:DI to point DPT 352 jnc SHORT .HardDiskMenuitemInfoForForeignDrive 353 call .HardDiskMenuitemInfoSizeForOurDrive 354 jmp BootMenuPrintCfg_ForOurDrive 355 356 ;-------------------------------------------------------------------- 357 ; .HardDiskMenuitemInfoForForeignDrive 358 ; Parameters: 359 ; DL: Untranslated Hard Disk number 360 ; DS: RAMVARS segment 361 ; Returns: 362 ; CF: Set since menu event was handled successfully 363 ; Corrupts registers: 364 ; AX, BX, CX, DX, SI, DI 365 ;-------------------------------------------------------------------- 366 ALIGN JUMP_ALIGN 367 .HardDiskMenuitemInfoForForeignDrive: 368 push bp 369 mov bp, sp 370 ePUSH_T ax, g_szCapacity 371 372 call DriveXlate_ToOrBack 373 call HCapacity_GetSectorCountFromForeignAH08h 374 call ConvertSectorCountInBXDXAXtoSizeAndPushForFormat 375 376 mov si, g_szSizeSingle 377 jmp SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP 378 379 ;-------------------------------------------------------------------- 380 ; .HardDiskMenuitemInfoSizeForOurDrive 381 ; Parameters: 382 ; DL: Untranslated Hard Disk number 383 ; DS:DI: Ptr to DPT 384 ; Returns: 385 ; Nothing 386 ; Corrupts registers: 387 ; AX, BX, CX, DX, SI, ES 388 ;-------------------------------------------------------------------- 389 ALIGN JUMP_ALIGN 390 .HardDiskMenuitemInfoSizeForOurDrive: 391 push bp 392 mov bp, sp 393 ePUSH_T ax, g_szCapacity 394 395 ; Get and push L-CHS size 396 call HCapacity_GetSectorCountFromOurAH08h 397 call ConvertSectorCountInBXDXAXtoSizeAndPushForFormat 398 399 ; Get and push total LBA size 400 call BootInfo_GetTotalSectorCount 401 call ConvertSectorCountInBXDXAXtoSizeAndPushForFormat 402 403 mov si, g_szSizeDual 404 ; Fall to BootMenuPrint_FormatCSSIfromParamsInSSBP 405 406 407 ;-------------------------------------------------------------------- 408 ; BootMenuPrint_FormatCSSIfromParamsInSSBP 409 ; Parameters: 410 ; CS:SI: Ptr to string to format 411 ; SS:BP: Ptr to format parameters 412 ; Returns: 413 ; BP: Popped from stack 414 ; Corrupts registers: 415 ; AX 416 ;-------------------------------------------------------------------- 417 ALIGN JUMP_ALIGN 418 BootMenuPrint_FormatCSSIfromParamsInSSBP: 419 push di 420 CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI 421 stc ; Successfull return from menu event 422 pop di 423 pop bp 424 ret 425 426 427 ;-------------------------------------------------------------------- 428 ; ConvertSectorCountInBXDXAXtoSizeAndPushForFormat 429 ; Parameters: 430 ; BX:DX:AX: Sector count 431 ; Returns: 432 ; Size in stack 433 ; Corrupts registers: 434 ; AX, BX, CX, DX, SI 435 ;-------------------------------------------------------------------- 436 ALIGN JUMP_ALIGN 437 ConvertSectorCountInBXDXAXtoSizeAndPushForFormat: 438 pop si ; Pop return address 439 call Size_ConvertSectorCountInBXDXAXtoKiB 440 mov cx, BYTE_MULTIPLES.kiB 441 call Size_GetSizeToAXAndCharToDLfromBXDXAXwithMagnitudeInCX 442 push ax ; Size in magnitude 443 push cx ; Tenths 444 push dx ; Magnitude character 445 jmp si 446 447 448 ;-------------------------------------------------------------------- 449 ; PrintNullTerminatedStringFromCSSIandSetCF 450 ; Parameters: 451 ; CS:SI: Ptr to NULL terminated string to print 452 ; Returns: 453 ; CF: Set since menu event was handled successfully 454 ; Corrupts registers: 455 ; AX, DI 456 ;-------------------------------------------------------------------- 457 ALIGN JUMP_ALIGN 458 PrintNullTerminatedStringFromCSSIandSetCF: 459 CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI 460 stc 461 ret 462 463 464 ;-------------------------------------------------------------------- 465 ; BootMenuPrint_ClearInformationArea 466 ; Parameters: 467 ; Nothing 468 ; Returns: 469 ; CF: Set 470 ; Corrupts registers: 471 ; AX, DI 472 ;-------------------------------------------------------------------- 473 ALIGN JUMP_ALIGN 474 BootMenuPrint_ClearInformationArea: 475 CALL_MENU_LIBRARY ClearInformationArea 476 stc 477 ret 478 11 479 12 480 ;-------------------------------------------------------------------- … … 70 538 ALIGN JUMP_ALIGN 71 539 BootMenuPrint_SetCursorPosition: 72 push bx 73 call MenuCrsr_SetCursor 74 pop bx 75 ret 76 77 78 ;-------------------------------------------------------------------- 79 ; Prints Floppy Drive hotkey string. 80 ; 81 ; BootMenuPrint_FloppyHotkeyString 82 ; Parameters: 83 ; BL: Number of floppy drives in system 84 ; Returns: 85 ; Nothing 86 ; Corrupts registers: 87 ; AX, CX, DX, SI 88 ;-------------------------------------------------------------------- 89 ALIGN JUMP_ALIGN 90 BootMenuPrint_FloppyHotkeyString: 91 test bl, bl ; Any floppy drives? 92 jz .Return 93 ePUSH_T ax, g_szHDD 94 ePUSH_T ax, g_szFDD 95 mov ax, 'A'-1 96 add al, bl ; Last Floppy Drive letter 97 push ax 98 ePUSH_T ax, 'A' 99 jmp SHORT BootMenuPrint_HotkeyString 100 .Return: 101 ret 102 103 ;-------------------------------------------------------------------- 104 ; Prints Floppy Drive or Hard Disk hotkey string when 105 ; parameters are pushed to stack. 106 ; 107 ; BootMenuPrint_HotkeyString 108 ; Parameters: 109 ; Stack: String formatting parameters 110 ; Returns: 111 ; Nothing 112 ; Corrupts registers: 113 ; AX, CX, DX, SI 114 ;-------------------------------------------------------------------- 115 ALIGN JUMP_ALIGN 116 BootMenuPrint_HotkeyString: 117 mov si, g_szBottomScrn 118 mov dh, 8 ; 8 bytes pushed to stack 119 jmp PrintString_JumpToFormat 120 121 122 ;-------------------------------------------------------------------- 123 ; Prints Hard Disk hotkey string. 124 ; 125 ; BootMenuPrint_FloppyHotkeyString 126 ; Parameters: 127 ; BH: Number of hard disks in system 128 ; Returns: 129 ; Nothing 130 ; Corrupts registers: 131 ; AX, CX, DX, SI 132 ;-------------------------------------------------------------------- 133 ALIGN JUMP_ALIGN 134 BootMenuPrint_HardDiskHotkeyString: 135 test bh, bh ; Any hard disks? 136 jz .Return 137 ePUSH_T ax, g_szFDD 138 ePUSH_T ax, g_szHDD 139 call BootMenu_GetLetterForFirstHardDisk 140 eMOVZX ax, bh ; Hard disk count to AX 141 add ax, cx ; One past last hard disk letter 142 dec ax ; Last hard disk letter 143 push ax 144 push cx 145 jmp SHORT BootMenuPrint_HotkeyString 146 .Return: 147 ret 148 149 150 ;-------------------------------------------------------------------- 151 ; Clears screen. 152 ; 153 ; BootMenuPrint_ClearScreen 154 ; Parameters: 155 ; Nothing 156 ; Returns: 157 ; Nothing 158 ; Corrupts registers: 159 ; AX, BX, DX 160 ;-------------------------------------------------------------------- 161 ALIGN JUMP_ALIGN 162 BootMenuPrint_ClearScreen: 163 push cx 164 call MenuDraw_ClrScr 165 pop cx 166 ret 167 168 169 ;-------------------------------------------------------------------- 170 ; Translates and prints drive number. 171 ; 172 ; BootMenuPrint_TranslatedDriveNumber 173 ; Parameters: 174 ; DL: Untranslated drive number 175 ; DS: RAMVARS segment 176 ; Returns: 177 ; Nothing 178 ; Corrupts registers: 179 ; AX, DI 180 ;-------------------------------------------------------------------- 181 ALIGN JUMP_ALIGN 182 BootMenuPrint_TranslatedDriveNumber: 183 push dx 184 call DriveXlate_ToOrBack 185 mov al, dl ; Drive number to AL 186 call Print_IntHexB 187 mov dl, ' ' 188 PRINT_CHAR ; Print space 189 pop dx 190 ret 191 192 193 ;-------------------------------------------------------------------- 194 ; Prints Floppy Drive Menuitem string. 195 ; 196 ; BootMenuPrint_FloppyMenuitem 197 ; Parameters: 198 ; DL: Untranslated Floppy Drive number 199 ; Returns: 200 ; AX: 1 if drive number was valid 201 ; 0 if drive number was invalid 202 ; Corrupts registers: 203 ; CX, DX, SI 204 ;-------------------------------------------------------------------- 205 ALIGN JUMP_ALIGN 206 BootMenuPrint_FloppyMenuitem: 207 ePUSH_T ax, BootMenuPrint_HardDiskPrinted ; Return address 208 add dl, 'A' ; Number to letter 209 push dx 210 ePUSH_T ax, g_szFloppyDrv 211 mov si, g_szFDLetter 212 mov dh, 4 ; 4 bytes pushed to stack 213 jmp PrintString_JumpToFormat 214 215 216 ;-------------------------------------------------------------------- 217 ; Prints Hard Disk Menuitem string. 218 ; 219 ; BootMenuPrint_HardDiskMenuitem 220 ; Parameters: 221 ; DL: Untranslated Hard Disk number 222 ; DS: RAMVARS segment 223 ; Returns: 224 ; AX: 1 if drive number was valid 225 ; 0 if drive number was invalid 226 ; Corrupts registers: 227 ; CX, DX, SI, ES 228 ;-------------------------------------------------------------------- 229 ALIGN JUMP_ALIGN 230 BootMenuPrint_HardDiskMenuitem: 231 ePUSH_T ax, BootMenuPrint_HardDiskPrinted 232 call FindDPT_ForDriveNumber ; DS:DI to point DPT 233 jnc SHORT BootMenuPrint_HardDiskMenuitemForForeignDrive 234 jmp SHORT BootMenuPrint_HardDiskMenuitemForOurDrive 235 ALIGN JUMP_ALIGN 236 BootMenuPrint_HardDiskPrinted: 237 mov ax, 1 238 ret 239 240 ;-------------------------------------------------------------------- 241 ; Prints Hard Disk Menuitem string for drive that is handled by 242 ; some another BIOS. 243 ; 244 ; BootMenuPrint_HardDiskMenuitemForForeignDrive 245 ; Parameters: 246 ; DL: Untranslated Hard Disk number 247 ; DS: RAMVARS segment 248 ; Returns: 249 ; AX: 1 if drive number was valid 250 ; 0 if drive number was invalid 251 ; Corrupts registers: 252 ; CX, DX, SI 253 ;-------------------------------------------------------------------- 254 ALIGN JUMP_ALIGN 255 BootMenuPrint_HardDiskMenuitemForForeignDrive: 256 mov si, g_szforeignHD 257 jmp PrintString_FromCS 258 259 ;-------------------------------------------------------------------- 260 ; Prints Hard Disk Menuitem string for drive that is handled by our BIOS. 261 ; 262 ; BootMenuPrint_HardDiskMenuitemForOurDrive 263 ; Parameters: 264 ; DL: Untranslated Hard Disk number 265 ; DS: RAMVARS segment 266 ; Returns: 267 ; AX: 1 if drive number was valid 268 ; 0 if drive number was invalid 269 ; Corrupts registers: 270 ; CX, DX, SI, ES 271 ;-------------------------------------------------------------------- 272 ALIGN JUMP_ALIGN 273 BootMenuPrint_HardDiskMenuitemForOurDrive: 274 call BootInfo_GetOffsetToBX 275 LOAD_BDA_SEGMENT_TO es, ax 276 lea si, [bx+BOOTNFO.szDrvName] 277 jmp PrintString_FromES 278 279 280 ;-------------------------------------------------------------------- 281 ; Prints Function Menuitem string. 282 ; 283 ; BootMenuPrint_FunctionMenuitem 284 ; Parameters: 285 ; DX: Function ID 286 ; Returns: 287 ; AX: 1 if function ID was valid 288 ; 0 if function ID was invalid 289 ; Corrupts registers: 290 ; DX, SI 291 ;-------------------------------------------------------------------- 292 ALIGN JUMP_ALIGN 293 BootMenuPrint_FunctionMenuitem: 294 test dx, dx ; ID_BOOTFUNC_ROMBOOT 295 jz SHORT .PrintRomBootMenuitem 296 xor ax, ax ; Event not processed 297 ret 298 299 ALIGN JUMP_ALIGN 300 .PrintRomBootMenuitem: 301 mov si, g_szRomBoot 302 ; Fall to .PrintAndReturn 303 304 ALIGN JUMP_ALIGN 305 .PrintAndReturn: 306 call PrintString_FromCS 307 mov ax, 1 ; Event processed 308 ret 309 310 311 ;-------------------------------------------------------------------- 312 ; Prints Floppy Drive Menuitem information strings. 313 ; 314 ; BootMenuPrint_FloppyMenuitemInformation 315 ; Parameters: 316 ; DL: Untranslated Floppy Drive number 317 ; DS: RAMVARS segment 318 ; Returns: 319 ; AX: 1 if drive number was valid 320 ; 0 if drive number was invalid 321 ; Corrupts registers: 322 ; BX, CX, DX, SI, DI, ES 323 ;-------------------------------------------------------------------- 324 ALIGN JUMP_ALIGN 325 BootMenuPrint_FloppyMenuitemInformation: 326 call FloppyDrive_GetType ; Get Floppy Drive type to BX 327 ePUSH_T ax, BootMenuPrint_ClearThreeInfoLines ; New return address 328 test bx, bx ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD) 329 jz SHORT BootMenuPrint_PrintXTFloppyType 330 cmp bl, FLOPPY_TYPE_35_ED 331 ja SHORT BootMenuPrint_PrintUnknownFloppyType 332 jmp SHORT BootMenuPrint_PrintKnownFloppyType 333 334 ;-------------------------------------------------------------------- 335 ; Prints Menuitem information string for two possible XT floppy drives. 336 ; 337 ; BootMenuPrint_PrintXTFloppyType 338 ; Parameters: 339 ; Nothing 340 ; Returns: 341 ; Nothing 342 ; Corrupts registers: 343 ; CX, DX, SI 344 ;-------------------------------------------------------------------- 345 ALIGN JUMP_ALIGN 346 BootMenuPrint_PrintXTFloppyType: 347 mov si, g_szFddSizeOr 348 jmp SHORT BootMenuPrint_FormatUnknownFloppyType 349 350 ;-------------------------------------------------------------------- 351 ; Prints Menuitem information string for unknown floppy drive type. 352 ; 353 ; BootMenuPrint_PrintUnknownFloppyType 354 ; Parameters: 355 ; Nothing 356 ; Returns: 357 ; Nothing 358 ; Corrupts registers: 359 ; CX, DX, SI 360 ;-------------------------------------------------------------------- 361 ALIGN JUMP_ALIGN 362 BootMenuPrint_PrintUnknownFloppyType: 363 mov si, g_szFddUnknown 364 BootMenuPrint_FormatUnknownFloppyType: 365 ePUSH_T ax, g_szCapacity 366 mov dh, 2 ; 2 bytes pushed to stack 367 jmp PrintString_JumpToFormat 368 369 ;-------------------------------------------------------------------- 370 ; Prints Menuitem information string for known floppy drive type. 371 ; 372 ; BootMenuPrint_PrintKnownFloppyType 373 ; Parameters: 374 ; BX: Floppy drive type 375 ; Returns: 376 ; Nothing 377 ; Corrupts registers: 378 ; CX, DX, SI 379 ;-------------------------------------------------------------------- 380 ALIGN JUMP_ALIGN 381 BootMenuPrint_PrintKnownFloppyType: 382 dec bx ; Cannot be 0 (FLOPPY_TYPE_525_OR_35_DD) 383 shl bx, 1 ; Shift for WORD lookup 384 push WORD [cs:bx+.rgwCapacity] 385 mov ax, [cs:bx+.rgwPhysicalSize] 386 push ax ; '1/4' or '1/2' 387 mov al, ah 388 push ax ; '5' or '3' 389 ePUSH_T ax, g_szCapacity 390 mov si, g_szFddSize 391 mov dh, 8 ; 8 bytes pushed to stack 392 jmp PrintString_JumpToFormat 393 ALIGN WORD_ALIGN 394 .rgwCapacity: 395 dw 360 396 dw 1200 397 dw 720 398 dw 1440 399 dw 2880 400 dw 2880 401 .rgwPhysicalSize: 402 db 172, '5' ; 1, FLOPPY_TYPE_525_DD 403 db 172, '5' ; 2, FLOPPY_TYPE_525_HD 404 db 171, '3' ; 3, FLOPPY_TYPE_35_DD 405 db 171, '3' ; 4, FLOPPY_TYPE_35_HD 406 db 171, '3' ; 5, 3.5" ED on some BIOSes 407 db 171, '3' ; 6, FLOPPY_TYPE_35_ED 408 409 410 ;-------------------------------------------------------------------- 411 ; Clears remaining characters from current information line 412 ; and clears following lines. 413 ; 414 ; BootMenuPrint_ClearThreeInfoLines 415 ; BootMenuPrint_ClearTwoInfoLines 416 ; BootMenuPrint_ClearOneInfoLine 417 ; Parameters: 418 ; Nothing 419 ; Returns: 420 ; AX: 1 421 ; Corrupts registers: 422 ; BX, DX 423 ;-------------------------------------------------------------------- 424 ALIGN JUMP_ALIGN 425 BootMenuPrint_ClearThreeInfoLines: 426 call MenuDraw_NewlineStrClrLn 427 ALIGN JUMP_ALIGN 428 BootMenuPrint_ClearTwoInfoLines: 429 call MenuDraw_NewlineStrClrLn 430 ALIGN JUMP_ALIGN 431 BootMenuPrint_ClearOneInfoLine: 432 call MenuDraw_NewlineStrClrLn 433 mov ax, 1 434 ret 435 436 437 ;-------------------------------------------------------------------- 438 ; Prints Hard Disk Menuitem information strings. 439 ; 440 ; BootMenuPrint_HardDiskMenuitemInformation 441 ; Parameters: 442 ; DL: Untranslated Hard Disk number 443 ; DS: RAMVARS segment 444 ; Returns: 445 ; AX: 1 if drive number was valid 446 ; 0 if drive number was invalid 447 ; Corrupts registers: 448 ; BX, CX, DX, SI, DI, ES 449 ;-------------------------------------------------------------------- 450 ALIGN JUMP_ALIGN 451 BootMenuPrint_HardDiskMenuitemInformation: 452 ePUSH_T ax, BootMenuPrint_HardDiskPrinted 453 call FindDPT_ForDriveNumber ; DS:DI to point DPT 454 jnc SHORT BootMenuPrint_HardDiskMenuitemInfoForForeignDrive 455 call BootMenuPrint_HardDiskMenuitemInfoSizeForOurDrive 456 jmp BootMenuPrintCfg_ForOurDrive 457 458 ;-------------------------------------------------------------------- 459 ; Prints Hard Disk Menuitem information strings for drive that 460 ; is handled by some other BIOS. 461 ; 462 ; BootMenuPrint_HardDiskMenuitemInfoForForeignDrive 463 ; Parameters: 464 ; DL: Untranslated Hard Disk number 465 ; DS: RAMVARS segment 466 ; Returns: 467 ; Nothing 468 ; Corrupts registers: 469 ; AX, BX, CX, DX, SI, DI 470 ;-------------------------------------------------------------------- 471 ALIGN JUMP_ALIGN 472 BootMenuPrint_HardDiskMenuitemInfoForForeignDrive: 473 call DriveXlate_ToOrBack 474 call HCapacity_GetSectorCountFromForeignAH08h 475 call HCapacity_ConvertSectorCountToSize 476 ePUSH_T dx, BootMenuPrint_ClearThreeInfoLines ; Return address 477 push cx ; Magnitude character 478 push si ; Tenths 479 push ax ; Size in magnitude 480 ePUSH_T ax, g_szCapacity ; "Capacity" 481 mov si, g_szSizeSingle 482 mov dh, 8 ; 8 bytes pushed to stack 483 jmp PrintString_JumpToFormat 484 485 ;-------------------------------------------------------------------- 486 ; Prints Hard Disk Menuitem information size string for drive that 487 ; is handled by our BIOS. 488 ; 489 ; BootMenuPrint_HardDiskMenuitemInfoSizeForOurDrive 490 ; Parameters: 491 ; DL: Untranslated Hard Disk number 492 ; DS:DI: Ptr to DPT 493 ; Returns: 494 ; Nothing 495 ; Corrupts registers: 496 ; AX, BX, CX, DX, SI, ES 497 ;-------------------------------------------------------------------- 498 ALIGN JUMP_ALIGN 499 BootMenuPrint_HardDiskMenuitemInfoSizeForOurDrive: 500 ePUSH_T ax, BootMenuPrint_ClearOneInfoLine ; Return address 501 502 ; Get and push total LBA size 503 call BootInfo_GetTotalSectorCount 504 call HCapacity_ConvertSectorCountToSize 505 push cx ; Magnitude character 506 push si ; Tenths 507 push ax ; Size in magnitude 508 509 ; Get and push L-CHS size 510 mov dl, [di+DPT.bDrvNum] ; Restore drive number 511 call HCapacity_GetSectorCountFromOurAH08h 512 call HCapacity_ConvertSectorCountToSize 513 push cx ; Magnitude character 514 push si ; Tenths 515 push ax ; Size in magnitude 516 517 ePUSH_T ax, g_szCapacity ; "Capacity" 518 mov si, g_szSizeDual 519 mov dh, 14 ; 14 bytes pushed to stack 520 jmp PrintString_JumpToFormat 521 522 523 ;-------------------------------------------------------------------- 524 ; Prints Function Menuitem information strings. 525 ; 526 ; BootMenuPrint_HardDiskMenuitemInformation 527 ; Parameters: 528 ; DX: Function ID 529 ; DS: RAMVARS segment 530 ; Returns: 531 ; AX: 1 if function ID was valid 532 ; 0 if function ID was valid 533 ; Corrupts registers: 534 ; BX, DX 535 ;-------------------------------------------------------------------- 536 ALIGN JUMP_ALIGN 537 BootMenuPrint_FunctionMenuitemInformation: 538 jmp SHORT BootMenuPrint_ClearThreeInfoLines 539 540 541 ;-------------------------------------------------------------------- 542 ; Prints Boot Menu title strings. 543 ; 544 ; BootMenuPrint_TitleStrings 545 ; Parameters: 546 ; Nothing 547 ; Returns: 548 ; AX: Was printing successfull 549 ; Corrupts registers: 550 ; BX, DX, SI 551 ;-------------------------------------------------------------------- 552 ALIGN JUMP_ALIGN 553 BootMenuPrint_TitleStrings: 554 mov si, ROMVARS.szTitle 555 call PrintString_FromCS 556 call BootMenuPrint_ClearOneInfoLine 557 mov si, ROMVARS.szVersion 558 call PrintString_FromCS 559 call BootMenuPrint_ClearOneInfoLine 560 mov si, g_szTitleLn3 561 call PrintString_FromCS 562 jmp SHORT BootMenuPrint_ClearOneInfoLine 540 push di 541 mov ax, dx 542 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX 543 pop di 544 ret -
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm
r3 r88 1 ; File name : BootMenuPrintCfg.asm 2 ; Project name : IDE BIOS 3 ; Created date : 28.3.2010 4 ; Last update : 9.4.2010 5 ; Author : Tomi Tilli 1 ; Project name : XTIDE Universal BIOS 6 2 ; Description : Functions for printing drive configuration 7 3 ; information on Boot Menu. … … 20 16 ; Nothing 21 17 ; Corrupts registers: 22 ; AX, BX, CX, DX, SI, ES18 ; AX, BX, CX, DX, SI, DI, ES 23 19 ;-------------------------------------------------------------------- 24 20 ALIGN JUMP_ALIGN … … 27 23 call BootMenuPrintCfg_GetPointers 28 24 call BootMenuPrintCfg_PushAndFormatCfgString 29 jmp BootMenuPrint_ ClearOneInfoLine25 jmp BootMenuPrint_Newline 30 26 31 27 … … 39 35 ; Nothing 40 36 ; Corrupts registers: 41 ; AX, BX, DX37 ; AX, SI, DI 42 38 ;-------------------------------------------------------------------- 43 39 ALIGN JUMP_ALIGN 44 40 BootMenuPrintCfg_HeaderAndChangeLine: 45 41 mov si, g_szCfgHeader 46 call Print String_FromCS47 jmp BootMenuPrint_ ClearOneInfoLine42 call PrintNullTerminatedStringFromCSSIandSetCF 43 jmp BootMenuPrint_Newline 48 44 49 45 … … 83 79 ; Nothing 84 80 ; Corrupts registers: 85 ; AX, CX, DX, SI81 ; AX, DX, SI, DI 86 82 ;-------------------------------------------------------------------- 87 83 ALIGN JUMP_ALIGN 88 84 BootMenuPrintCfg_PushAndFormatCfgString: 85 push bp 86 87 mov bp, sp 89 88 ; Fall to first push below 90 89 91 90 ;-------------------------------------------------------------------- 92 ; BootMenuPrintCfg_PushResetStatus 91 ; PushAddressingMode 92 ; Parameters: 93 ; DS:DI: Ptr to DPT 94 ; ES:BX: Ptr to BOOTNFO 95 ; CS:SI: Ptr to IDEVARS 96 ; Returns: 97 ; Nothing (jumps to next push below) 98 ; Corrupts registers: 99 ; AX, DX 100 ;-------------------------------------------------------------------- 101 PushAddressingMode: 102 mov dx, bx ; Backup BX to DX 103 mov bx, MASK_DPT_ADDR ; Load addressing mode mask 104 and bl, [di+DPT.bFlags] ; Addressing mode now in BX 105 push WORD [cs:bx+.rgszAddressingModeString] 106 mov bx, dx 107 jmp SHORT .NextPush 108 ALIGN WORD_ALIGN 109 .rgszAddressingModeString: 110 dw g_szLCHS 111 dw g_szPCHS 112 dw g_szLBA28 113 dw g_szLBA48 114 ALIGN JUMP_ALIGN 115 .NextPush: 116 117 ;-------------------------------------------------------------------- 118 ; PushBlockMode 93 119 ; Parameters: 94 120 ; DS:DI: Ptr to DPT … … 100 126 ; AX 101 127 ;-------------------------------------------------------------------- 102 BootMenuPrintCfg_PushResetStatus:103 eMOVZX ax, BYTE [di+DPT.b Reset]128 PushBlockMode: 129 eMOVZX ax, BYTE [di+DPT.bSetBlock] 104 130 push ax 105 131 106 132 ;-------------------------------------------------------------------- 107 ; BootMenuPrintCfg_PushIRQ108 ; Parameters: 109 ; DS:DI: Ptr to DPT 110 ; ES:BX: Ptr to BOOTNFO 111 ; CS:SI: Ptr to IDEVARS 112 ; Returns: 113 ; Nothing ( falls to next push below)133 ; PushBusType 134 ; Parameters: 135 ; DS:DI: Ptr to DPT 136 ; ES:BX: Ptr to BOOTNFO 137 ; CS:SI: Ptr to IDEVARS 138 ; Returns: 139 ; Nothing (jumps to next push below) 114 140 ; Corrupts registers: 115 141 ; AX, DX 116 142 ;-------------------------------------------------------------------- 117 BootMenuPrintCfg_PushIRQ: 118 mov dl, ' ' ; Load space to DL 119 mov al, [cs:si+IDEVARS.bIRQ] 120 test al, al ; Interrupts disabled? 121 jz SHORT .PushIrqDisabled 122 add al, '0' ; Digit to ASCII 123 cmp al, '9' ; Only one digit needed? 124 jbe SHORT .PushCharacters 125 126 ; Two digits needed 127 sub al, 10 ; Limit to single digit ASCII 128 mov dl, '1' ; Load '1 to DX 129 jmp SHORT .PushCharacters 130 ALIGN JUMP_ALIGN 131 .PushIrqDisabled: 132 mov al, '-' ; Load line to AL 133 xchg ax, dx ; Space to AL, line to DL 134 ALIGN JUMP_ALIGN 135 .PushCharacters: 136 push ax 137 push dx 138 139 ;-------------------------------------------------------------------- 140 ; BootMenuPrintCfg_PushBusType 141 ; Parameters: 142 ; DS:DI: Ptr to DPT 143 ; ES:BX: Ptr to BOOTNFO 144 ; CS:SI: Ptr to IDEVARS 145 ; Returns: 146 ; Nothing (jumps to next push below) 147 ; Corrupts registers: 148 ; AX, DX 149 ;-------------------------------------------------------------------- 150 BootMenuPrintCfg_PushBusType: 143 PushBusType: 151 144 xchg ax, bx ; Store BX to AX 152 145 eMOVZX bx, BYTE [cs:si+IDEVARS.bBusType] 153 146 mov bx, [cs:bx+.rgwBusTypeValues] ; Char to BL, Int to BH 154 147 eMOVZX dx, bh 148 push bx ; Push character 155 149 push dx ; Push 8, 16 or 32 156 push bx ; Push character157 150 xchg bx, ax ; Restore BX 158 151 jmp SHORT .NextPush … … 167 160 168 161 ;-------------------------------------------------------------------- 169 ; BootMenuPrintCfg_PushBlockMode162 ; PushIRQ 170 163 ; Parameters: 171 164 ; DS:DI: Ptr to DPT … … 175 168 ; Nothing (falls to next push below) 176 169 ; Corrupts registers: 170 ; AX, DX 171 ;-------------------------------------------------------------------- 172 PushIRQ: 173 mov dl, ' ' ; Load space to DL 174 mov al, [cs:si+IDEVARS.bIRQ] 175 test al, al ; Interrupts disabled? 176 jz SHORT .PushIrqDisabled 177 add al, '0' ; Digit to ASCII 178 cmp al, '9' ; Only one digit needed? 179 jbe SHORT .PushCharacters 180 181 ; Two digits needed 182 sub al, 10 ; Limit to single digit ASCII 183 mov dl, '1' ; Load '1 to DX 184 jmp SHORT .PushCharacters 185 ALIGN JUMP_ALIGN 186 .PushIrqDisabled: 187 mov al, '-' ; Load line to AL 188 xchg ax, dx ; Space to AL, line to DL 189 ALIGN JUMP_ALIGN 190 .PushCharacters: 191 push dx 192 push ax 193 194 ;-------------------------------------------------------------------- 195 ; PushResetStatus 196 ; Parameters: 197 ; DS:DI: Ptr to DPT 198 ; ES:BX: Ptr to BOOTNFO 199 ; CS:SI: Ptr to IDEVARS 200 ; Returns: 201 ; Nothing (falls to next push below) 202 ; Corrupts registers: 177 203 ; AX 178 204 ;-------------------------------------------------------------------- 179 BootMenuPrintCfg_PushBlockMode:180 eMOVZX ax, BYTE [di+DPT.b SetBlock]205 PushResetStatus: 206 eMOVZX ax, BYTE [di+DPT.bReset] 181 207 push ax 182 208 183 209 ;-------------------------------------------------------------------- 184 ; BootMenuPrintCfg_PushAddressingMode185 ; Parameters:186 ; DS:DI: Ptr to DPT187 ; ES:BX: Ptr to BOOTNFO188 ; CS:SI: Ptr to IDEVARS189 ; Returns:190 ; Nothing (jumps to next push below)191 ; Corrupts registers:192 ; AX, DX193 ;--------------------------------------------------------------------194 BootMenuPrintCfg_PushAddressingMode:195 mov dx, bx ; Backup BX to DX196 mov bx, MASK_DPT_ADDR ; Load addressing mode mask197 and bl, [di+DPT.bFlags] ; Addressing mode now in BX198 push WORD [cs:bx+.rgszAddressingModeString]199 mov bx, dx200 jmp SHORT .NextPush201 ALIGN WORD_ALIGN202 .rgszAddressingModeString:203 dw g_szLCHS204 dw g_szPCHS205 dw g_szLBA28206 dw g_szLBA48207 ALIGN JUMP_ALIGN208 .NextPush:209 210 ;--------------------------------------------------------------------211 210 ; Prints formatted configuration string from parameters pushed to stack. 212 211 ; … … 217 216 ; Nothing 218 217 ; Corrupts registers: 219 ; AX, CX, DX, SI218 ; AX, SI, DI 220 219 ;-------------------------------------------------------------------- 221 220 BootMenuPrintCfg_ValuesFromStack: 222 221 mov si, g_szCfgFormat 223 mov dh, 14 ; 14 bytes pushed to stack 224 jmp PrintString_JumpToFormat 222 jmp PrintNullTerminatedStringFromCSSIandSetCF -
trunk/XTIDE_Universal_BIOS/Src/Boot/BootPrint.asm
r87 r88 1 ; Project name : IDEBIOS1 ; Project name : XTIDE Universal BIOS 2 2 ; Description : Functions for printing boot related strings. 3 3 … … 6 6 7 7 ;-------------------------------------------------------------------- 8 ; Prints trying to boot string.9 ;10 8 ; BootPrint_TryToBootFromDL 11 9 ; Parameters: … … 15 13 ; Nothing 16 14 ; Corrupts registers: 17 ; AX, CX, SI, DI15 ; AX, SI 18 16 ;-------------------------------------------------------------------- 19 17 ALIGN JUMP_ALIGN 20 18 BootPrint_TryToBootFromDL: 21 push dx22 ePUSH_T ax, BootPrint_PopDxAndReturn ; Return address19 push bp 20 mov bp, sp 23 21 24 xor dh, dh ; Translated drive number to DX 25 push dx ; Push translated drive number 22 mov ax, g_szHardDrv 23 test dl, 80h 24 eCMOVZ ax, g_szFloppyDrv 25 push ax ; "Hard Drive" or "Floppy Drive" 26 26 27 call DriveXlate_ToOrBack 27 28 push dx ; Push untranslated drive number 28 29 mov ax, g_szFloppyDrv ; Assume "Floppy Drive" 30 test dl, 80h ; Hard Disk? 31 jz SHORT .PushHardOrFloppy 32 add ax, BYTE g_szHardDrv - g_szFloppyDrv 33 .PushHardOrFloppy: 34 push ax 29 call DriveXlate_ToOrBack 30 push dx ; Push translated drive number 35 31 36 32 mov si, g_szTryToBoot 37 mov dh, 6 ; 6 bytes pushed to stack 38 jmp PrintString_JumpToFormat 39 40 ALIGN JUMP_ALIGN 41 BootPrint_PopDxAndReturn: 42 pop dx 43 ret 33 jmp BootMenuPrint_FormatCSSIfromParamsInSSBP 44 34 45 35 46 36 ;-------------------------------------------------------------------- 47 ; Prints message that valid boot sector has been found.48 ;49 37 ; BootPrint_BootSectorLoaded 50 38 ; Parameters: … … 53 41 ; Nothing 54 42 ; Corrupts registers: 55 ; AX, CX,SI43 ; AX, SI 56 44 ;-------------------------------------------------------------------- 57 45 ALIGN JUMP_ALIGN 58 46 BootPrint_BootSectorLoaded: 59 push dx60 ePUSH_T ax, BootPrint_PopDxAndReturn ; Return address61 47 push bp 48 mov bp, sp 49 ePUSH_T ax, g_szBootSector 62 50 ePUSH_T ax, g_szFound 63 jmp SHORT BootPrint_MsgCodeShared 64 51 jmp SHORT PrintBootSectorResult 65 52 66 53 ;-------------------------------------------------------------------- 67 ; Prints message that first sector is not boot sector.68 ;69 54 ; BootPrint_FirstSectorNotBootable 70 55 ; Parameters: … … 73 58 ; Nothing 74 59 ; Corrupts registers: 75 ; AX, CX, DX,SI60 ; AX, SI 76 61 ;-------------------------------------------------------------------- 77 62 ALIGN JUMP_ALIGN 78 63 BootPrint_FirstSectorNotBootable: 64 push bp 65 mov bp, sp 66 ePUSH_T ax, g_szBootSector 79 67 ePUSH_T ax, g_szNotFound 80 BootPrint_MsgCodeShared: 81 ePUSH_T ax, g_szBootSector 68 PrintBootSectorResult: 82 69 mov si, g_szSectRead 83 mov dh, 4 ; 4 bytes pushed to stack 84 jmp PrintString_JumpToFormat 70 jmp BootMenuPrint_FormatCSSIfromParamsInSSBP 85 71 86 72 87 73 ;-------------------------------------------------------------------- 88 ; Prints error code for failed first sector read attempt.89 ;90 74 ; BootPrint_FailedToLoadFirstSector 91 75 ; Parameters: … … 94 78 ; Nothing 95 79 ; Corrupts registers: 96 ; AX, CX, DX,SI80 ; AX, CX, SI 97 81 ;-------------------------------------------------------------------- 98 82 ALIGN JUMP_ALIGN 99 83 BootPrint_FailedToLoadFirstSector: 84 push bp 85 mov bp, sp 100 86 eMOVZX cx, ah ; Error code to CX 101 87 push cx ; Push INT 13h error code 102 88 mov si, g_szReadError 103 mov dh, 2 ; 2 bytes pushed to stack 104 jmp PrintString_JumpToFormat 89 jmp BootMenuPrint_FormatCSSIfromParamsInSSBP
Note:
See TracChangeset
for help on using the changeset viewer.