Almost any of todays operating systems has a more or less propietary
format for executable program-files. pOS makes no difference
here, but the file-format is rather simple and only serves
for version-controlling, paramter-reading and for correct
loading of the program code into memory. This file-format
is actually independant from the kernel so that any other
file-format might be used in future.
In the current release of pOS a simple executable-file-format
is used. A compiled binary pOS application program consists
of three linked code-parts (objects):
- the executable-header
- the kernel-symbol library
- the actual program-code
The executable header contains version-information of the
program-code and an entry-code, which is called upon
loading and executing. The entry-code basically opens
a pipe to the shell to retrieve the call-parameters of
the program-file and then calls the program-code-entry
with passing the parameters from the shell to the main()-
function.
The kernel-symbol libary contains all symbols as defined
in the include-file pos.h. The library contains
nothing more than pointers to the appropriate functions
in the kernel and thus must always be linked to any
application-program which makes use of any of the
kernel-functions.
The actual program-code is a compiled C or assembler
program which object-code is compatible with the
cc65-linker.
As the pOS-executable-file-format is quite trivial and applicable to virtually any C-compiler or assembler, you can simply write your application-program as you are used to it from other operating-systems. The following example-program demonstrates this.
#include "pos.h" int main (int args, char * vargs) { if (args == 2) { conput ("Your first argument is: "); conput (vargs [1]); } else conput ("You did not specify any arguments !"); }