MCPcopy Create free account
hub / github.com/NetHack/NetHack / vga_WriteChar

Function vga_WriteChar

sys/msdos/vidvga.c:957–1021  ·  view source on GitHub ↗

* Write character 'ch', at (x,y) and * do it using the colour 'colour'. * */

Source from the content-addressed store, hash-verified

955 *
956 */
957static void
958vga_WriteChar(uint32 chr, int col, int row, int colour)
959{
960 int i;
961 int x, pixy;
962
963 char __far *cp;
964 unsigned char fnt;
965 int actual_colour = vgacmap[colour];
966 int bgcolor;
967 int vplane;
968 unsigned char bitmap[ROWS_PER_CELL];
969
970 /* if (chr < ' ') chr = ' '; */ /* assumes ASCII set */
971 vga_GetBitmap(chr, bitmap);
972
973 if (curframecolor != NO_COLOR)
974 bgcolor = vgacmap[curframecolor];
975 else
976 bgcolor = BACKGROUND_VGA_COLOR;
977
978 if (inversed) {
979 int tmpc = actual_colour;
980 actual_colour = bgcolor;
981 bgcolor = tmpc;
982 }
983
984 x = min(col, (CO - 1)); /* min() used protection from callers */
985 pixy = min(row, (LI - 1)) * 16; /* assumes 8 x 16 char set */
986 vplane = ~actual_colour & ~bgcolor & 0xF;
987 if (vplane != 0) {
988 egawriteplane(vplane);
989 for (i = 0; i < MAX_ROWS_PER_CELL; ++i) {
990 cp = screentable[pixy + i] + x;
991 WRITE_ABSOLUTE(cp, (char) 0x00);
992 }
993 }
994 vplane = actual_colour & ~bgcolor & 0xF;
995 if (vplane != 0) {
996 egawriteplane(vplane);
997 for (i = 0; i < MAX_ROWS_PER_CELL; ++i) {
998 cp = screentable[pixy + i] + x;
999 fnt = bitmap[i];
1000 WRITE_ABSOLUTE(cp, (char) fnt);
1001 }
1002 }
1003 vplane = ~actual_colour & bgcolor & 0xF;
1004 if (vplane != 0) {
1005 egawriteplane(vplane);
1006 for (i = 0; i < MAX_ROWS_PER_CELL; ++i) {
1007 cp = screentable[pixy + i] + x;
1008 fnt = ~bitmap[i];
1009 WRITE_ABSOLUTE(cp, (char) fnt);
1010 }
1011 }
1012 vplane = actual_colour & bgcolor & 0xF;
1013 if (vplane != 0) {
1014 egawriteplane(vplane);

Callers 6

vga_cl_endFunction · 0.85
vga_cl_eosFunction · 0.85
vga_xputcFunction · 0.85
vga_xputgFunction · 0.85
vidvga.cFile · 0.85
vga_WriteStrFunction · 0.85

Calls 1

vga_GetBitmapFunction · 0.85

Tested by

no test coverage detected