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

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

WIDE checkin... Added copyright and license information to sorce files, as per the GPL instructions for usage.

File size: 5.4 KB
Line 
1; Project name : XTIDE Universal BIOS
2; Description : Functions for printing drive detection strings.
3
4;
5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
7;
8; This program is free software; you can redistribute it and/or modify
9; it under the terms of the GNU General Public License as published by
10; the Free Software Foundation; either version 2 of the License, or
11; (at your option) any later version.
12;
13; This program is distributed in the hope that it will be useful,
14; but WITHOUT ANY WARRANTY; without even the implied warranty of
15; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16; GNU General Public License for more details.
17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;
19
20; Section containing code
21SECTION .text
22
23;--------------------------------------------------------------------
24; Prints BIOS name and segment address where it is found.
25;
26; DetectPrint_RomFoundAtSegment
27; Parameters:
28; Nothing
29; Returns:
30; Nothing
31; Corrupts registers:
32; AX, SI, DI
33;--------------------------------------------------------------------
34DetectPrint_RomFoundAtSegment:
35 push bp
36 mov bp, sp
37 mov si, g_szRomAt
38 ePUSH_T ax, ROMVARS.szTitle ; Bios title string
39 push cs ; BIOS segment
40
41DetectPrint_BootMenuPrint_FormatCSSIfromParamsInSSBP_Relay:
42 jmp BootMenuPrint_FormatCSSIfromParamsInSSBP
43
44
45;--------------------------------------------------------------------
46; DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP
47; Parameters:
48; CS:CX: Ptr to "Master" or "Slave" string
49; CS:BP: Ptr to IDEVARS
50; SI: Ptr to template string
51; Returns:
52; Nothing
53; Corrupts registers:
54; AX, SI, DI, CX
55;--------------------------------------------------------------------
56DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP:
57 mov ax, [cs:bp+IDEVARS.wPort] ; for IDE: AX=port address, DH=.bDevice
58 mov dx, [cs:bp+IDEVARS.bDevice-1] ; for Serial: AL=port address>>2, AH=baud rate
59 ; DL=COM number character, DH=.bDevice
60%ifdef MODULE_JRIDE
61 cmp dh, DEVICE_JRIDE_ISA
62 eCMOVE ax, cs ; Use segment address for JR-IDE/ISA
63%endif
64
65 push bp ; setup stack for call to
66 mov bp, sp ; BootMenuPrint_FormatCSSIfromParamsInSSBP
67
68 push cx ; Push "Master" or "Slave"
69
70 mov cl, (g_szDetectPort-$$) & 0xff ; Setup print string for standard IDE
71 ; Note that we modify only the low order bits of CX a lot here,
72 ; saving code space rather than reloading CX completely.
73 ; This optimization requires that all the g_szDetect* strings are
74 ; on the same 256 byte page, which is checked in strings.asm.
75
76%ifdef MODULE_SERIAL
77 cmp dh, DEVICE_SERIAL_PORT ; Check if this is a serial device
78
79 jnz .pushAndPrint ; CX = string to print, AX = port address, DX won't be used
80
81 mov cl, (g_szDetectCOM-$$) & 0xff ; Setup print string for COM ports
82 push cx ; And push now. We use the fact that format strings can contain
83 ; themselves format strings.
84
85 push dx ; Push COM number character
86 ; If the string is going to be "Auto", we will push a NULL (zero)
87 ; here for the COM port number, which will be eaten by the
88 ; print routine (DisplayPrint_CharacterFromAL), resulting in
89 ; just "COM" being printed without a character after it.
90
91 mov cl, (g_szDetectCOMAuto-$$) & 0xff ; Setup secondary print string for "Auto"
92
93 test dl, dl ; Check if serial port "Auto"
94 jz .pushAndPrintSerial ; CX = string to print, AX and DX won't be used
95
96 mov cl, (g_szDetectCOMLarge-$$) & 0xff ; Setup secondary print string for "COMn/xx.yK"
97
98 mov al,ah ; baud rate divisor to AL
99 cbw ; clear AH, AL will always be less than 128
100 xchg si,ax ; move AX to SI for divide
101 mov ax,1152 ; baud rate to display is 115200/divisor, the "00" is handled
102 ; in the print strings
103 cwd ; clear top 16-bits of dividend
104 div si ; and divide... Now AX = baud rate/100, DX = 0 (always a clean divide)
105
106 mov si,10 ; Now separate the whole portion from the fractional for "K" display
107 div si ; and divide... Now AX = baud rate/1000, DX = low order digit
108
109 cmp ax,si ; < 10: "2400", "9600", etc.; >= 10: "19.2K", "38.4K", etc.
110 jae .pushAndPrintSerial
111
112 mov cl, (g_szDetectCOMSmall-$$) & 0xff ; Setup secondary print string for "COMn/XXy00"
113
114.pushAndPrintSerial:
115.pushAndPrint:
116%endif
117
118 push cx ; Push print string
119 push ax ; Push high order digits, or port address, or N/A
120 push dx ; Push low order digit, or N/A
121
122 mov si, g_szDetectOuter ; Load SI with default wrapper string "IDE %s at %s: "
123
124 jmp short DetectPrint_BootMenuPrint_FormatCSSIfromParamsInSSBP_Relay
125
126
127;--------------------------------------------------------------------
128; DetectPrint_DriveNameFromBootnfoInESBX
129; Parameters:
130; ES:BX: Ptr to BOOTMENUINFO (if drive found)
131; Returns:
132; Nothing
133; Corrupts registers:
134; AX, SI
135;--------------------------------------------------------------------
136DetectPrint_DriveNameFromBootnfoInESBX:
137 push di
138 push bx
139
140 lea si, [bx+BOOTMENUINFO.szDrvName]
141 mov bx, es
142 CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromBXSI
143 CALL_DISPLAY_LIBRARY PrintNewlineCharacters
144
145 pop bx
146 pop di
147 ret
Note: See TracBrowser for help on using the repository browser.