Code Monkey home page Code Monkey logo

chip8-emulator's Introduction

Chip-8 Emulator

Chip 8 is an interpreted programming language (more like a virtual machine), which was initially used on the Telmac 1800 8-bit microcomputers to make game programming easier.

Memory

  • Interpreter occupies the first 512 bytes of memory space. Thus, programs written for the original system begin at memory location 512 (0x200)
  • Uppermost 256 Bytes are reserved for display refresh
  • 96 bytes below that are reserved for call stack, internal use, and other variables

Chip8 Memory layout

Registers

  • CHIP-8 has 16 8-bit dat aregisters namely V0-VF.
  • VF is for carry flag.
  • Address Register (I) is 16-bit wide

Stack

  • 16 levels of stack
  • Stack is used to store return addresses when subroutines are called.

Display

  • Chip-8 language uses a 64x32-pixel monochrome display
  • Chip-8 draws graphics on screen through the use of sprites. (Sprite: group of bytes which are a binary representation of the image)

Opcodes

Opcode Description Implemented
00E0 Clears the screen
00EE Return from a subroutine
1NNN Jump to address NNN
2NNN Call subroutine at NNN
3XNN Skips the next instruction if VX == NN
4XNN Skips the next instruction is VX != NN
5XY0 Skip the next instruction if VX == VY
6XNN VX = NN
7XNN Adds NN to VX
8XY0 VX = VY
8XY1 VX = VX OR VY
8XY2 VX &= VY
8XY3 VX ^= VY
8XY4 VX += VY
8XY5 VX -=VY
8XY6 VX >>= 1
8XY7 VX=VY-VX
8XYE VX <<= 1
9XY0 Skips the next instructions if VX != VY
ANNN I = NNN
BNNN PC=V0+NNN
CXNN VX = rand() & NN
DXYN Draws a sprite at coordinate (VX,VY) that has a width of 8 pixels and a height of N pixels
EX9E Skips the next instruction if the key stored in VX is pressed
EXA1 Skips the next instruction if the key stored in VX isn't pressed
FX07 VX = delay_timer
FX0A A key pressed is awaited, and then stored in VX
FX15 delay_timer = VX
FX18 sound_timer = VX
FX1E I += VX
FX29 Sets I to the location of the sprite for the character in VX
FX33 Stores the BCD representation of VX
FX55 memory = VX (V0-VF)
FX65 VX = memory

chip8-emulator's People

Contributors

huzzziiii avatar

Watchers

 avatar  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.