1 | ; Project name : XTIDE Universal BIOS |
---|
2 | ; Description : Int 13h function AH=8h, Read Disk Drive Parameters. |
---|
3 | |
---|
4 | ; Section containing code |
---|
5 | SECTION .text |
---|
6 | |
---|
7 | ;-------------------------------------------------------------------- |
---|
8 | ; Int 13h function AH=8h, Read Disk Drive Parameters. |
---|
9 | ; |
---|
10 | ; AH8h_HandlerForReadDiskDriveParameters |
---|
11 | ; Parameters: |
---|
12 | ; DL: Translated Drive number |
---|
13 | ; DS:DI: Ptr to DPT (in RAMVARS segment) |
---|
14 | ; SS:BP: Ptr to IDEPACK |
---|
15 | ; Returns with INTPACK: |
---|
16 | ; CH: Maximum cylinder number, bits 7...0 |
---|
17 | ; CL: Bits 7...6: Cylinder number bits 9...8 |
---|
18 | ; Bits 5...0: Maximum sector number (1...63) |
---|
19 | ; DH: Maximum head number (0...255) |
---|
20 | ; DL: Number of drives |
---|
21 | ; AH: Int 13h/40h floppy return status |
---|
22 | ; CF: 0 if successfull, 1 if error |
---|
23 | ;-------------------------------------------------------------------- |
---|
24 | AH8h_HandlerForReadDiskDriveParameters: |
---|
25 | call RamVars_IsDriveHandledByThisBIOS |
---|
26 | jnc SHORT .GetDriveParametersForForeignHardDiskInDL |
---|
27 | call AH8h_GetDriveParameters |
---|
28 | jmp SHORT .ReturnAfterStoringValuesToIntpack |
---|
29 | |
---|
30 | .GetDriveParametersForForeignHardDiskInDL: |
---|
31 | call Int13h_CallPreviousInt13hHandler |
---|
32 | jc SHORT .ReturnErrorFromPreviousInt13hHandler |
---|
33 | call RamVars_GetCountOfKnownDrivesToDL |
---|
34 | .ReturnAfterStoringValuesToIntpack: |
---|
35 | mov [bp+IDEPACK.intpack+INTPACK.cx], cx |
---|
36 | mov [bp+IDEPACK.intpack+INTPACK.dx], dx |
---|
37 | xor ah, ah |
---|
38 | .ReturnErrorFromPreviousInt13hHandler: |
---|
39 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH |
---|
40 | |
---|
41 | |
---|
42 | ;-------------------------------------------------------------------- |
---|
43 | ; Returns L-CHS parameters for drive and total hard disk count. |
---|
44 | ; |
---|
45 | ; AH8h_GetDriveParameters |
---|
46 | ; Parameters: |
---|
47 | ; DS:DI: Ptr to DPT (in RAMVARS segment) |
---|
48 | ; Returns: |
---|
49 | ; CH: Maximum cylinder number, bits 7...0 |
---|
50 | ; CL: Bits 7...6: Cylinder number bits 9...8 |
---|
51 | ; Bits 5...0: Maximum sector number (1...63) |
---|
52 | ; DH: Maximum head number (0...255) |
---|
53 | ; DL: Number of drives |
---|
54 | ; Corrupts registers: |
---|
55 | ; AX, BX |
---|
56 | ;-------------------------------------------------------------------- |
---|
57 | AH8h_GetDriveParameters: |
---|
58 | call AccessDPT_GetLCHStoAXBLBH |
---|
59 | ; Fall to .PackReturnValues |
---|
60 | |
---|
61 | ;-------------------------------------------------------------------- |
---|
62 | ; Packs L-CHS values to INT 13h, AH=08h return values. |
---|
63 | ; |
---|
64 | ; .PackReturnValues |
---|
65 | ; Parameters: |
---|
66 | ; AX: Number of L-CHS cylinders available (1...1024) |
---|
67 | ; BL: Number of L-CHS heads (1...256) |
---|
68 | ; BH: Number of L-CHS sectors per track (1...63) |
---|
69 | ; DS: RAMVARS segment |
---|
70 | ; Returns: |
---|
71 | ; CH: Maximum cylinder number, bits 7...0 |
---|
72 | ; CL: Bits 7...6: Cylinder number bits 9...8 |
---|
73 | ; Bits 5...0: Maximum sector number (1...63) |
---|
74 | ; DH: Maximum head number (0...255) |
---|
75 | ; DL: Number of drives |
---|
76 | ; Corrupts registers: |
---|
77 | ; AX, BX |
---|
78 | ;-------------------------------------------------------------------- |
---|
79 | .PackReturnValues: |
---|
80 | dec ax ; AX = Number of last cylinder |
---|
81 | dec bx ; BL = Number of last head |
---|
82 | xchg cx, ax |
---|
83 | xchg cl, ch ; CH = Last cylinder bits 0...7 |
---|
84 | eROR_IM cl, 2 ; CL bits 6...7 = Last cylinder bits 8...9 |
---|
85 | or cl, bh ; CL bits 0...5 = Sectors per track |
---|
86 | mov dh, bl ; DH = Maximum head number |
---|
87 | jmp RamVars_GetCountOfKnownDrivesToDL |
---|