[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:
|
---|
| 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 | ;--------------------------------------------------------------------
|
---|
| 28 | ALIGN JUMP_ALIGN
|
---|
| 29 | AH8h_HandlerForReadDiskDriveParameters:
|
---|
[32] | 30 | call RamVars_IsDriveHandledByThisBIOS
|
---|
| 31 | jnc SHORT .GetDriveParametersForForeignHardDiskInDL
|
---|
| 32 |
|
---|
[3] | 33 | push bx
|
---|
| 34 | call AH8h_GetDriveParameters
|
---|
| 35 | pop bx
|
---|
[35] | 36 | jmp Int13h_ReturnWithValueInDL
|
---|
[3] | 37 |
|
---|
[32] | 38 | ALIGN JUMP_ALIGN
|
---|
| 39 | .GetDriveParametersForForeignHardDiskInDL:
|
---|
| 40 | call Int13h_CallPreviousInt13hHandler
|
---|
[43] | 41 | jc SHORT .ReturnErrorFromPreviousInt13hHandler
|
---|
[32] | 42 | call RamVars_GetCountOfKnownDrivesToDL
|
---|
[35] | 43 | jmp Int13h_ReturnWithValueInDL
|
---|
[43] | 44 | .ReturnErrorFromPreviousInt13hHandler:
|
---|
| 45 | jmp Int13h_PopDiDsAndReturn
|
---|
[3] | 46 |
|
---|
[32] | 47 |
|
---|
[3] | 48 | ;--------------------------------------------------------------------
|
---|
| 49 | ; Returns L-CHS parameters for drive and total hard disk count.
|
---|
| 50 | ;
|
---|
[28] | 51 | ; AH8h_GetDriveParameters
|
---|
[3] | 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 | ;--------------------------------------------------------------------
|
---|
| 67 | ALIGN JUMP_ALIGN
|
---|
| 68 | AH8h_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)
|
---|
[32] | 84 | ; DS: RAMVARS segment
|
---|
[3] | 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 | ;--------------------------------------------------------------------
|
---|
| 94 | ALIGN JUMP_ALIGN
|
---|
| 95 | AH8h_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
|
---|
[32] | 103 | jmp RamVars_GetCountOfKnownDrivesToDL
|
---|