boot without INT
boot without INT
Hi.
How can i make a boot with no INT's instructions?
Im using INT 13h to load my "OS" from a floppy disk (in bochs emu). But i'd like to avoid INTs.
How can i make a boot with no INT's instructions?
Im using INT 13h to load my "OS" from a floppy disk (in bochs emu). But i'd like to avoid INTs.
Sorry if bad english.
Re: boot without INT
Hello,
Is there any reason why you want to avoid INTs?
You would have to develop a minidriver for the media you are booting from. This can be very hard, if impossible, within the 512 bytes of the bootsector do to its limited space. However it is possible outside the bootsector, of course.
Is there any reason why you want to avoid INTs?
You would have to develop a minidriver for the media you are booting from. This can be very hard, if impossible, within the 512 bytes of the bootsector do to its limited space. However it is possible outside the bootsector, of course.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Re: boot without INT
np.. just for fun & knowledge.neon wrote:Is there any reason why you want to avoid INTs?
How can i learn how to develop a driver?You would have to develop a minidriver for the media you are booting from. This can be very hard, if impossible, within the 512 bytes of the bootsector do to its limited space. However it is possible outside the bootsector, of course.
Sorry if bad english.
Re: boot without INT
OSDEV Wiki at your service.Teehee wrote:np.. just for fun & knowledge.neon wrote:Is there any reason why you want to avoid INTs?
How can i learn how to develop a driver?You would have to develop a minidriver for the media you are booting from. This can be very hard, if impossible, within the 512 bytes of the bootsector do to its limited space. However it is possible outside the bootsector, of course.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
Re: boot without INT
When i was writing my own bootloader i had so much trouble with BIOS int 13h, that i decided to skip it altogether, my bootloader now houses a mini-driver for floppy disks, it loads the next 35 sectors. My mini-driver takes about 400 bytes, 300 for the floppy driver proper, and 100 for PIC/PIT/DMA initialisation code, because bochs BIOS leaves those in a, hmm, rather interesting state.neon wrote: You would have to develop a minidriver for the media you are booting from. This can be very hard, if impossible, within the 512 bytes of the bootsector do to its limited space. However it is possible outside the bootsector, of course.
Of course, i had to make some assumptions, for example, i had to assume there were no bad sectors, and the user would not try to remove the floppy during boot.
As well, a mini-driver that takes away 400 bytes makes it inpossible to do some FAT-like directory parsing in the boot sector.
Re: boot without INT
Exactly! Now you seem to understand why BIOS is unavoidable.DLBuunk wrote:When i was writing my own bootloader i had so much trouble with BIOS int 13h, that i decided to skip it altogether, my bootloader now houses a mini-driver for floppy disks, it loads the next 35 sectors. My mini-driver takes about 400 bytes, 300 for the floppy driver proper, and 100 for PIC/PIT/DMA initialisation code, because bochs BIOS leaves those in a, hmm, rather interesting state.neon wrote: You would have to develop a minidriver for the media you are booting from. This can be very hard, if impossible, within the 512 bytes of the bootsector do to its limited space. However it is possible outside the bootsector, of course.
Of course, i had to make some assumptions, for example, i had to assume there were no bad sectors, and the user would not try to remove the floppy during boot.
As well, a mini-driver that takes away 400 bytes makes it inpossible to do some FAT-like directory parsing in the boot sector.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
Re: boot without INT
i really have trouble to understand these things. IDK why...
i have learned these boot steps:
1. load your boot sector
2. set A20
3. set PM
4. Hi kernel
Is that ok?
But i'd like a step-by-step for each item, using assembly examples. I can't understand that only by osdevwiki
i have learned these boot steps:
1. load your boot sector
2. set A20
3. set PM
4. Hi kernel
Is that ok?
But i'd like a step-by-step for each item, using assembly examples. I can't understand that only by osdevwiki
Sorry if bad english.
-
- Member
- Posts: 255
- Joined: Tue Jun 15, 2010 9:27 am
- Location: Flyover State, United States
- Contact:
Re: boot without INT
There are lots of assembly examples on the wiki. If you can't understand them, you probably don't know English well, in which case I would recommend learning it because it is the lingua franca of programming. Either that, or you don't meet the required knowledge (check Getting Started), in which case you should write some user-space programs before trying OS development.
Re: boot without INT
Did you check the 'Baby-Step Tutorials'.Teehee wrote:i really have trouble to understand these things. IDK why...
i have learned these boot steps:
1. load your boot sector
2. set A20
3. set PM
4. Hi kernel
Is that ok?
But i'd like a step-by-step for each item, using assembly examples. I can't understand that only by osdevwiki
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
Re: boot without INT
And how is it related to 'Boot without INT'? You may want to start a new thread.Teehee wrote:i really have trouble to understand these things. IDK why...
i have learned these boot steps:
1. load your boot sector
2. set A20
3. set PM
4. Hi kernel
Is that ok?
But i'd like a step-by-step for each item, using assembly examples. I can't understand that only by osdevwiki
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
- DavidCooper
- Member
- Posts: 1150
- Joined: Wed Oct 27, 2010 4:53 pm
- Location: Scotland
Re: boot without INT
I used to load my OS in using my own device driver in the boot sector (after switching to protected mode so that the same driver could be used for all loads and saves), but mine worked by polling the FDC chip after switching it out of DMA mode, the result being that Bochs couldn't handle it. More importantly, I couldn't boot a machine from a USB floppy drive, and writing a better device driver that uses the DMA and interrupts wouldn't help with that - there's simply no possibility of setting up the machine to use USB with your own code in a boot sector, so the only option is to let the BIOS help you. I've now junked the old boot sector and replaced it with one which uses the BIOS, and I have no desire to go back to the old one. Learn to love the BIOS - it is your friend, and it can do a lot more for you than just load your OS. Aim to write code to jump in and out of real mode from protected mode so that you can use the BIOS at any time. You may think your aim should be to get into protected mode and just stay there, writing all your own code to do all the things that the BIOS does, but internal floppy disk drives are practically extinct in computers now, so you should plan to work with USB floppy drives via the BIOS right from the start. Don't waste your time writing a beautiful boot sector which can only run on computers so old that they belong in a museum.
- DavidCooper
- Member
- Posts: 1150
- Joined: Wed Oct 27, 2010 4:53 pm
- Location: Scotland
Re: boot without INT
Sorry about the long delay, Berkus, but I've been trying to ensure that the new load/save system is fully reliable (simply by using it a lot, and so far it's worked faultlessly). I've also made numerous other changes which might have destabilised things, but I seem to have got away with the whole lot. There are a couple of new keyboard bugs which appear in Bochs, both to do with key repeats, but the worst that can happen is that a buffer will fill up and the OS will freeze if you hold a key down for too long while running code either through the slow monitor program or where the OS generates its own software key repeats to amplify the speed of the actual keyboard repeats. When that happens, you can reboot in an instant in Bochs and quickly get back to where you were, so it isn't a huge problem. I'll upload the current version as soon as I've tidied up the bit of code I'm currently working on so that it doesn't crash due to incompleteness. I'll announce it in the MSB-OS thread as soon as it's available. My site's been promising the next version by "tomorrow" for the best part of two months (because I haven't had the time to go into it to change it), but this time it really should be tomorrow unless something goes badly wrong.
If the OP wants to look at the original FDC driver (which is extremely compact), it's still in the OS, though it's no longer in the boot sector. Once it's available, he can run it in Bochs and look for the routine called "com" which sends strings of command bytes to the FDC chip. A number of adjacent routines hold the different strings of instructions used to do such things as read, write and seek. The command bytes are passed to com as inline parameters (or at least I think that's what they're called), each terminated by a 254 byte. A delay loop is run after each byte is sent.
[Edit: new version of MSB-OS available now. Click on link below to access it]
If the OP wants to look at the original FDC driver (which is extremely compact), it's still in the OS, though it's no longer in the boot sector. Once it's available, he can run it in Bochs and look for the routine called "com" which sends strings of command bytes to the FDC chip. A number of adjacent routines hold the different strings of instructions used to do such things as read, write and seek. The command bytes are passed to com as inline parameters (or at least I think that's what they're called), each terminated by a 254 byte. A delay loop is run after each byte is sent.
[Edit: new version of MSB-OS available now. Click on link below to access it]
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c
MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming
MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming