X-Git-Url: http://git.joshuawise.com/netwatch.git/blobdiff_plain/4bea7daf0e70a1540b8533c8253c197bb282416e..f16f4f1e99d1b45e7f0ba828616c1afdd1b50721:/aseg/counter.c diff --git a/aseg/counter.c b/aseg/counter.c index 891c075..8f807aa 100644 --- a/aseg/counter.c +++ b/aseg/counter.c @@ -1,10 +1,61 @@ +#include + char counter = 0; +unsigned long pcisave; +unsigned char vgasave; +unsigned char thestr[512]; + +void memcpy(char *dst, char *src, int c) +{ + while (c--) + *(dst++) = *(src++); +} + +void strcpy(char *dst, char *src) +{ + while (*src) + *(dst++) = *(src++); +} + +unsigned char vgaread(unsigned char idx) +{ + outb(0x3D4, idx); + inb(0x3D5); +} + +void strblit(char *src) +{ + char *destp = (char*)(0xB8000UL | (((unsigned int)vgaread(0xC)) << 9) | (((unsigned int)vgaread(0xD)) << 1)); + while (*src) + { + *(destp++) = *(src++); + *(destp++) = 0x1F; + } +} -#define outb(port, val) \ -({ asm volatile("outb %0, %%dx" : : "a" ((unsigned char)(val)) , "d" ((unsigned short)(port))); }) +void __start (void) +{ + unsigned char smramc; + + pcisave = inl(0xCF8); + vgasave = inb(0x3D4); -void __start (void) { counter++; - outb (0x80, counter); + outb(0x80, counter); + + strcpy(thestr, "15-412!"); + + smramc = pci_read8(0, 0, 0, 0x70); + pci_write8(0, 0, 0, 0x70, (smramc & 0xF3) | 0x08); + strblit(thestr); + pci_write8(0, 0, 0, 0x70, smramc); + + outl(0xCF8, pcisave); + outb(0x3D4, vgasave); + + outb(0x834, 0x40); // ack the periodic IRQ + outb(0x830, (inb(0x830) | 0x2) & ~0x40); + outb(0x830, inb(0x830) | 0x40); + }