I was pm'd asking about my code, so for reference, it is posted for everyone (it is pretty dependant on my kernel, but the basic idea should be simple, especially the stub program!). I was having issues with the position independant code, so here is a position dependant version that is currently working, should be easily adaptable if you wanted to.
****** Edit **** Oops, pasted the wrong file in here!!!! Hopefully this makes more sense now!
Now, the VESA header file, includes my ASCII font that I typed by hand into my editor
Code: Select all
#ifndef VESA_H
#define VESA_H
struct VBEInfo_S
{
s8 Signature[4]; //Signature 'VESA', returns VBE2
u16 Version; //0x0200
u32 OEMString; //Pointer to OEM string (fix me, we are seg:off)
u32 Caps; //Capabilities, unused for now
u32 VideoModePtr; //Pointer to video modes (fix me, we are seg:off)
u16 TotalMemory; //How many 64k segments we have
u16 SoftwareRev; //Software revision
u32 OEMVendorPtr; //(fix me, we are seg:off)
u32 OEMNamePtr; //(fix me, we are seg:off)
u32 OEMRevPtr; //(fix me, we are seg:off)
};
struct VBEModeInfo_S
{
u16 ModeAttributes;
u8 WinAAttributes,WinBAttributes;
u16 WinGranularity;
u16 WinSize;
u16 WinASegment,WinBSegment;
u32 WinFuncPtr;
u16 BytesPerScanLine;
u16 XRes;
u16 YRes;
u8 XCharSize,YCharSize;
u8 NumberOfPlanes;
u8 BitsPerPixel;
u8 NumberOfBanks;
u8 MemoryModel;
u8 BankSize;
u8 NumberOfImagePages;
u8 res1;
u8 RedMaskSize,RedFieldPosition;
u8 GreenMaskSize,GreenFieldPosition;
u8 BlueMaskSize,BlueFieldPosition;
u8 RsvedMaskSize,RsvedFieldPosition;
u8 DirectColorModeAttr;
//VBE 2.0
u32 PhysBasePtr;
u32 OffScreenMemOffset;
u16 OffScreenMemSize;
};
struct VESARegs_S
{
u16 ax;
u16 bx;
u16 cx;
u16 dx;
};
struct VESAMode_S
{
u32 Mode;
u32 BasePtr;
u32 Attributes;
u32 Width, Height;
u32 BitDepth;
u32 ScanlineWidth;
u8 RedMaskSize, RedPosition;
u8 GreenMaskSize, GreenPosition;
u8 BlueMaskSize, BluePosition;
};
//Max of 256
u8 AsciiChars[256*8] =
{
0,0,0,0,0,0,0,0, //0
0,0,0,0,0,0,0,0, //1
0,0,0,0,0,0,0,0, //2
0,0,0,0,0,0,0,0, //3
0,0,0,0,0,0,0,0, //4
0,0,0,0,0,0,0,0, //5
0,0,0,0,0,0,0,0, //6
0,0,0,0,0,0,0,0, //7
0,0,0,0,0,0,0,0, //8
0,0,0,0,0,0,0,0, //9
0,0,0,0,0,0,0,0, //10
0,0,0,0,0,0,0,0, //11
0,0,0,0,0,0,0,0, //12
0,0,0,0,0,0,0,0, //13
0,0,0,0,0,0,0,0, //14
0,0,0,0,0,0,0,0, //15
0,0,0,0,0,0,0,0, //16
0,0,0,0,0,0,0,0, //17
0,0,0,0,0,0,0,0, //18
0,0,0,0,0,0,0,0, //19
0,0,0,0,0,0,0,0, //20
0,0,0,0,0,0,0,0, //21
0,0,0,0,0,0,0,0, //22
0,0,0,0,0,0,0,0, //23
0,0,0,0,0,0,0,0, //24
0,0,0,0,0,0,0,0, //25
0,0,0,0,0,0,0,0, //26
0,0,0,0,0,0,0,0, //27
0,0,0,0,0,0,0,0, //28
0,0,0,0,0,0,0,0, //29
0,0,0,0,0,0,0,0, //30
0,0,0,0,0,0,0,0, //31
0,0,0,0,0,0,0,0, //32
/* 33 '!' */
0x10, //00010000
0x10, //00010000
0x10, //00010000
0x10, //00010000
0x10, //00010000
0x00, //00000000
0x10, //00010000
0x00, //00000000
/* 34 '"' */
0x6c, //01101100
0x6c, //01101100
0x28, //00101000
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x00, //00000000
/* 35 '#' */
0x24, //00100100
0x24, //00100100
0x7E, //01111110
0x24, //00100100
0x7E, //01111110
0x24, //00100100
0x24, //00100100
0x00, //00000000
/* 36 '$' */
0x10, //00010000
0x7C, //01111100
0x90, //10010000
0x7C, //01111100
0x12, //00010010
0x7C, //01111100
0x10, //00010000
0x00, //00000000
/* 37 '%' */
0x00, //00000000
0x44, //01000100
0x08, //00001000
0x10, //00010000
0x20, //00100000
0x44, //01000100
0x00, //00000000
0x00, //00000000
/* 38 '&' */
0x70, //01110000
0x88, //10001000
0x50, //01010000
0x20, //00100000
0x54, //01010100
0x88, //10001000
0x74, //01110100
0x00, //00000000
/* 39 ''' */
0x18, //00011000
0x10, //00010000
0x20, //00100000
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x00, //00000000
/* 40 '(' */
0x08, //00001000
0x10, //00010000
0x20, //00100000
0x20, //00100000
0x20, //00100000
0x10, //00010000
0x08, //00001000
0x00, //00000000
/* 41 ')' */
0x20, //00100000
0x10, //00010000
0x08, //00001000
0x08, //00001000
0x08, //00001000
0x10, //00010000
0x20, //00100000
0x00, //00000000
/* 42 '*' */
0x00, //00000000
0x44, //01000100
0x28, //00101000
0x7C, //01111100
0x28, //00101000
0x44, //01000100
0x00, //00000000
0x00, //00000000
/* 43 '+' */
0x00, //00000000
0x10, //00010000
0x10, //00010000
0x7C, //01111100
0x10, //00010000
0x10, //00010000
0x00, //00000000
0x00, //00000000
/* 44 ',' */
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x18, //00011000
0x10, //00010000
0x20, //00100000
/* 45 '-' */
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x7C, //01111100
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x00, //00000000
/* 46 '.' */
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x18, //00011000
0X18, //00011000
0x00, //00000000
/* 47 '/' */
0x00, //00000000
0x04, //00000100
0x08, //00001000
0x10, //00010000
0x20, //00100000
0x40, //01000000
0x00, //00000000
0x00, //00000000
/* 48 '0' */
0x38, //00111000
0x44, //01000100
0x8A, //10001010
0x92, //10010010
0xA2, //10100010
0x44, //01000100
0x38, //00111000
0x00, //00000000
/* 49 '1' */
0x18, //00011000
0x28, //00101000
0x48, //01001000
0x08, //00001000
0x08, //00001000
0x08, //00001000
0x7E, //01111110
0x00, //00000000
/* 50 '2' */
0x7C, //01111100
0x82, //10000010
0x82, //10000010
0x1C, //00011100
0xE0, //11100000
0x80, //10000000
0xFE, //11111110
0x00, //00000000
/* 51 '3' */
0x7C, //01111100
0x82, //10000010
0x02, //00000010
0x1C, //00011100
0x02, //00000010
0x82, //10000010
0x7C, //01111100
0x00, //00000000
/* 52 '4' */
0x04, //00000100
0x44, //01000100
0x44, //01000100
0x7C, //01111100
0x04, //00000100
0x04, //00000100
0x04, //00000100
0x00, //00000000
/* 53 '5' */
0xFE, //11111110
0x80, //10000000
0xFC, //11111100
0x02, //00000010
0x02, //00000010
0x82, //10000010
0x7C, //01111100
0x00, //00000000
/* 54 '6' */
0x06, //00000110
0x18, //00011000
0x20, //00100000
0x7C, //01111100
0x82, //10000010
0x82, //10000010
0x7C, //01111100
0x00, //00000000
/* 55 '7' */
0xFE, //11111110
0x84, //10000100
0x08, //00001000
0x08, //00001000
0x10, //00010000
0x10, //00010000
0x20, //00100000
0x00, //00000000
/* 56 '8' */
0x7C, //01111100
0x82, //10000010
0x82, //10000010
0x7C, //01111100
0x82, //10000010
0x82, //10000010
0x7C, //01111100
0x00, //00000000
/* 57 '9' */
0x7E, //01111110
0x82, //10000010
0x82, //10000010
0x7E, //01111110
0x04, //00000100
0x04, //00000100
0x08, //00001000
0x00, //00000000
/* 58 ':' */
0x00, //00000000
0x10, //00010000
0x00, //00000000
0x00, //00000000
0x10, //00010000
0x00, //00000000
0x00, //00000000
0x00, //00000000
/* 59 ';' */
0x00, //00000000
0x10, //00010000
0x00, //00000000
0x00, //00000000
0x10, //00010000
0x20, //00100000
0x00, //00000000
0x00, //00000000
/* 60 '<' */
0x08, //00001000
0x10, //00010000
0x20, //00100000
0x40, //01000000
0x20, //00100000
0x10, //00010000
0x08, //00001000
0x00, //00000000
/* 61 '=' */
0x00, //00000000
0x00, //00000000
0x7C, //01111100
0x00, //00000000
0x00, //00000000
0x7C, //01111100
0x00, //00000000
0x00, //00000000
/* 62 '>' */
0x20, //00100000
0x10, //00010000
0x08, //00001000
0x04, //00000100
0x08, //00001000
0x10, //00010000
0x20, //00100000
0x00, //00000000
/* 63 '?' */
0x7C, //01111100
0x82, //10000010
0x04, //00000100
0x08, //00001000
0x10, //00010000
0x00, //00000000
0x10, //00010000
0x00, //00000000
/* 64 '@' */
0x7C, //01111100
0x82, //10000010
0xBA, //10111010
0xAA, //10101010
0xBE, //10111110
0x80, //10000000
0x7E, //01111110
0x00, //00000000
/* 65 'A' */
0x10, //00010000
0x28, //00101000
0x28, //00101000
0x44, //01000100
0x7C, //01111100
0x82, //10000010
0x82, //10000010
0x00, //00000000
/* 66 'B' */
0xFC, //11111100
0x82, //10000010
0x82, //10000010
0xFC, //11111100
0x82, //10000010
0x82, //10000010
0xFC, //11111100
0x00, //00000000
/* 67 'C' */
0x7C, //01111100
0x82, //10000010
0x80, //10000000
0x80, //10000000
0x80, //10000000
0x82, //10000010
0x7C, //01111100
0x00, //00000000
/* 68 'D'*/
0xF8, //11111000
0x84, //10000100
0x82, //10000010
0x82, //10000010
0x82, //10000010
0x84, //10000100
0xF8, //11111000
0x00, //00000000
/* 69 'E' */
0xFE, //11111110
0x80, //10000000
0x80, //10000000
0xF8, //11111000
0x80, //10000000
0x80, //10000000
0xFE, //11111110
0x00, //00000000
/* 70 'F' */
0xFE, //11111110
0x80, //10000000
0x80, //10000000
0xF8, //11111000
0x80, //10000000
0x80, //10000000
0x80, //10000000
0x00, //00000000
/* 71 'G' */
0x7C, //01111100
0x82, //10000010
0x80, //10000000
0x80, //10000000
0x9C, //10011100
0x82, //10000010
0x7C, //01111100
0x00, //00000000
/* 72 'H' */
0x82, //10000010
0x82, //10000010
0x82, //10000010
0xFE, //11111110
0x82, //10000010
0x82, //10000010
0x82, //10000010
0x00, //00000000
/* 73 'I' */
0x7C, //01111100
0x10, //00010000
0x10, //00010000
0x10, //00010000
0x10, //00010000
0x10, //00010000
0x7C, //01111100
0x00, //00000000
/* 74 'J' */
0x3E, //00111110
0x08, //00001000
0x08, //00001000
0x08, //00001000
0x08, //00001000
0x88, //10001000
0x70, //01110000
0x00, //00000000
/* 75 'K' */
0x86, //10000110
0x88, //10001000
0x90, //10010000
0xA0, //11100000
0xD0, //10010000
0x88, //10001000
0x86, //10000110
0x00, //00000000
/* 76 'L' */
0x80, //10000000
0x80, //10000000
0x80, //10000000
0x80, //10000000
0x80, //10000000
0x80, //10000000
0xFE, //11111110
0x00, //00000000
/* 77 'M' */
0x82, //10000010
0xC6, //11000110
0xAA, //10101010
0x92, //10010010
0x82, //10000010
0x82, //10000010
0x82, //10000010
0x00, //00000000
/* 78 'N' */
0x82, //10000010
0xC2, //11000010
0xA2, //10100010
0x92, //10010010
0x8A, //10001010
0x86, //10000110
0x82, //10000010
0x00, //00000000
/* 79 'O' */
0x38, //00111000
0x44, //01000100
0x82, //10000010
0x82, //10000010
0x82, //10000010
0x44, //01000100
0x38, //00111000
0x00, //00000000
/* 80 'P' */
0xFC, //11111100
0x82, //10000010
0x82, //10000010
0xFC, //11111100
0x80, //10000000
0x80, //10000000
0x80, //10000000
0x00, //00000000
/* 81 'Q' */
0x38, //00111000
0x44, //01000100
0x82, //10000010
0x82, //10000010
0x9A, //10011010
0x44, //01000100
0x3A, //00111010
0x00, //00000000
/* 82 'R' */
0xFC, //11111100
0x82, //10000010
0x82, //10000010
0xFC, //11111100
0x90, //10010000
0x88, //10001000
0x86, //10000110
0x00, //00000000
/* 83 'S' */
0x7C, //01111100
0x82, //10000010
0x80, //10000000
0x7C, //01111100
0x02, //00000010
0x82, //10000010
0x7C, //01111100
0x00, //00000000
/* 84 'T' */
0xFE, //11111110
0x10, //00010000
0x10, //00010000
0x10, //00010000
0x10, //00010000
0x10, //00010000
0x10, //00010000
0x00, //00000000
/* 85 'U' */
0x82, //10000010
0x82, //10000010
0x82, //10000010
0x82, //10000010
0x82, //10000010
0x44, //01000100
0x38, //00111000
0x00, //00000000
/* 86 'V' */
0x82, //10000010
0x82, //10000010
0x44, //01000100
0x44, //01000100
0x28, //00101000
0x28, //00101000
0x10, //00010000
0x00, //00000000
/* 87 'W' */
0x82, //10000010
0x82, //10000010
0x92, //10010010
0x92, //10010010
0xAA, //10101010
0xAA, //10101010
0x44, //01000100
0x00, //00000000
/* 88 'X' */
0x82, //10000010
0x44, //01000100
0x28, //00101000
0x10, //00010000
0x28, //00101000
0x44, //01000100
0x82, //10000010
0x00, //00000000
/* 89 'Y' */
0x82, //10000010
0x44, //01000100
0x28, //00101000
0x10, //00010000
0x10, //00010000
0x10, //00010000
0x10, //00010000
0x00, //00000000
/* 90 'Z' */
0xFE, //11111110
0x04, //00000100
0x08, //00001000
0x10, //00010000
0x20, //00100000
0x40, //01000000
0xFE, //11111110
0x00, //00000000
/* 91 '[' */
0x38, //00111000
0x20, //00100000
0x20, //00100000
0x20, //00100000
0x20, //00100000
0x20, //00100000
0x38, //00111000
0x00, //00000000
/* 92 '\' */
0x00, //00000000
0x40, //01000000
0x20, //00100000
0x10, //00010000
0x08, //00001000
0x04, //00000100
0x00, //00000000
0x00, //00000000
/* 93 ']' */
0x38, //00111000
0x08, //00001000
0x08, //00001000
0x08, //00001000
0x08, //00001000
0x08, //00001000
0x38, //00111000
0x00, //00000000
/* 94 '^' */
0x10, //00010000
0x28, //00101000
0x44, //01000100
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x00, //00000000
/* 95 '_' */
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x00, //00000000
0xFF, //11111111
/* 96 '`' */
0x30, //00110000
0x10, //00010000
0x08, //00001000
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x00, //00000000
/* 97 'a' */
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x7C, //01111100
0x84, //10000100
0x84, //10000100
0x7A, //01111010
0x00, //00000000
/* 98 'b' */
0x80, //10000000
0x80, //10000000
0x80, //10000000
0x78, //11111000
0x84, //10000100
0x84, //10000100
0x78, //11111000
0x00, //00000000
/* 99 'c' */
0x00, //00000000
0x00, //00000000
0x38, //00111000
0x44, //01000100
0x80, //10000000
0x44, //01000100
0x38, //00111000
0x00, //00000000
/* 100 'd' */
0x04, //00000100
0x04, //00000100
0x04, //00000100
0x7C, //01111100
0x84, //10000100
0x84, //10000100
0x7C, //01111100
0x00, //00000000
/* 101 'e' */
0x00, //00000000
0x00, //00000000
0x78, //01111000
0x84, //10000100
0xFC, //11111100
0x80, //10000000
0x7C, //01111100
0x00, //00000000
/* 102 'f' */
0x38, //00111000
0x44, //01000100
0x40, //01000000
0xF0, //11110000
0x40, //01000000
0x40, //01000000
0x40, //01000000
0x00, //00000000
/* 103 'g' */
0x00, //00000000
0x00, //00000000
0x38, //00111000
0x44, //01000100
0x44, //01000100
0x3C, //00111100
0x04, //00000100
0x38, //00111000
/* 104 'h' */
0x80, //10000000
0x80, //10000000
0x80, //10000000
0xB8, //10111000
0xC4, //11000100
0x84, //10000100
0x84, //10000100
0x00, //00000000
/* 105 'i' */
0x00, //00000000
0x10, //00010000
0x00, //00000000
0x10, //00010000
0x10, //00010000
0x10, //00010000
0x10, //00010000
0x00, //00000000
/* 106 'j' */
0x00, //00000000
0x08, //00001000
0x00, //00000000
0x08, //00001000
0x08, //00001000
0x08, //00001000
0x48, //01001000
0x30, //00110000
/* 107 'k' */
0x80, //10000000
0x80, //10000000
0x98, //10011000
0xA0, //10100000
0xC0, //11000000
0xA0, //10100000
0x90, //10010000
0x00, //00000000
/* 108 'l' */
0x00, //00000000
0x20, //00100000
0x20, //00100000
0x20, //00100000
0x20, //00100000
0x20, //00100000
0x30, //00110000
0x00, //00000000
/* 109 'm' */
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x6C, //01101100
0x92, //10010010
0x92, //10010010
0X92, //10010010
0x00, //00000000
/* 110 'n' */
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x78, //01111000
0x84, //10000100
0x84, //10000100
0x84, //10000100
0x00, //00000000
/* 111 'o' */
0x00, //00000000
0x00, //00000000
0x78, //01111000
0x84, //10000100
0x84, //10000100
0x84, //10000100
0x78, //01111000
0x00, //00000000
/* 112 'p' */
0x00, //00000000
0x00, //00000000
0xB8, //10111000
0xC4, //11000100
0x82, //10000010
0xC4, //11000100
0xB8, //10111000
0x80, //10000000
/* 113 'q' */
0x00, //00000000
0x00, //00000000
0x78, //01111000
0x84, //10000100
0x84, //10000100
0x7C, //01111100
0x04, //00000100
0x06, //00000110
/* 114 'r' */
0x00, //00000000
0x00, //00000000
0x5C, //01011100
0x22, //00100010
0x20, //00100000
0x20, //00100000
0x20, //00100000
0x00, //00000000
/* 115 's' */
0x00, //00000000
0x00, //00000000
0x3C, //00111100
0x40, //01000000
0x38, //00111000
0x04, //00000100
0x78, //01111000
0x00, //00000000
/* 114 't' */
0x00, //00000000
0x00, //00000000
0x10, //00010000
0x3C, //00111100
0x10, //00010000
0x10, //00010000
0x10, //00010000
0x00, //00000000
/* 115 'u' */
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x44, //01000100
0x44, //01000100
0x44, //01000100
0x3A, //00111010
0x00, //00000000
/* 116 'v' */
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x82, //10000010
0x44, //01000100
0x28, //00101000
0x10, //00010000
0x00, //00000000
/* 117 'w' */
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x82, //10000010
0x92, //10010010
0x54, //01010100
0x28, //00101000
0x00, //00000000
/* 118 'x' */
0x00, //00000000
0x00, //00000000
0x44, //01000100
0x28, //00101000
0x10, //00010000
0x28, //00101000
0x44, //01000100
0x00, //00000000
/* 119 'y' */
0x00, //00000000
0x00, //00000000
0x00, //00000000
0x82, //10000010
0x44, //01000100
0x28, //00101000
0x10, //00010000
0x60, //01100000
/* 120 'z' */
0x00, //00000000
0x00, //00000000
0x7C, //01111100
0x08, //00001000
0x10, //00010000
0x20, //00100000
0x7C, //01111100
0x00, //00000000
};
#endif
Last but not least, my VESA driver thus far (not much functionality yet).