Skip to content

jhgorrell/dcpu-el

Repository files navigation

README.org

About “dcpu-el”

dcpu-el is a DCPU-16 assembly mode and emulator written in elisp.

Quickstart

 git clone https://github.com/jhgorrell/dcpu-el.git dcpu-el.git
 cd dcpu-el.git
 emacs dcpu-test.el
 M-x dcpu:test-hw-1
 Press "F11 F11" to toggle the UI; "F12" to single step.

Features

  • v1.7 emulator
  • emacs font-lock mode for dasm assembly
  • four pane display of register, memory, screen and source
  • single step and run to break
  • screen device (addr @ 0x8000; 32 wide 12 high)
  • Checkpoint save and restore - jump back to prior cpu states!

Screenshot

http://github.com/jhgorrell/dcpu-el/raw/master/images/screen-1.png

Emulator Keybindings

<f12>           dcpu:ui-run
<f11> <f11>     dcpu:ui-toggle
<f11> 1         dcpu:ui-run-speed-1
<f11> 2         dcpu:ui-run-speed-2
<f11> 3         dcpu:ui-run-speed-3
<f11> ?         dcpu:ui-help
<f11> B         dcpu:ui-clear-break
<f11> R         dcpu:ui-cpu-reset
<f11> b         dcpu:ui-set-break
<f11> m         dcpu:ui-add-areg
<f11> t         dcpu:trace-toggle
<f11> u         dcpu:ui-update
<f11> c a       dcpu:ui-checkpoint-auto
<f11> c l       dcpu:ui-checkpoint-load
<f11> c s       dcpu:ui-checkpoint-save
<f11> s c       dcpu:ui-toggle-screen-color
<f11> w 1       dcpu:ui-goto-reg-win
<f11> w 2       dcpu:ui-goto-mem-win
<f11> w 3       dcpu:ui-goto-screen-win
<f11> w 4       dcpu:ui-goto-main-win
<f11> w 5       dcpu:ui-goto-right-win
<f11> w m       dcpu:ui-goto-mem-win
<f11> w r       dcpu:ui-goto-reg-win
<f11> w s       dcpu:ui-goto-screen-win
<f11> w t       dcpu:ui-view-trace
<f11> w w       dcpu:ui-goto-main-win

Files

dasm-mode.el
Mode for editing dcpu16 assembly
dcpu-elisp.el
elisp setup for working with dcpu el files
dcpu.el
Main file which includes the others
dcpu-util.el
Utility functions
dcpu-aregion.el
Address regions
dcpu-defs.el
defvars for dcpu-dcpu.el
dcpu-cpu.el
The dcpu16 emulator
dcpu-opcode-func.el
Defines defopcode
dcpu-opcode-list.el
List of defopcodes which def
dcpu-asm-defs.el
List of opcodes for asm/disasm
dcpu-asm.el
simple LAP inspired 2-pass assembler
dcpu-disasm.el
simple disassembler
dcpu-cli
shell script to run as an app
dcpu-cli.el
elisp for app
dcpu-faces.el
List of faces
dcpu-display.el
Display drawing functions
dcpu-screen.el
Screen drawing functions
dcpu-ui.el
User Interface functions
dcpu-tests.el
some tests and dcpu LAP code
elex.el
lexer written in elisp
elex-test.el
tests of lexer

Todo

  • special “dcpu-checkpoint a” instr in the emulator
  • check cycle counts
  • instr freq count/profiler
  • disassemble other data structures (strings,code,…)
  • relative labels in disassembly
  • charset
  • interrupts
  • keyboard @ 0x7FFF
  • devices
  • autoloads

Future Optimizations

  • macros for fixed regs
  • “if-tree” instead of cond (huffman weight?)

Future Features

  • dump state to load later (include regs)
  • add external sim
  • other reg names (aliases)
  • octal/bin nums
  • “:label” and “label:”
  • “.include”
  • asm macros
  • asm directives (.org .align)
  • jit
  • compiler

JIT

  • JIT supress computing of EX when not needed
  • supress computing of other dead values

Other Links

About

dcpu-16 for emacs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages