-
Notifications
You must be signed in to change notification settings - Fork 13
Tutorial: Writing a program
This tutorial will get you started in how to write a program for fudge.
We will start with the most basic of programs namely the helloworld
program.
#include <fudge.h>
void main()
{
call_write(CALL_O0, 0, 13, "Hello world!\n");
}
All programs begin by including the header fudge.h
in order to access the most basic system functionality and definitions in order to communicate with the kernel.
A program starts in main()
. As you can see main()
does not take any arguments nor does it return any value. This is different to other operating systems because fudge communicates exclusively using streams. Streams are communication channels between the kernel and the program.
- CALL_DR: Root directory stream
- CALL_DW: Working directory stream
- CALL_I[0-9]: Input stream
- CALL_O[0-9]: Output stream
- CALL_L[0-9]: Local stream. For general purpose
In this case the helloworld
program only uses the output stream by issuing the call_write()
syscall sending the string "Hello world!\n"
of size 13 bytes and offset 0.