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

Last change on this file since 195 was 173, checked in by aitotat@…, 13 years ago

Changes to XTIDE Universal BIOS:

  • L-CHS parameters are now generated differently for LBA enabled drives.
  • Booting to EBIOS partitions now seems to work (at least on one drive).
File size: 3.2 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; 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;--------------------------------------------------------------------
24ALIGN JUMP_ALIGN
25AH8h_HandlerForReadDiskDriveParameters:
26 call RamVars_IsDriveHandledByThisBIOS
27 jnc SHORT .GetDriveParametersForForeignHardDiskInDL
28 call AH8h_GetDriveParameters
29 jmp SHORT .ReturnAfterStoringValuesToIntpack
30
31.GetDriveParametersForForeignHardDiskInDL:
32 call Int13h_CallPreviousInt13hHandler
33 jc SHORT .ReturnErrorFromPreviousInt13hHandler
34 call RamVars_GetCountOfKnownDrivesToDL
35.ReturnAfterStoringValuesToIntpack:
36 mov [bp+IDEPACK.intpack+INTPACK.cx], cx
37 mov [bp+IDEPACK.intpack+INTPACK.dx], dx
38 xor ah, ah
39.ReturnErrorFromPreviousInt13hHandler:
40 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
41
42
43;--------------------------------------------------------------------
44; Returns L-CHS parameters for drive and total hard disk count.
45;
46; AH8h_GetDriveParameters
47; Parameters:
48; DS:DI: Ptr to DPT (in RAMVARS segment)
49; Returns:
50; CH: Maximum cylinder number, bits 7...0
51; CL: Bits 7...6: Cylinder number bits 9...8
52; Bits 5...0: Maximum sector number (1...63)
53; DH: Maximum head number (0...255)
54; DL: Number of drives
55; Corrupts registers:
56; AX, BX
57;--------------------------------------------------------------------
58ALIGN JUMP_ALIGN
59AH8h_GetDriveParameters:
60 call AccessDPT_GetLCHS ; AX=sectors, BX=cylinders, DX=heads
61 ; Fall to .PackReturnValues
62
63;--------------------------------------------------------------------
64; Packs L-CHS values to INT 13h, AH=08h return values.
65;
66; .PackReturnValues
67; Parameters:
68; AX: Number of L-CHS sectors per track (1...63)
69; BX: Number of L-CHS cylinders available (1...1024)
70; DX: Number of L-CHS heads (1...256)
71; DS: RAMVARS segment
72; Returns:
73; CH: Maximum cylinder number, bits 7...0
74; CL: Bits 7...6: Cylinder number bits 9...8
75; Bits 5...0: Maximum sector number (1...63)
76; DH: Maximum head number (0...255)
77; DL: Number of drives
78; Corrupts registers:
79; AX, BX
80;--------------------------------------------------------------------
81.PackReturnValues:
82 dec bx ; Cylinder count to last cylinder
83 dec dx ; Head count to max head number
84 mov dh, dl ; Max head number to DH
85 mov ch, bl ; Cylinder bits 7...0 to CH
86 mov cl, bh ; Cylinder bits 9...8 to CL
87 eROR_IM cl, 2 ; Cylinder bits 9...8 to CL bits 7...6
88 or cl, al ; Sectors per track to CL bits 5...0
89 jmp RamVars_GetCountOfKnownDrivesToDL
Note: See TracBrowser for help on using the repository browser.