Simple Operating System
kernel.c File Reference

Simple 16 bit kernel for BIOS. More...

#include <io.h>
#include "../include/string.h"
#include "../include/stdlib.h"
#include <conio.h>
#include "interrupts.h"
#include "fs.h"
Include dependency graph for kernel.c:

Go to the source code of this file.

Macros

#define KERNEL   1
 
#define KERNEL_ADDRESS   0
 
#define PROGRAMS_MAX   7
 Maximal number of programs running simultaneously. More...
 

Functions

int load (Byte beginSector, Byte track, int parameter, int size, int segment)
 
int gets (char *str, int size)
 
void reset ()
 Reset OS to kernel.
 
__int void timer (struct interruptFrame *frame)
 Interruption is called 18 times per second. More...
 
__int void shiftPrtSc (struct interruptFrame *frame)
 Shift + PrintScreen handler. More...
 
__int void ctrlBreak (struct interruptFrame *frame)
 Ctrl + Break handler. More...
 
__start void main ()
 
void __printf (int a)
 Function for int 0x20 AH=3 see io.h printf() More...
 

Variables

bool programsMap [PROGRAMS_MAX]
 

Detailed Description

Simple 16 bit kernel for BIOS.

Author
Jaclav
Date
2023-06-10
Bug:

cannot give string literal to char* parameter, only int WHY!?

cannot use * as pointers, int only

Definition in file kernel.c.

Macro Definition Documentation

◆ PROGRAMS_MAX

#define PROGRAMS_MAX   7

Maximal number of programs running simultaneously.

1 segment for 1 program causes lack of segments https://wiki.osdev.org/Memory_Map_(x86)

Definition at line 32 of file kernel.c.

Function Documentation

◆ __printf()

void __printf ( int  a)

Function for int 0x20 AH=3 see io.h printf()

Parameters
aaddress of first parameter on stack, nth parameter is a+4n
Todo:
do it with dll

Definition at line 346 of file kernel.c.

◆ ctrlBreak()

__int void ctrlBreak ( struct interruptFrame frame)

Ctrl + Break handler.

It's called from int 9 see H-09 interrupts.a RBIL

https://www.stanislavs.org/helppc/int_1b.html

Bug:
doesn't work on bochs

Definition at line 123 of file kernel.c.

◆ main()

__start void main ( )

set interruption flag

Definition at line 131 of file kernel.c.

◆ shiftPrtSc()

__int void shiftPrtSc ( struct interruptFrame frame)

Shift + PrintScreen handler.

It's called from int 9 see H-09 interrupts.a RBIL

Bug:
doesn't work on bochs

Definition at line 112 of file kernel.c.

◆ timer()

__int void timer ( struct interruptFrame frame)

Interruption is called 18 times per second.

see B-1C interrupts.e RBIL

Todo:
It should switch between processes, add multithreading

Definition at line 61 of file kernel.c.