[148] | 1 | ; Project name : XTIDE Universal BIOS
|
---|
[3] | 2 | ; Description : Int 13h function AH=24h, Set Multiple Blocks.
|
---|
| 3 |
|
---|
| 4 | ; Section containing code
|
---|
| 5 | SECTION .text
|
---|
| 6 |
|
---|
| 7 | ;--------------------------------------------------------------------
|
---|
| 8 | ; Int 13h function AH=24h, Set Multiple Blocks.
|
---|
| 9 | ;
|
---|
| 10 | ; AH24h_HandlerForSetMultipleBlocks
|
---|
| 11 | ; Parameters:
|
---|
[148] | 12 | ; AL: Same as in INTPACK
|
---|
| 13 | ; DL: Translated Drive number
|
---|
| 14 | ; DS:DI: Ptr to DPT (in RAMVARS segment)
|
---|
[150] | 15 | ; SS:BP: Ptr to IDEPACK
|
---|
| 16 | ; Parameters on INTPACK:
|
---|
[3] | 17 | ; AL: Number of Sectors per Block (1, 2, 4, 8, 16, 32, 64 or 128)
|
---|
[150] | 18 | ; Returns with INTPACK:
|
---|
[3] | 19 | ; AH: Int 13h return status
|
---|
| 20 | ; CF: 0 if succesfull, 1 if error
|
---|
| 21 | ;--------------------------------------------------------------------
|
---|
| 22 | ALIGN JUMP_ALIGN
|
---|
| 23 | AH24h_HandlerForSetMultipleBlocks:
|
---|
[158] | 24 | test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED
|
---|
[150] | 25 | jnz SHORT .TryToSetBlockMode
|
---|
| 26 | stc
|
---|
| 27 | mov ah, RET_HD_INVALID
|
---|
| 28 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
|
---|
| 29 |
|
---|
| 30 | ALIGN JUMP_ALIGN
|
---|
| 31 | .TryToSetBlockMode:
|
---|
[84] | 32 | %ifndef USE_186
|
---|
[3] | 33 | call AH24h_SetBlockSize
|
---|
[148] | 34 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
|
---|
[84] | 35 | %else
|
---|
[148] | 36 | push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
|
---|
[162] | 37 | ; Fall to AH24h_SetBlockSize
|
---|
[84] | 38 | %endif
|
---|
[3] | 39 |
|
---|
| 40 |
|
---|
| 41 | ;--------------------------------------------------------------------
|
---|
| 42 | ; AH24h_SetBlockSize
|
---|
| 43 | ; Parameters:
|
---|
| 44 | ; AL: Number of Sectors per Block (1, 2, 4, 8, 16, 32, 64 or 128)
|
---|
[148] | 45 | ; DS:DI: Ptr to DPT (in RAMVARS segment)
|
---|
[150] | 46 | ; SS:BP: Ptr to IDEPACK
|
---|
[3] | 47 | ; Returns:
|
---|
| 48 | ; AH: Int 13h return status
|
---|
| 49 | ; CF: 0 if succesfull, 1 if error
|
---|
| 50 | ; Corrupts registers:
|
---|
[148] | 51 | ; AL, BX, CX, DX
|
---|
[3] | 52 | ;--------------------------------------------------------------------
|
---|
| 53 | ALIGN JUMP_ALIGN
|
---|
| 54 | AH24h_SetBlockSize:
|
---|
[150] | 55 | MIN_U al, MAX_SUPPORTED_BLOCK_SIZE_IN_SECTORS
|
---|
| 56 | push ax
|
---|
| 57 | xchg dx, ax ; DL = Block size (Sector Count Register)
|
---|
| 58 | mov al, COMMAND_SET_MULTIPLE_MODE
|
---|
| 59 | mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY)
|
---|
| 60 | call Idepack_StoreNonExtParametersAndIssueCommandFromAL
|
---|
| 61 | pop bx
|
---|
[3] | 62 | jc SHORT .DisableBlockMode
|
---|
| 63 |
|
---|
| 64 | ; Store new block size to DPT and return
|
---|
[150] | 65 | mov [di+DPT_ATA.bSetBlock], bl ; Store new block size
|
---|
[3] | 66 | ret
|
---|
| 67 | .DisableBlockMode:
|
---|
[150] | 68 | mov BYTE [di+DPT_ATA.bSetBlock], 1 ; Disable block mode
|
---|
[3] | 69 | ret
|
---|