Code Monkey home page Code Monkey logo

hnc8's Introduction

hnc8

CHIP-8 emulator with a debug server

Background

I wrote this back in 2019 as a course project so I'd be allowed to skip a very basic class on C programming. I might've overdone it a bit on the complexity of my little "C 101" course project :)).

It builds and the code doesn't look too horrible, so I'm taking it over from my old and lost github account for preservation.

Building

The only dependency is glfw.
Not very tested under Windows, so be wary.

To build a debug build:
make debug

To build a release build:
make release

To build under Windows: make -f Makefile.win

To cross-compile for Windows make -f Makefile.win CC=x86_64-w64-mingw32-gcc

Usage

Emulator mode

./hnc8 rom.ch8

Disassembler mode

./hnc8 -md rom.ch8

Debug server mode

./hnc8 -ms

Command line arguments

-m

Select mode of operation.
Valid modes are "emu", "server" and "disasm".

-h

Display help text.

-v

Output version information.

Disassembler arguments

-a

Display memory addresses before assembly.

-i

Display raw instruction bytes before assembly.

Emulator arguments

-f integer

Set clock multiplier for the emulator core.
Timers are still ticked at 60hz.

-s double

Set graphical output scale.

Debug server arguments

-p integer

Set debug server listen port.

Emulator keys

1-4, Q-R, A-F, Z-V

Chip8 keypad.

F5

Reset emulator.

ESC

Quit emulator.

TAB

Turbo mode.

Debug server

Usage

Launch the emulator in debug server mode:
./hnc8 -ms

Use netcat to connect to it:
nc localhost 8888

To disconnect send the command shutdown and disconnct from the server.

Commands

help

Display help.

shutdown

Shut down the server after client disconnect.

load filename / l filename

Load a file into the emulator core.

break [address] / b [address]

Set a breakpoint on specified address or current PC.

lsbreak / lb

List all breakpoints.

rmbreak [index] / rb [index]

Remove breakpoint at index or remove most recently added breakpoint.

continue / c

Continue execution after a breakpoint.

backtrace / bt

Display the stack values.

stepi [count] / si [count]

Execute count number of instructions from current PC.
If count is none then a single instruction is executed.

examine address [count] / x address [count]

Examine memory contents at address. Displays count bytes.

commands

List all commands

registers [register] [value] / r [register] [value]

No arguments:
Display contents of all registers.

Register argument set:
Display contents of specified register.

Register and value arguments set:
Set contents of register to value.

setkey keynum / sk keynum

Toggle state of key keynum.

keys / k

Display keypad state.

disassemble [count] [address] / da [count] [address]

Disassemble count opcodes starting at address.
If address is not specified then from current PC.

screen / scr

Display VM screen contents.

hnc8's People

Contributors

hundinui avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.