· Начало · Статистика · WASM.RU · Noir.Ru ·

 WASM Phorum (Оффлайн - 24.11.2003) —› WASM.ASSEMBLER —› Опять про серийный номер винта

Посл.отвђт Сообщенiе


Дата: Июл 21, 2003 21:19:08

Посмотрел в топиках, Black_mirror советует скачать стандарт ATA x.x, я скачал ATA 1. Почитал но нихрена не понял, как этим пользоваться. Толи от того, что я английский не знаю, толи не так читал, толи ...
Если не трудно, то обясните на пальцах(для долго соображающих), как это сделать(узнать S/N). И желательно бы чтобы это все работало под голым ДОСом(возможно такое?).


Дата: Июл 22, 2003 04:17:43

KiNDeR
Проверял, почти под "голым" DOS'ом.
w98se: "Command prompt only"
	.model	tiny
	.code

Base_Port	equ	1f0h
HD		equ	0	; !!! Hard Disk number

	.Startup

	mov	dx,Base_Port + 6
	mov	al,10100000b or (HD shl 4)
	out	dx,al
	jmp	$+2
	inc	dx
	mov	al,0ech
	out	dx,al
	jmp	$+2

@@:
	in	al,dx
	jmp	$+2
	test	al,80h
	jnz	@B

	mov	dx,Base_Port
	mov	di,offset Buffer
	mov	cx,100h

@@:
	in	ax,dx
	xchg	ah,al
	stosw
	loop	@B

	xor	cx,cx
	mov	dx,offset Fname
	mov	ah,3ch
	int	21h
	xchg	bx,ax

	mov	dx,offset Buffer
	mov	cx,100h
	mov	ah,40h
	int	21h

	mov	ah,3eh
	int	21h

	.exit

Fname	db	'hdd_id.dat', 0
Buffer	db	100h dup (?)

end


Дата: Июл 22, 2003 04:49:21

P2M
Если не трудно добавь комментариев, чтоб я на TASM мог перевести...


Дата: Июл 22, 2003 05:57:39

KiNDeR
Tasm непонимает только @B.
Вам они тоже не понятны?

Что конкретно прокомментировать?
0ECh?
10100000b or (HD shl 4)?


Дата: Июл 24, 2003 16:54:05

P2M
Прошу прощенья, это так на вскидку просьба...
У меня в файл пишется 256 байт хлама.(цифра 1 и еще какойто код)...


Дата: Июл 25, 2003 03:46:26

KiNDeR
в файл пишется 256 байт хлама
Попробуйте эти байты наложить на:
---------------------------------------------------------------------- -
  Word  Description                                                    
---------------------------------------------------------------------- -
  00h   Bit mapped general configuration information. True when bit set
        Bit 15: Reserved for non magnetic drives.                      
        Bit 14: Format speed tolerance gap not required.               
        Bit 13: Track offset option not available.                     
        Bit 12: Data strobe offset option not available.               
        Bit 11: Rotational speed tolerance is < 0.5%                   
        Bit 10: Disk transfer rate not > 10 MB/s                       
        Bit 09: Disk transfer rate > 5 MB/s and < 10 MB/s              
        Bit 08: Disk transfer rate > 5 MB/s                            
        Bit 07: Removable cartridge drive.                             
        Bit 06: Fixed drive.                                           
        Bit 05: Spindle motor control option not implemented.          
        Bit 04: Head switch time > 15 microseconds.                    
        Bit 03: Not MFM encoded.                                       
        Bit 02: Not soft sectored.                                     
        Bit 01: Hard Sectored.                                         
        Bit 00: Reserved.                                              
  01h   Number of logical cylinders in the default translation mode.   
  02h   Reserved.                                                      
  03h   Number of logical heads in the default translation mode.       
  04h   Number of unformatted bytes per logical track.                 
  05h   Number of unformatted bytes per sector.                        
  06h   Number of logical sectors per track.                           
  07h   Bits 15...08: Inter Sector Gap after Index & before splice.    
        Bits 07...00: Inter Sector Gap bytes.                          
  08h   Bits 15...08: Reserved.                                        
        Bits 07...00: Bytes in Phase Lock Oscillator field.            
  09h   Number of vendor unique status words.                          
! 0Ah   Serial number, 20 ASCII chars, right aligned & padded with 20h.
  14h   Controller type:                                               
        0000h: Not specified.                                          
        0001h: Single ported, single sector buffer capable of data     
               transfers only to or from the host or the disk at one   
               time.                                                   
        0002h: Dual ported, multiple sector buffer capable of          
               simultaneous data transfers to and from the host, or    
               from the host and the disk.                             
        0003h: Dual ported, multiple sector buffer capable of          
               simultaneous data transfers with read caching.          
        0004h-FFFFh: Reserved.                                         
  15h   Buffer size in 512 byte increments.                            
  16h   Number of ECC bytes passed to host on R/W long operations.     
  17h   Firmware revision, 8 ASCII chars, left aligned & space padded. 
  1Bh   Model Number, 40 ASCII chars, left aligned & space padded.     
  2Fh   READ/WRITE multiples implemented.                              
  30h   Supports double word I/O transfer.                             
  31h   Reserved.                                                      
  32h   Reserved.                                                      
  33h   Minimum PIO data transfer cycle time in nsec.                  
  34h   Minimum DMA data transfer cycle time in nsec.                  
  35h   All words past this point are reserved.                        


Она взята с IDE - Hardware Reference & Information Document.
Поиск на странице 'ECh: Identify Drive'.


Дата: Июл 25, 2003 04:24:32 · Поправил: KiNDeR

P2M
Прверил снова, на 40 гиктарном винте все нармально, а на 213 мегабайтном только 128 единиц и 128 "6F"...

получил серий ный номер с помощью http://www.sources.ru/cpp/cpp_show_ide_information.shtml , посмотрел в файл серийный номер лежит не по смещению 0Ah, а по смещению 14h...


Дата: Июл 25, 2003 04:37:58

KiNDeR
На указанной мною странице есть информация, что не все HDD поддерживают 0ECh (там стоит '@', а ниже '@ These commands are optional and may not be supported by some drives.')

Если серийный номер этого HDD понимает какая-то другая программа/bios/..., то надо ковырять ее.


Дата: Июл 25, 2003 04:44:26

P2M
Будем искать....


Powered by miniBB 1.6 © 2001-2002
Время загрузки страницы (сек.): 0.064