Breaks Debugger

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
org
Posts: 155
Joined: Tue Aug 07, 2012 12:27 pm

Breaks Debugger

Post by org »

6502 simulator (or emulator) on the gate level.

https://github.com/emu-russia/breaks/re ... s-debug-17

(If you're interested you can read the development history of previous versions there)

The Debugger consists of two parts - GUI in c# to display the internals of the processor and native code in c++ which contains the actual emulation of the processor. When you click on the "Step" button, the processor performs one half-cycle and the GUI shows you what's there. The debugger also includes a simple assembler that compiles a 64 Kbyte memory blob at once.

The data flow diagram for the lower part with slight modifications is taken from the dissection of 6502 by ttlworks. Thanks ttlworks! :)

It is possible to dump the internals as Markdown with pictures, for this you need to create a folder WikiMarkdown, where results will be stored.

An example of what results can be seen here: https://github.com/emu-russia/breaks/bl ... /ops/20.md

Source code of the 6502 emulator here: https://github.com/emu-russia/breaks/tr ... /M6502Core

UnitTest Mode

To run the debugger in unit test mode, you need to create a JSON like this:

Code: Select all

json
{
	"CompileFromSource": true,
	"MemDumpInput": "mem.bin",
	"AsmSource": "Test.asm",
	"RamStart": "0",
	"RamSize": "0x800",
	"RomStart": "0xc000",
	"RomSize": "0x4000",
	"RunUntilBrk": true,
	"RunCycleAmount": true,
	"CycleMax": 10000,
	"DumpMem": true,
	"JsonResult": "res.json",
	"MemDumpOutput": "mem2.bin"
}
And run with parameter:

Code: Select all

BreaksDebugger Test.json
As input code, you can use 64 Kbytes memory dump (MemDumpInput) or assembly language source (AsmSource).

Simulator will run until it encounters instruction `BRK` (RunUntilBrk) or specified number of cycles (RunCycleAmount, CycleMax) (These are cycles, not half-cycles).

The output will be a memory dump after simulation (MemDumpOutput) and JSON with simulation results (JsonResult).
Attachments
20_JSR_T3_PHI1.jpg
concept.jpg
Last edited by org on Fri Jan 21, 2022 10:18 am, edited 1 time in total.
User avatar
org
Posts: 155
Joined: Tue Aug 07, 2012 12:27 pm

Re: Breaks Debugger

Post by org »

Tested the operation of the M6502Core in the modified Nintendulator.

https://github.com/ogamespec/nintendulator

Slow, but it works :)
User avatar
org
Posts: 155
Joined: Tue Aug 07, 2012 12:27 pm

Re: Breaks Debugger

Post by org »

Checked nestest, it looks like it needs more work on the bugs...
Attachments
nestest.jpg
User avatar
org
Posts: 155
Joined: Tue Aug 07, 2012 12:27 pm

Re: Breaks Debugger

Post by org »

Fixed minor bugs in M6502Core, now everything works properly. A fresh Breaks Debugger is coming soon.
Attachments
nestest.jpg
User avatar
org
Posts: 155
Joined: Tue Aug 07, 2012 12:27 pm

Re: Breaks Debugger

Post by org »

https://github.com/emu-russia/breaks/re ... s-debug-17

Now I hope the comparison of the correctness of the work will not Breaks Debugger with emulators, but vice versa :)
User avatar
org
Posts: 155
Joined: Tue Aug 07, 2012 12:27 pm

Re: Breaks Debugger

Post by org »

Added support for all stable illegal opcodes.

https://github.com/emu-russia/breaks/re ... s-debug-18
Attachments
illegal_opcodes_nestest.png
Post Reply