tc-dcpu

command module
v0.0.0-...-a7f2889 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2023 License: BSD-3-Clause Imports: 17 Imported by: 0

README

TC-DCPU: An Emulator

This is an emulator, written with Go and SDL2, for the Techcompliant flavour of the DCPU-16.

Processors

DCPU-16

The DCPU-16 core is compatible with the final 1.7 version of Notch's spec, augmented with TC's extensions to add the LOG, BRK and HLT opcodes.

Risque-16

The Risque-16 is a RISC-style chip inspired by the ARM and Thumb architectures.

It supports the same hardware as the DCPU-16. Instructions generally do less per cycle than the DCPU, but the simpler core executes faster, yielding similar performance.

Pass the -cpu rq flag to switch to Risque-16 mode.

Getting Started

Install Go, and then go get github.com/bshepherdson/tc-dcpu.

Hardware

TC-DCPU supports the following devices, with links to the Techcompliant specs:

All devices publish the Techcompliant new IDs, not the old Notch ones.

Usage

tc-dcpu [options] <ROM file>

Command-line Options
  • -arch cpu: Pass dcpu or rq to select the DCPU-16 or Risque-16 (default: dcpu)
  • -disassemble: Dump a human-readable disassembly of the ROM, instead of executing it. (-arch is honoured; other options are ignored.)
  • -disk disk_file: Specifies the filename to be loaded into the M35fd disk drive.
  • -dump-hw: Pass this to exit immediately with a list of the available hardware devices, and their names as understood by -hw.
  • -hw device1,device2,...: Pass a comma-separated list of device names as given by -dump-hw; devices will be created in that order.
    • Default: keyboard,lem1802,m35fd,clock,rng,hsdp-1d,serial
  • script script_file: Run the script in this file (see below for the scripting language). This allows for automated testing and so on.
  • turbo: Pass this to start in "turbo" mode, where the speed is unlimited. Default: false, 100kHz for DCPU-16 and 200kHz for Risque-16.
Runtime Keybindings

Pressing F-keys engages special functions in the emulator.

  • F1: Show a help guide.
  • F2: Start the debugger
  • F3: Resume running, when debugging
  • F4: Toggle turbo speed
  • F6: Eject/insert disk (assumes a single disk drive)
Debugging

On a LOG opcode, the emulator emits the value in hex, decimal and as a character.

Encountering a BRK opcode triggers the debugger. The debugger has built-in help.

Scripting

A rudimentary scripting language is included, to help automate testing and bootstrapped applications. It expects one command per line, and has basically no syntax. (No comments, no variables, etc.)

  • eject: Ejects the disk. Assumes a single disk drive.
  • mount disk_file: Mounts the named file as the disk. Must be ejected already. Likewise assumes a single disk drive.
  • type char: Types a single character.
  • send string...: Sends the words typed, separated by spaces and ended by a newline.
  • run cycles: Runs that many cycles before continuing the script.
  • quit: Quits the emulator.

The scripting language is processor-agnostic.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL