Changeset 258 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Boot
- Timestamp:
- Feb 22, 2012, 7:01:53 PM (13 years ago)
- google:author:
- gregli@hotmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Boot
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenu.asm
r248 r258 37 37 ; Clear: There is no selected menu item, DL is not valid 38 38 ; Corrupts registers: 39 ; CX, DI39 ; AX, DI 40 40 ;-------------------------------------------------------------------- 41 41 ALIGN JUMP_ALIGN … … 50 50 51 51 mov dl, cl ; Copy menuitem index to DX 52 call FloppyDrive_GetCountTo CX53 cmp dl, cl ; Floppy drive?52 call FloppyDrive_GetCountToAX 53 cmp dl, al ; Floppy drive? 54 54 jb SHORT .ReturnFloppyDriveInDX ; Set CF if branch taken 55 or cl, 80h ; Or 80h into CL before the sub55 or al, 80h ; Or 80h into AL before the sub 56 56 ; to cause CF to be set after 57 57 ; and result has high order bit set 58 sub dl, cl ; Remove floppy drives from index58 sub dl, al ; Remove floppy drives from index 59 59 60 60 .ReturnFloppyDriveInDX: … … 94 94 ALIGN JUMP_ALIGN 95 95 BootMenu_GetMenuitemCountToAX: 96 call RamVars_GetHardDiskCountFromBDAto CX96 call RamVars_GetHardDiskCountFromBDAtoAX 97 97 xchg ax, cx 98 call FloppyDrive_GetCountTo CX98 call FloppyDrive_GetCountToAX 99 99 add ax, cx 100 100 ret … … 136 136 BootMenu_GetMenuitemToAXforAsciiHotkeyInAL: 137 137 call Char_ALtoUpperCaseLetter 138 call BootMenu_GetLetterForFirstHardDiskToCL139 138 xor ah, ah 140 cmp al, cl ; Letter is for Hard Disk? 139 xchg ax, cx 140 call BootMenu_GetLetterForFirstHardDiskToAL 141 cmp cl, al ; Letter is for Hard Disk? 141 142 jae SHORT .StartFromHardDiskLetter 143 xchg ax, cx 142 144 sub al, 'A' ; Letter to Floppy Drive menuitem 143 145 ret 144 146 ALIGN JUMP_ALIGN 145 147 .StartFromHardDiskLetter: 146 sub al, cl ; Hard Disk index147 call FloppyDrive_GetCountTo CX148 sub cl, al ; Hard Disk index 149 call FloppyDrive_GetCountToAX 148 150 add ax, cx ; Menuitem index 151 ; Note: no need to xchg ax, cx as above, since adding with result to ax 149 152 ret 150 153 … … 160 163 ; CL: Upper case letter for first hard disk 161 164 ; Corrupts registers: 162 ; CH163 ;-------------------------------------------------------------------- 164 ALIGN JUMP_ALIGN 165 BootMenu_GetLetterForFirstHardDiskTo CL:166 call FloppyDrive_GetCountTo CX167 add cl, 'A'168 cmp cl, 'C'165 ; AX 166 ;-------------------------------------------------------------------- 167 ALIGN JUMP_ALIGN 168 BootMenu_GetLetterForFirstHardDiskToAL: 169 call FloppyDrive_GetCountToAX 170 add al, 'A' 171 cmp al, 'C' 169 172 ja .Return 170 mov cl, 'C'173 mov al, 'C' 171 174 ALIGN JUMP_ALIGN, ret 172 175 .Return: … … 181 184 ; DX: Menuitem index (assuming drive is available) 182 185 ; Corrupts registers: 183 ; Nothing186 ; AX 184 187 ;-------------------------------------------------------------------- 185 188 ALIGN JUMP_ALIGN … … 188 191 test dl, dl 189 192 jns SHORT .ReturnItemIndexInDX ; Return if floppy drive (HD bit not set) 190 call FloppyDrive_GetCountTo CX193 call FloppyDrive_GetCountToAX 191 194 and dl, ~80h ; Clear HD bit 192 add dx, cx195 add dx, ax 193 196 .ReturnItemIndexInDX: 194 197 ret … … 212 215 test dl, dl ; Floppy drive? 213 216 jns SHORT .IsFloppyDriveInSystem 214 call RamVars_GetHardDiskCountFromBDAto CX ; Hard Disk count to CX215 or cl, 80h ; Set Hard Disk bit to CX217 call RamVars_GetHardDiskCountFromBDAtoAX ; Hard Disk count to AX 218 or al, 80h ; Set Hard Disk bit to AX 216 219 jmp SHORT .CompareDriveNumberToDriveCount 217 220 .IsFloppyDriveInSystem: 218 call FloppyDrive_GetCountTo CX221 call FloppyDrive_GetCountToAX 219 222 .CompareDriveNumberToDriveCount: 220 cmp dl, cl ; Set CF when DL is smaller221 ret 223 cmp dl, al ; Set CF when DL is smaller 224 ret -
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuEvent.asm
r248 r258 21 21 %ifdef MENUEVENT_INLINE_OFFSETS 22 22 23 add bx, BootMenuEvent_Handler 23 add bx, BootMenuEvent_Handler.FirstEvent 24 24 jmp bx 25 25 26 MENUEVENT_InitializeMenuinitFromDSSI equ (BootMenuEvent_Handler.InitializeMenuinitFromDSSI - BootMenuEvent_Handler )27 MENUEVENT_ExitMenu equ (BootMenuEvent_EventCompleted - BootMenuEvent_Handler )28 MENUEVENT_ItemHighlightedFromCX equ (BootMenuEvent_Handler.ItemHighlightedFromCX - BootMenuEvent_Handler )29 MENUEVENT_ItemSelectedFromCX equ (BootMenuEvent_Handler.ItemSelectedFromCX - BootMenuEvent_Handler )30 MENUEVENT_KeyStrokeInAX equ (BootMenuEvent_Handler.KeyStrokeInAX - BootMenuEvent_Handler )31 MENUEVENT_RefreshTitle equ (BootMenuPrint_TitleStrings - BootMenuEvent_Handler )32 MENUEVENT_RefreshInformation equ (BootMenuPrint_RefreshInformation - BootMenuEvent_Handler )33 MENUEVENT_RefreshItemFromCX equ (BootMenuPrint_RefreshItem - BootMenuEvent_Handler )26 MENUEVENT_InitializeMenuinitFromDSSI equ (BootMenuEvent_Handler.InitializeMenuinitFromDSSI - BootMenuEvent_Handler.FirstEvent) 27 MENUEVENT_ExitMenu equ (BootMenuEvent_EventCompleted - BootMenuEvent_Handler.FirstEvent) 28 MENUEVENT_ItemHighlightedFromCX equ (BootMenuEvent_Handler.ItemHighlightedFromCX - BootMenuEvent_Handler.FirstEvent) 29 MENUEVENT_ItemSelectedFromCX equ (BootMenuEvent_Handler.ItemSelectedFromCX - BootMenuEvent_Handler.FirstEvent) 30 MENUEVENT_KeyStrokeInAX equ (BootMenuEvent_Handler.KeyStrokeInAX - BootMenuEvent_Handler.FirstEvent) 31 MENUEVENT_RefreshTitle equ (BootMenuPrint_TitleStrings - BootMenuEvent_Handler.FirstEvent) 32 MENUEVENT_RefreshInformation equ (BootMenuPrint_RefreshInformation - BootMenuEvent_Handler.FirstEvent) 33 MENUEVENT_RefreshItemFromCX equ (BootMenuPrint_RefreshItem - BootMenuEvent_Handler.FirstEvent) 34 34 ; 35 35 ; Note that there is no entry for MENUEVENT_IdleProcessing. If MENUEVENT_IDLEPROCESSING_ENABLE is not %defined, … … 67 67 ; DS:SI: Ptr to initialized MENUINIT struct 68 68 ALIGN JUMP_ALIGN 69 .FirstEvent: 69 70 .InitializeMenuinitFromDSSI: 70 71 push ds -
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm
r255 r258 24 24 25 25 call RamVars_IsDriveHandledByThisBIOS 26 j nc .notOurs26 jc .notOurs 27 27 28 28 call FindDPT_ForDriveNumber ; if it is one of ours, print the string in bootnfo … … 47 47 push ax ; the hard disks don't ever use it, but it does no harm) 48 48 49 jmp short BootMenuPrint_ FormatCSSIfromParamsInSSBP49 jmp short BootMenuPrint_RefreshInformation.FormatRelay 50 50 51 51 ;-------------------------------------------------------------------- … … 87 87 push bp 88 88 mov bp,sp 89 jmp short BootMenuPrint_ FormatCSSIfromParamsInSSBP89 jmp short BootMenuPrint_RefreshInformation.FormatRelay 90 90 91 91 … … 110 110 mov bp, sp 111 111 112 mov si, g_szCapacity ; Setup print string now, carries through to print call 113 114 xor di, di 115 call RamVars_IsDriveHandledByThisBIOS 116 jc SHORT .notours 117 call FindDPT_ForDriveNumber ; DS:DI to point DPT 118 .notours: 119 112 120 test dl, dl ; are we a hard disk? 113 121 js BootMenuPrint_HardDiskRefreshInformation 114 122 123 test di,di 124 jnz .ours 115 125 call FloppyDrive_GetType ; Get Floppy Drive type to BX 126 jmp .around 127 .ours: 128 call AH8h_GetDriveParameters 129 .around: 116 130 117 131 mov ax, g_szFddSizeOr ; .PrintXTFloppyType 118 test b x, bx; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD)132 test bl, bl ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD) 119 133 jz SHORT .PushAXAndOutput 120 134 … … 158 172 159 173 mov al,FloppyTypes.rgbCapacityMultiplier 174 mov bh, 0 160 175 mul byte [cs:bx+FloppyTypes.rgbCapacity - 1] ; -1 since 0 is handled above and not in the table 161 176 … … 163 178 push ax 164 179 165 jmp short BootMenuPrint_HardDiskRefreshInformation.output 180 .FormatRelay: 181 jmp short BootMenuPrint_FormatCSSIfromParamsInSSBP 166 182 167 183 … … 180 196 ALIGN JUMP_ALIGN 181 197 BootMenuPrint_HardDiskRefreshInformation: 182 call RamVars_IsDriveHandledByThisBIOS 183 jnc SHORT .HardDiskMenuitemInfoForForeignDrive 184 call FindDPT_ForDriveNumber ; DS:DI to point DPT 185 ; Fall to .HardDiskMenuitemInfoForOurDrive 186 187 ;-------------------------------------------------------------------- 188 ; .HardDiskMenuitemInfoForOurDrive 189 ; Parameters: 190 ; DL: Untranslated Hard Disk number 191 ; DS:DI: Ptr to DPT 192 ; Returns: 193 ; Nothing 194 ; Corrupts registers: 195 ; AX, BX, CX, DX, SI, DI, ES 196 ;-------------------------------------------------------------------- 198 test di,di 199 jz .HardDiskMenuitemInfoForForeignDrive 200 197 201 .HardDiskMenuitemInfoForOurDrive: 198 202 ePUSH_T ax, g_szInformation … … 200 204 ; Get and push total LBA size 201 205 call BootMenuInfo_GetTotalSectorCount 202 call ConvertSectorCountInBXDXAXtoSizeAndPushForFormat 203 jmp BootMenuPrintCfg_ForOurDrive 204 205 ;-------------------------------------------------------------------- 206 ; .HardDiskMenuitemInfoForForeignDrive 207 ; Parameters: 208 ; DL: Untranslated Hard Disk number 209 ; DS: RAMVARS segment 210 ; Returns: 211 ; CF: Set since menu event was handled successfully 212 ; Corrupts registers: 213 ; AX, BX, CX, DX, SI, DI 214 ;-------------------------------------------------------------------- 215 ALIGN JUMP_ALIGN 206 jmp .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat 207 216 208 .HardDiskMenuitemInfoForForeignDrive: 217 209 call DriveXlate_ToOrBack 218 210 call AH15h_GetSectorCountFromForeignDriveToDXAX 219 call ConvertSectorCountInBXDXAXtoSizeAndPushForFormat 220 221 ALIGN JUMP_ALIGN 222 .output: 223 mov si, g_szCapacity 224 ;;; fall-through 211 212 .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat: 213 ePUSH_T cx, g_szCapacityNum ; Push format substring 214 call Size_ConvertSectorCountInBXDXAXtoKiB 215 mov cx, BYTE_MULTIPLES.kiB 216 call Size_GetSizeToAXAndCharToDLfromBXDXAXwithMagnitudeInCX 217 push ax ; Size in magnitude 218 push cx ; Tenths 219 push dx ; Magnitude character 220 221 test di,di 222 jz short BootMenuPrint_FormatCSSIfromParamsInSSBP 223 224 %include "BootMenuPrintCfg.asm" ; inline of code to fill out remainder of information string 225 226 ;;; fall-through to BootMenuPrint_FormatCSSIfromParamsInSSBP 227 225 228 226 229 ;-------------------------------------------------------------------- … … 273 276 ALIGN JUMP_ALIGN 274 277 BootMenuPrint_TheBottomOfScreen: 275 call FloppyDrive_GetCountTo CX276 mov bl, cl; Floppy Drive count to BL277 call RamVars_GetHardDiskCountFromBDAto CX278 mov bh, cl ; Hard Disk count to BH278 call FloppyDrive_GetCountToAX 279 xchg bx, ax ; Floppy Drive count to BL 280 call RamVars_GetHardDiskCountFromBDAtoAX 281 mov bh, al ; Hard Disk count to BH 279 282 ; Fall to .MoveCursorToHotkeyStrings 280 283 … … 321 324 test bh, bh ; Any Hard Drives? 322 325 jz SHORT .SkipHardDriveHotkeys 323 xchg ax, cx ; Store Key Attribute 324 call BootMenu_GetLetterForFirstHardDiskToCL 325 mov ch, ANGLE_QUOTE_RIGHT 326 xchg ax, cx 326 call BootMenu_GetLetterForFirstHardDiskToAL 327 mov ah, ANGLE_QUOTE_RIGHT 327 328 mov si, g_szHDD 328 329 call PushHotkeyParamsAndFormat … … 390 391 CALL_DISPLAY_LIBRARY InitializeDisplayContext 391 392 ret 392 393 394 ;--------------------------------------------------------------------395 ; ConvertSectorCountInBXDXAXtoSizeAndPushForFormat396 ; Parameters:397 ; BX:DX:AX: Sector count398 ; Returns:399 ; Size in stack400 ; Corrupts registers:401 ; AX, BX, CX, DX, SI402 ;--------------------------------------------------------------------403 ALIGN JUMP_ALIGN404 ConvertSectorCountInBXDXAXtoSizeAndPushForFormat:405 pop si ; Pop return address406 ePUSH_T cx, g_szCapacityNum ; Push format substring407 call Size_ConvertSectorCountInBXDXAXtoKiB408 mov cx, BYTE_MULTIPLES.kiB409 call Size_GetSizeToAXAndCharToDLfromBXDXAXwithMagnitudeInCX410 push ax ; Size in magnitude411 push cx ; Tenths412 push dx ; Magnitude character413 jmp si414 393 415 394 -
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm
r241 r258 2 2 ; Description : Functions for printing drive configuration 3 3 ; information on Boot Menu. 4 4 ; 5 ; Included by BootMenuPrint.asm, this routine is to be inserted into 6 ; BootMenuPrint_HardDiskRefreshInformation. 7 ; 5 8 ; Section containing code 6 9 SECTION .text 10 11 ;;; fall-into from BootMenuPrint_HardDiskRefreshInformation. 7 12 8 13 ;-------------------------------------------------------------------- … … 16 21 ; Nothing 17 22 ; Corrupts registers: 18 ; AX, BX, CX, DX , SI, DI23 ; AX, BX, CX, DX 19 24 ;-------------------------------------------------------------------- 20 ALIGN JUMP_ALIGN 21 BootMenuPrintCfg_ForOurDrive: 25 .BootMenuPrintCfg_ForOurDrive: 22 26 eMOVZX ax, BYTE [di+DPT.bIdevarsOffset] 23 xchg si, ax ; CS:SInow points to IDEVARS27 xchg bx, ax ; CS:BX now points to IDEVARS 24 28 ; Fall to .PushAndFormatCfgString 25 29 … … 28 32 ; Parameters: 29 33 ; DS:DI: Ptr to DPT 30 ; CS: SI: Ptr to IDEVARS34 ; CS:BX: Ptr to IDEVARS 31 35 ; Returns: 32 36 ; Nothing (jumps to next push below) 33 37 ; Corrupts registers: 34 ; AX, BX38 ; AX, CX 35 39 ;-------------------------------------------------------------------- 36 40 .PushAddressingMode: … … 41 45 ;; with AL clear, and so we exchange AL and AH after the multiply for the final result. 42 46 ;; 43 mov bl,(1<<(8-ADDRESSING_MODE_FIELD_POSITION)) * g_szAddressingModes_Displacement44 mul bl47 mov cl,(1<<(8-ADDRESSING_MODE_FIELD_POSITION)) * g_szAddressingModes_Displacement 48 mul cl 45 49 xchg al,ah 46 50 add ax,g_szAddressingModes … … 51 55 ; Parameters: 52 56 ; DS:DI: Ptr to DPT 53 ; CS: SI: Ptr to IDEVARS57 ; CS:BX: Ptr to IDEVARS 54 58 ; Returns: 55 59 ; Nothing (falls to next push below) … … 69 73 ; Parameters: 70 74 ; DS:DI: Ptr to DPT 71 ; CS: SI: Ptr to IDEVARS75 ; CS:BX: Ptr to IDEVARS 72 76 ; Returns: 73 77 ; Nothing (jumps to next push below) … … 77 81 .PushBusType: 78 82 mov al,g_szBusTypeValues_Displacement 79 mul BYTE [cs: si+IDEVARS.bDevice]83 mul BYTE [cs:bx+IDEVARS.bDevice] 80 84 81 85 shr ax,1 ; divide by 2 since IDEVARS.bDevice is multiplied by 2 … … 88 92 ; Parameters: 89 93 ; DS:DI: Ptr to DPT 90 ; CS: SI: Ptr to IDEVARS94 ; CS:BX: Ptr to IDEVARS 91 95 ; Returns: 92 96 ; Nothing (falls to next push below) … … 95 99 ;-------------------------------------------------------------------- 96 100 .PushIRQ: 97 mov al, BYTE [cs: si+IDEVARS.bIRQ]101 mov al, BYTE [cs:bx+IDEVARS.bIRQ] 98 102 cbw 99 103 push ax … … 103 107 ; Parameters: 104 108 ; DS:DI: Ptr to DPT 105 ; CS: SI: Ptr to IDEVARS109 ; CS:BX: Ptr to IDEVARS 106 110 ; Returns: 107 111 ; Nothing (falls to next push below) … … 114 118 push ax 115 119 116 ;-------------------------------------------------------------------- 117 ; PrintValuesFromStack 118 ; Parameters: 119 ; Stack: All formatting parameters 120 ; Returns: 121 ; Nothing 122 ; Corrupts registers: 123 ; AX, SI, DI 124 ;-------------------------------------------------------------------- 125 .PrintValuesFromStack: 126 jmp BootMenuPrint_HardDiskRefreshInformation.output 127 120 ;;; fall-out to BootMenuPrint_HardDiskRefreshInformation.
Note:
See TracChangeset
for help on using the changeset viewer.