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