X-Git-Url: http://git.joshuawise.com/netwatch.git/blobdiff_plain/8f946ddedda18836cfc4846e8496b30772503267..035d7af7dd4727735ec57f8195a4842e31ffc997:/aseg/counter.c?ds=inline diff --git a/aseg/counter.c b/aseg/counter.c index edad021..de82574 100644 --- a/aseg/counter.c +++ b/aseg/counter.c @@ -1,11 +1,56 @@ +#include + char counter = 0; +unsigned long pcisave; +unsigned char vgasave; +unsigned char thestr[512]; -#define outb(port, val) \ -({ asm volatile("outb %0, %%dx" : : "a" ((unsigned char)(val)) , "d" ((unsigned short)(port))); }) +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*)(0xB8000 | (vgaread(0xC) << 5) | (vgaread(0xD) << 1)); + while (*src) + { + *(destp++) = *(src++); + *(destp++) = 0x1F; + } +} void __start (void) { + unsigned char smramc; + + pcisave = inl(0xCF8); + vgasave = inb(0x3D4); + 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); }