GitXplorerGitXplorer
v

voja4_nibbler

public
6 stars
3 forks
0 issues

Commits

List of commits on branch master.
Verified
cc5ea7fb9e5785ee6365440476af285f7e9291e6

Fix build error due to format warning (#12)

uunwiredben committed 2 years ago
Unverified
3d531945ef25d8bd54d3775f39b69da6e594c4a7

Refresh screen at 30 Hz.

vvoctav committed 2 years ago
Unverified
1dde653fdae0e2d3536c7dc51d6cb803d77dc950

Generate key release events after a fixed delay.

vvoctav committed 2 years ago
Unverified
ac1a6a36b29c052968df92c3dbb9ae65226c5f9f

Remove obsolete include ui.h from vm.c.

vvoctav committed 2 years ago
Unverified
6489174b560fa0b06a9b5492651a4e03b45059c0

Carry over inc/dec on jsr/pcl to pcm and pch (#11).

vvoctav committed 2 years ago
Unverified
6a8bca7ebf0f8263539718c292745f1b57274b0b

Compactify the register layout.

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