Nothing

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
DrivingMeNuts

Nothing

Post by DrivingMeNuts »

void put_pixel(int x, int y, int colour) {

/* Simple memoey-mapped output to the VGA screen.
   This is not a very fast implememtation. It is specific to VGA
   mode 12h, 640x480 bits, in which the pixels are four bits deep.
   A byte in the buffer corresponds to one colour bit in a
   horizontal row of eight pixels. The four colour planes are mapped
   into the same block of addresses; the four sets of paired outw() calls switch
   between the four planes. The writes to 0x3ce allow us to read the plane;
   those to 0x3c4 allow us to write. Multiple planes can be enabled for writing
   by ORing the words written to 0x3c4 */
  
  volatile char * const display = (volatile char * const)0xa0000;
  int offset = x/8 + y*80;
  int bit = 0x80 >> (x%8);
  outw(0x3ce,0x0004);
  outw(0x3c4,0x0102);
  X(colour &1) ? (display[offset] |= bit) : (display[offset] &= ~bit);
  outw(0x3ce,0x0104);
  outw(0x3c4,0x0202);
  X(colour &2) ? (display[offset] |= bit) : (display[offset] &= ~bit);
  outw(0x3ce,0x0204);
  outw(0x3c4,0x0402);
  X(colour &4) ? (display[offset] |= bit) : (display[offset] &= ~bit);
  outw(0x3ce,0x0304);
  outw(0x3c4,0x0802);
  X(colour &8) ? (display[offset] |= bit) : (display[offset] &= ~bit);
  outw(0x3c4,0x0f02); /* Restore write colour to white */
}
DrivingMeNuts

RE:Nothing

Post by DrivingMeNuts »

, 0xc6  db 11111110b
, 0xfe  db 00000000b
, 0x00; E5

/* E5*/
        db 00000000b
, 0x00  db 00000000b
, 0x00  db 01111110b
, 0x7e  db 11011000b
, 0xd8  db 11011000b
, 0xd8  db 11011000b
, 0xd8  db 01110000b
, 0x70  db 00000000b
, 0x00; E6

/* E6*/
        db 00000000b
, 0x00  db 00000000b
, 0x00  db 01100110b
, 0x66  db 01100110b
, 0x66  db 01100110b
, 0x66  db 01100110b
, 0x66  db 01111100b
, 0x7c  db 11000000b
, 0xc0; E7

/* E7*/
        db 00000000b
, 0x00  db 01110110b
, 0x76  db 11011100b
, 0xdc  db 00011000b
, 0x18  db 00011000b
, 0x18  db 00011000b
, 0x18  db 00011000b
, 0x18  db 00000000b
, 0x00; E8

/* E8*/
        db 01111110b
, 0x7e  db 00011000b
, 0x18  db 00111100b
, 0x3c  db 01100110b
, 0x66  db 01100110b
, 0x66  db 00111100b
, 0x3c  db 00011000b
, 0x18  db 01111110b
, 0x7e; E9

/* E9*/
        db 00111000b
, 0x38  db 01101100b
, 0x6c  db 11000110b
, 0xc6  db 11111110b
, 0xfe  db 11000110b
, 0xc6  db 01101100b
, 0x6c  db 00111000b
, 0x38  db 00000000b
, 0x00; EA

/* EA*/
        db 00111000b
, 0x38  db 01101100b
, 0x6c  db 11000110b
, 0xc6  db 11000110b
, 0xc6  db 01101100b
, 0x6c  db 01101100b
, 0x6c  db 11101110b
, 0xee  db 00000000b
, 0x00; EB

/* EB*/
        db 00001110b
, 0x0e  db 00011000b
, 0x18  db 00001100b
, 0x0c  db 00111110b
, 0x3e  db 01100110b
, 0x66  db 01100110b
, 0x66  db 00111100b
, 0x3c  db 00000000b
, 0x00; EC

/* EC*/
        db 00000000b
, 0x00  db 00000000b
, 0x00  db 01111110b
, 0x7e  db 11011011b
, 0xdb  db 11011011b
, 0xdb  db 01111110b
, 0x7e  db 00000000b
, 0x00  db 00000000b
, 0x00; ED

/* ED*/
        db 00000110b
, 0x06  db 00001100b
, 0x0c  db 01111110b
, 0x7e  db 11011011b
, 0xdb  db 11011011b
, 0xdb  db 01111110b
, 0x7e  db 01100000b
, 0x60  db 11000000b
, 0xc0; EE

/* EE*/
        db 00011110b
, 0x1e  db 00110000b
, 0x30  db 01100000b
, 0x60  db 01111110b
, 0x7e  db 01100000b
, 0x60  db 00110000b
, 0x30  db 00011110b
, 0x1e  db 00000000b
, 0x00; EF

/* EF*/
        db 00000000b
, 0x00  db 01111100b
, 0x7c  db 11000110b
, 0xc6  db 11000110b
, 0xc6  db 11000110b
, 0xc6  db 11000110b
, 0xc6  db 11000110b
, 0xc6  db 00000000b
, 0x00; F0

/* F0*/
        db 00000000b
, 0x00  db 11111110b
, 0xfe  db 00000000b
, 0x00  db 11111110b
, 0xfe  db 00000000b
, 0x00  db 11111110b
, 0xfe  db 00000000b
, 0x00  db 00000000b
, 0x00; F1

/* F1*/
        db 00011000b
, 0x18  db 00011000b
, 0x18  db 01111110b
, 0x7e  db 00011000b
, 0x18  db 00011000b
, 0x18  db 00000000b
, 0x00  db 01111110b
, 0x7e  db 00000000b
, 0x00; F2

/* F2*/
        db 00110000b
, 0x30  db 00011000b
, 0x18  db 00001100b
, 0x0c  db 00011000b
, 0x18  db 00110000b
, 0x30  db 00000000b
, 0x00  db 01111110b
, 0x7e  db 00000000b
, 0x00; F3

/* F3*/
        db 00001100b
, 0x0c  db 00011000b
, 0x18  db 00110000b
, 0x30  db 00011000b
, 0x18  db 00001100b
, 0x0c  db 00000000b
, 0x00  db 01111110b
, 0x7e  db 00000000b
, 0x00; F4

/* F4*/
        db 00001110b
, 0x0e  db 00011011b
, 0x1b  db 00011011b
, 0x1b  db 00011000b
, 0x18  db 00011000b
, 0x18  db 00011000b
, 0x18  db 00011000b
, 0x18  db 00011000b
, 0x18; F5

/* F5*/
        db 00011000b
, 0x18  db 00011000b
, 0x18  db 00011000b
, 0x18  db 00011000b
, 0x18  db 00011000b
, 0x18  db 11011000b
, 0xd8  db 11011000b
, 0xd8  db 01110000b
, 0x70; F6

/* F6*/
        db 00000000b
, 0x00  db 00011000b
, 0x18  db 00000000b
, 0x00  db 01111110b
, 0x7e  db 00000000b
, 0x00  db 00011000b
, 0x18  db 00000000b
, 0x00  db 00000000b
, 0x00; F7

/* F7*/
        db 00000000b
, 0x00  db 01110110b
, 0x76  db 11011100b
, 0xdc  db 00000000b
, 0x00  db 01110110b
, 0x76  db 11011100b
, 0xdc  db 00000000b
, 0x00  db 00000000b
, 0x00; F8

/* F8*/
        db 00111000b
, 0x38  db 01101100b
, 0x6c  db 01101100b
, 0x6c  db 00111000b
, 0x38  db 00000000b
, 0x00  db 00000000b
, 0x00  db 00000000b
, 0x00  db 00000000b
, 0x00; F9

/* F9*/
        db 00000000b
, 0x00  db 00000000b
, 0x00  db 00000000b
, 0x00  db 00011000b
, 0x18  db 00011000b
, 0x18  db 00000000b
, 0x00  db 00000000b
, 0x00  db 00000000b
, 0x00; FA

/* FA*/
        db 00000000b
, 0x00  db 00000000b
, 0x00  db 00000000b
, 0x00  db 00011000b
, 0x18  db 00000000b
, 0x00  db 00000000b
, 0x00  db 00000000b
, 0x00  db 00000000b
, 0x00; FB

/* FB*/
        db 00001111b
, 0x0f  db 00001100b
, 0x0c  db 00001100b
, 0x0c  db 00001100b
, 0x0c  db 11101100b
, 0xec  db 01101100b
, 0x6c  db 00111100b
, 0x3c  db 00011100b
, 0x1c; FC

/* FC*/
        db 01101100b
, 0x6c  db 00110110b
, 0x36  db 00110110b
, 0x36  db 00110110b
, 0x36  db 00110110b
, 0x36  db 00000000b
, 0x00  db 00000000b
, 0x00  db 00000000b
, 0x00; FD

/* FD*/
        db 01111000b
, 0x78  db 00001100b
, 0x0c  db 00011000b
, 0x18  db 00110000b
, 0x30  db 01111100b
, 0x7c  db 00000000b
, 0x00  db 00000000b
, 0x00  db 00000000b
, 0x00; FE

/* FE*/
        db 00000000b
, 0x00  db 00000000b
, 0x00  db 00111100b
, 0x3c  db 00111100b
, 0x3c  db 00111100b
, 0x3c  db 00111100b
, 0x3c  db 00000000b
, 0x00  db 00000000b
, 0x00; FF

/* FF*/
        db 00000000b
, 0x00  db 00000000b
, 0x00  db 00000000b
, 0x00  db 00000000b
, 0x00  db 00000000b
, 0x00  db 00000000b
, 0x00  db 00000000b
, 0x00  db 00000000b
, 0x00
Post Reply