CodyNET is a .NET based emulator for the Cody Computer, a retro-style computer based on the WDC65C02 microprocessor.
This implementation is using iTitus' Cody Emulator as a reference. It aims to enhance the original emulator with extended features.
- Emulation of Cody Basic and Assembly
- ...
- Debugging tools for assembly programming
- Emulator can be set to run in real time
Uses the 65x02 SingleStepTests created by Thomas Harte et al., licensed under MIT.
Download the test definitions for the WDC65C02 from here and unpack them in CodyNET.Tests/testdata to run the tests. The project copies everything under wdc65c02/ to the test output directory so tests can run from the compiled bin folder.
Prefer the helper scripts for minimal effort:
./CodyNET.Tests/testdata/fetch-singlestep-tests.sh./CodyNET.Tests/testdata/fetch-singlestep-tests.ps1This folder testdata should contain the path wdc65c02/v1/*.json
- Just-In-Time Assembly to display instruction context in debugger
- Buttons and register values at top of debugger
There are multiple ways to implement the Debugger. Ideally, the debug instructions should be easy to use and remember, while not having side effects on the program.
The 65C02 has several unused opcodes that could be used for artificial mnemonics. This might cause side effects on the actual Cody Computer Hardware. Existing assemblers might not support these mnemonics, so a preprocessor would be required, adding an additional step to assembling a program.
- DRS #index → Dump Registers in Logger
- DBP → Create breakpoint, gives control to debugger when reached
- DMP → Dump Memory in Logger
- Mnemonics easy to remember and intuitive to use
- Very easy to implement in the emulator
- Possible side effects on real hardware
- Requires a preprocessor for existing assemblers, or a custom assembler
The Cody Computer does not map the full 16-bit address space. The range $FF00 to $FFFF is reserved for ROM. Writing to these addresses could be used to trigger debugger actions. This approach has no side effects on the actual hardware, as writes to ROM are ignored.
- No side effects on real hardware
- No preprocessor or custom assembler required
- Easy implementation of Debugger as Memory Mapped Device in the Emulator
- Multiple instructions required for command
- Commands less intuitive to use
Macros could be used to simplify the usage of Option B in assembly code. For example:
DBG_DBP = $FF00
DBG_DRS = $FF01
DBG_DMP = $FF02
DBP .macro param
LDA #\param
STA DBG_DBP
.endmacro
DRS .macro
LDA #$01
STA DBG_DRS
.endmacro
DMP .macro param
LDA #\param
STA DBG_DMP
.endmacro
start:
DBP $01
DRS
DMP $02
BRKor even shorter:
DBP .macro param
LDA #\param
STA $FF00
.endmacro
start:
DBP $01
BRK[Step] [Continue] [Exit]
A = 0x50, X = 0x10, PC = 0x2000
-------------------------------
STA $2002 <- Current instruction
LDA $2000 <- Next instruction
JSR $FFD2
[...]