diff --git a/Authors b/Authors index aeadcec..7f775d0 100755 --- a/Authors +++ b/Authors @@ -1,5 +1,4 @@ Christopher Olsen -John Ventrone Jeff Leveille Lars Wirzenius diff --git a/UbixOS-Team b/UbixOS-Team index 1d1590b..54bb678 100755 --- a/UbixOS-Team +++ b/UbixOS-Team @@ -2,7 +2,6 @@ Christopher Olsen AKA Ubu Project Founder -John Ventrone AKA Ghetto V UI Specialist Larry Sica AKA lomion Project Dictator Mark Iuzzolino AKA TCA Lead Gui Developer Jeff Leveille AKA grayspace Lead Multimedia Developer diff --git a/src/bin/shell/main.c b/src/bin/shell/main.c index e43d41a..5ea4d06 100755 --- a/src/bin/shell/main.c +++ b/src/bin/shell/main.c @@ -29,10 +29,23 @@ main(); } -int main() { - printf("UbixOS: "); - //exec("shell"); - printf("\nShell goes here!\n"); +void gets(char *buffer) { + int count = 0,ch=0; while (1) { + ch = fgetc(stdin); + if(ch == 10) break; + if(ch == 8 && count > 0) count-=2; + else buffer[count] = ch; + printf("%c",ch); + count++; + } + buffer[count] = '\0'; + } + +int main() { + char buffer[256]; + while (1) { + printf("\nUbixOS: "); + gets(buffer); } } diff --git a/src/lib/libc/include/stdio.h b/src/lib/libc/include/stdio.h index 6230988..39669da 100755 --- a/src/lib/libc/include/stdio.h +++ b/src/lib/libc/include/stdio.h @@ -48,5 +48,6 @@ int vsprintf(char *buf,const char *fmt,vaList args); FILE *fopen(const char *,const char *); int fwrite(const void *ptr,int size,FILE *fd); +int fgetc(FILE *fd); #endif \ No newline at end of file diff --git a/src/lib/libc/stdio/Makefile b/src/lib/libc/stdio/Makefile index e3c36d5..ac330bf 100755 --- a/src/lib/libc/stdio/Makefile +++ b/src/lib/libc/stdio/Makefile @@ -14,7 +14,7 @@ REMOVE = rm -f #Objects -OBJS = printf.o vsprintf.o fd.o vfprintf.o fopen.o fwrite.o +OBJS = printf.o vsprintf.o fd.o vfprintf.o fopen.o fwrite.o fgetc.o #Output OUTPUT = libc.so diff --git a/src/sys/drivers/keyboard.c b/src/sys/drivers/keyboard.c index d27804a..cde1c9e 100755 --- a/src/sys/drivers/keyboard.c +++ b/src/sys/drivers/keyboard.c @@ -194,4 +194,20 @@ while(inportByte(0x64) & 2); outportByte(0x60, ledStatus); while(inportByte(0x64) & 2); - } \ No newline at end of file + } + +//Temp +unsigned char getch() { + unsigned char ret_key=0; + unsigned int loop=0; + + while (keystrokeBuffersize == 0); + + ret_key = keystrokeBuffer[0]; + keystrokeBuffersize--; + + for (loop=0; loop<254; loop++) { + keystrokeBuffer[loop] = keystrokeBuffer[loop+1]; + } + return ret_key; + } diff --git a/src/sys/include/ubixos/syscalls.h b/src/sys/include/ubixos/syscalls.h index e3bf128..daa3dab 100755 --- a/src/sys/include/ubixos/syscalls.h +++ b/src/sys/include/ubixos/syscalls.h @@ -29,11 +29,12 @@ void sysExit(); void sysExec(); void sysFork(); +void sysFgetc(); typedef void (*functionPTR)(); functionPTR systemCalls[] = { - sysFwrite,sysGetpid,sysExit,sysExec,sysFork + sysFwrite,sysGetpid,sysExit,sysExec,sysFork,sysFgetc }; int totalCalls = sizeof(systemCalls)/sizeof(functionPTR); diff --git a/src/sys/kernel/syscall.c b/src/sys/kernel/syscall.c index 48f8a40..9ed929f 100755 --- a/src/sys/kernel/syscall.c +++ b/src/sys/kernel/syscall.c @@ -80,7 +80,7 @@ kprintf("Status: [%i]\n",status); } -void sysExec(int a,int b,int c,int d) { +void sysExec() { int fd=0,i=0,x=0; char *binarySpace = (char *)0x7C0000; char *newLoc; @@ -106,3 +106,13 @@ : "g" (binaryHeader->eEntry) ); } + +void sysFgetc() { + int fd; + int *ptr; + asm("": "=b" (ptr),"=c" (fd)); + asm("sti"); + if (fd == 0) { + ptr[0] = getch(); + } + } \ No newline at end of file diff --git a/ubixos.kdevprj b/ubixos.kdevprj index 270409b..1c10bfd 100755 --- a/ubixos.kdevprj +++ b/ubixos.kdevprj @@ -203,8 +203,14 @@ install_location= type=HEADER +[src/lib/libc/stdio/Makefile] +dist=true +install=false +install_location= +type=DATA + [src/lib/libc/stdio/Makefile.am] -files=src/lib/libc/stdio/printf.c,src/lib/libc/stdio/fprintf.c,src/lib/libc/stdio/fd.c,src/lib/libc/stdio/vfprintf.c,src/lib/libc/stdio/vsprintf.c,src/lib/libc/stdio/fopen.c,src/lib/libc/stdio/fwrite.c +files=src/lib/libc/stdio/printf.c,src/lib/libc/stdio/fprintf.c,src/lib/libc/stdio/fd.c,src/lib/libc/stdio/vfprintf.c,src/lib/libc/stdio/vsprintf.c,src/lib/libc/stdio/fopen.c,src/lib/libc/stdio/fwrite.c,src/lib/libc/stdio/Makefile,src/lib/libc/stdio/fgetc.c sharedlib_LDFLAGS=-version-info 0:0:1 sharedlib_rootname=stdio sub_dirs= @@ -216,6 +222,12 @@ install_location= type=SOURCE +[src/lib/libc/stdio/fgetc.c] +dist=true +install=false +install_location= +type=SOURCE + [src/lib/libc/stdio/fopen.c] dist=true install=false