From 8ea3e244d44190e44a092ffb004e13ad94174c68 Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Sun, 24 May 2015 23:30:12 +0200 Subject: porting ncurses... --- userspace/Makefile | 4 ++-- userspace/foolshell.c | 16 ++++++++++++++-- userspace/init.c | 1 + userspace/snake.c | 16 +++++++++++++++- userspace/sys/Makefile | 1 - userspace/sys/crt0.S | 3 +++ userspace/sys/crt0.o | Bin 660 -> 660 bytes userspace/sys/libfool.a | Bin 37292 -> 37550 bytes userspace/sys/sys.c | 10 ++++++++++ userspace/sys/sys.o | Bin 17956 -> 18236 bytes userspace/sys/syscalls.c | 3 ++- userspace/sys/syscalls.o | Bin 18572 -> 18544 bytes userspace/sys/termios.h | 18 ++++++++++++++++++ 13 files changed, 65 insertions(+), 7 deletions(-) (limited to 'userspace') diff --git a/userspace/Makefile b/userspace/Makefile index 801326b..1f562ab 100644 --- a/userspace/Makefile +++ b/userspace/Makefile @@ -18,7 +18,7 @@ PROGS=foolshell ls simple brainfuck add checker clear task1 task2 init cat snake include ../Makefile.common ext2.img: $(PROGS) ../mp/mp.bin - dd if=/dev/zero of=ext2.img bs=512 count=10000 + dd if=/dev/zero of=ext2.img bs=512 count=50000 sudo mkfs.ext2 -O none ext2.img -F mkdir mnt sudo mount ext2.img mnt @@ -31,7 +31,7 @@ ext2.img: $(PROGS) ../mp/mp.bin echo "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++." > mnt/home/miguel/hello.brain # cp ~/temp/fool-os-stuff/binutils-build-host-foolos/binutils/readelf mnt/bin # cp ../font/binfont.bin mnt/ - cp ~/temp/fool-os-stuff/ncurses-5.9/progs/tput mnt/bin + cp ~/temp/fool-os-stuff/ncurses-5.9-foolos-new/progs/* mnt/bin/ cp ../mp/mp.bin mnt/boot/ mkdir -p mnt/etc echo "127.0.0.1 localhost" > mnt/etc/hosts diff --git a/userspace/foolshell.c b/userspace/foolshell.c index 0ec7e88..fa62094 100644 --- a/userspace/foolshell.c +++ b/userspace/foolshell.c @@ -3,7 +3,17 @@ #include #include +#include + extern char **environ; +extern struct _reent *_impure_ptr; + + + +uint8_t buf_test[1024*300]; + + + // void hello() @@ -50,6 +60,7 @@ void prompt() int main(int argc, char **argv) { /* + printf("_impure_ptr: 0x%08x\n",_impure_ptr); printf("argv= 0x%08x \n",argv); printf("environ= 0x%08x \n",environ); */ @@ -62,7 +73,8 @@ int main(int argc, char **argv) if(!silent)hello(); - char *buf=malloc(256); + //char *buf=malloc(256); + char buf[256]; while(1) { @@ -89,7 +101,7 @@ char **tokenize(char *buf) for(i=0;i +int data4[100]; + +int data1=1; +int data2=2; +int data3=3; + int main() { - printf("Hello I am FoolSnake 0.1\n"); + printf("Hello I am FoolSnake 0.1\n some data test: %i %i %i", data1,data2,data3 ); + + puts("+++"); + for(int i=0;i<100;i++) + { + if(data4[i]!=0)printf("WOW"); + } + puts("+++"); + printf("setvbuf returned %i\n",setvbuf(stdin,NULL,_IONBF,0)); fool_tune(1,0,0); // activate gaming mode diff --git a/userspace/sys/Makefile b/userspace/sys/Makefile index cdcd3b7..2e71714 100644 --- a/userspace/sys/Makefile +++ b/userspace/sys/Makefile @@ -17,7 +17,6 @@ crt0.o: crt0.S crt_install: crt0.o cp crt0.o $(SYSROOT)/usr/lib/ - header_install: cp termios.h $(SYSROOT)/usr/include/sys/ diff --git a/userspace/sys/crt0.S b/userspace/sys/crt0.S index 025c21b..d09f8ca 100644 --- a/userspace/sys/crt0.S +++ b/userspace/sys/crt0.S @@ -5,6 +5,9 @@ _start: pop %eax mov %eax, environ +pop %eax +#mov %eax, _impure_ptr + call main push environ diff --git a/userspace/sys/crt0.o b/userspace/sys/crt0.o index db292b0..1b71404 100644 Binary files a/userspace/sys/crt0.o and b/userspace/sys/crt0.o differ diff --git a/userspace/sys/libfool.a b/userspace/sys/libfool.a index 81a4f16..0823595 100644 Binary files a/userspace/sys/libfool.a and b/userspace/sys/libfool.a differ diff --git a/userspace/sys/sys.c b/userspace/sys/sys.c index adf6ff9..7639307 100644 --- a/userspace/sys/sys.c +++ b/userspace/sys/sys.c @@ -169,3 +169,13 @@ char *getlogin(void) return NULL; } +int gtty() +{ + return -1; +} + +int stty() +{ + return -1; +} + diff --git a/userspace/sys/sys.o b/userspace/sys/sys.o index d04089e..dc5a2e3 100644 Binary files a/userspace/sys/sys.o and b/userspace/sys/sys.o differ diff --git a/userspace/sys/syscalls.c b/userspace/sys/syscalls.c index 4b29451..c3ff909 100644 --- a/userspace/sys/syscalls.c +++ b/userspace/sys/syscalls.c @@ -1,6 +1,7 @@ #include "kernel/syscalls.h" -char **environ; +extern char **environ; +//struct _reent *_impure_ptr; // generic syscall interface! int syscall(int call, int p1, int p2, int p3) diff --git a/userspace/sys/syscalls.o b/userspace/sys/syscalls.o index f8fd94b..a0a4265 100644 Binary files a/userspace/sys/syscalls.o and b/userspace/sys/syscalls.o differ diff --git a/userspace/sys/termios.h b/userspace/sys/termios.h index ff1e838..b6625be 100644 --- a/userspace/sys/termios.h +++ b/userspace/sys/termios.h @@ -1,2 +1,20 @@ typedef uint32_t speed_t; typedef uint32_t DIR; + +#define B0 0000000 /* hang up */ +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 + -- cgit v1.2.3