summaryrefslogtreecommitdiff
path: root/userspace
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-09-29 19:57:52 +0200
committerMiguel <m.i@gmx.at>2018-09-29 19:57:52 +0200
commit75433d155c152b809e9f25b1099fc06d6106308b (patch)
treef4f84309e6cf2aa9bc0d9df5ae532b94a60fea0f /userspace
parent73e80bf4b6c69b92a04b525f114a072a1c4b0d3a (diff)
improving window compositor
Diffstat (limited to 'userspace')
-rw-r--r--userspace/fsh.c6
-rw-r--r--userspace/pain2.c44
-rw-r--r--userspace/put_pixel.h33
3 files changed, 71 insertions, 12 deletions
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 <stdlib.h>
+#include <stdio.h>
+
+#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;i<atoi(argv[1]);i++)
+ {
+ for(int i=0;i<100;i++)
+ {
+ put_rect(0,0,640,480,0xff0000);
+ put_rect(100+i,100+i,100,100,0x0000ff);
+ }
+
+ for(int i=100;i>0;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 <stdint.h>
-#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<y+h; yy++) // iter over lines
+ {
+ for(int xx=x; xx<x+w; xx++) // single line
+ {
+ *pix=col;
+ pix++;
+ }
+ pix+=640-w;
+
+ }
}
-
+void put_pixel(int x,int y, uint32_t color)
+{
+ uint8_t *p=VESA_FRAMEBUFFER+y*VESA_PITCH+x*VESA_BPP;
+ uint32_t *pix=p;
+ *pix=color;
+}
void put_pixel_old(int x,int y, int color)
{