Changeset 221 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src
- Timestamp:
- Jan 25, 2012, 2:36:47 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src
- Files:
-
- 1 deleted
- 11 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm
r218 r221 25 25 ; Parameters: 26 26 ; AH: IDE command to issue 27 ; AL: Number of sectors to transfer (for xfer commands) 27 28 ; BH: Timeout ticks 28 29 ; BL: IDE Status Register flag to wait after command … … 39 40 ALIGN JUMP_ALIGN 40 41 Idepack_ConvertDapToIdepackAndIssueCommandFromAH: 42 mov [bp+IDEPACK.bSectorCount], al 41 43 mov [bp+IDEPACK.bCommand], ah 42 mov al, [es:si+DAP.bSectorCount]43 mov [bp+IDEPACK.bSectorCount], al44 44 45 45 mov al, [es:si+DAP.qwLBA] ; LBA byte 0 … … 56 56 or al, ah 57 57 mov [bp+IDEPACK.bDrvAndHead], al 58 les si, [es:si+DAP.dwMemoryAddress] 58 59 ; Normalize data buffer pointer to ES:SI 60 mov ax, [es:si+DAP.dwMemoryAddress] ; Load offset 61 mov cx, ax 62 eSHR_IM ax, 4 ; Divide offset by 16 63 add ax, [es:si+DAP.dwMemoryAddress+2] ; Add segment 64 mov es, ax ; Segment normalized 65 mov si, cx 66 and si, BYTE 0Fh ; Offset normalized 59 67 jmp SHORT GetDeviceControlByteToIdepackAndStartTransfer 60 68 %endif … … 65 73 ; Parameters: 66 74 ; AH: IDE command to issue 67 ; AL: Number of sectors to transfer 75 ; AL: Number of sectors to transfer (for xfer commands) 68 76 ; BH: Timeout ticks 69 77 ; BL: IDE Status Register flag to wait after command … … 73 81 ; DH: Starting head number (0...255) 74 82 ; DS:DI: Ptr to DPT (in RAMVARS segment) 83 ; ES:SI: Ptr to normalized data buffer (for xfer commands) 75 84 ; SS:BP: Ptr to IDEPACK (containing INTPACK) 76 ; Parameters on INTPACK:77 ; ES:BX: Ptr to data buffer78 85 ; Returns: 79 86 ; AH: INT 13h Error Code … … 88 95 89 96 push bx 90 call PrepareBuffer_ToESSIforOldInt13hTransfer91 97 call Address_OldInt13hAddressToIdeAddress 92 98 call AccessDPT_GetDriveSelectByteToAL -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH25h_HDrvID.asm
r170 r221 22 22 ALIGN JUMP_ALIGN 23 23 AH25h_HandlerForGetDriveInformation: 24 mov si, [bp+IDEPACK.intpack+INTPACK.bx] 24 mov al, 1 ; Read 1 sector 25 call Prepare_BufferToESSIforOldInt13hTransfer 25 26 %ifdef USE_186 26 27 push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm
r218 r221 15 15 ; SS:BP: Ptr to IDEPACK 16 16 ; Parameters on INTPACK: 17 ; AL: Number of sectors to read (1... 255, 0=256)17 ; AL: Number of sectors to read (1...128) 18 18 ; CH: Cylinder number, bits 7...0 19 19 ; CL: Bits 7...6: Cylinder number bits 9 and 8 … … 28 28 ALIGN JUMP_ALIGN 29 29 AH2h_HandlerForReadDiskSectors: 30 call CommandLookup_GetOldInt13hIndexToBX 30 call Prepare_BufferToESSIforOldInt13hTransfer 31 call Prepare_GetOldInt13hCommandIndexToBX 31 32 mov ah, [cs:bx+g_rgbReadCommandLookup] 32 33 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ) -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH3h_HWrite.asm
r169 r221 15 15 ; SS:BP: Ptr to IDEREGS_AND_INTPACK 16 16 ; Parameters on INTPACK: 17 ; AL: Number of sectors to write (1... 255, 0=256)17 ; AL: Number of sectors to write (1...128) 18 18 ; CH: Cylinder number, bits 7...0 19 19 ; CL: Bits 7...6: Cylinder number bits 9 and 8 … … 27 27 ALIGN JUMP_ALIGN 28 28 AH3h_HandlerForWriteDiskSectors: 29 call CommandLookup_GetOldInt13hIndexToBX 29 call Prepare_BufferToESSIforOldInt13hTransfer 30 call Prepare_GetOldInt13hCommandIndexToBX 30 31 mov ah, [cs:bx+g_rgbWriteCommandLookup] 31 32 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ) 32 mov si, [bp+IDEPACK.intpack+INTPACK.bx]33 33 %ifdef USE_186 34 34 push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm
r169 r221 15 15 ; SS:BP: Ptr to INTPACK 16 16 ; Parameters on INTPACK in SS:BP: 17 ; AL: Number of sectors to verify (1... 255, 0=256)17 ; AL: Number of sectors to verify (1...128) 18 18 ; CH: Cylinder number, bits 7...0 19 19 ; CL: Bits 7...6: Cylinder number bits 9 and 8 … … 26 26 ALIGN JUMP_ALIGN 27 27 AH4h_HandlerForVerifyDiskSectors: 28 call Prepare_ByValidatingSectorsInALforOldInt13h 28 29 mov ah, COMMAND_VERIFY_SECTORS 29 30 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRDY) -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH42h_ExtendedReadSectors.asm
r218 r221 24 24 ALIGN JUMP_ALIGN 25 25 AH42h_HandlerForExtendedReadSectors: 26 call AH42h_LoadDapToESSIandVerifyForTransfer 27 call CommandLookup_GetEbiosIndexToBX 26 call Prepare_ByLoadingDapToESSIandVerifyingForTransfer 28 27 mov ah, [cs:bx+g_rgbReadCommandLookup] 29 28 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ) … … 35 34 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 36 35 %endif 37 38 39 ;--------------------------------------------------------------------40 ; AH42h_LoadDapToESSIandVerifyForTransfer41 ; Parameters:42 ; SI: Same as in INTPACK43 ; SS:BP: Ptr to IDEPACK44 ; Parameters on INTPACK:45 ; DS:SI: Ptr to Disk Address Packet46 ; Returns:47 ; ES:SI: Ptr to Disk Address Packet (DAP)48 ; Exits from INT 13h if invalid DAP49 ; Corrupts registers:50 ; Nothing51 ;--------------------------------------------------------------------52 ALIGN JUMP_ALIGN53 AH42h_LoadDapToESSIandVerifyForTransfer:54 mov es, [bp+IDEPACK.intpack+INTPACK.ds] ; ES:SI to point Disk Address Packet55 cmp BYTE [es:si+DAP.bSize], MINIMUM_DAP_SIZE56 jb SHORT AH42h_ReturnWithInvalidFunctionError57 cmp WORD [es:si+DAP.bSectorCount], BYTE 058 je SHORT AH42h_ReturnWithInvalidFunctionError59 ret60 AH42h_ReturnWithInvalidFunctionError:61 mov ah, RET_HD_INVALID62 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH43h_ExtendedWriteSectors.asm
r169 r221 27 27 AH43h_HandlerForExtendedWriteSectors: 28 28 cmp BYTE [bp+IDEPACK.intpack+INTPACK.al], 2 ; Verify requested? 29 jae SHORT AH42h_ReturnWithInvalidFunctionError29 jae SHORT Prepare_ReturnFromInt13hWithInvalidFunctionError 30 30 31 call AH42h_LoadDapToESSIandVerifyForTransfer 32 call CommandLookup_GetEbiosIndexToBX 31 call Prepare_ByLoadingDapToESSIandVerifyingForTransfer 33 32 mov ah, [cs:bx+g_rgbWriteCommandLookup] 34 33 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ) -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH44h_ExtendedVerifySectors.asm
r165 r221 24 24 ALIGN JUMP_ALIGN 25 25 AH44h_HandlerForExtendedVerifySectors: 26 call AH42h_LoadDapToESSIandVerifyForTransfer 27 call CommandLookup_GetEbiosIndexToBX 26 call Prepare_ByLoadingDapToESSIandVerifyingForTransfer 28 27 mov ah, [cs:bx+g_rgbVerifyCommandLookup] 29 28 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRDY) -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH47h_ExtendedSeek.asm
r169 r221 25 25 mov es, [bp+IDEPACK.intpack+INTPACK.ds] ; ES:SI to point Disk Address Packet 26 26 cmp BYTE [es:si+DAP.bSize], MINIMUM_DAP_SIZE 27 jb SHORT AH42h_ReturnWithInvalidFunctionError27 jb SHORT Prepare_ReturnFromInt13hWithInvalidFunctionError 28 28 29 29 mov ah, COMMAND_SEEK … … 36 36 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 37 37 %endif 38 39 .WriteWithVerifyNotSupported: 40 jmp Prepare_ReturnFromInt13hWithInvalidFunctionError -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH48h_GetExtendedDriveParameters.asm
r170 r221 40 40 mov ax, MINIMUM_EDRIVEINFO_SIZE 41 41 cmp [di+EDRIVE_INFO.wSize], ax 42 jb SHORT AH42h_ReturnWithInvalidFunctionError42 jb SHORT Prepare_ReturnFromInt13hWithInvalidFunctionError 43 43 je SHORT .SkipEddConfigurationParameters 44 44 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Prepare.asm
r220 r221 5 5 SECTION .text 6 6 7 ;-------------------------------------------------------------------- 8 ; Prepare_ByLoadingDapToESSIandVerifyingForTransfer 9 ; Parameters: 10 ; SI: Offset to DAP 11 ; DS:DI: Ptr to DPT 12 ; SS:BP: Ptr to IDEPACK 13 ; Parameters on INTPACK: 14 ; DS:SI: Ptr to Disk Address Packet 15 ; Returns: 16 ; BX: Index to command lookup table 17 ; ES:SI: Ptr to Disk Address Packet (DAP) 18 ; Exits from INT 13h if invalid DAP 19 ; Corrupts registers: 20 ; AX, DX 21 ;-------------------------------------------------------------------- 22 %ifdef MODULE_EBIOS 23 ALIGN JUMP_ALIGN 24 Prepare_ByLoadingDapToESSIandVerifyingForTransfer: 25 ; Load pointer to DAP to ES:SI and make sure it is valid 26 mov es, [bp+IDEPACK.intpack+INTPACK.ds] ; ES:SI to point Disk Address Packet 27 cmp BYTE [es:si+DAP.bSize], MINIMUM_DAP_SIZE 28 jb SHORT InvalidDAP 29 30 ; Make sure that sector count is valid 31 mov ax, [es:si+DAP.wSectorCount] 32 test ax, ax 33 jz SHORT ZeroSectorsRequestedSoNoErrors 34 cmp ax, BYTE 127 35 ja SHORT InvalidNumberOfSectorsRequested 36 ; Fall to GetEbiosCommandIndexToBX 37 38 ;-------------------------------------------------------------------- 39 ; GetEbiosCommandIndexToBX 40 ; Parameters: 41 ; DS:DI: Ptr to DPT 42 ; ES:SI: Ptr to DAP (Disk Address Packet) 43 ; Returns: 44 ; BX: Index to command lookup table 45 ; Corrupts registers: 46 ; AX, DX 47 ;-------------------------------------------------------------------- 48 GetEbiosCommandIndexToBX: 49 ; LBA28 or LBA48 command 50 xor dx, dx 51 mov al, [es:si+DAP.qwLBA+3] ; Load LBA48 byte 3 (bits 24...31) 52 and ax, 00F0h ; Clear LBA28 bits 24...27 53 or ax, [es:si+DAP.qwLBA+4] ; Set bits from LBA bytes 4 and 5 54 cmp dx, ax ; Set CF if any of bits 28...47 set 55 rcl dx, 1 ; DX = 0 for LBA28, DX = 1 for LBA48 56 call Prepare_GetOldInt13hCommandIndexToBX 57 or bx, dx ; Set block mode / single sector bit 58 ret 59 %endif 60 61 62 ;-------------------------------------------------------------------- 63 ; Prepare_GetOldInt13hCommandIndexToBX 64 ; Parameters: 65 ; DS:DI: Ptr to DPT 66 ; Returns: 67 ; BX: Index to command lookup table 68 ; Corrupts registers: 69 ; Nothing 70 ;-------------------------------------------------------------------- 71 ALIGN JUMP_ALIGN 72 Prepare_GetOldInt13hCommandIndexToBX: 73 ; Block mode or single sector 74 mov bl, [di+DPT.bFlagsHigh] 75 and bx, BYTE FLGH_DPT_BLOCK_MODE_SUPPORTED ; Bit 1 76 ret 77 78 7 79 ;--------------------------------------------------------------------- 8 ; Prepare Buffer_ToESSIforOldInt13hTransfer80 ; Prepare_BufferToESSIforOldInt13hTransfer 9 81 ; Parameters: 10 82 ; AL: Number of sectors to transfer … … 19 91 ;-------------------------------------------------------------------- 20 92 ALIGN JUMP_ALIGN 21 Prepare Buffer_ToESSIforOldInt13hTransfer:93 Prepare_BufferToESSIforOldInt13hTransfer: 22 94 ; Normalize buffer pointer 23 95 mov bx, [bp+IDEPACK.intpack+INTPACK.bx] ; Load offset … … 27 99 mov es, bx ; Segment normalized 28 100 and si, BYTE 0Fh ; Offset normalized 101 ; Fall to Prepare_ByValidatingSectorsInALforOldInt13h 29 102 30 ; Check if valid number of sectors 103 104 ;--------------------------------------------------------------------- 105 ; Prepare_ByValidatingSectorsInALforOldInt13h 106 ; Parameters: 107 ; AL: Number of sectors to transfer 108 ; Returns: 109 ; Exits INT 13h if invalid number of sectors in AL 110 ; Corrupts registers: 111 ; Nothing 112 ;-------------------------------------------------------------------- 113 ALIGN JUMP_ALIGN 114 Prepare_ByValidatingSectorsInALforOldInt13h: 31 115 test al, al 32 js SHORT .CheckZeroOffsetFor128Sectors 33 jz SHORT .InvalidNumberOfSectorsRequested116 js SHORT .CheckZeroOffsetFor128Sectors ; 128 or more 117 jz SHORT InvalidNumberOfSectorsRequested ; Zero not allowed for old INT 13h 34 118 ret ; Continue with transfer 35 119 … … 37 121 .CheckZeroOffsetFor128Sectors: 38 122 cmp al, 128 39 ja SHORT .InvalidNumberOfSectorsRequested123 ja SHORT InvalidNumberOfSectorsRequested 40 124 mov ah, RET_HD_BOUNDARY 41 125 test si, si ; Offset must be zero to xfer 128 sectors 42 jnz SHORT .CannotAlignPointerProperly126 jnz SHORT CannotAlignPointerProperly 43 127 ret ; Continue with transfer 44 128 45 .InvalidNumberOfSectorsRequested: 129 InvalidDAP: 130 InvalidNumberOfSectorsRequested: 131 Prepare_ReturnFromInt13hWithInvalidFunctionError: 46 132 mov ah, RET_HD_INVALID 47 .CannotAlignPointerProperly: 133 ZeroSectorsRequestedSoNoErrors: 134 CannotAlignPointerProperly: 48 135 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 49 136 137 138 139 ; Command lookup tables 140 g_rgbReadCommandLookup: 141 db COMMAND_READ_SECTORS ; 00b, CHS or LBA28 single sector 142 db COMMAND_READ_SECTORS_EXT ; 01b, LBA48 single sector 143 db COMMAND_READ_MULTIPLE ; 10b, CHS or LBA28 block mode 144 db COMMAND_READ_MULTIPLE_EXT ; 11b, LBA48 block mode 145 146 g_rgbWriteCommandLookup: 147 db COMMAND_WRITE_SECTORS 148 db COMMAND_WRITE_SECTORS_EXT 149 db COMMAND_WRITE_MULTIPLE 150 db COMMAND_WRITE_MULTIPLE_EXT 151 152 g_rgbVerifyCommandLookup: 153 db COMMAND_VERIFY_SECTORS 154 db COMMAND_VERIFY_SECTORS_EXT 155 db COMMAND_VERIFY_SECTORS 156 db COMMAND_VERIFY_SECTORS_EXT -
trunk/XTIDE_Universal_BIOS/Src/Main.asm
r218 r221 207 207 208 208 ; INT 13h Hard Disk BIOS functions 209 %include "DriveXlate.asm" ; For swapping drive numbers210 %include "Address.asm" ; For sector address translations211 %include "CommandLookup.asm" ; For getting correct transfer command212 %include "PrepareBuffer.asm" ; For buffer pointer normalization213 209 %include "Int13h.asm" ; For Int 13h, Disk functions 214 210 %include "AH0h_HReset.asm" ; Required by Int13h_Jump.asm … … 227 223 %include "AH24h_HSetBlocks.asm" ; Required by Int13h_Jump.asm 228 224 %include "AH25h_HDrvID.asm" ; Required by Int13h_Jump.asm 225 %include "DriveXlate.asm" ; For swapping drive numbers 226 %include "Address.asm" ; For sector address translations 227 %include "Prepare.asm" ; For buffer pointer normalization 229 228 %ifdef MODULE_EBIOS 230 %include "AH41h_CheckIfExtensionsPresent.asm"231 229 %include "AH42h_ExtendedReadSectors.asm" 232 230 %include "AH43h_ExtendedWriteSectors.asm" … … 234 232 %include "AH47h_ExtendedSeek.asm" 235 233 %include "AH48h_GetExtendedDriveParameters.asm" 234 %include "AH41h_CheckIfExtensionsPresent.asm" 236 235 %endif 237 236
Note:
See TracChangeset
for help on using the changeset viewer.