source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm@ 181

Last change on this file since 181 was 181, checked in by krille_n_@…, 14 years ago

Changes to all parts of the project:

  • Size optimizations.
  • Added a define (EXCLUDE_FROM_XTIDECFG) to exclude unused library code from XTIDECFG.
  • Tried to minimize time spent with interrupts disabled.
  • Some minor attempts to improve speed (reordering instructions etc).
  • Tried to improve readability, did some cleanup and fixed some errors in comments.
File size: 4.7 KB
RevLine 
[88]1; Project name : XTIDE Universal BIOS
[3]2; Description : Functions for printing drive configuration
3; information on Boot Menu.
4
5; Section containing code
6SECTION .text
7
8;--------------------------------------------------------------------
9; Prints Hard Disk configuration for drive handled by our BIOS.
10; Cursor is set to configuration header string position.
11;
12; BootMenuPrintCfg_ForOurDrive
13; Parameters:
[127]14; DS: Segment to DPT
15; Stack: Offset to DPT
[3]16; Returns:
17; Nothing
18; Corrupts registers:
[150]19; AX, BX, CX, DX, SI, DI
[3]20;--------------------------------------------------------------------
21ALIGN JUMP_ALIGN
22BootMenuPrintCfg_ForOurDrive:
[127]23 pop di
[96]24 mov si, g_szCfgHeader
25 call BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
[150]26 eMOVZX ax, BYTE [di+DPT.bIdevarsOffset]
27 xchg si, ax ; CS:SI now points to IDEVARS
[96]28 ; Fall to PushAndFormatCfgString
[3]29
30;--------------------------------------------------------------------
[96]31; PushAndFormatCfgString
[3]32; Parameters:
33; DS:DI: Ptr to DPT
34; CS:SI: Ptr to IDEVARS
35; Returns:
36; Nothing
37; Corrupts registers:
[88]38; AX, DX, SI, DI
[3]39;--------------------------------------------------------------------
[96]40PushAndFormatCfgString:
[88]41 push bp
42 mov bp, sp
[3]43 ; Fall to first push below
44
45;--------------------------------------------------------------------
[88]46; PushAddressingMode
[3]47; Parameters:
48; DS:DI: Ptr to DPT
49; CS:SI: Ptr to IDEVARS
50; Returns:
[88]51; Nothing (jumps to next push below)
[3]52; Corrupts registers:
[96]53; AX
[3]54;--------------------------------------------------------------------
[88]55PushAddressingMode:
[150]56 call AccessDPT_GetAddressingModeForWordLookToBX
57 push WORD [cs:bx+rgszAddressingModeString]
[3]58
59;--------------------------------------------------------------------
[88]60; PushBlockMode
[3]61; Parameters:
62; DS:DI: Ptr to DPT
63; CS:SI: Ptr to IDEVARS
64; Returns:
65; Nothing (falls to next push below)
66; Corrupts registers:
[88]67; AX
[3]68;--------------------------------------------------------------------
[88]69PushBlockMode:
[150]70 mov ax, 1
[158]71 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED
[150]72 jz SHORT .PushBlockSizeFromAX
73 mov al, [di+DPT_ATA.bSetBlock]
74.PushBlockSizeFromAX:
[3]75 push ax
76
77;--------------------------------------------------------------------
[88]78; PushBusType
[3]79; Parameters:
80; DS:DI: Ptr to DPT
81; CS:SI: Ptr to IDEVARS
82; Returns:
83; Nothing (jumps to next push below)
84; Corrupts registers:
85; AX, DX
86;--------------------------------------------------------------------
[181]87;PushBusType:
88 cwd ; Clear DX using sign extension
[3]89 xchg ax, bx ; Store BX to AX
[150]90 eMOVZX bx, BYTE [cs:si+IDEVARS.bDevice]
91 mov bx, [cs:bx+rgwBusTypeValues] ; Char to BL, Int to BH
[181]92 mov dl, bh
[88]93 push bx ; Push character
[150]94 push dx ; Push 1, 8, 16 or 32
[3]95 xchg bx, ax ; Restore BX
96
97;--------------------------------------------------------------------
[88]98; PushIRQ
[3]99; Parameters:
100; DS:DI: Ptr to DPT
101; CS:SI: Ptr to IDEVARS
102; Returns:
103; Nothing (falls to next push below)
104; Corrupts registers:
[88]105; AX, DX
[3]106;--------------------------------------------------------------------
[88]107PushIRQ:
108 mov dl, ' ' ; Load space to DL
109 mov al, [cs:si+IDEVARS.bIRQ]
110 test al, al ; Interrupts disabled?
111 jz SHORT .PushIrqDisabled
112 add al, '0' ; Digit to ASCII
113 cmp al, '9' ; Only one digit needed?
114 jbe SHORT .PushCharacters
115
116 ; Two digits needed
117 sub al, 10 ; Limit to single digit ASCII
118 mov dl, '1' ; Load '1 to DX
119 jmp SHORT .PushCharacters
120ALIGN JUMP_ALIGN
121.PushIrqDisabled:
122 mov al, '-' ; Load line to AL
123 xchg ax, dx ; Space to AL, line to DL
124ALIGN JUMP_ALIGN
125.PushCharacters:
126 push dx
[3]127 push ax
128
129;--------------------------------------------------------------------
[88]130; PushResetStatus
[3]131; Parameters:
132; DS:DI: Ptr to DPT
133; CS:SI: Ptr to IDEVARS
134; Returns:
[88]135; Nothing (falls to next push below)
[3]136; Corrupts registers:
[88]137; AX
[3]138;--------------------------------------------------------------------
[88]139PushResetStatus:
[158]140 mov al, [di+DPT.bFlagsHigh]
141 and ax, MASKH_DPT_RESET
[88]142 push ax
[3]143
144;--------------------------------------------------------------------
[96]145; PrintValuesFromStack
[3]146; Parameters:
147; Stack: All formatting parameters
148; Returns:
149; Nothing
150; Corrupts registers:
[88]151; AX, SI, DI
[3]152;--------------------------------------------------------------------
[96]153PrintValuesFromStack:
[3]154 mov si, g_szCfgFormat
[127]155 jmp BootMenuPrint_FormatCSSIfromParamsInSSBP
[96]156
157
[150]158ALIGN WORD_ALIGN
159rgszAddressingModeString:
160 dw g_szLCHS
161 dw g_szPCHS
162 dw g_szLBA28
163 dw g_szLBA48
164
165rgwBusTypeValues:
166 db 'D', 8 ; DEVICE_8BIT_DUAL_PORT_XTIDE
167 db 'X', 8 ; DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0
168 db 'S', 8 ; DEVICE_8BIT_SINGLE_PORT
169 db ' ', 16 ; DEVICE_16BIT_ATA
170 db ' ', 32 ; DEVICE_32BIT_ATA
171 db ' ', 1 ; DEVICE_SERIAL_PORT
Note: See TracBrowser for help on using the repository browser.