void VGA_ioport_out( WORD port, BYTE val ) { switch (port) { case 0x3c0: if (vga_address_3c0) vga_index_3c0 = val; else FIXME("Unsupported index, register 0x3c0: 0x%02x (value 0x%02x)\n", vga_index_3c0, val); vga_address_3c0 = !vga_address_3c0; break; case 0x3c4: vga_index_3c4 = val; break; case 0x3c5: switch(vga_index_3c4) { case 0x04: /* Sequencer: Memory Mode Register */ if(vga_fb_depth == 8) VGA_SetWindowStart((val & 8) ? 0 : -1); else FIXME("Memory Mode Register not supported in this mode.\n"); break; default: FIXME("Unsupported index, register 0x3c4: 0x%02x (value 0x%02x)\n", vga_index_3c4, val); } break; case 0x3c8: palreg=val; palcnt=0; break; case 0x3c9: ((BYTE*)&paldat)[palcnt++]=val << 2; if (palcnt==3) { VGA_SetPalette(&paldat,palreg++,1); palcnt=0; } break; case 0x3ce: vga_index_3ce = val; break; case 0x3cf: FIXME("Unsupported index, register 0x3ce: 0x%02x (value 0x%02x)\n", vga_index_3ce, val); break; case 0x3d4: vga_index_3d4 = val; break; case 0x3d5: FIXME("Unsupported index, register 0x3d4: 0x%02x (value 0x%02x)\n", vga_index_3d4, val); break; default: FIXME("Unsupported VGA register: 0x%04x (value 0x%02x)\n", port, val); } }
int VGA_SetMode(unsigned Xres,unsigned Yres,unsigned Depth) { ModeSet par; int newSize; vga_fb_width = Xres; vga_fb_height = Yres; vga_fb_depth = Depth; vga_fb_offset = 0; vga_fb_pitch = Xres * ((Depth + 7) / 8); newSize = Xres * Yres * ((Depth + 7) / 8); if(newSize < 256 * 1024) newSize = 256 * 1024; if(vga_fb_size < newSize) { HeapFree(GetProcessHeap(), 0, vga_fb_data); vga_fb_data = HeapAlloc(GetProcessHeap(), 0, newSize); vga_fb_size = newSize; } if(Xres >= 640 || Yres >= 480) { par.Xres = Xres; par.Yres = Yres; } else { par.Xres = 640; par.Yres = 480; } VGA_SetWindowStart((Depth < 8) ? -1 : 0); par.Depth = (Depth < 8) ? 8 : Depth; MZ_RunInThread(VGA_DoSetMode, (ULONG_PTR)&par); return par.ret; }
/********************************************************************** * INT10_HandleVESA * * Handler for VESA functions (int10 function 0x4f). */ static void INT10_HandleVESA( CONTEXT *context ) { BIOSDATA *data = DOSVM_BiosData(); switch(AL_reg(context)) { case 0x00: /* RETURN CONTROLLER INFORMATION */ TRACE( "VESA RETURN CONTROLLER INFORMATION\n" ); { BYTE *ptr = CTX_SEG_OFF_TO_LIN(context, context->SegEs, context->Edi); INT10_FillControllerInformation( ptr ); SET_AL( context, 0x4f ); SET_AH( context, 0x00 ); /* 0x00 = successful 0x01 = failed */ } break; case 0x01: /* RETURN MODE INFORMATION */ TRACE( "VESA RETURN MODE INFORMATION %04x\n", CX_reg(context) ); { struct _ModeInfoBlock *ptr = CTX_SEG_OFF_TO_LIN(context, context->SegEs, context->Edi); SET_AL( context, 0x4f ); if (INT10_FillModeInformation( ptr, CX_reg(context) )) SET_AH( context, 0x00 ); /* status: success */ else SET_AH( context, 0x01 ); /* status: failed */ } break; case 0x02: /* SET SuperVGA VIDEO MODE */ TRACE( "Set VESA video mode %04x\n", BX_reg(context) ); SET_AL( context, 0x4f ); /* function supported */ if (INT10_SetVideoMode( data, BX_reg(context) )) SET_AH( context, 0x00 ); /* success */ else SET_AH( context, 0x01 ); /* failed */ break; case 0x03: /* VESA SuperVGA BIOS - GET CURRENT VIDEO MODE */ SET_AL( context, 0x4f ); SET_AH( context, 0x00 ); SET_BX( context, INT10_GetHeap()->VesaCurrentMode ); break; case 0x04: /* VESA SuperVGA BIOS - SAVE/RESTORE SuperVGA VIDEO STATE */ ERR("VESA SAVE/RESTORE Video State - Not Implemented\n"); /* AL_reg(context) = 0x4f; = supported so not set since not implemented */ /* maybe we should do this instead ? */ /* AH_reg(context = 0x01; not implemented so just fail */ break; case 0x05: /* VESA SuperVGA BIOS - CPU VIDEO MEMORY CONTROL */ /* * This subfunction supports only Window A (BL_reg == 0) and * it assumes that window granularity is 64k. */ switch(BH_reg(context)) { case 0x00: /* select video memory window */ SET_AL( context, 0x4f ); /* function supported */ if(BL_reg(context) == 0) { VGA_SetWindowStart(DX_reg(context) * 64 * 1024); SET_AH( context, 0x00 ); /* status: successful */ } else SET_AH( context, 0x01 ); /* status: failed */ break; case 0x01: /* get video memory window */ SET_AL( context, 0x4f ); /* function supported */ if(BL_reg(context) == 0) { SET_DX( context, VGA_GetWindowStart() / 64 / 1024 ); SET_AH( context, 0x00 ); /* status: successful */ } else SET_AH( context, 0x01 ); /* status: failed */ break; default: INT_BARF( context, 0x10 ); } break; case 0x06: /* VESA GET/SET LOGICAL SCAN LINE LENGTH */ ERR("VESA GET/SET LOGICAL SCAN LINE LENGTH - Not Implemented\n"); /* AL_reg(context) = 0x4f; = supported so not set since not implemented */ /* maybe we should do this instead ? */ /* AH_reg(context = 0x001; not implemented so just fail */ break; case 0x07: /* GET/SET DISPLAY START */ ERR("VESA GET/SET DISPLAY START - Not Implemented\n"); /* AL_reg(context) = 0x4f; = supported so not set since not implemented */ /* maybe we should do this instead ? */ /* AH_reg(context = 0x001; not implemented so just fail */ break; case 0x08: /* GET/SET DAC PALETTE CONTROL */ ERR("VESA GET/SET DAC PALETTE CONTROL- Not Implemented\n"); /* AL_reg(context) = 0x4f; = supported so not set since not implemented */ /* maybe we should do this instead ? */ /* AH_reg(context = 0x001; not implemented so just fail */ break; case 0x09: /* SET PALETTE ENTRIES */ FIXME("VESA Set palette entries - not implemented\n"); break; case 0x0a: /* GET PROTECTED-MODE CODE */ FIXME("VESA Get protected-mode code - not implemented\n"); break; case 0x10: /* Display Power Management Extensions */ FIXME("VESA Display Power Management Extensions - not implemented\n"); break; case 0xef: /* get video mode for hercules-compatibles */ /* There's no reason to really support this */ /* is there?....................(A.C.) */ TRACE("Just report the video not hercules compatible\n"); SET_DX( context, 0xffff ); break; case 0xff: /* Turn VESA ON/OFF */ /* I don't know what to do */ break; default: FIXME("VESA Function (0x%x) - Not Supported\n", AH_reg(context)); break; } }