HariboteOS/day6/bootpack.c
2021-03-15 23:41:52 +08:00

38 lines
846 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <stdio.h>
#include "bootpack.h"
#include "desctbl.h"
#include "graphic.h"
#include "int.h"
#include "io.h"
int main(void) {
struct BootInfo *binfo = (struct BootInfo *)ADR_BOOTINFO;
char mcursor[256];
char s[40];
init_gdtidt();
init_pic(); // GDT/IDT完成初始化开放CPU中断
io_sti();
init_palette();
init_screen8(binfo->vram, binfo->scrnx, binfo->scrny);
int mx = (binfo->scrnx - 16) / 2;
int my = (binfo->scrny - 28 - 16) / 2;
init_mouse_cursor8(mcursor, COL8_008484);
put_block8_8(binfo->vram, binfo->scrnx, 16, 16, mx, my, mcursor, 16);
sprintf(s, "(%d, %d)", mx, my);
put_fonts8_asc(binfo->vram, binfo->scrnx, 0, 0, COL8_FFFFFF, s);
io_out8(PIC0_IMR, 0xf9); // 开放PIC1以及键盘中断
io_out8(PIC1_IMR, 0xef); // 开放鼠标中断
for (;;) {
io_hlt();
}
return 0;
}