Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to write an OS.. Help me a bit? 1

Status
Not open for further replies.

DevPortal

Programmer
Jul 8, 2005
40
US
I'm utilizing a bootloader I found online which I modified. It can load a COM file after booting, and supports minimal error handling. It is copyrighted, so if anyone has a bootloader which I can have that can load a .com file or any other file type that can be made in C or assembly, please tell me. Also: My current problem (while utilizing the bootloader i have) is that I am trying to write a kernel. I am trying to program for keyboard support so that the user can type things in, and then I can have the OS jump to different code based on what they type in. It will be a very simple setup, but this is what i'd like for now. Currently I have this: (i'm new to assembly, so there may well be errors, and the output of this SHOULD [but doesn't] allow the user to display one keypress at a time.)

inputloop:
int 9
in al, 60h
msg db, al
bios_print_string msg
jmp inputloop
 
Well, that shows that the code isn't properly functioning then, since it changes the results by NADDA. I'm going to try the original code (before I modified it to have different messages) and see if it will load the calc program right...
 
Proving that the code was fine, the original message displayed properly, and then nothing happens. This shows that it may be that SecWrite isnt properly writing the file to the disk, so I will attempt to do it on a true DOS 6.22 machine. If it still does not work, I will attempt to find a different program to write a file to a specific sector.
 
Apparently none of my stuff is working any longer, don't know why. I put the basic boot image onto the disk, and copied the calculator applet to my disk as osloader.com. This did not execute. I will have to revamp my project, maybe using differing boot code.
 
Your bootloader code exceeds the maximum of one sector,
so the bytes above the 512 a falling into the big black
hole.

By recoding the move you just added a byte of machine code
so one more byte of the bootload message falls into....

If there is no 000h found in memory from this point
the bootloader will just ceep sending byte's till all
64k is done and then do it all over again.

Then the second, afther loading a com file you have to start your program at xxxx:0100 and not xxxx:0000

succes, Tessa
 
Tessa, that definitely deserves a star.

I was on the verge of digging out an old version of MASM to try to make sense of what was going wrong - just shows how rusty I am.

I would not necessarily agree with you about the start address, though. DOS requires COM files to start at xxxx:0100, but this is to allow for the Program Segment Prefix. There is no reason why DevPortal's programs can't start from xxxx:0000.

DevPortal, The Boot Sector does not need to allow for a BIOS Parameter Block since this is not DOS. All the Boot Sector has to do is load your operating system - NOTHING ELSE. Asd you don't need complex disk management, the OS (which can be as large as you need) can start from the second sector. The OS will then provide the resources that we talked about in my post 8 Jul 05 14:21

Hope this gives you something more to go on.

 
Some further thoughts on structure:

Disk Layout (AbsoluteSectors):
Code:
0     :  Boot Sector
1 - 8 :  Operating System
9     :  File System
10 -> :  Files

This allows for a 4K operating system
If your file names are limited to 8 characters then up to 64 files
As this does not provide detailed file management files should be fixed at, say, 4K and padded where necessary.

=========

Memory Structure:
Code:
0000:7C00 BS Loaded
0000:8FFE SP
0000:9000 OS
0000:A000 memory copy of File System
0000:B000 user program area

This means that CS, DS, ES and SS can all be 0

==========

Your Boot Sector would then just need to set SS:SP (between CLI and STI) and DS and ES. Then load AbsoluteSectors 1 to 8 at 0000:9000 and JMP to 9000.

Your OS would then load AbsoluteSector 9 at A000 and then monitor the keyboard. When Enter is pressed check the string that has been entered against the FileSystem, work out which File was selected (if filenames are fixed at or packed to 8 characters the arithmetic will be easy) and then claculate the AbsoluteSector (which can then be easily converted to Head/Cylinder/Sector) to locate the program, load it into B000 and CALL B000. Note all your programs must end with RET to get back to the OS loop.

Hope this helps.




 
If you are building the com files the space for the program segment prefix is reserved in the binairy(== com) file.
So you have to start your programs at xxxx:0100.
If you create your com's thru a other way then an only then you can start at xxxx:0000

Also you have to consider that if you are realy bootloading from the bios level, that means if there is no other operating system loaded before, you can not use "DOS" interrupt call(it simple is not there).
Only the "BIOS" call can be used.

Good luck, Tessa
 
I've already recoded the whole OS and have it passing the control to a C kernel, but am at the same problem only worse than when it was in ASM, cuz I cant even execute programs >.<. Anyway, I think I'm going to two-prong this project, and make an ASM-Only OS and a ASM/C OS. Also: As I said very early in these posts, I'm an ASM noob. I'm also a C noob. I'm pretty much a noob to all normal programming. The only language I have extensive (and I mean GODLIKE) experience in is GML, which is in a program called Gamemaker. It is very very similar to C, so I have some good experience with the structure, and good grasp on programming in general. Anyway, what I'm trying to say is that while I can understand just about everything you guys say, I cannot implement some of the things, because I just don't know how to translate from suggestions-->code. I'm just not experienced enough. (I've made most of what I've made so far through modifying public domain code) Therefore, could someone help me do so?
 
if you like, go to my mwesite


and email me from there. I would be interested in helping you with your c code. i am not as fluent as some but i do have 5 or 6 years as an intense hobbyist. i have also begun a study of assembler. i would not be able to help you much with asm but i am looking for the opportunity to work with someone els on a project. your project interests me and i see the opportunity to learn some new skills.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top