Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <l4io.h>
- #include <l4/sigma0.h>
- #include <l4/ia32/arch.h>
- void set_port(unsigned int port_address, unsigned char index, unsigned char value)
- {
- unsigned int port_register = port_address;
- if(port_address!=0x3C0)
- port_register = port_address+1;
- __asm__ __volatile__ ("out %%al, %%dx" :: "a" (index), "d" (port_address));
- __asm__ __volatile__ ("out %%al, %%dx" :: "a" (value), "d" (port_register));
- }
- int main(int argc, char** argv)
- {
- //definitions
- L4_Fpage_t VGA;
- volatile L4_Word_t* pixels;
- __asm__ __volatile__ ("in %%dx, %%al" :: "a" (0x3DA));
- set_port(0x3C0, 0x00, 0x41);
- set_port(0x3C0, 0x01, 0x00);
- set_port(0x3C0, 0x02, 0x0F);
- set_port(0x3C0, 0x03, 0x00);
- set_port(0x3C0, 0x04, 0x00);
- set_port(0x3C0, 0x20, 0x00);
- __asm__ __volatile__ ("out %%al, %%dx" :: "a" (0x63), "d" (0x3C2));
- set_port(0x3C4, 0x01, 0x01);
- set_port(0x3C4, 0x02, 0x01);
- set_port(0x3C4, 0x03, 0x00);
- set_port(0x3C4, 0x04, 0x0E);
- set_port(0x3CE, 0x05, 0x40);
- set_port(0x3CE, 0x06, 0x05);
- set_port(0x3D4, 0x00, 0x5F);
- set_port(0x3D4, 0x01, 0x4F);
- set_port(0x3D4, 0x02, 0x50);
- set_port(0x3D4, 0x03, 0x82);
- set_port(0x3D4, 0x04, 0x54);
- set_port(0x3D4, 0x05, 0x80);
- set_port(0x3D4, 0x06, 0xBF);
- set_port(0x3D4, 0x07, 0x1F);
- set_port(0x3D4, 0x08, 0x00);
- set_port(0x3D4, 0x09, 0x41);
- set_port(0x3D4, 0x10, 0x9C);
- set_port(0x3D4, 0x11, 0x8E);
- set_port(0x3D4, 0x12, 0x8F);
- set_port(0x3D4, 0x13, 0x28);
- set_port(0x3D4, 0x14, 0x40);
- set_port(0x3D4, 0x15, 0x96);
- set_port(0x3D4, 0x16, 0xB9);
- set_port(0x3D4, 0x17, 0xA3);
- __asm__ __volatile__ ("out %%al, %%dx" :: "a" (0xFF), "d" (0x3C6));
- __asm__ __volatile__ ("out %%al, %%dx" :: "a" (0x00), "d" (0x3C8));
- __asm__ __volatile__ ("out %%al, %%dx" :: "a" (0xFF), "d" (0x3C9));
- //aquire the VGA address space
- VGA = L4_Fpage(0xA0000, 64);
- L4_Sigma0_GetPage(L4_nilthread, VGA);
- //setup is now complete drawing will commence
- pixels=(L4_Word_t*)0xA0000;
- for(int i=0; i<64999; i++)
- {
- pixels++;
- *pixels=(L4_Word_t)0x00;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement