source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Boot/BootInfo.asm@ 252

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

Changes to XTIDE Universal BIOS:

  • Boot menu now shows only one capacity.
  • Added "strings" makefile target to compress strings.
File size: 2.7 KB
RevLine 
[88]1; Project name : XTIDE Universal BIOS
[3]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 BOOTNFO struct for detected hard disk.
10;
11; BootInfo_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 BOOTNFO (if successful)
18; Corrupts registers:
[241]19; AX, BX, CX, DX, DI, SI
[3]20;--------------------------------------------------------------------
21BootInfo_CreateForHardDisk:
[241]22 call BootInfo_ConvertDPTtoBX ; ES:BX now points to new BOOTNFO
23 push bx ; Preserve for return
[3]24
[241]25 mov di, bx ; Starting pointer at beginning of structure
[3]26
[241]27;
28; Store Drive Name
29;
30 push ds ; Preserve RAMVARS
31 push si ; Preserve SI for call to GetTotalSectorCount...
[3]32
[241]33 push es ; ES copied to DS
[3]34 pop ds
[241]35
[100]36 add si, BYTE ATA1.strModel ; DS:SI now points drive name
37 lea di, [bx+BOOTNFO.szDrvName] ; ES:DI now points to name destination
[121]38 mov cx, LEN_BOOTNFO_DRV / 2 ; Max number of WORDs allowed
39.CopyNextWord:
40 lodsw
41 xchg al, ah ; Change endianness
42 stosw
43 loop .CopyNextWord
[128]44 xor ax, ax ; Zero AX and clear CF
[241]45 stosw ; Terminate with NULL
[3]46
47 pop si
48 pop ds
[241]49
50;
51; Store Sector Count
52;
53 call AtaID_GetTotalSectorCountToBXDXAXfromAtaInfoInESSI
54
55 stosw
56 xchg ax, dx
57 stosw
58 xchg ax, bx
59 stosw
60
61 pop bx
62
[3]63 ret
64
[252]65
[3]66;--------------------------------------------------------------------
67; BootInfo_GetTotalSectorCount
68; Parameters:
[241]69; DS:DI: DPT Pointer
[3]70; Returns:
71; BX:DX:AX: 48-bit sector count
72; Corrupts registers:
[252]73; CX
[128]74;--------------------------------------------------------------------
[3]75ALIGN JUMP_ALIGN
76BootInfo_GetTotalSectorCount:
[252]77 test BYTE [di+DPT.bFlagsLow], FLG_DRVNHEAD_LBA
78 jnz SHORT .ReturnFullCapacity
79 jmp AH15h_GetSectorCountToBXDXAX
80.ReturnFullCapacity:
81 jmp AccessDPT_GetLbaSectorCountToBXDXAX
[100]82
83
84;--------------------------------------------------------------------
[241]85; Returns offset to BOOTNFO based on DPT pointer.
[100]86;
[241]87; BootInfo_ConvertDPTtoBX
[100]88; Parameters:
[241]89; DS:DI: DPT Pointer
[100]90; Returns:
91; BX: Offset to BOOTNFO struct
92; Corrupts registers:
93; AX
94;--------------------------------------------------------------------
95ALIGN JUMP_ALIGN
[241]96BootInfo_ConvertDPTtoBX:
97 mov ax, di
98 sub ax, RAMVARS_size ; subtract off base of DPTs
99 mov bl, DPT_BOOTNFO_SIZE_MULTIPLIER ; BOOTNFO's are a whole number multiple of DPT size
100 mul bl
101 add ax, BOOTVARS.rgBootNfo ; add base of BOOTNFO
102 xchg ax, bx
103 ret
Note: See TracBrowser for help on using the repository browser.