summaryrefslogtreecommitdiff
path: root/userspace/put_pixel.h
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-09-28 19:24:18 +0200
committerMiguel <m.i@gmx.at>2018-09-28 19:24:18 +0200
commitbe3d9f2cf2a8cfe670eac6df255db55ff9205c49 (patch)
treed6479240409398b0cd9de47b3728e7530d94a106 /userspace/put_pixel.h
parent5f6c2bcf0d2f9c416134aba224d90a605f216818 (diff)
started workin on foolish window composer
Diffstat (limited to 'userspace/put_pixel.h')
-rw-r--r--userspace/put_pixel.h31
1 files changed, 27 insertions, 4 deletions
diff --git a/userspace/put_pixel.h b/userspace/put_pixel.h
index f4b9332..f879772 100644
--- a/userspace/put_pixel.h
+++ b/userspace/put_pixel.h
@@ -2,14 +2,38 @@
#define VESA_FRAMEBUFFER 0xf6000000
#define VESA_PITCH 2560
-#define VESA_BPP 32
+#define VESA_BPP 4
+//https://forum.osdev.org/viewtopic.php?t=10018&p=64358
// TODO: what will happen in 24bit mode?
-static void put_pixel(int x,int y, int color)
+
+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;
+
+ 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();
+}
+
+
+
+void put_pixel_old(int x,int y, int 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 (x) x = (x*VESA_BPP); // get bytes (divide by 8)
if (y) y = (y*VESA_PITCH);
//uint8_t *cTemp=VbeModeInfoBlock->physbase;
uint8_t *cTemp=VESA_FRAMEBUFFER;
@@ -18,4 +42,3 @@ static void put_pixel(int x,int y, int color)
cTemp[x+y+1] = (uint8_t)((color>>8) & 0xff);
cTemp[x+y+2] = (uint8_t)((color>>16) & 0xff);
}
-