[3] | 1 | ; File name : AH8h_HParams.asm
|
---|
| 2 | ; Project name : IDE BIOS
|
---|
| 3 | ; Created date : 27.9.2007
|
---|
[35] | 4 | ; Last update : 24.8.2010
|
---|
[3] | 5 | ; Author : Tomi Tilli
|
---|
| 6 | ; Description : Int 13h function AH=8h, Read Disk Drive Parameters.
|
---|
| 7 |
|
---|
| 8 | ; Section containing code
|
---|
| 9 | SECTION .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 | ;--------------------------------------------------------------------
|
---|
| 32 | ALIGN JUMP_ALIGN
|
---|
| 33 | AH8h_HandlerForReadDiskDriveParameters:
|
---|
[32] | 34 | call RamVars_IsDriveHandledByThisBIOS
|
---|
| 35 | jnc SHORT .GetDriveParametersForForeignHardDiskInDL
|
---|
| 36 |
|
---|
[3] | 37 | push bx
|
---|
| 38 | call AH8h_GetDriveParameters
|
---|
| 39 | pop bx
|
---|
[35] | 40 | jmp Int13h_ReturnWithValueInDL
|
---|
[3] | 41 |
|
---|
[32] | 42 | ALIGN JUMP_ALIGN
|
---|
| 43 | .GetDriveParametersForForeignHardDiskInDL:
|
---|
| 44 | call Int13h_CallPreviousInt13hHandler
|
---|
| 45 | call RamVars_GetCountOfKnownDrivesToDL
|
---|
[35] | 46 | jmp Int13h_ReturnWithValueInDL
|
---|
[3] | 47 |
|
---|
[32] | 48 |
|
---|
[3] | 49 | ;--------------------------------------------------------------------
|
---|
| 50 | ; Returns L-CHS parameters for drive and total hard disk count.
|
---|
| 51 | ;
|
---|
[28] | 52 | ; AH8h_GetDriveParameters
|
---|
[3] | 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 | ;--------------------------------------------------------------------
|
---|
| 68 | ALIGN JUMP_ALIGN
|
---|
| 69 | AH8h_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 | ;--------------------------------------------------------------------
|
---|
| 90 | ALIGN JUMP_ALIGN
|
---|
| 91 | AH8h_ReserveCylinders:
|
---|
| 92 | test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_MAXSIZE
|
---|
| 93 | jnz SHORT .Return
|
---|
| 94 | dec bx ; Reserve diagnostic cylinder
|
---|
| 95 | ALIGN 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)
|
---|
[32] | 108 | ; DS: RAMVARS segment
|
---|
[3] | 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 | ;--------------------------------------------------------------------
|
---|
| 118 | ALIGN JUMP_ALIGN
|
---|
| 119 | AH8h_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
|
---|
[32] | 127 | jmp RamVars_GetCountOfKnownDrivesToDL
|
---|