4 #include "lib/string.h"
6 extern uint8_t* framebuffer_addr;
7 extern uint32_t framebuffer_bpp;
8 extern uint32_t framebuffer_pitch;
9 extern uint8_t* back_framebuffer_addr;
10 extern uint32_t framebuffer_size;
12 #define VESA_WIDTH (getScreenWidth())
13 #define VESA_HEIGHT (getScreenHeight())
16 #define PACK_INTO_RGB(struct_px) ((struct_px.r & 0xff) << 16) |\
17 ((struct_px.g & 0xff) << 8) |\
35 VESA_BLACK = 0x000000,
37 VESA_GREEN = 0x00AA00,
40 VESA_MAGENTA = 0xAA00AA,
41 VESA_YELLOW = 0xAA5500,
42 VESA_LIGHT_GREY = 0xAAAAAA,
43 VESA_DARK_GREY = 0x555555,
44 VESA_LIGHT_BLUE = 0x5555FF,
45 VESA_LIGHT_GREEN = 0x55FF55,
46 VESA_LIGHT_CYAN = 0x55FFFF,
47 VESA_LIGHT_RED = 0xFF5555,
48 VESA_LIGHT_MAGENTA = 0xFF55FF,
49 VESA_LIGHT_YELLOW = 0xffff55,
50 VESA_WHITE = 0xFFFFFF,
55 uint8_t windowA, windowB;
58 uint16_t segmentA, segmentB;
62 uint16_t screen_width, screen_height;
63 uint8_t wChar, yChar, planes, bpp, banks;
64 uint8_t memoryModel, bankSize, imagePages;
68 uint8_t readMask, redPosition;
69 uint8_t greenMask, greenPosition;
70 uint8_t blueMask, bluePosition;
71 uint8_t reservedMask, reservedPosition;
72 uint8_t directColorAttributes;
75 uint32_t offScreenMemOff;
76 uint16_t offScreenMemSize;
77 uint8_t reserved1[206];
80 #define punch() memcpy(framebuffer_addr, back_framebuffer_addr, framebuffer_size)
84 uint32_t getDisplayPitch();
85 uint32_t getScreenWidth();
86 uint32_t getScreenHeight();
87 size_t getDisplayAddr();
88 uint32_t getDisplayBpp();
89 size_t getFrameBufferAddr();
90 size_t getPixel(int32_t x, int32_t y);
100 inline static __attribute__((always_inline))
void set_pixel(uint32_t x, uint32_t y, uint32_t color) {
102 if (x >= VESA_WIDTH ||
107 uint8_t* pixels = back_framebuffer_addr + (x * (framebuffer_bpp >> 3)) + y * framebuffer_pitch;
109 pixels[0] = color & 255;
110 pixels[1] = (color >> 8) & 255;
111 pixels[2] = (color >> 16) & 255;
119 inline static __attribute__((always_inline)) uint32_t getDisplaySize(){
120 return framebuffer_size;
123 void setPixelAlpha(uint32_t x, uint32_t y,
rgba_color color);
124 void rect_copy(
int x,
int y,
int width,
int height);
125 void graphics_update(uint32_t new_width, uint32_t new_height, uint32_t new_pitch);
Основные определения ядра
struct registers __attribute__((packed))
Структура данных пакета от мыши