]> Joshua Wise's Git repositories - netwatch.git/blame - aseg/counter.c
Merge ELF loader.
[netwatch.git] / aseg / counter.c
CommitLineData
035d7af7
JW
1#include <io.h>
2
4bea7daf 3char counter = 0;
035d7af7
JW
4unsigned long pcisave;
5unsigned char vgasave;
6unsigned char thestr[512];
4bea7daf 7
035d7af7
JW
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{
9b8c947b 28 char *destp = (char*)(0xB8000UL | (((unsigned int)vgaread(0xC)) << 9) | (((unsigned int)vgaread(0xD)) << 1));
035d7af7
JW
29 while (*src)
30 {
31 *(destp++) = *(src++);
32 *(destp++) = 0x1F;
33 }
34}
4bea7daf 35
015cd976
JW
36void __start (void)
37{
035d7af7
JW
38 unsigned char smramc;
39
40 pcisave = inl(0xCF8);
41 vgasave = inb(0x3D4);
42
4bea7daf 43 counter++;
035d7af7
JW
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);
a46bffee
JW
55
56 outb(0x834, 0x40); // ack the periodic IRQ
57 outb(0x830, (inb(0x830) | 0x2) & ~0x40);
58 outb(0x830, inb(0x830) | 0x40);
59
4bea7daf
JW
60}
61
This page took 0.032991 seconds and 4 git commands to generate.