ATA read/write sectors: Difference between revisions

Jump to navigation Jump to search
Generalized write description.
[unchecked revision][unchecked revision]
(Generalized write description.)
Line 4:
 
==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.
<source lang="asm">
;=============================================================================
Line 83:
=ATA write sectors=
 
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).
==Write in CHS mode==
As noted by Dex (aka 'qark') in this [http://forum.osdev.org/viewtopic.php?f=1&t=12268 forum topic], the only difference to ata_chs_read is 30h is sent to command register instead of 20h, and using OUTSW instead of INSW, and of course from [RSI] instead of to [RDI]. So code for ata_chs_write can be obtained this way.
 
==Write in LBA mode==
Similar to 'read in LBA mode'.
 
=See also=
1,490

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu