From 9bf84f13117dd4ddc73bdba1720ee30ecddd5149 Mon Sep 17 00:00:00 2001 From: trpeski Date: Mon, 19 Sep 2016 18:14:27 +0300 Subject: [PATCH 1/2] Create GeneralDrivers.h --- src/GeneralDrivers.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/GeneralDrivers.h diff --git a/src/GeneralDrivers.h b/src/GeneralDrivers.h new file mode 100644 index 0000000..e180c8b --- /dev/null +++ b/src/GeneralDrivers.h @@ -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 )); + +} From 91297b1bfe7344a1002590aecba6c84ff1518648 Mon Sep 17 00:00:00 2001 From: trpeski Date: Sat, 24 Sep 2016 10:21:32 +0300 Subject: [PATCH 2/2] Create kernel.asm --- src/kernel.asm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/kernel.asm diff --git a/src/kernel.asm b/src/kernel.asm new file mode 100644 index 0000000..8f7f7d2 --- /dev/null +++ b/src/kernel.asm @@ -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).. +