2009-09-17 13:55:38 +02:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
|
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
2009-10-12 16:39:59 +02:00
|
|
|
|
$Revision$
|
2009-09-17 13:55:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;******************************************************
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HDD <EFBFBD> CD
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Mario79
|
|
|
|
|
;******************************************************
|
|
|
|
|
|
|
|
|
|
;****************************************************
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HDD <EFBFBD> CD *
|
|
|
|
|
;****************************************************
|
|
|
|
|
FindHDD:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [ChannelNumber], 1
|
|
|
|
|
mov [DiskNumber], 0
|
2009-09-17 13:55:38 +02:00
|
|
|
|
call FindHDD_3
|
|
|
|
|
; mov ax,[Sector512+176]
|
|
|
|
|
; mov [DRIVE_DATA+6],ax
|
|
|
|
|
; mov ax,[Sector512+126]
|
|
|
|
|
; mov [DRIVE_DATA+8],ax
|
|
|
|
|
; mov ax,[Sector512+128]
|
|
|
|
|
; mov [DRIVE_DATA+8],ax
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [DiskNumber], 1
|
2009-09-17 13:55:38 +02:00
|
|
|
|
call FindHDD_3
|
|
|
|
|
; mov al,[Sector512+176]
|
|
|
|
|
; mov [DRIVE_DATA+7],al
|
|
|
|
|
inc [ChannelNumber]
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [DiskNumber], 0
|
2009-09-17 13:55:38 +02:00
|
|
|
|
call FindHDD_3
|
|
|
|
|
; mov al,[Sector512+176]
|
|
|
|
|
; mov [DRIVE_DATA+8],al
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [DiskNumber], 1
|
2009-09-17 13:55:38 +02:00
|
|
|
|
call FindHDD_1
|
|
|
|
|
; mov al,[Sector512+176]
|
|
|
|
|
; mov [DRIVE_DATA+9],al
|
|
|
|
|
|
|
|
|
|
jmp EndFindHDD
|
|
|
|
|
|
|
|
|
|
FindHDD_1:
|
|
|
|
|
call ReadHDD_ID
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [DevErrorCode], 0
|
2009-09-17 13:55:38 +02:00
|
|
|
|
jne FindHDD_2
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [Sector512+6], word 16
|
2009-09-17 13:55:38 +02:00
|
|
|
|
ja FindHDD_2
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [Sector512+12], word 255
|
2009-09-17 13:55:38 +02:00
|
|
|
|
ja FindHDD_2
|
|
|
|
|
inc byte [DRIVE_DATA+1]
|
|
|
|
|
jmp FindHDD_2_2
|
|
|
|
|
FindHDD_2:
|
|
|
|
|
call DeviceReset
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [DevErrorCode], 0
|
2009-09-17 13:55:38 +02:00
|
|
|
|
jne FindHDD_2_2
|
|
|
|
|
call ReadCD_ID
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [DevErrorCode], 0
|
|
|
|
|
jne FindHDD_2_2
|
2009-09-17 13:55:38 +02:00
|
|
|
|
inc byte [DRIVE_DATA+1]
|
|
|
|
|
inc byte [DRIVE_DATA+1]
|
|
|
|
|
FindHDD_2_2:
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
FindHDD_3:
|
|
|
|
|
call FindHDD_1
|
2012-02-22 17:06:05 +01:00
|
|
|
|
shl byte [DRIVE_DATA+1], 2
|
2009-09-17 13:55:38 +02:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LBA
|
2010-01-15 12:54:11 +01:00
|
|
|
|
uglobal
|
2009-09-17 13:55:38 +02:00
|
|
|
|
SectorAddress DD ?
|
2010-01-15 12:54:11 +01:00
|
|
|
|
endg
|
2009-09-17 13:55:38 +02:00
|
|
|
|
;*************************************************
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: *
|
|
|
|
|
;* ChannelNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (1 <EFBFBD><EFBFBD><EFBFBD> 2); *
|
|
|
|
|
;* DiskNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0 <EFBFBD><EFBFBD><EFBFBD> 1). *
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
|
|
|
|
;* <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Sector512. *
|
|
|
|
|
;*************************************************
|
|
|
|
|
ReadHDD_ID:
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CHS
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [ATAAddressMode], 0
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [ATAFeatures], 0
|
|
|
|
|
mov [ATAHead], 0
|
|
|
|
|
mov [ATACommand], 0ECh
|
2009-09-17 13:55:38 +02:00
|
|
|
|
call SendCommandToHDD
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [DevErrorCode], 0;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2009-09-17 13:55:38 +02:00
|
|
|
|
jne @@End ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov DX, [ATABasePortAddr]
|
|
|
|
|
add DX, 7 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov ecx, 0xffff
|
2009-09-17 13:55:38 +02:00
|
|
|
|
@@WaitCompleet:
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
dec ecx
|
2010-01-15 12:54:11 +01:00
|
|
|
|
; cmp ecx,0
|
2012-02-22 17:06:05 +01:00
|
|
|
|
jz @@Error1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
in AL, DX
|
|
|
|
|
test AL, 80h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BSY
|
2009-09-17 13:55:38 +02:00
|
|
|
|
jnz @@WaitCompleet
|
2012-02-22 17:06:05 +01:00
|
|
|
|
test AL, 1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ERR
|
2009-09-17 13:55:38 +02:00
|
|
|
|
jnz @@Error6
|
2012-02-22 17:06:05 +01:00
|
|
|
|
test AL, 08h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DRQ
|
2009-09-17 13:55:38 +02:00
|
|
|
|
jz @@WaitCompleet
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
; mov AX,DS
|
|
|
|
|
; mov ES,AX
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov EDI, Sector512 ;offset Sector512
|
|
|
|
|
mov DX, [ATABasePortAddr];<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov CX, 256 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
rep insw ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
@@Error1:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [DevErrorCode], 1
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
@@Error6:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [DevErrorCode], 6
|
|
|
|
|
@@End:
|
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
|
|
|
|
|
|
2010-01-15 12:54:11 +01:00
|
|
|
|
iglobal
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 <EFBFBD> 2
|
|
|
|
|
StandardATABases DW 1F0h, 170h
|
2010-01-15 12:54:11 +01:00
|
|
|
|
endg
|
|
|
|
|
uglobal
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
ChannelNumber DW ?
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
DiskNumber DB ?
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ATA
|
|
|
|
|
ATABasePortAddr DW ?
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ATA-<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
ATAFeatures DB ? ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
ATASectorCount DB ? ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
ATASectorNumber DB ? ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
ATACylinder DW ? ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
ATAHead DB ? ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
ATAAddressMode DB ? ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0 - CHS, 1 - LBA)
|
|
|
|
|
ATACommand DB ? ;<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0 - <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 1 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 2 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
|
|
|
|
; 3 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 4 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
|
|
|
|
; 5 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 6 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
2010-01-15 12:54:11 +01:00
|
|
|
|
DevErrorCode dd ?
|
|
|
|
|
endg
|
2009-09-17 13:55:38 +02:00
|
|
|
|
;****************************************************
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: *
|
|
|
|
|
;* ChannelNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (1 <EFBFBD><EFBFBD><EFBFBD> 2); *
|
|
|
|
|
;* DiskNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0 <EFBFBD><EFBFBD><EFBFBD> 1); *
|
|
|
|
|
;* ATAFeatures - "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; *
|
|
|
|
|
;* ATASectorCount - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
|
|
|
|
;* ATASectorNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
|
|
|
|
;* ATACylinder - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
|
|
|
|
;* ATAHead - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
|
|
|
|
;* ATAAddressMode - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0-CHS, 1-LBA); *
|
|
|
|
|
;* ATACommand - <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: *
|
|
|
|
|
;* <EFBFBD> ATABasePortAddr - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HDD; *
|
|
|
|
|
;* <EFBFBD> DevErrorCode - <EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> DevErrorCode <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
|
|
|
|
;****************************************************
|
|
|
|
|
SendCommandToHDD:
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [ATAAddressMode], 1
|
2009-09-17 13:55:38 +02:00
|
|
|
|
ja @@Err2
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov BX, [ChannelNumber]
|
|
|
|
|
cmp BX, 1
|
2009-09-17 13:55:38 +02:00
|
|
|
|
jb @@Err3
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp BX, 2
|
2009-09-17 13:55:38 +02:00
|
|
|
|
ja @@Err3
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
dec BX
|
2012-02-22 17:06:05 +01:00
|
|
|
|
shl BX, 1
|
|
|
|
|
movzx ebx, bx
|
|
|
|
|
mov AX, [ebx+StandardATABases]
|
|
|
|
|
mov [ATABasePortAddr], AX
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HDD <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov DX, [ATABasePortAddr]
|
|
|
|
|
add DX, 6 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov AL, [DiskNumber]
|
|
|
|
|
cmp AL, 1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2009-09-17 13:55:38 +02:00
|
|
|
|
ja @@Err4
|
2012-02-22 17:06:05 +01:00
|
|
|
|
shl AL, 4
|
|
|
|
|
or AL, 10100000b
|
|
|
|
|
out DX, AL
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
inc DX
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov ecx, 0xfff
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; mov eax,[timer_ticks]
|
|
|
|
|
; mov [TickCounter_1],eax
|
|
|
|
|
@@WaitHDReady:
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
dec ecx
|
2010-01-15 12:54:11 +01:00
|
|
|
|
; cmp ecx,0
|
2012-02-22 17:06:05 +01:00
|
|
|
|
jz @@Err1
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; mov eax,[timer_ticks]
|
|
|
|
|
; sub eax,[TickCounter_1]
|
|
|
|
|
; cmp eax,300 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 300 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
; ja @@Err1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
in AL, DX
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BSY
|
2012-02-22 17:06:05 +01:00
|
|
|
|
test AL, 80h
|
2009-09-17 13:55:38 +02:00
|
|
|
|
jnz @@WaitHDReady
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DRQ
|
2012-02-22 17:06:05 +01:00
|
|
|
|
test AL, 08h
|
2009-09-17 13:55:38 +02:00
|
|
|
|
jnz @@WaitHDReady
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
cli
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov DX, [ATABasePortAddr]
|
2009-09-17 13:55:38 +02:00
|
|
|
|
inc DX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov AL, [ATAFeatures]
|
|
|
|
|
out DX, AL
|
2009-09-17 13:55:38 +02:00
|
|
|
|
inc DX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov AL, [ATASectorCount]
|
|
|
|
|
out DX, AL
|
2009-09-17 13:55:38 +02:00
|
|
|
|
inc DX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov AL, [ATASectorNumber]
|
|
|
|
|
out DX, AL
|
2009-09-17 13:55:38 +02:00
|
|
|
|
inc DX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov AX, [ATACylinder]
|
|
|
|
|
out DX, AL
|
2009-09-17 13:55:38 +02:00
|
|
|
|
inc DX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov AL, AH
|
|
|
|
|
out DX, AL
|
2009-09-17 13:55:38 +02:00
|
|
|
|
inc DX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov AL, [DiskNumber]
|
|
|
|
|
shl AL, 4
|
|
|
|
|
cmp [ATAHead], 0Fh;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2009-09-17 13:55:38 +02:00
|
|
|
|
ja @@Err5
|
2012-02-22 17:06:05 +01:00
|
|
|
|
or AL, [ATAHead]
|
|
|
|
|
or AL, 10100000b
|
|
|
|
|
mov AH, [ATAAddressMode]
|
|
|
|
|
shl AH, 6
|
|
|
|
|
or AL, AH
|
|
|
|
|
out DX, AL
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov AL, [ATACommand]
|
2009-09-17 13:55:38 +02:00
|
|
|
|
inc DX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
out DX, AL
|
2009-09-17 13:55:38 +02:00
|
|
|
|
sti
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [DevErrorCode], 0
|
2010-01-15 12:54:11 +01:00
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
@@Err1:
|
|
|
|
|
mov [DevErrorCode], 1
|
2010-01-15 12:54:11 +01:00
|
|
|
|
ret
|
2012-02-22 17:06:05 +01:00
|
|
|
|
@@Err2:
|
|
|
|
|
mov [DevErrorCode], 2
|
2010-01-15 12:54:11 +01:00
|
|
|
|
ret
|
2012-02-22 17:06:05 +01:00
|
|
|
|
@@Err3:
|
|
|
|
|
mov [DevErrorCode], 3
|
2010-01-15 12:54:11 +01:00
|
|
|
|
ret
|
2012-02-22 17:06:05 +01:00
|
|
|
|
@@Err4:
|
|
|
|
|
mov [DevErrorCode], 4
|
2010-01-15 12:54:11 +01:00
|
|
|
|
ret
|
2012-02-22 17:06:05 +01:00
|
|
|
|
@@Err5:
|
|
|
|
|
mov [DevErrorCode], 5
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
;*************************************************
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ATAPI *
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: *
|
|
|
|
|
;* ChannelNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
|
|
|
|
;* DiskNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
|
|
|
|
;* <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Sector512. *
|
|
|
|
|
;*************************************************
|
|
|
|
|
ReadCD_ID:
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CHS
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [ATAAddressMode], 0
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [ATAFeatures], 0
|
|
|
|
|
mov [ATASectorCount], 0
|
|
|
|
|
mov [ATASectorNumber], 0
|
|
|
|
|
mov [ATACylinder], 0
|
|
|
|
|
mov [ATAHead], 0
|
|
|
|
|
mov [ATACommand], 0A1h
|
2009-09-17 13:55:38 +02:00
|
|
|
|
call SendCommandToHDD
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp [DevErrorCode], 0;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2009-09-17 13:55:38 +02:00
|
|
|
|
jne @@End_1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HDD
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov DX, [ATABasePortAddr]
|
|
|
|
|
add DX, 7 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<EFBFBD>7h
|
|
|
|
|
mov ecx, 0xffff
|
2009-09-17 13:55:38 +02:00
|
|
|
|
@@WaitCompleet_1:
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
dec ecx
|
|
|
|
|
; cmp ecx,0
|
|
|
|
|
jz @@Error1_1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
in AL, DX
|
|
|
|
|
test AL, 80h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BSY
|
2009-09-17 13:55:38 +02:00
|
|
|
|
jnz @@WaitCompleet_1
|
2012-02-22 17:06:05 +01:00
|
|
|
|
test AL, 1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ERR
|
2009-09-17 13:55:38 +02:00
|
|
|
|
jnz @@Error6_1
|
2012-02-22 17:06:05 +01:00
|
|
|
|
test AL, 08h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DRQ
|
2009-09-17 13:55:38 +02:00
|
|
|
|
jz @@WaitCompleet_1
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
; mov AX,DS
|
|
|
|
|
; mov ES,AX
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov EDI, Sector512 ;offset Sector512
|
|
|
|
|
mov DX, [ATABasePortAddr];<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1x0h
|
|
|
|
|
mov CX, 256;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
rep insw
|
2010-01-15 12:54:11 +01:00
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
@@Error1_1:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [DevErrorCode], 1
|
2010-01-15 12:54:11 +01:00
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
@@Error6_1:
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [DevErrorCode], 6
|
2009-09-17 13:55:38 +02:00
|
|
|
|
@@End_1:
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
;*************************************************
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
|
|
|
|
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: *
|
|
|
|
|
;* ChannelNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (1 <EFBFBD><EFBFBD><EFBFBD> 2); *
|
|
|
|
|
;* DiskNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0 <EFBFBD><EFBFBD><EFBFBD> 1). *
|
|
|
|
|
;*************************************************
|
|
|
|
|
DeviceReset:
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov BX, [ChannelNumber]
|
|
|
|
|
cmp BX, 1
|
2009-09-17 13:55:38 +02:00
|
|
|
|
jb @@Err3_2
|
2012-02-22 17:06:05 +01:00
|
|
|
|
cmp BX, 2
|
2009-09-17 13:55:38 +02:00
|
|
|
|
ja @@Err3_2
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
dec BX
|
2012-02-22 17:06:05 +01:00
|
|
|
|
shl BX, 1
|
|
|
|
|
movzx ebx, bx
|
|
|
|
|
mov DX, [ebx+StandardATABases]
|
|
|
|
|
mov [ATABasePortAddr], DX
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
add DX, 6 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov AL, [DiskNumber]
|
|
|
|
|
cmp AL, 1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2009-09-17 13:55:38 +02:00
|
|
|
|
ja @@Err4_2
|
2012-02-22 17:06:05 +01:00
|
|
|
|
shl AL, 4
|
|
|
|
|
or AL, 10100000b
|
|
|
|
|
out DX, AL
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov AL, 08h
|
2009-09-17 13:55:38 +02:00
|
|
|
|
inc DX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
out DX, AL
|
|
|
|
|
mov ecx, 0x80000
|
2009-09-17 13:55:38 +02:00
|
|
|
|
@@WaitHDReady_1:
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
dec ecx
|
2010-01-15 12:54:11 +01:00
|
|
|
|
; cmp ecx,0
|
2009-09-17 13:55:38 +02:00
|
|
|
|
je @@Err1_2 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
in AL, DX
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BSY
|
2012-02-22 17:06:05 +01:00
|
|
|
|
test AL, 80h
|
2009-09-17 13:55:38 +02:00
|
|
|
|
jnz @@WaitHDReady_1
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
mov [DevErrorCode], 0
|
2010-01-15 12:54:11 +01:00
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-22 17:06:05 +01:00
|
|
|
|
@@Err1_2:
|
|
|
|
|
mov [DevErrorCode], 1
|
2010-01-15 12:54:11 +01:00
|
|
|
|
ret
|
2012-02-22 17:06:05 +01:00
|
|
|
|
@@Err3_2:
|
|
|
|
|
mov [DevErrorCode], 3
|
2010-01-15 12:54:11 +01:00
|
|
|
|
ret
|
2012-02-22 17:06:05 +01:00
|
|
|
|
@@Err4_2:
|
|
|
|
|
mov [DevErrorCode], 4
|
2009-09-17 13:55:38 +02:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
EndFindHDD:
|
|
|
|
|
|