source: xtideuniversalbios/tags/XTIDE_Universal_BIOS_v1.1.4/Src/Handlers/Int13h/AH8h_HParams.asm@ 462

Last change on this file since 462 was 35, checked in by Tomi Tilli, 14 years ago

Cleaned recent changes a bit to save few bytes.

File size: 3.9 KB
Line 
1; File name : AH8h_HParams.asm
2; Project name : IDE BIOS
3; Created date : 27.9.2007
4; Last update : 24.8.2010
5; Author : Tomi Tilli
6; Description : Int 13h function AH=8h, Read Disk Drive Parameters.
7
8; Section containing code
9SECTION .text
10
11;--------------------------------------------------------------------
12; Int 13h function AH=8h, Read Disk Drive Parameters.
13;
14; AH8h_HandlerForReadDiskDriveParameters
15; Parameters:
16; AH: Bios function 8h
17; DL: Drive number
18; Parameters loaded by Int13h_Jump:
19; DS: RAMVARS segment
20; Returns:
21; CH: Maximum cylinder number, bits 7...0
22; CL: Bits 7...6: Cylinder number bits 9...8
23; Bits 5...0: Maximum sector number (1...63)
24; DH: Maximum head number (0...255)
25; DL: Number of drives
26; AH: Int 13h/40h floppy return status
27; CF: 0 if successfull, 1 if error
28; IF: 1
29; Corrupts registers:
30; Flags
31;--------------------------------------------------------------------
32ALIGN JUMP_ALIGN
33AH8h_HandlerForReadDiskDriveParameters:
34 call RamVars_IsDriveHandledByThisBIOS
35 jnc SHORT .GetDriveParametersForForeignHardDiskInDL
36
37 push bx
38 call AH8h_GetDriveParameters
39 pop bx
40 jmp Int13h_ReturnWithValueInDL
41
42ALIGN JUMP_ALIGN
43.GetDriveParametersForForeignHardDiskInDL:
44 call Int13h_CallPreviousInt13hHandler
45 call RamVars_GetCountOfKnownDrivesToDL
46 jmp Int13h_ReturnWithValueInDL
47
48
49;--------------------------------------------------------------------
50; Returns L-CHS parameters for drive and total hard disk count.
51;
52; AH8h_GetDriveParameters
53; Parameters:
54; DL: Drive number
55; DS: RAMVARS segment
56; Returns:
57; CH: Maximum cylinder number, bits 7...0
58; CL: Bits 7...6: Cylinder number bits 9...8
59; Bits 5...0: Maximum sector number (1...63)
60; DH: Maximum head number (0...255)
61; DL: Number of drives
62; DS:DI: Ptr to DPT
63; AH: Int 13h/40h floppy return status
64; CF: 0 if successfull, 1 if error
65; Corrupts registers:
66; AL, BX
67;--------------------------------------------------------------------
68ALIGN JUMP_ALIGN
69AH8h_GetDriveParameters:
70 call FindDPT_ForDriveNumber
71 call AccessDPT_GetLCHSfromPCHS ; AX=sectors, BX=cylinders, DX=heads
72 call AH8h_ReserveCylinders
73 call AH8h_PackReturnValues
74 xor ax, ax ; Clear AH and CF
75 ret
76
77
78;--------------------------------------------------------------------
79; Reserves diagnostic cylinder if so configured.
80;
81; AH8h_ReserveCylinders
82; Parameters:
83; BX: Total number of L-CHS cylinders available
84; DS:DI: Ptr to DPT
85; Returns:
86; BX: Number of L-CHS cylinders available after reserving
87; Corrupts registers:
88; CX
89;--------------------------------------------------------------------
90ALIGN JUMP_ALIGN
91AH8h_ReserveCylinders:
92 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_MAXSIZE
93 jnz SHORT .Return
94 dec bx ; Reserve diagnostic cylinder
95ALIGN JUMP_ALIGN
96.Return:
97 ret
98
99
100;--------------------------------------------------------------------
101; Packs L-CHS values to INT 13h, AH=08h return values.
102;
103; AH8h_PackReturnValues
104; Parameters:
105; AX: Number of L-CHS sectors per track (1...63)
106; BX: Number of L-CHS cylinders available (1...1024)
107; DX: Number of L-CHS heads (1...256)
108; DS: RAMVARS segment
109; Returns:
110; CH: Maximum cylinder number, bits 7...0
111; CL: Bits 7...6: Cylinder number bits 9...8
112; Bits 5...0: Maximum sector number (1...63)
113; DH: Maximum head number (0...255)
114; DL: Number of drives
115; Corrupts registers:
116; AX, BX
117;--------------------------------------------------------------------
118ALIGN JUMP_ALIGN
119AH8h_PackReturnValues:
120 dec bx ; Cylinder count to last cylinder
121 dec dx ; Head count to max head number
122 mov dh, dl ; Max head number to DH
123 mov ch, bl ; Cylinder bits 7...0 to CH
124 mov cl, bh ; Cylinder bits 9...8 to CL
125 eROR_IM cl, 2 ; Cylinder bits 9...8 to CL bits 7...6
126 or cl, al ; Sectors per track to CL bits 5...0
127 jmp RamVars_GetCountOfKnownDrivesToDL
Note: See TracBrowser for help on using the repository browser.