Release

CHIP8 Emulator

10

Greenpilloz 2021-01-05 00:54 (Edited)

- Nobody :
- Me : I'm gonna build an emulator for a fantasy console inside this emulator for a fantasy console !

Bio:
Created in 1977, CHIP-8 is the original fantasy console. Initially designed to ease game development for the COSMAC VIP kit computer, it has enjoyed several revivals over the decades for new and exciting platforms. Today, creating a CHIP-8 implementation is a rite of passage for anyone interested in learning about emulation.
(from https://chip-8.github.io/links/)

Links:
- technical references: http://devernay.free.fr/hacks/chip8/C8TECH10.HTM
- Awesome CHIP-8: https://chip-8.github.io/links/
- online emulator: https://www.chip8.net

Idea:
So basically it is an emulation of a simplified CPU, with 16 Register (like variables), a stack (to save the location when jumping to subroutines), some other special registers to store a location (I), a timer (DT), and a timer for a buzzing sound (ST), as well as 4Kb of RAM where the program, font and sprites are loaded. Every address in the RAM is an address from $000 to $FFF (in hex), the program starts at $200 the fonts are at $000. Every instruction consists of 2 Bytes, so the program starts at instruction $200, then $202, $204 etc...

Instructions:
- 00E0 - CLS
- 00EE - RET
- 0NNN - SYS ADDR
- 1NNN - JP ADDR
- 2NNN - CALL ADDR
- 3XKK - SE VX, BYTE
- 4XKK - SNE VX, BYTE
- 5XY0 - SE VX, VY
- 6XKK - LD VX, BYTE
- 7XKK - ADD VX, BYTE
- 8XY0 - LD VX, VY
- 8XY1 - OR VX, VY
- 8XY2 - AND VX, VY
- 8XY3 - XOR VX, VY
- 8XY4 - ADD VX, VY
- 8XY5 - SUB VX, VY
- 8XY6 - SHR VX {, VY}
- 8XY7 - SUBN VX, VY
- 8XYE - SHL VX {, VY}
- 9XY0 - SNE VX, VY
- ANNN - LD I, ADDR
- BNNN - JP V0, ADDR
- CXKK - RND VX, BYTE
- DXYN - DRW VX, VY, NIBBLE
- EX9E - SKP VX
- EXA1 - SKNP VX
- FX07 - LD VX, DT
- FX0A - LD VX, K
- FX15 - LD DT, VX
- FX18 - LD ST, VX
- FX1E - ADD I, VX
- FX29 - LD F, VX
- FX33 - LD B, VX
- FX55 - LD [I], VX
- FX65 - LD VX, [I]
(see http://devernay.free.fr/hacks/chip8/C8TECH10.HTM for details)

Keys:
- "123AZEQSDWXC" Correspond to the 16 keys "123456789ABCDEF" of the original console

Special Keys:
? -- Load from ROM
, -- Load from DISK.nx
; -- Restart
. -- Save to disk
+ -- Settings (change speed, key config...)
H -- Help
SPACE -- Do one step
ENTER -- Run
BCKSPCE -- Edit RAM
P -- Play Mode (Run faster, don't print debug info)

Comes with 23 preloaded games !!!

(to load any other CHIP8 game you can use the following command in a unix terminal:
c=0;for d in *.ch8; do echo "#$((c++)):$d"; hexdump -e '16/1 "%02x " "\n"' $d | tr -d ' ' | tr '[a-z]' '[A-Z]'; done >DISK.nx)

CHANGES:
25/03/21 - Fixed a bug with opcodes 8XY5, 8X06, and 8X0E (bit shifting and subtraction) that caused BLINKY to not work.

CHIP8.nx | Open in app
2021-03-25 12:09
CHIP8.nx | Open in app
2021-01-05 01:16
CHIP8.nx | Open in app
2021-01-05 00:54

Timo 2021-01-05 06:57

Wow!


DrGonzo 2021-01-05 07:46

Neat! Runs better than previous version! Gg


TrashCan Games 2021-01-05 14:50

Very nice


Nicky 2021-03-24 10:55

@greenpilloz,Blinky game doesn't work! Can you fix it?


Greenpilloz 2021-03-25 12:11 (Edited)

@Nicky got you covered pal ;-) It was a sneaky bug with bit shifting. I'm not sure what are the controls for this game but it seems to work now.

btw, it's quite unplayable at the default speed, you should put 20 cpu cycles per VBL or smthg like that (press '+' for settings), and play only in 'p' mode (press 'p' instead of enter for faster execution).


Log in to reply.