[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 | AH24h_HandlerForSetMultipleBlocks: |
---|
[84] | 23 | %ifndef USE_186 |
---|
[3] | 24 | call AH24h_SetBlockSize |
---|
[148] | 25 | jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH |
---|
[84] | 26 | %else |
---|
[148] | 27 | push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH |
---|
[162] | 28 | ; Fall to AH24h_SetBlockSize |
---|
[84] | 29 | %endif |
---|
[3] | 30 | |
---|
| 31 | |
---|
| 32 | ;-------------------------------------------------------------------- |
---|
| 33 | ; AH24h_SetBlockSize |
---|
| 34 | ; Parameters: |
---|
| 35 | ; AL: Number of Sectors per Block (1, 2, 4, 8, 16, 32, 64 or 128) |
---|
[148] | 36 | ; DS:DI: Ptr to DPT (in RAMVARS segment) |
---|
[150] | 37 | ; SS:BP: Ptr to IDEPACK |
---|
[3] | 38 | ; Returns: |
---|
| 39 | ; AH: Int 13h return status |
---|
| 40 | ; CF: 0 if succesfull, 1 if error |
---|
| 41 | ; Corrupts registers: |
---|
[148] | 42 | ; AL, BX, CX, DX |
---|
[3] | 43 | ;-------------------------------------------------------------------- |
---|
| 44 | AH24h_SetBlockSize: |
---|
[150] | 45 | push ax |
---|
| 46 | xchg dx, ax ; DL = Block size (Sector Count Register) |
---|
[232] | 47 | or BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED ; Assume success |
---|
[150] | 48 | mov al, COMMAND_SET_MULTIPLE_MODE |
---|
| 49 | mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY) |
---|
| 50 | call Idepack_StoreNonExtParametersAndIssueCommandFromAL |
---|
| 51 | pop bx |
---|
[181] | 52 | jnc .StoreBlockSize |
---|
| 53 | mov bl, 1 ; Disable block mode |
---|
[232] | 54 | and BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_BLOCK_MODE_SUPPORTED |
---|
[181] | 55 | .StoreBlockSize: ; Store new block size to DPT and return |
---|
| 56 | mov [di+DPT_ATA.bSetBlock], bl |
---|
[3] | 57 | ret |
---|