source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm@ 512

Last change on this file since 512 was 493, checked in by gregli@…, 12 years ago

Separated MODULE_8BIT_IDE into the basic part used by XTIDE rev 1 and rev 2 which is PIO based, and MODULE_8BIT_IDE_ADVANCED for JRIDE and XTCF support which requires memory mapping and/or DMA. This allows for creating an 8KB image with boot menu support (but no hotkeys) for the XTIDE rev 1. Cleaned up how we reset the drive translation information, ensuring it is properly set between boot attempt on a primary and secondary drive - as a result we clean it when needed, rather than trying to always keep it clean. Also fixed translation bugs in int13h.asm where I had previously missed converting some MODULE_HOTKEYS into MODULE_DRIVEXLATE.

File size: 2.8 KB
Line 
1; Project name : XTIDE Universal BIOS
2; Description : Int 13h function AH=24h, Set Multiple Blocks.
3
4;
5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
7;
8; This program is free software; you can redistribute it and/or modify
9; it under the terms of the GNU General Public License as published by
10; the Free Software Foundation; either version 2 of the License, or
11; (at your option) any later version.
12;
13; This program is distributed in the hope that it will be useful,
14; but WITHOUT ANY WARRANTY; without even the implied warranty of
15; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16; GNU General Public License for more details.
17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;
19
20; Section containing code
21SECTION .text
22
23;--------------------------------------------------------------------
24; Int 13h function AH=24h, Set Multiple Blocks.
25;
26; AH24h_HandlerForSetMultipleBlocks
27; Parameters:
28; AL: Same as in INTPACK
29; DL: Translated Drive number
30; DS:DI: Ptr to DPT (in RAMVARS segment)
31; SS:BP: Ptr to IDEPACK
32; Parameters on INTPACK:
33; AL: Number of Sectors per Block (1, 2, 4, 8, 16, 32, 64 or 128)
34; Returns with INTPACK:
35; AH: Int 13h return status
36; CF: 0 if successful, 1 if error
37;--------------------------------------------------------------------
38AH24h_HandlerForSetMultipleBlocks:
39%ifndef USE_186
40 call AH24h_SetBlockSize
41 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
42%else
43 push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
44 ; Fall to AH24h_SetBlockSize
45%endif
46
47
48;--------------------------------------------------------------------
49; AH24h_SetBlockSize
50; Parameters:
51; AL: Number of Sectors per Block (1, 2, 4, 8, 16, 32, 64 or 128)
52; DS:DI: Ptr to DPT (in RAMVARS segment)
53; SS:BP: Ptr to IDEPACK
54; Returns:
55; AH: Int 13h return status
56; CF: 0 if successful, 1 if error
57; Corrupts registers:
58; AL, CX, DX
59;--------------------------------------------------------------------
60AH24h_SetBlockSize:
61%ifdef MODULE_8BIT_IDE_ADVANCED
62 ; XT-CF does not support largest block size in DMA mode.
63 cmp al, XTCF_DMA_MODE_MAX_BLOCK_SIZE
64 jbe SHORT .NoNeedToLimitBlockSize
65 cmp BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA
66 je SHORT AH1Eh_LoadInvalidCommandToAHandSetCF
67.NoNeedToLimitBlockSize:
68%endif ; MODULE_8BIT_IDE_ADVANCED
69
70 push bx
71
72 push ax
73 xchg dx, ax ; DL = Block size (Sector Count Register)
74 mov al, COMMAND_SET_MULTIPLE_MODE
75 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY)
76 call Idepack_StoreNonExtParametersAndIssueCommandFromAL
77 pop bx
78 jnc SHORT .StoreBlockSize
79 mov bl, 1 ; Block size 1 will always work
80.StoreBlockSize: ; Store new block size to DPT and return
81 mov [di+DPT_ATA.bBlockSize], bl
82
83 pop bx
84 ret
Note: See TracBrowser for help on using the repository browser.