Close

ESP8266 ESPboy CHIP8/SCHIP emulator packed with 90 games

A project log for ESPboy - RetroGaming&Software development MuliTool

For IT geeks, retro game fans, makers. Open source, portable, modular to explore, create, learn, code & play

romansRomanS 07/04/2019 at 09:480 Comments

ESP8266 ESPboy CHIP8/SCHIP emulator packed with 90 games

About chip8/schip: https://en.wikipedia.org/wiki/CHIP-8

Special thanks to:

and Alvaro Alea Fernandez https://github.com/alvaroalea for his Chip-8 emulator 

Implemented all known quirks to provide wide compatibility

Used information from

The games should be with extention ".ch8" as <gamename.ch8> 
To upload games to SPIFFS check: https://www.youtube.com/watch?v=25eLIdLKgHs&t=3s

For correct compilation, change settings in file «User_Setup.h» of TFT_eSPI library

  1. 50 #define TFT_WIDTH 128
  2. 53 #define TFT_HEIGHT 128
  3. 67 #define ST7735_GREENTAB3
  4. 149 #define TFT_CS -1
  5. 150 #define TFT_DC PIN_D8
  6. 152 #define TFT_RST -1
  7. 224 #define LOAD_GLCD
  8. 255 #define SPI_FREQUENCY 27000000

GAMENAME PREFIXES:

CHIP8 GAMES in this package digital heritage )

  1. Airplane 
  2. Animal Race by Brian Astle
  3. Astro Dodge by Martijn Wenting / Revival Studios
  4. Blinky by Hans Christian Egeberg
  5. Blitz by David Winter
  6. Bowling by Gooitzen van der Wal
  7. Breakout (Brix hack) by David Winter
  8. Breakout by Carmelo Cortez
  9. Brick (Brix hack)
  10. Brix by Andreas Gustafsson
  11. Cave
  12. Connect 4 by David Winter
  13. Deflection by John Fort
  14. Guess by David Winter
  15. Hidden by David Winter
  16. Landing
  17. Lunar Lander
  18. Mastermind by Robert Lindley
  19. Merlin by David Winter
  20. Missile by David Winter
  21. Most Dangerous Game by Peter Maruhnic
  22. NIM by Carmelo Cortez
  23. Paddles
  24. Pong (1 player) 
  25. Pong 2 (Pong hack) by David Winter
  26. Pong by Paul Vervalin
  27. Reversi by Philip Baltzer
  28. Rocket Launch by Jonas Lindstedt
  29. Rocket
  30. Rush Hour
  31. Shooting Stars by Philip Baltzer
  32. Slide by Joyce Weisbecker
  33. Soccer
  34. Space Flight
  35. Space Invaders by David Winter
  36. Squash by David Winter
  37. Syzygy by Roy Trevino
  38. Tank
  39. Tapeworm by JDR
  40. Tetris by Fran Dachille
  41. TicTacToe by David Winter
  42. Timebomb 
  43. UFO |
  44. Vertical Brix by Paul Robson
  45. Wall by David Winter
  46. Wipe Off by Joseph Weisbecker
  47. WormV4 by Martijn Wenting / Revival Studios

HIRES GAMES in this package

  1. Astro Dodge by Martijn Wenting / Revival Studios
  2. WormV4 by Martijn Wenting / Revival Studios

SUPER CHIP GAMES in this package

  1. Alien | Jonas Lindstedt
  2. Ant  In Search of Coke | Erin S. Catto
  3. Astro Dodge| Martijn Wenting / Revival Studios
  4. Blinky | Hans Christian Egeberg
  5. Car | Klaus von Sengbusch
  6. Field! | Al Roland
  7. H.Piper | Paul Raines
  8. Joust | Erin S. Catto
  9. Loopz | Andreas Daumann
  10. Magic Square | David Winter
  11. Mines!  The minehunter | David Winter
  12. Sokoban | hap
  13. Spacefight 2091 | Carsten Soerensen
  14. UBoat | Michael Kemper
  15. WormV3 | RB
  16. WormV4 | Martijn Wenting

OCTO JAM GAMES 
https://johnearnest.github.io/chip8Archive/

  1. RPS | SystemLogoff
  2. Octo: a Chip 8 Story | SystemLogoff
  3. Pumpkin "Dreess" Up | SystemLogoff
  4. Rockto | SupSuper
  5. Flight Runner | TodPunk
  6. Turnover '77 | 
  7. Ultimate Tictactoe |
  8. Super Square | tann
  9. Eaty The Alien | JohnEarnest
  10. Octopeg | Chromatophore
  11. Masquer8 | Chromatophore
  12. Fuse | JohnEarnest
  13. Black Rainbow | JohnEarnest
  14. 8CE Attourny  Disc 1, 2, 3 | SystemLogoff
  15. DVN8 | SystemLogoff
  16. SubTerr8nia |
  17. Slippery Slope | JohnEarnest
  18. Octo Rancher | SystemLogoff
  19. Tank! | Rectus
  20. Carbon8 | Chromatophore
  21. ChipWar | JohnEarnest
  22. Cave Explorer | JohnEarnest
  23. Outlaw | JohnEarnest
  24. Bad Kaiju Ju | MattBooth
  25. Piper | Aeris, JordanMecom, LillianWang

Tested games are not in this package due to numerous keys using or something else 

  1. Bingo by Andrew Modla (hybrid)
  2. Blockout by Steve Houkx
  3. 15 Puzzle by Roger Ivie
  4. Biorhythm by Jef Winsor
  5. Blackjack by Andrew Modla (hybrid)
  6. Craps
  7. Figures
  8. Filter
  9. Fishie by hap
  10. Pinball by Andrew Modla (hybrid)
  11. Programmable Spacefighters by Jef Winsor
  12. Puzzle |
  13. Robot |
  14. Sequence Shoot by Joyce Weisbecker
  15. Spooky Spot by Joseph Weisbecker
  16. Sum Fun by Joyce Weisbecker
  17. Tron
  18. Video Display Drawing Game by Joseph Weisbecker (hybrid)
  19. Addition Problems by Paul C. Moews
  20. Bounce by Les Harris
  21. Robot
  22. Worms
  23. Car Race Demo by Erik Bryntse
  24. Single Dragon (Bomber Section) by David Nurser
  25. Single Dragon (Stages 12) by David Nurser
  26. XMirror
  27. Sens8tion by Chromatophore
  28. Grad School Simulator 2014 by JohnEarnest
  29. Loopz by Andreas Daumann
  30. Matches
  31. Syzygy2

CONFIG FILE 
You is able to make <gamename.k> configuration files and upload them to the SPIFFS togather with games.
It looks like simple txt file. Check below

The name of the configuration file should be the same as the game's name but with extention ".k" as <gamename.k>

-------------------config file begins---------------------

4 2 8 6 5 11 4 6
13
0
1
67
30
60
200
Here could be description of the game about 300 symbols
-------------------config file ends---------------------

CONFIG FILE <gamename.k> INSTRUCTIONS
It's important not to change layout of first 9 lines of this file.
- key mapping separated by spaces
- foreground color
- background color
- delay
- compatibility flags
- quantity of opcodes run before TFT updates
- timers frequency
- sound tone frequency
- .ch8 file description about 300 symbols

1. KEY MAPPING
first line is the list of chi8 keys separated with spaces corresponded to ESPboy keys

ESPboy keys
0-LEFT, 1-UP, 2-DOWN, 3-RIGHT, 4-ACT, 5-ESC, 6-LFT side button, 7-RGT side button

Chip8 keys
1     2     3     C[12]
4     5     6     D[13]
7     8     9     E[14]
A[10] 0[0] B[11]  F[15]

2. FOREGROUND COLOR
no of color according to the list  
0-BLACK  1-NAVY  2-DARKGREEN  3-DARKCYAN  4-MAROON 
5-PURPLE  6-OLIVE  7-LIGHTGREY  8-DARKGREY  9-BLUE  
10-GREEN  11-CYAN  12-RED  13-MAGENTA  14-YELLOW
15-WHITE  16-ORANGE  17-GREENYELLOW  18-PINK

3. BACKGROUND COLOR
no of color according to the same list 

4. DELAY
delay in microseconds before each instruction

5. COMPATIBILITY FLAGS
are used to turn on/off few emulator tricks
details https://github.com/Chromatophore/HP48-Superchip

>8XY6/8XYE opcode
Bit shifts a register by 1, VIP: shifts rY by one and places in rX, SCHIP: ignores rY field, shifts existing value in rX.
bit1 = 1    <<= amd >>= takes vx, shifts, puts to vx, ignore vy
bit1 = 0    <<= and >>= takes vy, shifts, puts to vx

>FX55/FX65 opcode
Saves/Loads registers up to X at I pointer - VIP: increases I by X, SCHIP: I remains static.
bit2 = 1    load and store operations leave i unchaged
bit2 = 0    I is set to I + X + 1 after operation

>8XY4/8XY5/8XY7/ ??8XY6??and??8XYE??
bit3 = 1    arithmetic results write to vf after status flag
bit3 = 0    vf write only status flag

>DXYN
bit4 = 1    wrapping sprites
bit4 = 0    clip sprites at screen edges instead of wrapping

>BNNN (aka jump0)
Sets PC to address NNN + v0 - VIP: correctly jumps based on value in v0. SCHIP: also uses highest nibble of address to select register, instead of v0 (high nibble pulls double duty). Effectively, making it jumpN where target memory address is N##. Very awkward quirk.
bit5 = 1    Jump to CurrentAddress+NN ;4 high bits of target address determines the offset register of jump0 instead of v0.
bit5 = 0    Jump to address NNN+V0

>DXYN check bit 8
bit6 = 1    drawsprite returns number of collised rows of the sprite + rows out of the screen lines of the sprite (check for bit8)
bit6 = 0    drawsprite returns 1 if collision/s and 0 if no collision/s

>EMULATOR TFT DRAW
bit7 = 1    draw to TFT just after changing pixel by drawsprite() not on timer
bit7 = 0    redraw all TFT from display on timer

>DXYN OUT OF SCREEN check bit 6
bit8 = 1    drawsprite does not add "number of out of the screen lines of the sprite" in returned value 
bit8 = 0    drawsprite add "number of out of the screen lines of the sprite" in returned value 

>0x1E ADI I = I + VX. SET reg I OVERFLOW BIT IN reg VF OR NOT
bit9 = 1 set VF=1 in case of I ovelflow, overwise VF=0
bit9 = 0 VX stay unchanged after oveflowing reg I operation I = I + VX 

for example for AstroDodge game should be set as (binary)01000011 = (decimal)67 

6. Quantity of opcodes 
Quantity of opcodes runs till screen update. Works if you don't use TFT_DRAW bit7 of COMPATIBILITY FLAGS

7. TIMERS FREQUENCY
Setting up the frequency of CHIP8 timers. Standart is 60Hz

8. SOUND TONE
the freq tone of sound

9. GAME INFO
write 314 symbols of information you'll see before the game starts 

Discussions