Changeset 169 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Device
- Timestamp:
- Aug 21, 2011, 4:39:58 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Device
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
r167 r169 128 128 129 129 ; Output Sector Address High (only used by LBA48) 130 xor ax, ax ; Sector Count High always zero since 127 sector limit 131 mov ah, BYTE [bp+IDEPACK.bLbaLowExt] 130 mov ax, [bp+IDEPACK.wSectorCountHighAndLbaLowExt] 132 131 mov cx, [bp+IDEPACK.wLbaMiddleAndHighExt] 133 132 call OutputSectorCountAndAddress -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
r167 r169 5 5 ; This struct must not be larger than IDEPACK without INTPACK. 6 6 struc PIOVARS 7 .wBlockLeftAndSectorsInLastBlock: 8 .bBlocksLeft resb 1 9 .bSectorsInLastBlock: resb 1 7 .wBlocksLeft resb 2 10 8 .wBlockSize resb 2 ; Block size in WORDs (256...32768) 11 9 .wDataPort resb 2 12 10 .bSectorsInLastBlock: resb 1 13 11 resb 1 ; Offset 7 = IDEPACK.bDeviceControl 14 12 .fnXfer resb 2 ; Offset to transfer function … … 34 32 ALIGN JUMP_ALIGN 35 33 IdeTransfer_StartWithCommandInAL: 34 mov ah, [bp+IDEPACK.bSectorCountHighExt] 35 36 36 ; Are we reading or writing? 37 37 test al, 16 ; Bit 4 is cleared on all the read commands but set on 3 of the 4 write commands … … 42 42 ; Prepare to read data to ESSI 43 43 mov bx, g_rgfnPioRead 44 call InitializePiovarsToSSBPfromIdepackInSSBP 44 mov al, [bp+IDEPACK.bSectorCount] 45 call InitializePiovarsInSSBPwithSectorCountInAX 45 46 xchg si, di 46 %ifdef USE_18647 push ReadFromDriveToESDI48 jmp Registers_NormalizeESDI49 %else50 47 call Registers_NormalizeESDI 51 jmp SHORT ReadFromDriveToESDI 52 %endif 48 jmp SHORT ReadFromDrive 53 49 54 50 ALIGN JUMP_ALIGN 55 51 .PrepareToWriteDataFromESSI: 56 52 mov bx, g_rgfnPioWrite 57 call InitializePiovarsToSSBPfromIdepackInSSBP 53 mov al, [bp+IDEPACK.bSectorCount] 54 call InitializePiovarsInSSBPwithSectorCountInAX 58 55 call Registers_NormalizeESSI 59 ; Fall to WriteToDrive FromESSI60 61 62 ;-------------------------------------------------------------------- 63 ; WriteToDrive FromESSI56 ; Fall to WriteToDrive 57 58 59 ;-------------------------------------------------------------------- 60 ; WriteToDrive 64 61 ; Parameters: 65 62 ; DS:DI: Ptr to DPT (in RAMVARS segment) … … 73 70 ; AL, BX, CX, DX, SI, ES 74 71 ;-------------------------------------------------------------------- 75 WriteToDrive FromESSI:72 WriteToDrive: 76 73 ; Always poll when writing first block (IRQs are generated for following blocks) 77 74 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ) … … 81 78 .WriteNextBlock: 82 79 mov dx, [bp+PIOVARS.wDataPort] 83 dec BYTE [bp+PIOVARS.bBlocksLeft] ; Transferring last (possibly partial) block?80 dec WORD [bp+PIOVARS.wBlocksLeft] ; Transferring last (possibly partial) block? 84 81 jz SHORT .XferLastBlock ; If so, jump to transfer 85 82 mov cx, [bp+PIOVARS.wBlockSize] ; Load block size in WORDs 86 83 call [bp+PIOVARS.fnXfer] ; Transfer full block 84 85 ; Normalize pointer when necessary 86 mov ax, si 87 shr ax, 1 ; WORD offset 88 add ax, [bp+PIOVARS.wBlockSize] 89 jns SHORT .WaitUntilReadyToTransferNextBlock 90 call Registers_NormalizeESSI 91 92 ALIGN JUMP_ALIGN 93 .WaitUntilReadyToTransferNextBlock: 87 94 %ifdef USE_186 88 95 push .WriteNextBlock … … 110 117 111 118 ;-------------------------------------------------------------------- 112 ; ReadFromDrive ToESDI119 ; ReadFromDrive 113 120 ; Parameters: 114 121 ; ES:DI: Normalized ptr to buffer to recieve data … … 124 131 ;-------------------------------------------------------------------- 125 132 ALIGN JUMP_ALIGN 126 ReadFromDrive ToESDI:133 ReadFromDrive: 127 134 ; Wait until drive is ready to transfer 128 135 xchg di, si ; DS:DI now points DPT 129 136 call IdeWait_IRQorDRQ ; Wait until ready to transfer 130 jc SHORT WriteToDrive FromESSI.ReturnWithTransferErrorInAH137 jc SHORT WriteToDrive.ReturnWithTransferErrorInAH 131 138 xchg si, di ; ES:DI now points buffer 132 139 133 140 ; Transfer full or last (possible partial) block 134 141 mov dx, [bp+PIOVARS.wDataPort] 135 dec BYTE [bp+PIOVARS.bBlocksLeft]142 dec WORD [bp+PIOVARS.wBlocksLeft] 136 143 jz SHORT .XferLastBlock 137 144 mov cx, [bp+PIOVARS.wBlockSize] ; Load block size in WORDs 138 %ifdef USE_186139 push ReadFromDriveToESDI140 jmp [bp+PIOVARS.fnXfer]141 %else142 145 call [bp+PIOVARS.fnXfer] ; Transfer full block 143 jmp SHORT ReadFromDriveToESDI ; Loop while blocks left 144 %endif 146 147 ; Normalize pointer when necessary 148 mov ax, di 149 shr ax, 1 ; WORD offset 150 add ax, [bp+PIOVARS.wBlockSize] 151 jns SHORT ReadFromDrive 152 %ifdef USE_186 153 push ReadFromDrive 154 jmp Registers_NormalizeESDI 155 %else 156 call Registers_NormalizeESDI 157 jmp SHORT ReadFromDrive ; Loop while blocks left 158 %endif 159 145 160 146 161 ALIGN JUMP_ALIGN … … 155 170 156 171 ;-------------------------------------------------------------------- 157 ; InitializePiovarsToSSBPfromIdepackInSSBP 158 ; Parameters: 172 ; InitializePiovarsInSSBPwithSectorCountInAX 173 ; Parameters: 174 ; AX: Number of sectors to transfer (1...65535) 159 175 ; BX: Offset to transfer function lookup table 160 176 ; DS:DI: Ptr to DPT (in RAMVARS segment) 161 ; SS:BP: Ptr to IDEPACK162 ; Returns:163 177 ; SS:BP: Ptr to PIOVARS 178 ; Returns: 179 ; Nothing 164 180 ; Corrupts registers: 165 181 ; AX, BX, CX, DX 166 182 ;-------------------------------------------------------------------- 167 183 ALIGN JUMP_ALIGN 168 InitializePiovars ToSSBPfromIdepackInSSBP:184 InitializePiovarsInSSBPwithSectorCountInAX: 169 185 ; Store number of blocks to transfer 170 eMOVZX cx, BYTE [di+DPT_ATA.bSetBlock] ; Block size in sectors, zero CH 171 eMOVZX ax, BYTE [bp+IDEPACK.bSectorCount] ; AX = sectors to transfer (1...128) 172 div cl ; AL = Full blocks to transfer 173 test ah, ah ; AH = Sectors in partial block 186 eMOVZX cx, BYTE [di+DPT_ATA.bSetBlock] ; Block size in sectors 187 xor dx, dx ; DX:AX = Sectors to transfer (1...65535) 188 div cx ; AX = Full blocks to transfer 189 test dx, dx 190 mov dh, cl ; DH = Full block size if no partial blocks to transfer 174 191 jz SHORT .NoPartialBlocksToTransfer 175 inc ax ; Add partial block to total block count176 SKIP2B dx ; Skip mov ah, cl192 inc ax ; Partial block 193 mov dh, dl ; DH = Size of partial block in sectors 177 194 .NoPartialBlocksToTransfer: 178 mov ah, cl ; Full block size if no partial blocks to transfer179 mov [bp+PIOVARS. wBlockLeftAndSectorsInLastBlock], ax195 mov [bp+PIOVARS.wBlocksLeft], ax 196 mov [bp+PIOVARS.bSectorsInLastBlock], dh 180 197 181 198 ; Store block size in WORDs -
trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm
r167 r169 39 39 Idepack_ConvertDapToIdepackAndIssueCommandFromAH: 40 40 mov [bp+IDEPACK.bCommand], ah 41 mov a l, [es:si+DAP.wSectorCount]41 mov ax, [es:si+DAP.wSectorCount] 42 42 mov [bp+IDEPACK.bSectorCount], al 43 mov [bp+IDEPACK.bSectorCountHighExt], ah 43 44 44 45 mov al, [es:si+DAP.qwLBA] ; LBA byte 0 … … 81 82 ALIGN JUMP_ALIGN 82 83 Idepack_TranslateOldInt13hAddressAndIssueCommandFromAH: 84 mov [bp+IDEPACK.bCommand], ah 85 test al, al 86 eCSETZ ah 83 87 mov [bp+IDEPACK.bSectorCount], al 84 mov [bp+IDEPACK.b Command], ah88 mov [bp+IDEPACK.bSectorCountHighExt], ah 85 89 86 90 push bx … … 125 129 mov [bp+IDEPACK.wSectorCountAndLbaLow], dx 126 130 mov [bp+IDEPACK.wLbaMiddleAndHigh], cx 131 mov BYTE [bp+IDEPACK.bSectorCountHighExt], 0 127 132 128 133 ; Drive and Head select byte
Note:
See TracChangeset
for help on using the changeset viewer.