Look mom, a CHIP8 CPU being emulated in Node RED

So....

For those monitoring this:

  • Pointless
  • Silly
  • But Crazy achievement in Node RED

If not following: What has been achieved here, is Emulating A CHIP8 Console CPU with Node RED only
It's now become quite a project of mine, and has become an almost Full CHIP8 Console.

The following changes/break throughs have been made since I last posted:

  • No longer needs ANY external lib/Node RED Module
  • The rendering is now achieved with a Native Canvas object in a browser window (HTTP IN)
    • I have employed a type of RFB to send pixel changes over a web socket to the Browser window
  • Now Supports Input. YES!!! you can now play the games :smiley:
  • Now renders Audio - square wave only. YES!!! audio is now rendered
  • Reduce the use of function nodes where possible (@TotallyInformation :wink: )

This started as a fun time waster, and I quickly realised what has been achieved here...
A CPU Stack being emulated / Run inside a Node RED flow!

It's pretty crazy to think, you can see the CPU being executed in a flow.

  1. Import The flow (again, no external libs or Node RED modules are needed - its using all core nodes)
  2. Deploy
  3. On a new browser tab - Go to http://x.x.x.x:1880/chip8
  4. Click the title (this is to allow audio to be played - most browsers require interaction for audio to be allowed) - the video panel should go black
  5. Go back to the flow editor, Inject your chosen ROM (I have included 2)
  6. Inject Start

There are some CPU instructions that I need to fix - but mostly its playable.
To load a new ROM - you have to redo the above steps (you might need to disable/enable the flow - Hey it's a Console being emulated in Node RED, give me a break :wink:

Enjoy.

Keys for Space Invaders as example.

W - Start new Game / Fire
Q - Move Left
E - Move Right

Flow

flows-2.json (33.4 KB)

This whole thing started when @cymplecy implemented an MQTT Broker in Node RED - so wanted to push the bounderies of what is possible after seeing his work.

Have a great weekend!

4 Likes