/cnmcu-nano-demo

CodeNode Nano Demo is a proof-of-conecpt of a emulated microcontroller for use in a Minecraft mod.

Primary LanguageCGNU General Public License v3.0GPL-3.0

CodeNode Nano Demo

A proof-of-conecpt application the emulates a 6502 based microcontroller for use in Minecraft. You are able to program the MCU in assembly and run the code in real-time with the help of vasm, a 6502 assembler. The MCU is able to interact with four redstone wires and handle interrupts.

Screencapture

Table of Contents

Features

  • Emulation of a 6502 microcontroller.
  • Control of MCU and four redstone wires connected to it.
  • CPU and memory status display.
  • Built code editor with syntax highlighting (sort-of).
  • Ability to load and save code.
  • Utilizes vasm to assemble code.
  • Upload code to the MCU and run it in real-time.

MCU Documentation (How to use)

Screenshot

Goto CodeNode Nano Demo > Help > Documentation.

How to build

This works for most operating systems, but you need to have CMake installed.

First, clone the repository recursively:

git clone https://github.com/elmfrain/cnmcu-nano-demo.git --recursive

Create a build directory

mkdir build && cd build

Run CMake

cmake ..

Build the project

make cnmcu-nano-demo

On Windows, you can use Visual Studio to build the project. Open the project in the build directory and build the cnmcu-nano-demo target.

How to run

Before running the application, you must download and/or build the vasm assembler. Some prebuilt binaries are avaiable here, but you may need to build them yourself on some platforms.

You must put vasm6502_oldstyle and vobjdump (and cywin.dll for Windows) binaries in the toolchain folder.

/ cnmcu-nano-demo
  / toolchain
    / vasm6502_oldstyle
    / vobjdump
    / cywin.dll

If you've built the project yourself, chances are that you need to be in the build directory, the structure should look like this:

/ cnmcu-nano-demo
  / build
    / toolchain
      / vasm6502_oldstyle
      / vobjdump
      / cywin.dll

The application will use these binaries to assemble the code.

Then run the application:

./cnmcu-nano-demo

Use different toolchain (assembler)

If you wish to use a different assembler, you can change the compile_command in the textbox besides the Upload button.

Screenshot

res/program.s should be set as the input file for your assembler. Then the output flag should be set at the end of the command, for example:

vasm6502_oldstyle -Fbin -dotdir -wdc02 res/program.s -o <the app fills this in>

because the application expects rom.bin to be the output file.

Downloads

Prebuilt binaries for Windows, Linux, and MacOS x86_64 systems can be found in the releases section.

Libraries Used

Misc

This project uses code from this tiny game-engine used in SARE Logo Visualizer that uses Lua to load assets and setup scene composition. Created assets and planned scene composition using Blender.