• Recent Tutorials

  • Up is down - Baremetal Programming & Pascal as Low As It Gets

    First lets look at the components of helios - a kernel.pas, helios_console.pas and core_helios.pas make up most of what we care about - stub.asm is the loader, linker.script tells ld how to link our OS into the kernel.obj we care about and the remainder of the files are only there for the re-assurance of dependency satisfaction.

    Kernel.pas - the 'second stage' of getting your code running, it acts as a marker in the digital sea of ones and zeros found inside Kernel.obj, our actual running kernel. All it does is set everything up and get it ready with a globally recognizeable kmain procedcure telling the loader: Start running things here. This then launches the helios.kernel procedure from core_helios.pas where any initialization code can be added and also supplies a unix style runlevel variable to keep track of just how far down the line the OS is at.


    helios_console.pas supplies the oHelios_Console that gives us the ability to print things to the screen as well as read a key code - very basic but required.


    The code itself is rather self explanatory on the xyz_helios_abc.pas files - its all the familiar pascal. below it is the fundamentals of getting the ball rolling: x86.pas - full of the ASM goodness that talks to our hardware as well as a few others.


    Comments 5 Comments
    1. chronozphere's Avatar
      chronozphere -
      Impressive! I didn't know that this was possible using pascal. Although its not really necessary, since we allready have linux, its great to play with :-D

      I fear that I won't have any time for it though.
    1. code_glitch's Avatar
      code_glitch -
      Its true we have linux - but lets say you needed to calculate some numbers of pi as fast as you could with zero overhead (or only a few bytes of it ).

      As a concept though, I think this demonstrates the true power of pascal - I've heard all too many critiques of it saying its too high level, no direct memory management and how limiting managed pointers can be. This, though, is the transformation of 'theoretically' to a much more practical approach to saying: it may be high level, but give it a line or two of ASM, tell the compiler to scrap the beautification and off you go: baremetal programming

      It is a shame the OSDev site only goes as far as basic VGA - if we had opengl drivers/code available I would have been able to compile prometheus and that could have been a sight to behold. Although I have not given up on the idea of finding some ATI docs on the matter and looking if there is any common ground between the driver .so files procedure wise. Because if that is the case it may be possible to scrap together a quick and dirty solution to the OpenGL solution. Still looking into this a bit at a time as it were.
    1. Ñuño Martínez's Avatar
      Ñuño Martínez -
      Man, I was looking for something like this for decades. Actually. Thank you for make it public!
    1. code_glitch's Avatar
      code_glitch -
      Nuno: No problem at all... I was actually getting worried by the silence of the comments box I'd posted one of the few topics no one needed/was interested in

      At least now its helped at least one person I am more or less satisfied...
    1. Ñuño Martínez's Avatar
      Ñuño Martínez -
      Quote Originally Posted by code_glitch View Post
      At least now its helped at least one person I am more or less satisfied...
      You know: Tanenbaum's book is so complex... I know your HeliOS isn't a full kernel but it helps to understand and testing ideas and so.