source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm@ 619

Last change on this file since 619 was 618, checked in by Krister Nordvall, 3 years ago

Changes:

  • Updated the BIOS makefile. Added the NO_ATAID_CORRECTION define back to the Tiny build as I've realized that the correction code should not be needed for builds without MODULE_EBIOS. Also added a new makefile target 'custom' to make it easier for people to make custom builds.
  • Fixed a bug where calling INT 13h/AH=15h for drives not handled by XUB (floppy drives for example) would return an error due to the fact that any non-zero return value in AH from the other BIOS would cause the CF to be set in Int13h_SetErrorCodeToIntpackInSSBPfromAH. The return path is now via Int13h_ReturnFromHandlerWithoutStoringErrorCode which means that no status/error code will be returned in the BDA but that should not be a problem as the other BIOS should do that anyway. This change also fixed another potential problem where return values in DL from the other BIOS were assumed to be drive numbers when MODULE_SERIAL_FLOPPY is included in the build.
  • Minor optimizations and fixes.
File size: 3.3 KB
Line 
1; Project name : XTIDE Universal BIOS
2; Description : Int 13h function AH=4h, Verify Disk Sectors.
3
4;
5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 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=4h, Verify Disk Sectors.
25;
26; AH4h_HandlerForVerifyDiskSectors
27; Parameters:
28; AL, CX, DH: 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 in SS:BP:
33; AL: Number of sectors to verify (1...128)
34; CH: Cylinder number, bits 7...0
35; CL: Bits 7...6: Cylinder number bits 9 and 8
36; Bits 5...0: Starting sector number (1...63)
37; DH: Starting head number (0...255)
38; Returns with INTPACK in SS:BP:
39; AH: Int 13h/40h floppy return status
40; AL: Number of sectors actually verified (only valid if CF set for some BIOSes)
41; CF: 0 if successful, 1 if error
42;--------------------------------------------------------------------
43ALIGN JUMP_ALIGN
44AH4h_HandlerForVerifyDiskSectors:
45 mov ah, COMMAND_VERIFY_SECTORS
46 call Prepare_ByValidatingSectorsInALforOldInt13h ; Preserves AX
47 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRDY)
48 push ax ; Store number of sectors to verify
49 call Idepack_TranslateOldInt13hAddressAndIssueCommandFromAH
50 pop cx ; Number of sectors verified if successful
51 jnc SHORT .NoErrors
52
53; TODO: For now we assume serial device do not produce verify errors
54 call AH4h_CalculateNumberOfSuccessfullyVerifiedSectors
55.NoErrors:
56 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAHandTransferredSectorsFromCL
57
58
59;--------------------------------------------------------------------
60; Calculates number of succesfully verified sectors. This function works only
61; if verify command stopped to an device error (such as bad sector) since IDE
62; register contents are not valid unless error.
63;
64; AH4h_CalculateNumberOfSuccessfullyVerifiedSectors
65; Parameters:
66; AH: INT 13h error code
67; CX: Number of sectors that was meant to be verified
68; DS:DI: Ptr to DPT (in RAMVARS segment)
69; SS:BP: Ptr to IDEPACK
70; Returns with INTPACK in SS:BP:
71; CX: Number of sectors succesfully verified
72; CF: 1
73;--------------------------------------------------------------------
74ALIGN JUMP_ALIGN
75AH4h_CalculateNumberOfSuccessfullyVerifiedSectors:
76 xchg cx, ax ; Store error code to CH
77 call Device_ReadLBAlowRegisterToAL
78 sub al, [bp+IDEPACK.bLbaLow] ; AL = sector address with verify failure - starting sector address
79 xor ah, ah
80 xchg cx, ax ; Number of successfully verified sectors in CX, error code in AH
81 stc
82 ret
Note: See TracBrowser for help on using the repository browser.