--- /dev/null
+/*
+ IO Functions
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
+
+#ifndef System_IO_OS_DK_
+#define System_IO_OS_DK_
+
+int sys_in8(int port);
+int sys_in16(int port);
+int sys_in32(int port);
+
+void sys_out8(int port, int data);
+void sys_out16(int port, int data);
+void sys_out32(int port, int data);
+
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ Key Board Manager
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
\ No newline at end of file
--- /dev/null
+/*
+ VGA Manager
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
+
+#ifndef System_VGA_Text_OS_DK_
+#define System_VGA_Text_OS_DK_
+
+typedef enum{
+ Black=0x0,
+ Blue=0x1,
+ Green=0x2,
+ Cian=0x3,
+ Red=0x4,
+ Masenta=0x5,
+ Brown=0x6,
+ LightGray=0x7,
+ DarkGray=0x8,
+ LightBlue=0x9,
+ LightGreen=0xa,
+ LightCian=0xb,
+ LightRed=0xc,
+ LightMasenta=0xd,
+ LightBrown=0xe,
+ White=0xf,
+}Color_t;
+
+void init_sysvga(void);
+void ClearScreen(void);
+void vga_text_update_cursor(void);
+void DisplayOutputChar(const char ch);
+void ShiftDisplayChar(unsigned int len);
+void DisplayColorChangeChar(Color_t fore, Color_t back);
+
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ tools
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
+
+#ifndef Tools_OS_DK_
+#define Tools_OS_DK_
+
+void tool_beep(int tone);
+
+unsigned int lsearch_int(int* arrey, int search_num, unsigned int len);
+unsigned int lsearch_short(short* arrey, short search_num, unsigned int len);
+unsigned int lsearch_char(char* arrey, char search_num, unsigned int len);
+
+unsigned int lsearch_uint(unsigned int* arrey, unsigned int search_num, unsigned int len);
+unsigned int lsearch_ushort(unsigned short* arrey, unsigned short search_num, unsigned int len);
+unsigned int lsearch_uchar(unsigned char* arrey, unsigned char search_num, unsigned int len);
+
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ Type Define
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
+
+#ifndef OS_DK_Types_
+#define OS_DK_Types_
+
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+typedef unsigned long long uint64_t;
+
+typedef char int8_t;
+typedef short int16_t;
+typedef int int32_t;
+typedef long long int64_t;
+
+typedef unsigned short size_t;
+
+typedef char bool;
+
+#ifndef true
+# define true 0==0
+#endif
+
+#ifndef false
+# define false 0==1
+#endif
+
+#ifndef NULL
+# define NULL 0
+#endif
+
+#endif
\ No newline at end of file
--- /dev/null
+#Tools Makefile
+#Target
+T_NAME = libosdk.a
+TARGET = "${REL_F}/${T_NAME}"
+
+# Define
+AR = ar
+CD = cd
+MAKE = make
+CP = cp -pu
+TAR = tar
+
+ARFLAG = -rcs
+TARFLAG = -cf
+
+LIB =
+
+#Dir
+INC_DIR = ./include
+INC_REL = ${REL_DIR}/single_pkg
+
+LIB_DIR = ./lib
+LIB_IO = libio.a
+LIB_VGA = libvga.a
+LIB_T = libtools.a
+
+IO_DIR = ${LIB_DIR}/io
+VGA_DIR = ${LIB_DIR}/vga
+T_DIR = ${LIB_DIR}/tools
+
+IO_LIB = ${IO_DIR}/${LIB_IO}
+VGA_LIB = ${VGA_DIR}/${LIB_VGA}
+T_LIB = ${T_DIR}/${LIB_T}
+
+REL_DIR = ../release
+REL_S = ${REL_DIR}/single_pkg/lib
+REL_F = ${REL_DIR}/full_pkg
+REL_IO = ${REL_S}/${LIB_IO}
+REL_VGA = ${REL_S}/${LIB_VGA}
+REL_T = ${REL_S}/${LIB_T}
+
+ALL_LIB = ${IO_LIB} ${VGA_LIB} ${T_LIB}
+LIB_A_R = ${REL_S}/${T_NAME}
+
+compile:
+ ${CD} ${IO_DIR}; ${MAKE} io
+ ${CD} ${VGA_DIR}; ${MAKE} vga
+ ${CD} ${T_DIR}; ${MAKE} tools
+
+ ${AR} ${ARFLAG} ${TARGET} ${ALL_LIB}
+
+single:
+ ${MAKE} compile
+
+ ${CP} ${IO_LIB} ${REL_IO}
+ ${CP} ${VGA_LIB} ${REL_VGA}
+ ${CP} ${T_LIB} ${REL_T}
+ ${CP} ${TARGET} ${LIB_A_R}
+
+ ${CP}r ${INC_DIR} ${INC_REL}
+
+full:
+ ${MAKE} compile
+ ${MAKE} single
+
+ ${TAR} ${TARFLAG} ${REL_F}/osdk.tar ${REL_S}
+ bzip2 ${REL_F}/osdk.tar
\ No newline at end of file
/*
IO Functions
+ (C) 2015 OS-DK.
(C) 2015 VOSystems.
-*/
\ No newline at end of file
+*/
+
+#ifndef System_IO_OS_DK_
+#define System_IO_OS_DK_
+
+int sys_in8(int port);
+int sys_in16(int port);
+int sys_in32(int port);
+
+void sys_out8(int port, int data);
+void sys_out16(int port, int data);
+void sys_out32(int port, int data);
+
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ Key Board Manager
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
\ No newline at end of file
/*
VGA Manager
+ (C) 2015 OS-DK.
(C) 2015 VOSystems.
-*/
\ No newline at end of file
+*/
+
+#ifndef System_VGA_Text_OS_DK_
+#define System_VGA_Text_OS_DK_
+
+typedef enum{
+ Black=0x0,
+ Blue=0x1,
+ Green=0x2,
+ Cian=0x3,
+ Red=0x4,
+ Masenta=0x5,
+ Brown=0x6,
+ LightGray=0x7,
+ DarkGray=0x8,
+ LightBlue=0x9,
+ LightGreen=0xa,
+ LightCian=0xb,
+ LightRed=0xc,
+ LightMasenta=0xd,
+ LightBrown=0xe,
+ White=0xf,
+}Color_t;
+
+void init_sysvga(void);
+void ClearScreen(void);
+void vga_text_update_cursor(void);
+void DisplayOutputChar(const char ch);
+void ShiftDisplayChar(unsigned int len);
+void DisplayColorChangeChar(Color_t fore, Color_t back);
+
+#endif
\ No newline at end of file
/*
tools
+ (C) 2015 OS-DK.
(C) 2015 VOSystems.
-*/
\ No newline at end of file
+*/
+
+#ifndef Tools_OS_DK_
+#define Tools_OS_DK_
+
+void tool_beep(int tone);
+
+unsigned int lsearch_int(int* arrey, int search_num, unsigned int len);
+unsigned int lsearch_short(short* arrey, short search_num, unsigned int len);
+unsigned int lsearch_char(char* arrey, char search_num, unsigned int len);
+
+unsigned int lsearch_uint(unsigned int* arrey, unsigned int search_num, unsigned int len);
+unsigned int lsearch_ushort(unsigned short* arrey, unsigned short search_num, unsigned int len);
+unsigned int lsearch_uchar(unsigned char* arrey, unsigned char search_num, unsigned int len);
+
+#endif
\ No newline at end of file
/*
Type Define
- (C) 2015 VOSystems.s
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
*/
-#ifndef OS-DK_Types_
-#define OS-DK_Types_
+#ifndef OS_DK_Types_
+#define OS_DK_Types_
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
--- /dev/null
+/*
+ IO Functions
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
+
+#ifndef System_IO_OS_DK_
+#define System_IO_OS_DK_
+
+int sys_in8(int port);
+int sys_in16(int port);
+int sys_in32(int port);
+
+void sys_out8(int port, int data);
+void sys_out16(int port, int data);
+void sys_out32(int port, int data);
+
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ Key Board Manager
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
\ No newline at end of file
--- /dev/null
+/*
+ VGA Manager
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
+
+#ifndef System_VGA_Text_OS_DK_
+#define System_VGA_Text_OS_DK_
+
+typedef enum{
+ Black=0x0,
+ Blue=0x1,
+ Green=0x2,
+ Cian=0x3,
+ Red=0x4,
+ Masenta=0x5,
+ Brown=0x6,
+ LightGray=0x7,
+ DarkGray=0x8,
+ LightBlue=0x9,
+ LightGreen=0xa,
+ LightCian=0xb,
+ LightRed=0xc,
+ LightMasenta=0xd,
+ LightBrown=0xe,
+ White=0xf,
+}Color_t;
+
+void init_sysvga(void);
+void ClearScreen(void);
+void vga_text_update_cursor(void);
+void DisplayOutputChar(const char ch);
+void ShiftDisplayChar(unsigned int len);
+void DisplayColorChangeChar(Color_t fore, Color_t back);
+
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ tools
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
+
+#ifndef Tools_OS_DK_
+#define Tools_OS_DK_
+
+void tool_beep(int tone);
+
+unsigned int lsearch_int(int* arrey, int search_num, unsigned int len);
+unsigned int lsearch_short(short* arrey, short search_num, unsigned int len);
+unsigned int lsearch_char(char* arrey, char search_num, unsigned int len);
+
+unsigned int lsearch_uint(unsigned int* arrey, unsigned int search_num, unsigned int len);
+unsigned int lsearch_ushort(unsigned short* arrey, unsigned short search_num, unsigned int len);
+unsigned int lsearch_uchar(unsigned char* arrey, unsigned char search_num, unsigned int len);
+
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ Type Define
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
+
+#ifndef OS_DK_Types_
+#define OS_DK_Types_
+
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+typedef unsigned long long uint64_t;
+
+typedef char int8_t;
+typedef short int16_t;
+typedef int int32_t;
+typedef long long int64_t;
+
+typedef unsigned short size_t;
+
+typedef char bool;
+
+#ifndef true
+# define true 0==0
+#endif
+
+#ifndef false
+# define false 0==1
+#endif
+
+#ifndef NULL
+# define NULL 0
+#endif
+
+#endif
\ No newline at end of file
--- /dev/null
+#Tools Makefile
+#Target
+TARGET = "libio.a"
+
+# Define
+CC = gcc
+AS = gcc
+AR = ar
+
+CFLAG = -m32 -ffreestanding -fno-common -masm=intel -nostdlib -fno-builtin -fomit-frame-pointer -O2 -c
+AFLAG = -m32 -ffreestanding -fno-common -fno-builtin -fomit-frame-pointer -O2 -c
+
+ARFLAG = -rcs
+
+INCLUDE = -I${INCDIR}
+
+#Dir
+INCDIR = ../../include
+
+.S.o:
+ ${AS} ${INCLUDE} ${AFLAG} $<
+
+.c.o:
+ ${CC} ${INCLUDE} ${CFLAG} $<
+
+IN_S = in.S
+OUT_S = out.S
+
+IO_OBJ = ${IN_S:.S=.o} ${OUT_S:.S=.o}
+
+io:${IO_OBJ}
+ ${AR} ${ARFLAG} ${TARGET} ${IO_OBJ}
\ No newline at end of file
--- /dev/null
+/*
+ in Functions
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
+
+.file "in.S"
+.intel_syntax noprefix
+.code32
+
+.global sys_in8, sys_in16, sys_in32
+
+sys_in8:
+ MOV EDX,[ESP+4]
+ MOV EAX,0
+ IN AL,DX
+ RET
+
+sys_in16:
+ MOV EDX,[ESP+4]
+ MOV EAX,0
+ IN AX,DX
+ RET
+
+sys_in32:
+ MOV EDX,[ESP+4]
+ IN EAX,DX
+ RET
\ No newline at end of file
--- /dev/null
+/*
+ out Functions
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
+
+.file "out.S"
+.intel_syntax noprefix
+.code32
+
+.global sys_out8, sys_out16, sys_out32
+
+sys_out8:
+ MOV EDX,[ESP+4]
+ MOV AL,[ESP+8]
+ OUT DX,AL
+ RET
+
+sys_out16:
+ MOV EDX,[ESP+4]
+ MOV EAX,[ESP+8]
+ OUT DX,AX
+ RET
+
+sys_out32:
+ MOV EDX,[ESP+4]
+ MOV EAX,[ESP+8]
+ OUT DX,EAX
+ RET
\ No newline at end of file
--- /dev/null
+#Tools Makefile
+#Target
+TARGET = "libtools.a"
+
+# Define
+CC = gcc
+AS = gcc
+AR = ar
+
+CFLAG = -m32 -ffreestanding -fno-common -masm=intel -nostdlib -fno-builtin -fomit-frame-pointer -O2 -c
+AFLAG = -m32 -ffreestanding -fno-common -fno-builtin -fomit-frame-pointer -O2 -c
+
+ARFLAG = -rcs
+
+INCLUDE = -I${INCDIR}
+
+#Dir
+INCDIR = ../../include
+
+.S.o:
+ ${AS} ${INCLUDE} ${AFLAG} $<
+
+.c.o:
+ ${CC} ${INCLUDE} ${CFLAG} $<
+
+BEEP_C = beep.c
+LSEA_C = linersearch.c
+SYS_S = systool.S
+
+T_OBJ = ${BEEP_C:.c=.o} ${LSEA_C:.c=.o} ${SYS_S:.S=.o}
+
+tools:${T_OBJ}
+ ${AR} ${ARFLAG} ${TARGET} ${T_OBJ}
\ No newline at end of file
--- /dev/null
+/*
+ Beep
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
+
+void tool_beep(int tone)
+{
+ int i;
+ if(tone == 0) {
+ i = subset_tool_in8(0x61);
+ subset_tool_out8(0x61, i & 0x0d);
+ }else{
+ i = 1193180000 / tone;
+ subset_tool_out8(0x43, 0xb6);
+ subset_tool_out8(0x42, i & 0xff);
+ subset_tool_out8(0x42, i >> 8);
+ i = subset_tool_in8(0x61);
+ subset_tool_out8(0x61, (i | 0x03) & 0x0f);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ Liner Search
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
+
+unsigned int lsearch_int(int* arrey, int search_num, unsigned int len)
+{
+ if(len==0)return 0;
+
+ unsigned int C;
+ for(C=0; C<len; C++){
+ if(arrey[C]==search_num){
+ return C;
+ }
+ }
+ return 0;
+}
+
+unsigned int lsearch_short(short* arrey, short search_num, unsigned int len)
+{
+ if(len==0)return 0;
+
+ unsigned int C;
+ for(C=0; C<len; C++){
+ if(arrey[C]==search_num){
+ return C;
+ }
+ }
+ return 0;
+}
+
+unsigned int lsearch_char(char* arrey, char search_num, unsigned int len)
+{
+ if(len==0)return 0;
+
+ unsigned int C;
+ for(C=0; C<len; C++){
+ if(arrey[C]==search_num){
+ return C;
+ }
+ }
+ return 0;
+}
+
+unsigned int lsearch_uint(unsigned int* arrey, unsigned int search_num, unsigned int len)
+{
+ if(len==0)return 0;
+
+ unsigned int C;
+ for(C=0; C<len; C++){
+ if(arrey[C]==search_num){
+ return C;
+ }
+ }
+ return 0;
+}
+
+unsigned int lsearch_ushort(unsigned short* arrey, unsigned short search_num, unsigned int len)
+{
+ if(len==0)return 0;
+
+ unsigned int C;
+ for(C=0; C<len; C++){
+ if(arrey[C]==search_num){
+ return C;
+ }
+ }
+ return 0;
+}
+
+unsigned int lsearch_uchar(unsigned char* arrey, unsigned char search_num, unsigned int len)
+{
+ if(len==0)return 0;
+
+ unsigned int C;
+ for(C=0; C<len; C++){
+ if(arrey[C]==search_num){
+ return C;
+ }
+ }
+ return 0;
+}
\ No newline at end of file
--- /dev/null
+/*
+ System tools
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
+
+.file "systool.S"
+.intel_syntax noprefix
+.code32
+
+.global sys_cli, sys_sti, sys_hlt
+
+sys_cli:
+ cli
+ ret
+
+sys_sti:
+ sti
+ ret
+
+sys_hlt:
+ hlt
+ ret
+
+subset_tool_out8:
+ MOV EDX,[ESP+4]
+ MOV AL,[ESP+8]
+ OUT DX,AL
+ RET
+
+subset_tool_in8:
+ MOV EDX,[ESP+4]
+ MOV EAX,0
+ IN AL,DX
+ RET
\ No newline at end of file
--- /dev/null
+#Tools Makefile
+#Target
+TARGET = "libvga.a"
+
+# Define
+CC = gcc
+AS = gcc
+AR = ar
+
+CFLAG = -m32 -ffreestanding -fno-common -masm=intel -nostdlib -fno-builtin -fomit-frame-pointer -O2 -c
+AFLAG = -m32 -ffreestanding -fno-common -fno-builtin -fomit-frame-pointer -O2 -c
+
+ARFLAG = -rcs
+
+INCLUDE = -I${INCDIR}
+
+#Dir
+INCDIR = ../../include
+
+.S.o:
+ ${AS} ${INCLUDE} ${AFLAG} $<
+
+.c.o:
+ ${CC} ${INCLUDE} ${CFLAG} $<
+
+TEXT_C = text.c
+SUB_S = subset.S
+
+VGA_OBJ = ${TEXT_C:.c=.o} ${SUB_S:.S=.o}
+
+vga:${VGA_OBJ}
+ ${AR} ${ARFLAG} ${TARGET} ${VGA_OBJ}
\ No newline at end of file
--- /dev/null
+/*
+ IO Functions for VGA Manager
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
+
+.file "subset.S"
+.intel_syntax noprefix
+.code32
+
+.global subset_out8
+
+subset_out8:
+ MOV EDX,[ESP+4]
+ MOV AL,[ESP+8]
+ OUT DX,AL
+ RET
\ No newline at end of file
--- /dev/null
+/*
+ VGA Text Manager
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
+
+#include<sysvga.h>
+#include<types.h>
+
+static unsigned short *ch_vram;
+static unsigned short X,Y,pos;
+static unsigned char attr;
+
+enum VGA_PORTS{
+ CRTC_ADDR = 0x3D4,
+ CRTC_DATA = 0x3D5
+};
+
+enum CGTC_REGS{
+ CRTC_CURSOR_H = 0x0E,
+ CRTC_CURSOR_L = 0x0F
+};
+
+void init_sysvga(void)
+{
+ ch_vram=(unsigned short*)0xb8000;
+ X=0; Y=0; pos=0;
+ DisplayColorChangeChar(White,Black);
+}
+
+void ClearScreen(void)
+{
+ ch_vram=(unsigned short*)0xb8000;
+ X=0;Y=0;
+ while(ch_vram<(unsigned short*)0xc0000)
+ {
+ *ch_vram++ =NULL;
+ }
+ ch_vram=(unsigned short*)0xb8000;
+
+ vga_text_update_cursor();
+
+ return;
+}
+
+void vga_text_update_cursor(void)
+{
+ pos=(Y*80)+X;
+ subset_out8(CRTC_ADDR, CRTC_CURSOR_H);
+ subset_out8(CRTC_DATA, pos >> 8 );
+ subset_out8(CRTC_ADDR, CRTC_CURSOR_L);
+ subset_out8(CRTC_DATA, pos & 0xFF );
+}
+
+void DisplayOutputChar(const char ch)
+{
+ if(ch=='\n'){
+ if(Y<25){
+ ch_vram+=(80-X);
+ X=0;
+ Y++;
+ pos=Y*80;
+ }else{
+ ShiftDisplayChar(1);
+ ch_vram+=(80-X);
+ pos=Y*80;
+ X=0;
+ }
+ }else if(ch=='\r'){
+ ch_vram-=X;
+ X=0;
+
+ }else if(ch=='\t'){
+ DisplayOutputChar(' ');
+ DisplayOutputChar(' ');
+
+ }else{
+ *ch_vram++ = (((attr)<<8) | ch);
+
+ }
+}
+
+void ShiftDisplayChar(unsigned int len)
+{
+ unsigned int *sc1,*sc2;
+ sc1=0xb8000; sc2=0xb8000+(80*2);
+ while(sc2<=0xc0000)*sc1++ = *sc2++;
+ if(len>1){
+ len--;
+ ShiftDisplayChar(len);
+ }
+}
+
+void DisplayColorChangeChar(Color_t fore, Color_t back)
+{
+ attr |= (back<<4) | (fore & 0x0f);
+}
\ No newline at end of file