New Person

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.
NotTheCHEAT

New Person

Post by NotTheCHEAT »

Although I've been planning to start writing my own OS, JOS1, for a long time, and have seen this forum before, I haven't joined until today. I am using FASM and DJGPP.

Question: What do physical addresses in real mode become in protected mode? Does 20000h in real mode become 00020000h, or 20000000h in protected mode? (All the stuff about MSB, LSB, and all that starts to get to ya ::) ) Also, what about read-only areas like BIOS? Does FFF00h become 000FFF00h or FFF00000h in protected mode? Or is the BIOS even accessible in protected mode (I know you can't do BIOS calls, but there is some read-only data stored there, correct)?

I am too lazy to write a bootloader, does anyone have one for NASM or FASM that is open source? I want FAT12, enter protected mode after loading the kernel, and display loading and error messages if possible. This way I can test my kernel, both physically and using Bochs.

Thanks!
AR

Re:New Person

Post by AR »

1) 0xFFFF0 is still 0xFFFF0 in protected mode, the MSB/LSB only comes into play when reading individual bytes of the address in memory.

2) Try GRUB (And see the Wiki).
NotTheCHEAT

Re:New Person

Post by NotTheCHEAT »

GRUB? With a floppy? I just want something simple, GRUB is complex. I'm using a Windows machine!
AR

Re:New Person

Post by AR »

GRUB is the most common approach, GRUB can be installed on a floppy, prebuilt GRUB FAT Images can be used on Windows. You don't need to know how it works to use it [and it is properly better to not care as I've discovered]. See the Wiki for links to prebuilt images.

There are also the more complex like XOSL (GRUB with a GUI) that are also multiboot compliant.
Tora OS

Re:New Person

Post by Tora OS »

Grub isnt that complex and it works like a charm to. I would highly recommend it.
Freanan

Re:New Person

Post by Freanan »

True.
I used my own bootloader written after some tutorial for a very long time which resulted in several unexplainable problems.
It is better if you have a bootloader that is proven to really work as it should.
And, as it was said you don't need to know how it works.
It also offers you to get data about the system for you.
For example a map of free memory regions (though my code to read it does not work right now :( ). You even can have it preload modules for you, so that your kernel does not have to include disk drivers (helpfull for mikrokernels)..

About your adressing questions... The adresses stay the same, numerically (if you use flat segmentation and until you use paging, where you can map an adress to where you want).

Anyway, have fun with os development ;)
Dex4u

Re:New Person

Post by Dex4u »

I Think theres a miss understanding about bootloaders, that you need to use one made for the purpose or make your own.
A lot of half finished OS's would make very good bootloaders and theres lots of them about.
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re:New Person

Post by bubach »

You could use my old one from BOS 0.03 (public domain), it loads a file from fat12 and sets a20 & pmode before jumping to the loaded file.

/ Christoffer
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:New Person

Post by Brendan »

Hi,

This is what I can't understand - people doing massive amounts of work to create a new OS, but starting out relying on Microsoft's FAT12 (the worst file system ever created). It's like a machanical engineer saying "I'm going to make a totally new high performance vehicle" and then beginning with a starting handle and crank shaft from a Model 'T' Ford, left over from the days before electric starter motors.

Please, if you're writing your own boot loader either use raw sectors, create your own file system, or do something (anything) that doesn't involve following the footsteps of fools from almost half a century ago.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:New Person

Post by Pype.Clicker »

Brendan wrote: Hi,

This is what I can't understand - people doing massive amounts of work to create a new OS, but starting out relying on Microsoft's FAT12 ...

Please, if you're writing your own boot loader either use raw sectors, create your own file system, or do something (anything) that doesn't involve following the footsteps of fools from almost half a century ago.
Maybe just because those people wish to be able to use something else that their OS to populate the floppy ? or because half the people around just wish to get what's going on rather than "build a brand new stuff" ...
Dex4u

Re:New Person

Post by Dex4u »

@Brendan, you have made the commonest misstake most OS Dev's make, that is to think you can make better (this as nothing to do with your coding skills etc.) so many people start to do OS Dev because they think that they have a great new way of doing things, 99% end up as nowhere nearer as good as the thing they want to replace.

Take Dos as a example, most people think its rubbish, but after 4 years work, If anybody OS can do anything like what Dos can do, you will have done better than 99% of OS Dev's.

Only go into OS Dev for 2 reason, 1. to learn and 2. because you need a type of OS that is not available (eg: you want to get rid of the bloat).
As for those that go in to OS Dev to make something new where are there OS end up ??.
NotTheCHEAT

Re:New Person

Post by NotTheCHEAT »

Thanks Bubach. It's even in FASM syntax (I use FASM)! Brendan, you have to realize that FAT12 is easiest. I'm planning to make my own File System eventually, but FAT12 is the easiest to copy files to and from. It's not a mistake to make things easier on yourself- the bootloader is not the important thing, that can be changed later (I might switch to GRUB later, but it's very complex and I don't want to try to learn anything new). The kernel is the most important part, and no matter how you make/use the FS, that's the part I need to spend the most time on.

Thanks all for the suggestions. I'll probably switch to GRUB later, but right now I want to get started on the kernel, not learning some arcane commands, config file syntax, etc.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:New Person

Post by Brendan »

Hi,
NotTheCHEAT wrote:Brendan, you have to realize that FAT12 is easiest.
I'd have to disagree here - using no filesystem at all is easiest (load the boot image or kernel from contiguous sectors). It's also easy to eventually adapt to suit your own file system (just have N reserved sectors at the start).


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
NotTheCHEAT

Re:New Person

Post by NotTheCHEAT »

Not when you're on a windows system... lol

And you may say it's more difficult to write a bootloader. Well I don't have to write a bootloader, bubach just gave me one! So many people use FAT12 bootloaders that surely one will share, then I don't have to reinvent the wheel.

Eventually I'll have to write filesystem drivers, but until that happens FAT12 is no more difficult than no filesystem, or my own. I'm planning to make my own filesystem later, it just isn't THE MOST IMPORTANT THING until I actually HAVE an actual KERNEL.
AR

Re:New Person

Post by AR »

I would have to say creating your own filesystem is actually a bad idea, unless (and only unless) the features that you need cannot be retrofitted on any existing filesystem in any way.

The existing file systems are well tested with well defined advantages/disadvantages. Inventing your own will only yield an immature and potentially unreliable filesystem that will require rigourous testing before gaining any sort of acceptance [which is required for information interchange with other Operating Systems].

Of course, none of these things are factors if you think the concept of a "file system" is flawed and you want to replace the concept :)
Post Reply