setos

拙OS
Log | Files | Refs | LICENSE

main.c (764B)


      1 #include "../uefi/uefi.h"
      2 
      3 typedef unsigned char          uint8_t;
      4 typedef unsigned int           uint32_t;
      5 typedef unsigned long long int uint64_t;
      6 
      7 // Argument order is to interface to the MS-ABI
      8 void
      9 kernel_main(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop)
     10 {
     11 	uint32_t *fb_base = (uint32_t *)gop->Mode->FrameBufferBase;
     12 	uint32_t hrez = gop->Mode->Info->HorizontalResolution;
     13 	uint32_t vrez = gop->Mode->Info->VerticalResolution;
     14 	uint32_t sl = gop->Mode->Info->PixelsPerScanLine;
     15 	uint32_t cx = hrez / 2;
     16 	uint32_t cy = vrez / 2;
     17 	for (int i = 0; i < vrez; i++) {
     18 		for (int j = 0; j < hrez; j++) {
     19 			if ((cx-j)*(cx-j) + (cy-i)*(cy-i) < (vrez/3) * (vrez/3)) {
     20 				fb_base[i * sl + j] = 0xff << 16;
     21 			} else {
     22 				fb_base[i * sl + j] = 0xffffff;
     23 			}
     24 		}
     25 	}
     26 	for(;;);
     27 }