Page 1 of 1

about LBA and Floppy

Posted: Thu Feb 21, 2008 6:46 am
by demoh
Hi

I have some questions:

1. How I can check what type of LBA is in computer? LBA28, LBA48 or not LBA?
2. Can I use LBA to read from floppy? If I can then how can I do it?
3. What numbers have floppy and hard drivers in LBA calling?
4. How I can check what floppy and hard diver I have? Max size and number for LBA calling.

I want some assembler or C code, please.

Sorry for my English ;)

Posted: Thu Feb 21, 2008 6:49 am
by JamesM
Hi,

I can't actually answer your question (I'm sure someone here will, though), but just for future reference:
I want some assembler or C code, please.
That sentence is actually quite rude. A better sentence might be "If possible, I would like some assembler or C code, please.".

If English was your first language, other people here (including myself) might jump on you for being extremely rude.

Just FYI :-)

James

Posted: Thu Feb 21, 2008 8:30 am
by zaleschiemilgabriel
First, the "type of LBA" is not "in a computer", it is a feature provided by different physical storage hardware (IDE). You get the type of LBA from the hardware or the BIOS does that for you.
Floppies never needed LBA addressing so that feature was not implemented in most floppy controllers.
Look here for some code:
http://www.openwatcom.org/index.php/Acc ... under_DPMI
Next time, try google-ing a bit.

Posted: Thu Feb 21, 2008 12:01 pm
by demoh
Thanks for answers and for correct my English :)

I used google but I didn't find this info or I am blind :P

If possible, I would like some assembler or C code, please. :)

My questions is open for your answer :)

This is my first second language. Sorry for my bad :)

Posted: Thu Feb 21, 2008 1:17 pm
by XCHG
1) By probing the device and asking for its supported LBA addressing modes.
2) I don't think you can. You can always create a function that translates LBA addresses to CHS and sends them to the floppy drive. You will fool yourself with it but it might make you happy.
3) What?
4) By probing the device. You can read T13.org documentations about IDE and ATA. For floppy drives, you can use the CMOS.

To detect the available floppy drivers for example, you can use the below function that I have written:

Code: Select all

; ——————————————————————————————————————————————————
  __FloppyDetectAvailableDrives:
    ; DWORD __FloppyDetectAvailableDrives (void); StdCall;
    FDAD_DRIVE0_IS_AVAILABLE      EQU       0x00000001
    FDAD_DRIVE1_IS_AVAILABLE      EQU       0x00000002
    PUSH    EDX
    INVOKE  __CMOSRead, CMOS_INDEX_FLOPPYDISKDRIVETYPES
    TEST    EAX , 0x000000F0 ; Drive 0
    SETNZ   DL
    TEST    EAX , 0x0000000F ; Drive 1
    SETNZ   DH
    ; DL = Drive0
    ; DH = Drive1
    MOV     EAX , EDX
    SHR     EAX , 0x00000007
    AND     EDX , 0x00000001
    OR      EAX , EDX
    POP     EDX
    RET
The __CMOSRead is defined in this way:

Code: Select all

  __CMOSRead:
    ; DWORD __CMOSRead (DWORD CMOSIndex); StdCall;
    PUSHFD
    CLI
    MOV     EAX , DWORD PTR [ESP + 0x08] ; CMOSIndex
    OUT     CMOS_PORT_WRITE , AL
    TIMES   0x04 NOP
    XOR     EAX , EAX
    IN      AL , CMOS_PORT_READ
    POPFD
    RET     0x04
You can find more information by searching in Google.