VirtualBox

Changeset 94355 in vbox


Ignore:
Timestamp:
Mar 24, 2022 1:21:38 PM (3 years ago)
Author:
vboxsync
Message:

VGABIOS: Added ability to set 200/350-line (CGA/EGA) text modes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/BIOS/vgabios.c

    r94316 r94355  
    900900};
    901901
     902/* Convert index in vga_modes[] to index in video_param_table[] for 200-line (CGA) text modes. */
     903static int8_t line_to_vpti_200[8] = {
     904    0x00, 0x01, 0x02, 0x03, -1, -1, -1, 0x07
     905};
     906
     907/* Same for 350-line (EGA) text modes. */
     908static int8_t line_to_vpti_350[8] = {
     909    0x13, 0x14, 0x15, 0x16, -1, -1, -1, 0x07
     910};
     911
     912/* Same for 400-line (VGA) text modes. */
     913static int8_t line_to_vpti_400[8] = {
     914    0x17, 0x17, 0x18, 0x18, -1, -1, -1, 0x19
     915};
     916
     917int find_vpti(uint8_t line)
     918{
     919    int         idx;
     920    uint8_t     mctl;
     921
     922    if (vga_modes[line].class == TEXT) {
     923        mctl = read_byte(BIOSMEM_SEG, BIOSMEM_MODESET_CTL);
     924        if (mctl & 0x10)
     925            idx = line_to_vpti_400[line];
     926        else if (mctl & 0x80)
     927            idx = line_to_vpti_200[line];
     928        else
     929            idx = line_to_vpti_350[line];
     930    } else
     931        idx = line_to_vpti[line];
     932
     933    return idx;
     934}
     935
    902936static void biosfn_load_text_user_pat(uint8_t AL, uint16_t ES, uint16_t BP, uint16_t CX, uint16_t DX, uint8_t BL, uint8_t BH);
    903937
     
    942976 save_area = (void __far *)read_dword(BIOSMEM_SEG, BIOSMEM_VS_POINTER);
    943977
    944  vpti=line_to_vpti[line];
    945  vpt = save_area[0];
     978 vpti = find_vpti(line);
     979 vpt  = save_area[0];
    946980 vpt += vpti;
    947981
     
    10881122 write_byte(BIOSMEM_SEG,BIOSMEM_VIDEO_CTL,(0x60|noclearmem));
    10891123 write_byte(BIOSMEM_SEG,BIOSMEM_SWITCHES,0xF9);
    1090  write_byte(BIOSMEM_SEG,BIOSMEM_MODESET_CTL,read_byte(BIOSMEM_SEG,BIOSMEM_MODESET_CTL)&0x7f);
    10911124
    10921125 // FIXME We nearly have the good tables. to be reworked
     
    11181151     cso_txt __far   *ovr = save_area[2];
    11191152
    1120      biosfn_load_text_8_16_pat(0x04, 0);    /* Load 8x16 font into page 0. */
     1153     switch (vpt->cheight) {
     1154     case 8:
     1155         biosfn_load_text_user_pat(0, 0xC000, (uint16_t)vgafont8,  256, 0, 0, vpt->cheight);
     1156         break;
     1157     case 14:
     1158         biosfn_load_text_user_pat(0, 0xC000, (uint16_t)vgafont14, 256, 0, 0, vpt->cheight);
     1159         break;
     1160     default:
     1161         biosfn_load_text_user_pat(0, 0xC000, (uint16_t)vgafont16, 256, 0, 0, vpt->cheight);
     1162     }
    11211163     if (ovr)
    11221164      {
     
    20602102#endif
    20612103}
     2104// --------------------------------------------------------------------------------------------
     2105static void biosfn_set_txt_lines(uint8_t AL)
     2106{
     2107    uint8_t     mctl;
     2108
     2109    /* Read byte at 40:89. */
     2110    mctl = read_byte(BIOSMEM_SEG, BIOSMEM_MODESET_CTL);
     2111    mctl = mctl & 0x6F; /* Clear 400/200 line flags. */
     2112
     2113    switch (AL) /* AL was already validated to be in 0-2 range. */
     2114    {
     2115    case 0: /* 200 lines. */
     2116        mctl |= 0x80;
     2117        break;
     2118    case 2: /* 400 lines. */
     2119        mctl |= 0x10;
     2120        break;
     2121    }
     2122    write_byte(BIOSMEM_SEG, BIOSMEM_MODESET_CTL, mctl);
     2123}
    20622124
    20632125// --------------------------------------------------------------------------------------------
     
    26362698        biosfn_alternate_prtsc();
    26372699        break;
     2700       case 0x30:
     2701         if (GET_AL() <= 2) {
     2702             biosfn_set_txt_lines(GET_AL());
     2703             SET_AL(0x12);
     2704         }
     2705         break;
    26382706       case 0x34:   /* CGA text cursor emulation control. */
    26392707        if (GET_AL() < 2) {
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette