source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm@ 52

Last change on this file since 52 was 3, checked in by Tomi Tilli, 15 years ago
File size: 2.3 KB
RevLine 
[3]1; File name : AccessDPT.asm
2; Project name : IDE BIOS
3; Created date : 16.3.2010
4; Last update : 26.4.2010
5; Author : Tomi Tilli
6; Description : Functions for accessing DPT data.
7
8; Section containing code
9SECTION .text
10
11;--------------------------------------------------------------------
12; Returns L-CHS values from DPT.
13;
14; AccessDPT_GetLCHSfromPCHS
15; Parameters:
16; DS:DI: Ptr to Disk Parameter Table
17; Returns:
18; AX: Number of L-CHS sectors per track
19; BX: Number of L-CHS cylinders
20; DX: Number of L-CHS heads
21; Corrupts registers:
22; Nothing
23;--------------------------------------------------------------------
24ALIGN JUMP_ALIGN
25AccessDPT_GetLCHSfromPCHS:
26 xchg ax, cx
27 mov cl, [di+DPT.bShLtoP] ; Load shift count
28 mov bx, [di+DPT.wPCyls] ; Load P-CHS cylinders
29 shr bx, cl ; Shift to L-CHS cylinders
30 xchg cx, ax
31 mov dx, [di+DPT.wLHeads] ; Load L-CHS heads
32 eMOVZX ax, BYTE [di+DPT.bPSect] ; Load Sectors per track
33 ret
34
35
36;--------------------------------------------------------------------
37; Tests IDEVARS flags for master or slave drive.
38;
39; AccessDPT_TestIdeVarsFlagsForMasterOrSlaveDrive
40; Parameters:
41; AX: Bitmask to test DRVPARAMS.wFlags
42; DS:DI: Ptr to Disk Parameter Table
43; Returns:
44; ZF: Set if tested bit was zero
45; Cleared if tested bit was non-zero
46; CF: 0
47; Corrupts registers:
48; BX
49;--------------------------------------------------------------------
50ALIGN JUMP_ALIGN
51AccessDPT_TestIdeVarsFlagsForMasterOrSlaveDrive:
52 call AccessDPT_GetPointerToDRVPARAMStoCSBX
53 test [cs:bx+DRVPARAMS.wFlags], ax
54 ret
55
56;--------------------------------------------------------------------
57; Returns pointer to DRVPARAMS for master or slave drive.
58;
59; AccessDPT_GetPointerToDRVPARAMStoCSBX
60; Parameters:
61; DS:DI: Ptr to Disk Parameter Table
62; Returns:
63; CS:BX: Ptr to DRVPARAMS
64; Corrupts registers:
65; Nothing
66;--------------------------------------------------------------------
67ALIGN JUMP_ALIGN
68AccessDPT_GetPointerToDRVPARAMStoCSBX:
69 eMOVZX bx, [di+DPT.bIdeOff] ; CS:BX points to IDEVARS
70 test BYTE [di+DPT.bDrvSel], FLG_IDE_DRVHD_DRV
71 jnz SHORT .ReturnPointerToSlaveDRVPARAMS
72 add bx, BYTE IDEVARS.drvParamsMaster
73 ret
74ALIGN JUMP_ALIGN
75.ReturnPointerToSlaveDRVPARAMS:
76 add bx, BYTE IDEVARS.drvParamsSlave
77 ret
Note: See TracBrowser for help on using the repository browser.