GitXplorerGitXplorer
v

voja4_nibbler

public
6 stars
3 forks
0 issues

Commits

List of commits on branch master.
Unverified
e6ea9ab2b75a88730a634da8f994a1865d6aedff

Add context around current instruction in diassembly listing.

vvoctav committed 2 years ago
Unverified
39da2c06a19f808578370947061dfb9cf9c7ed25

Display timing stats on VM clocks and UI updates.

vvoctav committed 2 years ago
Unverified
4367f80bbfd30f8f3ff0497dbac1a3ccf3add909

Initializes ncurses after loading program.

vvoctav committed 2 years ago
Unverified
3518205f5765f25854416dd4da030a8af43d45fb

Fix crash when program cannot be loaded.

vvoctav committed 2 years ago
Unverified
6be9c19308fe22aedaf2174893358d5fb18d3333

Allow multiple UI updates in-between VM cycles.

vvoctav committed 2 years ago
Unverified
a8cecde6f8f5e908f46185dcb481d6f81c0264fb

Track VM state changes and skip screen updates if not needed.

vvoctav committed 2 years ago

README

The README file for this repository.

Nibbler - Text based emulator for Voja's 4-bit processor.

Eats nibbles for breakfast.

Building

Requirements

Modern C compiler, make, and ncurses library (development files).

Linux

To install ncurses library development files on Ubuntu/Debian:

sudo apt-get install ncurses-dev

To build:

make

Windows (MSYS2)

Only MSYS2 platform was tested on Windows. Ensure gcc and make are installed before continuing.

To install ncurses library development files:

pacman -S ncurses-devel

To build:

make

Basic Usage

To run:

./nibbler file.hex

There are some sample binaries that work with the emulator in examples/. These have been assembled from the official badge tools repo.

Keys:

  • Q - end program and exit.
  • Space - pause execution, or execute a single instruction if already paused.
  • Enter - continue execution normally if paused.
  • Left/Right - decrement/increment Page register.
  • <tab> - key 0 (mode).
  • 1 2 3 4 - keys 1-4 (opcode).
  • A S D F - keys 5-8 (operand x).
  • Z X C V - keys 9-12 (operand y).
  • / - key 13 (data in).

Note that pressing Esc results in a small delay as getch is attempting to parse the escape sequence.

Command Line Options

  • The -p option tells nibbler to pause at the start of the program before executing any instructions. This allows single stepping from the beginning. The default is to start executing directly.
  • The -r option will color the page display area red on terminals that support colors. This better simulates the look for the real hardware.

Terminal Settings

Dimming is only supported for terminals with 256 colors.

It's possible to change TERM environment variable to force a certain terminal type (e.g. export TERM=xterm-256color):

  • xterm-mono - monochrome.
  • xterm-color - 8 colors.
  • xterm-16color - 16 colors.
  • xterm-256color - 256 colors.

Features

  • Simulated LED matrix shows active page.
  • Dimmer is simulated using color output (interpolates between black and yellow).
  • Clock and Sync registers supported. The simulation itself is very fast and can do faster than 100 KHz, but UI updates may introduce slight delays.
  • All registers are mapped correctly onto user memory and can be visualized in the matrix just like on the real hardware.
  • Basic support for keys. AnyPress and LastPress flags will be set the first time a recognized key is pressed and will stay like that. JustPress will be set every time a new key is recognized, and it will be reset when the program reads the register (as expected).

Missing Features

The core VM seems to work well with a variety of programs, but there may still be bugs.

The following features are not supported (or only partially supported):

  • Key support is partial. Alt key is not supported, and since it's not possible to get key release events from the terminal, a key will be reported as released after a fixed amount of time (200 miliseconds).
  • GPIO input is not implemented; pins will always show as 1.
  • UART is not implemented.

There a lot more work to be done on the UI.

Resources