public void DrawTiles() { ushort tileBaseAddress = DisFuncs.GetTileBaseAddress(_state.TileBase); ushort tileMapBaseAddress = DisFuncs.GetTileMapBaseAddress(_state.TileMap); for (int tileY = 0; tileY < 18; ++tileY) { for (int tileX = 0; tileX < 20; ++tileX) { int tileOffset; if (_state.NoTileMap) { tileOffset = 16 * tileY + tileX; } else { tileOffset = DisFuncs.GetTileOffset(_disDef, _memory, tileMapBaseAddress, _state.TileBase, tileX, tileY); } byte[] tileData = DisFuncs.GetTileData(_disDef, _memory, tileBaseAddress, tileOffset, false); DrawFuncs.DrawTile(_pixelLookupTable, _disDef, _debugInternalTargets[(int)DebugTargets.Tiles], _tempPixelBuffer, _disDef.ScreenPixelCountX, tileData, 8 * tileX, 8 * tileY, 256, 256); } } }
internal void DrawSprite(uint[] spriteData, int spriteCode, int pX, int pY) { DrawFuncs.DrawTransparency(_disDef, spriteData, 8, 0, 0, 8, 16); if (_state.LCDCBits[2]) { spriteCode = spriteCode & 0xFE; // We remove the last bit } // We draw the top part byte[] pixels = DisFuncs.GetTileData(_disDef, _memory, 0x8000, spriteCode, _state.LCDCBits[2]); DrawFuncs.DrawTile(_pixelLookupTable, _disDef, spriteData, _tempPixelBuffer, 8, pixels, pX, pY, _disDef.ScreenPixelCountX, _disDef.ScreenPixelCountY); }