[88] | 1 | ; Project name : XTIDE Universal BIOS
|
---|
[3] | 2 | ; Description : Functions for printing drive detection strings.
|
---|
| 3 |
|
---|
| 4 | ; Section containing code
|
---|
| 5 | SECTION .text
|
---|
| 6 |
|
---|
| 7 | ;--------------------------------------------------------------------
|
---|
| 8 | ; Prints BIOS name and segment address where it is found.
|
---|
| 9 | ;
|
---|
| 10 | ; DetectPrint_RomFoundAtSegment
|
---|
| 11 | ; Parameters:
|
---|
| 12 | ; Nothing
|
---|
| 13 | ; Returns:
|
---|
| 14 | ; Nothing
|
---|
| 15 | ; Corrupts registers:
|
---|
[120] | 16 | ; AX, SI, DI
|
---|
[3] | 17 | ;--------------------------------------------------------------------
|
---|
| 18 | DetectPrint_RomFoundAtSegment:
|
---|
[88] | 19 | push bp
|
---|
[97] | 20 | mov bp, sp
|
---|
[3] | 21 | mov si, g_szRomAt
|
---|
[88] | 22 | ePUSH_T ax, ROMVARS.szTitle ; Bios title string
|
---|
| 23 | push cs ; BIOS segment
|
---|
[242] | 24 |
|
---|
| 25 | DetectPrint_BootMenuPrint_FormatCSSIfromParamsInSSBP_Relay:
|
---|
[88] | 26 | jmp BootMenuPrint_FormatCSSIfromParamsInSSBP
|
---|
[3] | 27 |
|
---|
| 28 |
|
---|
| 29 | ;--------------------------------------------------------------------
|
---|
[97] | 30 | ; DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP
|
---|
[3] | 31 | ; Parameters:
|
---|
[233] | 32 | ; CS:CX: Ptr to "Master" or "Slave" string
|
---|
[3] | 33 | ; CS:BP: Ptr to IDEVARS
|
---|
[242] | 34 | ; SI: Ptr to template string
|
---|
[3] | 35 | ; Returns:
|
---|
| 36 | ; Nothing
|
---|
| 37 | ; Corrupts registers:
|
---|
[196] | 38 | ; AX, SI, DI, CX
|
---|
[3] | 39 | ;--------------------------------------------------------------------
|
---|
[97] | 40 | DetectPrint_StartDetectWithMasterOrSlaveStringInAXandIdeVarsInCSBP:
|
---|
[233] | 41 |
|
---|
| 42 | mov ax, [cs:bp+IDEVARS.wPort] ; for IDE: AX=port address, DH=.bDevice
|
---|
| 43 | mov dx, [cs:bp+IDEVARS.bDevice-1] ; for Serial: AL=port address>>2, AH=baud rate
|
---|
| 44 | ; DL=COM number character, DH=.bDevice
|
---|
[262] | 45 |
|
---|
| 46 | mov si, g_szDetectOuter ; Load SI with default wrapper string "IDE %s at %s: "
|
---|
| 47 |
|
---|
[242] | 48 | push bp ; setup stack for call to
|
---|
[233] | 49 | mov bp, sp ; BootMenuPrint_FormatCSSIfromParamsInSSBP
|
---|
| 50 |
|
---|
| 51 | push cx ; Push "Master" or "Slave"
|
---|
[242] | 52 |
|
---|
[233] | 53 | mov cl, (g_szDetectPort-$$) & 0xff ; Setup print string for standard IDE
|
---|
| 54 | ; Note that we modify only the low order bits of CX a lot here,
|
---|
| 55 | ; saving code space rather than reloading CX completely.
|
---|
| 56 | ; This optimization requires that all the g_szDetect* strings are
|
---|
| 57 | ; on the same 256 byte page, which is checked in strings.asm.
|
---|
[3] | 58 |
|
---|
[244] | 59 | cmp dh, DEVICE_SERIAL_PORT ; Check if this is a serial device
|
---|
[233] | 60 |
|
---|
[244] | 61 | jnz .pushAndPrint ; CX = string to print, AX = port address, DX won't be used
|
---|
[233] | 62 |
|
---|
| 63 | mov cl, (g_szDetectCOM-$$) & 0xff ; Setup print string for COM ports
|
---|
| 64 | push cx ; And push now. We use the fact that format strings can contain
|
---|
| 65 | ; themselves format strings.
|
---|
| 66 |
|
---|
| 67 | push dx ; Push COM number character
|
---|
[242] | 68 | ; If the string is going to be "Auto", we will push a NULL (zero)
|
---|
| 69 | ; here for the COM port number, which will be eaten by the
|
---|
| 70 | ; print routine (DisplayPrint_CharacterFromAL), resulting in
|
---|
[235] | 71 | ; just "COM" being printed without a character after it.
|
---|
[242] | 72 |
|
---|
[233] | 73 | mov cl, (g_szDetectCOMAuto-$$) & 0xff ; Setup secondary print string for "Auto"
|
---|
[242] | 74 |
|
---|
[244] | 75 | test dl, dl ; Check if serial port "Auto"
|
---|
[262] | 76 | jz .pushAndPrintSerial ; CX = string to print, AX and DX won't be used
|
---|
[242] | 77 |
|
---|
[233] | 78 | mov cl, (g_szDetectCOMLarge-$$) & 0xff ; Setup secondary print string for "COMn/xx.yK"
|
---|
[3] | 79 |
|
---|
[233] | 80 | mov al,ah ; baud rate divisor to AL
|
---|
| 81 | cbw ; clear AH, AL will always be less than 128
|
---|
| 82 | xchg si,ax ; move AX to SI for divide
|
---|
[242] | 83 | mov ax,1152 ; baud rate to display is 115200/divisor, the "00" is handled
|
---|
[233] | 84 | ; in the print strings
|
---|
[242] | 85 | cwd ; clear top 16-bits of dividend
|
---|
[233] | 86 | div si ; and divide... Now AX = baud rate/100, DX = 0 (always a clean divide)
|
---|
[242] | 87 |
|
---|
[233] | 88 | mov si,10 ; Now separate the whole portion from the fractional for "K" display
|
---|
| 89 | div si ; and divide... Now AX = baud rate/1000, DX = low order digit
|
---|
[242] | 90 |
|
---|
| 91 | cmp ax,si ; < 10: "2400", "9600", etc.; >= 10: "19.2K", "38.4K", etc.
|
---|
[262] | 92 | jae .pushAndPrintSerial
|
---|
[196] | 93 |
|
---|
[233] | 94 | mov cl, (g_szDetectCOMSmall-$$) & 0xff ; Setup secondary print string for "COMn/XXy00"
|
---|
[242] | 95 |
|
---|
[262] | 96 | .pushAndPrintSerial:
|
---|
| 97 | mov si, g_szDetectOuterSerial ; Finally load SI with wrapper string "Serial %s on %s: "
|
---|
| 98 |
|
---|
[242] | 99 | .pushAndPrint:
|
---|
[233] | 100 | push cx ; Push print string
|
---|
| 101 | push ax ; Push high order digits, or port address, or N/A
|
---|
| 102 | push dx ; Push low order digit, or N/A
|
---|
| 103 |
|
---|
[242] | 104 | jmp short DetectPrint_BootMenuPrint_FormatCSSIfromParamsInSSBP_Relay
|
---|
[196] | 105 |
|
---|
| 106 |
|
---|
[3] | 107 | ;--------------------------------------------------------------------
|
---|
[98] | 108 | ; DetectPrint_DriveNameFromBootnfoInESBX
|
---|
[3] | 109 | ; Parameters:
|
---|
[254] | 110 | ; ES:BX: Ptr to BOOTMENUINFO (if drive found)
|
---|
[3] | 111 | ; Returns:
|
---|
| 112 | ; Nothing
|
---|
| 113 | ; Corrupts registers:
|
---|
[88] | 114 | ; AX, SI
|
---|
[3] | 115 | ;--------------------------------------------------------------------
|
---|
[98] | 116 | DetectPrint_DriveNameFromBootnfoInESBX:
|
---|
[88] | 117 | push di
|
---|
| 118 | push bx
|
---|
| 119 |
|
---|
[254] | 120 | lea si, [bx+BOOTMENUINFO.szDrvName]
|
---|
[88] | 121 | mov bx, es
|
---|
| 122 | CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromBXSI
|
---|
| 123 | CALL_DISPLAY_LIBRARY PrintNewlineCharacters
|
---|
| 124 |
|
---|
| 125 | pop bx
|
---|
| 126 | pop di
|
---|
| 127 | ret
|
---|