ATA read/write sectors: Difference between revisions

m
Bot: Replace deprecated source tag with syntaxhighlight
[unchecked revision][unchecked revision]
m (Bot: Replace deprecated source tag with syntaxhighlight)
 
Line 5:
==Read in CHS mode==
Accessing disk using CHS (cylinder,head,sector) indexes seem to be kinda old type but is the base for LBA access. The following NASM long-mode subroutine reads CH sectors to memory address indicated by RDI register.
<sourcesyntaxhighlight lang="asm">
;=============================================================================
; ATA read sectors (CHS mode)
Line 77:
popfq
ret
</syntaxhighlight>
</source>
 
==Read in LBA mode==
{{stub}}
<sourcesyntaxhighlight lang="asm">
;=============================================================================
; ATA read sectors (LBA mode)
Line 149:
popfq
ret
</syntaxhighlight>
</source>
 
=ATA write sectors=
Line 155:
A write is mostly equivalent to performing a read operation. The only changes needed are a change in command (0x30 for chs write), and the direction of the data, which is written (rep outsw from *SI) to the data port rather than read (rep insw to *DI).
 
<sourcesyntaxhighlight lang="asm">
;=============================================================================
; ATA write sectors (LBA mode)
Line 225:
popfq
ret
</syntaxhighlight>
</source>
 
=See also=