30æ¥OSèªä½å ¥é13æ¥ç®ï¼Win10ï¼
ã¯ããã«
ãã©ãµãããã人ããã£ã±ãâ¦
ç®æ¬¡
ã¿ã¤ã-2
æå表示ãç°¡åã«(harib10a)
Harimainã§ã®æå表示ãè¡ãå¦çããã¤ã
ï¼ãèæ¯ãæ¸ã
ï¼ãæåãè¨ã
ï¼ãã·ã¼ãããªãã¬ãã·ã¥
ã«ãªã£ã¦ããé¨åãããã®ã§ãã¾ã¨ãããã¨ã§æ´çãããã¨ãã£ãæµãã®ããã§ãã
å®è¡
FIFOãããã¡ãè¦ç´ã(harib10b)
FIFOãããã¡ãã¿ã¤ãã®å ´åã«3ã¤ãããâ¦ç¡é§ãªå¦çã¨ãããã100åãã£ãã100åä½ãã®ãâ¦ï¼ã¨ãããã¨ã§ã¾ã¨ããã¿ããã§ãã
æ¹æ³ã¯åã¿ã¤ãã¼ã®ãã¼ã¿ã¯ãåããããã¡ãéãã¦éãã®ã§ãããåãåãå ã®æç»ã®å¦çã®æ®µéã«ã¦æ¡ä»¶åå²ã§å¤ãã«ããã¦ããæãã¿ããã§ãã
ãã®æ¡ä»¶åå²ã
} else if (fifo8_status(&timerfifo) != 0) { i = fifo8_get(&timerfifo); /* ã¨ããããèªãï¼ç©ºã«ããããï¼ */ io_sti(); if (i == 10) { putfonts8_asc_sht(sht_back, 0, 64, COL8_FFFFFF, COL8_008484, "10[sec]", 7); } else if (i == 3) { putfonts8_asc_sht(sht_back, 0, 80, COL8_FFFFFF, COL8_008484, "3[sec]", 6); } else { /* 0ã1 */ if (i != 0) { timer_init(timer3, &timerfifo, 0); /* 次ã¯0ã */ boxfill8(buf_back, binfo->scrnx, COL8_FFFFFF, 8, 96, 15, 111); } else { timer_init(timer3, &timerfifo, 1); /* 次ã¯1ã */ boxfill8(buf_back, binfo->scrnx, COL8_008484, 8, 96, 15, 111); } timer_settime(timer3, 50); sheet_refresh(sht_back, 8, 96, 16, 112);
ããã§é ç·ã3æ¬ã ã£ãã®ã1æ¬ã«ãªã£ãæãã§ãã£ããï¼
å®è¡ããã¨
æ§è½ãæ¯è¼ãã¦ã¿ã(harib10c~harib10f)
å種ã¿ã¤ãã¼ãè²ã ãªæ¹æ³ã§å®è£ ãã¦ããã®ã§ããããæ§è½æ¯è¼ããä¸å°ãä½ããæ§è½æ¯è¼ãè¡ãã¿ããã§ãã
ã¾ãã¯ä¸å°ã¨ãã¦count++ã復活ããã10ç§å¾ã«ããã¤ãªã®ãã表示ãããããã«ããã¿ããã§ãã
ããã¦ãèµ·åå¾3ç§éã¯æ°ããªãããã«ãã¦ï¼èª¤å·®ãããããçºçãã¦ãã¾ãããã§ãï¼
ãã¨ã¯ã12æ¥ã®æã®ãã¼ã¿ã§ç¢ºèªããã¨
harib10c
harib10d
harib10e
harib10f
ã¨ãã£ãæãã«ãªãã¾ãã
FIFOãããã¡ãè¦ç´ã(harib10g)
å
¨ã¦ã®ãã¼ã¿ã®éä¿¡ã«ä¸ã¤ã®FIFOãããã¡ã§å¯¾å¿ãããã¨ãããã¨ã¿ããã§ãã
ãã®ããã«ãã¼ã¿ã大å¹
ã«å ç®ããããããã¨ã§å¤ãå¤ããæ¡ä»¶åå²ããããã§ãããCharåãªã®ã§å¯¾å¿ãã§ããªãã¨â¦
ã¨ãããã¨ã§intåã§å¯¾å¿ããããã«å
¨ä½çãªä¿®æ£ãè¡ãããã§ãã
åºæ¬çã«ãããã¨åãã¿ããã§ãããintåã¸ã®å¯¾å¿ã®ããçµæ§ãããã¿ããã§ããâ¦
ãã®ãã¼ã¿æ§é ã®ãã¨ãç·å½¢ãªã¹ã
ã¨å¼ã¶ããã§ãã
å®è¡ããã¨
çªå µã使ã£ã¦ããã°ã©ã ãçããã¦ã¿ã(harib10i)
çªå µã¨ããããã°ã©ãã³ã°ãã¯ããã¯ã使ç¨ãããã°ã©ãã³ã°ã®ç縮ãè¡ã£ã¦ã¿ãã¿ããã§ãã
ãã®çªå
µããããããã§
ã»åä½ä¸ã®ã¿ã¤ãã¯ããä¸ã¤ã«ãªãå ´å
ã»å
é ã«å
¥ããå ´å
ã»ä¸çªå¾ãã«å
¥ããå ´å
ã®ãã¡ã1åç®ï¼çªå
µãããã®ã§æä½2åã«ãªãï¼ã¨ååç®ï¼çªå
µããã¤ãå¾ãï¼ãæ¶ãããã¨ã§16è¡ãã·ã§ã¼ãã«ããã§ããã¿ããã§ãã
ãã®ãããã§
void timer_settime(struct TIMER *timer, unsigned int timeout) { int e; struct TIMER *t, *s; timer->timeout = timeout + timerctl.count; timer->flags = TIMER_FLAGS_USING; e = io_load_eflags(); io_cli(); timerctl.using++; if (timerctl.using == 1) { /* åä½ä¸ã®ã¿ã¤ãã¯ãã1ã¤ã«ãªãå ´å */ timerctl.t0 = timer; timer->next = 0; /* 次ã¯ãªã */ timerctl.next = timer->timeout; io_store_eflags(e); return; } t = timerctl.t0; if (timer->timeout <= t->timeout) { /* å é ã«å ¥ããå ´å */ timerctl.t0 = timer; timer->next = t; /* 次ã¯t */ timerctl.next = timer->timeout; io_store_eflags(e); return; } /* ã©ãã«å ¥ããã°ããããæ¢ã */ for (;;) { s = t; t = t->next; if (t == 0) { break; /* ä¸çªå¾ãã«ãªã£ã */ } if (timer->timeout <= t->timeout) { /* sã¨tã®éã«å ¥ããå ´å */ s->next = timer; /* sã®æ¬¡ã¯timer */ timer->next = t; /* timerã®æ¬¡ã¯t */ io_store_eflags(e); return; } } /* 1çªç®å¾ãã«å ¥ããå ´å */ s->next = timer; timer->next = 0; io_store_eflags(e); return; }
ã
/* timersã¸ã®ç»é²ã追å */ void timer_settime(struct TIMER *timer, unsigned int timeout) { int e; struct TIMER *t, *s; timer->timeout = timeout + timerctl.count; timer->flags = TIMER_FLAGS_USING; e = io_load_eflags(); io_cli(); t = io_load_eflags(); if (timer->timeout <= t->timeout) { /* å é ã«å ¥ããå ´å */ timerctl.t0 = timer; timer->next = t; /* 次ã¯ï½ */ timerctl.next = timer->timeout; io_store_eflags(e); return; } /* ã©ãã«å ¥ããã°ããããæ¢ã */ for (;;) { s = t; t = t->next; if (timer->timeout <= t->timeout) { /* sã¨tã®éã«å ¥ããå ´å */ s->next = timer; /* sã®æ¬¡ã¯timer */ timer->next = t; /* timerã®æ¬¡ã¯t */ io_store_eflags(e); return; } } }
ãããªãã¾ãã
ã¾ããinthandker20ã
/* IDT20ã®å¦çè¨å® */ void inthandler20(int *esp) { int i; /* */ struct TIMER *timer; io_out8(PIC0_OCW2, 0x60); /* IRQ-00åä»å®äºãPICã«éç¥ */ timerctl.count++; /* æå®ã«å¾ãã«ã¦ã³ããã */ if (timerctl.next > timerctl.count) { return; /* ã¾ã 次ã®æå»ã«ãªã£ã¦ããªãã®ã§ãããããã¾ã */ } timer = timerctl.t0; /* ã¨ããããå é ã®çªå°ãtimerã«ä»£å ¥ */ for (i = 0;i < timerctl.using; i++) { /* timers ã®ã¿ã¤ãã¯å ¨ã¦åä½ä¸ã®ãã®ãªã®ã§ãflagsã確èªããªã */ if (timer->timeout > timerctl.count) { break; } /* ã¿ã¤ã ã¢ã¦ã */ timer->flags = TIMER_FLAGS_ALLOC; fifo32_put(timer->fifo, timer->data); timer = timer->next; /* 次ã®ã¿ã¤ãã®çªå°ãtimerã«ä»£å ¥ */ } timerctl.using -= i; /* æ°ããããã */ timerctl.t0 = timer; /* timerctl.nextã®è¨å® */ if (timerctl.using > 0) { timerctl.next = timerctl.t0->timeout; } else { timerctl.next = 0xffffffff; } return; }
ã
/* IDT20ã®å¦çè¨å® */ void inthandler20(int *esp) { int i; /* */ struct TIMER *timer; io_out8(PIC0_OCW2, 0x60); /* IRQ-00åä»å®äºãPICã«éç¥ */ timerctl.count++; /* æå®ã«å¾ãã«ã¦ã³ããã */ if (timerctl.next > timerctl.count) { return; /* ã¾ã 次ã®æå»ã«ãªã£ã¦ããªãã®ã§ãããããã¾ã */ } timer = timerctl.t0; /* ã¨ããããå é ã®çªå°ãtimerã«ä»£å ¥ */ for (;;) { /* timers ã®ã¿ã¤ãã¯å ¨ã¦åä½ä¸ã®ãã®ãªã®ã§ãflagsã確èªããªã */ if (timer->timeout > timerctl.count) { break; } /* ã¿ã¤ã ã¢ã¦ã */ timer->flags = TIMER_FLAGS_ALLOC; fifo32_put(timer->fifo, timer->data); timer = timer->next; /* 次ã®ã¿ã¤ãã®çªå°ãtimerã«ä»£å ¥ */ } /* æ°ããããã */ timerctl.t0 = timer; timerctl.next = timerctl.t0->timeout; return; }
ã³ã£ãããããããçããªãã¾ããâ¦ãããªææ³ããã£ãã¨ã¯â¦
ãã®å¾make runããã¨
ãããªæãã§ããï¼
æå¾ã«
è²ã ãªæ¹é ãå¦ã¹ã¾ããããããããã¼ã¿æ§é ãªã®ããªï¼çµãã£ãå¾ã«æ¬æ ¼çã«å¦ã³ããã§ããâ¦