summaryrefslogtreecommitdiff
path: root/userspace/put_pixel.h
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-09-28 11:13:06 +0200
committerMiguel <m.i@gmx.at>2018-09-28 11:13:06 +0200
commit5f6c2bcf0d2f9c416134aba224d90a605f216818 (patch)
tree6fda812ecd1ce06f743c292f3d0495d0b2941bbd /userspace/put_pixel.h
parent4ddca59e2c07a98988ffb07571d2b35c4c90f5ac (diff)
struggling with scheduler and userprog to view ppm files
Diffstat (limited to 'userspace/put_pixel.h')
-rw-r--r--userspace/put_pixel.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/userspace/put_pixel.h b/userspace/put_pixel.h
new file mode 100644
index 0000000..f4b9332
--- /dev/null
+++ b/userspace/put_pixel.h
@@ -0,0 +1,21 @@
+#include <stdint.h>
+
+#define VESA_FRAMEBUFFER 0xf6000000
+#define VESA_PITCH 2560
+#define VESA_BPP 32
+
+// TODO: what will happen in 24bit mode?
+static void put_pixel(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 (y) y = (y*VESA_PITCH);
+ //uint8_t *cTemp=VbeModeInfoBlock->physbase;
+ uint8_t *cTemp=VESA_FRAMEBUFFER;
+
+ cTemp[x+y] = (uint8_t)(color & 0xff);
+ cTemp[x+y+1] = (uint8_t)((color>>8) & 0xff);
+ cTemp[x+y+2] = (uint8_t)((color>>16) & 0xff);
+}
+