source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuInfo.asm@ 371

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

Removed align directives for initalization code and added define for align in boot-time calls to the assembly library (defaulting to 1), resulting in a significant savings for the AT and 386 builds. Fixed a bug with switch command line handling in the serial server. Put in CR characters in licesnse.txt, so that it properly displays on Windows. In the configurator, added default values for user supplied CHS and LBA values, defaulting to values within range when those features are enabled. Updated the copyright message in the configurator as the literal word Copyright is important.

File size: 2.4 KB
Line 
1; Project name : XTIDE Universal BIOS
2; Description : Functions for generating and accessing drive
3; information to be displayed on boot menu.
4
5; Section containing code
6SECTION .text
7
8;--------------------------------------------------------------------
9; Creates new BOOTMENUINFO struct for detected hard disk.
10;
11; BootMenuInfo_CreateForHardDisk
12; Parameters:
13; DL: Drive number
14; DS:DI: Ptr to Disk Parameter Table
15; ES:SI: Ptr to 512-byte ATA information read from the drive
16; Returns:
17; ES:BX: Ptr to BOOTMENUINFO (if successful)
18; Corrupts registers:
19; AX, BX, CX, DX, DI
20;--------------------------------------------------------------------
21BootMenuInfo_CreateForHardDisk:
22 call BootMenuInfo_ConvertDPTtoBX ; ES:BX now points to new BOOTMENUINFO
23
24 ; Store Drive Name
25 push ds ; Preserve RAMVARS
26 push si
27
28 push es ; ES copied to DS
29 pop ds
30
31 add si, BYTE ATA1.strModel ; DS:SI now points drive name
32 lea di, [bx+BOOTMENUINFO.szDrvName] ; ES:DI now points to name destination
33 mov cx, MAX_HARD_DISK_NAME_LENGTH / 2 ; Max number of WORDs allowed
34.CopyNextWord:
35 lodsw
36 xchg al, ah ; Change endianness
37 stosw
38 loop .CopyNextWord
39 xor ax, ax ; Zero AX and clear CF
40 stosw ; Terminate with NULL
41
42 pop si
43 pop ds
44
45 ret
46
47
48;--------------------------------------------------------------------
49; BootMenuInfo_GetTotalSectorCount
50; Parameters:
51; DS:DI: DPT Pointer
52; Returns:
53; BX:DX:AX: 48-bit sector count
54; Corrupts registers:
55; CX
56;--------------------------------------------------------------------
57BootMenuInfo_GetTotalSectorCount:
58 test BYTE [di+DPT.bFlagsLow], FLG_DRVNHEAD_LBA
59 jnz SHORT .ReturnFullCapacity
60 jmp AH15h_GetSectorCountToBXDXAX
61.ReturnFullCapacity:
62 jmp AccessDPT_GetLbaSectorCountToBXDXAX
63
64
65;--------------------------------------------------------------------
66; Returns offset to BOOTMENUINFO based on DPT pointer.
67;
68; BootMenuInfo_ConvertDPTtoBX
69; Parameters:
70; DS:DI: DPT Pointer
71; Returns:
72; BX: Offset to BOOTMENUINFO struct
73; Corrupts registers:
74; AX
75;--------------------------------------------------------------------
76BootMenuInfo_ConvertDPTtoBX:
77 mov ax, di
78 sub ax, BYTE RAMVARS_size ; subtract off base of DPTs
79 mov bl, DPT_BOOTMENUINFO_SIZE_MULTIPLIER ; BOOTMENUINFO's are a whole number multiple of DPT size
80 mul bl
81 add ax, BOOTVARS.rgBootNfo ; add base of BOOTMENUINFO
82 xchg ax, bx
83 ret
Note: See TracBrowser for help on using the repository browser.