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); } } }