Guest User

Untitled

a guest
Sep 25th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.62 KB | None | 0 0
  1. // SCREENSHOT: https://puu.sh/rnAsR/a097b41e1b.png
  2.  
  3. #include <stdbool.h>
  4.  
  5. #include "console.h"
  6. #include "input.h"
  7. #include "stdlib.h"
  8. #include "pmm.h"
  9.  
  10. int ticks = 0;
  11.  
  12. void os_tick()
  13. {
  14.     ticks++;
  15.     // int_to_string(mainmenu[5].label, ticks, 10);
  16.     // console_refresh();
  17. }
  18.  
  19. menuitem_t mainmenu_contents[] = {
  20.     { "Screen 0", 0x00 },
  21.     { "Screen 1", 0x00 },
  22.     { "Screen 2", 0x00 },
  23.     { "System", MENU_RIGHTALIGN },
  24.     { "Catalog", MENU_RIGHTALIGN },
  25. };
  26. menu_t mainmenu = {
  27.     sizeof(mainmenu_contents) / sizeof(mainmenu_contents[0]),
  28.     mainmenu_contents,
  29. };
  30.  
  31. void os_init()
  32. {
  33.     // TODO: Initialize OS…
  34.     console_init();
  35.    
  36.     console_set(console_new());
  37.     console_menu(&mainmenu);
  38.    
  39.     printf("Starting the OS...\n");
  40.    
  41.     printf("String: %s\n", "Hello World!");
  42.     printf("Numbers: %b %d %x\n", 14, 15, 13);
  43.     printf("Numbers: %b %d %x\n", -14, -15, -13);
  44.    
  45.     printf("Character Map:\n");
  46.     for(int y = -1; y < 16; y++)
  47.     {
  48.         for(int x = -1; x < 16; x++) {
  49.             if(y < 0) {
  50.                 if(x < 0) {
  51.                     printf("  ");
  52.                 } else {
  53.                     printf("%x ", x);
  54.                 }
  55.                 continue;
  56.             }
  57.             if(x < 0) {
  58.                 printf("%x ", y);
  59.             } else {
  60.                 char c = 16*y+x;
  61.                 if(c == '\n' || c == '\b')
  62.                     printf("  ");
  63.                 else
  64.                     printf("%c ", c);
  65.             }
  66.        
  67.         }
  68.         printf("\n");
  69.     }
  70.    
  71.     printf("PMM Testing:\n");
  72.     {
  73.         page_t p0, p1;
  74.         printf("pmm_alloc[0] = %d\n", pmm_alloc());
  75.         printf("pmm_alloc[1] = %d\n", p0 = pmm_alloc());
  76.         printf("pmm_alloc[2] = %d\n", pmm_alloc());
  77.         printf("pmm_alloc[3] = %d\n", p1 = pmm_alloc());
  78.         pmm_free(p0);
  79.         printf("pmm_alloc[4] = %d\n", pmm_alloc());
  80.     }
  81.    
  82.     // shell_start();
  83.    
  84.     while(true);
  85. }
Advertisement
Add Comment
Please, Sign In to add comment