Write FAT12 Assembly for Floppy
Write FAT12 Assembly for Floppy
Hello every One
I am about to progress with the boot and loading of the kernel.
But something bothers me, I would like to know, as we can not create an MBR on a floppy disk, how to implement a FAT for floppy disk?
And another question is, how do I make my system compatible with other systems if I sit on a floppy disk?
In addition I would like you to look at this site: http://starman.vertcomp.com/asm/mbr/DOS50FDB.htm#BPB
How can she help me?
Re: Write FAT12 Assembly for Floppy
I am not entirely certain what you are talking about. You can create a boot loader for a floppy disk. That boot loader will have to take the BPB into account. When you write the boot loader to the disk, you have to skip the BPB that's already there, or else you'll destroy the file system.
Your bootloader will then have to somehow load the next stage (typically done by iterating over the root directory and looking for a constant file name) and load that somewhere, and then jump there.
As for compatibility, you have to know the different hardware platforms you want to support. I personally am creating a pure 64-bit OS, so I am not particularly bothered about IBM 5150 compatibility. If you wish to at least recognize if someone is using a too old CPU, here's what I do:
Your bootloader will then have to somehow load the next stage (typically done by iterating over the root directory and looking for a constant file name) and load that somewhere, and then jump there.
As for compatibility, you have to know the different hardware platforms you want to support. I personally am creating a pure 64-bit OS, so I am not particularly bothered about IBM 5150 compatibility. If you wish to at least recognize if someone is using a too old CPU, here's what I do:
- Push SP. An 8086 CPU will push the decremented value of SP, all others will push the old value. So if you pop that value into another register, and now the other register and SP are not equal, you are executing on an 8086. For me, that is the cue to bail out.
- All CPUs since the 80186 have implemented the undefined opcode exception, so now I just register a handler for interrupt 6 that also prints the "CPU too old" error message if triggered.
- Now I can just execute CPUID. If the CPU is anything before the later 80486s, this will just trigger #UD. Otherwise I can now identify features. Including long mode.
Last edited by nullplan on Wed Apr 10, 2019 10:03 pm, edited 1 time in total.
Carpe diem!
Re: Write FAT12 Assembly for Floppy
There's no MBR on a floppy, usually (I mean, you can probably have one, but it'll likely make incompatible with existing OSes that understand FAT). And there's no need for it since floppies don't have that much capacity to carve into partitions.ledoux wrote:I would like to know, as we can not create an MBR on a floppy disk, how to implement a FAT for floppy disk?
See https://github.com/alexfru/BootProg.ledoux wrote:And another question is, how do I make my system compatible with other systems if I sit on a floppy disk?
Specifically, you really want to have these things: This is enough for the floppy to be recognized by DOS and Windows. Between the BPB and the signature you can have anything.
Re: Write FAT12 Assembly for Floppy
alexfru wrote:There's no MBR on a floppy, usually (I mean, you can probably have one, but it'll likely make incompatible with existing OSes that understand FAT). And there's no need for it since floppies don't have that much capacity to carve into partitions.ledoux wrote:I would like to know, as we can not create an MBR on a floppy disk, how to implement a FAT for floppy disk?
See https://github.com/alexfru/BootProg.ledoux wrote:And another question is, how do I make my system compatible with other systems if I sit on a floppy disk?
Specifically, you really want to have these things: This is enough for the floppy to be recognized by DOS and Windows. Between the BPB and the signature you can have anything.
Why did you do that , at this level :
https://github.com/alexfru/BootProg/blo ... 2.asm#L184
I don't know how you put shr ax , 4
Re: Write FAT12 Assembly for Floppy
Why not? What should be there instead?ledoux wrote:Why did you do that , at this level :
https://github.com/alexfru/BootProg/blo ... 2.asm#L184
I don't know how you put shr ax , 4
Did you read all relevant lines, 179 through 191, including the comments?
Do you know the basics of how segmentation works? And what "paragraph" stands for in this context?
IOW, do you have a specific question?
Re: Write FAT12 Assembly for Floppy
alexfru wrote:Why not? What should be there instead?ledoux wrote:Why did you do that , at this level :
https://github.com/alexfru/BootProg/blo ... 2.asm#L184
I don't know how you put shr ax , 4
Did you read all relevant lines, 179 through 191, including the comments?
Do you know the basics of how segmentation works? And what "paragraph" stands for in this context?
IOW, do you have a specific question?
In fact, I do not really understand why we make decals at this level.
You're right, I'd like you to help me understand some of the concepts of paragraph and segmentation
- Thunderbirds747
- Member
- Posts: 83
- Joined: Sat Sep 17, 2016 2:14 am
- Location: Moscow, Russia
Re: Write FAT12 Assembly for Floppy
IMO it's a pretty childish question, asking a programmer to do this, do that which requires his/her own skills. Learn from various pages, books, documentation, this will help you out. Myself I would just learn X language or look up X tutorials.
-Timothy Ryazanov
-Timothy Ryazanov
Coffee is not airplane fuel.