summaryrefslogtreecommitdiff
path: root/src/kernel/main.c
blob: 877a276f4f1b264dc8e6e9e2613659c3964f7cea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <stdint.h>
#include "vga.h"
#include "fat.h"
#include "fs.h"
#include "ata.h"
#include "panic.h"
#include "serial.h"
#include "util.h"

uint8_t nbuf[11];

void main() {
  vga_blank();
  vga_printsz("Initializing drivers...");
  sinit();
  vga_printsz("\n  Serial ready.");
  load_fat();
  clear_fs_handles();
  vga_printsz("\n  File system ready.\n\nDisk label: ");
  vga_printsn(FAT_INFO->label, 11);
  vga_printsz("\nDisk size:  ");
  u32_dec(FAT_INFO->sectors >> 1, nbuf);
  vga_printsz(nbuf);
  vga_printsz("k\n\nFAT start:\n");
  nbuf[3] = 0;
  for (uint8_t r = 0; r < 192; r += 24) {
    for (uint8_t c = 0; c < 24; ++c) {
      u8_hex(*(uint8_t *)(FAT + r + c), nbuf);
      nbuf[2] = ' ';
      vga_printsz(nbuf);
    }
    vga_printch('\n');
  }
  while (1)
    asm ("hlt");
}