]> Joshua Wise's Git repositories - netwatch.git/blame_incremental - aseg/counter.c
add elf loader to grub boot; doesn't do aseg opening yet (todo!)
[netwatch.git] / aseg / counter.c
... / ...
CommitLineData
1#include <io.h>
2
3char counter = 0;
4unsigned long pcisave;
5unsigned char vgasave;
6unsigned char thestr[512];
7
8void memcpy(char *dst, char *src, int c)
9{
10 while (c--)
11 *(dst++) = *(src++);
12}
13
14void strcpy(char *dst, char *src)
15{
16 while (*src)
17 *(dst++) = *(src++);
18}
19
20unsigned char vgaread(unsigned char idx)
21{
22 outb(0x3D4, idx);
23 inb(0x3D5);
24}
25
26void strblit(char *src)
27{
28 char *destp = (char*)(0xB8000UL | (((unsigned int)vgaread(0xC)) << 9) | (((unsigned int)vgaread(0xD)) << 1));
29 while (*src)
30 {
31 *(destp++) = *(src++);
32 *(destp++) = 0x1F;
33 }
34}
35
36void __start (void)
37{
38 unsigned char smramc;
39
40 pcisave = inl(0xCF8);
41 vgasave = inb(0x3D4);
42
43 counter++;
44 outb(0x80, counter);
45
46 strcpy(thestr, "15-412!");
47
48 smramc = pci_read8(0, 0, 0, 0x70);
49 pci_write8(0, 0, 0, 0x70, (smramc & 0xF3) | 0x08);
50 strblit(thestr);
51 pci_write8(0, 0, 0, 0x70, smramc);
52
53 outl(0xCF8, pcisave);
54 outb(0x3D4, vgasave);
55
56 outb(0x834, 0x40); // ack the periodic IRQ
57 outb(0x830, (inb(0x830) | 0x2) & ~0x40);
58 outb(0x830, inb(0x830) | 0x40);
59
60}
61
This page took 0.023254 seconds and 4 git commands to generate.