flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
farrier 06 Jan 2006, 20:35
Goat6,
Try: GetDiskFreeSpaceEx Code: bud db "C:\", 0 DISKSIZE struct dwLowSize dd ? dwHighSize dd ? DISKSIZE ends avail_bytes DISKSIZE total_bytes DISKSIZE free_bytes DISKSIZE invoke GetDiskFreeSpaceEx, bud, avail_bytes, total_bytes, free_bytes This will give you info for the C:\ drive available to the user. hth, farrier _________________ Some Assembly Required It's a good day to code! U.S.Constitution; Bill of Rights; Amendment 1: ... the right of the people peaceably to assemble, ... The code is dark, and full of errors! |
|||
![]() |
|
Goat6 06 Jan 2006, 22:32
Thanks for the suggestion but I cant use that Im writting Kernel code and it must have no dependencies on other OSes.
_________________ Death is not the opposite of life but rather the absence of it. |
|||
![]() |
|
crc 06 Jan 2006, 22:41
You need to send the ATA_IDENTIFY command to the drive, wait for the BSY flag to clear, then read in 256 words.
1. Send 0x3c (ATA_IDENTIFY) to port 0x1f7. I send this as a single byte. 2. Read a byte in from port 0x1f7; when the value is equal to 88 (decimal), the busy flag is clear. 3. Repeat step 2 until the busy flag is cleared 4. Read in 256 words from port 0x1f0 5. Look through these words to find what you want to know. Words number 100-103 store the total number of 512-byte sectors that can be addressed via 48-bit LBA. This will be the actual disk size. If you use CHS addressing; you won't get the full size on large hard drives. http://www.tldp.org/HOWTO/Large-Disk-HOWTO-10.html has some nice details, including a good chart of what ATA_IDENTIFY returns. It was one of my main resources when I started improving the hard disk drivers in my OS. |
|||
![]() |
|
edfed 30 Mar 2006, 10:51
easier is to call the int 13h,8
ah=8 with dl=drive number (0 for fd1,1 for fd2,80h for hd0,81h for hd1) return=> cx=cylinder,sector in ata chs form cx: bits 0-5=>sectors count bits 6-7=>high order cylinders count bits 8-15=>low cylinders byte dl=heads/sides it works |
|||
![]() |
|
jdawg 06 May 2006, 17:31
edfed wrote
Quote: easier is to call the int 13h,8 I have a couple of copies of the interrupt vector table, but none of them cover anything about the values you send to the ISR. |
|||
![]() |
|
Mota 06 May 2006, 22:39
Oh um, while we're here, is there anywhere that'll give me good info on how to program an ATA driver? It doesn't need to tell me what to do exactly, but it would help if someone knew somewhere that tells us about the interrupts triggered, hardware registers, and pseudo-procedures that an ATA driver programmer would need to know.
Erm... thanks in advance? ![]() |
|||
![]() |
|
crc 07 May 2006, 00:56
Check http://ata-atapi.com/ for some good, solid documentation on the ATA specs and free code to review/use.
|
|||
![]() |
|
Dex4u 07 May 2006, 10:34
This basic tut, may also help : http://www.geocities.com/siliconvalley/2072/atapi.htm
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.