diff options
Diffstat (limited to 'userspace/put_pixel.h')
| -rw-r--r-- | userspace/put_pixel.h | 33 |
1 files changed, 22 insertions, 11 deletions
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) { |
