VirtualBox

Changeset 97779 in vbox


Ignore:
Timestamp:
Dec 12, 2022 3:13:58 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
154849
Message:

DevVGA: Implemented address wraparound for text modes for better CGA/EGA/VGA compatibility.

File:
1 edited

Legend:

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

    r97621 r97779  
    18161816    s_incr = pThis->cr[0x17] & 0x40 ? 4 : 8;
    18171817
     1818    unsigned addr_mask;
     1819    if (!(pThis->cr[0x17] & 0x40) && !(pThis->cr[0x17] & 0x20))
     1820        addr_mask = 0xffff;     /* Wrap at 64K, for CGA and 64K EGA compatibility. */
     1821    else
     1822        addr_mask = 0x3ffff;    /* Wrap at 256K, standard VGA. */
     1823
    18181824    line_offset = pThis->line_offset;
    1819     s1 = pThisCC->pbVRam + (pThis->start_addr * s_incr);
     1825    s1 = pThisCC->pbVRam + ((pThis->start_addr * s_incr) & addr_mask);
    18201826
    18211827    /* double scanning - not for 9-wide modes */
     
    18811887        pThis->cursor_end = pThis->cr[0xb];
    18821888    }
    1883     cursor_ptr = pThisCC->pbVRam + (pThis->start_addr + cursor_offset) * s_incr;
     1889    cursor_ptr = pThisCC->pbVRam + (((pThis->start_addr + cursor_offset) * s_incr) & addr_mask);
    18841890    depth_index = vgaR3GetDepthIndex(pDrv->cBits);
    18851891    if (cw == 16)
     
    20012007            d1 += x_incr;
    20022008            src += s_incr;  /* Even in text mode, word/byte mode matters. */
     2009            if (src > (pThisCC->pbVRam + addr_mask))
     2010                src = pThisCC->pbVRam;
    20032011            ch_attr_ptr++;
    20042012        }
     
    20282036        if ((uint32_t)cy == (pThis->line_compare / cheight))
    20292037            s1 = pThisCC->pbVRam;
     2038
     2039        if (s1 > (pThisCC->pbVRam + addr_mask))
     2040            s1 = s1 - (addr_mask + 1);
    20302041    }
    20312042    if (cy_start >= 0)
     
    43854396        uint32_t cbLine;
    43864397        uint32_t offStart;
     4398        uint32_t offCursr;
    43874399        uint32_t uLineCompareIgn;
    43884400        vgaR3GetOffsets(pThis, &cbLine, &offStart, &uLineCompareIgn);
     
    43904402            cbLine = 80 * ch_stride;
    43914403        offStart *= ch_stride;
     4404        offCursr = ((pThis->cr[0x0e] << 8) | pThis->cr[0x0f]) * ch_stride;
    43924405        pHlp->pfnPrintf(pHlp, "cbLine:   %#x\n", cbLine);
    43934406        pHlp->pfnPrintf(pHlp, "offStart: %#x (line %#x)\n", offStart, offStart / cbLine);
     4407        pHlp->pfnPrintf(pHlp, "offCursr: %#x\n", offCursr);
    43944408    }
    43954409    if (pThis->fRealRetrace)
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