MCPcopy Create free account
hub / github.com/TASEmulators/fceux / BGData

Class BGData

src/ppu.cpp:2006–2094  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2004
2005//todo - consider making this a 3 or 4 slot fifo to keep from touching so much memory
2006struct BGData {
2007 struct Record {
2008 uint8 nt, pecnt, at, pt[2], qtnt;
2009 uint8 ppu1[8];
2010
2011 INLINE void Read() {
2012 NTRefreshAddr = RefreshAddr = ppur.get_ntread();
2013 if (PEC586Hack)
2014 ppur.s = (RefreshAddr & 0x200) >> 9;
2015 else if (QTAIHack) {
2016 qtnt = QTAINTRAM[((((RefreshAddr >> 10) & 3) >> ((qtaintramreg >> 1)) & 1) << 10) | (RefreshAddr & 0x3FF)];
2017 ppur.s = qtnt & 0x3F;
2018 }
2019 pecnt = (RefreshAddr & 1) << 3;
2020 nt = CALL_PPUREAD(RefreshAddr);
2021 ppu1[0] = PPU[1];
2022 runppu(1);
2023 ppu1[1] = PPU[1];
2024 runppu(1);
2025
2026
2027
2028 RefreshAddr = ppur.get_atread();
2029 at = CALL_PPUREAD(RefreshAddr);
2030
2031 //modify at to get appropriate palette shift
2032 if (ppur.vt & 2) at >>= 4;
2033 if (ppur.ht & 2) at >>= 2;
2034 at &= 0x03;
2035 at <<= 2;
2036 //horizontal scroll clocked at cycle 3 and then
2037 //vertical scroll at 251
2038 ppu1[2] = PPU[1];
2039 runppu(1);
2040 if (PPUON) {
2041 ppur.increment_hsc();
2042 if (ppur.status.cycle == 251)
2043 ppur.increment_vs();
2044 }
2045 ppu1[3] = PPU[1];
2046 runppu(1);
2047
2048 ppur.par = nt;
2049 RefreshAddr = ppur.get_ptread();
2050 if (PEC586Hack) {
2051 pt[0] = CALL_PPUREAD(RefreshAddr | pecnt);
2052 ppu1[4] = PPU[1];
2053 runppu(1);
2054 ppu1[5] = PPU[1];
2055 runppu(1);
2056 pt[1] = CALL_PPUREAD(RefreshAddr | pecnt);
2057 ppu1[6] = PPU[1];
2058 runppu(1);
2059 ppu1[7] = PPU[1];
2060 runppu(1);
2061 } else if (QTAIHack && (qtnt & 0x40)) {
2062 pt[0] = *(CHRptr[0] + RefreshAddr);
2063 ppu1[4] = PPU[1];

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected