FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


I want to write a OS





why6487
I would like to make a OS written in C++ and Assembler. This is what the bootloader does:

Loads a EXFS filesystem of a hard drive combined to a file called thehd.hd (anyone needs to develop it in C++) which of that loads loader.bl and loads the fs.dir file and starts fileman.prg which can manage files on it.

The Goal of it:

The goal is to make a GUI based OS like Windows (not a ripaway)!
The tile bar color is dark blue.

Anyone that makes a logo I give 5 FRIH$.

Filesystem code:
Code:
// The "Malta" filesystem, EXFS
int FSMain();
{
         var bootloader = "loader.bl";
         var s = 0;
         // Commantice loading!
         s = ExcuteFile(bootloader);
         // Fail?
         if (s = 0)
         {
                    scrPrint("Unable to load loader.bl! Error 1.");
         }
         else()
         {
                    return 1;
         }
}

The API, fileman.prg, hard drive and memory mangement is yet need some help on.
Arno v. Lumig
I'm actually working on an OS myself. I got a multiboot-compliant kernel that can do some text output to a simple console. I am working on the memory management now.
How far are you with your OS? The APIs you use in the code example in your previous post, are they working yet, or is it just a bit of pseudo-code?
why6487
Arno v. Lumig wrote:
I'm actually working on an OS myself. I got a multiboot-compliant kernel that can do some text output to a simple console. I am working on the memory management now.
How far are you with your OS? The APIs you use in the code example in your previous post, are they working yet, or is it just a bit of pseudo-code?


They aren't working. I need help on them. If your interisted in the project, PM me and tell what you are good at. I'm yet 2% done.
I'm on the loader part if anyone would help me.
Arno v. Lumig
I could pass you the multiboot-compliant kernel, but it's of no use, it doesn't have any features yet except for text output... You'll need grub to boot it by the way, I'm not going to write a boot loader myself (It's nearly as hard as writing an OS, and it's useless if you got GRUB).
why6487
Arno v. Lumig wrote:
I could pass you the multiboot-compliant kernel, but it's of no use, it doesn't have any features yet except for text output... You'll need grub to boot it by the way, I'm not going to write a boot loader myself (It's nearly as hard as writing an OS, and it's useless if you got GRUB).


I'll just write a single loader.
It's done now.
Code:
// Malta loader
var hdimg = "fs.dir"
var s1 = 0;
scrPrint("Ok when loading...");
// Now to init!
initFS(hdimg, 1, df );
// Fail (yet again?)
if(s1 = 0);
{
         scrPrint("Couldn't load filesystem! Error 2.");
}
else()
{
         scrPrint("Loaded fully!");
         countdown(5, "Load up!");
         ExcuteFile("fileman.prg");
}

So, I'm working on memory now. Can you help me?
Arno v. Lumig
Code:
global _loader           ; making entry point visible to linker
extern _main             ; tells the linker that main is in an other file

; doing some grub magic
MODULEALIGN equ  1<<0
MEMINFO     equ  1<<1
FLAGS       equ  MODULEALIGN | MEMINFO
MAGIC       equ    0x1BADB002
CHECKSUM    equ -(MAGIC + FLAGS)

section .text
align 4
MultiBootHeader:
   dd MAGIC
   dd FLAGS
   dd CHECKSUM

STACKSIZE equ 0x4000          ; reserve 16k of kernel stack space

_loader:
   mov esp, stack+STACKSIZE           ; set up the stack
   push eax                           ; do multiboot magic
   push ebx                           ; and info structure

   call  _main                        ; call function main
               hlt                    ; halt the machine as soon as main returns

section .bss
align 32
stack:
   resb STACKSIZE      ; reserve 16k stack


That is a simple NASM assembly file that will load function main() from an external C file. You'll have to compile this and the C file and then link them together with ld. Then setup grub to point to the kernel and it'll boot (and do what's contained in the main() function of the C file).
From now on you'll be able to change memory values like this: (in C, not ASM)
Code:
unsigned char *pointer = (unsigned char*)0xB80000; //this is the video memory pointer
*pointer++ = 0; //put the value 0 in the variable the pointer points at (you're with me?)


Actually, the cls (clearscreen) function looks like this:
Code:
void cls()
{
 unsigned char *pntr = (unsigned char *)0xB8000; //setup the pointer
   const long size = 80*25; //console size
   long loop; //counter

   for (loop=0; loop<size; loop++) {
      *pntr++ = 0;
      *pntr++ = 0xF;
}
why6487
Arno v. Lumig wrote:
Code:
global _loader           ; making entry point visible to linker
extern _main             ; tells the linker that main is in an other file

; doing some grub magic
MODULEALIGN equ  1<<0
MEMINFO     equ  1<<1
FLAGS       equ  MODULEALIGN | MEMINFO
MAGIC       equ    0x1BADB002
CHECKSUM    equ -(MAGIC + FLAGS)

section .text
align 4
MultiBootHeader:
   dd MAGIC
   dd FLAGS
   dd CHECKSUM

STACKSIZE equ 0x4000          ; reserve 16k of kernel stack space

_loader:
   mov esp, stack+STACKSIZE           ; set up the stack
   push eax                           ; do multiboot magic
   push ebx                           ; and info structure

   call  _main                        ; call function main
               hlt                    ; halt the machine as soon as main returns

section .bss
align 32
stack:
   resb STACKSIZE      ; reserve 16k stack


That is a simple NASM assembly file that will load function main() from an external C file. You'll have to compile this and the C file and then link them together with ld. Then setup grub to point to the kernel and it'll boot (and do what's contained in the main() function of the C file).
From now on you'll be able to change memory values like this: (in C, not ASM)
Code:
unsigned char *pointer = (unsigned char*)0xB80000; //this is the video memory pointer
*pointer++ = 0; //put the value 0 in the variable the pointer points at (you're with me?)


Actually, the cls (clearscreen) function looks like this:
Code:
void cls()
{
 unsigned char *pntr = (unsigned char *)0xB8000; //setup the pointer
   const long size = 80*25; //console size
   long loop; //counter

   for (loop=0; loop<size; loop++) {
      *pntr++ = 0;
      *pntr++ = 0xF;
}

I didn't get GRUB source code. I can do this:
Code:
global _loader           ; making entry point visible to linker
extern _FSmain             ; tells the linker that main is in an other file

; not doing some grub magic
MODULEALIGN equ  1<<0
MEMINFO     equ  1<<1
FLAGS       equ  MODULEALIGN | MEMINFO
MAGIC       equ    0x1BADB002
CHECKSUM    equ -(MAGIC + FLAGS)

section .text
STACKSIZE equ 0x8000          ; reserve 32k of kernel stack space

_loader:
   mov esp, stack+STACKSIZE           ; set up the stack
   push eax                           ; do multiboot magic
   push ebx                           ; and info structure

   call  _FSMain                        ; call function FSMain
               hlt                    ; halt the machine as soon as FSMain returns

section .bss
align 32
stack:
   resb STACKSIZE      ; reserve 32k stack

And thanks for the cls function!

I now need the source of the API (which is hard) and fileman.prg.

I wrote the MsgBox function.
All I need is...
framePrint, scrPrint, scrColor, buttonMake, CompileFile, CopyFile, DeleteFile, ExcuteFile, initFS and countdown.

If I have Linux (which I don't have) the ASM code is this:
Code:
global _loader           ; making entry point visible to linker
extern _FSMain                   ; tells the linker that main is in an other file

; doing some grub magic
MODULEALIGN equ  1<<0
MEMINFO     equ  1<<1
FLAGS       equ  MODULEALIGN | MEMINFO
MAGIC       equ    0x1BADB002
CHECKSUM    equ -(MAGIC + FLAGS)

section .text
align 4
MultiBootHeader:
   dd MAGIC
   dd FLAGS
   dd CHECKSUM

STACKSIZE equ 0x8000          ; reserve 32k of kernel stack space

_loader:
   mov esp, stack+STACKSIZE           ; set up the stack
   push eax                           ; do multiboot magic
   push ebx                           ; and info structure

   call  _FSMain                        ; call function main
               hlt                    ; halt the machine as soon as main returns

section .bss
align 32
stack:
   resb STACKSIZE      ; reserve 32k stack
Animal
Please stop double and multiple posting. I've combined all your double posts - in future, if you have something to add, use the "Edit" button as required by the Forum Rules.
why6487
I've done the Malta logo. Here it is:

Animal wrote:
Please stop double and multiple posting. I've combined all your double posts - in future, if you have something to add, use the "Edit" button as required by the Forum Rules.

OK, Aminal.
why6487
API should be done tommorow.

Progress : 46%
API:
Code:
// Malta API
void cls()
{
 unsigned char *pntr = (unsigned char *)0xB8000; //setup the pointer
   const long size = 80*25; //console size
   long loop; //counter

   for (loop=0; loop<size; loop++) {
      *pntr++ = 0;
      *pntr++ = 0xF;
}
void MsgBox(msg, title);
{
   unsigned char *pntr = (unsigned char *)0xB8000; //setup the pointer
   const long size = 80*25; //console size
   long loop; //counter
   
   framePrint("msgbox");
   scrPrint("-------------------------------------/n");
   scrColor(blue);
   scrPrint("          "title"                   /n");
   scrDefault();
   scrPrint("-------------------------------------/n');
   scrPrint(true, msg);
   buttonPrint(msgbox, "OK");
   scrPrint("-------------------------------------/n");
   mouseEn();
   if (okpressed = 1;)
   {
           cls();
   }
void Start()
{
  loader();
}
void GetProperitesOfFile(file);
{
  read = 096:975:865        // translates to first sector on cy 0 and side 0
  find = 100:000:000         // translates to second sector on cy 0 and side 0
  var result = getIt(hdimg);
}
Animal
I've warned you before about double-posting, yet you continue to do it. I'm therefore closing this thread since this is nothing other than an abuse of the Frihost points system. Please do not create a new thread regarding your operating system - if you wish to inform users about the code, use your site and not the Frihost Forum.

-close-
Related topics
PHP Write to line
Microsoft gunning for Adobe's PDF format?
Java
A use for Ajax?
Clock-javascript
50 frih$ - Write an article or post on the forums
COnstructing an OS from nothing...
Non-Computer OS
OS based on Adobe Flash?
Thinking about creating my own OS
Why people hate Mac-OS (users)?
Cool OS to try on older hardware
World leading OS
*** POLL *** The Best Programming Language?
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Computers -> Operating Systems

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.