[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:
|
---|
[258] | 16 | ; BL: Drive Type (for floppies only)
|
---|
[3] | 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)
|
---|
[285] | 20 | ; DH: Maximum head number (0...254)
|
---|
[3] | 21 | ; DL: Number of drives
|
---|
[258] | 22 | ; ES:DI: Floppy DPT (for floppies only)
|
---|
[3] | 23 | ; AH: Int 13h/40h floppy return status
|
---|
| 24 | ; CF: 0 if successfull, 1 if error
|
---|
| 25 | ;--------------------------------------------------------------------
|
---|
| 26 | AH8h_HandlerForReadDiskDriveParameters:
|
---|
[262] | 27 | test di,di
|
---|
| 28 | jnz SHORT .OurDrive
|
---|
[258] | 29 |
|
---|
| 30 | call Int13h_CallPreviousInt13hHandler
|
---|
| 31 | jnc SHORT .MidGame
|
---|
| 32 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
|
---|
| 33 |
|
---|
| 34 | .OurDrive:
|
---|
[3] | 35 | call AH8h_GetDriveParameters
|
---|
| 36 |
|
---|
[258] | 37 | %ifdef MODULE_SERIAL_FLOPPY
|
---|
| 38 | push cs ; setup registers if we are a floppy drive, in all cases
|
---|
| 39 | pop es ; if it is not a floppy drive, these values will not be put in INTPACK
|
---|
| 40 | mov di, AH8h_FloppyDPT
|
---|
| 41 | %endif
|
---|
| 42 | ;; fall-through
|
---|
| 43 |
|
---|
| 44 | .MidGame:
|
---|
| 45 | call RamVars_GetCountOfKnownDrivesToAX ; assume hard disk for now, will discard if for floppies
|
---|
| 46 |
|
---|
| 47 | test byte [bp+IDEPACK.intpack+INTPACK.dl], 080h
|
---|
| 48 | jnz .Done
|
---|
| 49 |
|
---|
| 50 | mov [bp+IDEPACK.intpack+INTPACK.bl], bl
|
---|
| 51 |
|
---|
| 52 | mov [bp+IDEPACK.intpack+INTPACK.es], es
|
---|
| 53 | mov [bp+IDEPACK.intpack+INTPACK.di], di
|
---|
| 54 |
|
---|
| 55 | call FloppyDrive_GetCountToAX
|
---|
| 56 |
|
---|
| 57 | .Done:
|
---|
| 58 | mov ah, dh
|
---|
| 59 |
|
---|
[150] | 60 | mov [bp+IDEPACK.intpack+INTPACK.cx], cx
|
---|
[258] | 61 | xchg [bp+IDEPACK.intpack+INTPACK.dx], ax ; recover DL for BDA last status byte determination
|
---|
| 62 |
|
---|
[148] | 63 | xor ah, ah
|
---|
[258] | 64 | %ifdef MODULE_SERIAL_FLOPPY
|
---|
| 65 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH_ALHasDriveNumber
|
---|
| 66 | %else
|
---|
[148] | 67 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
|
---|
[258] | 68 | %endif
|
---|
[3] | 69 |
|
---|
[32] | 70 |
|
---|
[3] | 71 | ;--------------------------------------------------------------------
|
---|
| 72 | ; Returns L-CHS parameters for drive and total hard disk count.
|
---|
| 73 | ;
|
---|
[28] | 74 | ; AH8h_GetDriveParameters
|
---|
[3] | 75 | ; Parameters:
|
---|
[148] | 76 | ; DS:DI: Ptr to DPT (in RAMVARS segment)
|
---|
[3] | 77 | ; Returns:
|
---|
| 78 | ; CH: Maximum cylinder number, bits 7...0
|
---|
| 79 | ; CL: Bits 7...6: Cylinder number bits 9...8
|
---|
| 80 | ; Bits 5...0: Maximum sector number (1...63)
|
---|
[285] | 81 | ; DH: Maximum head number (0...254)
|
---|
[3] | 82 | ; Corrupts registers:
|
---|
[148] | 83 | ; AX, BX
|
---|
[3] | 84 | ;--------------------------------------------------------------------
|
---|
| 85 | AH8h_GetDriveParameters:
|
---|
[227] | 86 | call AccessDPT_GetLCHStoAXBLBH
|
---|
[148] | 87 | ; Fall to .PackReturnValues
|
---|
[3] | 88 |
|
---|
| 89 | ;--------------------------------------------------------------------
|
---|
| 90 | ; Packs L-CHS values to INT 13h, AH=08h return values.
|
---|
| 91 | ;
|
---|
[148] | 92 | ; .PackReturnValues
|
---|
[3] | 93 | ; Parameters:
|
---|
[227] | 94 | ; AX: Number of L-CHS cylinders available (1...1024)
|
---|
[285] | 95 | ; BL: Number of L-CHS heads (1...255)
|
---|
[227] | 96 | ; BH: Number of L-CHS sectors per track (1...63)
|
---|
[32] | 97 | ; DS: RAMVARS segment
|
---|
[3] | 98 | ; Returns:
|
---|
| 99 | ; CH: Maximum cylinder number, bits 7...0
|
---|
| 100 | ; CL: Bits 7...6: Cylinder number bits 9...8
|
---|
| 101 | ; Bits 5...0: Maximum sector number (1...63)
|
---|
[285] | 102 | ; DH: Maximum head number (0...254)
|
---|
[3] | 103 | ; Corrupts registers:
|
---|
| 104 | ; AX, BX
|
---|
| 105 | ;--------------------------------------------------------------------
|
---|
[148] | 106 | .PackReturnValues:
|
---|
[227] | 107 | dec ax ; AX = Number of last cylinder
|
---|
| 108 | dec bx ; BL = Number of last head
|
---|
| 109 | xchg cx, ax
|
---|
| 110 | xchg cl, ch ; CH = Last cylinder bits 0...7
|
---|
| 111 | eROR_IM cl, 2 ; CL bits 6...7 = Last cylinder bits 8...9
|
---|
| 112 | or cl, bh ; CL bits 0...5 = Sectors per track
|
---|
| 113 | mov dh, bl ; DH = Maximum head number
|
---|
[285] | 114 |
|
---|
[258] | 115 | %ifdef MODULE_SERIAL_FLOPPY
|
---|
| 116 | mov bl,[di+DPT.bFlagsHigh]
|
---|
[261] | 117 | %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS ; not sure why this is needed for preprocessor-only
|
---|
[258] | 118 | eSHR_IM bl,FLGH_DPT_SERIAL_FLOPPY_TYPE_FIELD_POSITION
|
---|
[261] | 119 | %endif
|
---|
[258] | 120 | %endif
|
---|
| 121 | ret
|
---|
| 122 |
|
---|
| 123 | %ifdef MODULE_SERIAL_FLOPPY
|
---|
| 124 | ;
|
---|
| 125 | ; Floppy Disk Parameter Table. There is no way to specify more than one of these
|
---|
| 126 | ; for any given system, so no way to make this drive or media specific.
|
---|
[261] | 127 | ; So we return fixed values out of the ROM for callers who might be expecting this information.
|
---|
[258] | 128 | ;
|
---|
| 129 | ; On AT systems, we return the information for a 1.44 MB disk,
|
---|
| 130 | ; and on XT systems, we return the information for a 360 KB disk.
|
---|
| 131 | ;
|
---|
| 132 | AH8h_FloppyDPT:
|
---|
| 133 | %ifdef USE_AT
|
---|
| 134 | db 0ah << 4 | 0fh ; Offset 0: Drive timings, 1.44MB values
|
---|
| 135 | %else
|
---|
| 136 | db 0dh << 4 | 0fh ; Offset 0: Drive timings, 360KB values
|
---|
| 137 | %endif
|
---|
| 138 |
|
---|
| 139 | db 1h << 1 | 0 ; Offset 1: Typical values of 1 for head load time
|
---|
| 140 | ; DMA used (although it actually is not, but is more restrctive)
|
---|
| 141 | db 25h ; Offset 2: Inactiviy motor turn-off delay,
|
---|
| 142 | ; Typical value of 25h for 2 second delay
|
---|
| 143 | db 02h ; Offset 3: Sector size, always 512
|
---|
| 144 |
|
---|
| 145 | %ifdef USE_AT
|
---|
| 146 | db 12h ; Offset 4: Sectors per track, 1.44MB value
|
---|
| 147 | db 1bh ; Offset 5: Sector gap, 1.44MB value
|
---|
| 148 | %else
|
---|
| 149 | db 09h ; Offset 4: Sectors per track, 360KB value
|
---|
| 150 | db 2ah ; Offset 5: Sector gap, 360KB value
|
---|
| 151 | %endif
|
---|
| 152 |
|
---|
| 153 | db 0ffh ; Offset 6: Data length
|
---|
| 154 |
|
---|
| 155 | %ifdef USE_AT
|
---|
| 156 | db 6ch ; Offset 7: Format gap length, 1.44MB value
|
---|
| 157 | %else
|
---|
| 158 | db 50h ; Offset 7: Format gap length, 360KB value
|
---|
| 159 | %endif
|
---|
| 160 |
|
---|
| 161 | db 0f6h ; Offset 8: Fill byte for format
|
---|
| 162 | db 0fh ; Offset 9: Head setting time
|
---|
| 163 | db 08h ; Offset A: Wait for motor startpu time
|
---|
| 164 |
|
---|
| 165 | %ifdef USE_AT
|
---|
| 166 | db 79 ; Offset B: Maximum track number, 1.44MB value
|
---|
| 167 | db 0 ; Offset C: Data transfer rate, 1.44MB value
|
---|
| 168 | db 4 ; Offset D: Diskette CMOS drive type, 1.44MB value
|
---|
| 169 | %else
|
---|
| 170 | db 39 ; Offset B: Maximum track number, 360KB value
|
---|
| 171 | db 80h ; Offset C: Data transfer rate, 360KB value
|
---|
| 172 | db 1 ; Offset D: Diskette CMOS drive type, 360KB value
|
---|
| 173 | %endif
|
---|
| 174 | %endif
|
---|