static int setmode(int mode, int prv_mode) { unsigned char *moderegs; ModeTiming *modetiming; ModeInfo *modeinfo; int i; if (!modeavailable(mode)) return 1; modeinfo = __svgalib_createModeInfoStructureForSvgalibMode(mode); modetiming = malloc(sizeof(ModeTiming)); if (__svgalib_getmodetiming(modetiming, modeinfo, cardspecs)) { free(modetiming); free(modeinfo); return 1; } moderegs = malloc(TOTAL_REGS); initializemode(moderegs, modetiming, modeinfo, mode); free(modetiming); __svgalib_setregs(moderegs); /* Set standard regs. */ setregs(moderegs, mode); /* Set extended regs. */ free(moderegs); free(modeinfo); return 0; }
static void setregs(const unsigned char regs[], int mode) { /* Enable graphics register modification */ port_out(0x00, GRA_E0); port_out(0x01, GRA_E1); __svgalib_setregs(regs); }
static int tvga8900_setmode(int mode, int prv_mode) { const unsigned char *regs; regs = LOOKUPMODE(tvga_modes, mode); if (regs == NULL) return (int) (__svgalib_vga_driverspecs.setmode(mode, prv_mode)); if (!tvga8900_modeavailable(mode)) return 1; __svgalib_setregs(regs); tvga8900_setregs(regs, mode); return 0; }