//kernel.c //08/13/03 Josh Holtrop //Holtrop's Operating System #include "k_defines.h" #include "functions.h" void isr(int num); void k_init(); #include "functions.c" //9000:306 typedef struct{ USHORT ModeAttributes; UCHAR WinAAttributes; UCHAR WinBAttributes; USHORT WinGranularity; USHORT WinSize; USHORT WinASegment; USHORT WinBSegment; UINT WinFuncPtr; USHORT BytesPerScanLine; USHORT XResolution; USHORT YResolution; UCHAR XCharSize; UCHAR YCharSize; UCHAR NumberOfPlanes; UCHAR BitsPerPixel; UCHAR NumberOfBanks; UCHAR MemoryModel; UCHAR BankSize; UCHAR NumberOfImagePages; UCHAR Reserved1; UCHAR RedMaskSize; UCHAR RedFieldPosition; UCHAR GreenMaskSize; UCHAR GreenFieldPosition; UCHAR BlueMaskSize; UCHAR BlueFieldPosition; UCHAR RsvdMaskSize; UCHAR RsvdFieldPosition; UCHAR DirectColorModeInfo; dword PhysBasePtr; UINT OffScreenMemOffset; USHORT OffScreenMemSize; UCHAR Reserved[206]; } ModeInfoBlock; void k_init() { remap_pics(0x20, 0x28); //set timer : 2e9c = 100hz outportb(0x43, 0x34); outportb(0x40, 0x9c); //lsb outportb(0x40, 0x2e); //msb enable_ints(); ModeInfoBlock *mib = (ModeInfoBlock *) 0x90306; UINT *vid = (UINT *) (mib->PhysBasePtr); UINT a; UINT tot = ((mib->XResolution) * (mib->YResolution)); word step = 0x1000000 / tot; //step to increase color by for each pixel dword color = 0; for (a = 0; a < tot; a++) { vid[a] = color; color += step; } } void isr(int num) { if (num == 0x20) { (*(char*)0xB8000)++; *(char*)0xB8001 = 7; eoi(); } }