F 100 FFFF 0 a org 400 ; Tests PRIMARY Master Disk Drive (P0) using Registers: 1Fxh/3F6h mov dx,3F6 ; Alternate status register. in al,dx and al,80 jnz 403 ; Read until not busy. mov dx,1F7 ; Command register. mov al,90 out dx,al ; Execute Device Diagnostic. mov dx,3F6 in al,dx and al,80 jnz 411 ; Wait until not busy. mov dx,1F1 ; Error register in al,dx and al,1 ; Device 0 passed? jz 453 ; If 'No' -> exit mov dx,3F6 ; Alternate status register. in al,dx and al,80 jnz 421 ; Read until not busy. mov dx,1F6 ; Device/Head register. mov al,E0 ; Select Device 0. <-- Primary MASTER drive. out dx,al ; Write Device register. mov dx,3F6 ; Alternate status register. in al,dx and al,80 jnz 42F ; Wait until not busy. in al,dx and al,40 jz 434 ; Wait until data ready. mov dx,1F7 ; Command register. mov al,EC ; ATA Identify Device Command. out dx,al ; Write command. mov dx,3F6 ; Alternate status register. in al,dx and al,80 jnz 442 ; Wait until not busy. mov dx,1F0 ; Data register. mov di,100 ; Address of data buffer (could be located elsewhere) mov cx,100 ; 256 words of data. cld rep ; REP INSW db 6d int 3 g =400 d 100 2ff q