Advertisement
Guest User

TIMER.C

a guest
Feb 1st, 2018
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include <dos.h>
  2. #include <stdio.h>
  3. int a = 0;
  4. int b = 0;
  5. int c = 1;
  6. void interrupt clocktick(){
  7.     b++;
  8.     outp(0x20, 0x20);
  9.     outp(0x36, 0x43);
  10. }
  11. int main(void){
  12.     /* set PIT mode*/
  13.     outp(0x36, 0x43);
  14.     outp(0x01,0x40); /* send low byte*/
  15.     outp(0x00,0x40); /* send high byte*/
  16.     setvect(0x08, clocktick);
  17.     while(c == 1){
  18.         printf("b%i\n", b);
  19.     }
  20.     getchar();
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement