#include #include static char* numeric[] = { "1", "2", "4", "8", "16", "33", "66", "100" }; void show() { unsigned short reg, i; outportb(0x22,0x80); reg = inportb(0x23); i = reg >> 5; if ( i > 5 ) i += reg & 1; puts(numeric[i]); } void setclk(int hyper, int speed) { unsigned short reg; outportb(0x22,0x80); reg = inportb(0x23); outportb(0x22,0x80); outportb(0x23,(reg & 0xFE) | hyper); outportb(0x22,0x40); reg = inportb(0x23); outportb(0x22,0x40); outportb(0x23,(reg & 0xF8) | speed); } void main(int argc, char **argv) { if (argc == 2) { switch (argv[1][0]) { case '3': setclk(0,0); break; case '6': setclk(0,1); break; case '9': case '1': setclk(1,1); break; } } sleep(1); show(); }