Changeset 99 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm
- Timestamp:
- Jan 31, 2011, 11:27:17 AM (14 years ago)
- google:author:
- aitotat
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm
r3 r99 1 ; File name : AtaID.asm 2 ; Project name : IDE BIOS 3 ; Created date : 6.4.2010 4 ; Last update : 9.4.2010 5 ; Author : Tomi Tilli 1 ; Project name : XTIDE Universal BIOS 6 2 ; Description : Functions for accessing ATA information read with 7 3 ; IDENTIFY DEVICE command. … … 11 7 12 8 ;-------------------------------------------------------------------- 13 ; Returns P-CHS values from ATA information.14 ;15 9 ; AtaID_GetPCHS 16 10 ; Parameters: … … 18 12 ; Returns: 19 13 ; AX: Number of user specified P-CHS cylinders 20 ; B L: Number of user specified P-CHS sectors per track21 ; B H: Number of user specified P-CHS heads14 ; BH: Number of user specified P-CHS sectors per track 15 ; BL: Number of user specified P-CHS heads 22 16 ; Corrupts registers: 23 17 ; Nothing 24 18 ;-------------------------------------------------------------------- 25 ALIGN JUMP_ALIGN26 19 AtaID_GetPCHS: 27 20 mov ax, [es:si+ATA1.wCylCnt] ; Cylinders (1...16383) 28 mov b h, [es:si+ATA1.wHeadCnt] ; Heads (1...16)29 mov b l, [es:si+ATA1.wSPT] ; Sectors per Track (1...63)21 mov bl, [es:si+ATA1.wHeadCnt] ; Heads (1...16) 22 mov bh, [es:si+ATA1.wSPT] ; Sectors per Track (1...63) 30 23 ret 31 24 32 25 33 26 ;-------------------------------------------------------------------- 34 ; Returns total number of available sectors from ATA information.35 ;36 27 ; AtaID_GetTotalSectorCount 37 28 ; Parameters: … … 42 33 ; Nothing 43 34 ;-------------------------------------------------------------------- 44 ALIGN JUMP_ALIGN45 35 AtaID_GetTotalSectorCount: 36 push ds 37 38 push es 39 pop ds 46 40 xor bx, bx 47 test WORD [ es:si+ATA1.wCaps], A1_wCaps_LBA48 jz SHORT AtaID_GetChsSectorCount49 ; Fall to AtaID_GetLbaSectorCount41 test WORD [si+ATA1.wCaps], A1_wCaps_LBA 42 jz SHORT .GetChsSectorCount 43 ; Fall to .GetLbaSectorCount 50 44 51 45 ;-------------------------------------------------------------------- 52 ; Returns total number of available sectors for LBA addressing. 53 ; 54 ; AtaID_GetLbaSectorCount 46 ; .GetLbaSectorCount 55 47 ; Parameters: 56 48 ; BX: Zero 57 ; ES:SI: Ptr to 512-byte ATA information read from the drive49 ; DS:SI: Ptr to 512-byte ATA information read from the drive 58 50 ; Returns: 59 51 ; BX:DX:AX: 48-bit sector count … … 61 53 ; Nothing 62 54 ;-------------------------------------------------------------------- 63 ;ALIGN JUMP_ALIGN 64 AtaID_GetLbaSectorCount: 65 test WORD [es:si+ATA6.wSetSup83], A6_wSetSup83_LBA48 55 .GetLbaSectorCount: 56 test WORD [si+ATA6.wSetSup83], A6_wSetSup83_LBA48 66 57 jz SHORT .GetLba28SectorCount 67 mov ax, [es:si+ATA6.qwLBACnt] 68 mov dx, [es:si+ATA6.qwLBACnt+2] 69 mov bx, [es:si+ATA6.qwLBACnt+4] 58 mov ax, [si+ATA6.qwLBACnt] 59 mov dx, [si+ATA6.qwLBACnt+2] 60 mov bx, [si+ATA6.qwLBACnt+4] 61 pop ds 70 62 ret 71 ALIGN JUMP_ALIGN72 63 .GetLba28SectorCount: 73 mov ax, [es:si+ATA1.dwLBACnt] 74 mov dx, [es:si+ATA1.dwLBACnt+2] 64 mov ax, [si+ATA1.dwLBACnt] 65 mov dx, [si+ATA1.dwLBACnt+2] 66 pop ds 75 67 ret 76 68 77 69 ;-------------------------------------------------------------------- 78 ; Returns total number of available sectors for P-CHS addressing. 79 ; 80 ; AtaID_GetChsSectorCount 70 ; .GetChsSectorCount 81 71 ; Parameters: 82 ; ES:SI: Ptr to 512-byte ATA information read from the drive72 ; DS:SI: Ptr to 512-byte ATA information read from the drive 83 73 ; Returns: 84 74 ; DX:AX: 24-bit sector count … … 86 76 ; Nothing 87 77 ;-------------------------------------------------------------------- 88 ALIGN JUMP_ALIGN 89 AtaID_GetChsSectorCount: 90 m ov al, [es:si+ATA1.wSPT] ; AL=Sectors per track91 mul BYTE [es:si+ATA1.wHeadCnt] ; AX=Sectors per track * number of heads92 mul WORD [es:si+ATA1.wCylCnt] ; DX:AX=Sectors per track * number of heads * number of cylinders78 .GetChsSectorCount: 79 mov al, [si+ATA1.wSPT] ; AL=Sectors per track 80 mul BYTE [si+ATA1.wHeadCnt] ; AX=Sectors per track * number of heads 81 mul WORD [si+ATA1.wCylCnt] ; DX:AX=Sectors per track * number of heads * number of cylinders 82 pop ds 93 83 ret
Note:
See TracChangeset
for help on using the changeset viewer.