- // find the entry in the video modes
- struct vgamode_s *vmode_g = find_vga_entry(mode);
- dprintf(1, "mode search %02x found %p\n", mode, vmode_g);
- if (!vmode_g)
- return;
-
- // Read the bios mode set control
- u8 modeset_ctl = GET_BDA(modeset_ctl);
-
- // Then we know the number of lines
-// FIXME
-
- // if palette loading (bit 3 of modeset ctl = 0)
- if ((modeset_ctl & 0x08) == 0) { // Set the PEL mask
- stdvga_set_pel_mask(GET_GLOBAL(vmode_g->pelmask));
-
- // From which palette
- u8 *palette_g = GET_GLOBAL(vmode_g->dac);
- u16 palsize = GET_GLOBAL(vmode_g->dacsize) / 3;
-
- // Always 256*3 values
- stdvga_set_dac_regs(get_global_seg(), palette_g, 0, palsize);
- u16 i;
- for (i = palsize; i < 0x0100; i++) {
- static u8 rgb[3] VAR16;
- stdvga_set_dac_regs(get_global_seg(), rgb, i, 1);
- }
-
- if ((modeset_ctl & 0x02) == 0x02)
- perform_gray_scale_summing(0x00, 0x100);
- }
-
- stdvga_set_mode(vmode_g);
-
- if (noclearmem == 0x00)
- clear_screen(vmode_g);
-
- // Set CRTC address VGA or MDA
- u16 crtc_addr = VGAREG_VGA_CRTC_ADDRESS;
- if (GET_GLOBAL(vmode_g->memmodel) == MTEXT)
- crtc_addr = VGAREG_MDA_CRTC_ADDRESS;
-