Results 1 to 6 of 6

Thread: Has this been done before? Pascal OS?

  1. #1
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45

    Has this been done before? Pascal OS?

    I've been looking around the Internet and found this page: http://wiki.osdev.org/Pascal but I find it rather incomplete. Well actually, very. I then looked at the various C options, but, in all honesty, I cannot stand C one bit. So I had another look at the http://wiki.osdev.org/Pascal page and got a bootloader working but can't get any further.

    I am using IsoMaster to write the stub.o (from stub.asm) to the boot record and boot it in virtual box. I've tested it and I know that it gets up to the line "call kmain" but cannot get it to go any further. Is there some sort of error that I am missing? Preferably, is there anyone out there that has written a good tutorial that is relatively easy to follow in how to build a kernel in pascal?

    Many thanks in advance.

    ~~EDIT~~
    I know that this is PGD and that it stands for Pascal Game Development but I thought that this would be the place where I could find the most amount of pascal programmers, and not on some other osdev forum crammed full with C coders.
    ~~END~~
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  2. #2

    Re: Has this been done before? Pascal OS?

    First I must say that IMHO C is the best option to code an operating system because it was designed for such work and Pascal is much higher level.

    Anyway there are a kernel written in Pascal + Assembler: Toro. Actually I don't know how much complex it is but you'll find a lot of versions in the download page. May be it helps you a bit.
    No signature provided yet.

  3. #3
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45

    Re: Has this been done before? Pascal OS?

    Although Toro seems good, I am now, officially, lost. What I seek to do is just get a bootsector to launch a program/procedure. Although Toro does contain it (I think) it uses all manner of complex techniques (multitasking, boot options...) which has me completely confused. Any help would much appreciated. Here is the file I have in the boot sector at the moment:

    Code:
    [bits 32]
    
    [global kstart]
    
    [extern kmain]
     
    
    MULTIBOOT_MODULE_ALIGN     equ   1<<0
    MULTIBOOT_MEMORY_MAP      equ   1<<1
    MULTIBOOT_GRAPHICS_FIELDS    equ   1<<2
    MULTIBOOT_ADDRESS_FIELDS    equ   1<<16
     
    
    MULTIBOOT_HEADER_MAGIC     equ   0x1BADB002
    MULTIBOOT_HEADER_FLAGS     equ   MULTIBOOT_MODULE_ALIGN | MULTIBOOT_MEMORY_MAP
    MULTIBOOT_HEADER_CHECKSUM    equ   -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
    
    KERNEL_STACKSIZE        equ   0x4000
     
    section .text
    
    align 4
    dd MULTIBOOT_HEADER_MAGIC
    dd MULTIBOOT_HEADER_FLAGS
    dd MULTIBOOT_HEADER_CHECKSUM
     
    
    kstart:
        mov esp, KERNEL_STACK+KERNEL_STACKSIZE 
        push eax                
        push ebx               
        call kmain            
        cli                 
        hlt                 
     
    section .bss
    
    align 32
    KERNEL_STACK:
        resb KERNEL_STACKSIZE
    My question at the moment is, why does it not execute the kmain procedure? Does it all have to be in one file or will seperate files do? Here is the result of DIR in the folder:

    Code:
    autocompile.sh	 crt.o		  kernel.obj	  multiboot.o	 stub.o
    autocompile.sh~ crt.ppu	  kernel.pas	  multiboot.pas system.o
    console.o	 howtocompile.txt kernel.ppu	  multiboot.ppu system.pas
    console.pas	 kernel.bak	  linker.script  stub.asm	 system.ppu
    console.ppu	 kernel.o	  linker.script~ stub.asm~
    where stub.o is boot record...
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  4. #4

    Re: Has this been done before? Pascal OS?

    I've written one which is still under development. It currently works on x86 and ARM

    Getting over the first part is the hardest. You just have to try a lot and read alot. If there's anything specific just send me a PM or contact me on jeppesoftware@hotmail.com

    There's a bit about it here, though no source yet. I'm still looking for a way to get a source control repository http://j-software.dk/
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  5. #5

    Re: Has this been done before? Pascal OS?

    I believe that on the fpc forums there was once an hello world os source. But i cannot find it there now.

    Found it: http://wiki.osdev.org/Pascal it is now a wiki page and does a bit more...
    http://3das.noeska.com - create adventure games without programming

  6. #6
    PGDCE Developer de_jean_7777's Avatar
    Join Date
    Nov 2006
    Location
    Bosnia and Herzegovina (Herzegovina)
    Posts
    287

    Re: Has this been done before? Pascal OS?

    I have an example of a barebone OS which you can get here (beware of ads, free hosting ).
    http://dbx.orgfree.com/bareos/index.html
    I used the code from the OSDev Pascal barebone wiki page, put it in units and done some stuff to get a buildable iso. I've provided a built iso. Read the included bareOS.txt file which explains how to build the code.

    Also an interesting example, but way more complex is Free Pascal Operating System. The google code page is a mess, but the OS is quite effective. Seeing as the author(s) did not update in quite some time, I'm not sure if this is going anywhere.

    Quote Originally Posted by &#209;u&#241;o Mart&#237;nez
    First I must say that IMHO C is the best option to code an operating system because it was designed for such work and Pascal is much higher level.
    The above examples show that it is possible to do an OS in Pascal. There is no significant advantage of C over Pascal. Both will require the use of some assembly anyway. The higher level thing is wrong, as it is possible to use FPC for programming embedded systems (which btw, is something low level). In Delphi it is also possible, but rather difficult which makes Delphi unsuited for this task. It may be true that C may be better suited (in my opinion not, as it's as easy to do OS development in FPC as it is in C), but if you want to program in Pascal, there is no reason to use C.
    Existence is pain

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •