source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm@ 233

Last change on this file since 233 was 233, checked in by gregli@…, 13 years ago

Serial Port: split single byte port and baud into two bytes, taking advantage of the two bytes in DPT_SERIAL, which supports more serial baud rates and in particular fixed a bug where a 4x client machine couldn't talk to a 115.2K server machine. This is a wide change, touching lots of files, but most are shallow changes. DetectPrint.asm took the most significant changes, now it calculates the baud rate to display instead of using characters provided by the Configurator. The Configurator now has a new menu flag, FLG_MENUITEM_CHOICESTRINGS, for specifying that values are not linear and they should be lookedup rather than indexed. Finally, another important bug fixed here is that in some error cases, the serial port code could get into an infinite loop waiting ont the hardware; now it has a timeout.

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