Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/GeneralDrivers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
general driver for simple output and input those drivers are not meant to be used by the kernel
but used for making of more specific drivers like print();
*/ // written by antonio trpeski


unsigned char PortIOinByte( unsigned short port ) {

unsigned char data;

__asm__ (" in %% dx , %% al " : "=a " ( data ) : "d " ( port ));

return data;

}

void portIOoutByte( unsigned short port , unsigned char data ) {

__asm__ (" out %% al , %% dx " : :" a" ( data ), "d" ( port ));

}

unsigned short portIOinWord( unsigned short port ) {

unsigned short data;

__asm__ (" in %% dx , %% ax " : "=a " ( data ) : "d " ( port ));

return data;

}

void portIOoutWord( unsigned short port , unsigned short data ) {

__asm__ (" out %% ax , %% dx " : :" a" ( data ), "d" ( port ));

}
21 changes: 21 additions & 0 deletions src/kernel.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@









// section for kernel call (interapts) this will be called

inter:
pusha
cmp eax,4 ; if it has the value 4 then it will do a sys_out
je print


print:
mov al,bl ; so the caller will put the char in the bl
int 10h ; call bios (this can be done with the drivers but we need a system to make letters grapichs)..