- Timestamp:
- Aug 28, 2012, 4:05:55 PM (12 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Inc/DeviceIDE.inc
r432 r444 27 27 ; Polling timeout delays (system timer ticks, 1 tick = 54.9 ms) 28 28 TIMEOUT_DRQ EQU 255 ; 14 s (some CF cards occasionally have long write delays) 29 TIMEOUT_ IDENTIFY_DEVICE EQU(500/55) ; 500 ms29 TIMEOUT_SELECT_DRIVE_DURING_DRIVE_DETECTION EQU (500/55) ; 500 ms 30 30 TIMEOUT_MOTOR_STARTUP EQU (10000/55) ; 10 s 31 31 TIMEOUT_MAXIMUM EQU 255 ; We would actually want 31 seconds here but I don't think there are so slow drives -
trunk/XTIDE_Universal_BIOS/Inc/RamVars.inc
r443 r444 37 37 .wNewStackOffset resb 2 38 38 %endif 39 .wDrvDetectSignature: ; Signature when BIOS is in drive detection mode 39 40 .fpOldI13h resb 4 ; Far pointer to old INT 13h handler 40 .wSignature resb 2 ; Sign for finding stolen 1 kiB41 .wSignature resb 2 ; Sign for finding stolen 1...64 kiB 41 42 .bTimeoutTicksLeft resb 1 42 43 .bLastTimeoutUpdate resb 1 … … 53 54 %endif 54 55 endstruc 56 57 ; Note!!! .wDrvDetectSignature and .wSignature are intentionally in different locations. 58 RAMVARS_RAM_SIGNATURE EQU "Xu" ; RAMVARS signature for .wSignature 59 RAMVARS_DRV_DETECT_SIGNATURE EQU 5A5Ah ; Signature when BIOS is in drive detection mode 60 55 61 56 62 … … 83 89 %endif 84 90 85 RAMVARS_SIGNATURE EQU "Xu" ; RAMVARS signature for .wSignature 91 86 92 87 93 ; -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
r443 r444 203 203 ALIGN JUMP_ALIGN 204 204 IdeCommand_SelectDrive: 205 %if 0 206 ; Wait until neither Master or Slave Drive is busy 207 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY) 208 cmp BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE 209 eCMOVE bh, TIMEOUT_IDENTIFY_DEVICE 210 call IdeWait_PollStatusFlagInBLwithTimeoutInBH 211 %endif 205 ; We use different timeout value when detecting drives. 206 ; This prevents unnecessary long delays when drive is not present. 207 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY) 208 cmp WORD [RAMVARS.wDrvDetectSignature], RAMVARS_DRV_DETECT_SIGNATURE 209 eCMOVE bh, TIMEOUT_SELECT_DRIVE_DURING_DRIVE_DETECTION 212 210 213 211 ; Select Master or Slave Drive 214 212 mov al, [bp+IDEPACK.bDrvAndHead] 215 213 OUTPUT_AL_TO_IDE_REGISTER DRIVE_AND_HEAD_SELECT_REGISTER 216 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY)217 cmp BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE218 eCMOVE bh, TIMEOUT_IDENTIFY_DEVICE219 214 call IdeWait_PollStatusFlagInBLwithTimeoutInBH 220 215 -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
r442 r444 228 228 ; ReadBlockFromXtideRev1 XTIDE rev 1 229 229 ; ReadBlockFromXtideRev2 XTIDE rev 2 or rev 1 with swapped A0 and A3 (chuck-mod) 230 ; ReadBlockFrom8bitDataPort CF-XT when using 8-bit PIO 230 231 ; ReadBlockFrom16bitDataPort Normal 16-bit IDE 231 232 ; ReadBlockFrom32bitDataPort VLB/PCI 32-bit IDE … … 241 242 %ifdef MODULE_8BIT_IDE 242 243 243 ALIGN JUMP_ALIGN 244 ReadBlockFromXtideRev1: 245 UNROLL_SECTORS_IN_CX_TO_QWORDS 246 mov bl, 8 ; Bit mask for toggling data low/high reg 247 ALIGN JUMP_ALIGN 248 .InswLoop: 249 XTIDE_INSW 250 XTIDE_INSW 251 XTIDE_INSW 252 XTIDE_INSW 253 loop .InswLoop 254 ret 255 256 ;-------------------------------------------------------------------- 257 %ifndef USE_186 ; 8086/8088 compatible WORD read 258 ALIGN JUMP_ALIGN 259 ReadBlockFromXtideRev2: 260 UNROLL_SECTORS_IN_CX_TO_QWORDS 261 ALIGN JUMP_ALIGN 262 .ReadNextQword: 263 in ax, dx ; Read 1st WORD 264 stosw ; Store 1st WORD to [ES:DI] 265 in ax, dx 266 stosw ; 2nd 267 in ax, dx 268 stosw ; 3rd 269 in ax, dx 270 stosw ; 4th 271 loop .ReadNextQword 272 ret 273 %endif 274 275 ;-------------------------------------------------------------------- 276 ALIGN JUMP_ALIGN 277 ReadBlockFromXTCF: 278 UNROLL_SECTORS_IN_CX_TO_DWORDS 279 ALIGN JUMP_ALIGN 280 .ReadNextDword: 281 in al, dx ; Read 1st BYTE 282 stosb ; Store 1st BYTE to [ES:DI] 283 in al, dx 284 stosb 285 286 in al, dx 287 stosb 288 in al, dx 289 stosb 290 loop .ReadNextDword 291 ret 292 244 ALIGN JUMP_ALIGN 245 ReadBlockFromXtideRev1: 246 UNROLL_SECTORS_IN_CX_TO_QWORDS 247 mov bl, 8 ; Bit mask for toggling data low/high reg 248 ALIGN JUMP_ALIGN 249 .InswLoop: 250 XTIDE_INSW 251 XTIDE_INSW 252 XTIDE_INSW 253 XTIDE_INSW 254 loop .InswLoop 255 ret 256 257 ;-------------------------------------------------------------------- 258 %ifndef USE_186 ; 8086/8088 compatible WORD read 259 ALIGN JUMP_ALIGN 260 ReadBlockFromXtideRev2: 261 UNROLL_SECTORS_IN_CX_TO_QWORDS 262 ALIGN JUMP_ALIGN 263 .ReadNextQword: 264 in ax, dx ; Read 1st WORD 265 stosw ; Store 1st WORD to [ES:DI] 266 in ax, dx 267 stosw ; 2nd 268 in ax, dx 269 stosw ; 3rd 270 in ax, dx 271 stosw ; 4th 272 loop .ReadNextQword 273 ret 274 %endif 275 276 ;-------------------------------------------------------------------- 277 %ifdef USE_186 278 ALIGN JUMP_ALIGN 279 ReadBlockFrom8bitDataPort: 280 shl cx, 9 ; Sectors to BYTEs 281 rep insb 282 ret 283 284 %else ; If 8088/8086 285 ALIGN JUMP_ALIGN 286 ReadBlockFrom8bitDataPort: 287 UNROLL_SECTORS_IN_CX_TO_DWORDS 288 ALIGN JUMP_ALIGN 289 .ReadNextDword: 290 in al, dx ; Read 1st BYTE 291 stosb ; Store 1st BYTE to [ES:DI] 292 in al, dx 293 stosb 294 295 in al, dx 296 stosb 297 in al, dx 298 stosb 299 loop .ReadNextDword 300 ret 301 %endif 293 302 %endif ; MODULE_8BIT_IDE 294 303 295 304 ;-------------------------------------------------------------------- 296 305 %ifdef USE_186 297 ALIGN JUMP_ALIGN 298 ReadBlockFrom16bitDataPort: 299 xchg cl, ch ; Sectors to WORDs 300 rep 301 db 6Dh ; INSW (we want this in XT build) 302 ret 306 ALIGN JUMP_ALIGN 307 ReadBlockFrom16bitDataPort: 308 xchg cl, ch ; Sectors to WORDs 309 rep insw 310 ret 303 311 %endif 304 312 305 313 ;-------------------------------------------------------------------- 306 314 %ifdef USE_AT 307 ALIGN JUMP_ALIGN 308 ReadBlockFrom32bitDataPort: 309 db 0C1h ; SHL 310 db 0E1h ; CX 311 db 7 ; 7 (Sectors to DWORDs) 312 rep 313 db 66h ; Override operand size to 32-bit 314 db 6Dh ; INSW/INSD 315 ret 315 ALIGN JUMP_ALIGN 316 ReadBlockFrom32bitDataPort: 317 shl cx, 7 ; Sectors to DWORDs 318 rep 319 db 66h ; Override operand size to 32-bit 320 db 6Dh ; INSW/INSD 321 ret 316 322 %endif 317 323 … … 320 326 ; WriteBlockToXtideRev1 XTIDE rev 1 321 327 ; WriteBlockToXtideRev2 XTIDE rev 2 or rev 1 with swapped A0 and A3 (chuck-mod) 322 ; WriteBlockTo FastXtide Fast XTIDE (CPLD v2 project)328 ; WriteBlockTo8bitDataPort XT-CF when using 8-bit PIO 323 329 ; WriteBlockTo16bitDataPort Normal 16-bit IDE 324 330 ; WriteBlockTo32bitDataPort VLB/PCI 32-bit IDE … … 334 340 %ifdef MODULE_8BIT_IDE 335 341 336 ALIGN JUMP_ALIGN 337 WriteBlockToXtideRev1: 338 push ds 339 UNROLL_SECTORS_IN_CX_TO_QWORDS 340 mov bl, 8 ; Bit mask for toggling data low/high reg 341 push es ; Copy ES... 342 pop ds ; ...to DS 343 ALIGN JUMP_ALIGN 344 .OutswLoop: 345 XTIDE_OUTSW 346 XTIDE_OUTSW 347 XTIDE_OUTSW 348 XTIDE_OUTSW 349 loop .OutswLoop 350 pop ds 351 ret 352 353 ;-------------------------------------------------------------------- 354 ALIGN JUMP_ALIGN 355 WriteBlockToXtideRev2: 356 UNROLL_SECTORS_IN_CX_TO_QWORDS 357 push ds 358 push es ; Copy ES... 359 pop ds ; ...to DS 360 ALIGN JUMP_ALIGN 361 .WriteNextQword: 362 XTIDE_MOD_OUTSW 363 XTIDE_MOD_OUTSW 364 XTIDE_MOD_OUTSW 365 XTIDE_MOD_OUTSW 366 loop .WriteNextQword 367 pop ds 368 ret 369 370 ;-------------------------------------------------------------------- 371 ALIGN JUMP_ALIGN 372 WriteBlockToXTCF: 373 UNROLL_SECTORS_IN_CX_TO_DWORDS 374 push ds 375 push es 376 pop ds 377 ALIGN JUMP_ALIGN 378 .WriteNextDword: 379 lodsb ; Load 1st BYTE from [DS:SI] 380 out dx, al ; Write 1st BYTE 381 lodsb 382 out dx, al 383 384 lodsb 385 out dx, al 386 lodsb 387 out dx, al 388 loop .WriteNextDword 389 pop ds 390 ret 342 ALIGN JUMP_ALIGN 343 WriteBlockToXtideRev1: 344 push ds 345 UNROLL_SECTORS_IN_CX_TO_QWORDS 346 mov bl, 8 ; Bit mask for toggling data low/high reg 347 push es ; Copy ES... 348 pop ds ; ...to DS 349 ALIGN JUMP_ALIGN 350 .OutswLoop: 351 XTIDE_OUTSW 352 XTIDE_OUTSW 353 XTIDE_OUTSW 354 XTIDE_OUTSW 355 loop .OutswLoop 356 pop ds 357 ret 358 359 ;-------------------------------------------------------------------- 360 ALIGN JUMP_ALIGN 361 WriteBlockToXtideRev2: 362 UNROLL_SECTORS_IN_CX_TO_QWORDS 363 push ds 364 push es ; Copy ES... 365 pop ds ; ...to DS 366 ALIGN JUMP_ALIGN 367 .WriteNextQword: 368 XTIDE_MOD_OUTSW 369 XTIDE_MOD_OUTSW 370 XTIDE_MOD_OUTSW 371 XTIDE_MOD_OUTSW 372 loop .WriteNextQword 373 pop ds 374 ret 375 376 ;-------------------------------------------------------------------- 377 %ifdef USE_186 378 ALIGN JUMP_ALIGN 379 WriteBlockTo8bitDataPort: 380 shl cx, 9 ; Sectors to BYTEs 381 es ; Source is ES segment 382 rep outsb 383 ret 384 385 %else ; If 8088/8086 386 ALIGN JUMP_ALIGN 387 WriteBlockTo8bitDataPort: 388 UNROLL_SECTORS_IN_CX_TO_DWORDS 389 push ds 390 push es 391 pop ds 392 ALIGN JUMP_ALIGN 393 .WriteNextDword: 394 lodsb ; Load 1st BYTE from [DS:SI] 395 out dx, al ; Write 1st BYTE 396 lodsb 397 out dx, al 398 399 lodsb 400 out dx, al 401 lodsb 402 out dx, al 403 loop .WriteNextDword 404 pop ds 405 ret 406 %endif 391 407 %endif ; MODULE_8BIT_IDE 392 393 408 394 409 ;-------------------------------------------------------------------- … … 398 413 xchg cl, ch ; Sectors to WORDs 399 414 es ; Source is ES segment 400 rep 401 db 6Fh ; OUTSW (we want this in XT build) 415 rep outsw 402 416 ret 403 417 … … 405 419 ALIGN JUMP_ALIGN 406 420 WriteBlockTo32bitDataPort: 407 db 0C1h ; SHL 408 db 0E1h ; CX 409 db 7 ; 7 (Sectors to DWORDs) 421 shl cx, 7 ; Sectors to DWORDs 410 422 es ; Source is ES segment 411 423 rep … … 422 434 %ifdef MODULE_8BIT_IDE 423 435 dw 0 ; 0, DEVICE_8BIT_JRIDE_ISA 424 dw ReadBlockFrom XTCF; 1, DEVICE_8BIT_XTCF436 dw ReadBlockFrom8bitDataPort ; 1, DEVICE_8BIT_XTCF 425 437 %ifdef USE_186 426 438 dw ReadBlockFrom16bitDataPort ; 2, DEVICE_8BIT_XTIDE_REV2 … … 442 454 %ifdef MODULE_8BIT_IDE 443 455 dw 0 ; 0, DEVICE_8BIT_JRIDE_ISA 444 dw WriteBlockTo XTCF; 1, DEVICE_8BIT_XTCF456 dw WriteBlockTo8bitDataPort ; 1, DEVICE_8BIT_XTCF 445 457 dw WriteBlockToXtideRev2 ; 2, DEVICE_XTIDE_REV2 446 458 dw WriteBlockToXtideRev1 ; 3, DEVICE_XTIDE_REV1 -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm
r433 r444 75 75 xor di, di 76 76 call Memory_ZeroESDIwithSizeInCX 77 mov WORD [RAMVARS.wSignature], RAMVARS_SIGNATURE 77 mov WORD [RAMVARS.wDrvDetectSignature], RAMVARS_DRV_DETECT_SIGNATURE 78 mov WORD [RAMVARS.wSignature], RAMVARS_RAM_SIGNATURE 78 79 ; Fall to .InitializeInt13hStackChangeVariables 79 80 … … 151 152 mov ds, di ; EBDA segment to DS 152 153 add di, BYTE 64 ; DI to next stolen kB 153 cmp WORD [RAMVARS.wSignature], RAMVARS_ SIGNATURE154 cmp WORD [RAMVARS.wSignature], RAMVARS_RAM_SIGNATURE 154 155 jne SHORT .LoopStolenKBs ; Loop until sign found (always found eventually) 155 156 ret
Note:
See TracChangeset
for help on using the changeset viewer.