OSDev.org

The Place to Start for Operating System Developers
It is currently Mon Aug 19, 2019 12:09 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Write FAT12 Assembly for Floppy
PostPosted: Tue Apr 09, 2019 8:29 pm 
Offline

Joined: Sun Mar 10, 2019 11:55 pm
Posts: 4
:D :D :D

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?


Top
 Profile  
 
 Post subject: Re: Write FAT12 Assembly for Floppy
PostPosted: Tue Apr 09, 2019 10:13 pm 
Offline
Member
Member

Joined: Wed Aug 30, 2017 8:24 am
Posts: 225
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:

  1. 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.
  2. 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.
  3. 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.

Top
 Profile  
 
 Post subject: Re: Write FAT12 Assembly for Floppy
PostPosted: Wed Apr 10, 2019 2:09 am 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 970
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?


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:
And another question is, how do I make my system compatible with other systems if I sit on a floppy disk?

See https://github.com/alexfru/BootProg.
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.


Top
 Profile  
 
 Post subject: Re: Write FAT12 Assembly for Floppy
PostPosted: Sun Jul 28, 2019 11:24 am 
Offline

Joined: Sun Mar 10, 2019 11:55 pm
Posts: 4
alexfru wrote:
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?


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:
And another question is, how do I make my system compatible with other systems if I sit on a floppy disk?

See https://github.com/alexfru/BootProg.
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


Top
 Profile  
 
 Post subject: Re: Write FAT12 Assembly for Floppy
PostPosted: Sun Jul 28, 2019 12:54 pm 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 970
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


Why not? What should be there instead?
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?


Top
 Profile  
 
 Post subject: Re: Write FAT12 Assembly for Floppy
PostPosted: Sun Jul 28, 2019 3:19 pm 
Offline

Joined: Sun Mar 10, 2019 11:55 pm
Posts: 4
alexfru wrote:
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


Why not? What should be there instead?
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group