about LBA and Floppy

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
demoh
Posts: 2
Joined: Wed Feb 20, 2008 3:39 pm

about LBA and Floppy

Post 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 ;)
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post 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
User avatar
zaleschiemilgabriel
Member
Member
Posts: 232
Joined: Mon Feb 04, 2008 3:58 am

Post 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.
demoh
Posts: 2
Joined: Wed Feb 20, 2008 3:39 pm

Post 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 :)
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Post 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.
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
Post Reply