GithubHelp home page GithubHelp logo

aquova / chip8-book Goto Github PK

View Code? Open in Web Editor NEW
148.0 3.0 11.0 285 KB

An introduction to Chip-8 emulation using Rust

Home Page: https://aquova.net/chip8/chip8.pdf

License: Creative Commons Zero v1.0 Universal

Makefile 3.69% Rust 85.60% HTML 2.68% JavaScript 8.02%
rust emulation emulator webassembly chip8 chip8-emulator chip-8 emudev wasm chip-8-emulator

chip8-book's People

Contributors

aitorres avatar aquova avatar coolandsmartrr avatar lesleyrs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

chip8-book's Issues

Implementation of Sound in the Chip8 Emulator

First of all I'd like to say thanks to aquova for making this very extensive manuell on the chip8 emulator. This has helped me with setting sdl up and the opcodes of course. I also implemented sound into the emulator (just an oscillator that produces a sine wave when the sound timer hits 0). The sound runs on the same thread as the main emulator but that shouldn't be to much of a problem when the sound is very short.

You can take a look [here] (https://github.com/MalekDeKalem/Rust-Chip8-Emulator)

Error when trying to run on m1

When executing Cargo run on Desktop folder:

error: linking with `cc` failed: exit status: 1
    = note: ld: library not found for -lSDL2
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

Space Invaders After Chip8 ?

Sorry to contact you like this, but I couldn't find another way.
I've just read your book on making a chip8 emulator in rust, and I've really enjoyed it.
Will you consider doing the same thing with space invaders ? (the Midway 8080 arcade machine, not a clone of the game)
It is generally considered to be the next step in emulation programming after the chip8, but I couldn't find a tutorial that explains things clearly to me.

Setup chapter skips `keys`

On the Setup chapter, there should be a section mentioning how keys / the keypad is represented on this implementation.

Up to the Stack section, keys are not mentioned. Then, the section that comes right after which is the Timers already includes the keys as part of the Emu struct with no explanation. I actually missed it until my code editor complained of missing keys afterwards in the process.

Credit original author of CHIP-8 games

The provided Chip-8 games are supplied from Zophar's Domain. Original author unknown.

The games in your repo were created by David Winter: https://www.pong-story.com/chip8/

Note that these games were made for Winter's own CHIP-8 interpreter, which in turn was based on CHIP-48, which contains many incompatibilities with other interpreters. If your emulator, and book, are based on that, it's probably incompatible with many games made both before and after the early 90s.

Section 4.2 error: character dimensions

From section 4.2 of the book:

Each character is made up of eight rows of five pixels, with each row using a byte of data, meaning that each letter altogether takes up five bytes of data.

This should either be "five rows of eight pixels" or "eight columns of five pixels".

Pong glitches after about 1 second

I got to the finished desktop build part, and space invaders for example runs fine. But when I try pong it completely glitches out without doing anything. Any fix?

[Document] Stack is LIFO not FIFO

Hi, not sure if the book issues are meant to be opened here, but I did not know where to post it.
I was wondering if there was a mistake in this section as you mentioned Stack but described it as FIFO even though it is usually LIFO and the pancake example sounds like a LIFO example as well?

image

Modern 8XY6 and 8XYE not necessarily correct

It might be worth making a note in the book about instructions 8XY6 and 8XYE.

It turns out the these instruction's meaning somehow got changed with time. Since the idea about the implementation of these is so widespread these days, this leaves the emulator implementor with a dilemma, support the original way (for original ROMs), or support the new way?

Generally it's likely a good idea to support both ways, seeing as its possible one may run into older ROMs which rely on the original correct behavior.

https://web.archive.org/web/20170213223712/http://laurencescotford.co.uk/?p=266

Only the first five of these instructions were officially documented by RCA. 8XY6, 8XY7 and 8XYE are all undocumented. Unfortunately an erroneous assumption about 8XY6 and 8XYE, the two shift instructions, seems to have crept into Chip-8 lore at some point. Most recent documentation on Chip-8 suggests these instructions shift VX rather than VY. Some documents suggest that the correct format for them is 8X06 and 8X0E. However, when these instructions are run on the original Chip-8 interpreter, they will shift VY not VX! An instruction of the form 8X06 or 8X0E will not work as expected. The programmer would be expecting this to shift VX and store the result back in VX. What would actually happen is that V0 would be shifted and the result stored back in VX. This leaves the programmer of a contemporary interpreter with a bit of a dilemma. Do you make these instructions function as they would have done in the original interpreter or do you make them function in accordance with the erroneous assumption? Or do you offer both modes and a way to switch between them? This post documents the way the instructions worked in the original Chip-8 interpreter.

Edit: Also, here's a chip8 test suite. It revealed a few problems with the book's implementation, particularly this one
https://github.com/Timendus/chip8-test-suite

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.