Changeset 589 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src
- Timestamp:
- May 22, 2016, 12:26:57 PM (8 years ago)
- Location:
- trunk/XTIDE_Universal_BIOS/Src
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
r584 r589 33 33 IdeCommand_ResetMasterAndSlaveController: 34 34 ; HSR0: Set_SRST 35 call AccessDPT_GetDeviceControlByteToAL 36 or al, FLG_DEVCONTROL_SRST | FLG_DEVCONTROL_nIEN ; Set Reset bit 35 ; Used to be: 36 ; call AccessDPT_GetDeviceControlByteToAL 37 ; or al, FLG_DEVCONTROL_SRST | FLG_DEVCONTROL_nIEN ; Set Reset bit 38 ; Is now: 39 mov al, FLG_DEVCONTROL_SRST | FLG_DEVCONTROL_nIEN 40 ; --- 37 41 OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER DEVICE_CONTROL_REGISTER_out 38 42 mov ax, HSR0_RESET_WAIT_US … … 40 44 41 45 ; HSR1: Clear_wait 42 call AccessDPT_GetDeviceControlByteToAL 43 or al, FLG_DEVCONTROL_nIEN 44 and al, ~FLG_DEVCONTROL_SRST ; Clear reset bit 46 ; Used to be: 47 ; call AccessDPT_GetDeviceControlByteToAL 48 ; or al, FLG_DEVCONTROL_nIEN 49 ; and al, ~FLG_DEVCONTROL_SRST ; Clear reset bit 50 ; Is now: 51 mov al, FLG_DEVCONTROL_nIEN 52 ; --- 45 53 OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER DEVICE_CONTROL_REGISTER_out 46 54 mov ax, HSR1_RESET_WAIT_US … … 51 59 jmp IdeWait_PollStatusFlagInBLwithTimeoutInBH 52 60 61 ; *FIXME* AccessDPT_GetDeviceControlByteToAL currently always returns with 62 ; AL cleared (0) or with only bit 1 set (FLG_DEVCONTROL_nIEN = 2). 63 ; The commented away instructions above sets FLG_DEVCONTROL_nIEN anyway 64 ; making the call to AccessDPT_GetDeviceControlByteToAL redundant. 65 ; I have left this code as is since I don't know if it's a mistake 66 ; (from all the way back to r150) or if it's coded this way in anticipation 67 ; of some future changes to AccessDPT_GetDeviceControlByteToAL. 53 68 54 69 ;-------------------------------------------------------------------- -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDmaBlock.asm
r567 r589 94 94 ; When DI is zero only one transfer is required since we've limited the 95 95 ; XT-CFv3 block size to 32k 96 jnc SHORT .TransferLastDmaPageWithSizeInCX96 jnc SHORT StartDMAtransferForXTCFwithDmaModeInBL 97 97 98 98 ; CF was set, so DI != 0 and we might need one or two transfers 99 cmp cx, ax ; if we won't cross a physical page boundary...100 jbe SHORT .TransferLastDmaPageWithSizeInCX; ...perform the transfer in one operation99 cmp cx, ax ; if we won't cross a physical page boundary... 100 jbe SHORT StartDMAtransferForXTCFwithDmaModeInBL ; ...perform the transfer in one operation 101 101 102 102 ; Calculate how much we can transfer on first and second rounds … … 108 108 call StartDMAtransferForXTCFwithDmaModeInBL 109 109 pop cx ; Pop size for second DMA page 110 111 .TransferLastDmaPageWithSizeInCX:112 110 ; Fall to StartDMAtransferForXTCFwithDmaModeInBL 113 111 … … 115 113 ;-------------------------------------------------------------------- 116 114 ; StartDMAtransferForXTCFwithDmaModeInBL 117 ; Updated for XT-CFv3, 11-Apr-13118 115 ; Parameters: 119 116 ; BL: Byte for DMA Mode Register -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdePioBlock.asm
r580 r589 29 29 ; -------------------------------------------------------------------------------------------------- 30 30 31 32 31 %ifdef MODULE_8BIT_IDE 33 34 32 ;-------------------------------------------------------------------- 35 33 ; IdePioBlock_ReadFromXtideRev1 … … 57 55 58 56 ;-------------------------------------------------------------------- 57 ; 8-bit PIO from a single data port. 58 ; 59 59 ; IdePioBlock_ReadFrom8bitDataPort 60 ;61 ; 8-bit PIO from a single data port.62 ;63 60 ; Parameters: 64 61 ; CX: Block size in 512 byte sectors … … 68 65 ; Nothing 69 66 ; Corrupts registers: 70 ; AX, BX,CX67 ; AX, CX 71 68 ;-------------------------------------------------------------------- 72 69 ALIGN JUMP_ALIGN … … 87 84 ret 88 85 %endif 89 90 %endif ; MODULE_8BIT_IDE 91 92 93 ;-------------------------------------------------------------------- 86 %endif ; MODULE_8BIT_IDE 87 88 89 ;-------------------------------------------------------------------- 90 ; 16-bit and 32-bit PIO from a single data port. 91 ; 94 92 ; IdePioBlock_ReadFrom16bitDataPort 95 ; 96 ; 16-bit PIO from a single data port. 97 ; 93 ; IdePioBlock_ReadFrom32bitDataPort 98 94 ; Parameters: 99 95 ; CX: Block size in 512 byte sectors … … 103 99 ; Nothing 104 100 ; Corrupts registers: 105 ; AX, BX,CX101 ; AX, CX 106 102 ;-------------------------------------------------------------------- 107 103 ALIGN JUMP_ALIGN 108 104 IdePioBlock_ReadFrom16bitDataPort: 109 105 %ifdef USE_186 110 xchg cl, ch ; Sectors to WORDs106 xchg cl, ch ; Sectors to WORDs 111 107 rep insw 112 108 ret … … 126 122 127 123 ;-------------------------------------------------------------------- 124 %ifdef MODULE_ADVANCED_ATA 128 125 ALIGN JUMP_ALIGN 129 126 IdePioBlock_ReadFrom32bitDataPort: 130 db 0C1h ; SHL 131 db 0E1h ; CX 132 db 7 ; 7 (Sectors to DWORDs) 133 rep 134 db 66h ; Override operand size to 32-bit 135 db 6Dh ; INSW/INSD 136 ret 137 127 shl cx, 7 ; Sectors to DWORDs 128 rep insd 129 ret 130 %endif ; MODULE_ADVANCED_ATA 138 131 139 132 … … 145 138 146 139 %ifdef MODULE_8BIT_IDE 147 148 140 ;-------------------------------------------------------------------- 149 141 ; IdePioBlock_WriteToXtideRev1 … … 151 143 ; CX: Block size in 512-byte sectors 152 144 ; DX: IDE Data port address 153 ; ES:SI: Normalized ptr to buffer containing data145 ; DS:SI: Normalized ptr to buffer containing data 154 146 ; Returns: 155 147 ; Nothing … … 159 151 ALIGN JUMP_ALIGN 160 152 IdePioBlock_WriteToXtideRev1: 161 push ds162 153 UNROLL_SECTORS_IN_CX_TO_QWORDS 163 154 mov bl, 8 ; Bit mask for toggling data low/high reg 164 push es165 pop ds166 155 ALIGN JUMP_ALIGN 167 156 .OutswLoop: … … 170 159 %endrep 171 160 loop .OutswLoop 172 pop ds173 161 ret 174 162 … … 179 167 ; CX: Block size in 512-byte sectors 180 168 ; DX: IDE Data port address 181 ; ES:SI: Normalized ptr to buffer containing data182 ; Returns: 183 ; Nothing 184 ; Corrupts registers: 185 ; AX, BX,CX169 ; DS:SI: Normalized ptr to buffer containing data 170 ; Returns: 171 ; Nothing 172 ; Corrupts registers: 173 ; AX, CX 186 174 ;-------------------------------------------------------------------- 187 175 ALIGN JUMP_ALIGN 188 176 IdePioBlock_WriteToXtideRev2: 189 177 UNROLL_SECTORS_IN_CX_TO_QWORDS 190 push ds191 push es192 pop ds193 178 ALIGN JUMP_ALIGN 194 179 .WriteNextQword: … … 197 182 %endrep 198 183 loop .WriteNextQword 199 pop ds200 184 ret 201 185 … … 206 190 ; CX: Block size in 512-byte sectors 207 191 ; DX: IDE Data port address 208 ; ES:SI: Normalized ptr to buffer containing data209 ; Returns: 210 ; Nothing 211 ; Corrupts registers: 212 ; AX, BX,CX192 ; DS:SI: Normalized ptr to buffer containing data 193 ; Returns: 194 ; Nothing 195 ; Corrupts registers: 196 ; AX, CX 213 197 ;-------------------------------------------------------------------- 214 198 ALIGN JUMP_ALIGN … … 216 200 %ifdef USE_186 217 201 shl cx, 9 ; Sectors to BYTEs 218 es ; Source is ES segment219 202 rep outsb 220 203 ret … … 222 205 %else ; 808x 223 206 UNROLL_SECTORS_IN_CX_TO_QWORDS 224 push ds225 push es226 pop ds227 207 ALIGN JUMP_ALIGN 228 208 .WriteNextQword: … … 232 212 %endrep 233 213 loop .WriteNextQword 234 pop ds 235 ret 236 %endif 237 214 ret 215 %endif 238 216 %endif ; MODULE_8BIT_IDE 239 217 … … 245 223 ; CX: Block size in 512-byte sectors 246 224 ; DX: IDE Data port address 247 ; ES:SI: Normalized ptr to buffer containing data248 ; Returns: 249 ; Nothing 250 ; Corrupts registers: 251 ; AX, BX,CX225 ; DS:SI: Normalized ptr to buffer containing data 226 ; Returns: 227 ; Nothing 228 ; Corrupts registers: 229 ; AX, CX 252 230 ;-------------------------------------------------------------------- 253 231 ALIGN JUMP_ALIGN … … 255 233 %ifdef USE_186 256 234 xchg cl, ch ; Sectors to WORDs 257 es ; Source is ES segment258 235 rep outsw 259 236 ret … … 261 238 %else ; 808x 262 239 UNROLL_SECTORS_IN_CX_TO_QWORDS 263 push ds264 push es265 pop ds266 240 ALIGN JUMP_ALIGN 267 241 .WriteNextQword: … … 271 245 %endrep 272 246 loop .WriteNextQword 273 pop ds274 ret 275 %endif 276 277 ;-------------------------------------------------------------------- 247 ret 248 %endif 249 250 ;-------------------------------------------------------------------- 251 %ifdef MODULE_ADVANCED_ATA 278 252 ALIGN JUMP_ALIGN 279 253 IdePioBlock_WriteTo32bitDataPort: 280 db 0C1h ; SHL 281 db 0E1h ; CX 282 db 7 ; 7 (Sectors to DWORDs) 283 es ; Source is ES segment 284 rep 285 db 66h ; Override operand size to 32-bit 286 db 6Fh ; OUTSW/OUTSD 287 ret 254 shl cx, 7 ; Sectors to DWORDs 255 rep outsd 256 ret 257 %endif ; MODULE_ADVANCED_ATA -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
r584 r589 173 173 cmp [bp+PIOVARS.bSectorsLeft], cl 174 174 jbe SHORT .WriteLastBlockToDrive 175 push ds 176 push es 177 pop ds 175 178 call [bp+PIOVARS.fnXfer] 176 179 pop ds 177 180 ; Wait until ready for next block and check for errors 178 181 call IdeWait_IRQorDRQ ; Wait until ready to transfer … … 189 192 mov cl, [bp+PIOVARS.bSectorsLeft] ; CH is already zero 190 193 push cx 194 push ds 195 push es 196 pop ds 191 197 call [bp+PIOVARS.fnXfer] ; Transfer possibly partial block 198 pop ds 192 199 jmp SHORT CheckErrorsAfterTransferringLastBlock 193 200 … … 237 244 ; Convert ES:SI to physical address 238 245 %ifdef USE_386 239 240 246 mov dx, es 241 247 xor ax, ax … … 247 253 248 254 %elifdef USE_186 249 ; Bytes EU Cycles(286) 250 mov ax, es ; 2 2 251 rol ax, 4 ; 3 9 252 mov dx, ax ; 2 2 253 and ax, BYTE 0Fh; 3 3 254 xor dx, ax ; 2 2 255 add si, dx ; 2 2 256 adc al, ah ; 2 2 257 mov es, ax ; 2 2 258 ;------------------------------------ 259 ; 18 24 255 mov ax, es 256 rol ax, 4 257 mov dx, ax 258 and ax, 0Fh 259 xor dx, ax 260 add si, dx 261 adc al, ah 262 mov es, ax 263 260 264 %else ; 808x 261 ; Bytes EU Cycles(808x) 262 mov al, 4 ; 2 4 263 mov dx, es ; 2 2 264 xchg cx, ax ; 1 3 265 rol dx, cl ; 2 24 266 mov cx, dx ; 2 2 267 xchg cx, ax ; 1 3 268 and ax, BYTE 0Fh; 3 4 269 xor dx, ax ; 2 3 270 add si, dx ; 2 3 271 adc al, ah ; 2 3 272 mov es, ax ; 2 2 273 ;------------------------------------ 274 ; 21 53 275 ; 276 ; Judging by the Execution Unit cycle count the above block of code is 277 ; apparently slower. However, the shifts and rotates in the block below 278 ; execute faster than the Bus Interface Unit on an 8088 can fetch them, 279 ; thus causing the EU to starve. The difference in true execution speed 280 ; (if any) might not be worth the extra 5 bytes. 281 ; In other words, we could use a real world test here. 282 ; 283 %if 0 284 ; Bytes EU Cycles(808x/286) 285 xor dx, dx ; 2 3/2 286 mov ax, es ; 2 2/2 287 %rep 4 288 shl ax, 1 ; 8 8/8 289 rcl dx, 1 ; 8 8/8 290 %endrep 291 add si, ax ; 2 3/2 292 adc dl, dh ; 2 3/2 293 mov es, dx ; 2 2/2 294 ;------------------------------------ 295 ; 26 29/26 296 %endif ; 0 265 mov al, 4 266 mov dx, es 267 xchg cx, ax 268 rol dx, cl 269 mov cx, dx 270 xchg cx, ax 271 and ax, 0Fh 272 xor dx, ax 273 add si, dx 274 adc al, ah 275 mov es, ax 276 297 277 %endif 298 278 … … 334 314 %ifdef USE_AT ; CF is always clear for XT builds 335 315 ; AH = RET_HD_INVALID (01) if CF set, RET_HD_SUCCESS (00) if not. CF unchanged. 316 %ifdef USE_386 317 setc ah 318 %else 336 319 sbb ah, ah 337 320 neg ah 338 321 %endif 322 %endif ; USE_AT 339 323 ret 340 324 … … 345 329 g_rgfnPioRead: 346 330 dw IdePioBlock_ReadFrom16bitDataPort ; 0, DEVICE_16BIT_ATA 331 %ifdef MODULE_ADVANCED_ATA 347 332 dw IdePioBlock_ReadFrom32bitDataPort ; 1, DEVICE_32BIT_ATA 333 %elifdef MODULE_8BIT_IDE 334 dw NULL 335 %endif ; MODULE_ADVANCED_ATA 348 336 %ifdef MODULE_8BIT_IDE 349 337 dw IdePioBlock_ReadFrom8bitDataPort ; 2, DEVICE_8BIT_ATA … … 361 349 g_rgfnPioWrite: 362 350 dw IdePioBlock_WriteTo16bitDataPort ; 0, DEVICE_16BIT_ATA 351 %ifdef MODULE_ADVANCED_ATA 363 352 dw IdePioBlock_WriteTo32bitDataPort ; 1, DEVICE_32BIT_ATA 353 %elifdef MODULE_8BIT_IDE 354 dw NULL 355 %endif ; MODULE_ADVANCED_ATA 364 356 %ifdef MODULE_8BIT_IDE 365 357 dw IdePioBlock_WriteTo8bitDataPort ; 2, DEVICE_8BIT_ATA -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm
r568 r589 98 98 %endif 99 99 cld ; String instructions to increment pointers 100 CREATE_FRAME_INTPACK_TO_SSBP SIZE_OF_IDEPACK_WITHOUT_INTPACK 100 ePUSHA 101 push ds 102 push es 103 %ifdef USE_386 104 ; push fs 105 ; push gs 106 %endif 107 sub sp, BYTE SIZE_OF_IDEPACK_WITHOUT_INTPACK 108 mov bp, sp 101 109 call RamVars_GetSegmentToDS 102 110 … … 297 305 ; on INT 13h to enable interrupts. 298 306 or BYTE [bp+IDEPACK.intpack+INTPACK.flags+1], (FLG_FLAGS_IF>>8) 299 mov sp, bp ; This makes possible to exit anytime, no matter what is on stack 300 RESTORE_FRAME_INTPACK_FROM_SSBP SIZE_OF_IDEPACK_WITHOUT_INTPACK 307 308 lea sp, [bp+SIZE_OF_IDEPACK_WITHOUT_INTPACK] 309 %ifdef USE_386 310 ; pop gs 311 ; pop fs 312 %endif 313 pop es 314 pop ds 315 ePOPA 316 iret 301 317 302 318 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1Eh_XTCF.asm
r588 r589 152 152 153 153 154 %if 0155 ; We always need to enable 8-bit mode since 16-bit mode is restored156 ; when controller is reset (AH=00h or 0Dh)157 ePUSH_T bx, AH23h_Enable8bitPioMode158 159 ; Convert mode to device type (see XTCF.inc for full details)160 and ax, 3161 jz SHORT .Set8bitPioMode ; XTCF_8BIT_PIO_MODE = 0162 dec ax ; XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD = 1163 jz SHORT .Set8bitPioModeWithBIUOffload164 dec ax ; XTCF_16BIT_PIO_WITH_BIU_OFFLOAD = 2165 jz SHORT .Set16bitPioModeWithBIUOffload166 167 ; XTCF_DMA_MODE = 3168 mov BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA169 170 ; DMA transfers have limited block size171 mov al, [di+DPT_ATA.bBlockSize]172 cmp al, XTCF_DMA_MODE_MAX_BLOCK_SIZE173 jbe SHORT AH24h_SetBlockSize174 mov al, XTCF_DMA_MODE_MAX_BLOCK_SIZE175 jmp SHORT AH24h_SetBlockSize176 177 .Set16bitPioModeWithBIUOffload:178 pop bx ; Do not enable 8-bit PIO...179 ePUSH_T bx, AH23h_Disable8bitPioMode ; ...disable it instead180 mov al, DEVICE_8BIT_XTCF_PIO16_WITH_BIU_OFFLOAD181 SKIP2B bx182 183 .Set8bitPioMode:184 mov al, DEVICE_8BIT_XTCF_PIO8185 SKIP2B bx186 187 .Set8bitPioModeWithBIUOffload:188 mov al, DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD189 mov [di+DPT_ATA.bDevice], al190 ret191 %endif ; 0192 193 194 154 ;-------------------------------------------------------------------- 195 155 ; AH1Eh_GetCurrentXTCFmodeToAX … … 197 157 ; DS:DI: Ptr to DPT (in RAMVARS segment) 198 158 ; Returns: 199 ; AX: XT-CF mode ( XTCF_8BIT_PIO_MODE, XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD, XTCF_16BIT_PIO_WITH_BIU_OFFLOAD or XTCF_DMA_MODE)159 ; AX: XT-CF mode (see XTCF.inc) 200 160 ; CF: Clear 201 161 ; Corrupts registers: … … 208 168 ret 209 169 210 %if 0211 mov al, [di+DPT_ATA.bDevice]212 shr al, 1213 cbw214 sub al, XTCF_DEVICE_OFFSET >> 1215 ret216 %endif ; 0 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH23h_HFeatures.asm
r584 r589 92 92 mov si, FEATURE_ENABLE_8BIT_PIO_TRANSFER_MODE 93 93 jmp SHORT AH23h_SetControllerFeatures 94 95 %ifdef MODULE_8BIT_IDE_ADVANCED 94 96 AH23h_Disable8bitPioMode: 95 97 mov si, FEATURE_DISABLE_8BIT_PIO_TRANSFER_MODE … … 97 99 xor ah, ah ; Clear error since modern drives might not understand the command and are 98 100 ret ; always in 16-bit mode anyway 99 %endif 101 %endif ; MODULE_8BIT_IDE_ADVANCED 102 %endif ; MODULE_8BIT_IDE -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm
r526 r589 40 40 ; AH: Int 13h/40h floppy return status 41 41 ; AL: Burst error length if AH returns 11h (we never return error code 11h) 42 ; Number of sectors actually read (only valid if CF set for some BIOSes)42 ; Number of sectors actually read (only valid if CF set for some BIOSes) 43 43 ; CF: 0 if successful, 1 if error 44 44 ;-------------------------------------------------------------------- -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH3h_HWrite.asm
r526 r589 39 39 ; Returns with INTPACK: 40 40 ; AH: Int 13h/40h floppy return status 41 ; AL: Number of sectors actually written (only valid if CF set for some BIOSes)41 ; AL: Number of sectors actually written (only valid if CF set for some BIOSes) 42 42 ; CF: 0 if successful, 1 if error 43 43 ;-------------------------------------------------------------------- -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
r588 r589 184 184 185 185 ; Advanced PIO mode 3 and above 186 mov dl, [di+DPT_ADVANCED_ATA.bPioMode]187 or dl, PIO_FLOW_CONTROL_MODE_xxx186 mov dl, PIO_FLOW_CONTROL_MODE_xxx 187 or dl, [di+DPT_ADVANCED_ATA.bPioMode] 188 188 189 189 .IordyNotSupported: -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Address.asm
r568 r589 174 174 ; +=sectToSeek-1 (24-bit result) 175 175 ; Max = 16,450,497 + 63 - 1 = 16,450,559 = FB03FFh 176 xor bh, bh ; Sector number now in BX176 mov bh, ch ; Sector number now in BX, CH=zero 177 177 dec bx ; sectToSeek-=1 178 add ax, bx ; Add to loword 179 adc dl, bh ; Add possible carry to byte2, BH=zero 180 181 ; Copy DX:AX to proper return registers 182 xchg bx, ax ; BL = Sector Number Register (LBA 7...0) 183 mov cl, bh ; Low Cylinder Register (LBA 15...8) 184 mov ch, dl ; High Cylinder Register (LBA 23...16) 185 mov bh, dh ; Drive and Head Register (LBA 27...24) 178 add bx, ax ; Add loword to BX (BL = Sector Number Register (LBA 7...0)) 179 adc ch, dl ; Add possible carry to byte2 (CH = High Cylinder Register (LBA 23...16)) 180 mov cl, bh ; CL = Low Cylinder Register (LBA 15...8) 181 mov bh, dh ; BH = Drive and Head Register (LBA 27...24) 186 182 ret -
trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/AdvAtaInit.asm
r587 r589 37 37 AdvAtaInit_DetectControllerForIdeBaseInBX: 38 38 call Vision_DetectAndReturnIDinAXandPortInDXifControllerPresent 39 jne SHORT .NoAdvancedControllerForPortBX 39 jnz SHORT .NoVisionControllerFound 40 40 41 call Vision_DoesIdePortInBXbelongToControllerWithIDinAX 41 jne SHORT .NoAdvancedControllerForPortBX 42 jz SHORT .AdvancedControllerFoundForPortBX 43 44 .NoVisionControllerFound: 42 45 call PDC20x30_DetectControllerForIdeBaseInBX 43 46 jnc SHORT .NoAdvancedControllerForPortBX 44 47 45 stc ; Advanced Controller found for port BX 48 .AdvancedControllerFoundForPortBX: 49 stc 46 50 ret 47 51 48 52 .NoAdvancedControllerForPortBX: 49 xor ax, ax 53 xor ax, ax ; Clear ID in AX and CF 50 54 ret 51 55 … … 66 70 AdvAtaInit_GetControllerMaxPioModeToALandMinPioCycleTimeToBX: 67 71 cmp ah, ID_QD6580_ALTERNATE 72 %ifdef USE_386 73 jae Vision_GetMaxPioModeToALandMinCycleTimeToBX 74 jmp PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX 75 %else 68 76 jae SHORT .Vision 69 77 jmp PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX 70 78 .Vision: 71 79 jmp Vision_GetMaxPioModeToALandMinCycleTimeToBX 80 %endif 72 81 73 82 … … 88 97 test ax, ax 89 98 jz SHORT .NoAdvancedController ; Return with CF cleared 90 99 91 100 cmp ah, ID_QD6580_ALTERNATE 92 101 jae SHORT .Vision … … 98 107 99 108 call AdvAtaInit_LoadMasterDPTtoDSSIifSlaveInDSDI 100 call Vision_InitializeWithIDinAH andConfigInAL109 call Vision_InitializeWithIDinAH 101 110 xor ax, ax ; Success 102 111 … … 116 125 ; Zero if Slave Drive not present 117 126 ; Corrupts registers: 118 ; A X127 ; AL 119 128 ;-------------------------------------------------------------------- 120 129 AdvAtaInit_LoadMasterDPTtoDSSIifSlaveInDSDI: -
trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/PDC20x30.asm
r588 r589 36 36 mov dx, bx 37 37 call EnablePdcProgrammingMode 38 jz .ControllerDetected 39 clc 40 ret 41 .ControllerDetected: 42 call GetPdcIDtoAX 38 jnz SHORT DisablePdcProgrammingMode.Return ; PDC controller not detected 39 ; ePUSH_T ax, DisablePdcProgrammingMode ; Uncomment this if GetPdcIDtoAX needs to be a real function 40 ; Fall to GetPdcIDtoAX 41 42 ;-------------------------------------------------------------------- 43 ; Programming mode must be enabled for this function. 44 ; This function also enables PDC 20630 extra registers. 45 ; 46 ; GetPdcIDtoAX 47 ; Parameters: 48 ; DX: IDE Base port 49 ; Returns: 50 ; AH: PDC ID 51 ; Corrupts registers: 52 ; AL, BX 53 ;-------------------------------------------------------------------- 54 GetPdcIDtoAX: 55 push dx 56 57 ; Try to enable PDC 20630 extra registers 58 add dx, BYTE LOW_CYLINDER_REGISTER 59 in al, dx 60 or al, FLG_PDCLCR_ENABLE_EXTRA_REGISTERS 61 out dx, al 62 63 ; Try to access PDC 20630 registers to see if they are available 64 ; Hopefully this does not cause problems for systems with PDC 20230 65 add dx, BYTE PDC20630_INDEX_REGISTER - LOW_CYLINDER_REGISTER 66 mov al, PDCREG7_STATUS ; Try to access PDC 20630 status register 67 out dx, al 68 xchg bx, ax 69 in al, dx ; Does index register contain status register index? 70 cmp al, bl 71 mov ah, ID_PDC20630 72 eCMOVNE ah, ID_PDC20230 73 74 pop dx 75 ; ret ; Uncomment this to make GetPdcIDtoAX a real function 43 76 ; Fall to DisablePdcProgrammingMode 44 77 … … 49 82 ; DX: Base port 50 83 ; Returns: 51 ; Nothing84 ; CF: Set 52 85 ; Corrupts registers: 53 86 ; AL … … 56 89 add dx, BYTE HIGH_CYLINDER_REGISTER 57 90 in al, dx 58 sub dx, BYTE HIGH_CYLINDER_REGISTER59 stc ; Set for PDC20x30_DetectControllerForIdeBaseInBX 91 add dx, -HIGH_CYLINDER_REGISTER ; Sets CF for PDC20x30_DetectControllerForIdeBaseInBX 92 .Return: 60 93 ret 61 94 … … 66 99 ; DX: Base port 67 100 ; Returns: 101 ; CF: Cleared 68 102 ; ZF: Set if programming mode enabled 69 103 ; Corrupts registers: … … 72 106 EnablePdcProgrammingMode: 73 107 ; Set bit 7 to sector count register 74 add dx, BYTE SECTOR_COUNT_REGISTER 75 in al, dx 108 inc dx 109 inc dx 110 in al, dx ; 1F2h (SECTOR_COUNT_REGISTER) 76 111 or al, 80h 77 112 out dx, al … … 93 128 ; PDC20230C and PDC20630 clears the bit we set at the beginning 94 129 in al, dx 95 sub dx, BYTE SECTOR_COUNT_REGISTER 96 test al, 80h 97 ret 98 99 100 ;-------------------------------------------------------------------- 101 ; Programming mode must be enabled for this function. 102 ; This function also enables PDC 20630 extra registers. 103 ; 104 ; GetPdcIDtoAX 105 ; Parameters: 106 ; DX: IDE Base port 107 ; Returns: 108 ; AX: PDC ID word 109 ; Corrupts registers: 110 ; BX 111 ;-------------------------------------------------------------------- 112 GetPdcIDtoAX: 113 ; Try to enable PDC 20630 extra registers 114 add dx, BYTE LOW_CYLINDER_REGISTER 115 in al, dx 116 or al, FLG_PDCLCR_ENABLE_EXTRA_REGISTERS 117 out dx, al 118 119 ; Try to access PDC 20630 registers to see if they are available 120 ; Hopefully this does not cause problems for systems with PDC 20230 121 add dx, BYTE PDC20630_INDEX_REGISTER - LOW_CYLINDER_REGISTER 122 mov al, PDCREG7_STATUS ; Try to access PDC 20630 status register 123 out dx, al 124 xchg bx, ax 125 in al, dx ; Does index register contain status register index? 126 cmp al, bl 127 mov ah, ID_PDC20630 128 eCMOVNE ah, ID_PDC20230 130 dec dx 131 dec dx ; Base port 132 test al, 80h ; Clears CF 129 133 ret 130 134 … … 145 149 PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX: 146 150 cmp ah, ID_PDC20630 147 je SHORT . return ; No need to limit anything151 je SHORT .Return ; No need to limit anything 148 152 mov ax, 2 ; Limit PIO to 2 for ID_PDC20230 149 153 mov bx, PIO_2_MIN_CYCLE_TIME_NS 150 154 stc 151 . return:155 .Return: 152 156 ret 153 157 … … 165 169 ;-------------------------------------------------------------------- 166 170 PDC20x30_InitializeForDPTinDSDI: 171 %ifdef USE_386 172 xor ch, ch 173 test BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE 174 setnz cl 175 %else 167 176 xor cx, cx 168 177 test BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE 169 eCSETNZ cl 178 jz SHORT .NotSlave 179 inc cx 180 .NotSlave: 181 %endif 170 182 171 183 mov dx, [di+DPT.wBasePort] … … 173 185 call SetSpeedForDriveInCX 174 186 cmp BYTE [di+DPT_ADVANCED_ATA.wControllerID+1], ID_PDC20630 175 jne .initializationCompleted187 jne SHORT .InitializationCompleted 176 188 call SetPdc20630SpeedForDriveInCX 177 . initializationCompleted:189 .InitializationCompleted: 178 190 mov dx, [di+DPT.wBasePort] 179 191 call DisablePdcProgrammingMode … … 201 213 mov bh, ~MASK_PDCSCR_DEV1SPEED ; Assume slave 202 214 inc cx 203 loop . setSpeed215 loop .SetSpeed 204 216 eSHL_IM bl, POS_PDCSCR_DEV0SPEED 205 217 mov bh, ~MASK_PDCSCR_DEV0SPEED 206 . setSpeed:218 .SetSpeed: 207 219 in al, dx 208 220 and al, bh 209 221 or al, bl 210 222 cmp bl, 7 211 jb SHORT OutputNewValue223 jb SHORT .OutputNewValue 212 224 or al, FLG_PDCSCR_UNKNOWN_BIT7 ; Flag for PIO 2 and above? 213 jmp SHORT OutputNewValue 225 .OutputNewValue: 226 out dx, al 227 ret 214 228 215 229 .rgbPioModeToPDCspeedValue: … … 228 242 ; DX: Low Cylinder Register 229 243 ; Corrupts registers: 230 ; AX , CX244 ; AX 231 245 ;-------------------------------------------------------------------- 232 246 SetPdc20630SpeedForDriveInCX: 233 247 inc dx ; LOW_CYLINDER_REGISTER 234 mov ah, FLG_PDCLCR_DEV0SPEED_BIT4 | FLG_PDCLCR_DEV0IORDY 235 shr ah, cl 236 in al, dx 237 not ah 248 mov ah, ~(FLG_PDCLCR_DEV0SPEED_BIT4 | FLG_PDCLCR_DEV0IORDY) 249 ror ah, cl 250 in al, dx 238 251 and al, ah ; Clear drive specific bits 239 252 cmp BYTE [di+DPT_ADVANCED_ATA.bPioMode], 2 240 jbe . clearBitsOnly253 jbe .ClearBitsOnly 241 254 not ah 242 255 or al, ah 243 .clearBitsOnly: 244 OutputNewValue: 245 out dx, al 246 ret 247 256 .ClearBitsOnly: 257 out dx, al 258 ret 259 -
trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/Vision.asm
r582 r589 29 29 ; AX: ID WORD specific for QDI Vision Controllers 30 30 ; (AL = QD65xx Config Register contents) 31 ; (AH = QDI Vision Controller ID (bits 4...7))31 ; (AH = QDI Vision Controller ID) 32 32 ; DX: Controller port (not IDE port) 33 33 ; ZF: Set if controller found … … 46 46 ; from Axh to Bxh. 47 47 call IsConfigRegisterWithIDinAL 48 je SHORT VisionControllerDetected 48 je SHORT VisionControllerDetected.Return 49 49 50 50 ; Check QD65xx alternative base port 51 ordl, QD65XX_ALTERNATIVE_BASE_PORT51 mov dl, QD65XX_ALTERNATIVE_BASE_PORT 52 52 in al, QD65XX_ALTERNATIVE_BASE_PORT + QD65XX_CONFIG_REGISTER_in 53 53 %endif ; DANGEROUS_DETECTION … … 68 68 mov ah, al 69 69 and al, MASK_QDCONFIG_CONTROLLER_ID 70 cmp al, ID_QD6500 << 470 cmp al, ID_QD6500 71 71 je SHORT VisionControllerDetected 72 cmp al, ID_QD6580 << 472 cmp al, ID_QD6580 73 73 je SHORT VisionControllerDetected 74 cmp al, ID_QD6580_ALTERNATE << 474 cmp al, ID_QD6580_ALTERNATE 75 75 VisionControllerDetected: 76 76 xchg ah, al 77 .Return: 77 78 ret 78 79 … … 82 83 ; Parameters: 83 84 ; AL: QD65xx Config Register contents 84 ; AH: QDI Vision Controller ID (bits 4...7)85 ; AH: QDI Vision Controller ID 85 86 ; BX: IDE Base port to check 86 87 ; DX: Vision Controller port … … 92 93 ;-------------------------------------------------------------------- 93 94 Vision_DoesIdePortInBXbelongToControllerWithIDinAX: 94 cmp ah, ID_QD6500 << 495 cmp ah, ID_QD6500 95 96 je SHORT .DoesIdePortInDXbelongToQD6500 96 97 … … 128 129 ; Parameters: 129 130 ; AL: QD65xx Config Register contents 130 ; AH: QDI Vision Controller ID (bits 4...7)131 ; AH: QDI Vision Controller ID 131 132 ; Returns: 132 133 ; AL: Max supported PIO mode … … 139 140 ;-------------------------------------------------------------------- 140 141 Vision_GetMaxPioModeToALandMinCycleTimeToBX: 141 cmp ah, ID_QD6500 << 4142 cmp ah, ID_QD6500 142 143 jne SHORT .NoNeedToLimitForQD6580 143 144 … … 149 150 150 151 ;-------------------------------------------------------------------- 151 ; Vision_InitializeWithIDinAHandConfigInAL 152 ; Parameters: 153 ; AL: QD65xx Config Register contents 154 ; AH: QDI Vision Controller ID (bits 4...7) 152 ; Vision_InitializeWithIDinAH 153 ; Parameters: 154 ; AH: QDI Vision Controller ID 155 155 ; DS:DI: Ptr to DPT for Single or Slave Drive 156 156 ; SI: Offset to Master DPT if Slave Drive present … … 162 162 ; AX, BX, CX, DX, BP 163 163 ;-------------------------------------------------------------------- 164 Vision_InitializeWithIDinAH andConfigInAL:164 Vision_InitializeWithIDinAH: 165 165 ; QD6580 has a Control Register that needs to be programmed 166 cmp ah, ID_QD6500 << 4166 cmp ah, ID_QD6500 167 167 mov dx, [di+DPT_ADVANCED_ATA.wControllerBasePort] 168 168 mov bp, QD6500_MAX_ACTIVE_TIME_CLOCKS | (QD6500_MIN_ACTIVE_TIME_CLOCKS << 8) ; Assume QD6500 -
trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm
r580 r589 81 81 mov al, [cs:ROMVARS.wFlags] ; Configurator set to always scan? 82 82 or al, [es:BDA.bKBFlgs1] ; Or, did the user hold down the ALT key? 83 and al, 8 ; 8 = alt key depressed, same as FLG_ROMVARS_SERIAL_ ALWAYSDETECT83 and al, 8 ; 8 = alt key depressed, same as FLG_ROMVARS_SERIAL_SCANDETECT 84 84 jnz .DriveDetectLoop 85 85 %endif ; MODULE_SERIAL … … 135 135 136 136 shr ch, 1 ; number of drives, 1 or 2 only, to CF flag (clear=1, set=2) 137 rclal, 1 ; starting drive number in upper 7 bits, number of drives in low bit137 eRCL_IM al, 1 ; starting drive number in upper 7 bits, number of drives in low bit 138 138 .NoFloppies: 139 139 mov [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst], al -
trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm
r568 r589 90 90 %ifdef MODULE_SERIAL 91 91 cmp dh, DEVICE_SERIAL_PORT ; Check if this is a serial device 92 93 jnz .pushAndPrint ; CX = string to print, AX = port address, DX won't be used 92 jne SHORT .pushAndPrint ; CX = string to print, AX = port address, DX won't be used 94 93 95 94 mov cl, (g_szDetectCOM-$$) & 0xff ; Setup print string for COM ports … … 106 105 107 106 test dl, dl ; Check if serial port "Auto" 108 jz .pushAndPrintSerial; CX = string to print, AX and DX won't be used107 jz SHORT .pushAndPrintSerial ; CX = string to print, AX and DX won't be used 109 108 110 109 mov cl, (g_szDetectCOMLarge-$$) & 0xff ; Setup secondary print string for "COMn/xx.yK" 111 110 112 mov al, ah ; baud rate divisor to AL111 mov al, ah ; baud rate divisor to AL 113 112 cbw ; clear AH, AL will always be less than 128 114 xchg si, ax ; move AX to SI for divide115 mov ax, 1152; baud rate to display is 115200/divisor, the "00" is handled113 xchg si, ax ; move AX to SI for divide 114 mov ax, 1152 ; baud rate to display is 115200/divisor, the "00" is handled 116 115 ; in the print strings 117 116 cwd ; clear top 16-bits of dividend 118 117 div si ; and divide... Now AX = baud rate/100, DX = 0 (always a clean divide) 119 118 120 mov si, 10 ; Now separate the whole portion from the fractional for "K" display119 mov si, 10 ; Now separate the whole portion from the fractional for "K" display 121 120 div si ; and divide... Now AX = baud rate/1000, DX = low order digit 122 121 123 cmp ax, si ; < 10: "2400", "9600", etc.; >= 10: "19.2K", "38.4K", etc.124 jae .pushAndPrintSerial122 cmp ax, si ; < 10: "2400", "9600", etc.; >= 10: "19.2K", "38.4K", etc. 123 jae SHORT .pushAndPrintSerial 125 124 126 125 mov cl, (g_szDetectCOMSmall-$$) & 0xff ; Setup secondary print string for "COMn/XXy00" … … 150 149 DetectPrint_DriveNameFromDrvDetectInfoInESBX: 151 150 push bp 152 mov bp, sp153 lea si, [bx+DRVDETECTINFO.szDrvName]151 mov bp, sp 152 lea si, [bx+DRVDETECTINFO.szDrvName] 154 153 push si 155 mov si, g_szDriveName154 mov si, g_szDriveName 156 155 jmp SHORT DetectPrint_FormatCSSIfromParamsInSSBP 157 156 … … 276 275 ; 277 276 push bp 278 mov bp, sp277 mov bp, sp 279 278 ; Fall to DetectPrint_FormatCSSIfromParamsInSSBP 280 279 -
trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm
r580 r589 240 240 push cx 241 241 xchg ax, cx ; IRQ index to CL 242 mov ch, 1 ; Load 1 to be shifted 243 shl ch, cl ; Shift bit to correct position 244 not ch ; Invert to create bit mask for clearing 242 mov ch, ~1 ; Load bit mask to be rotated 243 rol ch, cl ; Rotate mask to correct position for clearing 245 244 in al, dx ; Read Interrupt Mask Register 246 245 and al, ch ; Clear wanted bit -
trunk/XTIDE_Universal_BIOS/Src/Main.asm
r588 r589 117 117 118 118 %ifdef MODULE_SERIAL 119 at ROMVARS.ideVarsSerialAuto+IDEVARS.bDevice, 119 at ROMVARS.ideVarsSerialAuto+IDEVARS.bDevice, db DEVICE_SERIAL_PORT 120 120 %endif 121 121 %else … … 134 134 at ROMVARS.bIdleTimeout, db 0 ; Standby timer disabled by default 135 135 136 %ifdef MODULE_8BIT_IDE_ADVANCED 137 at ROMVARS.ideVars0+IDEVARS.wBasePort, dw DEVICE_XTIDE_DEFAULT_PORT ; Controller Command Block base port 138 at ROMVARS.ideVars0+IDEVARS.bDevice, db DEVICE_8BIT_XTCF_PIO8 136 %ifndef MODULE_8BIT_IDE 137 at ROMVARS.ideVars0+IDEVARS.wBasePort, dw DEVICE_ATA_PRIMARY_PORT ; Controller Command Block base port 138 at ROMVARS.ideVars0+IDEVARS.wControlBlockPort, dw DEVICE_ATA_PRIMARY_PORTCTRL ; Controller Control Block base port 139 at ROMVARS.ideVars0+IDEVARS.bDevice, db DEVICE_16BIT_ATA 140 %elifdef MODULE_8BIT_IDE_ADVANCED 141 at ROMVARS.ideVars0+IDEVARS.wBasePort, dw DEVICE_XTIDE_DEFAULT_PORT ; Controller Command Block base port 142 at ROMVARS.ideVars0+IDEVARS.bDevice, db DEVICE_8BIT_XTCF_PIO8 139 143 %else 140 at ROMVARS.ideVars0+IDEVARS.wBasePort, 141 at ROMVARS.ideVars0+IDEVARS.wControlBlockPort, 142 at ROMVARS.ideVars0+IDEVARS.bDevice, 144 at ROMVARS.ideVars0+IDEVARS.wBasePort, dw DEVICE_XTIDE_DEFAULT_PORT ; Controller Command Block base port 145 at ROMVARS.ideVars0+IDEVARS.wControlBlockPort, dw DEVICE_XTIDE_DEFAULT_PORTCTRL ; Controller Control Block base port 146 at ROMVARS.ideVars0+IDEVARS.bDevice, db DEVICE_8BIT_XTIDE_REV1 143 147 %endif 144 148 at ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 145 149 at ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 146 150 151 at ROMVARS.ideVars1+IDEVARS.wBasePort, dw DEVICE_ATA_SECONDARY_PORT 152 at ROMVARS.ideVars1+IDEVARS.wControlBlockPort, dw DEVICE_ATA_SECONDARY_PORTCTRL 153 at ROMVARS.ideVars1+IDEVARS.bDevice, db DEVICE_16BIT_ATA 147 154 at ROMVARS.ideVars1+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 148 155 at ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 149 156 157 at ROMVARS.ideVars2+IDEVARS.wBasePort, dw DEVICE_ATA_TERTIARY_PORT 158 at ROMVARS.ideVars2+IDEVARS.wControlBlockPort, dw DEVICE_ATA_TERTIARY_PORTCTRL 159 at ROMVARS.ideVars2+IDEVARS.bDevice, db DEVICE_16BIT_ATA 150 160 at ROMVARS.ideVars2+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 151 161 at ROMVARS.ideVars2+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 152 162 163 at ROMVARS.ideVars3+IDEVARS.wBasePort, dw DEVICE_ATA_QUATERNARY_PORT 164 at ROMVARS.ideVars3+IDEVARS.wControlBlockPort, dw DEVICE_ATA_QUATERNARY_PORTCTRL 165 at ROMVARS.ideVars3+IDEVARS.bDevice, db DEVICE_16BIT_ATA 153 166 at ROMVARS.ideVars3+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 154 167 at ROMVARS.ideVars3+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 155 168 156 169 %ifdef MODULE_SERIAL 157 at ROMVARS.ideVarsSerialAuto+IDEVARS.bDevice, 170 at ROMVARS.ideVarsSerialAuto+IDEVARS.bDevice, db DEVICE_SERIAL_PORT 158 171 %endif 159 172 %endif … … 286 299 %include "AH41h_CheckIfExtensionsPresent.asm" 287 300 %endif 301 302 303 ; Although it's very unlikely to happen, we give warnings for builds that cannot be automatically checksummed due to the size being too large. 304 ; In some cases it's theoretically possible to checksum the build anyway (manually) which is why these are warnings and not errors. 305 %if BIOS_SIZE = 8192 ; A small build, possibly a candidate for the ROM socket on a 3Com 3C503 card. 306 %if ($-$$) <= BIOS_SIZE ; Only give warnings when the problem isn't obvious anyway. 307 %if ($-$$) > BIOS_SIZE - 3 308 %warning "This build is too large to be auto-checksummed!" 309 %endif 310 %endif 311 %elif ($-$$) = BIOS_SIZE ; A large build. 312 %warning "This build is too large to be auto-checksummed!" 313 %endif -
trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuPrint.asm
r583 r589 39 39 mov si, g_szRomBootDash ; Standard "Rom Boot" but with a "-" at the front 40 40 mov al, 20h ; The space between "Rom" and "Boot" 41 jnc .ROMBoot; display "Rom Boot" option for last entry41 jnc SHORT .ROMBoot ; display "Rom Boot" option for last entry 42 42 43 43 call FindDPT_ForDriveNumberInDL 44 jc .notOurs44 jc SHORT .notOurs 45 45 46 46 call DriveDetectInfo_ConvertDPTtoBX 47 47 mov si, g_szDriveNumBOOTNFO ; special g_szDriveNum that prints from BDA 48 jmp .go48 jmp SHORT .go 49 49 50 50 .notOurs: 51 mov si, g_szDriveNum52 mov bx, g_szForeignHD ; assume a hard disk for the moment51 mov si, g_szDriveNum 52 mov bx, g_szForeignHD ; assume a hard disk for the moment 53 53 54 54 test dl, dl 55 js .go56 mov bl, ((g_szFloppyDrv)-$$ & 0xff) ; and revisit the earlier assumption...55 js SHORT .go 56 mov bl, ((g_szFloppyDrv)-$$ & 0xff) ; and revisit the earlier assumption... 57 57 58 58 .go: … … 60 60 call DriveXlate_ToOrBack 61 61 62 test dl, 0f0h ; if there is a character in the upper nibble 63 jnz .noSpace 64 dec si ; backup a character to a leading space 65 .noSpace: 62 cmp dl, 10h ; Check if there is a character in the upper nibble 63 sbb si, 0 ; If not, backup a character to a leading space 66 64 67 65 push dx ; translated drive number … … 86 84 ;-------------------------------------------------------------------- 87 85 BootMenuPrint_TitleStrings: 88 xor di, di ; Null character will be eaten86 xor di, di ; Null character will be eaten 89 87 mov si, g_szBootMenuTitle 90 88 jmp DetectPrint_RomFoundAtSegment.BootMenuEntry … … 105 103 106 104 call BootMenu_GetDriveToDXforMenuitemInCX 107 jnc BootMenuEvent_Completed; nothing to display if "Rom Boot" option105 jnc SHORT BootMenuEvent_Completed ; nothing to display if "Rom Boot" option 108 106 109 107 push bp … … 116 114 inc dl ; are we a hard disk? 117 115 dec dl ; inc/dec will set SF, without modifying CF or DL 118 js .HardDiskRefreshInformation119 120 jnc .ours; Based on CF from FindDPT_ForDriveNumberInDL above116 js SHORT .HardDiskRefreshInformation 117 118 jnc SHORT .ours ; Based on CF from FindDPT_ForDriveNumberInDL above 121 119 call FloppyDrive_GetType ; Get Floppy Drive type to BX 122 jmp .around120 jmp SHORT .around 123 121 .ours: 124 122 call AH8h_GetDriveParameters … … 132 130 cmp bl, FLOPPY_TYPE_35_ED 133 131 ja SHORT .PushAXAndOutput 134 135 132 ; Fall to .PrintKnownFloppyType 136 133 … … 162 159 mov al, (g_szFddThreeHalf - $$) & 0xff 163 160 cmp bl, FLOPPY_TYPE_525_HD 164 ja .ThreeHalf161 ja SHORT .ThreeHalf 165 162 mov al, (g_szFddFiveQuarter - $$) & 0xff 166 163 .ThreeHalf: … … 168 165 169 166 xor bh, bh 170 mov al, FloppyTypes.rgbCapacityMultiplier167 mov al, FloppyTypes.rgbCapacityMultiplier 171 168 mul BYTE [cs:bx+FloppyTypes.rgbCapacity - 1] ; -1 since 0 is handled above and not in the table 172 169 … … 184 181 ; Parameters: 185 182 ; DS: RAMVARS segment 183 ; DI: Zero if foreign drive 184 ; Offset to DPT if our drive 185 ; CF: Set if foreign drive 186 ; Clear if our drive 186 187 ; Returns: 187 188 ; CF: Set since menu event was handled successfully 188 189 ; Corrupts registers: 189 ; BX, CX, DX, SI, DI, ES190 ; AX, BX, CX, DX, SI, DI, ES 190 191 ;-------------------------------------------------------------------- 191 192 .HardDiskRefreshInformation: 192 jc .HardDiskMenuitemInfoForForeignDrive; Based on CF from FindDPT_ForDriveNumberInDL (way) above193 jc SHORT .HardDiskMenuitemInfoForForeignDrive ; Based on CF from FindDPT_ForDriveNumberInDL (way) above 193 194 194 195 .HardDiskMenuitemInfoForOurDrive: 195 196 ePUSH_T ax, g_szInformation ; Add substring for our hard disk information 196 call GetTotalSectorCount 197 jmp .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat 197 198 %ifdef MODULE_EBIOS 199 ePUSH_T ax, .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat 200 test BYTE [di+DPT.bFlagsLow], FLGL_DPT_LBA 201 %ifdef USE_386 202 jnz AccessDPT_GetLbaSectorCountToBXDXAX 203 jmp AH15h_GetSectorCountToBXDXAX 204 %else ; ~USE_386 205 jz SHORT .NoLBA 206 jmp AccessDPT_GetLbaSectorCountToBXDXAX 207 .NoLBA: 208 jmp AH15h_GetSectorCountToBXDXAX 209 %endif 210 %else ; ~MODULE_EBIOS 211 call AH15h_GetSectorCountToBXDXAX 212 jmp SHORT .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat 213 %endif ; MODULE_EBIOS 198 214 199 215 .HardDiskMenuitemInfoForForeignDrive: … … 226 242 db 2880 / FloppyTypes.rgbCapacityMultiplier ; type 5 227 243 db 2880 / FloppyTypes.rgbCapacityMultiplier ; type 6 228 229 230 ;--------------------------------------------------------------------231 ; GetTotalSectorCount232 ; Parameters:233 ; DS:DI: DPT Pointer234 ; Returns:235 ; BX:DX:AX: 48-bit sector count236 ; Corrupts registers:237 ; CX238 ;--------------------------------------------------------------------239 %ifdef MODULE_EBIOS240 GetTotalSectorCount EQU AccessDPT_GetLbaSectorCountToBXDXAX241 %else242 GetTotalSectorCount EQU AH15h_GetSectorCountToBXDXAX243 %endif -
trunk/XTIDE_Universal_BIOS/Src/Strings.asm
r588 r589 136 136 g_szDeviceTypeValues: 137 137 g_szDeviceTypeValues_16bit: db " 16",NULL 138 %ifdef MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 138 139 g_szDeviceTypeValues_32bit: db " 32",NULL 140 %ifdef MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 139 141 g_szDeviceTypeValues_8bit: db " 8",NULL 140 142 g_szDeviceTypeValues_XTIDEr1: db "D8 ",NULL ; Dual 8-bit 141 143 g_szDeviceTypeValues_XTIDEr2: db "X8 ",NULL ; A0<->A3 swapped 8-bit 144 %ifdef MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 142 145 g_szDeviceTypeValues_XTCFpio8: db "T8 ",NULL ; True 8-bit 143 146 g_szDeviceTypeValues_XTCFpio8BIU: db "T8B",NULL … … 146 149 g_szDeviceTypeValues_JrIde: db "M8 ",NULL ; Memory Mapped 8-bit 147 150 g_szDeviceTypeValues_ADP50L: db "M8 ",NULL ; Memory Mapped 8-bit 151 %ifdef MODULE_SERIAL 148 152 g_szDeviceTypeValues_Serial: db "SER",NULL 149 150 g_szDeviceTypeValues_Displacement equ (g_szDeviceTypeValues_32bit - g_szDeviceTypeValues) 153 %endif ; MODULE_SERIAL 154 %endif ; MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 155 %endif ; MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 156 %endif ; MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 157 158 g_szDeviceTypeValues_Displacement equ 3 ; 3 compressed, 4 uncompressed 159 ;g_szDeviceTypeValues_Displacement equ (g_szDeviceTypeValues_32bit - g_szDeviceTypeValues) 151 160 ; 152 161 ; Ensure that device type strings are correctly spaced in memory … … 156 165 %error "g_szDeviceTypeValues Displacement Incorrect 1" 157 166 %endif 167 168 %ifdef MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 169 158 170 %if g_szDeviceTypeValues_32bit <> g_szDeviceTypeValues_16bit + g_szDeviceTypeValues_Displacement 159 171 %error "g_szDeviceTypeValues Displacement Incorrect 2" 160 172 %endif 173 174 %ifdef MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 175 161 176 %if g_szDeviceTypeValues_8bit <> g_szDeviceTypeValues_32bit + g_szDeviceTypeValues_Displacement 162 177 %error "g_szDeviceTypeValues Displacement Incorrect 3" … … 168 183 %error "g_szDeviceTypeValues Displacement Incorrect 5" 169 184 %endif 185 186 %ifdef MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 187 170 188 %if g_szDeviceTypeValues_XTCFpio8 <> g_szDeviceTypeValues_XTIDEr2 + g_szDeviceTypeValues_Displacement 171 189 %error "g_szDeviceTypeValues Displacement Incorrect 6" … … 186 204 %error "g_szDeviceTypeValues Displacement Incorrect 11" 187 205 %endif 206 207 %ifdef MODULE_SERIAL 208 188 209 %if g_szDeviceTypeValues_Serial <> g_szDeviceTypeValues_ADP50L + g_szDeviceTypeValues_Displacement 189 210 %error "g_szDeviceTypeValues Displacement Incorrect 12" 190 211 %endif 212 213 %endif ; MODULE_SERIAL 214 %endif ; MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 215 %endif ; MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 216 %endif ; MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 217 191 218 %endif 192 219 -
trunk/XTIDE_Universal_BIOS/Src/StringsCompressed.asm
r588 r589 257 257 db 20h, 2bh, 0fh ; compressed 258 258 259 %ifdef MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 259 260 g_szDeviceTypeValues_32bit: ; db " 32",NULL 260 261 ; db 20h, 33h, 32h, 00h ; uncompressed 261 262 db 20h, 2dh, 0ch ; compressed 262 263 264 %ifdef MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 263 265 g_szDeviceTypeValues_8bit: ; db " 8",NULL 264 266 ; db 20h, 20h, 38h, 00h ; uncompressed … … 273 275 db 5eh, 30h, 00h ; compressed 274 276 277 %ifdef MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 275 278 g_szDeviceTypeValues_XTCFpio8: ; db "T8 ",NULL ; True 8-bit 276 279 ; db 54h, 38h, 20h, 00h ; uncompressed … … 297 300 db 53h, 30h, 00h ; compressed 298 301 302 %ifdef MODULE_SERIAL 299 303 g_szDeviceTypeValues_Serial: ; db "SER",NULL 300 304 ; db 53h, 45h, 52h, 00h ; uncompressed 301 305 db 59h, 4bh, 98h ; compressed 302 306 303 304 g_szDeviceTypeValues_Displacement equ (g_szDeviceTypeValues_32bit - g_szDeviceTypeValues) 307 %endif ; MODULE_SERIAL 308 %endif ; MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 309 %endif ; MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 310 %endif ; MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 311 312 g_szDeviceTypeValues_Displacement equ 3 ; 3 compressed, 4 uncompressed 313 ;g_szDeviceTypeValues_Displacement equ (g_szDeviceTypeValues_32bit - g_szDeviceTypeValues) 305 314 ; 306 315 ; Ensure that device type strings are correctly spaced in memory … … 310 319 %error "g_szDeviceTypeValues Displacement Incorrect 1" 311 320 %endif 321 322 %ifdef MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 323 312 324 %if g_szDeviceTypeValues_32bit <> g_szDeviceTypeValues_16bit + g_szDeviceTypeValues_Displacement 313 325 %error "g_szDeviceTypeValues Displacement Incorrect 2" 314 326 %endif 327 328 %ifdef MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 329 315 330 %if g_szDeviceTypeValues_8bit <> g_szDeviceTypeValues_32bit + g_szDeviceTypeValues_Displacement 316 331 %error "g_szDeviceTypeValues Displacement Incorrect 3" … … 322 337 %error "g_szDeviceTypeValues Displacement Incorrect 5" 323 338 %endif 339 340 %ifdef MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 341 324 342 %if g_szDeviceTypeValues_XTCFpio8 <> g_szDeviceTypeValues_XTIDEr2 + g_szDeviceTypeValues_Displacement 325 343 %error "g_szDeviceTypeValues Displacement Incorrect 6" … … 340 358 %error "g_szDeviceTypeValues Displacement Incorrect 11" 341 359 %endif 360 361 %ifdef MODULE_SERIAL 362 342 363 %if g_szDeviceTypeValues_Serial <> g_szDeviceTypeValues_ADP50L + g_szDeviceTypeValues_Displacement 343 364 %error "g_szDeviceTypeValues Displacement Incorrect 12" 344 365 %endif 366 367 %endif ; MODULE_SERIAL 368 %endif ; MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 369 %endif ; MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 370 %endif ; MODULE_ADVANCED_ATA OR MODULE_8BIT_IDE OR MODULE_8BIT_IDE_ADVANCED OR MODULE_SERIAL 371 345 372 %endif 346 373 … … 567 594 568 595 ;; translated usage stats 569 ;; 172:2570 ;; 47:2571 ;; 171:2572 ;; 46:3573 ;; 48:2574 ;; 181:1575 ;; 200:1576 ;; 54:2577 ;; 45:2578 ;; 49:2579 596 ;; 34:3 580 597 ;; 179:8 581 ;; 56:8 598 ;; 46:3 599 ;; 44:1 600 ;; 200:1 601 ;; 48:2 602 ;; 175:1 603 ;; 171:2 604 ;; 51:3 605 ;; 50:2 582 606 ;; 33:1 583 607 ;; 53:2 608 ;; 45:2 609 ;; 47:2 610 ;; 172:2 611 ;; 56:8 584 612 ;; 32:34 585 ;; 175:1 586 ;; 44:1 587 ;; 50:2 588 ;; 51:3 613 ;; 181:1 614 ;; 54:2 615 ;; 49:2 589 616 ;; total translated: 20 590 617 591 618 ;; format usage stats 592 ;; z:2 619 ;; 5-x:1 620 ;; 2-u:1 621 ;; s:14 593 622 ;; nl:12 594 ;; u:6595 ;; 5-x:1596 ;; c:13597 623 ;; A:4 598 ;; s:14599 624 ;; 5-u:2 600 625 ;; x:5 601 ;; 2-u:1602 626 ;; 2-I:1 627 ;; z:2 628 ;; u:6 629 ;; c:13 603 630 ;; total format: 11 604 631 -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm
r588 r589 62 62 63 63 jnz SHORT .EnableDeviceIrq 64 oral, FLG_DEVCONTROL_nIEN ; Disable IRQ64 mov al, FLG_DEVCONTROL_nIEN ; Disable IRQ 65 65 .EnableDeviceIrq: 66 66 %else -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CompatibleDPT.asm
r568 r589 231 231 232 232 xor dl, dl ; Clear DL for checksum 233 push bp 234 mov bp, StoswThenAddALandAHtoDL 233 235 234 236 ; DPTE.wBasePort 235 237 mov ax, [si+DPT.wBasePort] 236 call StoswThenAddALandAHtoDL; Bytes 0 and 1238 call bp ; Bytes 0 and 1 237 239 238 240 ; DPTE.wControlBlockPort 239 241 eMOVZX bx, [si+DPT.bIdevarsOffset] 240 242 mov ax, [cs:bx+IDEVARS.wControlBlockPort] 241 call StoswThenAddALandAHtoDL; Bytes 2 and 3243 call bp ; Bytes 2 and 3 242 244 243 245 ; DPTE.bDrvnhead and DPTE.bBiosVendor … … 245 247 call AccessDPT_GetDriveSelectByteToAL 246 248 xchg si, di 247 call StoswThenAddALandAHtoDL; Bytes 4 and 5249 call bp ; Bytes 4 and 5 248 250 249 251 ; DPTE.bIRQ and DPTE.bBlockSize 250 252 mov al, [cs:bx+IDEVARS.bIRQ] ; No way to define that we might not use IRQ 251 mov ah, [si+DPT_ATA.bBlockSize] 252 cmp ah, 1253 j beSHORT .DoNotSetBlockModeFlag253 mov ah, [si+DPT_ATA.bBlockSize] ; DPT_ATA.bBlockSize must never be zero! 254 sahf ; Only block size = 1 sets CF 255 jc SHORT .DoNotSetBlockModeFlag 254 256 or cl, FLG_BLOCK_MODE_ENABLED 255 257 .DoNotSetBlockModeFlag: 256 call StoswThenAddALandAHtoDL; Bytes 6 and 7258 call bp ; Bytes 6 and 7 257 259 258 260 ; DPTE.bDmaChannelAndType and DPTE.bPioMode … … 266 268 sbb cl, -1 ; FLG_FAST_PIO_ENABLED (if .wControllerID > 0) 267 269 .DoNotSetFastPioFlag: 268 call StoswThenAddALandAHtoDL; Bytes 8 and 9270 call bp ; Bytes 8 and 9 269 271 %endif 270 272 … … 279 281 .NoChsTranslationOrBitShiftTranslationSet: 280 282 xchg ax, cx 281 call StoswThenAddALandAHtoDL ; Bytes 10 and 11 283 call bp ; Bytes 10 and 11 284 pop bp 282 285 283 286 ; DPTE.wReserved (must be zero)
Note:
See TracChangeset
for help on using the changeset viewer.