OSDN Git Service

基本機能完成 master
authorVOSystems <vosystems@user.sourceforge.jp>
Thu, 26 Feb 2015 07:46:11 +0000 (16:46 +0900)
committerVOSystems <vosystems@user.sourceforge.jp>
Thu, 26 Feb 2015 07:46:11 +0000 (16:46 +0900)
44 files changed:
release/full_pkg/libosdk.a [new file with mode: 0644]
release/full_pkg/osdk.tar.gz [new file with mode: 0644]
release/single_pkg/include/sysio.h [new file with mode: 0644]
release/single_pkg/include/syskbd.h [new file with mode: 0644]
release/single_pkg/include/sysvga.h [new file with mode: 0644]
release/single_pkg/include/tools.h [new file with mode: 0644]
release/single_pkg/include/types.h [new file with mode: 0644]
release/single_pkg/lib/libio.a [new file with mode: 0644]
release/single_pkg/lib/libosdk.a [new file with mode: 0644]
release/single_pkg/lib/libtools.a [new file with mode: 0644]
release/single_pkg/lib/libvga.a [new file with mode: 0644]
src/Makefile [new file with mode: 0644]
src/include/sysio.h
src/include/syskbd.h [new file with mode: 0644]
src/include/sysvga.h
src/include/tools.h
src/include/types.h
src/includek/sysio.h [new file with mode: 0644]
src/includek/syskbd.h [new file with mode: 0644]
src/includek/sysvga.h [new file with mode: 0644]
src/includek/tools.h [new file with mode: 0644]
src/includek/types.h [new file with mode: 0644]
src/lib/io/Makefile [new file with mode: 0644]
src/lib/io/in.S [new file with mode: 0644]
src/lib/io/in.o [new file with mode: 0644]
src/lib/io/libio.a [new file with mode: 0644]
src/lib/io/out.S [new file with mode: 0644]
src/lib/io/out.o [new file with mode: 0644]
src/lib/text.c [deleted file]
src/lib/tools/Makefile [new file with mode: 0644]
src/lib/tools/beep.c [new file with mode: 0644]
src/lib/tools/beep.o [new file with mode: 0644]
src/lib/tools/libtools.a [new file with mode: 0644]
src/lib/tools/linersearch.c [new file with mode: 0644]
src/lib/tools/linersearch.o [new file with mode: 0644]
src/lib/tools/systool.S [new file with mode: 0644]
src/lib/tools/systool.o [new file with mode: 0644]
src/lib/vga/Makefile [new file with mode: 0644]
src/lib/vga/libvga.a [new file with mode: 0644]
src/lib/vga/subset.S [new file with mode: 0644]
src/lib/vga/subset.o [new file with mode: 0644]
src/lib/vga/text.c [new file with mode: 0644]
src/lib/vga/text.o [new file with mode: 0644]
src/libosdk.a [new file with mode: 0644]

diff --git a/release/full_pkg/libosdk.a b/release/full_pkg/libosdk.a
new file mode 100644 (file)
index 0000000..7ee5bf3
Binary files /dev/null and b/release/full_pkg/libosdk.a differ
diff --git a/release/full_pkg/osdk.tar.gz b/release/full_pkg/osdk.tar.gz
new file mode 100644 (file)
index 0000000..b5905f9
Binary files /dev/null and b/release/full_pkg/osdk.tar.gz differ
diff --git a/release/single_pkg/include/sysio.h b/release/single_pkg/include/sysio.h
new file mode 100644 (file)
index 0000000..1d63150
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ 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
diff --git a/release/single_pkg/include/syskbd.h b/release/single_pkg/include/syskbd.h
new file mode 100644 (file)
index 0000000..17c3b25
--- /dev/null
@@ -0,0 +1,5 @@
+/*
+ Key Board Manager
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
\ No newline at end of file
diff --git a/release/single_pkg/include/sysvga.h b/release/single_pkg/include/sysvga.h
new file mode 100644 (file)
index 0000000..11cdf15
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ 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
diff --git a/release/single_pkg/include/tools.h b/release/single_pkg/include/tools.h
new file mode 100644 (file)
index 0000000..9fe1a99
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ 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
diff --git a/release/single_pkg/include/types.h b/release/single_pkg/include/types.h
new file mode 100644 (file)
index 0000000..b244c72
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ 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
diff --git a/release/single_pkg/lib/libio.a b/release/single_pkg/lib/libio.a
new file mode 100644 (file)
index 0000000..fbf2de6
Binary files /dev/null and b/release/single_pkg/lib/libio.a differ
diff --git a/release/single_pkg/lib/libosdk.a b/release/single_pkg/lib/libosdk.a
new file mode 100644 (file)
index 0000000..7ee5bf3
Binary files /dev/null and b/release/single_pkg/lib/libosdk.a differ
diff --git a/release/single_pkg/lib/libtools.a b/release/single_pkg/lib/libtools.a
new file mode 100644 (file)
index 0000000..aab3558
Binary files /dev/null and b/release/single_pkg/lib/libtools.a differ
diff --git a/release/single_pkg/lib/libvga.a b/release/single_pkg/lib/libvga.a
new file mode 100644 (file)
index 0000000..475af0f
Binary files /dev/null and b/release/single_pkg/lib/libvga.a differ
diff --git a/src/Makefile b/src/Makefile
new file mode 100644 (file)
index 0000000..f5279f2
--- /dev/null
@@ -0,0 +1,67 @@
+#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
index ecf1286..1d63150 100644 (file)
@@ -1,4 +1,18 @@
 /*
  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
diff --git a/src/include/syskbd.h b/src/include/syskbd.h
new file mode 100644 (file)
index 0000000..17c3b25
--- /dev/null
@@ -0,0 +1,5 @@
+/*
+ Key Board Manager
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
\ No newline at end of file
index 0181e32..11cdf15 100644 (file)
@@ -1,4 +1,36 @@
 /*
  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
index 99c4dd2..9fe1a99 100644 (file)
@@ -1,4 +1,20 @@
 /*
  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
index 2c76edb..b244c72 100644 (file)
@@ -1,10 +1,11 @@
 /*
  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;
diff --git a/src/includek/sysio.h b/src/includek/sysio.h
new file mode 100644 (file)
index 0000000..1d63150
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ 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
diff --git a/src/includek/syskbd.h b/src/includek/syskbd.h
new file mode 100644 (file)
index 0000000..17c3b25
--- /dev/null
@@ -0,0 +1,5 @@
+/*
+ Key Board Manager
+ (C) 2015 OS-DK.
+ (C) 2015 VOSystems.
+*/
\ No newline at end of file
diff --git a/src/includek/sysvga.h b/src/includek/sysvga.h
new file mode 100644 (file)
index 0000000..11cdf15
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ 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
diff --git a/src/includek/tools.h b/src/includek/tools.h
new file mode 100644 (file)
index 0000000..9fe1a99
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ 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
diff --git a/src/includek/types.h b/src/includek/types.h
new file mode 100644 (file)
index 0000000..b244c72
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ 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
diff --git a/src/lib/io/Makefile b/src/lib/io/Makefile
new file mode 100644 (file)
index 0000000..3dfc21c
--- /dev/null
@@ -0,0 +1,32 @@
+#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
diff --git a/src/lib/io/in.S b/src/lib/io/in.S
new file mode 100644 (file)
index 0000000..9e59d7a
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ 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
diff --git a/src/lib/io/in.o b/src/lib/io/in.o
new file mode 100644 (file)
index 0000000..4c719f5
Binary files /dev/null and b/src/lib/io/in.o differ
diff --git a/src/lib/io/libio.a b/src/lib/io/libio.a
new file mode 100644 (file)
index 0000000..fbf2de6
Binary files /dev/null and b/src/lib/io/libio.a differ
diff --git a/src/lib/io/out.S b/src/lib/io/out.S
new file mode 100644 (file)
index 0000000..a50eefe
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ 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
diff --git a/src/lib/io/out.o b/src/lib/io/out.o
new file mode 100644 (file)
index 0000000..49ee1e6
Binary files /dev/null and b/src/lib/io/out.o differ
diff --git a/src/lib/text.c b/src/lib/text.c
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/src/lib/tools/Makefile b/src/lib/tools/Makefile
new file mode 100644 (file)
index 0000000..b147d5e
--- /dev/null
@@ -0,0 +1,33 @@
+#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
diff --git a/src/lib/tools/beep.c b/src/lib/tools/beep.c
new file mode 100644 (file)
index 0000000..5a19c2a
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ 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
diff --git a/src/lib/tools/beep.o b/src/lib/tools/beep.o
new file mode 100644 (file)
index 0000000..1a8b8b7
Binary files /dev/null and b/src/lib/tools/beep.o differ
diff --git a/src/lib/tools/libtools.a b/src/lib/tools/libtools.a
new file mode 100644 (file)
index 0000000..aab3558
Binary files /dev/null and b/src/lib/tools/libtools.a differ
diff --git a/src/lib/tools/linersearch.c b/src/lib/tools/linersearch.c
new file mode 100644 (file)
index 0000000..534a629
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ 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
diff --git a/src/lib/tools/linersearch.o b/src/lib/tools/linersearch.o
new file mode 100644 (file)
index 0000000..2d65fc9
Binary files /dev/null and b/src/lib/tools/linersearch.o differ
diff --git a/src/lib/tools/systool.S b/src/lib/tools/systool.S
new file mode 100644 (file)
index 0000000..1c46c98
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ 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
diff --git a/src/lib/tools/systool.o b/src/lib/tools/systool.o
new file mode 100644 (file)
index 0000000..4943477
Binary files /dev/null and b/src/lib/tools/systool.o differ
diff --git a/src/lib/vga/Makefile b/src/lib/vga/Makefile
new file mode 100644 (file)
index 0000000..ad72ef3
--- /dev/null
@@ -0,0 +1,32 @@
+#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
diff --git a/src/lib/vga/libvga.a b/src/lib/vga/libvga.a
new file mode 100644 (file)
index 0000000..475af0f
Binary files /dev/null and b/src/lib/vga/libvga.a differ
diff --git a/src/lib/vga/subset.S b/src/lib/vga/subset.S
new file mode 100644 (file)
index 0000000..1f9d05e
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ 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
diff --git a/src/lib/vga/subset.o b/src/lib/vga/subset.o
new file mode 100644 (file)
index 0000000..be06f79
Binary files /dev/null and b/src/lib/vga/subset.o differ
diff --git a/src/lib/vga/text.c b/src/lib/vga/text.c
new file mode 100644 (file)
index 0000000..523aab1
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ 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
diff --git a/src/lib/vga/text.o b/src/lib/vga/text.o
new file mode 100644 (file)
index 0000000..af061e0
Binary files /dev/null and b/src/lib/vga/text.o differ
diff --git a/src/libosdk.a b/src/libosdk.a
new file mode 100644 (file)
index 0000000..bbbb32c
Binary files /dev/null and b/src/libosdk.a differ