mirror of
https://github.com/yourtion/30dayMakeOS.git
synced 2026-02-03 10:03:20 +08:00
计量时间
This commit is contained in:
@@ -10,7 +10,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, count = 0;
|
||||
unsigned int memtotal;
|
||||
struct MOUSE_DEC mdec;
|
||||
struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR;
|
||||
struct SHTCTL *shtctl;
|
||||
@@ -62,8 +62,7 @@ void HariMain(void)
|
||||
sheet_refresh(sht_back, 0, 0, binfo->scrnx, 48); /* 刷新文字 */
|
||||
|
||||
for (;;) {
|
||||
count++; /* 从这里开始 */
|
||||
sprintf(s, "%010d", count);
|
||||
sprintf(s, "%010d", timerctl.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); /* 到这里结束 */
|
||||
|
||||
@@ -169,5 +169,10 @@ void sheet_slide(struct SHEET *sht, int vx0, int vy0);
|
||||
void sheet_free(struct SHEET *sht);
|
||||
|
||||
/* timer.c */
|
||||
struct TIMERCTL {
|
||||
unsigned int count;
|
||||
};
|
||||
extern struct TIMERCTL timerctl;
|
||||
|
||||
void init_pit(void);
|
||||
void inthandler20(int *esp);
|
||||
|
||||
@@ -5,16 +5,20 @@
|
||||
#define PIT_CTRL 0x0043
|
||||
#define PIT_CNT0 0x0040
|
||||
|
||||
struct TIMERCTL timerctl;
|
||||
|
||||
void init_pit(void)
|
||||
{
|
||||
io_out8(PIT_CTRL, 0x43);
|
||||
io_out8(PIT_CNT0, 0x9c);
|
||||
io_out8(PIT_CNT0, 0x2e);
|
||||
timerctl.count = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
void inthandler20(int *esp)
|
||||
{
|
||||
io_out8(PIC0_OCW2, 0x60); /* 把IRQ-00信号接收完了的信息通知给PIC */
|
||||
/* 暂时什么也不做 */
|
||||
timerctl.count++;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user