diff --git a/11_day/bootpack.c b/11_day/bootpack.c index b0729f0..b52dca8 100644 --- a/11_day/bootpack.c +++ b/11_day/bootpack.c @@ -8,7 +8,7 @@ void HariMain(void) struct BOOTINFO *binfo = (struct BOOTINFO *) ADR_BOOTINFO; char s[40], keybuf[32], mousebuf[128]; int mx, my, i; - unsigned int memtotal; + unsigned int memtotal, count = 0; struct MOUSE_DEC mdec; struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; struct SHTCTL *shtctl; @@ -37,23 +37,21 @@ void HariMain(void) sht_mouse = sheet_alloc(shtctl); sht_win = sheet_alloc(shtctl); buf_back = (unsigned char *) memman_alloc_4k(memman, binfo->scrnx * binfo->scrny); - buf_win = (unsigned char *) memman_alloc_4k(memman, 160 * 68); + buf_win = (unsigned char *) memman_alloc_4k(memman, 160 * 52); sheet_setbuf(sht_back, buf_back, binfo->scrnx, binfo->scrny, -1); /* 没有透明色 */ sheet_setbuf(sht_mouse, buf_mouse, 16, 16, 99); /* 透明色号99 */ - sheet_setbuf(sht_win, buf_win, 160, 68, -1); /* 没有透明色 */ + sheet_setbuf(sht_win, buf_win, 160, 52, -1); /* 没有透明色 */ init_screen8(buf_back, binfo->scrnx, binfo->scrny); init_mouse_cursor8(buf_mouse, 99); /* 背景色号99 */ - make_window8(buf_win, 160, 68, "window"); - putfonts8_asc(buf_win, 160, 24, 28, COL8_000000, "Welcome to"); - putfonts8_asc(buf_win, 160, 24, 44, COL8_000000, " Haribote-OS!"); + make_window8(buf_win, 160, 52, "counter"); sheet_slide(sht_back, 0, 0); mx = (binfo->scrnx - 16) / 2; /* 按显示在画面中央来计算坐标 */ my = (binfo->scrny - 28 - 16) / 2; sheet_slide(sht_mouse, mx, my); sheet_slide(sht_win, 80, 72); sheet_updown(sht_back, 0); - sheet_updown(sht_mouse, 1); - sheet_updown(sht_win, 2); + sheet_updown(sht_win, 1); + sheet_updown(sht_mouse, 2); sprintf(s, "(%3d, %3d)", mx, my); putfonts8_asc(buf_back, binfo->scrnx, 0, 0, COL8_FFFFFF, s); sprintf(s, "memory %dMB free : %dKB", memtotal / (1024 * 1024), memman_total(memman) / 1024); @@ -61,9 +59,15 @@ void HariMain(void) sheet_refresh(sht_back, 0, 0, binfo->scrnx, 48); /* 刷新文字 */ for (;;) { + count++; /* 从这里开始 */ + sprintf(s, "%010d", count); + boxfill8(buf_win, 160, COL8_C6C6C6, 40, 28, 119, 43); + putfonts8_asc(buf_win, 160, 40, 28, COL8_000000, s); + sheet_refresh(sht_win, 40, 28, 120, 44); /* 到这里结束 */ + io_cli(); if (fifo8_status(&keyfifo) + fifo8_status(&mousefifo) == 0) { - io_stihlt(); + io_sti(); /* 不做HLT */ } else { if (fifo8_status(&keyfifo) != 0) { i = fifo8_get(&keyfifo);