wip: put_pixel (smh doing weird stuff when trying to draw a line)
This commit is contained in:
		
							
								
								
									
										16
									
								
								src/kernel.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								src/kernel.c
									
									
									
									
									
								
							@ -27,6 +27,12 @@
 | 
			
		||||
#error "This tutorial needs to be compiled with a ix86-elf compiler"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static void put_pixel(uint32_t color, uint32_t x, uint32_t y)
 | 
			
		||||
{
 | 
			
		||||
	const uint32_t coords = x + y * display.pitch;
 | 
			
		||||
	display.buff[coords] = color;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void kernel_main(multiboot_info_t *mbd, uint32_t magic)
 | 
			
		||||
{
 | 
			
		||||
	/* terminal_initialize(); */
 | 
			
		||||
@ -40,6 +46,14 @@ void kernel_main(multiboot_info_t *mbd, uint32_t magic)
 | 
			
		||||
	/*         "complex 8*unknown quantity -byte descriptor table. -- Troy "
 | 
			
		||||
	 */
 | 
			
		||||
	/*         "Martin 03:50, 22 March 2009 (UTC)\n"); */
 | 
			
		||||
	memset(display.buff, 255, 1024 * 1024);
 | 
			
		||||
	uint32_t color = 0 << 16 | 128 << 8 | 128;
 | 
			
		||||
	for (size_t i = 0; i < 100; i++) {
 | 
			
		||||
		put_pixel(color, 10, i);
 | 
			
		||||
		put_pixel(color, 11, i);
 | 
			
		||||
		put_pixel(color, 12, i);
 | 
			
		||||
		put_pixel(color, 13, i);
 | 
			
		||||
		put_pixel(color, 14, i);
 | 
			
		||||
	}
 | 
			
		||||
	/* memset(display.buff, 255, 1024 * 1024); */
 | 
			
		||||
	/* shell_init(); */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user