Floppy Direct IO



  • : ok, firstly yes i do want to write a floppy driver,and no i dont
    : have a memory access module. I have experience of C++, and i could
    : prob use my knowledge of that, the last site you gave me looked very
    : helpfull, although for the real low level stuff (drivers etc) i was
    : hoping to do it all in assembly, mainly for speed, also i have no
    : idea how to use a C file with an ASM file.
    : thanks for your help, i am checking out some of those sites atm

    How will you load anything from the drive without a good memory manager?
    It will be impossible for you to know if it will overwrite existing data,
    or even your kernel or other drivers without it.

    Because you have experience with C++, just convert it to asm. Its not hard.
    The tutorial I posted uses low level C, which compilies directly into
    assembly language.

    Dont *use* the source file, *learn* from it, and write your own. In fact,
    write a better one. Believe me--not doing this will really hurt you,
    and [b]will almost definately[/b] halt your project.

    [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS Operating System[rightbr][leftbr][link=http://www.mt2002.sitesled.com]Website[rightbr][/link][/size]
  • thats a fair point, i hadnt really thought of that.

    just want to run an idea past you (for a memory manager) sort of want to check if this is the right idea:

    have a table in memory that shows what sections of memory are in use (perhaps divide memory into 1MB blocks? and show what blocks are in use, much like the FAT table does on a floppy disk with clusters?

    thanks for the help, the tutorial you sent looks really good, i am just having a little fun atm (getting disk info) i have worked out how to get floppy info, and i can get C and D disk info, but i cant yet get any inf on sata drives...looks like this is gonna be a long project..GOOD :D


  • For an OS project--yes, it is going to be a *Long* while.

    Its good that you are getting the drive information to work
    though :-)

    As for creating a memory manager, you can impliment a malloc()
    and free() routines, along others.

    The idea is to store "memory blocks". By allocating blocks,
    you can use Dog Tags to track memory curruption, and bad pointers.

    I personally only seen (and implimented) these in C though.
    Nontheless, this should help somewhat:


    After implimenting a way to "Allocate" and "Deallocate" memory, you
    can test pointer validity in the memory blocks to indicate if the block
    is used or not.

    If you store all allocated blocks in a linked-list type structure,
    you can keep track of all memory in use very easily, without having a
    large table. Its also better, because you dont need to check unallocated
    memory blocks :-)

    I can probably post my memory manager, if you want. Its in C++, though,
    and tracks allocations from malloc()/free()/new/delete.

    [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS Operating System[rightbr][leftbr][link=http://www.mt2002.sitesled.com]Website[rightbr][/link][/size]
  • that source code looks like it could really help, so just let me make sure i understand, in the kernel code i define an data structure of a memory block:

    and then have a large amount of memory reserved for the list (256*len of mem_block???)

    and then when i am after a free section of memory i just loop through the reserved memory looking for one with a used of 0?

    if that is correct then i think i understand, but the only thing i dont really understand is how i am supposed to know what program (prog/driver/file...etc) is using which section of memory, should i have a label in the mem_block structure that is set to the name of the file loaded, or do i set a variable to the position of the memory location within the linked list?

    sorry to be asking so many (perhaps silly) questions, i just like to thoroughly understand things, i find it saves time.

  • OK, i am now really confused, i used two documents on the FDC and DMA, one that had very good information but very little examples, and the other that was entirely an example and no info, I used these to help write my own floppy controller...or at least i thought i had, it appears too "work" as there are no errors in any of the status registers, however when i try a read operation i cant figure out how to tell it where to put the data in memory, and when i try a write operation nothing happens, even though there are no errors in the status registers, i have included the entire source code for my project thus far and i would really appreciate it if you could have a look and point out any "obvious" mistakes that you can see

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!