VirtualBox

Changeset 34024 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Nov 12, 2010 9:47:37 AM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
67690
Message:

VGA: Added support for double scanned text modes.

Location:
trunk/src/VBox/Devices/Graphics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA.cpp

    r34014 r34024  
    14791479typedef void vga_draw_glyph8_func(uint8_t *d, int linesize,
    14801480                             const uint8_t *font_ptr, int h,
    1481                              uint32_t fgcol, uint32_t bgcol);
     1481                             uint32_t fgcol, uint32_t bgcol,
     1482                             int dscan);
    14821483typedef void vga_draw_glyph9_func(uint8_t *d, int linesize,
    14831484                                  const uint8_t *font_ptr, int h,
     
    17211722 * Text mode update
    17221723 * Missing:
    1723  * - double scan
    1724  * - double width
    17251724 * - underline
    17261725 * - flashing
     
    17341733    uint8_t *d1, *d, *src, *s1, *dest, *cursor_ptr;
    17351734    const uint8_t *font_ptr, *font_base[2];
    1736     int dup9, line_offset, depth_index;
     1735    int dup9, line_offset, depth_index, dscan;
    17371736    uint32_t *palette;
    17381737    uint32_t *ch_attr_ptr;
     
    17681767    line_offset = s->line_offset;
    17691768    s1 = s->CTX_SUFF(vram_ptr) + (s->start_addr * 8); /** @todo r=bird: Add comment why we do *8 instead of *4, it's not so obvious... */
     1769
     1770    /* double scanning - not for 9-wide modes */
     1771    dscan = (s->cr[9] >> 7) & 1;
    17701772
    17711773    /* total width & height */
     
    18411843    cx_min_upd = width;
    18421844
    1843     for(cy = 0; cy < height; cy++) {
     1845    for(cy = 0; cy < height; cy = cy + (1 << dscan)) {
    18441846        d1 = dest;
    18451847        src = s1;
     
    18681870                if (cw != 9) {
    18691871                    vga_draw_glyph8(d1, linesize,
    1870                                     font_ptr, cheight, fgcol, bgcol);
     1872                                    font_ptr, cheight, fgcol, bgcol, dscan);
    18711873                } else {
    18721874                    dup9 = 0;
     
    18871889                    if (line_last >= line_start && line_start < cheight) {
    18881890                        h = line_last - line_start + 1;
    1889                         d = d1 + linesize * line_start;
     1891                        d = d1 + (linesize * line_start << dscan);
    18901892                        if (cw != 9) {
    18911893                            vga_draw_glyph8(d, linesize,
    1892                                             cursor_glyph, h, fgcol, bgcol);
     1894                                            cursor_glyph, h, fgcol, bgcol, dscan);
    18931895                        } else {
    18941896                            vga_draw_glyph9(d, linesize,
     
    19181920            cx_min_upd = width;
    19191921        }
    1920         dest += linesize * cheight;
     1922        dest += linesize * cheight << dscan;
    19211923        s1 += line_offset;
    19221924    }
     
    40994101{
    41004102    PVGASTATE       s = PDMINS_2_DATA(pDevIns, PVGASTATE);
    4101     int             is_graph;
     4103    int             is_graph, double_scan;
    41024104    int             w, h, char_height, char_dots;
    41034105    int             val, vfreq_hz, hfreq_hz;
     
    41074109    is_graph  = s->gr[6] & 1;
    41084110    char_dots = (s->sr[0x01] & 1) ? 8 : 9;
     4111    double_scan = s->cr[9] >> 7;
    41094112    pHlp->pfnPrintf(pHlp, "pixel clock: %s\n", clocks[(s->msr >> 2) & 3]);
    4110     pHlp->pfnPrintf(pHlp, "double scanning %s\n", s->cr[9] & 0x80 ? "on" : "off");
     4113    pHlp->pfnPrintf(pHlp, "double scanning %s\n", double_scan ? "on" : "off");
    41114114    pHlp->pfnPrintf(pHlp, "double clocking %s\n", s->sr[1] & 0x08 ? "on" : "off");
    41124115    val = s->cr[0] + 5;
     
    41274130        char_height = val;
    41284131        pHlp->pfnPrintf(pHlp, "char height %d\n", val);
    4129         pHlp->pfnPrintf(pHlp, "text mode %dx%d\n", w / char_dots, h / char_height);
     4132        pHlp->pfnPrintf(pHlp, "text mode %dx%d\n", w / char_dots, h / (char_height << double_scan));
    41304133    }
    41314134    if (s->fRealRetrace)
     
    41764179            uint32_t uCharHeight;
    41774180            uint32_t uLines;
     4181            uint32_t uDblScan;
    41784182
    41794183            vga_get_offsets(pThis, &cbLine, &offStart, &uLineCompareIgn);
     
    41834187            uVDisp = pThis->cr[0x12] + ((pThis->cr[7] & 2) << 7) + ((pThis->cr[7] & 0x40) << 4) + 1;
    41844188            uCharHeight = (pThis->cr[9] & 0x1f) + 1;
    4185             uLines = uVDisp / uCharHeight;
     4189            uDblScan = pThis->cr[9] >> 7;
     4190            uLines = uVDisp / (uCharHeight << uDblScan);
    41864191            if (uLines < 25)
    41874192                uLines = 25;
  • trunk/src/VBox/Devices/Graphics/DevVGATmpl.h

    r33974 r34024  
    5959                                                     int font_data,
    6060                                                     uint32_t xorcol,
    61                                                      uint32_t bgcol)
     61                                                     uint32_t bgcol,
     62                                                     int dscan,
     63                                                     int linesize)
    6264{
    6365#if BPP == 1
    6466        ((uint32_t *)d)[0] = (dmask16[(font_data >> 4)] & xorcol) ^ bgcol;
    6567        ((uint32_t *)d)[1] = (dmask16[(font_data >> 0) & 0xf] & xorcol) ^ bgcol;
     68        if (dscan) {
     69            uint8_t *c = d + linesize;
     70            ((uint32_t *)c)[0] = ((uint32_t *)d)[0];
     71            ((uint32_t *)c)[1] = ((uint32_t *)d)[1];
     72        }
    6673#elif BPP == 2
    6774        ((uint32_t *)d)[0] = (dmask4[(font_data >> 6)] & xorcol) ^ bgcol;
     
    6976        ((uint32_t *)d)[2] = (dmask4[(font_data >> 2) & 3] & xorcol) ^ bgcol;
    7077        ((uint32_t *)d)[3] = (dmask4[(font_data >> 0) & 3] & xorcol) ^ bgcol;
     78        if (dscan)
     79            memcpy(d + linesize, d, 4 * sizeof(uint32_t));
    7180#else
    7281        ((uint32_t *)d)[0] = (-((font_data >> 7)) & xorcol) ^ bgcol;
     
    7887        ((uint32_t *)d)[6] = (-((font_data >> 1) & 1) & xorcol) ^ bgcol;
    7988        ((uint32_t *)d)[7] = (-((font_data >> 0) & 1) & xorcol) ^ bgcol;
     89        if (dscan)
     90            memcpy(d + linesize, d, 8 * sizeof(uint32_t));
    8091#endif
    8192}
     
    8394static void glue(vga_draw_glyph8_, DEPTH)(uint8_t *d, int linesize,
    8495                                          const uint8_t *font_ptr, int h,
    85                                           uint32_t fgcol, uint32_t bgcol)
     96                                          uint32_t fgcol, uint32_t bgcol, int dscan)
    8697{
    8798    uint32_t xorcol;
     
    91102    do {
    92103        font_data = font_ptr[0];
    93         glue(vga_draw_glyph_line_, DEPTH)(d, font_data, xorcol, bgcol);
     104        glue(vga_draw_glyph_line_, DEPTH)(d, font_data, xorcol, bgcol, dscan, linesize);
    94105        font_ptr += 4;
    95         d += linesize;
     106        d += linesize << dscan;
    96107    } while (--h);
    97108}
     
    99110static void glue(vga_draw_glyph16_, DEPTH)(uint8_t *d, int linesize,
    100111                                          const uint8_t *font_ptr, int h,
    101                                           uint32_t fgcol, uint32_t bgcol)
     112                                          uint32_t fgcol, uint32_t bgcol, int dscan)
    102113{
    103114    uint32_t xorcol;
     
    109120        glue(vga_draw_glyph_line_, DEPTH)(d,
    110121                                          expand4to8[font_data >> 4],
    111                                           xorcol, bgcol);
     122                                          xorcol, bgcol, dscan, linesize);
    112123        glue(vga_draw_glyph_line_, DEPTH)(d + 8 * BPP,
    113124                                          expand4to8[font_data & 0x0f],
    114                                           xorcol, bgcol);
     125                                          xorcol, bgcol, dscan, linesize);
    115126        font_ptr += 4;
    116         d += linesize;
     127        d += linesize << dscan;
    117128    } while (--h);
    118129}
Note: See TracChangeset for help on using the changeset viewer.

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