Giter Club home page Giter Club logo

chip8-emulator's Introduction

Hey there ๐Ÿ‘‹

Hey! My name is Ezekiel, and I am a recent computer science graduate with an interest in game development and software design. I love using my programming skills to bring new ideas to life, and I'm always looking for ways to learn and grow in my field. When I'm not coding, I enjoy exploring my creative side through digital art and I occasionally share my latest creations on my Instagram. Thanks for taking the time to get to know me!


๐Ÿ˜Ž About Me

  • ๐Ÿ”ญ Iโ€™m currently working on Fray, a fighting/action game framework for the Godot game engine! As a fan of fighting games, I noticed that there is a lack of resources and tools available to aid in the development of such games. So I started building an addon that helps with some common fighting game issues, such as state management, hitbox management, and complex input detection. I work on it in my free time so development has been a little slow but I hope what I have can be of some use to someone!

  • ๐ŸŒฑ Iโ€™m currently learning C++. I hope to become proficient enough to one day contribute to the Godot game engine. The plan after C++ is to try and pick up Rust.

  • ๐Ÿ”ฅ I dislike web development. Well not really, I just don't get along with CSS sometimes.

  • ๐ŸŽฎ Favorite Games: Some of my favorite games are Bloodborne, Guilty Gear Strive, and .hack//G.U.

  • โšก Fun fact: My username 'Pyxus' is just a combination of Pixel and Nexus. I came up with it back in middle school, it was supposed to be a clever way of saying "digital image".

๐Ÿงฐ Languages and Tools

C-Sharp

Java

Kotlin

JavaScript

TypeScript

Godot

Git

VS Code

Android Studio

React


๐Ÿ“Š Stats

Anurag's GitHub stats

chip8-emulator's People

Contributors

pyxus avatar twilli70 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

chip8-emulator's Issues

Fix vram out of bounds crashing

Some games attempt to draw to a memory spot not located in the vram, could be a failure to wrap or maybe these games expect a higher resolution?

Graphics rendering

Overview

Importance: High
Difficulty: High
Time Estimate: Unknown

Specifications

Chip8 requires a 64x32-pixel monochrome display where each pixel only contains the information as to whether it is on or off. Graphics are drawn to the screen through the use of 8xN sprites where N represents the pixel height of the sprite; N <= 15. Programs may reference a group 8x5 of font sprites representing hexadecimal digits 0-F stored in memory 0x000 to 0x1FF: A visualization of these fonts can found here.

Implementation Details

Chip8 sprites are bit packed where each byte contain 8 pixels of sprite data. Basically each bit needs to be iterated through and if a 1 is detected draw a pixel, and if a 0 is detected draw nothing. The relatively difficult part is drawing these pixels to screen as a 3rd party library will need to be used. OpenTK and Raylib-CS are my recommendations. I'd prefer if we can pull it off with OpenTK as Raylib is a higher-level wrapper.

Edit: On second thought im thinking we should just go with Raylib. It has a lot of out of the box features that could save us some headache

Main loop

Overview

Importance: High
Difficulty: Medium
Time Estimate: Depends

The main loop is where we'll need to update timers, draw calls, and such. Basically it controls the processing cycle of the emulator.

Specifications

Chip8 should update at a rate of 60Hz

Implementation Details

Basically we need a while loop that updates at 60Hz. How to do that will require some research but I don't think it will be too difficult.

Keyboard Input

Overview

Importance: Medium
Difficulty: Should be Low
Time Estimate: Less than a day

Specifications

Chip8 expects a 16-key hexadecimal keypad with the follow layout:
1 2 3 C
4 5 6 D
7 8 9 E
A 0 B F

Implementation Details

We'll need to map some keys on out keyboard to chip8's hexadecimal keyboard which is the easy part. The more difficult part is figuring out a way to detect inputs. If we choose to go with raylib I believe it had tools for doing this but native c# or some other c# library likely will support this. Overall this just requires more research.

I think input detection will also need to be integrated into our mainloop

3xkk

Tim - NOT working (3040) in debugger is V0, 64 not V0 40
(3120) V1, 32 program counter incremented by 2 even though Vx is not equal to kk

Memory emulation

Overview

Importance: High
Difficulty: Low
Time Estimate: Less than a few hours
Note: Difficulty and time estimate are my best guess based on research.

Specifications

Memory

Chip8 requires 4KB (4096 bytes) of RAM from location 0x000 (0) to 0xFFF (4095). The first 512 bytes, from 0x000 to 0x1FF are where the original interpreter was located and because of that will NOT be used by our emulator. Programs start at location 0x200 (512). See here for visual of memory layout.

Registers

  • 16 general purpose 8-bit registers referred to as Vx, where x is a hexadecimal digit 0 - F. VF is used as a flag by some instructions and should not be used by any program.
  • 16-bit register called I used to store memory addresses.
  • 2 special purpose 8-bit registers for delay and sound timers. When they are non-zero they are automatically decremented at a rate of 60Hz.
  • 16-bit program counter used to store the currently executing address.
  • 8-bit stack pointer used to point to the topmost level of the stack
  • 16 16-bit stack used to store the address that the interpreter should return when a subroutine is finished. 16 are needed since chip8 allows for 16 levels of nested subroutines.

Implementation Details

I believe all memory components can be emulated simply by using arrays. A public interface should be written for the purposes of interacting with the virtual memory.

Add support for hires roms

Hires roms require a 64x64 frame buffer as well as some additional specifications outlined in the hires_information.txt. This isn't too important im mostly putting this here as a reminder for if we have time.

Chip8 interpreter

Overview

Importance: High
Difficulty: Varies
Time Estimate: Unknown

Specifications

Chip8 features 36 2 byte long instructions that are stored most significant bit first. The first byte of each instruction should be stored in an even memory location. A full list of all instructions and a description of what they do can be found here.

Implementation Details

The simplest implementation would be a large switch statement that executes some code where a specific instruction is detected. Another implementation I've seen is using an array of function pointers where the opcode acts as an index to the function which should handle it.

note: This task can be split up among the team with each person handle a set of opcodes.

Loading Rom

Overview

Importance: High
Difficulty: Unknown
Time Estimate: Unknown

Before we can processes Chip8 instructions we need to be able to read from a ROM file.

Implementation Details

I have yet to do any research into this area and am current unaware of how it can be done. C# has a stream reader which should be able to read bytes from a file so that may be a good place to start.

Accept input through flag based command line arguments

In short I think the program should accept input through command line arguments. There should be at least 2 flags and more can be added if deemed necessary. The two flags are the following...

-p <path_to_chip-8_program>
-s <number_representing_window_scale>

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.