source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH8h_HParams.asm@ 106

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

Changes to XTIDE Universal BIOS:

  • Diagnostic cylinder can no longer be reserved.
File size: 3.3 KB
Line 
1; Project name : XTIDE Universal BIOS
2; Description : Int 13h function AH=8h, Read Disk Drive Parameters.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; Int 13h function AH=8h, Read Disk Drive Parameters.
9;
10; AH8h_HandlerForReadDiskDriveParameters
11; Parameters:
12; AH: Bios function 8h
13; DL: Drive number
14; Parameters loaded by Int13h_Jump:
15; DS: RAMVARS segment
16; Returns:
17; CH: Maximum cylinder number, bits 7...0
18; CL: Bits 7...6: Cylinder number bits 9...8
19; Bits 5...0: Maximum sector number (1...63)
20; DH: Maximum head number (0...255)
21; DL: Number of drives
22; AH: Int 13h/40h floppy return status
23; CF: 0 if successfull, 1 if error
24; IF: 1
25; Corrupts registers:
26; Flags
27;--------------------------------------------------------------------
28ALIGN JUMP_ALIGN
29AH8h_HandlerForReadDiskDriveParameters:
30 call RamVars_IsDriveHandledByThisBIOS
31 jnc SHORT .GetDriveParametersForForeignHardDiskInDL
32
33 push bx
34 call AH8h_GetDriveParameters
35 pop bx
36 jmp Int13h_ReturnWithValueInDL
37
38ALIGN JUMP_ALIGN
39.GetDriveParametersForForeignHardDiskInDL:
40 call Int13h_CallPreviousInt13hHandler
41 jc SHORT .ReturnErrorFromPreviousInt13hHandler
42 call RamVars_GetCountOfKnownDrivesToDL
43 jmp Int13h_ReturnWithValueInDL
44.ReturnErrorFromPreviousInt13hHandler:
45 jmp Int13h_PopDiDsAndReturn
46
47
48;--------------------------------------------------------------------
49; Returns L-CHS parameters for drive and total hard disk count.
50;
51; AH8h_GetDriveParameters
52; Parameters:
53; DL: Drive number
54; DS: RAMVARS segment
55; Returns:
56; CH: Maximum cylinder number, bits 7...0
57; CL: Bits 7...6: Cylinder number bits 9...8
58; Bits 5...0: Maximum sector number (1...63)
59; DH: Maximum head number (0...255)
60; DL: Number of drives
61; DS:DI: Ptr to DPT
62; AH: Int 13h/40h floppy return status
63; CF: 0 if successfull, 1 if error
64; Corrupts registers:
65; AL, BX
66;--------------------------------------------------------------------
67ALIGN JUMP_ALIGN
68AH8h_GetDriveParameters:
69 call FindDPT_ForDriveNumber
70 call AccessDPT_GetLCHSfromPCHS ; AX=sectors, BX=cylinders, DX=heads
71 call AH8h_PackReturnValues
72 xor ax, ax ; Clear AH and CF
73 ret
74
75
76;--------------------------------------------------------------------
77; Packs L-CHS values to INT 13h, AH=08h return values.
78;
79; AH8h_PackReturnValues
80; Parameters:
81; AX: Number of L-CHS sectors per track (1...63)
82; BX: Number of L-CHS cylinders available (1...1024)
83; DX: Number of L-CHS heads (1...256)
84; DS: RAMVARS segment
85; Returns:
86; CH: Maximum cylinder number, bits 7...0
87; CL: Bits 7...6: Cylinder number bits 9...8
88; Bits 5...0: Maximum sector number (1...63)
89; DH: Maximum head number (0...255)
90; DL: Number of drives
91; Corrupts registers:
92; AX, BX
93;--------------------------------------------------------------------
94ALIGN JUMP_ALIGN
95AH8h_PackReturnValues:
96 dec bx ; Cylinder count to last cylinder
97 dec dx ; Head count to max head number
98 mov dh, dl ; Max head number to DH
99 mov ch, bl ; Cylinder bits 7...0 to CH
100 mov cl, bh ; Cylinder bits 9...8 to CL
101 eROR_IM cl, 2 ; Cylinder bits 9...8 to CL bits 7...6
102 or cl, al ; Sectors per track to CL bits 5...0
103 jmp RamVars_GetCountOfKnownDrivesToDL
Note: See TracBrowser for help on using the repository browser.