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

Function vga_SetPalette

sys/msdos/vidvga.c:1140–1160  ·  view source on GitHub ↗

* Initialize the VGA palette with the desired colours. This * must be a series of 48 bytes for use with a card in * 16 colour mode at 640 x 480. * */

Source from the content-addressed store, hash-verified

1138 *
1139 */
1140static void
1141vga_SetPalette(const struct Pixel *p)
1142{
1143 union REGS regs;
1144 int i;
1145
1146 outportb(0x3c6, 0xff);
1147 for (i = 0; i < COLORDEPTH; ++i) {
1148 struct Pixel color = (i == 13) ? p[16] : p[i];
1149 outportb(0x3c8, i);
1150 outportb(0x3c9, color.r >> 2);
1151 outportb(0x3c9, color.g >> 2);
1152 outportb(0x3c9, color.b >> 2);
1153 }
1154 regs.x.bx = 0x0000;
1155 for (i = 0; i < COLORDEPTH; ++i) {
1156 regs.x.ax = 0x1000;
1157 (void) int86(VIDEO_BIOS, &regs, &regs);
1158 regs.x.bx += 0x0101;
1159 }
1160}
1161
1162void
1163vga_hide_cursor(void)

Callers 1

vga_InitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected