FlawlessChips 0.1.3
dotnet add package FlawlessChips --version 0.1.3
NuGet\Install-Package FlawlessChips -Version 0.1.3
<PackageReference Include="FlawlessChips" Version="0.1.3" />
<PackageVersion Include="FlawlessChips" Version="0.1.3" />
<PackageReference Include="FlawlessChips" />
paket add FlawlessChips --version 0.1.3
#r "nuget: FlawlessChips, 0.1.3"
#:package FlawlessChips@0.1.3
#addin nuget:?package=FlawlessChips&version=0.1.3
#tool nuget:?package=FlawlessChips&version=0.1.3
FlawlessChips

<img align="right" width="150px" height="150px" src="img/logo.png">
FlawlessChips is a C# library that provides gate-level simulation of various 8-bit chips.
FlawlessChips is (with a nod and wink to perfect6502's description):
- Flawless - it is a simulation of the original transistors, not an emulation. (Of course, there might be bugs...)
- Slow - like, really slow. This implementation is faster than the JavaScript implementations on which it's based, but it's still way slower than the original chips.
FlawlessChips's intended audience is emulator authors who want to run their emulations and compare e.g. output pins with this half-cycle exact simulation.
Simulated chips
- MOS Technology 6502 -
FlawlessChips.Flawless6502 - Ricoh 2A03 -
FlawlessChips.Flawless2A03 - Ricoh 2C02 -
FlawlessChips.Flawless2C02 - Zilog Z80 -
FlawlessChips.FlawlessZ80 - Atari 2600 TIA -
FlawlessChips.FlawlessTia
Install
FlawlessChips is available as a NuGet Package.
Usage
This example shows the Flawless6502 chip simulator. Other chips are similar.
var chip = new Flawless6502();
// Assert reset pin, initialize other pins, deassert reset pin.
// Calling this method is optional; you can perform this setup
// in your own code.
chip.Startup();
// Create 64K of memory for the chip to work with.
var memory = new byte[ushort.MaxValue + 1];
// Loop a few times.
for (var i = 0; i < 100; i++)
{
var newClk = !chip.IsHigh(clk0);
// Pulse clock pin. Any transistors connected to this pin will be re-evaluated, recursively,
// until the chip "settles" in its new state.
chip.SetNode(clk0, newClk ? NodeValue.PulledHigh : NodeValue.PulledLow);
// Memory accesses should only occur when the 6502's phi2 output pin is high.
if (chip.IsHigh(clk2out))
{
// Does the 6502 want to read?
if (chip.IsHigh(rw))
{
// You can access individual pin values via chip.IsHigh(ab0), chip.IsHigh(ab1), etc.
// But for simplicity there's GetBus and SetBus to set the whole bus value at once.
var address = chip.GetBus(ab);
var data = memory[address];
chip.SetBus(db, data);
}
else // Otherwise the 6502 wants to write.
{
var address = chip.GetBus(ab);
var data = chip.GetBus(db);
memory[address] = data;
}
}
// Print out a few interesting bits of chip state. There are also hundreds of other node names
// available in the FlawlessChips.Flawless6502.NodeIds class.
Console.WriteLine(
"Φ2 {0} PC {1:X4} X {2:X2} Y {3:X2} A {4:X2} SP {5:X2} AB {6:X4} DB {7:X2} RW {8}",
chip.IsHigh(clk2out) ? '1' : '0',
chip.GetPC(),
chip.GetBus(x),
chip.GetBus(y),
chip.GetBus(a),
chip.GetBus(s),
chip.GetBus(ab),
chip.GetBus(db),
chip.IsHigh(rw) ? '1' : '0');
}
License
This software is released under the BSD-Clause 2 license.
Credits
This project is essentially a C# port of the following projects. The authors of these projects deserve huge credit for their efforts in photographing chips, analyzing circuits, and writing the simulators.
Visual 6502 by Greg James, Brian Silverman, and Barry Silverman
- with optimization ideas from perfect6502 by Michael Steil.
Visual Z80, authorship unknown, perhaps Greg James, Brian Silverman, and Barry Silverman
The logo is a modified version of the chips icon by pictranoosa, and the perfect icon by Paffi.
Author
Tim Jones
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.