Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
clock Removes all the SPEC files. Notch has made it clear he does not Nov 22, 2012
etcp
keyboard Removes all the SPEC files. Notch has made it clear he does not Nov 22, 2012
lem1802 Runs go fmt over the source tree. May 10, 2013
m35fd
spc2000
sped3 Runs go fmt over the source tree. May 10, 2013
README.md dcpu-emu: Amend READMe with information about what the CLI display el… Nov 21, 2012
breakpoint.go dcpu-emu: Implement breakpoints and memory watchers. Nov 21, 2012
build.go
cli.go dcpu-emu: Minor bug fixes and made text wrap around text boxes of line Nov 24, 2012
cli_input.go dcpu-emu: Implement breakpoints and memory watchers. Nov 21, 2012
cli_label.go
cli_textbox.go
command.go
device.go dcpu-emu: Code cleanup, refactoring and other little bits. Nov 21, 2012
doc.go Added dcpu-list and -deps commands. Removed 'dcpu' command. Nov 16, 2012
emu.go dcpu-emu: Implements most of the CLI. Nov 21, 2012
gl.go dcpu-emu: Lots of improvements to emulator. Nov 3, 2012
lem1802.go
main.go dcpu-emu: Adds ETCP device to emulator. Nov 23, 2012
misc.go dcpu-emu: Removes emulator keybindings from opengl window. Nov 19, 2012
sourcecache.go
sped3.go dcpu-emu: Lots of improvements to emulator. Nov 3, 2012
version.go dcpu-emu: Minor bug fixes and made text wrap around text boxes of line Nov 24, 2012
watcher.go

README.md

DCPU Emulator

Note: This is work in progress and should not be considered useful yet.

This is an experimental, standalone, graphical emulator for the DCPU. It includes fully implemented DCPU hardware and doubles as a code profiler and debugger.

Controlling the emulator happens through a command line UI. The LEM1802 or SPED3 displays are running separately in an OpenGL context.

Keyboard input for the CLI happens in the console window. The openGL window accepts keyboard input only through the DCPU keyboard hardware and is meant strictly to control the DCPU program, not the emulator.

Keyboard shortcuts

These are all invoked from within the command line interface.

  • q: Start the CPU.
  • w: Stop the CPU.
  • e: Perform a single CPU step.
  • r: Reset the CPU to its initial state. This implicitly recompiles the program and loads it from disk and allows us to reload any changes to the source without restarting the emulator. Additionally it resets memory and registers to their beginning state. This will not reset breakpoints and memory watchers.
  • -: Decrease the CPU clock speed by 10x.
  • +: Increase the CPU clock speed by 10x.
  • /: This enters the commandline mode. We can enter commands manually this way.
    • esc: Hitting escape while in command line mode, will exit it.

Supported commands in command line mode are as follows:

  • exit: This cleanly exits the emulator.
  • b <address|sourcecontext>: This toggles a breakpoint. Either at the given memory address, or at the given source context. The source context looks as follows: "test/hw/main.dasm" 13. This is the relative file path, along with the line number. If the breakpoint does not exist yet, it is created. Otherwise it is enabled/disabled.
  • be: Enable all breakpoints.
  • bd: Disable all breakpoints but do not remove them.
  • bc: Clears all breakpoints.
  • m <address>: Defines a memory watcher for the given address.
  • mc: Clears all memory watchers.

CLI

The command line interface has 4 output windows.

  • Trace log: This log shows the current instruction as it is executed. It includes the PC, opcode, operands and all register states.
  • Source log: This shows the cycle cost for the current instruction, along with the cimulative cycle cost for all invocations of this specific instruction. Next to that, the file/line in which the instruction was defined, followed by the actual source line.
  • Watchers: This list shows the currently defined memory watchers.
  • Breakpoints: This list shows the currently defined memory breakpoints.

At the bottom of the window is a single line input textbox. It can be activated with the / key and used to type in commands defined in the previous paragraph.

Dependencies

go get github.com/go-gl/gl
go get github.com/go-gl/glfw
go get github.com/go-gl/glh
go get github.com/jteeuwen/keyboard/glfw

Usage

Run dcpu-emu -h for a listing of options.

License

DCPU, 0x10c and related materials are Copyright 2012 Mojang.

Unless otherwise stated, all of the work in this project is subject to a 1-clause BSD license. Its contents can be found in the enclosed LICENSE file.