OSDN Git Service

First Commit
authorvosystems <doradora.motochan@gmail.com>
Sat, 11 Oct 2014 04:29:37 +0000 (13:29 +0900)
committervosystems <doradora.motochan@gmail.com>
Sat, 11 Oct 2014 04:29:37 +0000 (13:29 +0900)
75 files changed:
BIN_HISTORY/2014.09.23.vsb [new file with mode: 0644]
BIN_HISTORY/2014.09.24.vsb [new file with mode: 0644]
BIN_HISTORY/2014.09.25.vsb [new file with mode: 0644]
BIN_HISTORY/2014.09.27.vsb [new file with mode: 0644]
BIN_HISTORY/2014.09.29.vsb [new file with mode: 0644]
BIN_HISTORY/2014.09.29_R2.vsb [new file with mode: 0644]
BIN_HISTORY/2014.09.30.vsb [new file with mode: 0644]
BIN_HISTORY/2014.10.04.vsb [new file with mode: 0644]
BIN_HISTORY/Kernel.vsb [new file with mode: 0644]
Console_Shell/main.c [new file with mode: 0644]
Drivers/Makefile [new file with mode: 0644]
Drivers/Makefile~ [new file with mode: 0644]
Kernel.vsb [new file with mode: 0644]
Kernel/ASM_Interrupt.S [new file with mode: 0644]
Kernel/ASM_Interrupt.o [new file with mode: 0644]
Kernel/FAT.c [new file with mode: 0644]
Kernel/FAT.c~ [new file with mode: 0644]
Kernel/FAT.o [new file with mode: 0644]
Kernel/GDT_IDT.c [new file with mode: 0644]
Kernel/GDT_IDT.o [new file with mode: 0644]
Kernel/Interrupt.c [new file with mode: 0644]
Kernel/Interrupt.o [new file with mode: 0644]
Kernel/Kernel.vsb [new file with mode: 0755]
Kernel/KeyBoard.c [new file with mode: 0644]
Kernel/KeyBoard.o [new file with mode: 0644]
Kernel/Makefile [new file with mode: 0644]
Kernel/MakefileORG [new file with mode: 0644]
Kernel/Vane.S [new file with mode: 0644]
Kernel/Vane.S~ [new file with mode: 0644]
Kernel/Vane.o [new file with mode: 0644]
Kernel/boot.c [new file with mode: 0644]
Kernel/boot.c~ [new file with mode: 0644]
Kernel/boot.o [new file with mode: 0644]
Kernel/fifo.c [new file with mode: 0644]
Kernel/linkerscript [new file with mode: 0644]
Kernel/load.S [new file with mode: 0644]
Kernel/load.S~ [new file with mode: 0644]
Kernel/load.o [new file with mode: 0644]
Kernel/memory.c [new file with mode: 0644]
Kernel/memory.o [new file with mode: 0644]
Kernel/scancode.c [new file with mode: 0644]
Kernel/scancode.o [new file with mode: 0644]
Kernel/stdio.c [new file with mode: 0644]
Kernel/stdio.o [new file with mode: 0644]
Kernel/string.c [new file with mode: 0644]
Kernel/string.o [new file with mode: 0644]
Makefile [new file with mode: 0644]
bu/boot.c [new file with mode: 0644]
bu/load.S [new file with mode: 0644]
bu/multiboot.h [new file with mode: 0644]
include/GDT_IDT.h [new file with mode: 0644]
include/GDT_IDT.h~ [new file with mode: 0644]
include/Interrupt.h [new file with mode: 0644]
include/Interrupt.h~ [new file with mode: 0644]
include/KeyBoard.h [new file with mode: 0644]
include/KeyBoard.h~ [new file with mode: 0644]
include/VaneOS.h [new file with mode: 0644]
include/VaneOS.h~ [new file with mode: 0644]
include/iostream~ [new file with mode: 0644]
include/memory.h [new file with mode: 0644]
include/memory.h~ [new file with mode: 0644]
include/multiboot.h [new file with mode: 0644]
include/multiboot.h~ [new file with mode: 0644]
include/scancode.h [new file with mode: 0644]
include/scancode.h~ [new file with mode: 0644]
include/stdarg.h [new file with mode: 0644]
include/stdarg.h~ [new file with mode: 0644]
include/stdio.c~ [new file with mode: 0644]
include/stdio.h [new file with mode: 0644]
include/stdio.h~ [new file with mode: 0644]
include/stdiohari.h~ [new file with mode: 0644]
include/string.h [new file with mode: 0644]
include/string.h~ [new file with mode: 0644]
lib/libvanec.a [new file with mode: 0644]
lib/libvanego.a [new file with mode: 0644]

diff --git a/BIN_HISTORY/2014.09.23.vsb b/BIN_HISTORY/2014.09.23.vsb
new file mode 100644 (file)
index 0000000..0b8688f
Binary files /dev/null and b/BIN_HISTORY/2014.09.23.vsb differ
diff --git a/BIN_HISTORY/2014.09.24.vsb b/BIN_HISTORY/2014.09.24.vsb
new file mode 100644 (file)
index 0000000..e029ee4
Binary files /dev/null and b/BIN_HISTORY/2014.09.24.vsb differ
diff --git a/BIN_HISTORY/2014.09.25.vsb b/BIN_HISTORY/2014.09.25.vsb
new file mode 100644 (file)
index 0000000..6ce1b20
Binary files /dev/null and b/BIN_HISTORY/2014.09.25.vsb differ
diff --git a/BIN_HISTORY/2014.09.27.vsb b/BIN_HISTORY/2014.09.27.vsb
new file mode 100644 (file)
index 0000000..96d9453
Binary files /dev/null and b/BIN_HISTORY/2014.09.27.vsb differ
diff --git a/BIN_HISTORY/2014.09.29.vsb b/BIN_HISTORY/2014.09.29.vsb
new file mode 100644 (file)
index 0000000..8b76df0
Binary files /dev/null and b/BIN_HISTORY/2014.09.29.vsb differ
diff --git a/BIN_HISTORY/2014.09.29_R2.vsb b/BIN_HISTORY/2014.09.29_R2.vsb
new file mode 100644 (file)
index 0000000..79c8681
Binary files /dev/null and b/BIN_HISTORY/2014.09.29_R2.vsb differ
diff --git a/BIN_HISTORY/2014.09.30.vsb b/BIN_HISTORY/2014.09.30.vsb
new file mode 100644 (file)
index 0000000..1ffd345
Binary files /dev/null and b/BIN_HISTORY/2014.09.30.vsb differ
diff --git a/BIN_HISTORY/2014.10.04.vsb b/BIN_HISTORY/2014.10.04.vsb
new file mode 100644 (file)
index 0000000..79f883e
Binary files /dev/null and b/BIN_HISTORY/2014.10.04.vsb differ
diff --git a/BIN_HISTORY/Kernel.vsb b/BIN_HISTORY/Kernel.vsb
new file mode 100644 (file)
index 0000000..6ab3cee
Binary files /dev/null and b/BIN_HISTORY/Kernel.vsb differ
diff --git a/Console_Shell/main.c b/Console_Shell/main.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/Drivers/Makefile b/Drivers/Makefile
new file mode 100644 (file)
index 0000000..4e8a3e4
--- /dev/null
@@ -0,0 +1,34 @@
+TARGET      = Kernel.vsb
+
+#宣言
+CC                     = gcc
+RM                     = /bin/rm
+MV                     = /bin/mv
+LD                     = /usr/bin/ld
+LN_S                   = ln -s
+AR                     = /usr/bin/ar
+RANLIB         = ranlib
+INCLUDES           = -I../include
+FLAGS          = -m32 -ffreestanding -fno-common -fno-builtin -fomit-frame-pointer -O2 -c
+FLAGSC         = -m32 -ffreestanding -fno-common -masm=intel -fno-builtin -fomit-frame-pointer -O2 -c
+LD          = ld  -melf_i386  -Ttext=0x100000 --oformat elf32-i386 -o
+
+#サフィックス
+.S.o:
+       ${CC} ${INCLUDES} ${FLAGS} $<
+.c.o:
+       ${CC} ${INCLUDES} ${FLAGSC} $<
+       
+#ソースコード
+
+
+#オブジェクト
+
+Drivers: ${BOOT_OBJ}
+       #${LD} ${TARGET} ${BOOT_OBJ}
+       @echo "No File In This Directory"
+
+${BOOT_OBJ}: ${BOOT_SRC}
+clean::
+       -${RM}  -f *~ *.lo *.o make.log *.bak .a.out .core .*.core
+
diff --git a/Drivers/Makefile~ b/Drivers/Makefile~
new file mode 100644 (file)
index 0000000..6a81bb4
--- /dev/null
@@ -0,0 +1,34 @@
+TARGET      = Kernel.vsb
+
+#宣言
+CC                     = gcc
+RM                     = /bin/rm
+MV                     = /bin/mv
+LD                     = /usr/bin/ld
+LN_S                   = ln -s
+AR                     = /usr/bin/ar
+RANLIB         = ranlib
+INCLUDES           = -I../include
+FLAGS          = -m32 -ffreestanding -fno-common -fno-builtin -fomit-frame-pointer -O2 -c
+FLAGSC         = -m32 -ffreestanding -fno-common -masm=intel -fno-builtin -fomit-frame-pointer -O2 -c
+LD          = ld  -melf_i386  -Ttext=0x100000 --oformat elf32-i386 -o
+
+#サフィックス
+.S.o:
+       ${CC} ${INCLUDES} ${FLAGS} $<
+.c.o:
+       ${CC} ${INCLUDES} ${FLAGSC} $<
+       
+#ソースコード
+
+
+#オブジェクト
+
+Drivers: ${BOOT_OBJ}
+       #${LD} ${TARGET} ${BOOT_OBJ}
+       echo "No File In This Directory"
+
+${BOOT_OBJ}: ${BOOT_SRC}
+clean::
+       -${RM}  -f *~ *.lo *.o make.log *.bak .a.out .core .*.core
+
diff --git a/Kernel.vsb b/Kernel.vsb
new file mode 100644 (file)
index 0000000..6168573
Binary files /dev/null and b/Kernel.vsb differ
diff --git a/Kernel/ASM_Interrupt.S b/Kernel/ASM_Interrupt.S
new file mode 100644 (file)
index 0000000..7df11f0
--- /dev/null
@@ -0,0 +1,73 @@
+.file "ASM_Interrupt.S"
+.code32
+.text
+.intel_syntax noprefix
+
+.global KeyBoard_Interrupt_asm,Timer_Interrupt_asm,INTERRUPT_NOTHING
+
+INTERRUPT_NOTHING:
+       cli
+       
+       pushad  
+       push    ds
+       push    es
+       push    fs
+       push    gs
+
+       pop     gs
+       pop     fs
+       pop     es
+       pop     ds
+       popad
+       
+       sti
+       
+       iret
+
+KeyBoard_Interrupt_asm:
+       cli
+       
+       pushad
+       push ds
+       push es
+       push fs
+       push gs
+       
+       call keyboard_interrupt
+       
+       mov al,0x20
+       out 0x20,al
+       
+       pop gs
+       pop fs
+       pop es
+       pop ds
+       popad
+       
+       sti
+       
+       iret
+       
+Timer_Interrupt_asm:
+       cli
+       
+       pushad
+       push ds
+       push es
+       push fs
+       push gs
+       
+       call timer_interrupt
+       
+       mov al,0x20
+       out 0x20,al
+       
+       pop gs
+       pop fs
+       pop es
+       pop ds
+       popad
+       
+       sti
+       
+       iret
diff --git a/Kernel/ASM_Interrupt.o b/Kernel/ASM_Interrupt.o
new file mode 100644 (file)
index 0000000..719191f
Binary files /dev/null and b/Kernel/ASM_Interrupt.o differ
diff --git a/Kernel/FAT.c b/Kernel/FAT.c
new file mode 100644 (file)
index 0000000..d09020f
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+
+*/
+#include<VaneOS.h>
+
+unsigned char* file_readBPB(void)
+{
+       unsigned char *BPB,*BPB_source=(unsigned char*)(BPB_SECTOR*SECTOR_SIZE);
+       int C=0;
+       for(C=0;C<0x52;C++)
+       {
+               BPB[C]=BPB_source[C];
+       }
+       return BPB;
+}
+
+void generate_bpb(bpb_data_t* bpb,const unsigned char* source)
+{
+       int c=0;
+       for(c=0;c<3;c++)
+               bpb->bootstrap_code[c]=*source++;
+       for(c=0;c<8;c++)
+               bpb->label[c]=*source++;
+       bpb->sector_byte=EX_CHAR_SHORT(source);
+       bpb->clust_sector=*source++;
+       bpb->reserved_sector=EX_CHAR_SHORT(source);
+       bpb->fat=*source++;
+}
+/*
+0x11   ルートディレクトリエントリ数 (FAT32 では 0)     2
+0x13   全セクタ数 (FAT32 では 0)        2
+0x15   メディアコード   1
+0x16   FAT のセクタ数     2
+0x18   1 トラックあたりのセクタ数  2
+0x1a   ドライブのヘッド数     2
+0x1c   不可視セクタ数   4
+0x20   全セクタ数 4
+0x24   FAT 1 つあたりのセクタ数       4
+0x28   フラグ       2
+0x2a   ファイルシステムバージョン 2
+0x2c   ルートディレクトリの開始クラスタ番号  4
+0x30   ファイルシステム情報のセクタ番号        2
+0x32   バックアップセクタ番号       2
+0x34   予約  12
+0x40   物理ドライブ番号        1
+0x41   予約  1
+0x42   ブートシグネチャ        1
+0x43   ボリュームシリアル ID  4
+0x47   ボリュームラベル        11
+0x52   ファイルシステムタイプ       8
+*/
+void file_readfat(int *fat,unsigned char *img,unsigned int sector)
+{
+       int i,j=0;
+       for(i=0;i<sector;i+=2)
+       {
+               fat[i+0]=(img[j+0] | img[j+1]<<8) & 0xfff;
+               fat[i+1]=(img[j+1]>>4 | img[j+2]<<4) & 0xfff;
+               j+=3;
+       }
+       return;
+}
+
+void file_loadfile(int clustno,int size,char* buf,int* fat,char* img)
+{
+       int i;
+       while(1)
+       {
+               if(size<=512)
+               {
+                       for(i=0;i<size;i++)
+                       {
+                               buf[i]=img[clustno*512+i];
+                       }
+                       break;
+               }
+               for(i=0;i<512;i++)
+               {
+                       buf[i]=img[clustno*512+i];
+               }
+               size-=512;
+               buf+=512;
+               clustno=fat[clustno];
+       }
+       return;
+}
diff --git a/Kernel/FAT.c~ b/Kernel/FAT.c~
new file mode 100644 (file)
index 0000000..de795b4
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+
+*/
+#include<VaneOS.h>
+
+unsigned char* file_readBPB(void)
+{
+       unsigned char *BPB,*BPB_source=(unsigned char*)BPB_SECTOR*SECTOR_SIZE;
+       int C=0;
+       for(C=0;C<0x52;C++)
+       {
+               BPB[C]=BPB_source[C];
+       }
+       return BPB;
+}
+
+void generate_bpb(bpb_data_t* bpb,const unsigned char* source)
+{
+       int c=0;
+       for(c=0;c<3;c++)
+               bpb->bootstrap_code[c]=*source++;
+       for(c=0;c<8;c++)
+               bpb->label[c]=*source++;
+       bpb->sector_byte=EX_CHAR_SHORT(source);
+       bpb->clust_sector=*source++;
+       bpb->reserved_sector=EX_CHAR_SHORT(source);
+       bpb->fat=*source++;
+}
+/*
+0x11   ルートディレクトリエントリ数 (FAT32 では 0)     2
+0x13   全セクタ数 (FAT32 では 0)        2
+0x15   メディアコード   1
+0x16   FAT のセクタ数     2
+0x18   1 トラックあたりのセクタ数  2
+0x1a   ドライブのヘッド数     2
+0x1c   不可視セクタ数   4
+0x20   全セクタ数 4
+0x24   FAT 1 つあたりのセクタ数       4
+0x28   フラグ       2
+0x2a   ファイルシステムバージョン 2
+0x2c   ルートディレクトリの開始クラスタ番号  4
+0x30   ファイルシステム情報のセクタ番号        2
+0x32   バックアップセクタ番号       2
+0x34   予約  12
+0x40   物理ドライブ番号        1
+0x41   予約  1
+0x42   ブートシグネチャ        1
+0x43   ボリュームシリアル ID  4
+0x47   ボリュームラベル        11
+0x52   ファイルシステムタイプ       8
+*/
+void file_readfat(int *fat,unsigned char *img,unsigned int sector)
+{
+       int i,j=0;
+       for(i=0;i<sector;i+=2)
+       {
+               fat[i+0]=(img[j+0] | img[j+1]<<8) & 0xfff;
+               fat[i+1]=(img[j+1]>>4 | img[j+2]<<4) & 0xfff;
+               j+=3;
+       }
+       return;
+}
+
+void file_loadfile(int clustno,int size,char* buf,int* fat,char* img)
+{
+       int i;
+       while(1)
+       {
+               if(size<=512)
+               {
+                       for(i=0;i<size;i++)
+                       {
+                               buf[i]=img[clustno*512+i];
+                       }
+                       break;
+               }
+               for(i=0;i<512;i++)
+               {
+                       buf[i]=img[clustno*512+i];
+               }
+               size-=512;
+               buf+=512;
+               clustno=fat[clustno];
+       }
+       return;
+}
diff --git a/Kernel/FAT.o b/Kernel/FAT.o
new file mode 100644 (file)
index 0000000..465757e
Binary files /dev/null and b/Kernel/FAT.o differ
diff --git a/Kernel/GDT_IDT.c b/Kernel/GDT_IDT.c
new file mode 100644 (file)
index 0000000..0619c33
--- /dev/null
@@ -0,0 +1,42 @@
+#include<VaneOS.h>
+#include<GDT_IDT.h>
+
+IDTR idtr;
+GATE_DESCRIPTOR        idt[ NUM_IDT ];
+SEGMENT_DESCRIPTOR     gdt[ NUM_GDT ];
+GDTR gdtr;
+
+void setupInterruptGate( int int_num, void *interrupt_handler )
+{
+       setupGateDescriptor( int_num,
+               ( int )interrupt_handler,
+               DEF_IDT_INT_SELECTOR,
+               DEF_IDT_FLAGS_PRESENT | DEF_IDT_FLAGS_INTGATE_32BIT );
+}
+
+void setupGateDescriptor( int int_num,int base,unsigned short selector,unsigned char flags )
+{
+       idt[ int_num ].baseLo   = ( unsigned short )(   base & 0x0000FFFF );
+       idt[ int_num ].selector = selector;
+       idt[ int_num ].reserved = 0x00;
+       idt[ int_num ].flags    = flags;
+       idt[ int_num ].baseHi   = ( unsigned short )( ( base & 0xFFFF0000 ) >> 16 );
+}
+
+void load_gdt(void)
+{
+    __asm__ __volatile__ ( "lgdt gdtr" );
+    __asm__ __volatile__ ( "mov %ax, 0x10" );
+    __asm__ __volatile__ ( "mov %ds, %ax" );
+    __asm__ __volatile__ ( "mov %es, %ax" );
+    __asm__ __volatile__ ( "mov %fs, %ax" );
+    __asm__ __volatile__ ( "mov %gs, %ax" );
+    __asm__ __volatile__ ( "mov %ss, %ax" );
+    
+    clear_state();
+}
+
+void load_idt(void)
+{
+       __asm__ __volatile__ ("lidt idtr");
+}
diff --git a/Kernel/GDT_IDT.o b/Kernel/GDT_IDT.o
new file mode 100644 (file)
index 0000000..116c62a
Binary files /dev/null and b/Kernel/GDT_IDT.o differ
diff --git a/Kernel/Interrupt.c b/Kernel/Interrupt.c
new file mode 100644 (file)
index 0000000..0640973
--- /dev/null
@@ -0,0 +1,35 @@
+/*!
+       Interrupt.c
+       Interrupt Handler and so on.
+       (C) 2014 VOSystems.
+*/
+
+#include<VaneOS.h>
+#include<KeyBoard.h>
+#include<Interrupt.h>
+#include<scancode.h>
+
+static volatile int timer_tick;
+int system_key_code_flag,break_flag;
+unsigned long long input;
+
+void timer_interrupt( void )
+{
+       /*count tick*/
+       timer_tick++;
+}
+
+void keyboard_interrupt( void )
+{
+       scan_code = readKbdEncBuffer();
+}
+
+inline void enable()
+{
+  __asm__ __volatile__ ("sti");
+}
+
+inline void disable()
+{
+  __asm__ __volatile__ ("cli");
+}
diff --git a/Kernel/Interrupt.o b/Kernel/Interrupt.o
new file mode 100644 (file)
index 0000000..e91dd56
Binary files /dev/null and b/Kernel/Interrupt.o differ
diff --git a/Kernel/Kernel.vsb b/Kernel/Kernel.vsb
new file mode 100755 (executable)
index 0000000..0fd907c
Binary files /dev/null and b/Kernel/Kernel.vsb differ
diff --git a/Kernel/KeyBoard.c b/Kernel/KeyBoard.c
new file mode 100644 (file)
index 0000000..18f930a
--- /dev/null
@@ -0,0 +1,179 @@
+/*!
+       KeyBoard.c
+       Keyboard functions without Interrupt Handler.
+       (C) 2014 VOSystems.
+*/
+
+#include<KeyBoard.h>
+
+int keyboard_disable;
+unsigned char scan_code;
+
+unsigned char readKbdCtrlStatus(void)
+{
+       return(inPortByte(DEF_PORT_KBD_CTRL_STATUS));
+}
+
+STATUS writeKbdCtrlCommand(unsigned char command)
+{
+       int retry;
+       
+       for(retry=0;retry<MAX_RETRY;++retry)
+       {
+               if((readKbdCtrlStatus() & DEF_KBD_STS_IBF)==0)
+               {
+                       outPortByte(DEF_PORT_KBD_CTRL_COMMAND,command);
+                       return DEF_KBD_OK;
+               }
+       }
+       return DEF_KBD_ERROR;
+}
+
+unsigned char readKbdEncBuffer(void)
+{
+       return(inPortByte(DEF_PORT_KBD_ENC_BUFFER));
+}
+
+STATUS writeKbdEncCommand(unsigned char command)
+{
+       int retry;
+       
+       for(retry=0;retry<MAX_RETRY;++retry)
+       {
+               if((readKbdCtrlStatus() & DEF_KBD_STS_IBF)==0)
+               {
+                       outPortByte(DEF_PORT_KBD_ENC_COMMAND,command);
+                       return DEF_KBD_OK;
+               }
+       }
+       return DEF_KBD_ERROR;
+}
+
+STATUS keyboardSetLED( E_KBD_LED led )
+{
+    unsigned char   wirte_data;
+    STATUS           status;
+       
+    /*if designated leds are unknow*/
+    if( ( E_KBD_SCROLL_LOCK_LED | E_KBD_NUM_LOCK_LED | E_KBD_CAPS_LOCK_LED ) < led)
+    {
+        return( DEF_KBD_ERROR );
+    }
+
+    status =  writeKbdEncCommand( DEF_KBD_ENC_COM_SETLED    );
+    status |= writeKbdEncCommand( ( unsigned char )led      );
+
+    return( status );
+}
+
+STATUS keyboardSelfTest( void )
+{
+    unsigned char enc_buffer;
+    STATUS        status;
+    
+    /* execute self test*/
+    status = writeKbdCtrlCommand( DEF_KBD_CTRL_COM_SELF_TEST );
+
+    if( DEF_KBD_OK != status )
+    {
+        return( status );
+    }
+
+    /*wait*/
+    status = waitKbdOutputBufferFull( );
+
+    if( DEF_KBD_OK != status )
+    {
+        return( status );
+    }
+
+    /*test result of self test*/
+    enc_buffer = readKbdEncBuffer( );
+
+    if( enc_buffer == DEF_KBD_CTRL_STS_SELF_TEST_OK )
+    {
+        return( status );
+    }
+
+    return( DEF_KBD_ERROR );
+}
+
+STATUS waitKbdOutputBufferFull( void )
+{
+    unsigned char kbd_status;
+    int           retry;
+
+    for( retry = 0 ; retry < MAX_RETRY ; retry++ )
+    {
+        kbd_status = readKbdCtrlStatus( );
+
+        if( ( kbd_status & DEF_KBD_STS_OBF ) == DEF_KBD_STS_OBF )
+        {
+            return( DEF_KBD_OK );
+        }
+    }
+
+    return( DEF_KBD_ERROR );
+}
+
+STATUS keyboardDisableKBD( void )
+{
+    /*disable a keyboard*/
+    STATUS status = writeKbdCtrlCommand( DEF_KBD_CTRL_COM_DISABLE_KBD );
+
+    if( DEF_KBD_OK != status ){
+        keyboard_disable = 0;
+        
+    }else{
+        keyboard_disable = 1;
+        
+    }
+
+    return( status );
+}
+
+STATUS keyboardEnableKBD( void )
+{
+    /*enable a keyboard*/
+    STATUS status = writeKbdCtrlCommand( DEF_KBD_CTRL_COM_ENABLE_KBD );
+
+    if( DEF_KBD_OK != status ){
+        keyboard_disable = 1;
+        
+    }else{
+        keyboard_disable = 0;
+        
+    }
+
+    return( status );
+}
+
+/*
+    Funtion     :initKeyboard
+    Input       :void
+    Output      :void
+    Return      :STATUS
+                 < status of initialization >
+
+    Description :initialize keyboard driver
+*/
+STATUS initKeyboard( void )
+{
+    STATUS status;
+       KEY_STATE key_state;
+    /*initialize keyboard management information*/
+    key_state.caps_on       = 0;
+    key_state.alt_on        = 0;
+    key_state.shift_on      = 0;
+    key_state.ctrl_on       = 0;
+    key_state.numlock_on    = 0;
+    key_state.scrolllock_on = 0;
+    key_state.insert_on     = 0;
+
+    scan_code               = 0x00;
+
+    /*set leds of keyboard off*/
+    status = keyboardSetLED( E_KBD_NONE_LED );
+    
+    return( status );
+}
diff --git a/Kernel/KeyBoard.o b/Kernel/KeyBoard.o
new file mode 100644 (file)
index 0000000..e6cc7fc
Binary files /dev/null and b/Kernel/KeyBoard.o differ
diff --git a/Kernel/Makefile b/Kernel/Makefile
new file mode 100644 (file)
index 0000000..b6115d8
--- /dev/null
@@ -0,0 +1,46 @@
+TARGET      = Kernel.vsb
+
+#宣言
+CC                     = gcc
+RM                     = /bin/rm
+MV                     = /bin/mv
+LD                     = /usr/bin/ld
+LN_S           = ln -s
+AR                     = /usr/bin/ar
+RANLIB         = ranlib
+INCLUDES    = -I../include
+LIBVANE                = ../lib/libvanec.a ../lib/libvanego.a
+FLAGS          = -m32 -ffreestanding -fno-common -fno-builtin -fomit-frame-pointer -O2 -c
+FLAGSC         = -m32 -ffreestanding -fno-common -nostdlib -masm=intel -fno-builtin -fomit-frame-pointer -O2 -c
+LD          = ld -Ttext 0x100000 -T linkerscript -melf_i386 --oformat elf32-i386 -o
+
+#サフィックス
+.S.o:
+       ${CC} ${INCLUDES} ${FLAGS} $<
+.c.o:
+       ${CC} ${INCLUDES} ${FLAGSC} $<
+       
+#ソースコード
+BOOT_C=boot.c
+BOOT_S=load.S
+VANE_S=Vane.S
+KEYBOARD_C=KeyBoard.c
+GDT_IDT_C=GDT_IDT.c
+INTERRUPT_C=Interrupt.c
+STDIO_C=stdio.c
+STRING_C=string.c
+ASM_INTERRUPT_S=ASM_Interrupt.S
+SCANCODE_C=scancode.c
+MEMMAN_C=memory.c
+FAT_C=FAT.c
+
+#オブジェクト
+BOOT_OBJ=${BOOT_S:.S=.o} ${BOOT_C:.c=.o} ${VANE_S:.S=.o} ${KEYBOARD_C:.c=.o} ${STDIO_C:.c=.o} ${GDT_IDT_C:.c=.o} ${INTERRUPT_C:.c=.o} ${STRING_C:.c=.o} ${ASM_INTERRUPT_S:.S=.o} ${SCANCODE_C:.c=.o} ${MEMMAN_C:.c=.o} ${FAT_C:.c=.o}
+
+kernel: ${BOOT_OBJ}
+       ${LD} ${TARGET} ${BOOT_OBJ}
+
+${BOOT_OBJ}: ${BOOT_SRC}
+clean::
+       -${RM}  -f *~ *.lo *.o make.log *.bak .a.out .core .*.core
+
diff --git a/Kernel/MakefileORG b/Kernel/MakefileORG
new file mode 100644 (file)
index 0000000..d9f95e9
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Vane Operating System  Makefile by VOSystems
+#--------------------------------------------//
+
+TARGET      = Kernel.vsb
+#INTTARGET     =bin/INT.vsb
+
+#宣言
+CC                     = gcc
+RM                     = /bin/rm
+MV                     = /bin/mv
+LD                     = /usr/bin/ld
+LN_S           = ln -s
+AR                     = /usr/bin/ar
+RANLIB         = ranlib
+INCLUDES    = -I./include
+FLAGS          = -m32 -ffreestanding -fno-common -fno-builtin -fomit-frame-pointer -O2 -c
+FLAGSC         = -m32 -ffreestanding -fno-common -masm=intel -fno-builtin -fomit-frame-pointer -O2 -c
+LD          = ld  -melf_i386  -Ttext=0x100000 --oformat elf32-i386 -o
+#LDAPP         = ld -melf_i386 -Ttext=0x280000 --oformat elf32-i386 -o
+
+#サフィックス
+.S.o:
+       ${CC} ${INCLUDES} ${FLAGS} $<
+.c.o:
+       ${CC} ${INCLUDES} ${FLAGSC} $<
+
+#ソースコード
+BOOT_C=boot.c
+BOOT_S=load.S
+VANE_S=Vane.S
+KEYBOARD_C=KeyBoard.c
+STDIO_C=stdio.c
+
+#STDIO_C=stdio.c
+BIN=Kernel.vsb
+
+#INT_C=int.c
+
+#オブジェクト
+BOOT_OBJ=${BOOT_S:.S=.o} ${BOOT_C:.c=.o} ${VANE_S:.S=.o} ${KEYBOARD_C:.c=.o} ${STDIO_C:.c=.o}
+INT_OBJ=${INT_C:.=.o}
+
+#処理
+copy:
+       cp /media/DATA/OS/OS/Kernel.vsb /media/VaneOS/Vane/Kernel.vsb
+all:
+       make vane
+       make copy
+
+vane: ${BOOT_OBJ}
+       ${LD} ${TARGET} ${BOOT_OBJ}
+       #${LDAPP} ${INTTARGET} ${INT_OBJ}
+
+${BOOT_OBJ}: ${BOOT_SRC}
+clean::
+       -${RM}  -f *~ *.lo *.o make.log *.bak .a.out .core .*.core
+
diff --git a/Kernel/Vane.S b/Kernel/Vane.S
new file mode 100644 (file)
index 0000000..b5fd419
--- /dev/null
@@ -0,0 +1,38 @@
+.file "Vane.S"
+.code32
+.text
+.intel_syntax noprefix
+
+.global clear_state,asm_move_cursol,hlt
+
+hlt:
+       HLT
+       RET
+
+clear_state:
+       jmp 0x08:_flush_seg
+       RET
+
+_flush_seg:
+       RET
+       
+asm_move_cursol:
+       PUSH BP
+       PUSH AX
+       
+       MOV AX,BP
+       MOV DX,0x03D4
+       MOV AL,0X0E
+       
+       OUT DX,AX
+       
+       POP AX
+       
+       MOV AH,AL
+       MOV AL,0x0F
+       
+       OUT DX,AX
+       
+       MOV EAX,0
+       
+       RET
diff --git a/Kernel/Vane.S~ b/Kernel/Vane.S~
new file mode 100644 (file)
index 0000000..b5fd419
--- /dev/null
@@ -0,0 +1,38 @@
+.file "Vane.S"
+.code32
+.text
+.intel_syntax noprefix
+
+.global clear_state,asm_move_cursol,hlt
+
+hlt:
+       HLT
+       RET
+
+clear_state:
+       jmp 0x08:_flush_seg
+       RET
+
+_flush_seg:
+       RET
+       
+asm_move_cursol:
+       PUSH BP
+       PUSH AX
+       
+       MOV AX,BP
+       MOV DX,0x03D4
+       MOV AL,0X0E
+       
+       OUT DX,AX
+       
+       POP AX
+       
+       MOV AH,AL
+       MOV AL,0x0F
+       
+       OUT DX,AX
+       
+       MOV EAX,0
+       
+       RET
diff --git a/Kernel/Vane.o b/Kernel/Vane.o
new file mode 100644 (file)
index 0000000..8287a2a
Binary files /dev/null and b/Kernel/Vane.o differ
diff --git a/Kernel/boot.c b/Kernel/boot.c
new file mode 100644 (file)
index 0000000..c0aac95
--- /dev/null
@@ -0,0 +1,213 @@
+/*!
+       \file boot.c
+       \Desc Kernel and Setting.
+       (C) 2014 VOSystems.
+*/
+
+#include<multiboot.h>
+#include<VaneOS.h>
+#include<KeyBoard.h>
+#include<Interrupt.h>
+#include<GDT_IDT.h>
+#include<stdio.h>
+#include<scancode.h>
+#include<memory.h>
+
+/*PROTOTYPE*/
+void outPortByte( unsigned short address, unsigned char value );
+unsigned char inPortByte( unsigned short address );
+void initPIC( void );
+int setPitCounter( int freq, unsigned char counter, unsigned char mode );
+void initPit( void );
+void clear_state(void);
+void hlt(void);
+
+/*!
+       load.S call this function
+       
+       Set All & Call shell
+       (C)2014 VOSystems.
+       \create 2014/09/23
+       \update 2014/09/27
+       \author 2m
+*/
+void cstart(unsigned long magic, unsigned long addr)
+{
+       /*Common Settings*/
+       char cmd[100]={0};
+       struct MEMMAN *memman=(struct MEMMAN*)MEMMAN_ADDR;
+       multiboot_info_t *mbi;
+       drive_info *drv;
+       
+       mbi = (multiboot_info_t *) addr;
+               
+       ClearScreen();
+       scan_code=0; break_flag=0;      system_key_code_flag=0;
+       screen=(unsigned short*)0xb8000;//VRam Setting
+       attr=WHITE;
+       
+       /*Start Set Main Code*/
+       printf("VOSystems Vane Operating System  [Version 0.2(build 300)]\n");
+       
+       /*Setting IDT*/
+       setupInterruptGate(DEF_IDT_INT_NUM_IRQ1,KeyBoard_Interrupt_asm);//Register Keyboard interrupt handler
+       setupInterruptGate(DEF_IDT_INT_NUM_IRQ0,Timer_Interrupt_asm);//Register Timer interrupt handler
+       idtr.size       = NUM_IDT * sizeof( GATE_DESCRIPTOR );
+       idtr.base       = ( GATE_DESCRIPTOR *)idt;
+       
+       load_idt();
+       printOK("Setting IDT.....");
+       
+       /*Setting GDT*/
+       /*set up null descriptor*/
+       gdt[NULL_DESCRIPTOR].limitLo    = DEF_GDT_NULL_LIMIT;
+       gdt[NULL_DESCRIPTOR].baseLo             = DEF_GDT_NULL_BASELO;
+       gdt[NULL_DESCRIPTOR].baseMid    = DEF_GDT_NULL_BASEMID;
+       gdt[NULL_DESCRIPTOR].flags              = DEF_GDT_NULL_FLAGS;
+       gdt[NULL_DESCRIPTOR].baseHi             = DEF_GDT_NULL_BASEHI;
+       /* set up code descriptor */
+       gdt[CODE_DESCRIPTOR].limitLo    = DEF_GDT_CODE_LIMIT;
+       gdt[CODE_DESCRIPTOR].baseLo             = DEF_GDT_CODE_BASELO;
+       gdt[CODE_DESCRIPTOR].baseMid    = DEF_GDT_CODE_BASEMID;
+       gdt[CODE_DESCRIPTOR].flags              = DEF_GDT_CODE_FLAGS;
+       gdt[CODE_DESCRIPTOR].baseHi             = DEF_GDT_CODE_BASEHI;
+
+       /* set up data descriptor */
+       gdt[DATA_DESCRIPTOR].limitLo    = DEF_GDT_DATA_LIMIT;
+       gdt[DATA_DESCRIPTOR].baseLo             = DEF_GDT_DATA_BASELO;
+       gdt[DATA_DESCRIPTOR].baseMid    = DEF_GDT_DATA_BASEMID;
+       gdt[DATA_DESCRIPTOR].flags              = DEF_GDT_DATA_FLAGS;
+       gdt[DATA_DESCRIPTOR].baseHi             = DEF_GDT_DATA_BASEHI;
+       
+       gdtr.size       = NUM_GDT * sizeof( SEGMENT_DESCRIPTOR );
+       gdtr.base       = ( SEGMENT_DESCRIPTOR *)gdt;
+       
+       load_gdt();
+       printOK("Setting GDT.....");
+               
+       initPIC();
+       printOK("Init PIC.....");
+       
+       initKeyboard();
+       keyboardEnableKBD();
+       printOK("Init Keyboard.....");
+       
+       setPitCounter(100,DEF_PIT_COM_COUNTER0,DEF_PIT_COM_MODE_SQUAREWAVE);
+       initPit();
+       printOK("Init PIT.....");
+       
+       memman_init(memman);
+       memman_free(memman,0x00001000,0x0009e000);
+       memman_free(memman,0x00400000,((mbi->mem_lower+mbi->mem_upper)*1024)-0x00400000);
+       printOK("Starting Memory Manager.....");
+       
+       unsigned char* BPB=file_readBPB();
+       bpb_data_t* bpb;
+       generate_bpb(bpb);
+       
+       printf("label -> %s\n",bpb->label);
+       
+       int* fat=(int*)memman_alloc_4k(memman,4*2880);
+       file_readfat(fat,(unsigned char*)(ADR_DISKIMG+FAT_DISK_PLASE),drv->drive_sectors);
+       printOK("Loading FAT File System.....");
+       
+       if(magic!=MULTIBOOT_BOOTLOADER_MAGIC){
+               printFAIL("Loading Memory Info.....");
+               
+       }else{
+               printOK("Loading Memory Info.....");
+               
+       }
+       printf("\n~Memory Information~\nLowMemory = %d KiB , UpperMemory = %d KiB , TotalMemory = %d MiB\n\n",mbi->mem_lower,
+               mbi->mem_upper,(mbi->mem_lower+mbi->mem_upper+1024)/1024);
+       
+       printf("Free Memory = %d MiB\n\n",memman_total(memman)/(1024*1024));
+       
+       puts("KernelShell/Root/>");
+       scanf("%s",&cmd);
+       printf("%s",cmd);
+       if(strcmp(cmd,"halt")==0)return;
+       while(1)hlt();
+       return;
+}
+
+void outPortByte( unsigned short address, unsigned char value )
+{
+       __asm__ __volatile__( "out %%dx, %%al" : : "d"(address), "a"(value) );
+}
+
+unsigned char inPortByte( unsigned short address )
+{
+       unsigned char data;
+
+       __asm__ __volatile__( "mov %%dx, %%ax" : : "a"(address) );
+       __asm__ __volatile__( "in %al, %dx" );
+       __asm__ __volatile__( "mov %%bl, %%al" : "=b"(data) );
+       return( data );
+}
+
+void initPIC( void )
+{
+       disable();
+       
+       outPortByte( PORT_MASTER_PIC_COMMAND,   PIC_ICW1        );
+       outPortByte( PORT_SLAVE_PIC_COMMAND,    PIC_ICW1        );
+
+       outPortByte( PORT_MASTER_PIC_DATA,      PIC_MASTER_ICW2 );
+       outPortByte( PORT_SLAVE_PIC_DATA,       PIC_SLAVE_ICW2  );
+
+       outPortByte( PORT_MASTER_PIC_DATA,      PIC_MASTER_ICW3 );
+       outPortByte( PORT_SLAVE_PIC_DATA,       PIC_SLAVE_ICW3  );
+
+       outPortByte( PORT_MASTER_PIC_DATA,      PIC_MASTER_ICW4 );
+       outPortByte( PORT_SLAVE_PIC_DATA,       PIC_SLAVE_ICW4  );
+       
+       outPortByte( PORT_MASTER_PIC_IMR, (~PIC_IMR_MASK_IRQ0) & (~PIC_IMR_MASK_IRQ2 )  );
+       outPortByte( PORT_SLAVE_PIC_IMR, PIC_IMR_MASK_IRQ_ALL                           );
+       
+    outPortByte( PORT_MASTER_PIC_IMR, ( ~PIC_IMR_MASK_IRQ0 )
+                 & ( ~PIC_IMR_MASK_IRQ1 ) & ( ~PIC_IMR_MASK_IRQ2 ) );
+    outPortByte( PORT_SLAVE_PIC_IMR, PIC_IMR_MASK_IRQ_ALL          );
+    
+    enable();
+}
+
+int setPitCounter( int freq, unsigned char counter, unsigned char mode )
+{
+       unsigned short  count;
+       unsigned char   command;
+
+       /* --------------------------------------------------------------------- */
+       /*      calculate frequency                                              */
+       /* --------------------------------------------------------------------- */
+       count = ( unsigned short )( DEF_PIT_CLOCK / freq );
+
+       /* --------------------------------------------------------------------- */
+       /*      make initial command                                             */
+       /* --------------------------------------------------------------------- */
+       command = mode | DEF_PIT_COM_RL_DATA | counter;
+
+       outPortByte( PIT_REG_CONTROL, command );
+
+       /* --------------------------------------------------------------------- */
+       /*      send counter value                                               */
+       /* --------------------------------------------------------------------- */
+       outPortByte( PIT_REG_COUNTER0, ( unsigned char )( count & 0xFF          ) );
+       outPortByte( PIT_REG_COUNTER0, ( unsigned char )( ( count >> 8 ) & 0xFF ) );
+}
+
+/*
+       Funtion     :initPit
+       Input       :void
+       Output      :void
+       Return      :void 
+
+       Description :initialize pic
+*/
+void initPit( void )
+{
+       /* --------------------------------------------------------------------- */
+       /*      set counter0 100Hz                                               */
+       /* --------------------------------------------------------------------- */
+       setPitCounter( 100, DEF_PIT_COM_COUNTER0,  DEF_PIT_COM_MODE_SQUAREWAVE );
+}
diff --git a/Kernel/boot.c~ b/Kernel/boot.c~
new file mode 100644 (file)
index 0000000..f1b17d0
--- /dev/null
@@ -0,0 +1,213 @@
+/*!
+       \file boot.c
+       \Desc Kernel and Setting.
+       (C) 2014 VOSystems.
+*/
+
+#include<multiboot.h>
+#include<VaneOS.h>
+#include<KeyBoard.h>
+#include<Interrupt.h>
+#include<GDT_IDT.h>
+#include<stdio.h>
+#include<scancode.h>
+#include<memory.h>
+
+/*PROTOTYPE*/
+void outPortByte( unsigned short address, unsigned char value );
+unsigned char inPortByte( unsigned short address );
+void initPIC( void );
+int setPitCounter( int freq, unsigned char counter, unsigned char mode );
+void initPit( void );
+void clear_state(void);
+void hlt(void);
+
+/*!
+       load.S call this function
+       
+       Set All & Call shell
+       (C)2014 VOSystems.
+       \create 2014/09/23
+       \update 2014/09/27
+       \author 2m
+*/
+void cstart(unsigned long magic, unsigned long addr)
+{
+       /*Common Settings*/
+       char cmd[100]={0};
+       struct MEMMAN *memman=(struct MEMMAN*)MEMMAN_ADDR;
+       multiboot_info_t *mbi;
+       drive_info *drv;
+       
+       mbi = (multiboot_info_t *) addr;
+               
+       ClearScreen();
+       scan_code=0; break_flag=0;      system_key_code_flag=0;
+       screen=(unsigned short*)0xb8000;//VRam Setting
+       attr=WHITE;
+       
+       /*Start Set Main Code*/
+       printf("VOSystems Vane Operating System  [Version 0.2(build 300)]\n");
+       
+       /*Setting IDT*/
+       setupInterruptGate(DEF_IDT_INT_NUM_IRQ1,KeyBoard_Interrupt_asm);//Register Keyboard interrupt handler
+       setupInterruptGate(DEF_IDT_INT_NUM_IRQ0,Timer_Interrupt_asm);//Register Timer interrupt handler
+       idtr.size       = NUM_IDT * sizeof( GATE_DESCRIPTOR );
+       idtr.base       = ( GATE_DESCRIPTOR *)idt;
+       
+       load_idt();
+       printOK("Setting IDT.....");
+       
+       /*Setting GDT*/
+       /*set up null descriptor*/
+       gdt[NULL_DESCRIPTOR].limitLo    = DEF_GDT_NULL_LIMIT;
+       gdt[NULL_DESCRIPTOR].baseLo             = DEF_GDT_NULL_BASELO;
+       gdt[NULL_DESCRIPTOR].baseMid    = DEF_GDT_NULL_BASEMID;
+       gdt[NULL_DESCRIPTOR].flags              = DEF_GDT_NULL_FLAGS;
+       gdt[NULL_DESCRIPTOR].baseHi             = DEF_GDT_NULL_BASEHI;
+       /* set up code descriptor */
+       gdt[CODE_DESCRIPTOR].limitLo    = DEF_GDT_CODE_LIMIT;
+       gdt[CODE_DESCRIPTOR].baseLo             = DEF_GDT_CODE_BASELO;
+       gdt[CODE_DESCRIPTOR].baseMid    = DEF_GDT_CODE_BASEMID;
+       gdt[CODE_DESCRIPTOR].flags              = DEF_GDT_CODE_FLAGS;
+       gdt[CODE_DESCRIPTOR].baseHi             = DEF_GDT_CODE_BASEHI;
+
+       /* set up data descriptor */
+       gdt[DATA_DESCRIPTOR].limitLo    = DEF_GDT_DATA_LIMIT;
+       gdt[DATA_DESCRIPTOR].baseLo             = DEF_GDT_DATA_BASELO;
+       gdt[DATA_DESCRIPTOR].baseMid    = DEF_GDT_DATA_BASEMID;
+       gdt[DATA_DESCRIPTOR].flags              = DEF_GDT_DATA_FLAGS;
+       gdt[DATA_DESCRIPTOR].baseHi             = DEF_GDT_DATA_BASEHI;
+       
+       gdtr.size       = NUM_GDT * sizeof( SEGMENT_DESCRIPTOR );
+       gdtr.base       = ( SEGMENT_DESCRIPTOR *)gdt;
+       
+       load_gdt();
+       printOK("Setting GDT.....");
+               
+       initPIC();
+       printOK("Init PIC.....");
+       
+       initKeyboard();
+       keyboardEnableKBD();
+       printOK("Init Keyboard.....");
+       
+       setPitCounter(100,DEF_PIT_COM_COUNTER0,DEF_PIT_COM_MODE_SQUAREWAVE);
+       initPit();
+       printOK("Init PIT.....");
+       
+       memman_init(memman);
+       memman_free(memman,0x00001000,0x0009e000);
+       memman_free(memman,0x00400000,((mbi->mem_lower+mbi->mem_upper)*1024)-0x00400000);
+       printOK("Starting Memory Manager.....");
+       
+       unsigned char* BPB=file_readBPB();
+       bpb_data_t* bpb;
+       generate_bpb(bpb);
+       
+       printf("label -> %s\n",bpb->label);
+       
+       int* fat=(int*)memman_alloc_4k(memman,4*2880);
+       file_readfat(fat,(unsigned char*)(ADR_DISKIMG+FAT_DISK_PLACE),drv->drive_sectors);
+       printOK("Loading FAT File System.....");
+       
+       if(magic!=MULTIBOOT_BOOTLOADER_MAGIC){
+               printFAIL("Loading Memory Info.....");
+               
+       }else{
+               printOK("Loading Memory Info.....");
+               
+       }
+       printf("\n~Memory Information~\nLowMemory = %d KiB , UpperMemory = %d KiB , TotalMemory = %d MiB\n\n",mbi->mem_lower,
+               mbi->mem_upper,(mbi->mem_lower+mbi->mem_upper+1024)/1024);
+       
+       printf("Free Memory = %d MiB\n\n",memman_total(memman)/(1024*1024));
+       
+       puts("KernelShell/Root/>");
+       scanf("%s",&cmd);
+       printf("%s",cmd);
+       if(strcmp(cmd,"halt")==0)return;
+       while(1)hlt();
+       return;
+}
+
+void outPortByte( unsigned short address, unsigned char value )
+{
+       __asm__ __volatile__( "out %%dx, %%al" : : "d"(address), "a"(value) );
+}
+
+unsigned char inPortByte( unsigned short address )
+{
+       unsigned char data;
+
+       __asm__ __volatile__( "mov %%dx, %%ax" : : "a"(address) );
+       __asm__ __volatile__( "in %al, %dx" );
+       __asm__ __volatile__( "mov %%bl, %%al" : "=b"(data) );
+       return( data );
+}
+
+void initPIC( void )
+{
+       disable();
+       
+       outPortByte( PORT_MASTER_PIC_COMMAND,   PIC_ICW1        );
+       outPortByte( PORT_SLAVE_PIC_COMMAND,    PIC_ICW1        );
+
+       outPortByte( PORT_MASTER_PIC_DATA,      PIC_MASTER_ICW2 );
+       outPortByte( PORT_SLAVE_PIC_DATA,       PIC_SLAVE_ICW2  );
+
+       outPortByte( PORT_MASTER_PIC_DATA,      PIC_MASTER_ICW3 );
+       outPortByte( PORT_SLAVE_PIC_DATA,       PIC_SLAVE_ICW3  );
+
+       outPortByte( PORT_MASTER_PIC_DATA,      PIC_MASTER_ICW4 );
+       outPortByte( PORT_SLAVE_PIC_DATA,       PIC_SLAVE_ICW4  );
+       
+       outPortByte( PORT_MASTER_PIC_IMR, (~PIC_IMR_MASK_IRQ0) & (~PIC_IMR_MASK_IRQ2 )  );
+       outPortByte( PORT_SLAVE_PIC_IMR, PIC_IMR_MASK_IRQ_ALL                           );
+       
+    outPortByte( PORT_MASTER_PIC_IMR, ( ~PIC_IMR_MASK_IRQ0 )
+                 & ( ~PIC_IMR_MASK_IRQ1 ) & ( ~PIC_IMR_MASK_IRQ2 ) );
+    outPortByte( PORT_SLAVE_PIC_IMR, PIC_IMR_MASK_IRQ_ALL          );
+    
+    enable();
+}
+
+int setPitCounter( int freq, unsigned char counter, unsigned char mode )
+{
+       unsigned short  count;
+       unsigned char   command;
+
+       /* --------------------------------------------------------------------- */
+       /*      calculate frequency                                              */
+       /* --------------------------------------------------------------------- */
+       count = ( unsigned short )( DEF_PIT_CLOCK / freq );
+
+       /* --------------------------------------------------------------------- */
+       /*      make initial command                                             */
+       /* --------------------------------------------------------------------- */
+       command = mode | DEF_PIT_COM_RL_DATA | counter;
+
+       outPortByte( PIT_REG_CONTROL, command );
+
+       /* --------------------------------------------------------------------- */
+       /*      send counter value                                               */
+       /* --------------------------------------------------------------------- */
+       outPortByte( PIT_REG_COUNTER0, ( unsigned char )( count & 0xFF          ) );
+       outPortByte( PIT_REG_COUNTER0, ( unsigned char )( ( count >> 8 ) & 0xFF ) );
+}
+
+/*
+       Funtion     :initPit
+       Input       :void
+       Output      :void
+       Return      :void 
+
+       Description :initialize pic
+*/
+void initPit( void )
+{
+       /* --------------------------------------------------------------------- */
+       /*      set counter0 100Hz                                               */
+       /* --------------------------------------------------------------------- */
+       setPitCounter( 100, DEF_PIT_COM_COUNTER0,  DEF_PIT_COM_MODE_SQUAREWAVE );
+}
diff --git a/Kernel/boot.o b/Kernel/boot.o
new file mode 100644 (file)
index 0000000..a0338ff
Binary files /dev/null and b/Kernel/boot.o differ
diff --git a/Kernel/fifo.c b/Kernel/fifo.c
new file mode 100644 (file)
index 0000000..0048246
--- /dev/null
@@ -0,0 +1,55 @@
+#include <VaneOS.h>
+
+#define FLAGS_OVERRUN          0x0001
+
+void fifo32_init(struct FIFO32 *fifo, int size, int *buf, struct TASK *task)
+{
+       fifo->size = size;
+       fifo->buf = buf;
+       fifo->free = size;
+       fifo->flags = 0;
+       fifo->p = 0;
+       fifo->q = 0;
+       fifo->task = task;
+       return;
+}
+
+int fifo32_put(struct FIFO32 *fifo, int data)
+{
+       if (fifo->free == 0) {
+               fifo->flags |= FLAGS_OVERRUN;
+               return -1;
+       }
+       fifo->buf[fifo->p] = data;
+       fifo->p++;
+       if (fifo->p == fifo->size) {
+               fifo->p = 0;
+       }
+       fifo->free--;
+       if (fifo->task != 0) {
+               if (fifo->task->flags != 2) {
+                       task_run(fifo->task, -1, 0);
+               }
+       }
+       return 0;
+}
+
+int fifo32_get(struct FIFO32 *fifo)
+{
+       int data;
+       if (fifo->free == fifo->size) {
+               return -1;
+       }
+       data = fifo->buf[fifo->q];
+       fifo->q++;
+       if (fifo->q == fifo->size) {
+               fifo->q = 0;
+       }
+       fifo->free++;
+       return data;
+}
+
+int fifo32_status(struct FIFO32 *fifo)
+{
+       return fifo->size - fifo->free;
+}
diff --git a/Kernel/linkerscript b/Kernel/linkerscript
new file mode 100644 (file)
index 0000000..303a1dc
--- /dev/null
@@ -0,0 +1,31 @@
+SECTIONS
+{
+       
+       .text :
+       {
+               _text_start = .;
+               *(.text)
+               _text_end = .;
+       }
+       
+       .rodata :
+       {
+               _rodata_start = .;
+               *(.rodata)
+               _rodata_end = .;
+       }
+       
+       .data :
+       {
+               _data_start = .;
+               *(.data)
+               _data_end = .;
+       }
+       
+       .bss :
+       {
+               _bss_start = .;
+               *(.bss)
+               _bss_end = .;
+       }
+}
diff --git a/Kernel/load.S b/Kernel/load.S
new file mode 100644 (file)
index 0000000..e89a902
--- /dev/null
@@ -0,0 +1,96 @@
+/* boot.S - bootstrap the kernel */
+/* Copyright (C) 1999, 2001  Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#define ASM_FILE       1
+#include <multiboot.h>
+
+/* C symbol format. HAVE_ASM_USCORE is defined by configure.  */
+#ifdef HAVE_ASM_USCORE
+# define EXT_C(sym)                    _ ## sym
+#else
+# define EXT_C(sym)                    sym
+#endif
+
+/* The size of our stack (16KB).  */
+#define STACK_SIZE                     0x4000
+
+/* The flags for the Multiboot header.  */
+#ifdef __ELF__
+# define MULTIBOOT_HEADER_FLAGS                0x00000003
+#else
+# define MULTIBOOT_HEADER_FLAGS                0x00010003
+#endif
+       
+       .text
+
+       .globl  start, _start
+start:
+_start:
+       jmp     multiboot_entry
+
+       /* Align 32 bits boundary.  */
+       .align  4
+
+       /* Multiboot header.  */
+multiboot_header:
+       /* magic */
+       .long   MULTIBOOT_HEADER_MAGIC
+       /* flags */
+       .long   MULTIBOOT_HEADER_FLAGS
+       /* checksum */
+       .long   -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
+#ifndef __ELF__
+       /* header_addr */
+       .long   multiboot_header
+       /* load_addr */
+       .long   _start
+       /* load_end_addr */
+       .long   _edata
+       /* bss_end_addr */
+       .long   _end
+       /* entry_addr */
+       .long   multiboot_entry
+#endif /* ! __ELF__ */
+
+multiboot_entry:
+       /* Initialize the stack pointer.  */
+       movl    $(stack + STACK_SIZE), %esp
+
+       /* Reset EFLAGS.  */
+       pushl   $0
+       popf
+
+       /* Push the pointer to the Multiboot information structure.  */
+       pushl   %ebx
+       /* Push the magic value.  */
+       pushl   %eax
+
+       /* Now enter the C main function...  */
+       call    EXT_C(cstart)
+       RET
+       /* Halt.  */
+       pushl   $halt_message
+       call    EXT_C(printf)
+       
+loop:  hlt
+       jmp     loop
+
+halt_message:
+       .asciz  "Halted."
+
+       /* Our stack area.  */
+       .comm   stack, STACK_SIZE
diff --git a/Kernel/load.S~ b/Kernel/load.S~
new file mode 100644 (file)
index 0000000..45bdcd9
--- /dev/null
@@ -0,0 +1,96 @@
+/* boot.S - bootstrap the kernel */
+/* Copyright (C) 1999, 2001  Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#define ASM_FILE       1
+#include <multiboot.h>
+
+/* C symbol format. HAVE_ASM_USCORE is defined by configure.  */
+#ifdef HAVE_ASM_USCORE
+# define EXT_C(sym)                    _ ## sym
+#else
+# define EXT_C(sym)                    sym
+#endif
+
+/* The size of our stack (16KB).  */
+#define STACK_SIZE                     0x4000
+
+/* The flags for the Multiboot header.  */
+#ifdef __ELF__
+# define MULTIBOOT_HEADER_FLAGS                0x00000003
+#else
+# define MULTIBOOT_HEADER_FLAGS                0x00010003
+#endif
+       
+       .text
+
+       .globl  start, _start
+start:
+_start:
+       jmp     multiboot_entry
+
+       /* Align 32 bits boundary.  */
+       .align  4
+
+       /* Multiboot header.  */
+multiboot_header:
+       /* magic */
+       .long   MULTIBOOT_HEADER_MAGIC
+       /* flags */
+       .long   MULTIBOOT_HEADER_FLAGS
+       /* checksum */
+       .long   -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
+#ifndef __ELF__
+       /* header_addr */
+       .long   multiboot_header
+       /* load_addr */
+       .long   _start
+       /* load_end_addr */
+       .long   _edata
+       /* bss_end_addr */
+       .long   _end
+       /* entry_addr */
+       .long   multiboot_entry
+#endif /* ! __ELF__ */
+
+multiboot_entry:
+       /* Initialize the stack pointer.  */
+       movl    $(stack + STACK_SIZE), %esp
+
+       /* Reset EFLAGS.  */
+       pushl   $0
+       popf
+
+       /* Push the pointer to the Multiboot information structure.  */
+       pushl   %ebx
+       /* Push the magic value.  */
+       pushl   %eax
+
+       /* Now enter the C main function...  */
+       call    EXT_C(cstart)
+
+       /* Halt.  */
+       pushl   $halt_message
+       call    EXT_C(printf)
+       
+loop:  hlt
+       jmp     loop
+
+halt_message:
+       .asciz  "Halted."
+
+       /* Our stack area.  */
+       .comm   stack, STACK_SIZE
diff --git a/Kernel/load.o b/Kernel/load.o
new file mode 100644 (file)
index 0000000..dc385b1
Binary files /dev/null and b/Kernel/load.o differ
diff --git a/Kernel/memory.c b/Kernel/memory.c
new file mode 100644 (file)
index 0000000..a39c24c
--- /dev/null
@@ -0,0 +1,123 @@
+#include<memory.h>
+
+void memman_init(struct MEMMAN *man)
+{
+       man->frees=0;
+       man->maxfrees=0;
+       man->lostsize=0;
+       man->losts=0;
+       
+       return;
+}
+
+unsigned int memman_total(struct MEMMAN *man)
+{
+       unsigned int i,t=0;
+       for(i=0;i<man->frees;i++)
+       {
+               t+=man->free[i].size;
+       }
+       return t;
+}
+
+unsigned int memman_alloc(struct MEMMAN *man,unsigned int size)
+{
+       unsigned int i,a;
+       for(i=0;i<man->frees;i++)
+       {
+               if(man->free[i].size>=size)
+               {
+                       a=man->free[i].addr;
+                       man->free[i].addr+=size;
+                       man->free[i].size-=size;
+                       if(man->free[i].size==0)
+                       {
+                               man->frees--;
+                               for(;i<man->frees;i++)
+                               {
+                                       man->free[i]=man->free[i+1];
+                               }
+                       }
+                       return a;
+               }
+       }
+       return 0;
+}
+
+int memman_free(struct MEMMAN *man,unsigned int addr,unsigned int size)
+{
+       int i,j;
+       for(i=0;i<man->frees;i++)
+       {
+               if(man->free[i].addr>addr)
+               {
+                       break;
+               }
+       }
+       
+       if(i>0)
+       {
+               if(man->free[i-1].addr+man->free[i-1].size==addr)
+               {
+                       man->free[i-1].size+=size;
+                       if(i<man->frees)
+                       {
+                               if(addr+size==man->free[i].addr)
+                               {
+                                       man->free[i-1].size+=man->free[i].size;
+                                       man->frees--;
+                                       for(;i<man->frees;i++)
+                                       {
+                                               man->free[i]=man->free[i+1];
+                                       }
+                               }
+                       }
+                       return 0;/*Successfully*/
+               }
+       }
+       /*FAIL Operation*/
+       if(i<man->frees)
+       {
+               if(addr+size==man->free[i].addr)
+               {
+                       man->free[i].addr=addr;
+                       man->free[i].size+=size;
+                       return 0;/*Successfully*/
+               }
+       }
+       /*FAIL Operation ~2~*/
+       if(man->frees<MEMMAN_FREES)
+       {
+               for(j=man->frees;j>i;j++)
+               {
+                       man->free[j]=man->free[j-1];
+               }
+               man->frees++;
+               if(man->maxfrees<man->frees)
+               {
+                       man->maxfrees=man->frees;
+               }
+               man->free[i].addr=addr;
+               man->free[i].size=size;
+               return 0;/*Successfully*/
+       }
+       man->losts++;
+       man->lostsize+=size;
+       return -1;/*FAIL*/
+}
+
+unsigned int memman_alloc_4k(struct MEMMAN* man,unsigned int size)
+{
+       unsigned int a;
+       size=(size+0xfff) & 0xfffff0000;
+       a=memman_alloc(man,size);
+       return a;
+}
+
+int memman_free_4k(struct MEMMAN* man,unsigned int addr,unsigned int size)
+{
+       int i;
+       size=(size+0xfff) & 0xfffff000;
+       i=memman_free(man,addr,size);
+       return i;
+}
diff --git a/Kernel/memory.o b/Kernel/memory.o
new file mode 100644 (file)
index 0000000..9e13e86
Binary files /dev/null and b/Kernel/memory.o differ
diff --git a/Kernel/scancode.c b/Kernel/scancode.c
new file mode 100644 (file)
index 0000000..da5e35a
--- /dev/null
@@ -0,0 +1,456 @@
+#include<scancode.h>
+#include<KeyBoard.h>
+#include<stdio.h>
+
+int shift_flag;
+
+char Generate_Scancode_To_ASCII_Code(void)
+{
+       unsigned char scode=scan_code;
+       scan_code=0;
+       
+       if(scode==SC_LEFT_SHIFT || scode==SC_RIGHT_SHIFT){
+               shift_flag=1;
+       }else if((shift_flag==1 && scode==BREAK_NORMAL(SC_LEFT_SHIFT)) || (shift_flag==1 && scode==BREAK_NORMAL(SC_LEFT_SHIFT))){
+               shift_flag=0;
+       }
+       if(SC_A==scode){
+               if(shift_flag==0){
+                       return'a';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'A';
+               }
+       }else if(SC_B==scode){
+               if(shift_flag==0){
+                       return'b';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'B';
+               }
+       }else if(SC_C==scode){
+               if(shift_flag==0){
+                       return'c';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'C';
+               }
+       }else if(SC_D==scode){
+               if(shift_flag==0){
+                       return'd';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'D';
+               }
+       }else if(SC_E==scode){
+               if(shift_flag==0){
+                       return'e';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'E';
+               }
+       }else if(SC_F==scode){
+               if(shift_flag==0){
+                       return'f';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'F';
+               }
+       }else if(SC_G==scode){
+               if(shift_flag==0){
+                       return'g';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'G';
+               }
+       }else if(SC_H==scode){
+               if(shift_flag==0){
+                       return'h';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'H';
+               }
+       }else if(SC_I==scode){
+               if(shift_flag==0){
+                       return'i';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'I';
+               }
+       }else if(SC_J==scode){
+               if(shift_flag==0){
+                       return'j';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'J';
+               }
+       }else if(SC_K==scode){
+               if(shift_flag==0){
+                       return'k';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'K';
+               }
+       }else if(SC_L==scode){
+               if(shift_flag==0){
+                       return'l';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'L';
+               }
+       }else if(SC_M==scode){
+               if(shift_flag==0){
+                       return'm';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'M';
+               }
+       }else if(SC_N==scode){
+               if(shift_flag==0){
+                       return'n';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'N';
+               }
+       }else if(SC_O==scode){
+               if(shift_flag==0){
+                       return'o';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'O';
+               }
+       }else if(SC_P==scode){
+               if(shift_flag==0){
+                       return'p';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'P';
+               }
+       }else if(SC_Q==scode){
+               if(shift_flag==0){
+                       return'q';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'Q';
+               }
+       }else if(SC_R==scode){
+               if(shift_flag==0){
+                       return'r';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'R';
+               }
+       }else if(SC_S==scode){
+               if(shift_flag==0){
+                       return's';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'S';
+               }
+       }else if(SC_T==scode){
+               if(shift_flag==0){
+                       return't';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'T';
+               }
+       }else if(SC_U==scode){
+               if(shift_flag==0){
+                       return'u';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'U';
+               }
+       }else if(SC_V==scode){
+               if(shift_flag==0){
+                       return'v';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'V';
+               }
+       }else if(SC_W==scode){
+               if(shift_flag==0){
+                       return'w';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'W';
+               }
+       }else if(SC_X==scode){
+               if(shift_flag==0){
+                       return'x';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'X';
+               }
+       }else if(SC_Y==scode){
+               if(shift_flag==0){
+                       return'y';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'Y';
+               }
+       }else if(SC_Z==scode){
+       if(shift_flag==0){
+                       return'z';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'Z';
+               }
+       }else if(SC_0==scode){
+               if(shift_flag==0){
+                       return'0';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'~';
+               }
+       }else if(SC_1==scode){
+               if(shift_flag==0){
+                       return'1';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'!';
+               }
+       }else if(SC_2==scode){
+               if(shift_flag==0){
+                       return'2';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'\"';
+               }
+       }else if(SC_3==scode){
+               if(shift_flag==0){
+                       return'3';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'#';
+               }
+       }else if(SC_4==scode){
+               if(shift_flag==0){
+                       return'4';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'$';
+               }
+       }else if(SC_5==scode){
+               if(shift_flag==0){
+                       return'5';
+               }else if(break_flag=1){
+                       
+               }else{
+                       return'%';
+               }
+       }else if(SC_6==scode){
+               if(shift_flag==0){
+                       return'6';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'&';
+               }
+       }else if(SC_7==scode){
+               if(shift_flag==0){
+                       return'7';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'\'';
+               }
+       }else if(SC_8==scode){
+               if(shift_flag==0){
+                       return'8';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'(';
+               }
+       }else if(SC_9==scode){
+               if(shift_flag==0){
+                       return'9';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return')';
+               }
+       }else if(SC_ECOAL==scode){
+               if(shift_flag==0){
+                       return'-';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'=';
+               }
+       }else if(SC_TILDA==scode){
+               if(shift_flag==0){
+                       return'^';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'~';
+               }
+       }else if(SC_YEN==scode){
+               if(shift_flag==0){
+                       return'\\';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'|';
+               }
+       }else if(SC_GAUS_RIGHT==scode){
+               if(shift_flag==0){
+                       return']';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'}';
+               }
+       }else if(SC_ENTER==scode){
+               if(break_flag!=1)return'\n';
+               
+       }else if(SC_AT_MARK==scode){
+               if(shift_flag==0){
+                       return'@';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'`';
+               }
+       }else if(MAKE_LR_SHIFT_AND_DEL==scode){
+               return 0x7f;
+               
+       }else if(MAKE_NUM_KEY_SLASH==scode){
+               if(break_flag!=1)return'/';
+               
+       }else if(MAKE_NUM_KEY_LEFT_SHIFT_AND_SLASH==scode){
+               return'/';
+               
+       }else if(MAKE_NUM_KEY_RIGHT_SHIFT_AND_SLASH==scode){
+               return'/';
+               
+       }else if(MAKE_NUM_KEY_LR_SHIFT_AND_SLASH==scode){
+               return'/';
+               
+       }else if(SC_NUM_KEY_AST==scode){
+               if(break_flag!=1)return'*';
+               
+       }else if(SC_NUM_KEY_MINUS==scode){
+               if(break_flag!=1)return'-';
+               
+       }else if(SC_NUM_KEY_PLUS==scode){
+               if(break_flag!=1)return'+';
+               
+       }else if(MAKE_NUM_KEY_ENTER==scode){
+               if(break_flag!=1)return'\n';
+               
+       }else if(SC_NUM_KEY_PIRIOD==scode){
+               if(break_flag!=1)return'.';
+               
+       }else if(SC_NUM_KEY_0==scode){
+               if(break_flag!=1)return'0';
+               
+       }else if(SC_NUM_KEY_1==scode){
+               if(break_flag!=1)return'1';
+               
+       }else if(SC_NUM_KEY_2==scode){
+               if(break_flag!=1)return'2';
+               
+       }else if(SC_NUM_KEY_3==scode){
+               if(break_flag!=1)return'3';
+               
+       }else if(SC_NUM_KEY_4==scode){
+               if(break_flag!=1)return'4';
+               
+       }else if(SC_NUM_KEY_5==scode){
+               if(break_flag!=1)return'5';
+               
+       }else if(SC_NUM_KEY_6==scode){
+               if(break_flag!=1)return'6';
+               
+       }else if(SC_NUM_KEY_7==scode){
+               if(break_flag!=1)return'7';
+               
+       }else if(SC_NUM_KEY_8==scode){
+               if(break_flag!=1)return'8';
+               
+       }else if(SC_NUM_KEY_9==scode){
+               if(break_flag!=1)return'9';
+               
+       }else if(SC_GAUS_LEFT==scode){
+               if(shift_flag==0){
+                       return'[';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'{';
+               }
+       }else if(SC_SEMI_COLON==scode){
+               if(shift_flag==0){
+                       return';';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'+';
+               }
+       }else if(SC_COMMA==scode){
+               if(shift_flag==0){
+                       return',';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'<';
+               }
+       }else if(SC_PILIOD==scode){
+               if(shift_flag==0){
+                       return'.';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'>';
+               }
+       }else if(SC_SLASH==scode){
+               if(shift_flag==0){
+                       return'/';
+               }else if(break_flag==1){
+                       
+               }else{
+                       return'?';
+               }
+       }else if(SC_BS==scode){
+               return '\b';
+       }else{
+               input = input | scode;
+               input=input<<16;
+               return 0;
+       }
+       return 0;
+}
diff --git a/Kernel/scancode.o b/Kernel/scancode.o
new file mode 100644 (file)
index 0000000..dbed477
Binary files /dev/null and b/Kernel/scancode.o differ
diff --git a/Kernel/stdio.c b/Kernel/stdio.c
new file mode 100644 (file)
index 0000000..c228472
--- /dev/null
@@ -0,0 +1,344 @@
+#include<stdio.h>
+#include<string.h>
+#include<KeyBoard.h>
+#include<scancode.h>
+#include<stdarg.h>
+/*
+COLOR
+
+BRACK, BLUE, GREEN, CIAN, RED, MASENTA
+BRAWN, GLAY, D_GLAY, CH_BLUE, CH_GREE
+CH_CIAN, PINK, CH_MAS, YELLOW, WHITE
+*/
+int asm_move_cursol(int ebp);
+
+unsigned short* screen;
+char attr;
+unsigned int X,Y;
+
+void scanf(const char* fmt,...)
+{
+       va_list arg;
+       va_start(arg,char*,fmt);
+       char ch=*fmt++;
+       unsigned int charactor_count=0;
+       
+       while(ch!='\0'){
+       
+               if(ch=='%'){
+                       ch=*fmt++;
+                       
+                       if(ch=='d'){
+                               int buf=0;      char chbuf=0;
+                               while(0){
+                                       chbuf=getch();
+                                       buf*=10;
+                                       
+                                       if(chbuf=='1'){
+                                               buf+=1;
+                                               putchar(chbuf);
+                                               ++charactor_count;
+                                       }else if(chbuf=='2'){
+                                               buf+=2;
+                                               putchar(chbuf);
+                                               ++charactor_count;
+                                       }else if(chbuf=='3'){
+                                               buf+=3;
+                                               putchar(chbuf);
+                                               ++charactor_count;
+                                       }else if(chbuf=='4'){
+                                               buf+=4;
+                                               putchar(chbuf);
+                                               ++charactor_count;
+                                       }else if(chbuf=='5'){
+                                               buf+=5;
+                                               putchar(chbuf);
+                                               ++charactor_count;
+                                       }else if(chbuf=='6'){
+                                               buf+=6;
+                                               putchar(chbuf);
+                                               ++charactor_count;
+                                       }else if(chbuf=='7'){
+                                               buf+=7;
+                                               putchar(chbuf);
+                                               ++charactor_count;
+                                       }else if(chbuf=='8'){
+                                               buf+=8;
+                                               putchar(chbuf);
+                                               ++charactor_count;
+                                       }else if(chbuf=='9'){
+                                               buf+=9;
+                                               putchar(chbuf);
+                                               ++charactor_count;
+                                       }else if(chbuf=='0'){
+                                               buf+=0;
+                                               putchar(chbuf);
+                                               ++charactor_count;
+                                       }else if(chbuf=='\b' && charactor_count>=0){
+                                               buf/=10;
+                                               putchar(chbuf);
+                                               --charactor_count;
+                                       }else{
+                                               buf/=10;
+                                               va_arg(arg,int)=buf;
+                                               break;
+                                       }
+                               }
+                       }else if(ch=='s'){
+                               char *cmd;      cmd=va_arg(arg,char*);
+                               int count=0;
+                               do{
+                                       *cmd=getch();
+                                       if(*cmd=='\n'){
+                                               putchar(*cmd);
+                                               *cmd='\0';
+                                               return;
+                                       }else if(*cmd==' '){
+                                               putchar(*cmd);
+                                               break;
+                                       }else if(*cmd=='\b' && count>0){
+                                               *cmd-- = '\0';
+                                               count--;
+                                               putchar('\b');
+                                       }else{
+                                               putchar(*cmd);
+                                               count++;
+                                               cmd++;
+                                       }
+                               }while(1);
+                       
+                       }else if(ch=='c'){
+                               va_arg(arg,char)=getchar();
+                       }
+               }
+               ch=*fmt++;
+       }
+}
+
+char getchar(void)
+{
+       char code=0;
+       while(code==0)
+       {
+               code=Generate_Scancode_To_ASCII_Code();
+       }
+       putchar(code);
+       return code;
+}
+
+char getch(void)
+{
+       char code=0;
+       while(code==0)
+       {
+               code=Generate_Scancode_To_ASCII_Code();
+       }
+       return code;
+}
+
+void ClearScreen(void)
+{
+       screen=(unsigned short*)0xb8000;
+       X=0;Y=0;
+       while(screen<(unsigned short*)0xc0000)
+       {
+               *screen++ =NUM_NULL;
+       }
+       screen=(unsigned short*)0xb8000;
+       return;
+}
+
+void puts(const char* msg)
+{
+       
+       char ch,buf;
+       ch=*msg++;
+       
+       while(ch!='\0')
+       {
+               
+               if(ch=='\n'){
+                       screen+=(80-X);/*80 charactors * 2byte - X charactors * 2 byte*/
+                       Y+=1;
+                       X=0;
+                       
+               }else if(ch=='\t'){
+                       *screen++ = (((attr)<<8) | ' ');
+                       *screen++ = (((attr)<<8) | ' ');
+                       X+=2;
+                       
+               }else if(ch=='\r'){
+                       while(X>=0)
+                       {
+                               *screen-- = NUM_NULL;
+                               --X;
+                       }
+               
+                       
+               }else{
+                       *screen++ = (((attr)<<8) | ch);
+                       X+=1;
+               }
+               ch=*msg++;
+               //MoveCursol();
+       }
+       return;
+}
+
+void putchar(const char ch)
+{
+       if(ch=='\n'){
+               screen+=(80-X);/*80 charactors * 2byte - X charactors * 2 byte*/
+               Y+=1;
+               X=0;
+               
+       }else if(ch=='\t'){
+               *screen++ = (((attr)<<8) | ' ');
+               *screen++ = (((attr)<<8) | ' ');
+               X+=2;
+               
+       }else if(ch=='\r'){
+               while(X>=0)
+               {
+                       *screen-- = (unsigned short*)NULL;
+                       --X;
+               }
+       
+       }else if(ch=='\b'){
+               screen--;
+               *screen = (unsigned short*)NULL;
+               --X;
+               
+       }else{
+               *screen++ = (((attr)<<8) | ch);
+               X+=1;
+       }
+       //MoveCursol();
+       return;
+}
+
+void printOK(const char* msg)
+{
+       attr=WHITE;
+       puts(msg);
+       while(X<(80-6))/*80 charactors - [ OK ]*/
+       {
+               puts(" ");
+       }
+       puts("[ ");
+       attr=GREEN;
+       puts("OK");
+       attr=WHITE;
+       puts(" ]\n");
+       return;
+}
+
+void printINFO(const char* msg)
+{
+       attr=WHITE;
+       puts(msg);
+       while(X<(80-6))/*80 charactors - [ OK ]*/
+       {
+               puts(" ");
+       }
+       puts("[");
+       attr=BLUE;
+       puts("INFO");
+       attr=WHITE;
+       puts("]\n");
+       return;
+}
+
+void printFAIL(const char* msg)
+{
+       attr=WHITE;
+       puts(msg);
+       while(X<(80-6))/*80 charactors - [ OK ]*/
+       {
+               puts(" ");
+       }
+       puts("[");
+       attr=RED;
+       puts("FAIL");
+       attr=WHITE;
+       puts("]\n");
+       return;
+}
+
+void printWARN(const char* msg)
+{
+       attr=WHITE;
+       puts(msg);
+       while(X<(80-6))/*80 charactors - [ OK ]*/
+       {
+               puts(" ");
+       }
+       puts("[");
+       attr=YELLOW;
+       puts("WARN");
+       attr=WHITE;
+       puts("]\n");
+       return;
+}
+
+char * uint_to_str(char *buf, unsigned src, int base) {
+  char *p = buf;
+  char *p1, *p2;
+
+  do {
+    *p++ = "0123456789ABCDEF"[src%base];
+  } while(src /= base);
+
+  // Terminate BUF
+  *p = 0;
+
+  // Reverse BUF
+  for(p1=buf, p2=p-1; p1 < p2; p1++, p2--) {
+    char tmp = *p1;
+    *p1 = *p2;
+    *p2 = tmp;
+  }
+
+  return buf;
+}
+
+void printf(char * fmt, ...) {
+       char **arg = (char **) &fmt;
+       char c;
+       arg++;
+
+       while((c = *fmt++) != 0) {
+               if(c != '%'){
+                       putchar(c);
+                       
+               }else{
+               char buf[64];
+               char *p;
+               c = *fmt++;
+               
+               if(c=='d'){
+                       // if value is minus, put '-' in the head
+                       if( 0 > *((int *) arg) ) {
+                               putchar('-');
+                               *((int *) arg) *= -1;
+                       }
+                       p = uint_to_str(buf, *((unsigned *) arg++), 10);
+                       puts(p);
+        
+               }else if(c=='x'){
+                       p = uint_to_str(buf, *((unsigned *) arg++), 16);
+                       puts(p);
+        
+               }else if(c=='s'){
+                       p = *arg++;
+                       puts(p);
+        }else if(c=='c'){
+               p=*arg++;
+               char send=*p;
+               putchar(send);
+               }else{
+                       putchar(c);
+      }
+    }
+  }
+}
diff --git a/Kernel/stdio.o b/Kernel/stdio.o
new file mode 100644 (file)
index 0000000..fd63299
Binary files /dev/null and b/Kernel/stdio.o differ
diff --git a/Kernel/string.c b/Kernel/string.c
new file mode 100644 (file)
index 0000000..5b27898
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+
+*/
+#include<string.h>
+
+int strcmp(const char* ch1,const char* ch2)
+{
+       while(*ch1==*ch2)
+       {
+               if(*ch1=='\0' && *ch2=='\0'){
+                       return 0;
+               
+               }else if((*ch1=='\0' || *ch2=='\0') && (*ch1!=*ch2)){
+                       break;
+                       
+               }
+               ++ch1;  ++ch2;
+       }
+       return 1;
+}
+
+void strcpy(char* copy,const char* source)
+{
+       while(*source!='\0')
+       {
+               *copy=*source;
+               ++copy; ++source;
+       }
+       *copy='\0';
+       return;
+}
diff --git a/Kernel/string.o b/Kernel/string.o
new file mode 100644 (file)
index 0000000..a005691
Binary files /dev/null and b/Kernel/string.o differ
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..5b8d802
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,41 @@
+#
+# Vane Operating System  Makefile by VOSystems
+#--------------------------------------------//
+
+TARGET      = Kernel.vsb
+
+#宣言
+CC                     = gcc
+RM                     = /bin/rm
+MV                     = /bin/mv
+LD                     = /usr/bin/ld
+LN_S                   = ln -s
+AR                     = /usr/bin/ar
+RANLIB         = ranlib
+INCLUDES           = -I../include
+FLAGS          = -m32 -ffreestanding -fno-common -fno-builtin -fomit-frame-pointer -O2 -c
+FLAGSC         = -m32 -ffreestanding -fno-common -masm=intel -fno-builtin -fomit-frame-pointer -O2 -c
+LD          = ld  -melf_i386  -Ttext=0x100000 --oformat elf32-i386 -o
+#LDAPP         = ld -melf_i386 -Ttext=0x280000 --oformat elf32-i386 -o
+export
+
+#サフィックス
+.S.o:
+       ${CC} ${INCLUDES} ${FLAGS} $<
+.c.o:
+       ${CC} ${INCLUDES} ${FLAGSC} $<
+
+#STDIO_C=stdio.c
+BIN=Kernel.vsb
+
+
+#処理
+copy:
+       cp /media/DATA/OS/OS/Kernel.vsb /media/VaneOS/Vane/Kernel.vsb
+all:
+       ${MAKE} -C Kernel
+       ${MAKE} -C Drivers
+       @echo "Make is finish successfully!!"
+
+clean:
+       -${RM}  -f *~ *.lo *.o make.log *.bak .a.out .core .*.core
diff --git a/bu/boot.c b/bu/boot.c
new file mode 100644 (file)
index 0000000..1f4e672
--- /dev/null
+++ b/bu/boot.c
@@ -0,0 +1,201 @@
+/*!
+       \file boot.c
+       \Desc Kernel and Setting.
+       (C) 2014 VOSystems.
+*/
+
+#include<multiboot.h>
+#include<VaneOS.h>
+#include<KeyBoard.h>
+#include<Interrupt.h>
+#include<GDT_IDT.h>
+#include<stdio.h>
+#include<scancode.h>
+#include<memory.h>
+
+/*PROTOTYPE*/
+void outPortByte( unsigned short address, unsigned char value );
+unsigned char inPortByte( unsigned short address );
+void initPIC( void );
+int setPitCounter( int freq, unsigned char counter, unsigned char mode );
+void initPit( void );
+void clear_state(void);
+
+/*!
+       load.S call this function
+       
+       Set All & Call shell
+       (C)2014 VOSystems.
+       \create 2014/09/23
+       \update 2014/09/27
+       \author 2m
+*/
+void cstart(unsigned long magic, mbi_t* info)
+{
+       /*Common Settings*/
+       char cmd[100]={0};
+       struct MEMMAN *memman=(struct MEMMAN*)MEMMAN_ADDR;
+       
+       ClearScreen();
+       scan_code=0; break_flag=0;      system_key_code_flag=0;
+       screen=(unsigned short*)0xb8000;//VRam Setting
+       attr=WHITE;
+       
+       /*Start Set Main Code*/
+       printf("VOSystems Vane Operating System  [Version 0.2(build 300)]\n");
+       
+       /*Setting IDT*/
+       setupInterruptGate(DEF_IDT_INT_NUM_IRQ1,KeyBoard_Interrupt_asm);//Register Keyboard interrupt handler
+       setupInterruptGate(DEF_IDT_INT_NUM_IRQ0,Timer_Interrupt_asm);//Register Timer interrupt handler
+       idtr.size       = NUM_IDT * sizeof( GATE_DESCRIPTOR );
+       idtr.base       = ( GATE_DESCRIPTOR *)idt;
+       
+       load_idt();
+       printOK("Setting IDT.....");
+       
+       /*Setting GDT*/
+       /*set up null descriptor*/
+       gdt[NULL_DESCRIPTOR].limitLo    = DEF_GDT_NULL_LIMIT;
+       gdt[NULL_DESCRIPTOR].baseLo             = DEF_GDT_NULL_BASELO;
+       gdt[NULL_DESCRIPTOR].baseMid    = DEF_GDT_NULL_BASEMID;
+       gdt[NULL_DESCRIPTOR].flags              = DEF_GDT_NULL_FLAGS;
+       gdt[NULL_DESCRIPTOR].baseHi             = DEF_GDT_NULL_BASEHI;
+       /* set up code descriptor */
+       gdt[CODE_DESCRIPTOR].limitLo    = DEF_GDT_CODE_LIMIT;
+       gdt[CODE_DESCRIPTOR].baseLo             = DEF_GDT_CODE_BASELO;
+       gdt[CODE_DESCRIPTOR].baseMid    = DEF_GDT_CODE_BASEMID;
+       gdt[CODE_DESCRIPTOR].flags              = DEF_GDT_CODE_FLAGS;
+       gdt[CODE_DESCRIPTOR].baseHi             = DEF_GDT_CODE_BASEHI;
+
+       /* set up data descriptor */
+       gdt[DATA_DESCRIPTOR].limitLo    = DEF_GDT_DATA_LIMIT;
+       gdt[DATA_DESCRIPTOR].baseLo             = DEF_GDT_DATA_BASELO;
+       gdt[DATA_DESCRIPTOR].baseMid    = DEF_GDT_DATA_BASEMID;
+       gdt[DATA_DESCRIPTOR].flags              = DEF_GDT_DATA_FLAGS;
+       gdt[DATA_DESCRIPTOR].baseHi             = DEF_GDT_DATA_BASEHI;
+       
+       gdtr.size       = NUM_GDT * sizeof( SEGMENT_DESCRIPTOR );
+       gdtr.base       = ( SEGMENT_DESCRIPTOR *)gdt;
+       
+       load_gdt();
+       printOK("Setting GDT.....");
+               
+       initPIC();
+       printOK("Init PIC.....");
+       
+       initKeyboard();
+       keyboardEnableKBD();
+       printOK("Init Keyboard.....");
+       
+       setPitCounter(100,DEF_PIT_COM_COUNTER0,DEF_PIT_COM_MODE_SQUAREWAVE);
+       initPit();
+       printOK("Init PIT.....");
+       
+       memman_init(memman);
+       memman_free(memman,0x00001000,0x0009e000);
+       memman_free(memman,0x00400000,((info->mem_lower+info->mem_upper)*1024)-0x00400000);
+       printOK("Starting Memory Manager.....");
+       
+       unsigned int info->
+       int* fat=(int*)memman_alloc_4k(memman,4*2880);
+       file_readfat(fat,(unsigned char*)(ADR_DISKIMG+0x000200));
+       printOK("Loading FAT File System.....");
+       
+       if(magic!=MULTIBOOT_BOOTLOADER_MAGIC){
+               printFAIL("Loading Memory Info.....");
+               
+       }else{
+               printOK("Loading Memory Info.....");
+               
+       }
+       printf("\nLowMemory = %d KiB , UpperMemory = %d KiB , TotalMemory = %d MiB\n\n",info->mem_lower,
+               info->mem_upper,(info->mem_lower+info->mem_upper+1024)/1024);
+       printf("Free Memory = %d MiB\n",memman_total(memman)/(1024*1024));
+       
+       puts("KernelShell/Root/>");
+       scanf("%s",&cmd);
+       printf("%s",cmd);
+       while(1);
+       return;
+}
+
+void outPortByte( unsigned short address, unsigned char value )
+{
+       __asm__ __volatile__( "out %%dx, %%al" : : "d"(address), "a"(value) );
+}
+
+unsigned char inPortByte( unsigned short address )
+{
+       unsigned char data;
+
+       __asm__ __volatile__( "mov %%dx, %%ax" : : "a"(address) );
+       __asm__ __volatile__( "in %al, %dx" );
+       __asm__ __volatile__( "mov %%bl, %%al" : "=b"(data) );
+       return( data );
+}
+
+void initPIC( void )
+{
+       disable();
+       
+       outPortByte( PORT_MASTER_PIC_COMMAND,   PIC_ICW1        );
+       outPortByte( PORT_SLAVE_PIC_COMMAND,    PIC_ICW1        );
+
+       outPortByte( PORT_MASTER_PIC_DATA,      PIC_MASTER_ICW2 );
+       outPortByte( PORT_SLAVE_PIC_DATA,       PIC_SLAVE_ICW2  );
+
+       outPortByte( PORT_MASTER_PIC_DATA,      PIC_MASTER_ICW3 );
+       outPortByte( PORT_SLAVE_PIC_DATA,       PIC_SLAVE_ICW3  );
+
+       outPortByte( PORT_MASTER_PIC_DATA,      PIC_MASTER_ICW4 );
+       outPortByte( PORT_SLAVE_PIC_DATA,       PIC_SLAVE_ICW4  );
+       
+       outPortByte( PORT_MASTER_PIC_IMR, (~PIC_IMR_MASK_IRQ0) & (~PIC_IMR_MASK_IRQ2 )  );
+       outPortByte( PORT_SLAVE_PIC_IMR, PIC_IMR_MASK_IRQ_ALL                           );
+       
+    outPortByte( PORT_MASTER_PIC_IMR, ( ~PIC_IMR_MASK_IRQ0 )
+                 & ( ~PIC_IMR_MASK_IRQ1 ) & ( ~PIC_IMR_MASK_IRQ2 ) );
+    outPortByte( PORT_SLAVE_PIC_IMR, PIC_IMR_MASK_IRQ_ALL          );
+    
+    enable();
+}
+
+int setPitCounter( int freq, unsigned char counter, unsigned char mode )
+{
+       unsigned short  count;
+       unsigned char   command;
+
+       /* --------------------------------------------------------------------- */
+       /*      calculate frequency                                              */
+       /* --------------------------------------------------------------------- */
+       count = ( unsigned short )( DEF_PIT_CLOCK / freq );
+
+       /* --------------------------------------------------------------------- */
+       /*      make initial command                                             */
+       /* --------------------------------------------------------------------- */
+       command = mode | DEF_PIT_COM_RL_DATA | counter;
+
+       outPortByte( PIT_REG_CONTROL, command );
+
+       /* --------------------------------------------------------------------- */
+       /*      send counter value                                               */
+       /* --------------------------------------------------------------------- */
+       outPortByte( PIT_REG_COUNTER0, ( unsigned char )( count & 0xFF          ) );
+       outPortByte( PIT_REG_COUNTER0, ( unsigned char )( ( count >> 8 ) & 0xFF ) );
+}
+
+/*
+       Funtion     :initPit
+       Input       :void
+       Output      :void
+       Return      :void 
+
+       Description :initialize pic
+*/
+void initPit( void )
+{
+       /* --------------------------------------------------------------------- */
+       /*      set counter0 100Hz                                               */
+       /* --------------------------------------------------------------------- */
+       setPitCounter( 100, DEF_PIT_COM_COUNTER0,  DEF_PIT_COM_MODE_SQUAREWAVE );
+}
diff --git a/bu/load.S b/bu/load.S
new file mode 100644 (file)
index 0000000..0e5f845
--- /dev/null
+++ b/bu/load.S
@@ -0,0 +1,34 @@
+#define ASM_FILE 1
+#include <multiboot.h>
+#define EXT_C(func)                    func
+#define STACK_SIZE                     0x4000
+#define MULTIBOOT_HEADER_FLAGS         0x00000003
+
+.text
+.global start,_start
+
+start:
+ _start:
+        jmp     multiboot_entry
+        .align  4
+
+multiboot_header:
+        .long   MULTIBOOT_HEADER_MAGIC
+        .long   MULTIBOOT_HEADER_FLAGS
+        .long   -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
+
+multiboot_entry:
+        movl    $(stack + STACK_SIZE), %esp
+        pushl   $0
+        popf
+        pushl   %ebx
+        pushl   %eax
+        
+        call    EXT_C(cstart)
+
+loop:
+        hlt
+        jmp    loop
+
+        
+.comm   stack, STACK_SIZE
diff --git a/bu/multiboot.h b/bu/multiboot.h
new file mode 100644 (file)
index 0000000..7dd52a0
--- /dev/null
@@ -0,0 +1,69 @@
+#ifndef MULTIBOOT_HEADER
+#define MULTIBOOT_HEADER 1
+     
+#define MULTIBOOT_SEARCH                        8192     
+#define MULTIBOOT_HEADER_MAGIC                  0x1BADB002     
+#define MULTIBOOT_BOOTLOADER_MAGIC              0x2BADB002     
+#define MULTIBOOT_UNSUPPORTED                   0x0000fffc     
+#define MULTIBOOT_MOD_ALIGN                     0x00001000     
+#define MULTIBOOT_INFO_ALIGN                    0x00000004     
+#define MULTIBOOT_PAGE_ALIGN                    0x00000001     
+#define MULTIBOOT_MEMORY_INFO                   0x00000002     
+#define MULTIBOOT_VIDEO_MODE                    0x00000004     
+#define MULTIBOOT_AOUT_KLUDGE                   0x00010000
+#define MULTIBOOT_INFO_MEMORY                   0x00000001
+#define MULTIBOOT_INFO_BOOTDEV                  0x00000002
+#define MULTIBOOT_INFO_CMDLINE                  0x00000004
+#define MULTIBOOT_INFO_MODS                     0x00000008
+#define MULTIBOOT_INFO_AOUT_SYMS                0x00000010
+#define MULTIBOOT_INFO_ELF_SHDR                 0X00000020  
+#define MULTIBOOT_INFO_MEM_MAP                  0x00000040
+#define MULTIBOOT_INFO_DRIVE_INFO               0x00000080
+#define MULTIBOOT_INFO_CONFIG_TABLE             0x00000100 
+#define MULTIBOOT_INFO_BOOT_LOADER_NAME         0x00000200
+#define MULTIBOOT_INFO_APM_TABLE                0x00000400
+#define MULTIBOOT_INFO_VIDEO_INFO               0x00000800
+  
+#ifndef ASM_FILE
+     
+#define MULTIBOOT_HEADER_MAGIC          0x1BADB002
+#define MULTIBOOT_HEADER_FLAGS          0x00000000
+#define MULTIBOOT_HEADER_CHECKSUM       -(MULTIBOOT_HEADER_MAGIC+MULTIBOOT_HEADER_FLAGS)
+#define KERNEL_STACK_SIZE               0x100000
+
+#define MULTIBOOT_BOOTLOADER_MAGIC      0x2BADB002
+
+
+typedef struct mbi_info {
+  unsigned long flags;
+  unsigned long mem_lower;
+  unsigned long mem_upper;
+  unsigned long boot_device;
+  unsigned long cmdline;
+  unsigned long mods_count;
+  unsigned long mods_addr;
+
+  // The section header table for ELF
+  unsigned long num;
+  unsigned long size;
+  unsigned long addr;
+  unsigned long shndx;
+
+  unsigned long mmap_length;
+  unsigned long mmap_addr;
+} __attribute__((__packed__)) mbi_t;
+
+// The memory map
+typedef struct memory_map {
+  unsigned long size;
+  unsigned long base_addr_low;
+  unsigned long base_addr_high;
+  unsigned long length_low;
+  unsigned long length_high;
+  unsigned long type;
+} __attribute__((__packed__)) memory_map;
+     
+#endif /* ! ASM_FILE */
+     
+#endif /* ! MULTIBOOT_HEADER */
+
diff --git a/include/GDT_IDT.h b/include/GDT_IDT.h
new file mode 100644 (file)
index 0000000..7e8da6f
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef _GDT_IDT_VANE_
+#define _GDT_IDT_VANE_
+
+extern IDTR idtr;
+extern GATE_DESCRIPTOR idt[ NUM_IDT ];
+extern SEGMENT_DESCRIPTOR      gdt[ NUM_GDT ];
+extern GDTR gdtr;
+
+
+void setupInterruptGate( int int_num, void *interrupt_handler );
+void setupGateDescriptor( int int_num,int base,unsigned short selector,unsigned char flags );
+void load_gdt(void);
+void load_idt(void);
+
+#endif
diff --git a/include/GDT_IDT.h~ b/include/GDT_IDT.h~
new file mode 100644 (file)
index 0000000..c33e0ce
--- /dev/null
@@ -0,0 +1,10 @@
+extern IDTR idtr;
+extern GATE_DESCRIPTOR idt[ NUM_IDT ];
+extern SEGMENT_DESCRIPTOR      gdt[ NUM_GDT ];
+extern GDTR gdtr;
+
+
+void setupInterruptGate( int int_num, void *interrupt_handler );
+void setupGateDescriptor( int int_num,int base,unsigned short selector,unsigned char flags );
+void load_gdt(void);
+void load_idt(void);
diff --git a/include/Interrupt.h b/include/Interrupt.h
new file mode 100644 (file)
index 0000000..26637c0
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+extern int timer_tick;
+*/
+
+#ifndef INTERRUPT_H
+#define INTERRUPT_H
+
+void Timer_Interrupt_asm(void);
+void KeyBoard_Interrupt_asm(void);
+void INTERRUPT_NOTHING(void);
+
+void enter_interrupt(void);
+void interrupt_done(void);
+void exit_interrupt(void);
+void keyboard_interrupt(void);
+void timer_interrupt(void);
+
+void enable();
+void disable();
+#endif
diff --git a/include/Interrupt.h~ b/include/Interrupt.h~
new file mode 100644 (file)
index 0000000..7d6ef8f
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+extern int timer_tick;
+*/
+
+#ifndef INTERRUPT_H
+#define INTERRUPT_H
+
+void Timer_Interrupt_asm(void);
+void KeyBoard_Interrupt_asm(void);
+void INTERRUPT_NOTHING(void);
+
+void enter_interrupt(void);
+void interrupt_done(void);
+void exit_interrupt(void);
+void keyboard_interrupt(void);
+void timer_interrupt(void);
+
+void enable()
+void disable()
+#endif
diff --git a/include/KeyBoard.h b/include/KeyBoard.h
new file mode 100644 (file)
index 0000000..b7d8214
--- /dev/null
@@ -0,0 +1,187 @@
+/*!
+       KeyBoard.h
+       Keyboard type load header
+       (C) 2014 VOSystems.
+*/
+
+#ifndef _KEYBOARD_H_VANE_
+#define _KEYBOARD_H_VANE_
+
+/*Typedef*/
+typedef struct
+{
+    int caps_on;
+    int alt_on;
+    int shift_on;
+    int ctrl_on;
+    int numlock_on;
+    int scrolllock_on;
+    int insert_on;
+} KEY_STATE;
+typedef int STATUS;
+typedef enum
+{
+    E_KBD_NONE_LED          = 0x00000000,
+    E_KBD_SCROLL_LOCK_LED   = 0x00000001,
+    E_KBD_NUM_LOCK_LED      = 0x00000002,
+    E_KBD_CAPS_LOCK_LED     = 0x00000004
+} E_KBD_LED;
+
+/*Extern*/
+extern int keyboard_disable;
+extern unsigned char scan_code;
+extern int system_key_code_flag,break_flag;
+extern unsigned long long input;
+
+/*PROTOTYPE*/
+void outPortByte( unsigned short address, unsigned char value );
+unsigned char inPortByte( unsigned short address );
+unsigned char readKbdCtrlStatus(void);
+STATUS writeKbdCtrlCommand(unsigned char command);
+unsigned char readKbdEncBuffer(void);
+STATUS writeKbdEncCommand(unsigned char command);
+STATUS keyboardSetLED( E_KBD_LED led );
+STATUS keyboardSelfTest( void );
+STATUS waitKbdOutputBufferFull( void );
+STATUS keyboardDisableKBD( void );
+STATUS keyboardEnableKBD( void );
+STATUS initKeyboard( void );
+char Generate_Scancode_To_ASCII_Code(void);
+
+/*DESCRIPTION KEYBOARD ENCODE*/
+#define DEF_PORT_KBD_ENCODER 0x0060
+#define DEF_PORT_KBD_ENC_BUFFER DEF_PORT_KBD_ENCODER
+#define DEF_PORT_KBD_ENC_COMMAND DEF_PORT_KBD_ENCODER
+
+/*DESCRIPTION KEYBOARD CONTROLER*/
+#define DEF_PORT_KBD_CONTROLLER 0x0064
+#define DEF_PORT_KBD_CTRL_STATUS DEF_PORT_KBD_CONTROLLER
+#define DEF_PORT_KBD_CTRL_COMMAND DEF_PORT_KBD_CONTROLLER
+
+/*DEFINE STATUS REGISTOR*/
+#define DEF_KBD_STS_OBF 0x01
+#define DEF_KBD_STS_IBF 0x02
+#define DEF_KBD_STS_F0  0x04
+#define DEF_KBD_STS_F1  0x08
+#define DEF_KBD_STS_ST4 0x10
+#define DEF_KBD_STS_ST5 0x20
+#define DEF_KBD_STS_ST6 0x40
+#define DEF_KBD_STS_ST7 0x80
+
+/*Key Board Status*/
+#define DEF_KBD_OK 0
+#define DEF_KBD_ERROR (-1)
+#define MAX_RETRY 0x01000000
+
+/*Key Board Status*/
+#define        DEF_KBD_ENC_COM_SETLED              0xED
+#define        DEF_KBD_ENC_COM_ECHO                0xEE
+#define        DEF_KBD_ENC_COM_GETSET_SCANCODE     0xF0
+#define        DEF_KBD_ENC_COM_GET_KBD_ID          0xF2
+#define        DEF_KBD_ENC_COM_SET_TYPEMATIC       0xF3
+#define        DEF_KBD_ENC_COM_ENABLE_KBD          0xF4
+#define        DEF_KBD_ENC_COM_DISABLE_KBD         0xF5
+#define        DEF_KBD_ENC_COM_SET_DEFAULT         0xF6
+#define        DEF_KBD_ENC_COM_SET_ALL_REPEAT      0xF7
+#define        DEF_KBD_ENC_COM_SET_ALL_BREAK       0xF8
+#define        DEF_KBD_ENC_COM_CLEAR_ALL_REP_BRK   0xF9
+#define        DEF_KBD_ENC_COM_SET_ALL_REP_BRK     0xFA
+#define        DEF_KBD_ENC_COM_SET_REPEAT          0xFB
+#define        DEF_KBD_ENC_COM_SET_BREAK           0xFC
+#define        DEF_KBD_ENC_COM_CLEAR_REP_BRK       0xFD
+#define        DEF_KBD_ENC_COM_REQ_RESEND          0xFE
+#define        DEF_KBD_ENC_COM_RESET_SELFTEST      0xFF
+
+/* Standard Commands      */
+#define DEF_KBD_CTRL_COM_READ_CCB        0x20
+#define DEF_KBD_CTRL_COM_WRITE_CCB       0x60
+#define DEF_KBD_CTRL_COM_DISABLE_MOUSE   0xA7
+#define DEF_KBD_CTRL_COM_ENABLE_MOUSE    0xA8
+#define DEF_KBD_CTRL_COM_TEST_MOUSE      0xA9
+#define DEF_KBD_CTRL_COM_SELF_TEST       0xAA
+#define DEF_KBD_CTRL_COM_TEST_IF         0xAB
+#define DEF_KBD_CTRL_COM_DISABLE_KBD     0xAD
+#define DEF_KBD_CTRL_COM_ENABLE_KBD      0xAE
+#define DEF_KBD_CTRL_COM_READ_IN_PORT    0xC0
+#define DEF_KBD_CTRL_COM_READ_OUT_PORT   0xD0
+#define DEF_KBD_CTRL_COM_WRITE_OUT_PORT  0xD1
+#define DEF_KBD_CTRL_COM_WRITE_MOUSE     0xD4
+#define DEF_KBD_CTRL_COM_READ_TEST_PORT  0xE0
+#define DEF_KBD_CTRL_COM_SYSTEM_RESET    0xFE
+
+/* Vendo-Specific Commands  */
+#define DEF_KBD_CTRL_COM_READ_RAM_0x20   0x20
+#define DEF_KBD_CTRL_COM_READ_RAM_0x21   0x21
+#define DEF_KBD_CTRL_COM_READ_RAM_0x22   0x22
+#define DEF_KBD_CTRL_COM_READ_RAM_0x23   0x23
+#define DEF_KBD_CTRL_COM_READ_RAM_0x24   0x24
+#define DEF_KBD_CTRL_COM_READ_RAM_0x25   0x25
+#define DEF_KBD_CTRL_COM_READ_RAM_0x26   0x26
+#define DEF_KBD_CTRL_COM_READ_RAM_0x27   0x27
+#define DEF_KBD_CTRL_COM_READ_RAM_0x28   0x28
+#define DEF_KBD_CTRL_COM_READ_RAM_0x29   0x29
+#define DEF_KBD_CTRL_COM_READ_RAM_0x2A   0x2A
+#define DEF_KBD_CTRL_COM_READ_RAM_0x2B   0x2B
+#define DEF_KBD_CTRL_COM_READ_RAM_0x2C   0x2C
+#define DEF_KBD_CTRL_COM_READ_RAM_0x2D   0x2D
+#define DEF_KBD_CTRL_COM_READ_RAM_0x2E   0x2E
+#define DEF_KBD_CTRL_COM_READ_RAM_0x2F   0x2F
+#define DEF_KBD_CTRL_COM_READ_RAM_0x30   0x30
+#define DEF_KBD_CTRL_COM_READ_RAM_0x31   0x31
+#define DEF_KBD_CTRL_COM_READ_RAM_0x32   0x32
+#define DEF_KBD_CTRL_COM_READ_RAM_0x33   0x33
+#define DEF_KBD_CTRL_COM_READ_RAM_0x34   0x34
+#define DEF_KBD_CTRL_COM_READ_RAM_0x35   0x35
+#define DEF_KBD_CTRL_COM_READ_RAM_0x36   0x36
+#define DEF_KBD_CTRL_COM_READ_RAM_0x37   0x37
+#define DEF_KBD_CTRL_COM_READ_RAM_0x38   0x38
+#define DEF_KBD_CTRL_COM_READ_RAM_0x39   0x39
+#define DEF_KBD_CTRL_COM_READ_RAM_0x3A   0x3A
+#define DEF_KBD_CTRL_COM_READ_RAM_0x3B   0x3B
+#define DEF_KBD_CTRL_COM_READ_RAM_0x3C   0x3C
+#define DEF_KBD_CTRL_COM_READ_RAM_0x3D   0x3D
+#define DEF_KBD_CTRL_COM_READ_RAM_0x3E   0x3E
+#define DEF_KBD_CTRL_COM_READ_RAM_0x3F   0x3F
+
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x60  0x60
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x61  0x61
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x62  0x62
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x63  0x36
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x64  0x46
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x65  0x56
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x66  0x66
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x67  0x67
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x68  0x68
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x69  0x69
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x6A  0x6A
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x6B  0x6B
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x6C  0x6C
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x6D  0x6D
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x6E  0x6E
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x6F  0x6F
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x70  0x70
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x71  0x71
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x72  0x72
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x73  0x73
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x74  0x74
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x75  0x75
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x76  0x76
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x77  0x77
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x78  0x78
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x79  0x79
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x7A  0x7A
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x7B  0x7B
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x7C  0x7C
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x7D  0x7D
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x7E  0x7E
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x7F  0x7F
+
+/*Self Status Command*/
+#define DEF_KBD_CTRL_STS_SELF_TEST_OK    0x55
+#define DEF_KBD_CTRL_STS_SELF_TEST_NG    0xFC
+
+
+
+
+
+#endif
diff --git a/include/KeyBoard.h~ b/include/KeyBoard.h~
new file mode 100644 (file)
index 0000000..758ad34
--- /dev/null
@@ -0,0 +1,188 @@
+/*!
+       KeyBoard.h
+       Keyboard type load header
+       (C) 2014 VOSystems.
+*/
+
+#ifndef _KEYBOARD_H_VANE_
+#define _KEYBOARD_H_VANE_
+
+/*Typedef*/
+typedef struct
+{
+    int caps_on;
+    int alt_on;
+    int shift_on;
+    int ctrl_on;
+    int numlock_on;
+    int scrolllock_on;
+    int insert_on;
+} KEY_STATE;
+typedef int STATUS;
+typedef enum
+{
+    E_KBD_NONE_LED          = 0x00000000,
+    E_KBD_SCROLL_LOCK_LED   = 0x00000001,
+    E_KBD_NUM_LOCK_LED      = 0x00000002,
+    E_KBD_CAPS_LOCK_LED     = 0x00000004
+} E_KBD_LED;
+
+/*Extern*/
+extern int keyboard_disable;
+extern unsigned char scan_code;
+extern char code;
+extern int system_key_code_flag,break_flag;
+extern unsigned long long input;
+
+/*PROTOTYPE*/
+void outPortByte( unsigned short address, unsigned char value );
+unsigned char inPortByte( unsigned short address );
+unsigned char readKbdCtrlStatus(void);
+STATUS writeKbdCtrlCommand(unsigned char command);
+unsigned char readKbdEncBuffer(void);
+STATUS writeKbdEncCommand(unsigned char command);
+STATUS keyboardSetLED( E_KBD_LED led );
+STATUS keyboardSelfTest( void );
+STATUS waitKbdOutputBufferFull( void );
+STATUS keyboardDisableKBD( void );
+STATUS keyboardEnableKBD( void );
+STATUS initKeyboard( void );
+char Generate_Scancode_To_ASCII_Code(void);
+
+/*DESCRIPTION KEYBOARD ENCODE*/
+#define DEF_PORT_KBD_ENCODER 0x0060
+#define DEF_PORT_KBD_ENC_BUFFER DEF_PORT_KBD_ENCODER
+#define DEF_PORT_KBD_ENC_COMMAND DEF_PORT_KBD_ENCODER
+
+/*DESCRIPTION KEYBOARD CONTROLER*/
+#define DEF_PORT_KBD_CONTROLLER 0x0064
+#define DEF_PORT_KBD_CTRL_STATUS DEF_PORT_KBD_CONTROLLER
+#define DEF_PORT_KBD_CTRL_COMMAND DEF_PORT_KBD_CONTROLLER
+
+/*DEFINE STATUS REGISTOR*/
+#define DEF_KBD_STS_OBF 0x01
+#define DEF_KBD_STS_IBF 0x02
+#define DEF_KBD_STS_F0  0x04
+#define DEF_KBD_STS_F1  0x08
+#define DEF_KBD_STS_ST4 0x10
+#define DEF_KBD_STS_ST5 0x20
+#define DEF_KBD_STS_ST6 0x40
+#define DEF_KBD_STS_ST7 0x80
+
+/*Key Board Status*/
+#define DEF_KBD_OK 0
+#define DEF_KBD_ERROR (-1)
+#define MAX_RETRY 0x01000000
+
+/*Key Board Status*/
+#define        DEF_KBD_ENC_COM_SETLED              0xED
+#define        DEF_KBD_ENC_COM_ECHO                0xEE
+#define        DEF_KBD_ENC_COM_GETSET_SCANCODE     0xF0
+#define        DEF_KBD_ENC_COM_GET_KBD_ID          0xF2
+#define        DEF_KBD_ENC_COM_SET_TYPEMATIC       0xF3
+#define        DEF_KBD_ENC_COM_ENABLE_KBD          0xF4
+#define        DEF_KBD_ENC_COM_DISABLE_KBD         0xF5
+#define        DEF_KBD_ENC_COM_SET_DEFAULT         0xF6
+#define        DEF_KBD_ENC_COM_SET_ALL_REPEAT      0xF7
+#define        DEF_KBD_ENC_COM_SET_ALL_BREAK       0xF8
+#define        DEF_KBD_ENC_COM_CLEAR_ALL_REP_BRK   0xF9
+#define        DEF_KBD_ENC_COM_SET_ALL_REP_BRK     0xFA
+#define        DEF_KBD_ENC_COM_SET_REPEAT          0xFB
+#define        DEF_KBD_ENC_COM_SET_BREAK           0xFC
+#define        DEF_KBD_ENC_COM_CLEAR_REP_BRK       0xFD
+#define        DEF_KBD_ENC_COM_REQ_RESEND          0xFE
+#define        DEF_KBD_ENC_COM_RESET_SELFTEST      0xFF
+
+/* Standard Commands      */
+#define DEF_KBD_CTRL_COM_READ_CCB        0x20
+#define DEF_KBD_CTRL_COM_WRITE_CCB       0x60
+#define DEF_KBD_CTRL_COM_DISABLE_MOUSE   0xA7
+#define DEF_KBD_CTRL_COM_ENABLE_MOUSE    0xA8
+#define DEF_KBD_CTRL_COM_TEST_MOUSE      0xA9
+#define DEF_KBD_CTRL_COM_SELF_TEST       0xAA
+#define DEF_KBD_CTRL_COM_TEST_IF         0xAB
+#define DEF_KBD_CTRL_COM_DISABLE_KBD     0xAD
+#define DEF_KBD_CTRL_COM_ENABLE_KBD      0xAE
+#define DEF_KBD_CTRL_COM_READ_IN_PORT    0xC0
+#define DEF_KBD_CTRL_COM_READ_OUT_PORT   0xD0
+#define DEF_KBD_CTRL_COM_WRITE_OUT_PORT  0xD1
+#define DEF_KBD_CTRL_COM_WRITE_MOUSE     0xD4
+#define DEF_KBD_CTRL_COM_READ_TEST_PORT  0xE0
+#define DEF_KBD_CTRL_COM_SYSTEM_RESET    0xFE
+
+/* Vendo-Specific Commands  */
+#define DEF_KBD_CTRL_COM_READ_RAM_0x20   0x20
+#define DEF_KBD_CTRL_COM_READ_RAM_0x21   0x21
+#define DEF_KBD_CTRL_COM_READ_RAM_0x22   0x22
+#define DEF_KBD_CTRL_COM_READ_RAM_0x23   0x23
+#define DEF_KBD_CTRL_COM_READ_RAM_0x24   0x24
+#define DEF_KBD_CTRL_COM_READ_RAM_0x25   0x25
+#define DEF_KBD_CTRL_COM_READ_RAM_0x26   0x26
+#define DEF_KBD_CTRL_COM_READ_RAM_0x27   0x27
+#define DEF_KBD_CTRL_COM_READ_RAM_0x28   0x28
+#define DEF_KBD_CTRL_COM_READ_RAM_0x29   0x29
+#define DEF_KBD_CTRL_COM_READ_RAM_0x2A   0x2A
+#define DEF_KBD_CTRL_COM_READ_RAM_0x2B   0x2B
+#define DEF_KBD_CTRL_COM_READ_RAM_0x2C   0x2C
+#define DEF_KBD_CTRL_COM_READ_RAM_0x2D   0x2D
+#define DEF_KBD_CTRL_COM_READ_RAM_0x2E   0x2E
+#define DEF_KBD_CTRL_COM_READ_RAM_0x2F   0x2F
+#define DEF_KBD_CTRL_COM_READ_RAM_0x30   0x30
+#define DEF_KBD_CTRL_COM_READ_RAM_0x31   0x31
+#define DEF_KBD_CTRL_COM_READ_RAM_0x32   0x32
+#define DEF_KBD_CTRL_COM_READ_RAM_0x33   0x33
+#define DEF_KBD_CTRL_COM_READ_RAM_0x34   0x34
+#define DEF_KBD_CTRL_COM_READ_RAM_0x35   0x35
+#define DEF_KBD_CTRL_COM_READ_RAM_0x36   0x36
+#define DEF_KBD_CTRL_COM_READ_RAM_0x37   0x37
+#define DEF_KBD_CTRL_COM_READ_RAM_0x38   0x38
+#define DEF_KBD_CTRL_COM_READ_RAM_0x39   0x39
+#define DEF_KBD_CTRL_COM_READ_RAM_0x3A   0x3A
+#define DEF_KBD_CTRL_COM_READ_RAM_0x3B   0x3B
+#define DEF_KBD_CTRL_COM_READ_RAM_0x3C   0x3C
+#define DEF_KBD_CTRL_COM_READ_RAM_0x3D   0x3D
+#define DEF_KBD_CTRL_COM_READ_RAM_0x3E   0x3E
+#define DEF_KBD_CTRL_COM_READ_RAM_0x3F   0x3F
+
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x60  0x60
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x61  0x61
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x62  0x62
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x63  0x36
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x64  0x46
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x65  0x56
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x66  0x66
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x67  0x67
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x68  0x68
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x69  0x69
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x6A  0x6A
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x6B  0x6B
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x6C  0x6C
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x6D  0x6D
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x6E  0x6E
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x6F  0x6F
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x70  0x70
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x71  0x71
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x72  0x72
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x73  0x73
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x74  0x74
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x75  0x75
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x76  0x76
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x77  0x77
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x78  0x78
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x79  0x79
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x7A  0x7A
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x7B  0x7B
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x7C  0x7C
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x7D  0x7D
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x7E  0x7E
+#define DEF_KBD_CTRL_COM_WRITE_RAM_0x7F  0x7F
+
+/*Self Status Command*/
+#define DEF_KBD_CTRL_STS_SELF_TEST_OK    0x55
+#define DEF_KBD_CTRL_STS_SELF_TEST_NG    0xFC
+
+
+
+
+
+#endif
diff --git a/include/VaneOS.h b/include/VaneOS.h
new file mode 100644 (file)
index 0000000..7b91f3d
--- /dev/null
@@ -0,0 +1,233 @@
+/****************************************
+*VaneOS.h
+*Vane Operating System Common Header
+*(C) 2014 VOSystems.
+****************************************/
+
+/*INCLUDE GUARD*/
+#ifndef VANEOS_H
+#define VANEOS_H
+
+/*DEFINE COMMON*/
+typedef unsigned char  BYTE;
+typedef unsigned short WORD;
+typedef unsigned long  DWORD;
+
+#define ADR_BOOTINFO   0x00000ff0
+#define ADR_DISKIMG            0x00100000
+#define FAT_DISK_PLASE 0x00020000
+#define BPB_SECTOR             63
+#define SECTOR_SIZE            512
+
+#define EX_CHAR_SHORT(source)  (unsigned short)(*source++ <<8) | *source++
+
+typedef struct
+{
+       char bootstrap_code[3];
+       char label[8];
+       unsigned short sector_byte;
+       unsigned char clust_sector;
+       unsigned short reserved_sector;
+       unsigned char fat;
+       unsigned short root_dir_entry;
+       unsigned short sector;
+       unsigned char media_code;
+       unsigned short fat_sector;
+       unsigned short track_sector;
+       unsigned short drive_head;
+       unsigned int un_known_sector;
+       unsigned int all_sector;
+       unsigned int one_fat_sector;
+       unsigned short flag;
+       unsigned short fs_ver;
+       unsigned int root_dir_start_clust_no;
+       unsigned short fs_sys_info;
+       unsigned short back_up_sector;
+       char reserved[12];
+       unsigned char physical_drive_no;
+       char reserved2;
+       char boot_signature;
+       unsigned int volume_s_ID;
+       char volume_label[11];
+       char fs_type[8];
+}bpb_data_t;
+
+typedef struct
+{
+       unsigned int size;
+       unsigned char drive_number;
+       unsigned char drive_mode;
+       unsigned short drive_cylinders;
+       unsigned char drive_head;
+       unsigned char drive_sectors;
+}drive_info;
+
+/* fifo.c */
+struct FIFO32 {
+       int *buf;
+       int p, q, size, free, flags;
+       struct TASK *task;
+};
+struct TSS32 {
+       int backlink, esp0, ss0, esp1, ss1, esp2, ss2, cr3;
+       int eip, eflags, eax, ecx, edx, ebx, esp, ebp, esi, edi;
+       int es, cs, ss, ds, fs, gs;
+       int ldtr, iomap;
+};
+struct TASK {
+       int sel, flags; /* sel\82ÍGDT\82Ì\94Ô\8d\86\82Ì\82±\82Æ */
+       int level, priority;
+       struct FIFO32 fifo;
+       struct TSS32 tss;
+};
+
+void fifo32_init(struct FIFO32 *fifo, int size, int *buf, struct TASK *task);
+int fifo32_put(struct FIFO32 *fifo, int data);
+int fifo32_get(struct FIFO32 *fifo);
+int fifo32_status(struct FIFO32 *fifo);
+
+
+/*TYPEDEF*/
+/*GDT Segment Descriptor*/
+typedef struct
+{
+       unsigned short  limitLo;
+       unsigned short  baseLo;
+       unsigned char   baseMid;
+       unsigned short  flags;
+       unsigned char   baseHi;
+} __attribute__ ((packed)) SEGMENT_DESCRIPTOR;
+
+
+typedef struct
+{
+       unsigned short          size;
+       SEGMENT_DESCRIPTOR*     base;
+} __attribute__ ((packed)) GDTR;
+
+/*IDT*/
+typedef struct
+{
+       unsigned short  baseLo;
+       unsigned short  selector;
+       unsigned char   reserved;
+       unsigned char   flags;
+       unsigned short  baseHi;
+} __attribute__ ((packed)) GATE_DESCRIPTOR;
+
+typedef struct
+{
+       unsigned short          size;
+       GATE_DESCRIPTOR*        base;
+} __attribute__ ((packed)) IDTR;
+
+/*DEFINES*/
+/*IDT*/
+
+#define        NUM_IDT 256
+
+#define        DEF_IDT_FLAGS_INTGATE_16BIT             0x06
+#define        DEF_IDT_FLAGS_TSKGATE                   0x05
+#define        DEF_IDT_FLAGS_CALL_GATE                 0x0C
+#define        DEF_IDT_FLAGS_INTGATE_32BIT             0x0E
+#define        DEF_IDT_FLAGS_TRPGATE                   0x0F
+#define        DEF_IDT_FLAGS_DPL_LV0                   0x00
+#define        DEF_IDT_FLAGS_DPL_LV1                   0x20
+#define        DEF_IDT_FLAGS_DPL_LV2                   0x40
+#define        DEF_IDT_FLAGS_DPL_LV3                   0x60
+#define        DEF_IDT_FLAGS_PRESENT                   0x80
+#define DEF_IDT_INT_NUM_IRQ1                   33
+#define DEF_IDT_INT_NUM_IRQ0                   32
+
+#define        DEF_IDT_INT_SELECTOR                    0x08
+
+/*GDT*/
+
+#define        NUM_GDT 3
+#define        NULL_DESCRIPTOR                 0
+#define        CODE_DESCRIPTOR                 1
+#define        DATA_DESCRIPTOR                 2
+#define        TEMP_DESCRIPTOR                 3
+#define        TASK_CODE_DESCRIPTOR    3
+#define        TASK_DATA_DESCRIPTOR    4
+#define        KTSS_DESCRIPTOR                 5
+
+/* Null Descriptor             */
+#define        DEF_GDT_NULL_LIMIT              0x0000
+#define        DEF_GDT_NULL_BASELO             0x0000
+#define        DEF_GDT_NULL_BASEMID    0x00
+#define        DEF_GDT_NULL_FLAGS              0x0000
+#define        DEF_GDT_NULL_BASEHI             0x00
+
+/* Code Descriptor             */
+#define        DEF_GDT_CODE_LIMIT              0xFFFF
+#define        DEF_GDT_CODE_BASELO             0x0000
+#define        DEF_GDT_CODE_BASEMID    0x00
+#define        DEF_GDT_CODE_FLAGS_BL   0x9A
+#define        DEF_GDT_CODE_FLAGS_BH   0xCF
+#define        DEF_GDT_CODE_FLAGS              0xCF9A
+#define        DEF_GDT_CODE_BASEHI             0x00
+
+/* Data Descriptor             */
+#define        DEF_GDT_DATA_LIMIT              0xFFFF
+#define        DEF_GDT_DATA_BASELO             0x0000
+#define        DEF_GDT_DATA_BASEMID    0x00
+#define        DEF_GDT_DATA_FLAGS              0xCF92
+#define        DEF_GDT_DATA_FLAGS_BL   0x92
+#define        DEF_GDT_DATA_FLAGS_BH   0xCF
+#define        DEF_GDT_DATA_BASEHI             0x00
+
+/*PIC*/
+#define        PORT_MASTER_PIC_COMMAND 0x0020
+#define        PORT_MASTER_PIC_STATUS  0x0020
+#define        PORT_MASTER_PIC_DATA    0x0021
+#define        PORT_MASTER_PIC_IMR             0x0021
+#define        PORT_SLAVE_PIC_COMMAND  0x00A0
+#define        PORT_SLAVE_PIC_STATUS   0x00A0
+#define        PORT_SLAVE_PIC_DATA             0x00A1
+#define        PORT_SLAVE_PIC_IMR              0x00A1
+#define        PIC_ICW1                                0x11
+#define        PIC_MASTER_ICW2                 0x20
+#define        PIC_SLAVE_ICW2                  0x28
+#define        PIC_MASTER_ICW3                 0x04
+#define        PIC_SLAVE_ICW3                  0x02
+#define        PIC_MASTER_ICW4                 0x01
+#define        PIC_SLAVE_ICW4                  0x01
+/*IRQ*/
+#define        PIC_IMR_MASK_IRQ0               0x01
+#define        PIC_IMR_MASK_IRQ1               0x02
+#define        PIC_IMR_MASK_IRQ2               0x04
+#define        PIC_IMR_MASK_IRQ3               0x08
+#define        PIC_IMR_MASK_IRQ4               0x10
+#define        PIC_IMR_MASK_IRQ5               0x20
+#define        PIC_IMR_MASK_IRQ6               0x40
+#define        PIC_IMR_MASK_IRQ7               0x80
+#define        PIC_IMR_MASK_IRQ_ALL    0xFF
+
+/*PIT*/
+#define        PIT_REG_COUNTER0                        0x0040
+#define        PIT_REG_COUNTER1                        0x0041
+#define        PIT_REG_COUNTER2                        0x0042
+#define        PIT_REG_CONTROL                         0x0043
+#define        DEF_PIT_CLOCK                           1193181.67      
+#define        DEF_PIT_COM_MASK_BINCOUNT       0x01
+#define        DEF_PIT_COM_MASK_MODE           0x0E
+#define        DEF_PIT_COM_MASK_RL                     0x30
+#define        DEF_PIT_COM_MASK_COUNTER        0xC0
+#define        DEF_PIT_COM_BINCOUNT_BIN        0x00
+#define        DEF_PIT_COM_BINCOUNT_BCD        0x01
+#define        DEF_PIT_COM_MODE_TERMINAL       0x00
+#define        DEF_PIT_COM_MODE_PROGONE        0x02
+#define        DEF_PIT_COM_MODE_RATEGEN        0x04
+#define        DEF_PIT_COM_MODE_SQUAREWAVE     0x06
+#define        DEF_PIT_COM_MODE_SOFTTRIG       0x08
+#define        DEF_PIT_COM_MODE_HARDTRIG       0x0A
+#define        DEF_PIT_COM_RL_LATCH            0x00
+#define        DEF_PIT_COM_RL_LSBONLY          0x10
+#define        DEF_PIT_COM_RL_MSBONLY          0x20
+#define        DEF_PIT_COM_RL_DATA                     0x30
+#define DEF_PIT_COM_COUNTER0           0x00
+#define        DEF_PIT_COM_COUNTER1            0x40
+#define        DEF_PIT_COM_COUNTER2            0x80
+
+#endif
diff --git a/include/VaneOS.h~ b/include/VaneOS.h~
new file mode 100644 (file)
index 0000000..577dee5
--- /dev/null
@@ -0,0 +1,233 @@
+/****************************************
+*VaneOS.h
+*Vane Operating System Common Header
+*(C) 2014 VOSystems.
+****************************************/
+
+/*INCLUDE GUARD*/
+#ifndef VANEOS_H
+#define VANEOS_H
+
+/*DEFINE COMMON*/
+typedef unsigned char  BYTE;
+typedef unsigned short WORD;
+typedef unsigned long  DWORD;
+
+#define ADR_BOOTINFO   0x00000ff0
+#define ADR_DISKIMG            0x00100000
+#define FAT_DISK_PLASE 0x00020000
+#define BPB_SECTOR             63
+#define SECTOR_SIZE            512
+
+#define EX_CHAR-SHORT(source)  (unsigned short)(*source++ <<8) | *source++
+
+typedef struct
+{
+       char bootstrap_code[3];
+       char label[8];
+       unsigned short sector_byte;
+       unsigned char clust_sector;
+       unsigned short reserved_sector;
+       unsigned char fat;
+       unsigned short root_dir_entry;
+       unsigned short sector;
+       unsigned char media_code;
+       unsigned short fat_sector;
+       unsigned short track_sector;
+       unsigned short drive_head;
+       unsigned int un_known_sector;
+       unsigned int all_sector;
+       unsigned int one_fat_sector;
+       unsigned short flag;
+       unsigned short fs_ver;
+       unsigned int root_dir_start_clust_no;
+       unsigned short fs_sys_info;
+       unsigned short back_up_sector;
+       char reserved[12];
+       unsigned char physical_drive_no;
+       char reserved2;
+       char boot_signature;
+       unsigned int volume_s_ID;
+       char volume_label[11];
+       char fs_type[8];
+}bpb_data_t;
+
+typedef struct
+{
+       unsigned int size;
+       unsigned char drive_number;
+       unsigned char drive_mode;
+       unsigned short drive_cylinders;
+       unsigned char drive_head;
+       unsigned char drive_sectors;
+}drive_info;
+
+/* fifo.c */
+struct FIFO32 {
+       int *buf;
+       int p, q, size, free, flags;
+       struct TASK *task;
+};
+struct TSS32 {
+       int backlink, esp0, ss0, esp1, ss1, esp2, ss2, cr3;
+       int eip, eflags, eax, ecx, edx, ebx, esp, ebp, esi, edi;
+       int es, cs, ss, ds, fs, gs;
+       int ldtr, iomap;
+};
+struct TASK {
+       int sel, flags; /* sel\82ÍGDT\82Ì\94Ô\8d\86\82Ì\82±\82Æ */
+       int level, priority;
+       struct FIFO32 fifo;
+       struct TSS32 tss;
+};
+
+void fifo32_init(struct FIFO32 *fifo, int size, int *buf, struct TASK *task);
+int fifo32_put(struct FIFO32 *fifo, int data);
+int fifo32_get(struct FIFO32 *fifo);
+int fifo32_status(struct FIFO32 *fifo);
+
+
+/*TYPEDEF*/
+/*GDT Segment Descriptor*/
+typedef struct
+{
+       unsigned short  limitLo;
+       unsigned short  baseLo;
+       unsigned char   baseMid;
+       unsigned short  flags;
+       unsigned char   baseHi;
+} __attribute__ ((packed)) SEGMENT_DESCRIPTOR;
+
+
+typedef struct
+{
+       unsigned short          size;
+       SEGMENT_DESCRIPTOR*     base;
+} __attribute__ ((packed)) GDTR;
+
+/*IDT*/
+typedef struct
+{
+       unsigned short  baseLo;
+       unsigned short  selector;
+       unsigned char   reserved;
+       unsigned char   flags;
+       unsigned short  baseHi;
+} __attribute__ ((packed)) GATE_DESCRIPTOR;
+
+typedef struct
+{
+       unsigned short          size;
+       GATE_DESCRIPTOR*        base;
+} __attribute__ ((packed)) IDTR;
+
+/*DEFINES*/
+/*IDT*/
+
+#define        NUM_IDT 256
+
+#define        DEF_IDT_FLAGS_INTGATE_16BIT             0x06
+#define        DEF_IDT_FLAGS_TSKGATE                   0x05
+#define        DEF_IDT_FLAGS_CALL_GATE                 0x0C
+#define        DEF_IDT_FLAGS_INTGATE_32BIT             0x0E
+#define        DEF_IDT_FLAGS_TRPGATE                   0x0F
+#define        DEF_IDT_FLAGS_DPL_LV0                   0x00
+#define        DEF_IDT_FLAGS_DPL_LV1                   0x20
+#define        DEF_IDT_FLAGS_DPL_LV2                   0x40
+#define        DEF_IDT_FLAGS_DPL_LV3                   0x60
+#define        DEF_IDT_FLAGS_PRESENT                   0x80
+#define DEF_IDT_INT_NUM_IRQ1                   33
+#define DEF_IDT_INT_NUM_IRQ0                   32
+
+#define        DEF_IDT_INT_SELECTOR                    0x08
+
+/*GDT*/
+
+#define        NUM_GDT 3
+#define        NULL_DESCRIPTOR                 0
+#define        CODE_DESCRIPTOR                 1
+#define        DATA_DESCRIPTOR                 2
+#define        TEMP_DESCRIPTOR                 3
+#define        TASK_CODE_DESCRIPTOR    3
+#define        TASK_DATA_DESCRIPTOR    4
+#define        KTSS_DESCRIPTOR                 5
+
+/* Null Descriptor             */
+#define        DEF_GDT_NULL_LIMIT              0x0000
+#define        DEF_GDT_NULL_BASELO             0x0000
+#define        DEF_GDT_NULL_BASEMID    0x00
+#define        DEF_GDT_NULL_FLAGS              0x0000
+#define        DEF_GDT_NULL_BASEHI             0x00
+
+/* Code Descriptor             */
+#define        DEF_GDT_CODE_LIMIT              0xFFFF
+#define        DEF_GDT_CODE_BASELO             0x0000
+#define        DEF_GDT_CODE_BASEMID    0x00
+#define        DEF_GDT_CODE_FLAGS_BL   0x9A
+#define        DEF_GDT_CODE_FLAGS_BH   0xCF
+#define        DEF_GDT_CODE_FLAGS              0xCF9A
+#define        DEF_GDT_CODE_BASEHI             0x00
+
+/* Data Descriptor             */
+#define        DEF_GDT_DATA_LIMIT              0xFFFF
+#define        DEF_GDT_DATA_BASELO             0x0000
+#define        DEF_GDT_DATA_BASEMID    0x00
+#define        DEF_GDT_DATA_FLAGS              0xCF92
+#define        DEF_GDT_DATA_FLAGS_BL   0x92
+#define        DEF_GDT_DATA_FLAGS_BH   0xCF
+#define        DEF_GDT_DATA_BASEHI             0x00
+
+/*PIC*/
+#define        PORT_MASTER_PIC_COMMAND 0x0020
+#define        PORT_MASTER_PIC_STATUS  0x0020
+#define        PORT_MASTER_PIC_DATA    0x0021
+#define        PORT_MASTER_PIC_IMR             0x0021
+#define        PORT_SLAVE_PIC_COMMAND  0x00A0
+#define        PORT_SLAVE_PIC_STATUS   0x00A0
+#define        PORT_SLAVE_PIC_DATA             0x00A1
+#define        PORT_SLAVE_PIC_IMR              0x00A1
+#define        PIC_ICW1                                0x11
+#define        PIC_MASTER_ICW2                 0x20
+#define        PIC_SLAVE_ICW2                  0x28
+#define        PIC_MASTER_ICW3                 0x04
+#define        PIC_SLAVE_ICW3                  0x02
+#define        PIC_MASTER_ICW4                 0x01
+#define        PIC_SLAVE_ICW4                  0x01
+/*IRQ*/
+#define        PIC_IMR_MASK_IRQ0               0x01
+#define        PIC_IMR_MASK_IRQ1               0x02
+#define        PIC_IMR_MASK_IRQ2               0x04
+#define        PIC_IMR_MASK_IRQ3               0x08
+#define        PIC_IMR_MASK_IRQ4               0x10
+#define        PIC_IMR_MASK_IRQ5               0x20
+#define        PIC_IMR_MASK_IRQ6               0x40
+#define        PIC_IMR_MASK_IRQ7               0x80
+#define        PIC_IMR_MASK_IRQ_ALL    0xFF
+
+/*PIT*/
+#define        PIT_REG_COUNTER0                        0x0040
+#define        PIT_REG_COUNTER1                        0x0041
+#define        PIT_REG_COUNTER2                        0x0042
+#define        PIT_REG_CONTROL                         0x0043
+#define        DEF_PIT_CLOCK                           1193181.67      
+#define        DEF_PIT_COM_MASK_BINCOUNT       0x01
+#define        DEF_PIT_COM_MASK_MODE           0x0E
+#define        DEF_PIT_COM_MASK_RL                     0x30
+#define        DEF_PIT_COM_MASK_COUNTER        0xC0
+#define        DEF_PIT_COM_BINCOUNT_BIN        0x00
+#define        DEF_PIT_COM_BINCOUNT_BCD        0x01
+#define        DEF_PIT_COM_MODE_TERMINAL       0x00
+#define        DEF_PIT_COM_MODE_PROGONE        0x02
+#define        DEF_PIT_COM_MODE_RATEGEN        0x04
+#define        DEF_PIT_COM_MODE_SQUAREWAVE     0x06
+#define        DEF_PIT_COM_MODE_SOFTTRIG       0x08
+#define        DEF_PIT_COM_MODE_HARDTRIG       0x0A
+#define        DEF_PIT_COM_RL_LATCH            0x00
+#define        DEF_PIT_COM_RL_LSBONLY          0x10
+#define        DEF_PIT_COM_RL_MSBONLY          0x20
+#define        DEF_PIT_COM_RL_DATA                     0x30
+#define DEF_PIT_COM_COUNTER0           0x00
+#define        DEF_PIT_COM_COUNTER1            0x40
+#define        DEF_PIT_COM_COUNTER2            0x80
+
+#endif
diff --git a/include/iostream~ b/include/iostream~
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/include/memory.h b/include/memory.h
new file mode 100644 (file)
index 0000000..ab7dccd
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+
+*/
+
+#ifndef _MEMORY_H_VANE_
+#define _MEMORY_H_VANE_
+
+#define MEMMAN_FREES   4090
+#define MEMMAN_ADDR            0x003c0000
+struct FREEINFO
+{
+       unsigned int addr,size;
+};
+
+struct MEMMAN
+{
+       int frees,maxfrees,lostsize,losts;
+       struct FREEINFO free[MEMMAN_FREES];
+};
+
+void memman_init(struct MEMMAN *man);
+unsigned int memman_total(struct MEMMAN *man);
+unsigned int memman_alloc(struct MEMMAN *man,unsigned int size);
+int memman_free(struct MEMMAN *man,unsigned int addr,unsigned int size);
+unsigned int memman_alloc_4k(struct MEMMAN* man,unsigned int size);
+int memman_free_4k(struct MEMMAN* man,unsigned int addr,unsigned int size);
+#endif
diff --git a/include/memory.h~ b/include/memory.h~
new file mode 100644 (file)
index 0000000..5ac5ddd
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+
+*/
+
+#ifndef _MEMORY_H_VANE_
+#define _MEMORY_H_VANE_
+
+#define MEMMAN_FREES   4090
+#define MEMMAN_ADDR            0x003c0000
+struct FREEINFO
+{
+       unsigned int addr,size;
+};
+
+struct MEMMAN
+{
+       int frees,maxfrees,lostsize,losts;
+       struct FREEINFO free[MEMMAN_FREES];
+};
+
+void memman_init(struct MEMMAN *man);
+unsigned int memman_total(struct MEMMAN *man);
+unsigned int memman_alloc(struct MEMMAN *man,unsigned int size);
+int memman_free(struct MEMMAN *man,unsigned int addr,unsigned int size);
+
+#endif
diff --git a/include/multiboot.h b/include/multiboot.h
new file mode 100644 (file)
index 0000000..0bb8e02
--- /dev/null
@@ -0,0 +1,223 @@
+/*  multiboot.h - Multiboot header file.  */
+/*  Copyright (C) 1999,2003,2007,2008,2009  Free Software Foundation, Inc.
+ *
+ *  Permission is hereby granted, free of charge, to any person obtaining a copy
+ *  of this software and associated documentation files (the "Software"), to
+ *  deal in the Software without restriction, including without limitation the
+ *  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ *  sell copies of the Software, and to permit persons to whom the Software is
+ *  furnished to do so, subject to the following conditions:
+ *
+ *  The above copyright notice and this permission notice shall be included in
+ *  all copies or substantial portions of the Software.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL ANY
+ *  DEVELOPER OR DISTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ *  IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef MULTIBOOT_HEADER
+#define MULTIBOOT_HEADER 1
+
+/* How many bytes from the start of the file we search for the header.  */
+#define MULTIBOOT_SEARCH                               8192
+
+/* The magic field should contain this.  */
+#define MULTIBOOT_HEADER_MAGIC                 0x1BADB002
+
+/* This should be in %eax.  */
+#define MULTIBOOT_BOOTLOADER_MAGIC             0x2BADB002
+
+/* The bits in the required part of flags field we don't support.  */
+#define MULTIBOOT_UNSUPPORTED                  0x0000fffc
+
+/* Alignment of multiboot modules.  */
+#define MULTIBOOT_MOD_ALIGN                    0x00001000
+
+/* Alignment of the multiboot info structure.  */
+#define MULTIBOOT_INFO_ALIGN                   0x00000004
+
+/* Flags set in the 'flags' member of the multiboot header.  */
+
+/* Align all boot modules on i386 page (4KB) boundaries.  */
+#define MULTIBOOT_PAGE_ALIGN                   0x00000001
+
+/* Must pass memory information to OS.  */
+#define MULTIBOOT_MEMORY_INFO                  0x00000002
+
+/* Must pass video information to OS.  */
+#define MULTIBOOT_VIDEO_MODE                   0x00000004
+
+/* This flag indicates the use of the address fields in the header.  */
+#define MULTIBOOT_AOUT_KLUDGE                  0x00010000
+
+/* Flags to be set in the 'flags' member of the multiboot info structure.  */
+
+/* is there basic lower/upper memory information? */
+#define MULTIBOOT_INFO_MEMORY                  0x00000001
+/* is there a boot device set? */
+#define MULTIBOOT_INFO_BOOTDEV                 0x00000002
+/* is the command-line defined? */
+#define MULTIBOOT_INFO_CMDLINE                 0x00000004
+/* are there modules to do something with? */
+#define MULTIBOOT_INFO_MODS                    0x00000008
+
+/* These next two are mutually exclusive */
+
+/* is there a symbol table loaded? */
+#define MULTIBOOT_INFO_AOUT_SYMS               0x00000010
+/* is there an ELF section header table? */
+#define MULTIBOOT_INFO_ELF_SHDR                        0X00000020
+
+/* is there a full memory map? */
+#define MULTIBOOT_INFO_MEM_MAP                 0x00000040
+
+/* Is there drive info?  */
+#define MULTIBOOT_INFO_DRIVE_INFO              0x00000080
+
+/* Is there a config table?  */
+#define MULTIBOOT_INFO_CONFIG_TABLE            0x00000100
+
+/* Is there a boot loader name?  */
+#define MULTIBOOT_INFO_BOOT_LOADER_NAME                0x00000200
+
+/* Is there a APM table?  */
+#define MULTIBOOT_INFO_APM_TABLE               0x00000400
+
+/* Is there video information?  */
+#define MULTIBOOT_INFO_VIDEO_INFO              0x00000800
+
+#ifndef ASM_FILE
+
+typedef unsigned short         multiboot_uint16_t;
+typedef unsigned int           multiboot_uint32_t;
+typedef unsigned long long     multiboot_uint64_t;
+
+struct multiboot_header
+{
+  /* Must be MULTIBOOT_MAGIC - see above.  */
+  multiboot_uint32_t magic;
+
+  /* Feature flags.  */
+  multiboot_uint32_t flags;
+
+  /* The above fields plus this one must equal 0 mod 2^32. */
+  multiboot_uint32_t checksum;
+
+  /* These are only valid if MULTIBOOT_AOUT_KLUDGE is set.  */
+  multiboot_uint32_t header_addr;
+  multiboot_uint32_t load_addr;
+  multiboot_uint32_t load_end_addr;
+  multiboot_uint32_t bss_end_addr;
+  multiboot_uint32_t entry_addr;
+
+  /* These are only valid if MULTIBOOT_VIDEO_MODE is set.  */
+  multiboot_uint32_t mode_type;
+  multiboot_uint32_t width;
+  multiboot_uint32_t height;
+  multiboot_uint32_t depth;
+};
+
+/* The symbol table for a.out.  */
+struct multiboot_aout_symbol_table
+{
+  multiboot_uint32_t tabsize;
+  multiboot_uint32_t strsize;
+  multiboot_uint32_t addr;
+  multiboot_uint32_t reserved;
+};
+typedef struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t;
+
+/* The section header table for ELF.  */
+struct multiboot_elf_section_header_table
+{
+  multiboot_uint32_t num;
+  multiboot_uint32_t size;
+  multiboot_uint32_t addr;
+  multiboot_uint32_t shndx;
+};
+typedef struct multiboot_elf_section_header_table multiboot_elf_section_header_table_t;
+
+struct multiboot_info
+{
+  /* Multiboot info version number */
+  multiboot_uint32_t flags;
+
+  /* Available memory from BIOS */
+  multiboot_uint32_t mem_lower;
+  multiboot_uint32_t mem_upper;
+
+  /* "root" partition */
+  multiboot_uint32_t boot_device;
+
+  /* Kernel command line */
+  multiboot_uint32_t cmdline;
+
+  /* Boot-Module list */
+  multiboot_uint32_t mods_count;
+  multiboot_uint32_t mods_addr;
+
+  union
+  {
+    multiboot_aout_symbol_table_t aout_sym;
+    multiboot_elf_section_header_table_t elf_sec;
+  } u;
+
+  /* Memory Mapping buffer */
+  multiboot_uint32_t mmap_length;
+  multiboot_uint32_t mmap_addr;
+
+  /* Drive Info buffer */
+  multiboot_uint32_t drives_length;
+  multiboot_uint32_t drives_addr;
+
+  /* ROM configuration table */
+  multiboot_uint32_t config_table;
+
+  /* Boot Loader Name */
+  multiboot_uint32_t boot_loader_name;
+
+  /* APM table */
+  multiboot_uint32_t apm_table;
+
+  /* Video */
+  multiboot_uint32_t vbe_control_info;
+  multiboot_uint32_t vbe_mode_info;
+  multiboot_uint16_t vbe_mode;
+  multiboot_uint16_t vbe_interface_seg;
+  multiboot_uint16_t vbe_interface_off;
+  multiboot_uint16_t vbe_interface_len;
+};
+typedef struct multiboot_info multiboot_info_t;
+
+struct multiboot_mmap_entry
+{
+  multiboot_uint32_t size;
+  multiboot_uint64_t addr;
+  multiboot_uint64_t len;
+#define MULTIBOOT_MEMORY_AVAILABLE             1
+#define MULTIBOOT_MEMORY_RESERVED              2
+  multiboot_uint32_t type;
+} __attribute__((packed));
+typedef struct multiboot_mmap_entry multiboot_memory_map_t;
+
+struct multiboot_mod_list
+{
+  /* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
+  multiboot_uint32_t mod_start;
+  multiboot_uint32_t mod_end;
+
+  /* Module command line */
+  multiboot_uint32_t cmdline;
+
+  /* padding to take it to 16 bytes (must be zero) */
+  multiboot_uint32_t pad;
+};
+typedef struct multiboot_mod_list multiboot_module_t;
+
+#endif /* ! ASM_FILE */
+
+#endif /* ! MULTIBOOT_HEADER */
diff --git a/include/multiboot.h~ b/include/multiboot.h~
new file mode 100644 (file)
index 0000000..7dd52a0
--- /dev/null
@@ -0,0 +1,69 @@
+#ifndef MULTIBOOT_HEADER
+#define MULTIBOOT_HEADER 1
+     
+#define MULTIBOOT_SEARCH                        8192     
+#define MULTIBOOT_HEADER_MAGIC                  0x1BADB002     
+#define MULTIBOOT_BOOTLOADER_MAGIC              0x2BADB002     
+#define MULTIBOOT_UNSUPPORTED                   0x0000fffc     
+#define MULTIBOOT_MOD_ALIGN                     0x00001000     
+#define MULTIBOOT_INFO_ALIGN                    0x00000004     
+#define MULTIBOOT_PAGE_ALIGN                    0x00000001     
+#define MULTIBOOT_MEMORY_INFO                   0x00000002     
+#define MULTIBOOT_VIDEO_MODE                    0x00000004     
+#define MULTIBOOT_AOUT_KLUDGE                   0x00010000
+#define MULTIBOOT_INFO_MEMORY                   0x00000001
+#define MULTIBOOT_INFO_BOOTDEV                  0x00000002
+#define MULTIBOOT_INFO_CMDLINE                  0x00000004
+#define MULTIBOOT_INFO_MODS                     0x00000008
+#define MULTIBOOT_INFO_AOUT_SYMS                0x00000010
+#define MULTIBOOT_INFO_ELF_SHDR                 0X00000020  
+#define MULTIBOOT_INFO_MEM_MAP                  0x00000040
+#define MULTIBOOT_INFO_DRIVE_INFO               0x00000080
+#define MULTIBOOT_INFO_CONFIG_TABLE             0x00000100 
+#define MULTIBOOT_INFO_BOOT_LOADER_NAME         0x00000200
+#define MULTIBOOT_INFO_APM_TABLE                0x00000400
+#define MULTIBOOT_INFO_VIDEO_INFO               0x00000800
+  
+#ifndef ASM_FILE
+     
+#define MULTIBOOT_HEADER_MAGIC          0x1BADB002
+#define MULTIBOOT_HEADER_FLAGS          0x00000000
+#define MULTIBOOT_HEADER_CHECKSUM       -(MULTIBOOT_HEADER_MAGIC+MULTIBOOT_HEADER_FLAGS)
+#define KERNEL_STACK_SIZE               0x100000
+
+#define MULTIBOOT_BOOTLOADER_MAGIC      0x2BADB002
+
+
+typedef struct mbi_info {
+  unsigned long flags;
+  unsigned long mem_lower;
+  unsigned long mem_upper;
+  unsigned long boot_device;
+  unsigned long cmdline;
+  unsigned long mods_count;
+  unsigned long mods_addr;
+
+  // The section header table for ELF
+  unsigned long num;
+  unsigned long size;
+  unsigned long addr;
+  unsigned long shndx;
+
+  unsigned long mmap_length;
+  unsigned long mmap_addr;
+} __attribute__((__packed__)) mbi_t;
+
+// The memory map
+typedef struct memory_map {
+  unsigned long size;
+  unsigned long base_addr_low;
+  unsigned long base_addr_high;
+  unsigned long length_low;
+  unsigned long length_high;
+  unsigned long type;
+} __attribute__((__packed__)) memory_map;
+     
+#endif /* ! ASM_FILE */
+     
+#endif /* ! MULTIBOOT_HEADER */
+
diff --git a/include/scancode.h b/include/scancode.h
new file mode 100644 (file)
index 0000000..4e1d0d6
--- /dev/null
@@ -0,0 +1,253 @@
+/*
+
+*/
+
+#ifndef _SCANCODE_H_VANE_
+#define _SCANCODE_H_VANE_
+
+char Generate_Scancode_To_ASCII_Code(void);
+
+/*Flag Code*/
+#define BREAK_FLAG 0xf0
+#define SPECIAL_FLAG 0xe0
+
+#define BREAK_NORMAL(make_code) (make_code + 0x80)
+/*Common*/
+#define SC_A   0x1e
+#define SC_B   0x30
+#define SC_C   0x2e
+#define SC_D   0x20
+#define SC_E   0x12
+#define SC_F   0x21
+#define SC_G   0x22
+#define SC_H   0x23
+#define SC_I   0x17
+#define SC_J   0x24
+#define SC_K   0x25
+#define SC_L   0x26
+#define SC_M   0x32
+#define SC_N   0x31
+#define SC_O   0x18
+#define SC_P   0x19
+#define SC_Q   0x10
+#define SC_R   0x13
+#define SC_S   0x1f
+#define SC_T   0x14
+#define SC_U   0x16
+#define SC_V   0x2f
+#define SC_W   0x11
+#define SC_X   0x2d
+#define SC_Y   0x15
+#define SC_Z   0x15
+
+#define SC_0   0x0b
+#define SC_1   0x02
+#define SC_2   0x03
+#define SC_3   0x04
+#define SC_4   0x05
+#define SC_5   0x06
+#define SC_6   0x07
+#define SC_7   0x08
+#define SC_8   0x09
+#define SC_9   0x0a
+
+#define SC_ZEN_HAN_KAKU        0x29
+#define SC_ECOAL               0x0c
+#define SC_TILDA               0x0d
+#define SC_YEN                 0x7d
+#define SC_GAUS_RIGHT  0x2b
+#define SC_BS                  0x0e
+#define SC_SP                  0x39
+#define SC_TB                  0xof
+#define SC_CAPS                        0x3a
+#define SC_LEFT_SHIFT  0x2a
+#define SC_LEFT_CTRL   0x1d
+#define SC_LEFT_ALT            0x38
+#define SC_RIGHT_SHIFT 0x36
+
+#define SC_ENTER               0x1c
+#define SC_ESC                 0x01
+
+#define SC_F1  0x3b
+#define SC_F2  0x3c
+#define SC_F3  0x3d
+#define SC_F4  0x3e
+#define SC_F5  0x3f
+#define SC_F6  0x40
+#define SC_F7  0x41
+#define SC_F8  0x42
+#define SC_F9  0x43
+#define SC_F10 0x44
+#define SC_F11 0x57
+#define SC_F12 0x58
+
+#define SC_SCR         0x46
+#define SC_AT_MARK     0x9a
+
+#define SC_NUM_LOCK            0x45
+#define SC_NUM_KEY_AST 0x37
+#define SC_NUM_KEY_MINUS       0x4a
+#define SC_NUM_KEY_PLUS        0x79
+#define SC_NUM_KEY_PIRIOD      0x53
+#define SC_NUM_KEY_0           0x52
+#define SC_NUM_KEY_1           0x4f
+#define SC_NUM_KEY_2           0x50
+#define SC_NUM_KEY_3           0x51
+#define SC_NUM_KEY_4           0x4b
+#define SC_NUM_KEY_5           0x4c
+#define SC_NUM_KEY_6           0x4d
+#define SC_NUM_KEY_7           0x47
+#define SC_NUM_KEY_8           0x48
+#define SC_NUM_KEY_9           0x49
+
+#define SC_GAUS_LEFT                   0x1b
+#define SC_SEMI_COLON                  0x27
+#define SC_COMMA                               0x28
+#define SC_PILIOD                              0x33
+#define SC_SLASH                               0x34
+#define SC_MUHENNKANN                  0x35
+#define SC_HENNKANN                            0x7b
+#define SC_KATAKANA_HIRAGANA   0x79
+
+
+/*Break*/
+#define BREAK_LEFT_WIN         0xe0f01f
+#define BREAK_RIGHT_CTRL       0xe0f014
+#define BREAK_RIGHT_WIN                0xe0f027
+#define BREAK_RIGHT_ALT                0xe0f011
+#define BREAK_APP                      0xe0f02f
+
+#define BREAK_PRISC                                                    0xe0f012e0f07c
+#define BREAK_PAUSE                                                    0xe1f01477e1f0f014f077
+#define BREAK_INSERT                                           0xe0f070
+#define BREAK_HOME                                                     0xe0f06c
+#define BREAK_PAGE_UP                                          0xe0f07d
+#define BREAK_DEL                                                      0xe0f071
+#define BREAK_END                                                      0xe0f075
+#define BREAK_PAGE_DOWN                                                0xe0f07a
+#define BREAK_ARROW_UP                                         0xe0f075
+#define BREAK_ARROW_LEFT                                       0xe0f06b
+#define BREAK_ARROW_DOWN                                       0xe0f072
+#define BREAK_ARROW_RIGHT                                      0xe0f074
+
+#define BREAK_NUM_LOCK_AND_INS                         0xe0f070e0f012
+#define BREAK_NUM_LOCK_AND_HOME                                0xe0f006e0f012
+#define BREAK_NUM_LOCK_AND_PAGE_UP                     0xe0f07de0f012
+#define BREAK_NUM_LOCK_AND_DEL                         0xe0f071e0f012
+#define BREAK_NUM_LOCK_AND_END                         0xe0f069e0f012
+#define BREAK_NUM_LOCK_AND_PAGE_DOWN           0xe0f07ae0f012
+#define BREAK_NUM_LOCK_AND_ARROW_UP                    0xe0f075e0f012
+#define BREAK_NUM_LOCK_AND_ARROW_LEFT          0xe0f06be0f012
+#define BREAK_NUM_LOCK_AND_ARROW_DOWN          0xe0f072e0f012
+#define BREAK_NUM_LOCK_AND_ARROW_RIGHT         0xe0f074e0f012
+
+#define BREAK_LEFT_SHIFT_AND_INS                       0xe0f070e012
+#define BREAK_LEFT_SHIFT_AND_HOME                      0xe0f06ce012
+#define BREAK_LEFT_SHIFT_AND_PAGE_UP           0xe0f07de012
+#define BREAK_LEFT_SHIFT_AND_DEL                       0xe0f071e012
+#define BREAK_LEFT_SHIFT_AND_END                       0xe0f069e012
+#define BREAK_LEFT_SHIFT_AND_PAGE_DOWN         0xe0f07ae012
+#define BREAK_LEFT_SHIFT_AND_ARROW_UP          0xe0f075e012
+#define BREAK_LEFT_SHIFT_AND_ARROW_LEFT                0xe0f06be012
+#define BREAK_LEFT_SHIFT_AND_ARROW_DOWN                0xe0f072e012
+#define BREAK_LEFT_SHIFT_AND_ARROW_RIGHT       0xe0f074e012
+
+#define BREAK_RIGHT_SHIFT_AND_INS                      0xe0f070e059
+#define BREAK_RIGHT_SHIFT_AND_HOME                     0xe0f06ce059
+#define BREAK_RIGHT_SHIFT_AND_PAGE_UP          0xe0f07de059
+#define BREAK_RIGHT_SHIFT_AND_DEL                      0xe0f071e059
+#define BREAK_RIGHT_SHIFT_AND_END                      0xe0f069e059
+#define BREAK_RIGHT_SHIFT_AND_PAGE_DOWN                0xe0f07ae059
+#define BREAK_RIGHT_SHIFT_AND_ARROW_UP         0xe0f075e059
+#define BREAK_RIGHT_SHIFT_AND_ARROW_LEFT       0xe0f06be059
+#define BREAK_RIGHT_SHIFT_AND_ARROW_DOWN       0xe0f072e059
+#define BREAK_RIGHT_SHIFT_AND_ARROW_RIGHT      0xe0f074e059
+
+#define BREAK_LR_SHIFT_AND_INS                 0xe0f070e059e012
+#define BREAK_LR_SHIFT_AND_HOME                        0xe0f06ce059e012
+#define BREAK_LR_SHIFT_AND_PAGE_UP             0xe0f07de059e012
+#define BREAK_LR_SHIFT_AND_DEL                 0xe0f071e059e012
+#define BREAK_LR_SHIFT_AND_END                 0xe0f069e059e012
+#define BREAK_LR_SHIFT_AND_PAGE_DOWN   0xe0f07ae059e012
+#define BREAK_LR_SHIFT_AND_ARROW_UP            0xe0f075e059e012
+#define BREAK_LR_SHIFT_AND_ARROW_LEFT  0xe0f06be059e012
+#define BREAK_LR_SHIFT_AND_ARROW_DOWN  0xe0f072e059e012
+#define BREAK_LR_SHIFT_AND_ARROW_RIGHT 0xe0f074e059e012
+
+#define BREAK_NUM_KEY_SLASH            0xe0f04a
+#define BREAK_NUM_KEY_LEFT_SHIFT_AND_SLASH             0xe0f04ae012
+#define BREAK_NUM_KEY_RIGHT_SHIFT_AND_SLASH            0xe0f04ae059
+#define BREAK_NUM_KEY_LR_SHIFT_AND_SLASH               0xe0f04ae059e012
+
+
+/*Make*/
+#define MAKE_RIGHT_CTRL                0xe014
+#define MAKE_RIGHT_WIN         0xe027
+#define MAKE_RIGHT_ALT         0xe011
+#define MAKE_APP                       0xe02f
+
+#define MAKE_LEFT_WIN          0xe01f
+#define MAKE_PRISC                     0xe012e07c
+#define MAKE_PAUSE                     0xe11477e1f014f077
+#define MAKE_INSERT                    0xe070
+#define MAKE_HOME                      0xe06c
+#define MAKE_PAGE_UP           0xe07d
+#define MAKE_DEL                       0xe071
+#define MAKE_END                       0xe075
+#define MAKE_PAGE_DOWN         0xe07a
+#define MAKE_ARROW_UP          0xe075
+#define MAKE_ARROW_LEFT                0xe06b
+#define MAKE_ARROW_DOWN                0xe072
+#define MAKE_ARROW_RIGHT       0xe074
+
+#define MAKE_NUM_LOCK_AND_INS                  0xe012e070
+#define MAKE_NUM_LOCK_AND_HOME                 0xe012e06c
+#define MAKE_NUM_LOCK_AND_PAGE_UP              0xe012e07d
+#define MAKE_NUM_LOCK_AND_DEL                  0xe012e071
+#define MAKE_NUM_LOCK_AND_END                  0xe012e069
+#define MAKE_NUM_LOCK_AND_PAGE_DOWN            0xe012e07a
+#define MAKE_NUM_LOCK_AND_ARROW_UP             0xe012e075
+#define MAKE_NUM_LOCK_AND_ARROW_LEFT   0xe012e06b
+#define MAKE_NUM_LOCK_AND_ARROW_DOWN   0xe012e072
+#define MAKE_NUM_LOCK_AND_ARROW_RIGHT  0xe012e074
+
+#define MAKE_LEFT_SHIFT_AND_INS                        0xe0f012e070
+#define MAKE_LEFT_SHIFT_AND_HOME               0xe0f012e06c
+#define MAKE_LEFT_SHIFT_AND_PAGE_UP            0xe0f012e07d
+#define MAKE_LEFT_SHIFT_AND_DEL                        0xe0f012e071
+#define MAKE_LEFT_SHIFT_AND_END                        0xe0f012e069
+#define MAKE_LEFT_SHIFT_AND_PAGE_DOWN  0xe0f012e07a
+#define MAKE_LEFT_SHIFT_AND_ARROW_UP   0xe0f012e075
+#define MAKE_LEFT_SHIFT_AND_ARROW_LEFT 0xe0f012e06b
+#define MAKE_LEFT_SHIFT_AND_ARROW_DOWN 0xe0f012e072
+#define MAKE_LEFT_SHIFT_AND_ARROW_RIGHT        0xe0f012e074
+
+#define MAKE_RIGHT_SHIFT_AND_INS                       0xe0f059e070
+#define MAKE_RIGHT_SHIFT_AND_HOME                      0xe0f059e06c
+#define MAKE_RIGHT_SHIFT_AND_PAGE_UP           0xe0f059e07d
+#define MAKE_RIGHT_SHIFT_AND_DEL                       0xe0f059e071
+#define MAKE_RIGHT_SHIFT_AND_END                       0xe0f059e069
+#define MAKE_RIGHT_SHIFT_AND_PAGE_DOWN         0xe0f059e07a
+#define MAKE_RIGHT_SHIFT_AND_ARROW_UP          0xe0f059e075
+#define MAKE_RIGHT_SHIFT_AND_ARROW_LEFT                0xe0f059e06b
+#define MAKE_RIGHT_SHIFT_AND_ARROW_DOWN                0xe0f059e072
+#define MAKE_RIGHT_SHIFT_AND_ARROW_RIGHT       0xe0f059e074
+
+#define MAKE_LR_SHIFT_AND_INS                  0xe0f012e0f059e070
+#define MAKE_LR_SHIFT_AND_HOME                 0xe0f012e0f059e06c
+#define MAKE_LR_SHIFT_AND_PAGE_UP              0xe0f012e0f059e07d
+#define MAKE_LR_SHIFT_AND_DEL                  0xe0f012e0f059e071
+#define MAKE_LR_SHIFT_AND_END                  0xe0f012e0f059e069
+#define MAKE_LR_SHIFT_AND_PAGE_DOWN            0xe0f012e0f059e07a
+#define MAKE_LR_SHIFT_AND_ARROW_UP             0xe0f012e0f059e075
+#define MAKE_LR_SHIFT_AND_ARROW_LEFT   0xe0f012e0f059e06b
+#define MAKE_LR_SHIFT_AND_ARROW_DOWN   0xe0f012e0f059e072
+#define MAKE_LR_SHIFT_AND_ARROW_RIGHT  0xe0f012e0f059e074
+#define MAKE_NUM_KEY_SLASH     0xe04a
+#define MAKE_NUM_KEY_LEFT_SHIFT_AND_SLASH      0xe0f012e04a
+#define MAKE_NUM_KEY_RIGHT_SHIFT_AND_SLASH     0xe0f059e04a
+#define MAKE_NUM_KEY_LR_SHIFT_AND_SLASH                0xe0f012e0f059e04a
+#define MAKE_NUM_KEY_ENTER     0xe05a
+
+
+#endif
diff --git a/include/scancode.h~ b/include/scancode.h~
new file mode 100644 (file)
index 0000000..5854bca
--- /dev/null
@@ -0,0 +1,252 @@
+/*
+
+*/
+
+#ifndef _SCANCODE_H_VANE_
+#define _SCANCODE_H_VANE_
+
+char Generate_Scancode_To_ASCII_Code(void);
+
+/*Flag Code*/
+#define BREAK_FLAG 0xf0
+#define SPECIAL_FLAG 0xe0
+
+/*Common*/
+#define SC_A   0x1c
+#define SC_B   0x32
+#define SC_C   0x21
+#define SC_D   0x23
+#define SC_E   0x24
+#define SC_F   0x2b
+#define SC_G   0x34
+#define SC_H   0x33
+#define SC_I   0x43
+#define SC_J   0x3b
+#define SC_K   0x42
+#define SC_L   0x4b
+#define SC_M   0x3a
+#define SC_N   0x31
+#define SC_O   0x44
+#define SC_P   0x4d
+#define SC_Q   0x15
+#define SC_R   0x2d
+#define SC_S   0x1b
+#define SC_T   0x2c
+#define SC_U   0x3c
+#define SC_V   0x2a
+#define SC_W   0x1d
+#define SC_X   0x22
+#define SC_Y   0x35
+#define SC_Z   0x1a
+
+#define SC_0   0x45
+#define SC_1   0x16
+#define SC_2   0x1e
+#define SC_3   0x26
+#define SC_4   0x25
+#define SC_5   0x2e
+#define SC_6   0x36
+#define SC_7   0x3d
+#define SC_8   0x3e
+#define SC_9   0x46
+
+#define SC_ZEN_HAN_KAKU        0x0e
+#define SC_ECOAL                       0x4e
+#define SC_TILDA                       0x55
+#define SC_YEN                 0x51
+#define SC_GAUS_RIGHT          0x5d
+#define SC_BS                          0x66
+#define SC_SP                          0x29
+#define SC_TB                          0x0d
+#define SC_CAPS                        0x58
+#define SC_LEFT_SHIFT          0x12
+#define SC_LEFT_CTRL           0x14
+#define SC_LEFT_ALT            0x11
+#define SC_RIGHT_SHIFT 0x59
+
+#define SC_ENTER                       0x5a
+#define SC_ESC                 0x76
+
+#define SC_F1  0x05
+#define SC_F2  0x06
+#define SC_F3  0x04
+#define SC_F4  0x0c
+#define SC_F5  0x03
+#define SC_F6  0x0b
+#define SC_F7  0x83
+#define SC_F8  0x0a
+#define SC_F9  0x01
+#define SC_F10 0x09
+#define SC_F11 0x78
+#define SC_F12 0x07
+
+#define SC_SCR                                         0x7e
+#define SC_AT_MARK                                     0x54//move
+
+#define SC_NUM_LOCK            0x77
+#define SC_NUM_KEY_AST 0x7c
+#define SC_NUM_KEY_MINUS       0x7b
+#define SC_NUM_KEY_PLUS        0x79
+#define SC_NUM_KEY_PIRIOD      0x71
+#define SC_NUM_KEY_0           0x70
+#define SC_NUM_KEY_1           0x69
+#define SC_NUM_KEY_2           0x72
+#define SC_NUM_KEY_3           0x7a
+#define SC_NUM_KEY_4           0x6b
+#define SC_NUM_KEY_5           0x73
+#define SC_NUM_KEY_6           0x74
+#define SC_NUM_KEY_7           0x6c
+#define SC_NUM_KEY_8           0x75
+#define SC_NUM_KEY_9           0x7d
+
+#define SC_GAUS_LEFT           0x5b
+#define SC_SEMI_COLON          0x4c
+#define SC_COMMA                       0x52
+#define SC_PILIOD                      0x41
+#define SC_SLASH                       0x49
+#define SC_MUHENNKANN          0x67
+#define SC_HENNKANN                    0x64
+#define SC_KATAKANA_HIRAGANA   0x13
+
+
+/*Break*/
+#define BREAK_LEFT_WIN         0xe0f01f
+#define BREAK_RIGHT_CTRL       0xe0f014
+#define BREAK_RIGHT_WIN                0xe0f027
+#define BREAK_RIGHT_ALT                0xe0f011
+#define BREAK_APP                      0xe0f02f
+
+#define BREAK_PRISC                                                    0xe0f012e0f07c
+#define BREAK_PAUSE                                                    0xe1f01477e1f0f014f077
+#define BREAK_INSERT                                           0xe0f070
+#define BREAK_HOME                                                     0xe0f06c
+#define BREAK_PAGE_UP                                          0xe0f07d
+#define BREAK_DEL                                                      0xe0f071
+#define BREAK_END                                                      0xe0f075
+#define BREAK_PAGE_DOWN                                                0xe0f07a
+#define BREAK_ARROW_UP                                         0xe0f075
+#define BREAK_ARROW_LEFT                                       0xe0f06b
+#define BREAK_ARROW_DOWN                                       0xe0f072
+#define BREAK_ARROW_RIGHT                                      0xe0f074
+
+#define BREAK_NUM_LOCK_AND_INS                         0xe0f070e0f012
+#define BREAK_NUM_LOCK_AND_HOME                                0xe0f006e0f012
+#define BREAK_NUM_LOCK_AND_PAGE_UP                     0xe0f07de0f012
+#define BREAK_NUM_LOCK_AND_DEL                         0xe0f071e0f012
+#define BREAK_NUM_LOCK_AND_END                         0xe0f069e0f012
+#define BREAK_NUM_LOCK_AND_PAGE_DOWN           0xe0f07ae0f012
+#define BREAK_NUM_LOCK_AND_ARROW_UP                    0xe0f075e0f012
+#define BREAK_NUM_LOCK_AND_ARROW_LEFT          0xe0f06be0f012
+#define BREAK_NUM_LOCK_AND_ARROW_DOWN          0xe0f072e0f012
+#define BREAK_NUM_LOCK_AND_ARROW_RIGHT         0xe0f074e0f012
+
+#define BREAK_LEFT_SHIFT_AND_INS                       0xe0f070e012
+#define BREAK_LEFT_SHIFT_AND_HOME                      0xe0f06ce012
+#define BREAK_LEFT_SHIFT_AND_PAGE_UP           0xe0f07de012
+#define BREAK_LEFT_SHIFT_AND_DEL                       0xe0f071e012
+#define BREAK_LEFT_SHIFT_AND_END                       0xe0f069e012
+#define BREAK_LEFT_SHIFT_AND_PAGE_DOWN         0xe0f07ae012
+#define BREAK_LEFT_SHIFT_AND_ARROW_UP          0xe0f075e012
+#define BREAK_LEFT_SHIFT_AND_ARROW_LEFT                0xe0f06be012
+#define BREAK_LEFT_SHIFT_AND_ARROW_DOWN                0xe0f072e012
+#define BREAK_LEFT_SHIFT_AND_ARROW_RIGHT       0xe0f074e012
+
+#define BREAK_RIGHT_SHIFT_AND_INS                      0xe0f070e059
+#define BREAK_RIGHT_SHIFT_AND_HOME                     0xe0f06ce059
+#define BREAK_RIGHT_SHIFT_AND_PAGE_UP          0xe0f07de059
+#define BREAK_RIGHT_SHIFT_AND_DEL                      0xe0f071e059
+#define BREAK_RIGHT_SHIFT_AND_END                      0xe0f069e059
+#define BREAK_RIGHT_SHIFT_AND_PAGE_DOWN                0xe0f07ae059
+#define BREAK_RIGHT_SHIFT_AND_ARROW_UP         0xe0f075e059
+#define BREAK_RIGHT_SHIFT_AND_ARROW_LEFT       0xe0f06be059
+#define BREAK_RIGHT_SHIFT_AND_ARROW_DOWN       0xe0f072e059
+#define BREAK_RIGHT_SHIFT_AND_ARROW_RIGHT      0xe0f074e059
+
+#define BREAK_LR_SHIFT_AND_INS                 0xe0f070e059e012
+#define BREAK_LR_SHIFT_AND_HOME                        0xe0f06ce059e012
+#define BREAK_LR_SHIFT_AND_PAGE_UP             0xe0f07de059e012
+#define BREAK_LR_SHIFT_AND_DEL                 0xe0f071e059e012
+#define BREAK_LR_SHIFT_AND_END                 0xe0f069e059e012
+#define BREAK_LR_SHIFT_AND_PAGE_DOWN   0xe0f07ae059e012
+#define BREAK_LR_SHIFT_AND_ARROW_UP            0xe0f075e059e012
+#define BREAK_LR_SHIFT_AND_ARROW_LEFT  0xe0f06be059e012
+#define BREAK_LR_SHIFT_AND_ARROW_DOWN  0xe0f072e059e012
+#define BREAK_LR_SHIFT_AND_ARROW_RIGHT 0xe0f074e059e012
+
+#define BREAK_NUM_KEY_SLASH            0xe0f04a
+#define BREAK_NUM_KEY_LEFT_SHIFT_AND_SLASH             0xe0f04ae012
+#define BREAK_NUM_KEY_RIGHT_SHIFT_AND_SLASH            0xe0f04ae059
+#define BREAK_NUM_KEY_LR_SHIFT_AND_SLASH               0xe0f04ae059e012
+
+
+/*Make*/
+#define MAKE_RIGHT_CTRL                0xe014
+#define MAKE_RIGHT_WIN         0xe027
+#define MAKE_RIGHT_ALT         0xe011
+#define MAKE_APP                       0xe02f
+
+#define MAKE_LEFT_WIN          0xe01f
+#define MAKE_PRISC                     0xe012e07c
+#define MAKE_PAUSE                     0xe11477e1f014f077
+#define MAKE_INSERT                    0xe070
+#define MAKE_HOME                      0xe06c
+#define MAKE_PAGE_UP           0xe07d
+#define MAKE_DEL                       0xe071
+#define MAKE_END                       0xe075
+#define MAKE_PAGE_DOWN         0xe07a
+#define MAKE_ARROW_UP          0xe075
+#define MAKE_ARROW_LEFT                0xe06b
+#define MAKE_ARROW_DOWN                0xe072
+#define MAKE_ARROW_RIGHT       0xe074
+
+#define MAKE_NUM_LOCK_AND_INS                  0xe012e070
+#define MAKE_NUM_LOCK_AND_HOME                 0xe012e06c
+#define MAKE_NUM_LOCK_AND_PAGE_UP              0xe012e07d
+#define MAKE_NUM_LOCK_AND_DEL                  0xe012e071
+#define MAKE_NUM_LOCK_AND_END                  0xe012e069
+#define MAKE_NUM_LOCK_AND_PAGE_DOWN            0xe012e07a
+#define MAKE_NUM_LOCK_AND_ARROW_UP             0xe012e075
+#define MAKE_NUM_LOCK_AND_ARROW_LEFT   0xe012e06b
+#define MAKE_NUM_LOCK_AND_ARROW_DOWN   0xe012e072
+#define MAKE_NUM_LOCK_AND_ARROW_RIGHT  0xe012e074
+
+#define MAKE_LEFT_SHIFT_AND_INS                        0xe0f012e070
+#define MAKE_LEFT_SHIFT_AND_HOME               0xe0f012e06c
+#define MAKE_LEFT_SHIFT_AND_PAGE_UP            0xe0f012e07d
+#define MAKE_LEFT_SHIFT_AND_DEL                        0xe0f012e071
+#define MAKE_LEFT_SHIFT_AND_END                        0xe0f012e069
+#define MAKE_LEFT_SHIFT_AND_PAGE_DOWN  0xe0f012e07a
+#define MAKE_LEFT_SHIFT_AND_ARROW_UP   0xe0f012e075
+#define MAKE_LEFT_SHIFT_AND_ARROW_LEFT 0xe0f012e06b
+#define MAKE_LEFT_SHIFT_AND_ARROW_DOWN 0xe0f012e072
+#define MAKE_LEFT_SHIFT_AND_ARROW_RIGHT        0xe0f012e074
+
+#define MAKE_RIGHT_SHIFT_AND_INS                       0xe0f059e070
+#define MAKE_RIGHT_SHIFT_AND_HOME                      0xe0f059e06c
+#define MAKE_RIGHT_SHIFT_AND_PAGE_UP           0xe0f059e07d
+#define MAKE_RIGHT_SHIFT_AND_DEL                       0xe0f059e071
+#define MAKE_RIGHT_SHIFT_AND_END                       0xe0f059e069
+#define MAKE_RIGHT_SHIFT_AND_PAGE_DOWN         0xe0f059e07a
+#define MAKE_RIGHT_SHIFT_AND_ARROW_UP          0xe0f059e075
+#define MAKE_RIGHT_SHIFT_AND_ARROW_LEFT                0xe0f059e06b
+#define MAKE_RIGHT_SHIFT_AND_ARROW_DOWN                0xe0f059e072
+#define MAKE_RIGHT_SHIFT_AND_ARROW_RIGHT       0xe0f059e074
+
+#define MAKE_LR_SHIFT_AND_INS                  0xe0f012e0f059e070
+#define MAKE_LR_SHIFT_AND_HOME                 0xe0f012e0f059e06c
+#define MAKE_LR_SHIFT_AND_PAGE_UP              0xe0f012e0f059e07d
+#define MAKE_LR_SHIFT_AND_DEL                  0xe0f012e0f059e071
+#define MAKE_LR_SHIFT_AND_END                  0xe0f012e0f059e069
+#define MAKE_LR_SHIFT_AND_PAGE_DOWN            0xe0f012e0f059e07a
+#define MAKE_LR_SHIFT_AND_ARROW_UP             0xe0f012e0f059e075
+#define MAKE_LR_SHIFT_AND_ARROW_LEFT   0xe0f012e0f059e06b
+#define MAKE_LR_SHIFT_AND_ARROW_DOWN   0xe0f012e0f059e072
+#define MAKE_LR_SHIFT_AND_ARROW_RIGHT  0xe0f012e0f059e074
+#define MAKE_NUM_KEY_SLASH     0xe04a
+#define MAKE_NUM_KEY_LEFT_SHIFT_AND_SLASH      0xe0f012e04a
+#define MAKE_NUM_KEY_RIGHT_SHIFT_AND_SLASH     0xe0f059e04a
+#define MAKE_NUM_KEY_LR_SHIFT_AND_SLASH                0xe0f012e0f059e04a
+#define MAKE_NUM_KEY_ENTER     0xe05a
+
+
+#endif
diff --git a/include/stdarg.h b/include/stdarg.h
new file mode 100644 (file)
index 0000000..2c8d3dd
--- /dev/null
@@ -0,0 +1,4 @@
+#define va_list        void**
+#define va_start(list,fig,arg_end)     list = (void**) &arg_end;
+#define va_arg(list,fig)       *((fig *) list++)
+#define va_end(list)   0
diff --git a/include/stdarg.h~ b/include/stdarg.h~
new file mode 100644 (file)
index 0000000..85b75bb
--- /dev/null
@@ -0,0 +1,4 @@
+#define va_list        void**
+#define va_start(list,fig,arg_end)     **list = (void*) &arg_end;
+#define va_arg(list,fig)       *((fig *) list++)
+#define va_end(list)   0
diff --git a/include/stdio.c~ b/include/stdio.c~
new file mode 100644 (file)
index 0000000..d1081ac
--- /dev/null
@@ -0,0 +1,136 @@
+#include<stdio.h>
+#include<stdarg.h>
+
+#pragma comment(lib,"vanelibc.vls")
+/*
+COLOR
+
+BRACK, BLUE, GREEN, CIAN, RED, MASENTA
+BRAWN, GLAY, D_GLAY, CH_BLUE, CH_GREE
+CH_CIAN, PINK, CH_MAS, YELLOW, WHITE
+*/
+
+unsigned short* screen;
+char attr;
+unsigned int X,Y;
+/*
+void printf(const char* format,...)
+{
+       va_list list;
+       char ch,buf;
+       ch=*format++;
+       va_start(list,format);
+       
+       while(ch!='\0')
+       {
+                               
+               if(ch=='\n'){
+                       screen+=(80-X);/*80 charactors * 2byte - X charactors * 2 byte*/
+                       Y+=1;
+                       X=0;
+                       
+               }else if(ch=='\t'){
+                       *screen++ = (((attr)<<8) | ' ');
+                       *screen++ = (((attr)<<8) | ' ');
+                       X+=2;
+                       
+               }else if(ch=='\r'){
+                       while(X>=0){
+                               --screen;
+                               --X;
+                       }
+               }else if(ch=='%'){
+                       ch=*format++;
+                       if(ch=='d'){
+                               
+                       }else if(ch=='c'){
+                               buf=(char)va_arg(list,char);
+                               *screen++ = (((attr)<<8) | buf);
+                               
+                       }else if(ch=='s'){
+                               do{
+                                       buf=va_arg(list,char);
+                                       *screen++ = (((attr)<<8) | buf);
+                               }while(buf!='\0');
+                               
+                       }else if(ch=='f'){
+                               char tmp[50],C=0;
+                               sprintf(tmp,"%f",va_arg(list,double));
+                               while(tmp[C]!='\0'){
+                                       *screen++ = (((attr)<<8) | tmp[C]);
+                                       ++C;
+                               }
+                               
+                       }else if(ch=='d'){
+                               char tmp[50],C=0;
+                               sprintf(tmp,"%d",va_arg(list,double));
+                               while(tmp[C]!='\0'){
+                                       *screen++ = (((attr)<<8) | tmp[C]);
+                                       ++C;
+                               }
+                               
+                       }else if(ch=='%'){
+                               *screen++ = (((attr)<<8) | '%');
+                               
+                       }else{
+                               *screen++ = (((attr)<<8) | '%');
+                               
+                       }
+                       
+               }else{
+                       *screen++ = (((attr)<<8) | ch);
+                       X+=1;
+               }
+               ch=*format++;
+       }
+       va_end(list);
+       return;
+}
+*/
+void puts(const char* msg)
+{
+       
+       char ch,buf;
+       ch=*msg++;
+       
+       while(*msg!='\0')
+       {
+                               
+               if(ch=='\n'){
+                       screen+=(80-X);/*80 charactors * 2byte - X charactors * 2 byte*/
+                       Y+=1;
+                       X=0;
+                       
+               }else if(ch=='\t'){
+                       *screen++ = (((attr)<<8) | ' ');
+                       *screen++ = (((attr)<<8) | ' ');
+                       X+=2;
+                       
+               }else if(ch=='\r'){
+                       screen-=X;
+               
+               }else if(ch=='%'){
+                       ch=*msg++;
+                       if(ch=='d'){
+                               
+                       }else if(ch=='c'){
+                       
+                       }else if(ch=='s'){
+                       
+                       }else if(ch=='f'){
+                       
+                       }else if(ch=='%'){
+                       
+                       }else{
+                       
+                       }
+                       
+               }else{
+                       *screen++ = (((attr)<<8) | ch);
+                       X+=1;
+               }
+               ch=*msg++;
+       }
+       return;
+}
+
diff --git a/include/stdio.h b/include/stdio.h
new file mode 100644 (file)
index 0000000..e409e81
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef _STDIO_H_VANE_
+#define _STDIO_H_VANE_
+
+extern unsigned short* screen;
+extern char attr;
+extern unsigned int X,Y;
+
+#define BRACK  0x00
+#define BLUE   0x01
+#define GREEN  0x02
+#define CIAN   0x03
+#define RED    0x04
+#define MASENTA        0x05
+#define BRAWN  0x06
+#define GLAY   0x07
+#define D_GLAY 0x08
+#define CH_BLUE        0x09
+#define CH_GREE        0x0a
+#define CH_CIAN        0x0b
+#define PINK   0x0c
+#define CH_MAS 0x0d
+#define YELLOW 0x0e
+#define WHITE  0x0f
+
+#define CHAR_BYTE      1
+#define SHORT_BYTE     2
+#define INT_BYTE       4
+#define LONG_BYTE      4
+#define LONG_LONG_BYTE 8
+#define DOUBLE_BYTE    8
+#define FLOAT_BYTE     4
+
+#if (!defined(NULL))
+       #define NULL    ((void *) 0)
+#endif
+
+#define NUM_NULL 0
+/*
+#include <stdarg.h>
+
+int sprintf(char *s, const char *format, ...);
+int vsprintf(char *s, const char *format, va_list arg);
+*/
+char getchar(void);
+char getch(void);
+
+void ClearScreen(void);
+void puts(const char* msg);
+void putchar(const char);
+void printOK(const char* msg);
+
+#endif
diff --git a/include/stdio.h~ b/include/stdio.h~
new file mode 100644 (file)
index 0000000..a309902
--- /dev/null
@@ -0,0 +1,49 @@
+#ifndef _STDIO_H_VANE_
+#define _STDIO_H_VANE_
+
+extern unsigned short* screen;
+extern char attr;
+extern unsigned int X,Y;
+
+#define BRACK  0x00
+#define BLUE   0x01
+#define GREEN  0x02
+#define CIAN   0x03
+#define RED    0x04
+#define MASENTA        0x05
+#define BRAWN  0x06
+#define GLAY   0x07
+#define D_GLAY 0x08
+#define CH_BLUE        0x09
+#define CH_GREE        0x0a
+#define CH_CIAN        0x0b
+#define PINK   0x0c
+#define CH_MAS 0x0d
+#define YELLOW 0x0e
+#define WHITE  0x0f
+
+#define CHAR_BYTE      1
+#define SHORT_BYTE     2
+#define INT_BYTE       4
+#define LONG_BYTE      4
+#define LONG_LONG_BYTE 8
+#define DOUBLE_BYTE    8
+#define FLOAT_BYTE     4
+
+#if (!defined(NULL))
+       #define NULL    ((void *) 0)
+#endif
+
+#define NUM_NULL 0
+/*
+#include <stdarg.h>
+
+int sprintf(char *s, const char *format, ...);
+int vsprintf(char *s, const char *format, va_list arg);
+*/
+void ClearScreen(void);
+void puts(const char* msg);
+void putchar(const char);
+void printOK(const char* msg);
+
+#endif
diff --git a/include/stdiohari.h~ b/include/stdiohari.h~
new file mode 100644 (file)
index 0000000..9999635
--- /dev/null
@@ -0,0 +1,24 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(STDIO_H))\r
+\r
+#define STDIO_H        1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+#if (!defined(NULL))\r
+       #define NULL    ((void *) 0)\r
+#endif\r
+\r
+#include <stdarg.h>\r
+\r
+int sprintf(char *s, const char *format, ...);\r
+int vsprintf(char *s, const char *format, va_list arg);\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/include/string.h b/include/string.h
new file mode 100644 (file)
index 0000000..f27f8de
--- /dev/null
@@ -0,0 +1,11 @@
+/*
+
+*/
+
+#ifndef _STRING_H_VANE_
+#define _STRING_H_VANE_
+
+int strcmp(const char*,const char*);
+void strcpy(char*,const char*);
+
+#endif
diff --git a/include/string.h~ b/include/string.h~
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/lib/libvanec.a b/lib/libvanec.a
new file mode 100644 (file)
index 0000000..545fd31
Binary files /dev/null and b/lib/libvanec.a differ
diff --git a/lib/libvanego.a b/lib/libvanego.a
new file mode 100644 (file)
index 0000000..9651ab1
Binary files /dev/null and b/lib/libvanego.a differ