Changeset 241 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Boot/BootInfo.asm
- Timestamp:
- Feb 9, 2012, 11:08:59 AM (13 years ago)
- google:author:
- gregli@hotmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Boot/BootInfo.asm
r181 r241 16 16 ; Returns: 17 17 ; ES:BX: Ptr to BOOTNFO (if successful) 18 ; CF: Cleared if BOOTNFO created succesfully19 ; Set if any error20 18 ; Corrupts registers: 21 ; AX, BX, CX, DX 19 ; AX, BX, CX, DX, DI, SI 22 20 ;-------------------------------------------------------------------- 23 21 BootInfo_CreateForHardDisk: 24 call BootInfo_ GetOffsetToBX ; ES:BX now points to new BOOTNFO25 ; Fall to .StoreSectorCount22 call BootInfo_ConvertDPTtoBX ; ES:BX now points to new BOOTNFO 23 push bx ; Preserve for return 26 24 27 ;-------------------------------------------------------------------- 28 ; .StoreSectorCount 29 ; Parameters: 30 ; ES:BX: Ptr to BOOTNFO 31 ; ES:SI: Ptr to 512-byte ATA information read from the drive 32 ; DS:DI: Ptr to Disk Parameter Table 33 ; Returns: 34 ; Nothing 35 ; Corrupts registers: 36 ; AX, CX, DX 37 ;-------------------------------------------------------------------- 38 .StoreSectorCount: 39 push bx 40 call AtaID_GetTotalSectorCountToBXDXAXfromAtaInfoInESSI 41 mov cx, bx ; Now in CX:DX:AX 42 pop bx 43 mov [es:bx+BOOTNFO.twSectCnt], ax 44 mov [es:bx+BOOTNFO.twSectCnt+2], dx 45 mov [es:bx+BOOTNFO.twSectCnt+4], cx 46 ; Fall to .StoreDriveName 25 mov di, bx ; Starting pointer at beginning of structure 47 26 48 ;-------------------------------------------------------------------- 49 ; .StoreDriveName 50 ; Parameters: 51 ; ES:BX: Ptr to BOOTNFO 52 ; ES:SI: Ptr to 512-byte ATA information read from the drive 53 ; DS:DI: Ptr to Disk Parameter Table 54 ; Returns: 55 ; CF: Cleared if variables stored succesfully 56 ; Set if any error 57 ; Corrupts registers: 58 ; AX, CX 59 ;-------------------------------------------------------------------- 60 .StoreDriveName: 61 push ds 62 push si 63 push di 27 ; 28 ; Store Drive Name 29 ; 30 push ds ; Preserve RAMVARS 31 push si ; Preserve SI for call to GetTotalSectorCount... 64 32 65 push es 33 push es ; ES copied to DS 66 34 pop ds 35 67 36 add si, BYTE ATA1.strModel ; DS:SI now points drive name 68 37 lea di, [bx+BOOTNFO.szDrvName] ; ES:DI now points to name destination … … 74 43 loop .CopyNextWord 75 44 xor ax, ax ; Zero AX and clear CF 76 stos b; Terminate with NULL45 stosw ; Terminate with NULL 77 46 78 pop di79 47 pop si 80 48 pop ds 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 81 63 ret 82 64 83 65 84 66 ;-------------------------------------------------------------------- 85 67 ; Finds BOOTNFO for drive and returns total sector count. … … 87 69 ; BootInfo_GetTotalSectorCount 88 70 ; Parameters: 89 ; DL: Drive number 90 ; DS: RAMVARS segment 71 ; DS:DI: DPT Pointer 91 72 ; Returns: 92 73 ; BX:DX:AX: 48-bit sector count … … 97 78 BootInfo_GetTotalSectorCount: 98 79 push ds 99 call BootInfo_ GetOffsetToBX80 call BootInfo_ConvertDPTtoBX 100 81 LOAD_BDA_SEGMENT_TO ds, ax 101 82 mov ax, [bx+BOOTNFO.twSectCnt] … … 107 88 108 89 ;-------------------------------------------------------------------- 109 ; Returns offset to BOOTNFO for wanted drive.90 ; Returns offset to BOOTNFO based on DPT pointer. 110 91 ; 111 ; BootInfo_ GetOffsetToBX92 ; BootInfo_ConvertDPTtoBX 112 93 ; Parameters: 113 ; DL: Drive number 114 ; DS: RAMVARS segment 94 ; DS:DI: DPT Pointer 115 95 ; Returns: 116 96 ; BX: Offset to BOOTNFO struct … … 119 99 ;-------------------------------------------------------------------- 120 100 ALIGN JUMP_ALIGN 121 BootInfo_ GetOffsetToBX:122 mov bl, dl ; Copy drive number to BL123 mov al, BOOTNFO_size ; Size of struct124 sub bl, [RAMVARS.bFirstDrv] ; Drive number to index125 mul bl ; AX = Offset inside BOOTNFO array126 add ax, BOOTVARS.rgBootNfo ; Add offset to BOOTNFO array127 xchg bx, ax ; Move result to BX128 ret 101 BootInfo_ConvertDPTtoBX: 102 mov ax, di 103 sub ax, RAMVARS_size ; subtract off base of DPTs 104 mov bl, DPT_BOOTNFO_SIZE_MULTIPLIER ; BOOTNFO's are a whole number multiple of DPT size 105 mul bl 106 add ax, BOOTVARS.rgBootNfo ; add base of BOOTNFO 107 xchg ax, bx 108 ret
Note:
See TracChangeset
for help on using the changeset viewer.