From 75433d155c152b809e9f25b1099fc06d6106308b Mon Sep 17 00:00:00 2001 From: Miguel Date: Sat, 29 Sep 2018 19:57:52 +0200 Subject: improving window compositor --- userspace/fsh.c | 6 +++++- userspace/pain2.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ userspace/put_pixel.h | 33 ++++++++++++++++++++++----------- 3 files changed, 71 insertions(+), 12 deletions(-) create mode 100644 userspace/pain2.c (limited to 'userspace') diff --git a/userspace/fsh.c b/userspace/fsh.c index 81c2bce..d456d1b 100644 --- a/userspace/fsh.c +++ b/userspace/fsh.c @@ -229,6 +229,7 @@ bool process(char *buf) { int pid=_fork(); + if(pid==0) { if(token[0][0]=='/')sprintf(buf,"%s",token[0]); @@ -238,7 +239,10 @@ bool process(char *buf) exit(1); } - if(token[1]==NULL||strcmp(token[1],"&"))_wait(pid); + int last=0; + for(last=0;token[last+1]!=NULL;last++); + printf("last: %s\n",token[last]); + if(strcmp(token[last],"&"))_wait(pid); } return true; diff --git a/userspace/pain2.c b/userspace/pain2.c new file mode 100644 index 0000000..840b6b6 --- /dev/null +++ b/userspace/pain2.c @@ -0,0 +1,44 @@ +#include "put_pixel.h" + +#include +#include + +#define dimx 640 +#define dimy 480 + +/* +void doscolor(int color,int color2) +{ + int i=0; + + for (int y = 0; y < dimy; y++) + for (int x = 0; x < dimx; x++) + { + { + if(x%2&&y%2)put_pixel(x,y,color); + else put_pixel(x,y,color2); + } + } +} +*/ + +int main(int argc,char **argv) +{ + for(int i=0;i0;i--) + { + put_rect(0,0,640,480,0xff0000); + put_rect(100+i,100+i,100,100,0x0000ff); + } + } + + return EXIT_SUCCESS; +} + diff --git a/userspace/put_pixel.h b/userspace/put_pixel.h index f879772..445e890 100644 --- a/userspace/put_pixel.h +++ b/userspace/put_pixel.h @@ -1,33 +1,44 @@ #include -#define VESA_FRAMEBUFFER 0xf6000000 +#define VESA_FRAMEBUFFER 0xfa000000 #define VESA_PITCH 2560 #define VESA_BPP 4 //https://forum.osdev.org/viewtopic.php?t=10018&p=64358 // TODO: what will happen in 24bit mode? +/* volatile int c; int delay() { c++; } -void put_pixel(int x,int y, uint32_t color) -{ - //do not write memory outside the screen buffer, check parameters against the VBE mode info - //if (x<0 || x>vesaXres|| y<0 || y>vesaYres) return; - //if (x) x = (x*(VESA_BPP>>3)); // get bytes (divide by 8) - //if (y) y = (y*VESA_PITCH); - //uint8_t *cTemp=VbeModeInfoBlock->physbase; +*/ +void put_rect(int x,int y, int w, int h,uint32_t col) +{ + // start uint8_t *p=VESA_FRAMEBUFFER+y*VESA_PITCH+x*VESA_BPP; uint32_t *pix=p; - *pix=color; -// for(int i=0;i<100;i++)delay(); + for(int yy=y; yy