VirtualBox

Changeset 4682 in vbox for trunk/src/VBox/Devices/Graphics


Ignore:
Timestamp:
Sep 10, 2007 5:29:10 PM (17 years ago)
Author:
vboxsync
Message:

Fixed video modes 4 and 5. Address calculations weren't taking word mode into account,
every other address needs to be skipped (same as text modes).

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

Legend:

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

    r4639 r4682  
    10431043            addr = ((addr & ~1) << 1) | plane;
    10441044#else
    1045             /* 'addr' is offset in a plane, bit 0 select the plane.
     1045            /* 'addr' is offset in a plane, bit 0 selects the plane.
    10461046             * Mask the bit 0, convert plane index to vram offset,
    10471047             * that is multiply by the number of planes,
     
    13441344        line_offset <<= 3;
    13451345#ifdef VBOX
    1346         if ((s->gr[0x06] & 1) == 0)
     1346        if (!(s->cr[0x14] & 0x40) && !(s->cr[0x17] & 0x40))
    13471347        {
    1348             /* Text mode. Every second byte of a plane is used. */
     1348            /* Word mode. Used for odd/even modes. */
    13491349            line_offset *= 2;
    13501350        }
     
    19791979    for(y = 0; y < height; y++) {
    19801980        addr = addr1;
     1981        /* CGA/MDA compatibility. Note that these addresses are all
     1982         * shifted left by two compared to VGA specs.
     1983         */
    19811984        if (!(s->cr[0x17] & 1)) {
    1982             int shift;
    1983             /* CGA compatibility handling */
    1984             shift = 14 + ((s->cr[0x17] >> 6) & 1);
    1985             addr = (addr & ~(1 << shift)) | ((y1 & 1) << shift);
     1985            addr = (addr & ~(1 << 15)) | ((y1 & 1) << 15);
    19861986        }
    19871987        if (!(s->cr[0x17] & 2)) {
    1988             addr = (addr & ~0x8000) | ((y1 & 2) << 14);
     1988            addr = (addr & ~(1 << 16)) | ((y1 & 2) << 15);
    19891989        }
    19901990#ifndef VBOX
  • trunk/src/VBox/Devices/Graphics/DevVGATmpl.h

    r4071 r4682  
    170170                                         const uint8_t *s, int width)
    171171{
    172     uint32_t plane_mask, *palette, data, v;
     172    uint32_t plane_mask, *palette, data, v, src_inc, dwb_mode;
    173173    int x;
    174174
    175175    palette = s1->last_palette;
    176176    plane_mask = mask16[s1->ar[0x12] & 0xf];
     177    dwb_mode = (s1->cr[0x14] & 0x40) ? 2 : (s1->cr[0x17] & 0x40) ? 0 : 1;
     178    src_inc = 4 << dwb_mode;
    177179    width >>= 3;
    178180    for(x = 0; x < width; x++) {
     
    193195        ((PIXEL_TYPE *)d)[7] = palette[(v >> 0) & 0xf];
    194196        d += BPP * 8;
    195         s += 4;
     197        s += src_inc;
    196198    }
    197199}
     
    212214                                           const uint8_t *s, int width)
    213215{
    214     uint32_t plane_mask, *palette, data, v;
     216    uint32_t plane_mask, *palette, data, v, src_inc, dwb_mode;
    215217    int x;
    216218
    217219    palette = s1->last_palette;
    218220    plane_mask = mask16[s1->ar[0x12] & 0xf];
     221    dwb_mode = (s1->cr[0x14] & 0x40) ? 2 : (s1->cr[0x17] & 0x40) ? 0 : 1;
     222    src_inc = 4 << dwb_mode;
    219223    width >>= 3;
    220224    for(x = 0; x < width; x++) {
     
    235239        PUT_PIXEL2(d, 7, palette[(v >> 0) & 0xf]);
    236240        d += BPP * 16;
    237         s += 4;
     241        s += src_inc;
    238242    }
    239243}
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