Changeset 558 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src
- Timestamp:
- Jun 23, 2013, 3:52:31 PM (11 years ago)
- google:author:
- krille_n_@hotmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDmaBlock.asm
r551 r558 1 1 ; Project name : XTIDE Universal BIOS 2 ; Description : IDE Read/Write functions for transferring 3 ; block using DMA.4 ; These functions should only be called from IdeTransfer.asm. 2 ; Description : IDE Read/Write functions for transferring block using DMA. 3 ; These functions should only be called from IdeTransfer.asm. 4 5 5 ; Modified JJP 05-Jun-13 6 6 7 ; 7 8 ; XTIDE Universal BIOS and Associated Tools … … 84 85 shl cx, 9 ; CX = Block size in BYTEs 85 86 %else 86 xchg 87 xchg cl, ch 87 88 shl cx, 1 88 89 %endif … … 92 93 neg ax ; 2s compliment 93 94 94 ; if DI was zero carry flag will be cleared (and set otherwise)95 ; If DI was zero carry flag will be cleared (and set otherwise) 95 96 ; When DI is zero only one transfer is required since we've limited the 96 97 ; XT-CFv3 block size to 32k 97 jnc .TransferLastDmaPageWithSizeInCX98 jnc SHORT .TransferLastDmaPageWithSizeInCX 98 99 99 100 ; CF was set, so DI != 0 and we might need one or two transfers 100 101 cmp cx, ax ; if we won't cross a physical page boundary... 101 jbe SHORT .TransferLastDmaPageWithSizeInCX ; ...perform the transfer in one operation102 jbe SHORT .TransferLastDmaPageWithSizeInCX ; ...perform the transfer in one operation 102 103 103 104 ; Calculate how much we can transfer on first and second rounds 104 xchg cx, ax; CX = BYTEs for first page105 sub ax, cx 106 push 105 xchg cx, ax ; CX = BYTEs for first page 106 sub ax, cx ; AX = BYTEs for second page 107 push ax ; Save bytes for second transfer on stack 107 108 108 109 ; Transfer first DMA page … … 126 127 ; ES:DI updated (CX is added) 127 128 ; Corrupts registers: 128 ; AX 129 ; AX, CX 129 130 ;-------------------------------------------------------------------- 130 131 ALIGN JUMP_ALIGN … … 161 162 sti ; Enable interrupts 162 163 164 ; Update physical address in ES:DI - since IO might need several calls through this function either from here 165 ; if crossing a physical page boundary, or from IdeTransfer.asm if requested sectors was > PIOVARS.wSectorsInBlock 166 ; We update the pointer here (before the actual transfer) to avoid having to save the byte count on the stack 167 mov ax, es ; copy physical page address to ax 168 add di, cx ; add requested bytes to di 169 adc al, 0 ; and increment physical page address, if required 170 mov es, ax ; and save it back in es 171 163 172 ; XT-CF transfers 16 bytes at a time. We need to manually start transfer for every block by writing (anything) 164 173 ; to the XT-CFv3 Control Register, which raises DRQ thereby passing system control to the 8237 DMA controller. … … 169 178 170 179 %if 0 ; Slow DMA code - works by checking 8237 status register after each 16-byte transfer, until it reports TC has been raised. 171 ;ALIGN JUMP_ALIGN 172 ;.TransferNextBlock: 173 ; cli ; We want no ISR to read DMA Status Register before we do 174 ; out dx, al ; Transfer up to 16 bytes to/from XT-CF card 175 ; in al, STATUS_REGISTER_DMA8_in 176 ; sti 177 ; test al, FLG_CH3_HAS_REACHED_TERMINAL_COUNT 178 ; jz SHORT .TransferNextBlock ; All bytes transferred? 179 %endif ; Slow DMA code 180 181 %if 1 ; Fast DMA code - perform computed number of transfers, then check DMA status register to be sure 182 push cx ; need byte count to update pointer at the end 180 ALIGN JUMP_ALIGN 181 .TransferNextBlock: 182 cli ; We want no ISR to read DMA Status Register before we do 183 out dx, al ; Transfer up to 16 bytes to/from XT-CF card 184 in al, STATUS_REGISTER_DMA8_in 185 sti 186 test al, FLG_CH3_HAS_REACHED_TERMINAL_COUNT 187 jz SHORT .TransferNextBlock ; All bytes transferred? 188 %else ; Fast DMA code - perform computed number of transfers, then check DMA status register to be sure 183 189 add cx, BYTE 15 ; We'll divide transfers in 16-byte atomic transfers, 184 190 eSHR_IM cx, 4 ; so include any partial block, which will be terminated … … 191 197 test al, FLG_CH3_HAS_REACHED_TERMINAL_COUNT ; ... for channel 3 terminal count 192 198 jz SHORT .TransferNextDmaBlock ; If not set, get more bytes 193 pop cx ; get back requested bytes 194 %endif ; Fast DMA code 195 196 ; Update physical address in ES:DI - since IO might need several calls through this function either from here 197 ; if crossing a physical page boundary, and from IdeTransfer.asm if requested sectors was > PIOVARS.wSectorsInBlock 198 mov ax, es ; copy physical page address to ax 199 add di, cx ; add requested bytes to di 200 adc al, 0 ; and increment physical page address, if required 201 mov es, ax ; and save it back in es 199 %endif 202 200 203 201 ret -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm
r545 r558 67 67 je SHORT .InputToALfromMemoryMappedRegisterInBX 68 68 mov bl, dl 69 mov bh, 69 mov bh, ADP50L_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET >> 8 70 70 71 71 .InputToALfromMemoryMappedRegisterInBX: -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdePioBlock.asm
r545 r558 1 1 ; Project name : XTIDE Universal BIOS 2 ; Description : IDE Read/Write functions for transferring 3 ; block using PIO modes. 2 ; Description : IDE Read/Write functions for transferring block using PIO modes. 4 3 ; These functions should only be called from IdeTransfer.asm. 5 4 … … 65 64 ; 66 65 ; Parameters: 67 ; CX: Block size in 512 byte sectors68 ; DX: IDE Data port address66 ; CX: Block size in 512 byte sectors 67 ; DX: IDE Data port address 69 68 ; ES:DI: Normalized ptr to buffer to receive data 70 69 ; Returns: … … 100 99 ; 101 100 ; Parameters: 102 ; CX: Block size in 512 byte sectors103 ; DX: IDE Data port address101 ; CX: Block size in 512 byte sectors 102 ; DX: IDE Data port address 104 103 ; ES:DI: Normalized ptr to buffer to receive data 105 104 ; Returns: … … 111 110 IdePioBlock_ReadFrom16bitDataPort: 112 111 %ifdef USE_186 113 xchg 112 xchg cl, ch ; Sectors to WORDs 114 113 rep insw 115 114 ret … … 120 119 .ReadNextOword: 121 120 %rep 8 ; WORDs 122 in ax, dx ; Read BYTE123 stosw ; Store BYTEto [ES:DI]121 in ax, dx ; Read WORD 122 stosw ; Store WORD to [ES:DI] 124 123 %endrep 125 124 loop .ReadNextOword … … 152 151 ; IdePioBlock_WriteToXtideRev1 153 152 ; Parameters: 154 ; CX: Block size in 512-byte sectors155 ; DX: IDE Data port address153 ; CX: Block size in 512-byte sectors 154 ; DX: IDE Data port address 156 155 ; ES:SI: Normalized ptr to buffer containing data 157 156 ; Returns: … … 180 179 ; IdePioBlock_WriteToXtideRev2 or rev 1 with swapped A0 and A3 (chuck-mod) 181 180 ; Parameters: 182 ; CX: Block size in 512-byte sectors183 ; DX: IDE Data port address181 ; CX: Block size in 512-byte sectors 182 ; DX: IDE Data port address 184 183 ; ES:SI: Normalized ptr to buffer containing data 185 184 ; Returns: … … 191 190 IdePioBlock_WriteToXtideRev2: 192 191 UNROLL_SECTORS_IN_CX_TO_QWORDS 193 push 194 push 195 pop 192 push ds 193 push es ; Copy ES... 194 pop ds ; ...to DS 196 195 ALIGN JUMP_ALIGN 197 196 .WriteNextQword: … … 207 206 ; IdePioBlock_WriteTo8bitDataPort 208 207 ; Parameters: 209 ; CX: Block size in 512-byte sectors210 ; DX: IDE Data port address208 ; CX: Block size in 512-byte sectors 209 ; DX: IDE Data port address 211 210 ; ES:SI: Normalized ptr to buffer containing data 212 211 ; Returns: … … 225 224 %else ; If 8088/8086 226 225 UNROLL_SECTORS_IN_CX_TO_QWORDS 227 push 228 ;mov 229 ;mov 230 push 231 pop 226 push ds 227 ;mov ax, es 228 ;mov ds, ax ; move es to ds via ax (does this run faster on 8088?) 229 push es 230 pop ds 232 231 ALIGN JUMP_ALIGN 233 232 .WriteNextQword: … … 248 247 ; IdePioBlock_WriteTo32bitDataPort VLB/PCI 32-bit IDE 249 248 ; Parameters: 250 ; CX: Block size in 512-byte sectors251 ; DX: IDE Data port address249 ; CX: Block size in 512-byte sectors 250 ; DX: IDE Data port address 252 251 ; ES:SI: Normalized ptr to buffer containing data 253 252 ; Returns: … … 274 273 .WriteNextQword: 275 274 %rep 4 ; WORDs 276 lodsw ; Load BYTEfrom [DS:SI]277 out dx, ax ; Write BYTE275 lodsw ; Load WORD from [DS:SI] 276 out dx, ax ; Write WORD 278 277 %endrep 279 278 loop .WriteNextQword -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
r545 r558 209 209 ; ES:SI: Normalized pointer 210 210 ; AH: INT 13h Error Code (only when CF set) 211 ; CF: Set of failed to normalize pointer (segment overflow)211 ; CF: Set if failed to normalize pointer (segment overflow) 212 212 ; Cleared if success 213 213 ; Corrupts registers: … … 295 295 ret 296 296 %endif ; MODULE_8BIT_IDE_ADVANCED 297 ; Fall to IdeTransfer_NormalizePointerInESSI if no MODULE_8BIT_IDE 297 ; Fall to IdeTransfer_NormalizePointerInESSI if no MODULE_8BIT_IDE_ADVANCED 298 298 299 299 … … 305 305 ; Returns: 306 306 ; ES:SI: Normalized pointer (SI = 0...15) 307 ; AH: INT 13h Error Code ( only when CF set)308 ; CF: Set of failed to normalize pointer (segment overflow)307 ; AH: INT 13h Error Code (when USE_AT defined and normalization was attempted) 308 ; CF: Set if failed to normalize pointer (segment overflow) 309 309 ; Cleared if success 310 310 ; Corrupts registers: … … 319 319 %ifdef USE_AT 320 320 xor dl, dl 321 shldx, 1321 eSHL_IM dx, 1 322 322 dec dx ; Prevents normalization when bytes + offset will be zero 323 323 add dx, si … … 329 329 NORMALIZE_FAR_POINTER es, si, ax, dx 330 330 %ifdef USE_AT ; CF is always clear for XT builds 331 jc SHORT .SegmentOverflow 332 ret 333 .SegmentOverflow: 334 mov ah, RET_HD_INVALID 331 ; AH = RET_HD_INVALID (01) if CF set, RET_HD_SUCCESS (00) if not. CF unchanged. 332 sbb ah, ah 333 neg ah 335 334 %endif 336 335 ret -
trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm
r538 r558 67 67 call IdeTransfer_NormalizePointerInESSI 68 68 %ifdef USE_AT 69 jnc SHORT .PointerNormalizationWasSuccessful l69 jnc SHORT .PointerNormalizationWasSuccessful 70 70 xor cx, cx ; Nothing transferred 71 jmp SerialCommand_ReturnError 72 .PointerNormalizationWasSuccessfull: 71 stc 72 ret 73 .PointerNormalizationWasSuccessful: 73 74 %endif 74 75 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm
r557 r558 169 169 mov [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv], dl 170 170 push WORD [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap] 171 mov WORD [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap], 8000h; No translation171 call DriveXlate_Reset ; No translation 172 172 %endif 173 173 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1Eh_XTCF.asm
r545 r558 40 40 ; AH: Int 13h return status 41 41 ; CF: 0 if successful, 1 if error 42 ; DX: Command return values (see XTCF.inc) 42 43 ;-------------------------------------------------------------------- 43 44 AH1Eh_HandlerForXTCFfeatures: … … 46 47 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 47 48 %else 48 push 49 push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 49 50 ; Fall to ProcessXTCFsubcommandFromAL 50 51 %endif … … 60 61 ; AH: Int 13h return status 61 62 ; CF: 0 if successful, 1 if error 62 ; DX Command return values (see XTCF.inc)63 63 ; Corrupts registers: 64 64 ; AL, BX, CX, DX, SI … … 68 68 call AccessDPT_IsThisDeviceXTCF 69 69 jne SHORT .XTCFnotFound 70 and ax, BYTE 7Fh; Subcommand now in AX (clears AH and CF)70 and ax, 0FFh ; Subcommand now in AX (clears AH and CF) 71 71 jz SHORT .XTCFfound ; Sub-function IS_THIS_DRIVE_XTCF (=0) 72 72 … … 75 75 76 76 dec ax ; Test subcommand for value 2 (GET_XTCF_TRANSFER_MODE) 77 jnz SHORT . XTCFnotFound ; Invalid subcommand77 jnz SHORT .AH1Eh_LoadInvalidCommandToAHandSetCF 78 78 79 79 ; GET_XTCF_TRANSFER_MODE 80 80 call AH1Eh_GetCurrentXTCFmodeToAX 81 mov dh, al 81 82 mov dl, [di+DPT_ATA.bBlockSize] 82 mov [bp+IDEPACK.intpack+INTPACK.dh], al ; return mode value... 83 mov [bp+IDEPACK.intpack+INTPACK.dl], dl ; ...and block size, via INTPACK... 83 mov [bp+IDEPACK.intpack+INTPACK.dx], dx ; Return mode value (DH) and block size (DL) via INTPACK 84 84 .XTCFfound: 85 ret ; ...with AH and CF cleared85 ret ; With AH and CF cleared 86 86 87 87 .XTCFnotFound: 88 88 .AH1Eh_LoadInvalidCommandToAHandSetCF: 89 stc ; set carry flag since XT-CF not found89 stc ; Set carry flag since XT-CF not found or invalid subcommand 90 90 mov ah, RET_HD_INVALID 91 ret ; and return91 ret 92 92 93 93 .SetXTCFtransferMode: 94 mov al, [bp+IDEPACK.intpack+INTPACK.dh] ; get specified mode (eg XTCF_DMA_MODE)95 ; and fall to AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL94 mov al, [bp+IDEPACK.intpack+INTPACK.dh] ; Get specified mode (eg XTCF_DMA_MODE) 95 ; Fall to AH1Eh_ChangeXTCFmodeBasedOnModeInAL 96 96 97 97 … … 102 102 ; DS:DI: Ptr to DPT (in RAMVARS segment) 103 103 ; SS:BP: Ptr to IDEPACK 104 ; Returns: 104 ; Returns: 105 105 ; AH: Int 13h return status 106 106 ; CF: 0 if successful, 1 if error … … 110 110 AH1Eh_ChangeXTCFmodeBasedOnModeInAL: 111 111 ; Note: Control register (as of XT-CFv3) is now a write-only register, 112 ; whos purpose is *only* to raise DRQ. The register cannot be read.112 ; whose purpose is *only* to raise DRQ. The register cannot be read. 113 113 ; Selected transfer mode is stored in BIOS variable (DPT_ATA.bDevice). 114 114 115 ; We always need to enable 8-bit mode since 16-bit mode is restored116 ; when controller is reset (AH=00h or 0Dh)117 ;118 115 ; Note that when selecting 'DEVICE_8BIT_PIO_MODE_WITH_BIU_OFFLOAD' mode, 119 116 ; the ATA device (i.e. CompactFlash card) will operate in 8-bit mode, but 120 ; data will be transferred from it 's data register using 16-bit CPU instructions117 ; data will be transferred from its data register using 16-bit CPU instructions 121 118 ; like REP INSW. This works because XT-CF adapters are 8-bit cards, and 122 119 ; the BIU in the machine splits each WORD requested by the CPU into two 8-bit … … 125 122 ; the data for presentation to the CPU. 126 123 ; 127 ; Also note th ough that some machines, noteably AT&T PC6300, have hardware128 ; errors in the BIU logic, resulting in reversed byte ordering. Therefore,129 ; mode DEVICE_8BIT_PIO is the default transfer mode for best system130 ; compatibility.124 ; Also note that some machines, noteably the Olivetti M24 (also known as 125 ; the AT&T PC6300 and Xerox 6060), have hardware errors in the BIU logic, 126 ; resulting in reversed byte ordering. Therefore, mode DEVICE_8BIT_PIO is 127 ; the default transfer mode for best system compatibility. 131 128 129 ; We always need to enable 8-bit mode since 16-bit mode is restored 130 ; when controller is reset (AH=00h or 0Dh) 132 131 ePUSH_T bx, AH23h_Enable8bitPioMode 133 132 134 133 ; Convert mode to device type (see XTCF.inc for full details) 135 134 and ax, 3 136 jz SHORT .Set8bitPioMode ; XTCF_8BIT_PIO_MODE = 0137 dec ax ; XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD = 1138 jz SHORT .Set8bitPioModeWithBIUOffload135 jz SHORT .Set8bitPioMode ; XTCF_8BIT_PIO_MODE = 0 136 dec ax ; XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD = 1 137 jz SHORT .Set8bitPioModeWithBIUOffload 139 138 140 139 ; XTCF_DMA_MODE = 2 (allow 3 as well for more optimized code) 141 140 mov BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA 142 141 143 ; DMA transfers have limited block size e142 ; DMA transfers have limited block size 144 143 mov al, [di+DPT_ATA.bBlockSize] 145 MIN_U al, XTCF_DMA_MODE_MAX_BLOCK_SIZE 146 jmp AH24h_SetBlockSize 147 ; exit via ret in AH24_SetBlockSize then through AH23h_Enable8bitPioMode 144 cmp al, XTCF_DMA_MODE_MAX_BLOCK_SIZE 145 jbe SHORT AH24h_SetBlockSize 146 mov al, XTCF_DMA_MODE_MAX_BLOCK_SIZE 147 jmp SHORT AH24h_SetBlockSize 148 148 149 149 .Set8bitPioMode: 150 mov BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_PIO8151 ret ; through AH23h_Enable8bitPioMode150 mov al, DEVICE_8BIT_XTCF_PIO8 151 SKIP2B bx 152 152 153 153 .Set8bitPioModeWithBIUOffload: 154 mov BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD 155 ret ; through AH23h_Enable8bitPioMode 154 mov al, DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD 155 mov [di+DPT_ATA.bDevice], al 156 ret 156 157 157 158 … … 160 161 ; Parameters: 161 162 ; DS:DI: Ptr to DPT (in RAMVARS segment) 162 ; Returns: 163 ; Returns: 163 164 ; AX: XT-CF mode (XTCF_8BIT_PIO_MODE, XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD or XTCF_DMA_MODE) 164 165 ; CF: Clear … … 167 168 ;-------------------------------------------------------------------- 168 169 AH1Eh_GetCurrentXTCFmodeToAX: 169 eMOVZX ax, BYTE [di+DPT_ATA.bDevice] ; get current mode from DPT 170 sub al, DEVICE_8BIT_XTCF_PIO8 171 shr ax, 1 ; Device type to XT-CF mode 170 mov al, [di+DPT_ATA.bDevice] 171 shr al, 1 172 cbw 173 sub al, DEVICE_8BIT_XTCF_PIO8 >> 1 172 174 ret -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm
r550 r558 84 84 pop bx ; Pop block size to BL 85 85 jc SHORT .DisableBlockMode 86 mov bh, bl ; BL and BH both have block size we tried to set 87 dec bh 88 jz SHORT .DisableBlockMode 86 87 ; All valid block sizes are powers of 2 which means BL have just one bit set (parity odd). 88 ; Incrementing BX will cause all block sizes except 1 to have two bits set (parity even). 89 ; Note that PF reflects only the lowest 8 bits of any register being modified. 90 inc bx ; 1 -> 2 ? 91 jpo SHORT .DisableBlockMode ; Jump if BL = 2 92 dec bx ; Restore block size (was larger than 1) 89 93 90 94 ; Enable block mode and store block size -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
r550 r558 112 112 113 113 114 %ifdef MODULE_8BIT_IDE_ADVANCED 114 115 ;;; Set XT-CF mode 115 %ifdef MODULE_8BIT_IDE_ADVANCED116 116 call AH1Eh_GetCurrentXTCFmodeToAX 117 117 call AH9h_SetModeFromALtoXTCF 118 118 STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_SET_XTCF_MODE 119 .DoNotSetXTCFmode:120 119 %endif ; MODULE_8BIT_IDE_ADVANCED 121 120 … … 124 123 call AH9h_Enable8bitModeForDevice8bitAta 125 124 STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_SET_8BIT_MODE 126 .DoNotSet8bitMode:127 125 %endif ; MODULE_8BIT_IDE 128 126 … … 138 136 call Idepack_StoreNonExtParametersAndIssueCommandFromAL 139 137 STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS 140 .SkipInitializeDeviceParameters:141 138 142 139 … … 302 299 jne SHORT IgnoreInvalidCommandError 303 300 jmp AH23h_Enable8bitPioMode 304 %endif 301 %endif ; MODULE_8BIT_IDE -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Prepare.asm
r550 r558 45 45 46 46 ; Make sure that sector count is valid 47 %ifdef USE_UNDOC_INTEL 48 eSALC ; Clear AL using CF (CF is cleared since JB above fell through) 49 or al, [es:si+DAP.wSectorCount] 50 %else 47 51 mov al, [es:si+DAP.wSectorCount] 48 52 test al, al 53 %endif 49 54 jz SHORT ZeroSectorsRequestedSoNoErrors 50 55 js SHORT InvalidNumberOfSectorsRequested … … 62 67 call Prepare_GetOldInt13hCommandIndexToBX 63 68 mov al, [di+DPT.bFlagsLow] 64 shlal, 1 ; Set CF if LBA48 supported69 eSHL_IM al, 1 ; Set CF if LBA48 supported 65 70 adc bl, bh ; LBA48 EXT commands 66 71 ret -
trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm
r545 r558 135 135 %endif 136 136 137 %ifdef MODULE_8BIT_IDE_ADVANCED 138 NoSlaveDriveAvailable: 139 %endif 137 140 ret 138 141 … … 153 156 ; ES: Zero (BDA segment) 154 157 ; Returns: 155 ; No ne158 ; Nothing 156 159 ; Corrupts registers: 157 160 ; AX, BL, CX, DX, SI, DI 158 161 ;-------------------------------------------------------------------- 159 162 StartDetectionWithDriveSelectByteInBHandStringInCX: 160 %ifdef MODULE_8BIT_IDE 161 call DetectDrives_DoesIdevarsInCSBPbelongToXTCF 162 jne SHORT .ShouldNotSkipSlaveDriveDetection 163 %ifdef MODULE_8BIT_IDE_ADVANCED 164 mov al, [cs:bp+IDEVARS.bDevice] 165 cmp al, DEVICE_8BIT_XTCF_PIO8 166 jb SHORT .DoNotSkipSlaveDriveDetection 167 cmp al, DEVICE_8BIT_XTCF_DMA 168 ja SHORT .DoNotSkipSlaveDriveDetection 163 169 164 170 ; XT-CF do not support slave drives so skip detection 165 171 test bh, FLG_DRVNHEAD_DRV 166 172 jnz SHORT NoSlaveDriveAvailable 167 . ShouldNotSkipSlaveDriveDetection:168 %endif ; MODULE_8BIT_IDE 173 .DoNotSkipSlaveDriveDetection: 174 %endif ; MODULE_8BIT_IDE_ADVANCED 169 175 170 176 call DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP 171 .DriveDetectionStringPrintedOnScreen: 177 172 178 %ifdef MODULE_HOTKEYS 173 179 call HotkeyBar_UpdateDuringDriveDetection … … 247 253 call DriveDetectInfo_CreateForHardDisk 248 254 jmp SHORT DetectPrint_DriveNameFromDrvDetectInfoInESBX 249 250 251 %ifdef MODULE_8BIT_IDE252 ;--------------------------------------------------------------------253 ; DetectDrives_DoesIdevarsInCSBPbelongToXTCF254 ; Parameters:255 ; CS:BP: Ptr to IDEVARS for the drive256 ; Returns:257 ; ZF: Set if IDEVARS belongs to XT-CF device258 ; Cleared if some other device259 ; Corrupts registers:260 ; AL261 ;--------------------------------------------------------------------262 DetectDrives_DoesIdevarsInCSBPbelongToXTCF:263 mov al, [cs:bp+IDEVARS.bDevice]264 cmp al, DEVICE_8BIT_XTCF_PIO8265 je SHORT .Done266 cmp al, DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD267 268 %ifdef MODULE_8BIT_IDE_ADVANCED269 je SHORT .Done270 cmp al, DEVICE_8BIT_XTCF_DMA271 %endif ; MODULE_8BIT_IDE_ADVANCED272 273 .Done: ; return state via ZF, set from the cmp instructions274 NoSlaveDriveAvailable:275 ret276 %endif ; MODULE_8BIT_IDE -
trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm
r556 r558 35 35 Initialize_FromMainBiosRomSearch: ; unused entrypoint ok 36 36 pushf ; To store IF 37 sti ; Enable interrupts for keystrokes 37 38 push ds 38 39 … … 45 46 %endif 46 47 47 sti ; Enable interrupts for keystrokes48 48 test BYTE [BDA.bKBFlgs1], (1<<2) ; Clears ZF if CTRL is held down 49 49 jnz SHORT .SkipRomInitialization -
trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm
r540 r558 97 97 .InitializeHardwareIrqHandlers: 98 98 call RamVars_GetIdeControllerCountToCX 99 mov di, ROMVARS.ideVars0+IDEVARS.bIRQ ; CS:SI points to first IDEVARS99 mov di, ROMVARS.ideVars0+IDEVARS.bIRQ 100 100 .IdeControllerLoop: 101 101 mov al, [cs:di] -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CompatibleDPT.asm
r550 r558 139 139 140 140 mov al, [si+DPT.bLchsSectorsPerTrack] 141 %ifdef USE_186 141 %ifndef USE_186 142 call StoswALandChecksumFromDL ; Bytes 14 (Logical sectors per track) and 15 (Checksum) 143 jmp SHORT FillStandardDPTtoESDIfromDPTinDSSI.RestoreOffsetsAndReturn 144 %else 142 145 push FillStandardDPTtoESDIfromDPTinDSSI.RestoreOffsetsAndReturn 143 jmp StoswALandChecksumFromDL ; Bytes 14 (Logical sectors per track) and 15 (Checksum) 144 %else 145 call StoswALandChecksumFromDL 146 jmp SHORT FillStandardDPTtoESDIfromDPTinDSSI.RestoreOffsetsAndReturn 147 %endif 146 ; Fall to StoswALandChecksumFromDL 147 %endif 148 149 150 ;-------------------------------------------------------------------- 151 ; StoswALandChecksumFromDL 152 ; Parameters: 153 ; AL: Last byte to store before checksum byte 154 ; DL: Sum of bytes so far 155 ; ES:DI: Ptr to where to store AL and Checksum byte 156 ; Returns: 157 ; DL: Sum of bytes so far 158 ; DI: Incremented by 2 159 ; Corrupts registers: 160 ; Nothing 161 ;-------------------------------------------------------------------- 162 StoswALandChecksumFromDL: 163 mov ah, al 164 add ah, dl 165 neg ah 166 stosw 167 ret 148 168 149 169 … … 226 246 %ifdef MODULE_ADVANCED_ATA 227 247 or ah, [si+DPT_ADVANCED_ATA.bPioMode] 228 jz SHORT . NoDotSetFastPioFlag248 jz SHORT .DoNotSetFastPioFlag 229 249 cmp WORD [si+DPT_ADVANCED_ATA.wControllerID], BYTE 0 230 je SHORT . NoDotSetFastPioFlag250 je SHORT .DoNotSetFastPioFlag 231 251 inc cx ; FLG_FAST_PIO_ENABLED 232 . NoDotSetFastPioFlag:252 .DoNotSetFastPioFlag: 233 253 %endif 234 254 call StoswThenAddALandAHtoDL ; Bytes 8 and 9 … … 276 296 ret 277 297 278 279 ;--------------------------------------------------------------------280 ; StoswALandChecksumFromDL281 ; Parameters:282 ; AL: Last byte to store before checksum byte283 ; DL: Sum of bytes so far284 ; ES:DI: Ptr to where to store AL and Checksum byte285 ; Returns:286 ; DL: Sum of bytes so far287 ; DI: Incremented by 2288 ; Corrupts registers:289 ; Nothing290 ;--------------------------------------------------------------------291 StoswALandChecksumFromDL:292 mov ah, al293 add ah, dl294 neg ah295 stosw296 ret -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm
r550 r558 34 34 ; ES: BDA Segment 35 35 ; Returns: 36 ; DS:DI: Ptr to Disk Parameter Table (if successful) 37 ; CF: Cleared if DPT created successfully 38 ; Set if any error 36 ; DS:DI: Ptr to Disk Parameter Table 37 ; CF: Cleared 39 38 ; Corrupts registers: 40 39 ; AX, BX, CX, DX … … 167 166 xor bx, bx 168 167 jmp SHORT .StoreTotalSectorsFromBXDXAX 169 ; Fall to .StoreNumberOfLbaSectors 168 170 169 171 170 ;-------------------------------------------------------------------- … … 209 208 ; Update drive counts (hard and floppy) 210 209 ;---------------------------------------------------------------------- 211 210 %ifdef MODULE_SERIAL 211 ; Device_FinalizeDPT returns with CF set only when a floppy was found which can't happen without MODULE_SERIAL 212 212 %ifdef MODULE_SERIAL_FLOPPY 213 213 ; … … 224 224 adc byte [RAMVARS.xlateVars+XLATEVARS.bFlopCreateCnt], 0 225 225 jnz .AllDone 226 %else 226 %else ; ~MODULE_SERIAL_FLOPPY 227 227 ; 228 228 ; Even without floppy support enabled, we shouldn't try to mount a floppy image as a hard disk, which … … 231 231 ; 232 232 jc .AllDone 233 %endif 233 %endif ; MODULE_SERIAL_FLOPPY 234 %endif ; MODULE_SERIAL 234 235 235 236 inc BYTE [RAMVARS.bDrvCnt] ; Increment drive count to RAMVARS 236 237 238 %ifdef MODULE_SERIAL 237 239 .AllDone: 238 240 clc 241 %endif 242 239 243 ret 240 244
Note:
See TracChangeset
for help on using the changeset viewer.