[93] | 1 | ; Project name : XTIDE Universal BIOS
|
---|
[3] | 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:
|
---|
[148] | 12 | ; DL: Translated Drive number
|
---|
| 13 | ; DS:DI: Ptr to DPT (in RAMVARS segment)
|
---|
[150] | 14 | ; SS:BP: Ptr to IDEPACK
|
---|
| 15 | ; Returns with INTPACK:
|
---|
[3] | 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 | ALIGN JUMP_ALIGN
|
---|
| 25 | AH8h_HandlerForReadDiskDriveParameters:
|
---|
[32] | 26 | call RamVars_IsDriveHandledByThisBIOS
|
---|
| 27 | jnc SHORT .GetDriveParametersForForeignHardDiskInDL
|
---|
[3] | 28 | call AH8h_GetDriveParameters
|
---|
[148] | 29 | jmp SHORT .ReturnAfterStoringValuesToIntpack
|
---|
[3] | 30 |
|
---|
[32] | 31 | .GetDriveParametersForForeignHardDiskInDL:
|
---|
| 32 | call Int13h_CallPreviousInt13hHandler
|
---|
[43] | 33 | jc SHORT .ReturnErrorFromPreviousInt13hHandler
|
---|
[32] | 34 | call RamVars_GetCountOfKnownDrivesToDL
|
---|
[148] | 35 | .ReturnAfterStoringValuesToIntpack:
|
---|
[150] | 36 | mov [bp+IDEPACK.intpack+INTPACK.cx], cx
|
---|
| 37 | mov [bp+IDEPACK.intpack+INTPACK.dx], dx
|
---|
[148] | 38 | xor ah, ah
|
---|
[43] | 39 | .ReturnErrorFromPreviousInt13hHandler:
|
---|
[148] | 40 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
|
---|
[3] | 41 |
|
---|
[32] | 42 |
|
---|
[3] | 43 | ;--------------------------------------------------------------------
|
---|
| 44 | ; Returns L-CHS parameters for drive and total hard disk count.
|
---|
| 45 | ;
|
---|
[28] | 46 | ; AH8h_GetDriveParameters
|
---|
[3] | 47 | ; Parameters:
|
---|
[148] | 48 | ; DS:DI: Ptr to DPT (in RAMVARS segment)
|
---|
[3] | 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:
|
---|
[148] | 56 | ; AX, BX
|
---|
[3] | 57 | ;--------------------------------------------------------------------
|
---|
| 58 | ALIGN JUMP_ALIGN
|
---|
| 59 | AH8h_GetDriveParameters:
|
---|
| 60 | call AccessDPT_GetLCHSfromPCHS ; AX=sectors, BX=cylinders, DX=heads
|
---|
[148] | 61 | ; Fall to .PackReturnValues
|
---|
[3] | 62 |
|
---|
| 63 | ;--------------------------------------------------------------------
|
---|
| 64 | ; Packs L-CHS values to INT 13h, AH=08h return values.
|
---|
| 65 | ;
|
---|
[148] | 66 | ; .PackReturnValues
|
---|
[3] | 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)
|
---|
[32] | 71 | ; DS: RAMVARS segment
|
---|
[3] | 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 | ;--------------------------------------------------------------------
|
---|
[148] | 81 | .PackReturnValues:
|
---|
[3] | 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
|
---|
[32] | 89 | jmp RamVars_GetCountOfKnownDrivesToDL
|
---|