├── res ├── sprites.bin ├── Screenshots │ ├── s1.png │ ├── s2.png │ ├── s3.png │ ├── s4.png │ ├── s5.png │ ├── s6.png │ ├── s7.png │ ├── animation.gif │ └── animation2.gif └── sprite_map ├── roms ├── games │ ├── Cave.ch8 │ ├── Shooting Stars [Philip Baltzer, 1978].txt │ ├── Tank.ch8 │ ├── Tron.ch8 │ ├── Filter.ch8 │ ├── Puzzle.ch8 │ ├── Soccer.ch8 │ ├── Airplane.ch8 │ ├── Figures.ch8 │ ├── Landing.ch8 │ ├── Paddles.ch8 │ ├── Timebomb.ch8 │ ├── X-Mirror.ch8 │ ├── Pong (alt).ch8 │ ├── Space Flight.ch8 │ ├── Pong (1 player).ch8 │ ├── Rocket Launcher.ch8 │ ├── Vers [JMN, 1991].ch8 │ ├── UFO [Lutz V, 1992].ch8 │ ├── Wall [David Winter].ch8 │ ├── Blitz [David Winter].ch8 │ ├── Guess [David Winter].ch8 │ ├── Merlin [David Winter].ch8 │ ├── Rush Hour [Hap, 2006].ch8 │ ├── Squash [David Winter].ch8 │ ├── Tapeworm [JDR, 1999].ch8 │ ├── 15 Puzzle [Roger Ivie].ch8 │ ├── Biorhythm [Jef Winsor].ch8 │ ├── Brick (Brix hack, 1990).ch8 │ ├── Connect 4 [David Winter].ch8 │ ├── Deflection [John Fort].ch8 │ ├── Hi-Lo [Jef Winsor, 1978].ch8 │ ├── Missile [David Winter].ch8 │ ├── Reversi [Philip Baltzer].ch8 │ ├── Slide [Joyce Weisbecker].ch8 │ ├── Animal Race [Brian Astle].ch8 │ ├── Guess [David Winter] (alt).ch8 │ ├── Nim [Carmelo Cortez, 1978].ch8 │ ├── Pong [Paul Vervalin, 1990].ch8 │ ├── Sum Fun [Joyce Weisbecker].ch8 │ ├── Syzygy [Roy Trevino, 1990].ch8 │ ├── Tic-Tac-Toe [David Winter].ch8 │ ├── 15 Puzzle [Roger Ivie] (alt).ch8 │ ├── Craps [Camerlo Cortez, 1978].ch8 │ ├── Hidden [David Winter, 1996].ch8 │ ├── Rush Hour [Hap, 2006] (alt).ch8 │ ├── Space Invaders [David Winter].ch8 │ ├── Tetris [Fran Dachille, 1991].ch8 │ ├── Wipe Off [Joseph Weisbecker].ch8 │ ├── ZeroPong [zeroZshadow, 2007].ch8 │ ├── Bowling [Gooitzen van der Wal].ch8 │ ├── Breakout [Carmelo Cortez, 1979].ch8 │ ├── Brix [Andreas Gustafsson, 1990].ch8 │ ├── Rocket Launch [Jonas Lindstedt].ch8 │ ├── Addition Problems [Paul C. Moews].ch8 │ ├── Lunar Lander (Udo Pernisz, 1979).ch8 │ ├── Rocket [Joseph Weisbecker, 1978].ch8 │ ├── Sequence Shoot [Joyce Weisbecker].ch8 │ ├── Submarine [Carmelo Cortez, 1978].ch8 │ ├── Vertical Brix [Paul Robson, 1996].ch8 │ ├── Worm V4 [RB-Revival Studios, 2007].ch8 │ ├── Astro Dodge [Revival Studios, 2008].ch8 │ ├── Coin Flipping [Carmelo Cortez, 1978].ch8 │ ├── Most Dangerous Game [Peter Maruhnic].ch8 │ ├── Space Invaders [David Winter] (alt).ch8 │ ├── Blinky [Hans Christian Egeberg, 1991].ch8 │ ├── Blinky [Hans Christian Egeberg] (alt).ch8 │ ├── Kaleidoscope [Joseph Weisbecker, 1978].ch8 │ ├── Pong 2 (Pong hack) [David Winter, 1997].ch8 │ ├── Programmable Spacefighters [Jef Winsor].ch8 │ ├── Russian Roulette [Carmelo Cortez, 1978].ch8 │ ├── Shooting Stars [Philip Baltzer, 1978].ch8 │ ├── Spooky Spot [Joseph Weisbecker, 1978].ch8 │ ├── Breakout (Brix hack) [David Winter, 1997].ch8 │ ├── Mastermind FourRow (Robert Lindley, 1978).ch8 │ ├── Space Intercept [Joseph Weisbecker, 1978].ch8 │ ├── Brick (Brix hack, 1990).txt │ ├── Space Invaders [David Winter].txt │ ├── Guess [David Winter].txt │ ├── Space Invaders [David Winter] (alt).txt │ ├── Guess [David Winter] (alt).txt │ ├── Russian Roulette [Carmelo Cortez, 1978].txt │ ├── 15 Puzzle [Roger Ivie].txt │ ├── Submarine [Carmelo Cortez, 1978].txt │ ├── Coin Flipping [Carmelo Cortez, 1978].txt │ ├── Blitz [David Winter].txt │ ├── Nim [Carmelo Cortez, 1978].txt │ ├── Tank.txt │ ├── Craps [Camerlo Cortez, 1978].txt │ ├── Breakout [Carmelo Cortez, 1979].txt │ ├── Pong [Paul Vervalin, 1990].txt │ ├── Breakout (Brix hack) [David Winter, 1997].txt │ ├── Space Intercept [Joseph Weisbecker, 1978].txt │ ├── Spooky Spot [Joseph Weisbecker, 1978].txt │ ├── Merlin [David Winter].txt │ ├── Hi-Lo [Jef Winsor, 1978].txt │ ├── Kaleidoscope [Joseph Weisbecker, 1978].txt │ ├── Connect 4 [David Winter].txt │ ├── Sum Fun [Joyce Weisbecker].txt │ ├── Slide [Joyce Weisbecker].txt │ ├── Hidden [David Winter, 1996].txt │ ├── Sequence Shoot [Joyce Weisbecker].txt │ ├── Rush Hour [Hap, 2006].txt │ ├── UFO [Lutz V, 1992].txt │ ├── Animal Race [Brian Astle].txt │ ├── Tetris [Fran Dachille, 1991].txt │ ├── Worm V4 [RB-Revival Studios, 2007].txt │ ├── Mastermind FourRow (Robert Lindley, 1978).txt │ ├── Astro Dodge [Revival Studios, 2008].txt │ ├── Reversi [Philip Baltzer].txt │ ├── Bowling [Gooitzen van der Wal].txt │ ├── Biorhythm [Jef Winsor].txt │ ├── Deflection [John Fort].txt │ ├── Most Dangerous Game [Peter Maruhnic].txt │ ├── Syzygy [Roy Trevino, 1990].txt │ ├── Lunar Lander [Udo Pernisz, 1979].txt │ └── Programmable Spacefighters [Jef Winsor].txt ├── programs │ ├── Fishie [Hap, 2005].txt │ ├── IBM Logo.ch8 │ ├── Chip8 Picture.ch8 │ ├── Fishie [Hap, 2005].ch8 │ ├── Keypad Test [Hap, 2006].ch8 │ ├── Life [GV Samways, 1980].ch8 │ ├── Framed MK1 [GV Samways, 1980].ch8 │ ├── Framed MK2 [GV Samways, 1980].ch8 │ ├── Chip8 emulator Logo [Garstyciuks].ch8 │ ├── Clock Program [Bill Fisher, 1981].ch8 │ ├── SQRT Test [Sergey Naydenov, 2010].ch8 │ ├── Minimal game [Revival Studios, 2007].ch8 │ ├── Division Test [Sergey Naydenov, 2010].ch8 │ ├── Delay Timer Test [Matthew Mikolay, 2010].ch8 │ ├── Jumping X and O [Harry Kleinberg, 1977].ch8 │ ├── Jumping X and O [Harry Kleinberg, 1977].txt │ ├── BMP Viewer - Hello (C8 example) [Hap, 2005].ch8 │ ├── Random Number Test [Matthew Mikolay, 2010].ch8 │ ├── Framed MK1 [GV Samways, 1980].txt │ ├── Framed MK2 [GV Samways, 1980].txt │ ├── BMP Viewer - Hello (C8 example) [Hap, 2005].txt │ ├── Keypad Test [Hap, 2006].txt │ ├── Delay Timer Test [Matthew Mikolay, 2010].txt │ ├── Clock Program [Bill Fisher, 1981].txt │ ├── Life [GV Samways, 1980].txt │ └── Random Number Test [Matthew Mikolay, 2010].txt ├── demos │ ├── Maze [David Winter, 199x].ch8 │ ├── Zero Demo [zeroZshadow, 2007].txt │ ├── Stars [Sergey Naydenov, 2010].ch8 │ ├── Zero Demo [zeroZshadow, 2007].ch8 │ ├── Maze (alt) [David Winter, 199x].ch8 │ ├── Particle Demo [zeroZshadow, 2008].ch8 │ ├── Sierpinski [Sergey Naydenov, 2010].ch8 │ ├── Sirpinski [Sergey Naydenov, 2010].ch8 │ ├── Trip8 Demo (2008) [Revival Studios].ch8 │ ├── Particle Demo [zeroZshadow, 2008].txt │ ├── Maze [David Winter, 199x].txt │ ├── Maze (alt) [David Winter, 199x].txt │ └── Trip8 Demo (2008) [Revival Studios].txt ├── hires │ ├── Hires Test [Tom Swan, 1979].ch8 │ ├── Hires Maze [David Winter, 199x].ch8 │ ├── Hires Stars [Sergey Naydenov, 2010].ch8 │ ├── Hires Particle Demo [zeroZshadow, 2008].ch8 │ ├── Astro Dodge Hires [Revival Studios, 2008].ch8 │ ├── Hires Sierpinski [Sergey Naydenov, 2010].ch8 │ ├── Hires Worm V4 [RB-Revival Studios, 2007].ch8 │ ├── Trip8 Hires Demo (2008) [Revival Studios].ch8 │ ├── Hires Particle Demo [zeroZshadow, 2008].txt │ ├── Hires Maze [David Winter, 199x].txt │ ├── !hires_information.txt │ ├── Hires Worm V4 [RB-Revival Studios, 2007].txt │ ├── Astro Dodge Hires [Revival Studios, 2008].txt │ └── Trip8 Hires Demo (2008) [Revival Studios].txt ├── README └── CHANGELOG ├── .gitignore ├── include ├── kbhit.hpp ├── Keyboard.hpp ├── GraphicEngine.hpp └── Machine.hpp ├── src ├── c8emu.cpp ├── Keyboard.cpp ├── kbhit.cpp ├── GraphicEngine.cpp └── Machine.cpp ├── Makefile ├── README.md └── LICENSE /res/sprites.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/res/sprites.bin -------------------------------------------------------------------------------- /roms/games/Cave.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Cave.ch8 -------------------------------------------------------------------------------- /roms/games/Shooting Stars [Philip Baltzer, 1978].txt: -------------------------------------------------------------------------------- 1 | Shooting Stars, by: Philip Baltzer 2 | 3 | -------------------------------------------------------------------------------- /roms/games/Tank.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Tank.ch8 -------------------------------------------------------------------------------- /roms/games/Tron.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Tron.ch8 -------------------------------------------------------------------------------- /roms/games/Filter.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Filter.ch8 -------------------------------------------------------------------------------- /roms/games/Puzzle.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Puzzle.ch8 -------------------------------------------------------------------------------- /roms/games/Soccer.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Soccer.ch8 -------------------------------------------------------------------------------- /res/Screenshots/s1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/res/Screenshots/s1.png -------------------------------------------------------------------------------- /res/Screenshots/s2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/res/Screenshots/s2.png -------------------------------------------------------------------------------- /res/Screenshots/s3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/res/Screenshots/s3.png -------------------------------------------------------------------------------- /res/Screenshots/s4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/res/Screenshots/s4.png -------------------------------------------------------------------------------- /res/Screenshots/s5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/res/Screenshots/s5.png -------------------------------------------------------------------------------- /res/Screenshots/s6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/res/Screenshots/s6.png -------------------------------------------------------------------------------- /res/Screenshots/s7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/res/Screenshots/s7.png -------------------------------------------------------------------------------- /roms/games/Airplane.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Airplane.ch8 -------------------------------------------------------------------------------- /roms/games/Figures.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Figures.ch8 -------------------------------------------------------------------------------- /roms/games/Landing.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Landing.ch8 -------------------------------------------------------------------------------- /roms/games/Paddles.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Paddles.ch8 -------------------------------------------------------------------------------- /roms/games/Timebomb.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Timebomb.ch8 -------------------------------------------------------------------------------- /roms/games/X-Mirror.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/X-Mirror.ch8 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore the build and lib dirs 2 | build 3 | lib/* 4 | 5 | # Ignore any executables 6 | bin/* 7 | -------------------------------------------------------------------------------- /roms/games/Pong (alt).ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Pong (alt).ch8 -------------------------------------------------------------------------------- /roms/programs/Fishie [Hap, 2005].txt: -------------------------------------------------------------------------------- 1 | Fishie, used as internal rom for fish n chips 2 | by hap, 10-07-05 3 | -------------------------------------------------------------------------------- /roms/programs/IBM Logo.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/programs/IBM Logo.ch8 -------------------------------------------------------------------------------- /res/Screenshots/animation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/res/Screenshots/animation.gif -------------------------------------------------------------------------------- /roms/games/Space Flight.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Space Flight.ch8 -------------------------------------------------------------------------------- /res/Screenshots/animation2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/res/Screenshots/animation2.gif -------------------------------------------------------------------------------- /roms/games/Pong (1 player).ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Pong (1 player).ch8 -------------------------------------------------------------------------------- /roms/games/Rocket Launcher.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Rocket Launcher.ch8 -------------------------------------------------------------------------------- /roms/games/Vers [JMN, 1991].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Vers [JMN, 1991].ch8 -------------------------------------------------------------------------------- /roms/programs/Chip8 Picture.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/programs/Chip8 Picture.ch8 -------------------------------------------------------------------------------- /roms/games/UFO [Lutz V, 1992].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/UFO [Lutz V, 1992].ch8 -------------------------------------------------------------------------------- /roms/games/Wall [David Winter].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Wall [David Winter].ch8 -------------------------------------------------------------------------------- /roms/games/Blitz [David Winter].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Blitz [David Winter].ch8 -------------------------------------------------------------------------------- /roms/games/Guess [David Winter].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Guess [David Winter].ch8 -------------------------------------------------------------------------------- /roms/games/Merlin [David Winter].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Merlin [David Winter].ch8 -------------------------------------------------------------------------------- /roms/games/Rush Hour [Hap, 2006].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Rush Hour [Hap, 2006].ch8 -------------------------------------------------------------------------------- /roms/games/Squash [David Winter].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Squash [David Winter].ch8 -------------------------------------------------------------------------------- /roms/games/Tapeworm [JDR, 1999].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Tapeworm [JDR, 1999].ch8 -------------------------------------------------------------------------------- /roms/programs/Fishie [Hap, 2005].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/programs/Fishie [Hap, 2005].ch8 -------------------------------------------------------------------------------- /roms/games/15 Puzzle [Roger Ivie].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/15 Puzzle [Roger Ivie].ch8 -------------------------------------------------------------------------------- /roms/games/Biorhythm [Jef Winsor].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Biorhythm [Jef Winsor].ch8 -------------------------------------------------------------------------------- /roms/games/Brick (Brix hack, 1990).ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Brick (Brix hack, 1990).ch8 -------------------------------------------------------------------------------- /roms/games/Connect 4 [David Winter].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Connect 4 [David Winter].ch8 -------------------------------------------------------------------------------- /roms/games/Deflection [John Fort].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Deflection [John Fort].ch8 -------------------------------------------------------------------------------- /roms/games/Hi-Lo [Jef Winsor, 1978].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Hi-Lo [Jef Winsor, 1978].ch8 -------------------------------------------------------------------------------- /roms/games/Missile [David Winter].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Missile [David Winter].ch8 -------------------------------------------------------------------------------- /roms/games/Reversi [Philip Baltzer].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Reversi [Philip Baltzer].ch8 -------------------------------------------------------------------------------- /roms/games/Slide [Joyce Weisbecker].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Slide [Joyce Weisbecker].ch8 -------------------------------------------------------------------------------- /roms/demos/Maze [David Winter, 199x].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/demos/Maze [David Winter, 199x].ch8 -------------------------------------------------------------------------------- /roms/demos/Zero Demo [zeroZshadow, 2007].txt: -------------------------------------------------------------------------------- 1 | This is my first program for the CHIP-8, a simple demo with 4 bouncing sprites. 2 | 3 | Enjoy! -------------------------------------------------------------------------------- /roms/games/Animal Race [Brian Astle].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Animal Race [Brian Astle].ch8 -------------------------------------------------------------------------------- /roms/games/Guess [David Winter] (alt).ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Guess [David Winter] (alt).ch8 -------------------------------------------------------------------------------- /roms/games/Nim [Carmelo Cortez, 1978].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Nim [Carmelo Cortez, 1978].ch8 -------------------------------------------------------------------------------- /roms/games/Pong [Paul Vervalin, 1990].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Pong [Paul Vervalin, 1990].ch8 -------------------------------------------------------------------------------- /roms/games/Sum Fun [Joyce Weisbecker].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Sum Fun [Joyce Weisbecker].ch8 -------------------------------------------------------------------------------- /roms/games/Syzygy [Roy Trevino, 1990].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Syzygy [Roy Trevino, 1990].ch8 -------------------------------------------------------------------------------- /roms/games/Tic-Tac-Toe [David Winter].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Tic-Tac-Toe [David Winter].ch8 -------------------------------------------------------------------------------- /roms/programs/Keypad Test [Hap, 2006].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/programs/Keypad Test [Hap, 2006].ch8 -------------------------------------------------------------------------------- /roms/programs/Life [GV Samways, 1980].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/programs/Life [GV Samways, 1980].ch8 -------------------------------------------------------------------------------- /roms/demos/Stars [Sergey Naydenov, 2010].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/demos/Stars [Sergey Naydenov, 2010].ch8 -------------------------------------------------------------------------------- /roms/demos/Zero Demo [zeroZshadow, 2007].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/demos/Zero Demo [zeroZshadow, 2007].ch8 -------------------------------------------------------------------------------- /roms/games/15 Puzzle [Roger Ivie] (alt).ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/15 Puzzle [Roger Ivie] (alt).ch8 -------------------------------------------------------------------------------- /roms/games/Craps [Camerlo Cortez, 1978].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Craps [Camerlo Cortez, 1978].ch8 -------------------------------------------------------------------------------- /roms/games/Hidden [David Winter, 1996].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Hidden [David Winter, 1996].ch8 -------------------------------------------------------------------------------- /roms/games/Rush Hour [Hap, 2006] (alt).ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Rush Hour [Hap, 2006] (alt).ch8 -------------------------------------------------------------------------------- /roms/games/Space Invaders [David Winter].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Space Invaders [David Winter].ch8 -------------------------------------------------------------------------------- /roms/games/Tetris [Fran Dachille, 1991].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Tetris [Fran Dachille, 1991].ch8 -------------------------------------------------------------------------------- /roms/games/Wipe Off [Joseph Weisbecker].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Wipe Off [Joseph Weisbecker].ch8 -------------------------------------------------------------------------------- /roms/games/ZeroPong [zeroZshadow, 2007].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/ZeroPong [zeroZshadow, 2007].ch8 -------------------------------------------------------------------------------- /roms/hires/Hires Test [Tom Swan, 1979].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/hires/Hires Test [Tom Swan, 1979].ch8 -------------------------------------------------------------------------------- /roms/demos/Maze (alt) [David Winter, 199x].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/demos/Maze (alt) [David Winter, 199x].ch8 -------------------------------------------------------------------------------- /roms/games/Bowling [Gooitzen van der Wal].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Bowling [Gooitzen van der Wal].ch8 -------------------------------------------------------------------------------- /roms/games/Breakout [Carmelo Cortez, 1979].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Breakout [Carmelo Cortez, 1979].ch8 -------------------------------------------------------------------------------- /roms/games/Brix [Andreas Gustafsson, 1990].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Brix [Andreas Gustafsson, 1990].ch8 -------------------------------------------------------------------------------- /roms/games/Rocket Launch [Jonas Lindstedt].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Rocket Launch [Jonas Lindstedt].ch8 -------------------------------------------------------------------------------- /roms/hires/Hires Maze [David Winter, 199x].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/hires/Hires Maze [David Winter, 199x].ch8 -------------------------------------------------------------------------------- /roms/demos/Particle Demo [zeroZshadow, 2008].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/demos/Particle Demo [zeroZshadow, 2008].ch8 -------------------------------------------------------------------------------- /roms/demos/Sierpinski [Sergey Naydenov, 2010].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/demos/Sierpinski [Sergey Naydenov, 2010].ch8 -------------------------------------------------------------------------------- /roms/demos/Sirpinski [Sergey Naydenov, 2010].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/demos/Sirpinski [Sergey Naydenov, 2010].ch8 -------------------------------------------------------------------------------- /roms/games/Addition Problems [Paul C. Moews].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Addition Problems [Paul C. Moews].ch8 -------------------------------------------------------------------------------- /roms/games/Lunar Lander (Udo Pernisz, 1979).ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Lunar Lander (Udo Pernisz, 1979).ch8 -------------------------------------------------------------------------------- /roms/games/Rocket [Joseph Weisbecker, 1978].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Rocket [Joseph Weisbecker, 1978].ch8 -------------------------------------------------------------------------------- /roms/games/Sequence Shoot [Joyce Weisbecker].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Sequence Shoot [Joyce Weisbecker].ch8 -------------------------------------------------------------------------------- /roms/games/Submarine [Carmelo Cortez, 1978].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Submarine [Carmelo Cortez, 1978].ch8 -------------------------------------------------------------------------------- /roms/games/Vertical Brix [Paul Robson, 1996].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Vertical Brix [Paul Robson, 1996].ch8 -------------------------------------------------------------------------------- /roms/games/Worm V4 [RB-Revival Studios, 2007].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Worm V4 [RB-Revival Studios, 2007].ch8 -------------------------------------------------------------------------------- /roms/programs/Framed MK1 [GV Samways, 1980].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/programs/Framed MK1 [GV Samways, 1980].ch8 -------------------------------------------------------------------------------- /roms/programs/Framed MK2 [GV Samways, 1980].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/programs/Framed MK2 [GV Samways, 1980].ch8 -------------------------------------------------------------------------------- /roms/demos/Trip8 Demo (2008) [Revival Studios].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/demos/Trip8 Demo (2008) [Revival Studios].ch8 -------------------------------------------------------------------------------- /roms/games/Astro Dodge [Revival Studios, 2008].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Astro Dodge [Revival Studios, 2008].ch8 -------------------------------------------------------------------------------- /roms/games/Coin Flipping [Carmelo Cortez, 1978].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Coin Flipping [Carmelo Cortez, 1978].ch8 -------------------------------------------------------------------------------- /roms/games/Most Dangerous Game [Peter Maruhnic].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Most Dangerous Game [Peter Maruhnic].ch8 -------------------------------------------------------------------------------- /roms/games/Space Invaders [David Winter] (alt).ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Space Invaders [David Winter] (alt).ch8 -------------------------------------------------------------------------------- /roms/hires/Hires Stars [Sergey Naydenov, 2010].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/hires/Hires Stars [Sergey Naydenov, 2010].ch8 -------------------------------------------------------------------------------- /roms/programs/Chip8 emulator Logo [Garstyciuks].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/programs/Chip8 emulator Logo [Garstyciuks].ch8 -------------------------------------------------------------------------------- /roms/programs/Clock Program [Bill Fisher, 1981].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/programs/Clock Program [Bill Fisher, 1981].ch8 -------------------------------------------------------------------------------- /roms/programs/SQRT Test [Sergey Naydenov, 2010].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/programs/SQRT Test [Sergey Naydenov, 2010].ch8 -------------------------------------------------------------------------------- /roms/games/Blinky [Hans Christian Egeberg, 1991].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Blinky [Hans Christian Egeberg, 1991].ch8 -------------------------------------------------------------------------------- /roms/games/Blinky [Hans Christian Egeberg] (alt).ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Blinky [Hans Christian Egeberg] (alt).ch8 -------------------------------------------------------------------------------- /roms/games/Kaleidoscope [Joseph Weisbecker, 1978].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Kaleidoscope [Joseph Weisbecker, 1978].ch8 -------------------------------------------------------------------------------- /roms/games/Pong 2 (Pong hack) [David Winter, 1997].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Pong 2 (Pong hack) [David Winter, 1997].ch8 -------------------------------------------------------------------------------- /roms/games/Programmable Spacefighters [Jef Winsor].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Programmable Spacefighters [Jef Winsor].ch8 -------------------------------------------------------------------------------- /roms/games/Russian Roulette [Carmelo Cortez, 1978].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Russian Roulette [Carmelo Cortez, 1978].ch8 -------------------------------------------------------------------------------- /roms/games/Shooting Stars [Philip Baltzer, 1978].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Shooting Stars [Philip Baltzer, 1978].ch8 -------------------------------------------------------------------------------- /roms/games/Spooky Spot [Joseph Weisbecker, 1978].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Spooky Spot [Joseph Weisbecker, 1978].ch8 -------------------------------------------------------------------------------- /roms/hires/Hires Particle Demo [zeroZshadow, 2008].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/hires/Hires Particle Demo [zeroZshadow, 2008].ch8 -------------------------------------------------------------------------------- /roms/programs/Minimal game [Revival Studios, 2007].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/programs/Minimal game [Revival Studios, 2007].ch8 -------------------------------------------------------------------------------- /roms/games/Breakout (Brix hack) [David Winter, 1997].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Breakout (Brix hack) [David Winter, 1997].ch8 -------------------------------------------------------------------------------- /roms/games/Mastermind FourRow (Robert Lindley, 1978).ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Mastermind FourRow (Robert Lindley, 1978).ch8 -------------------------------------------------------------------------------- /roms/games/Space Intercept [Joseph Weisbecker, 1978].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/games/Space Intercept [Joseph Weisbecker, 1978].ch8 -------------------------------------------------------------------------------- /roms/hires/Astro Dodge Hires [Revival Studios, 2008].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/hires/Astro Dodge Hires [Revival Studios, 2008].ch8 -------------------------------------------------------------------------------- /roms/hires/Hires Sierpinski [Sergey Naydenov, 2010].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/hires/Hires Sierpinski [Sergey Naydenov, 2010].ch8 -------------------------------------------------------------------------------- /roms/hires/Hires Worm V4 [RB-Revival Studios, 2007].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/hires/Hires Worm V4 [RB-Revival Studios, 2007].ch8 -------------------------------------------------------------------------------- /roms/hires/Trip8 Hires Demo (2008) [Revival Studios].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/hires/Trip8 Hires Demo (2008) [Revival Studios].ch8 -------------------------------------------------------------------------------- /roms/programs/Division Test [Sergey Naydenov, 2010].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/programs/Division Test [Sergey Naydenov, 2010].ch8 -------------------------------------------------------------------------------- /roms/programs/Delay Timer Test [Matthew Mikolay, 2010].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/programs/Delay Timer Test [Matthew Mikolay, 2010].ch8 -------------------------------------------------------------------------------- /roms/programs/Jumping X and O [Harry Kleinberg, 1977].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/programs/Jumping X and O [Harry Kleinberg, 1977].ch8 -------------------------------------------------------------------------------- /roms/programs/Jumping X and O [Harry Kleinberg, 1977].txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/programs/Jumping X and O [Harry Kleinberg, 1977].txt -------------------------------------------------------------------------------- /roms/games/Brick (Brix hack, 1990).txt: -------------------------------------------------------------------------------- 1 | BRICK: a modified version of BRIX, a CHIP-8 game. 2 | Original BRIX by Andreas Gustafsson. 3 | This one is a solid wall; no air between bricks! -------------------------------------------------------------------------------- /roms/programs/BMP Viewer - Hello (C8 example) [Hap, 2005].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/programs/BMP Viewer - Hello (C8 example) [Hap, 2005].ch8 -------------------------------------------------------------------------------- /roms/programs/Random Number Test [Matthew Mikolay, 2010].ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LakshyAAAgrawal/chip8emu/HEAD/roms/programs/Random Number Test [Matthew Mikolay, 2010].ch8 -------------------------------------------------------------------------------- /roms/demos/Particle Demo [zeroZshadow, 2008].txt: -------------------------------------------------------------------------------- 1 | This is my particledemo for the Chip-8, SuperChip and MegaChip8. 2 | Works on real hardware as well as emulators 3 | 4 | Enjoy! 5 | 6 | zeroZshadow -------------------------------------------------------------------------------- /roms/programs/Framed MK1 [GV Samways, 1980].txt: -------------------------------------------------------------------------------- 1 | Framed MK1, By: G.V. Samways, 1980 2 | 3 | This program displays a random movement of dots. You will notice a repetition in the pattern 4 | after a time. 5 | -------------------------------------------------------------------------------- /roms/programs/Framed MK2 [GV Samways, 1980].txt: -------------------------------------------------------------------------------- 1 | Framed MK2, By: G.V. Samways, 1980 2 | 3 | This program displays a random movement of lines. You will notice a repetition in the pattern 4 | after a time. 5 | -------------------------------------------------------------------------------- /roms/games/Space Invaders [David Winter].txt: -------------------------------------------------------------------------------- 1 | Space Invaders, by: David Winter 2 | 3 | The well known game. Destroy the invaders with your ship. Shoot 4 | with 5, move with 4 and 6. Press 5 to begin a game. 5 | 6 | -------------------------------------------------------------------------------- /roms/games/Guess [David Winter].txt: -------------------------------------------------------------------------------- 1 | Think to a number between 1 and 63. CHIP8 shows you several boards and you have to tell if you see your number in them. Press 5 if so, or another key if not. CHIP8 gives you the number... 2 | -------------------------------------------------------------------------------- /roms/games/Space Invaders [David Winter] (alt).txt: -------------------------------------------------------------------------------- 1 | Space Invaders, by: David Winter 2 | 3 | The well known game. Destroy the invaders with your ship. Shoot 4 | with 5, move with 4 and 6. Press 5 to begin a game. 5 | 6 | -------------------------------------------------------------------------------- /roms/hires/Hires Particle Demo [zeroZshadow, 2008].txt: -------------------------------------------------------------------------------- 1 | This is my particledemo for the Chip-8, Hires Chip-8 (64x64), SuperChip and MegaChip8. 2 | Works on real hardware as well as emulators 3 | 4 | Enjoy! 5 | 6 | zeroZshadow -------------------------------------------------------------------------------- /roms/games/Guess [David Winter] (alt).txt: -------------------------------------------------------------------------------- 1 | Think to a number between 1 and 63. CHIP8 shows you several boards and you have to tell if you see your number in them. Press 5 if so, or another key if not. CHIP8 gives you the number... 2 | -------------------------------------------------------------------------------- /roms/programs/BMP Viewer - Hello (C8 example) [Hap, 2005].txt: -------------------------------------------------------------------------------- 1 | BMP Viewer, 02-06-05, by hap 2 | works with monochrome BMPs only, of course. put the BMP data (headerless) at 3 | offset $30. change offset $0 (200) $00ff to $1202 for Chip-8. -------------------------------------------------------------------------------- /roms/games/Russian Roulette [Carmelo Cortez, 1978].txt: -------------------------------------------------------------------------------- 1 | Russian Roulette , by: Carmelo Cortez 2 | 3 | This game is called Russian RouLette. Press any key to Spin and pull the Trigger. 4 | A "Click" or "Bang" will show, get ten "clicks" in a row and you win. -------------------------------------------------------------------------------- /roms/games/15 Puzzle [Roger Ivie].txt: -------------------------------------------------------------------------------- 1 | Same than PUZZLE2. Wait for randomization... Instead of moving the item by pressing his associated key, move it UP DOWN LEFT RIGHT with respectively 2 8 4 6. Up and Down are inverted as the game uses the original CHIP8 keyboard. -------------------------------------------------------------------------------- /roms/games/Submarine [Carmelo Cortez, 1978].txt: -------------------------------------------------------------------------------- 1 | Submarine, by: Carmelo Cortez 2 | 3 | The Sub Game is my favorlte. Press "5" key to fire depth charges at the subs below. 4 | You score 15 points for a small sub and 5 points for the larger. You get 25 depth charges to start. -------------------------------------------------------------------------------- /roms/games/Coin Flipping [Carmelo Cortez, 1978].txt: -------------------------------------------------------------------------------- 1 | Coin Flipping, by: Carmelo Cortez 2 | 3 | The game is a Coin FlLpping program. Flip run up and the 4 | computer starts to flip a coin, and at the same tine shosing heads 5 | and tails on the screen, stopping at the value set in VC. 6 | -------------------------------------------------------------------------------- /roms/games/Blitz [David Winter].txt: -------------------------------------------------------------------------------- 1 | Blitz, by: David Winter 2 | 3 | This game is a BOMBER clone. You are in a plane, and you must destroy the towers of a town. Your plane is flying left to right, and goes down. Use 5 to drop a bomb. The game ends when you crash yourself on a tower... 4 | 5 | -------------------------------------------------------------------------------- /roms/games/Nim [Carmelo Cortez, 1978].txt: -------------------------------------------------------------------------------- 1 | Nim, by: Carmelo Cortez 2 | 3 | The Nim Game is a little less graphic than most games. The player may go first by pressing. "F" key, any other let the computer go first. 4 | You subtract 1, 2 or 3 fron the score. The one who ends up with the last number loses! -------------------------------------------------------------------------------- /roms/games/Tank.txt: -------------------------------------------------------------------------------- 1 | You are in a tank which has 25 bombs. Your goal is to hit 25 times a mobile target. The game ends when all your bombs are shot. If your tank hits the target, you lose 5 bombs. Use 2 4 6 and 8 to move. This game uses the original CHIP8 keyboard, so directions 2 and 8 are swapped. 2 | -------------------------------------------------------------------------------- /roms/games/Craps [Camerlo Cortez, 1978].txt: -------------------------------------------------------------------------------- 1 | Craps, by: Camerlo Cortez 2 | 3 | To use the Craps program, press any key to roll dice. 4 | 7 or 11 wins, 12, 2 or 3 loses on first roll. The second roll must match the first to win, but if you roll a seven you lose. This program could be expanded to include on-the-screen scoring of bets. 5 | -------------------------------------------------------------------------------- /roms/programs/Keypad Test [Hap, 2006].txt: -------------------------------------------------------------------------------- 1 | Keypad Test, by hap, 15-02-06 2 | 3 | press a chip8 key and the pressed char will light up 4 | if you want to do something funny, soft-reset the chip8/emulator over and over, 5 | and the sprite layout will become messed up ;p 6 | 7 | chip8 keypad: 8 | 1 2 3 c 9 | 4 5 6 d 10 | 7 8 9 e 11 | a 0 b f 12 | 13 | -------------------------------------------------------------------------------- /roms/games/Breakout [Carmelo Cortez, 1979].txt: -------------------------------------------------------------------------------- 1 | Breakout, by: Carmelo Cortez 2 | 3 | The game, Breakout, is a variation of the Wipe-Off game. 4 | You have six walls and 20 balls to start. To win you must get through all walls to the top of the screen. At the end of the game the program will show the number of times you hit the walls and will show "FREE!" if you get through. -------------------------------------------------------------------------------- /roms/games/Pong [Paul Vervalin, 1990].txt: -------------------------------------------------------------------------------- 1 | OK. here is PONG version 1.1. The ball is a little faster in this 2 | version making play a little more realistic. I know PONG 1.0 was 3 | just posted yesterday, but I think this version is significantly 4 | better, so here it is. 5 | 6 | Use keys 7 and 4 move left player and / and * move right player. 7 | 8 | Enjoy!! 9 | 10 | -------------------------------------------------------------------------------- /roms/games/Breakout (Brix hack) [David Winter, 1997].txt: -------------------------------------------------------------------------------- 1 | Breakout (Brix hack), by: David Winter 2 | 3 | This game is an "arkanoid" precursor. You have 5 lives, and your goal is the destruction of all the brixs. Use 4 and 6 to move your paddle. The game ends when all the brixs are destroyed. 4 | 5 | This game is the same than BRIX, but has graphics looking like the game on the Atari 2600 console. 6 | 7 | -------------------------------------------------------------------------------- /roms/games/Space Intercept [Joseph Weisbecker, 1978].txt: -------------------------------------------------------------------------------- 1 | Space Intercept, by Joseph Weisbecker 2 | 3 | At startup, Press 1 to select the large UFO whichh counts 5 points when hit or 2 to select the small UFO which counts 15 points when hit. 4 | Launch your rocket by pressing key 4,5 or 6. You get 15 rockets as shown in the lower right corner of the screen. Your score is shown in the lower left corner of the screen. 5 | -------------------------------------------------------------------------------- /include/kbhit.hpp: -------------------------------------------------------------------------------- 1 | // From http://linux-sxs.org/programming/kbhit.html 2 | 3 | #ifndef KBHITh 4 | #define KBHITh 5 | 6 | #include 7 | 8 | class keyboard{ 9 | public: 10 | 11 | keyboard(); 12 | ~keyboard(); 13 | int kbhit(); 14 | int getch(); 15 | 16 | private: 17 | 18 | struct termios initial_settings, new_settings; 19 | int peek_character; 20 | 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /include/Keyboard.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "../include/kbhit.hpp" 3 | #include 4 | #include 5 | 6 | class Keyboard{ 7 | private: 8 | keyboard kb; 9 | std::vector pressed_keys; 10 | std::map key_map; 11 | public: 12 | Keyboard(); 13 | bool update_pressed_keys(); // Returns true if there is an interrupt 14 | bool isKeyDown(uint8_t key); 15 | uint8_t waitAndGetKeypress(); 16 | }; 17 | -------------------------------------------------------------------------------- /roms/programs/Delay Timer Test [Matthew Mikolay, 2010].txt: -------------------------------------------------------------------------------- 1 | Hey guys! 2 | 3 | Here's another little program I wrote to test out a feature in my game. This 4 | program allows the user to change the value of the V3 register using the 2 and 8 5 | keys. When the 5 key is pressed, the delay timer starts counting down from the 6 | value the user placed into the V3 register, and the screen is updated as the 7 | value changes. 8 | 9 | -Matt -------------------------------------------------------------------------------- /roms/games/Spooky Spot [Joseph Weisbecker, 1978].txt: -------------------------------------------------------------------------------- 1 | Spooky Spot, by: Joseph Weisbecker 2 | 3 | Now you can let the computer make your big decisions or predict the future just like governmentt or industry leaders do. 4 | You will see the words YES and NO at the right of the screen. Ask the computer any question that can be answered with YES or NO. Press KEY 0 and the spooky spot will show you the computer's answer. This program replaces your old fashioned mechanical OUIJA board. 5 | -------------------------------------------------------------------------------- /roms/games/Merlin [David Winter].txt: -------------------------------------------------------------------------------- 1 | Merlin, by: David Winter 2 | 3 | This is the SIMON game. The goal is to remember in which order the squares are lighted. The game begins by lighting 4 random squares, and then asks you to light the squares in the correct order. 4 | You win a level when you give the exact order, and each increasing level shows a additionnal square. The game ends when you light an incorrect square. Keys are 4 and 5 for the two upper squares, then 1 and 2 for the two other ones. 5 | -------------------------------------------------------------------------------- /include/GraphicEngine.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | class GraphicEngine{ 8 | private: 9 | std::array, 32> fb; 10 | std::string screen_as_string(); 11 | bool dirty; 12 | public: 13 | GraphicEngine(); 14 | void cls(); 15 | uint8_t draw_sprite(std::vector::iterator start, std::vector::iterator end, uint8_t x, uint8_t y); 16 | void update_display(); 17 | bool is_dirty(); 18 | }; 19 | -------------------------------------------------------------------------------- /roms/games/Hi-Lo [Jef Winsor, 1978].txt: -------------------------------------------------------------------------------- 1 | Hi-Lo, by: Jef Winsor 2 | 3 | You have 10 chances to guess the value of a random number between 00 and 99 selected by the program. The number at the right of the screen shows the number of the guess you are using. Enter a two digit number and the computer tells you if you are high or low. Press any key to erase this number and then, try again. If you have failed after ten guesses, press any key and the number will be shown. If you are good you will never need more than seven guesses. 4 | -------------------------------------------------------------------------------- /roms/programs/Clock Program [Bill Fisher, 1981].txt: -------------------------------------------------------------------------------- 1 | This neat little clock program is the perfect program to run when someone asks: 2 | "That's nice, but what can your computer DO?" 3 | The program features "reverse" video numerals on the screen, which is a nice change from the 4 | usual white numbers on a black background. 5 | 6 | Instructions: 7 | - Type six digits on the hex keypad for the desired clock starting time, using 23 hour format (ex.173055) 8 | - Hit any hex key to start clock running at the above time setting. 9 | -------------------------------------------------------------------------------- /roms/games/Kaleidoscope [Joseph Weisbecker, 1978].txt: -------------------------------------------------------------------------------- 1 | VIP Kaleidoscope, by: Joseph Weisbecker 2 | 3 | Four spots appear in a group at the center of the screen. Press keys 2, 4, 6, or 8 to create a pattern. Keep your pattern smaller than 138 key depressions. 4 | 5 | Push key 0 to terminate pattern entry. Pushing key 0 causes your pattern to be continuously repeated forming a fascinating, changing kaleidoscope display on the screen. A "44444442220" key sequence provides a very nice effect Experiment to 6 | find other nice patterns. 7 | 8 | -------------------------------------------------------------------------------- /roms/games/Connect 4 [David Winter].txt: -------------------------------------------------------------------------------- 1 | Connect 4, by: David Winter 2 | 3 | This game is for two players. The goal is to align 4 coins in the 4 | game area. Each player's coins are colored. When you drop a coin, 5 | it is paced on the latest dropped coin in the same column, or at 6 | the bottom if the column is empty. Once the column is full, you 7 | cannot place any more coins in it. To select a column, use 4 and 6. 8 | 9 | To drop a coin, use 5. There is no winner detection yet. This will 10 | be soon avalaible (Hey! I don't spend my life on CHIP8 !). 11 | -------------------------------------------------------------------------------- /roms/programs/Life [GV Samways, 1980].txt: -------------------------------------------------------------------------------- 1 | Life, by: G.V. Samways 2 | 3 | This is a display of cell growth, in accordance with the following rules: 4 | 1. A cell is born if 3 cells are adjecent to an empty space. 5 | 2. A cell lives if 2 or 3 cells are adjacent, and dies otherwise. 6 | 3. All events take place simultaneously. 7 | 8 | To start the game, you make a pattern by entering the cell coordinates, first 9 | the "Y"from 0-7 downwards, then the "X" from 0-F across. 10 | F initialises the program, and the number of scans is entered plus one, so that 1 gives 0 scans 11 | to F giving 14, and 0 giving 255. The sit back and watch the colony live, or die. 12 | -------------------------------------------------------------------------------- /roms/demos/Maze [David Winter, 199x].txt: -------------------------------------------------------------------------------- 1 | Maze, by David Winter 2 | 3 | Drawing a random maze like this one consists in drawing random diagonal 4 | lines. There are two possibilities: right-to-left line, and left-to-right 5 | line. Each line is composed of a 4*4 bitmap. As the lines must form non- 6 | circular angles, the two bitmaps won't be '/' and '\'. The first one 7 | (right line) will be a little bit modified. See at the end of this source. 8 | 9 | The maze is composed of 16 lines (as the bitmaps are 4 pixels high), each 10 | line consists of 32 bitmaps. 11 | Bitmaps are drawn in random mode. We choose a random value (0 or 1). 12 | If it is 1, we draw a left line bitmap. If it is 0, we draw a right one. 13 | -------------------------------------------------------------------------------- /roms/demos/Maze (alt) [David Winter, 199x].txt: -------------------------------------------------------------------------------- 1 | Maze, by David Winter 2 | 3 | Drawing a random maze like this one consists in drawing random diagonal 4 | lines. There are two possibilities: right-to-left line, and left-to-right 5 | line. Each line is composed of a 4*4 bitmap. As the lines must form non- 6 | circular angles, the two bitmaps won't be '/' and '\'. The first one 7 | (right line) will be a little bit modified. See at the end of this source. 8 | 9 | The maze is composed of 16 lines (as the bitmaps are 4 pixels high), each 10 | line consists of 32 bitmaps. 11 | Bitmaps are drawn in random mode. We choose a random value (0 or 1). 12 | If it is 1, we draw a left line bitmap. If it is 0, we draw a right one. 13 | -------------------------------------------------------------------------------- /roms/hires/Hires Maze [David Winter, 199x].txt: -------------------------------------------------------------------------------- 1 | Maze, by David Winter 2 | 3 | Drawing a random maze like this one consists in drawing random diagonal 4 | lines. There are two possibilities: right-to-left line, and left-to-right 5 | line. Each line is composed of a 4*4 bitmap. As the lines must form non- 6 | circular angles, the two bitmaps won't be '/' and '\'. The first one 7 | (right line) will be a little bit modified. See at the end of this source. 8 | 9 | The maze is composed of 16 lines (as the bitmaps are 4 pixels high), each 10 | line consists of 32 bitmaps. 11 | Bitmaps are drawn in random mode. We choose a random value (0 or 1). 12 | If it is 1, we draw a left line bitmap. If it is 0, we draw a right one. 13 | -------------------------------------------------------------------------------- /roms/hires/!hires_information.txt: -------------------------------------------------------------------------------- 1 | Roms for the original VIP 2-page hires CHIP8 mode (64x64). 2 | These roms will work on original machines such as Cosmac Vip and Telmac 1800 without hardware modification. 3 | 4 | Emulator programmers can easily support these roms by adding something like the following in front of the opcode handling routine: 5 | 6 | if ((chip_programcounter==0x200) && (opcode==0x1260)) { 7 | // Init 64x64 hires mode 8 | chip_screenwidth=64;chip_screenheight=64; 9 | opcode=0x12C0; // Make the interperter jump to address 0x2c0 10 | } 11 | 12 | Additionally, you will need to catch opcode 0x0230 and handle the clearscreen event for 64x64 hires 13 | 14 | Kind regards, 15 | 16 | Revival Studios -------------------------------------------------------------------------------- /roms/programs/Random Number Test [Matthew Mikolay, 2010].txt: -------------------------------------------------------------------------------- 1 | Hey guys! 2 | 3 | I don't know if any of you will be interested in this, but I wrote this small 4 | program while coding my game to test out the random number generator. I wanted 5 | to see if there is a chance that zero will show up as the random number, and it 6 | turns out it can. 7 | 8 | Anyway, when you run the program, it brings a random number up on the screen. 9 | When you press any of the keys, it brings another random number up on the 10 | screen. This goes on until you quit the program. 11 | 12 | Address 0x202 holds the C0FF instruction, which commands the CHIP-8 interpreter 13 | to set V0 to a random number with the mask 0xFF. This yields 256 different 14 | possible numbers (0-255). If C0FF is changed to something like C00A, then the 15 | mask will change. This would yield 11 different possible numbers (0-10). 16 | 17 | -Matt -------------------------------------------------------------------------------- /roms/games/Sum Fun [Joyce Weisbecker].txt: -------------------------------------------------------------------------------- 1 | 11. VIP Sum Fun 2 | 3 | The object of this game is to add up the three digits 4 | which appear in the middle of the screen and then hit 5 | the key representing the total as fast as you can. 6 | 7 | How to Play VIP Sum FUn 8 | 9 | 1. Load the CHIP-8 interpreter at 0000-01FF and 10 | the game starting at 0200. 11 | 12 | 2. Turn RUN switch on. 13 | 14 | 3. You get twenty sets of three digits per game and 15 | between zero and ten points per set. The faster you 16 | enter the correct total, the more points you win. 17 | 18 | 4. If you wait more that 3 seconds, you get zero points. 19 | The correct sum is shown above the three digits after 20 | you enter it, and there is a pause before the next 21 | set appears. 22 | 23 | 5. The score is shown in the upper right-hand corner of 24 | the screen. The maximum number of points you can score 25 | is 200. Between 120 and 159 points is above average. 26 | A score of 160 or higher is outstanding. 27 | 28 | -------------------------------------------------------------------------------- /roms/games/Slide [Joyce Weisbecker].txt: -------------------------------------------------------------------------------- 1 | 5. VIP SLIDE 2 | 3 | Slide is a two-person game. Each player tries to slide a "puck" over the high-scoring 4 | "spots" without hitting the back wall. 5 | 6 | How To Play VIP Slide 7 | 8 | 1. Load the CHIP-8 interpretor at 0000-01FF 9 | and the game starting at 0200. 10 | 11 | 2. Turn RUN switch on. 12 | 13 | 3. The puck moves up and down randomly. Press "0" key to stop the puck. The puck 14 | will move towards the spots after you release the key. The longer you hold the 15 | key down, the further the puck travels (maximum time approximately 2.5 seconds). 16 | 17 | 4. You get 2 points for hitting the first spot, 4 points for either of the next two 18 | spots and 8 points for either of the last two. The highest score possible is 216 19 | (two spots can be hit on one slide). 20 | 21 | 5. If you hit the back wall, though, you get zero points for that slide, even though 22 | you've hit a spot. 23 | 24 | 6. Each player gets 3 pucks per turn and 6 turns in a game. 25 | -------------------------------------------------------------------------------- /src/c8emu.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/Machine.hpp" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | void loadFile(const std::string& filename, std::vector& prog){ 10 | // From https://stackoverflow.com/questions/5420317/reading-and-writing-binary-file 11 | std::ifstream input(filename, std::ios::binary); 12 | for(char c: std::vector(std::istreambuf_iterator(input), {})){ 13 | prog.push_back(c); 14 | } 15 | } 16 | 17 | int main(int argc, char ** argv){ 18 | Machine machine; 19 | 20 | { // Create block to deallocate the possibly large variable prog 21 | // Load Instructions 22 | std::vector prog; 23 | loadFile(argv[1], prog); 24 | machine.setInst(prog, 0x200); 25 | 26 | prog.clear(); 27 | 28 | // Load Sprites 29 | loadFile("res/sprites.bin", prog); 30 | machine.setInst(prog, 0x000); 31 | } 32 | 33 | // Begin instruction fetch-execute-increment cycle 34 | machine.runLoop(); 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /roms/games/Hidden [David Winter, 1996].txt: -------------------------------------------------------------------------------- 1 | ---------------------------------------- 2 | HIDDEN! 3 | Copyright (1996) by David WINTER 4 | ---------------------------------------- 5 | 6 | 7 | HIDDEN is a "memory" game. It is very simple to play. 8 | 9 | The rules are as follow: your goal is to find all the identical cards 10 | in a minimum time. 11 | 12 | You are playing in a 4*4 card grid. You can see only two cards at the 13 | same time. Once this time passed, these two cards will remain shown 14 | if they are identical, otherwise they will be hidden again. 15 | 16 | When the game is finished, two scores are shown: 17 | SC is your score, corresponding to the number of tries 18 | HI is the best score (smallest number of tries made to finish) 19 | 20 | The keys are: 21 | 22 | [2] : More DOWN 23 | [4] : Move LEFT 24 | [5] : Show card 25 | [6] : Move RIGHT 26 | [8] : Move UP 27 | 28 | Enjoy !!! 29 | -------------------------------------------------------------------------------- /res/sprite_map: -------------------------------------------------------------------------------- 1 | 0 2 | 0xF0 3 | 0x90 4 | 0x90 5 | 0x90 6 | 0xF0 7 | 8 | 1 9 | 0x20 10 | 0x60 11 | 0x20 12 | 0x20 13 | 0x70 14 | 15 | 2 16 | 0xF0 17 | 0x10 18 | 0xF0 19 | 0x80 20 | 0xF0 21 | 22 | 3 23 | 0xF0 24 | 0x10 25 | 0xF0 26 | 0x10 27 | 0xF0 28 | 29 | 4 30 | 0x90 31 | 0x90 32 | 0xF0 33 | 0x10 34 | 0x10 35 | 36 | 5 37 | 0xF0 38 | 0x80 39 | 0xF0 40 | 0x10 41 | 0xF0 42 | 43 | 6 44 | 0xF0 45 | 0x80 46 | 0xF0 47 | 0x90 48 | 0xF0 49 | 50 | 7 51 | 0xF0 52 | 0x10 53 | 0x20 54 | 0x40 55 | 0x40 56 | 57 | 8 58 | 0xF0 59 | 0x90 60 | 0xF0 61 | 0x90 62 | 0xF0 63 | 64 | 9 65 | 0xF0 66 | 0x90 67 | 0xF0 68 | 0x10 69 | 0xF0 70 | 71 | A 72 | 0xF0 73 | 0x90 74 | 0xF0 75 | 0x90 76 | 0x90 77 | 78 | B 79 | 0xE0 80 | 0x90 81 | 0xE0 82 | 0x90 83 | 0xE0 84 | 85 | C 86 | 0xF0 87 | 0x80 88 | 0x80 89 | 0x80 90 | 0xF0 91 | 92 | D 93 | 0xE0 94 | 0x90 95 | 0x90 96 | 0x90 97 | 0xE0 98 | 99 | E 100 | 0xF0 101 | 0x80 102 | 0xF0 103 | 0x80 104 | 0xF0 105 | 106 | F 107 | 0xF0 108 | 0x80 109 | 0xF0 110 | 0x80 111 | 0x80 -------------------------------------------------------------------------------- /roms/games/Sequence Shoot [Joyce Weisbecker].txt: -------------------------------------------------------------------------------- 1 | 12. VIP Sequence Shoot 2 | 3 | You score points by having the sharp-shooter hit the targets in the proper sequence. 4 | 5 | How to Play VIP Sequence Shoot 6 | 7 | 1. Load the CHIP-8 interpreter at 0000-01FF and 8 | the game starting at 0200. 9 | 10 | 2. Turn RUN switch on. 11 | 12 | 3. Pressing the Key C causes the little man to shoot the top target, Key D shoots the 13 | one below it, Key E the next lower and Key F the bottom target. 14 | 15 | 4. One of the four targets flashes and the computer waits for you to shoot it. When 16 | you press teh correct key, you get one point. Then two flash, on after the other. 17 | Shoot the one that flashed first, then shoot the other. This gives you two more 18 | points. Three targets (when hit in the same order as they flashed) add three 19 | points to your score. 20 | 21 | 5. Each time you shoot such a series of targets in proper sequence, your score 22 | increases by the number of targets you hit. An the next series you see is longer 23 | by one target. The maximum length of sequence is 22 targets, that is a score of 254. 24 | 25 | 6. Improper sequencing of shots in any series ends the game. -------------------------------------------------------------------------------- /include/Machine.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "../include/GraphicEngine.hpp" 8 | #include "../include/Keyboard.hpp" 9 | 10 | class ProgramLargerThanMemoryException: public std::exception { 11 | virtual const char* what() const throw(){ 12 | return "The passed program is larger than the memory"; 13 | } 14 | }; 15 | 16 | class Machine{ 17 | private: 18 | std::vector registers; // V0-VF 19 | std::vector memory; // Memory 20 | uint16_t I; // Index register 21 | std::vector stack; // Stack 22 | uint8_t SP; // Stack Pointer 23 | uint8_t DT; // Delay Timer 24 | uint8_t ST; // Sound Timer 25 | GraphicEngine ge; // Holds Graphics and frame buffer 26 | Keyboard kb; // presents Keyboard related functions 27 | uint16_t PC; // Program Counter 28 | std::chrono::steady_clock::time_point last_tick; 29 | 30 | // Methods 31 | void execute(uint16_t& opcode); 32 | uint8_t random_byte(); 33 | void print_machine_state(); 34 | void update_timers(const std::chrono::steady_clock::time_point& now); 35 | public: 36 | Machine(); 37 | void setInst(std::vector& prog, uint16_t start_addr); 38 | void runLoop(); 39 | }; 40 | -------------------------------------------------------------------------------- /src/Keyboard.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/Keyboard.hpp" 2 | #include 3 | #include 4 | 5 | Keyboard::Keyboard(){ 6 | key_map = std::map{ 7 | {'1', 0x1}, 8 | {'2', 0x2}, 9 | {'3', 0x3}, 10 | {'4', 0xc}, 11 | {'q', 0x4}, 12 | {'w', 0x5}, 13 | {'e', 0x6}, 14 | {'r', 0xd}, 15 | {'a', 0x7}, 16 | {'s', 0x8}, 17 | {'d', 0x9}, 18 | {'f', 0xe}, 19 | {'z', 0xa}, 20 | {'x', 0x0}, 21 | {'c', 0xb}, 22 | {'v', 0xf}, 23 | }; 24 | pressed_keys = std::vector(16, 0); 25 | } 26 | 27 | bool Keyboard::update_pressed_keys(){ 28 | if(kb.kbhit()){ 29 | int ch = kb.getch(); 30 | if(ch == 'l') return true; 31 | auto it = key_map.find(ch); 32 | if(it != key_map.end()){ 33 | pressed_keys[it->second] += 1; 34 | } 35 | } 36 | return false; 37 | } 38 | 39 | bool Keyboard::isKeyDown(uint8_t key){ 40 | // TODO 41 | if(pressed_keys[key] > 0){ 42 | pressed_keys[key] = 0; 43 | return true; 44 | } 45 | else return false; 46 | } 47 | 48 | uint8_t Keyboard::waitAndGetKeypress(){ 49 | do{ 50 | for(int i = 0; i < 16; ++i){ 51 | if(pressed_keys[i] > 0){ 52 | pressed_keys[i] = 0; 53 | return i; 54 | } 55 | } 56 | update_pressed_keys(); 57 | }while(true); 58 | 59 | return 0; 60 | } 61 | -------------------------------------------------------------------------------- /roms/games/Rush Hour [Hap, 2006].txt: -------------------------------------------------------------------------------- 1 | Rush Hour (v1.1) for CHIP-8 by hap 08-02-08, http://hap.samor.nl/ 2 | Originally released on 17-12-06. Version 1.1 improves a few things. 3 | Based on a boardgame by Nobuyuki Yoshigahara "Nob" and ThinkFun, 4 | http://www.thinkfun.com/ 5 | 6 | This game contains 170 puzzles. Most were taken from the original cardsets, 7 | some were made by me, and some were generated with Michel's PyTraffic, 8 | http://alpha.uhasselt.be/Research/Algebra/Members/pytraffic . Refer to 9 | the source code for detailed information on this. 10 | 11 | HOW TO PLAY 12 | =========== 13 | 14 | The goal of the game is to slide the arrow block(s) out of the 6*6 grid. 15 | Completing 10 boards will be awarded with the inclusion of the next boardset(s) 16 | as seen from the connections on the boardset select screen, a password will be 17 | given so you don't have to complete the game in a single session. 18 | 19 | HEX key PC key* Use 20 | --------------------------- 21 | 5 W up 22 | 8 S down 23 | 7 A left 24 | 9 D right 25 | A Z ok/hold to slide 26 | 1 1 option(in-game)/back 27 | 28 | * = for interpreters that have the 4*4 keypad at 1234/QWER/ASDF/ZXCV. 29 | -------------------------------------------------------------------------------- /src/kbhit.cpp: -------------------------------------------------------------------------------- 1 | // From http://linux-sxs.org/programming/kbhit.html 2 | 3 | #include "../include/kbhit.hpp" 4 | #include // read() 5 | 6 | keyboard::keyboard() 7 | { 8 | tcgetattr(0,&initial_settings); 9 | new_settings = initial_settings; 10 | new_settings.c_lflag &= ~ICANON; 11 | new_settings.c_lflag &= ~ECHO; 12 | new_settings.c_lflag &= ~ISIG; 13 | new_settings.c_cc[VMIN] = 1; 14 | new_settings.c_cc[VTIME] = 0; 15 | tcsetattr(0, TCSANOW, &new_settings); 16 | peek_character=-1; 17 | } 18 | 19 | keyboard::~keyboard() 20 | { 21 | tcsetattr(0, TCSANOW, &initial_settings); 22 | } 23 | 24 | int keyboard::kbhit() 25 | { 26 | unsigned char ch; 27 | int nread; 28 | 29 | if (peek_character != -1) return 1; 30 | new_settings.c_cc[VMIN]=0; 31 | tcsetattr(0, TCSANOW, &new_settings); 32 | nread = read(0,&ch,1); 33 | new_settings.c_cc[VMIN]=1; 34 | tcsetattr(0, TCSANOW, &new_settings); 35 | 36 | if (nread == 1) 37 | { 38 | peek_character = ch; 39 | return 1; 40 | } 41 | return 0; 42 | } 43 | 44 | int keyboard::getch() 45 | { 46 | char ch; 47 | 48 | if (peek_character != -1) 49 | { 50 | ch = peek_character; 51 | peek_character = -1; 52 | } else read(0,&ch,1); 53 | 54 | return ch; 55 | } 56 | -------------------------------------------------------------------------------- /roms/games/UFO [Lutz V, 1992].txt: -------------------------------------------------------------------------------- 1 | Here's how to play UFO: 2 | 3 | You have a stationary missle launcher at the bottom of the screen. You 4 | can shoot in three directions; left diagonal, straight up, and right 5 | diagonal.. using the keys 4, 5, and 6 respectively.. You try to hit 6 | one of two objects flying by.. at apparently varying speeds.. Your 7 | score is displayed on your left, the number of missles you have left 8 | is displayed on your right. (You get 15).. 9 | 10 | This game ("UFO") is not new. I have a copy of it from 1977 (!). It 11 | was one of the original CHIP-8 games on the audio cassette that was 12 | included when I bought my first computer, the Finnish-made Telmac 13 | 1800. 14 | 15 | It was also the first real program to run under CHIP-48 (it was used 16 | as a test case during the development of the CHIP-48 interpreter). The 17 | reason I have not posted it to the net myself is that I have no idea 18 | about its copyright status. I don't even know where it originated 19 | (RCA, perhaps?). 20 | 21 | The cassette that was bundled with the Telmac 1800 contains more than 22 | a dozen CHIP-8 programs. If someone could convince me that these 23 | programs are indeed freely redistributable, the other programs could 24 | also be posted. Otherwise, perhaps this one shouldn't have been. 25 | -------------------------------------------------------------------------------- /roms/games/Animal Race [Brian Astle].txt: -------------------------------------------------------------------------------- 1 | 9. VIP Animal Race 2 | 3 | Animal Race is a fun game for one person, with an element of luck - sure to 4 | put a smile on your face. Five different animals race against one another 5 | and you have the chance to test your expertise at picking the winner. 6 | 7 | 8 | How To Play Animal Race 9 | 10 | 1. Load the CHIP-8 interpretor at 0000-01FF 11 | and the game starting at 0200. 12 | 13 | 2. Turn RUN switch on. 14 | 15 | 3. Wait until the animals are lined up and read to start, then select an animal 16 | by pressing a letter A through E. A mark will appear to the left of the 17 | animal to remind you of the one you have selected. 18 | 19 | 4. Decide how much you want to bet (up to a limit of $9), then press that key. 20 | 21 | 5. After the race is over, press zero (or any key) to start the next race. 22 | Your winnings or losses will be computed and the new total displayed at 23 | the begining of the next race. 24 | 25 | Hints for expert players 26 | All animals move at approximately the same speed, but they start from different 27 | positions. The odds for each animal are related to the starting position but 28 | include a random element. Some races favor the player and you should bet up to 29 | the limit on these. Some races are unfavorable and you should bet carefully 30 | on these. 31 | 32 | You can win the game by accumulating $256 or more. 33 | -------------------------------------------------------------------------------- /roms/games/Tetris [Fran Dachille, 1991].txt: -------------------------------------------------------------------------------- 1 | TETRIS 2 | by Fran Dachille 3 | 4 | This is my first release of the famous Tetris game on the HP48S. I was 5 | inspired by the lack enjoyable games for our favorite handheld. [Not since the 6 | Goodies Disks have been available! -jkh-] This game, though it lacks some of 7 | the whistles and bangs of fancy versions, performs on par with quality arcade 8 | versions (nota bene -> SPEED). At my college, every person who picks up my 9 | calculator is immediately hooked for hours. 10 | 11 | This version is written for the CHIP48 game interpreter (c) 12 | copyright 1990 Andreas Gustafsson. 13 | 14 | The 4 key is left rotate, 5 - left move, 6 - right move, 1 15 | - drop, ENTER - restart, DROP - end. After every 5 lines, the speed 16 | increases slightly and peaks at 45 lines. 17 | 18 | There is room for improvement in this version. Notably, background 19 | pictures, a pause key (for now, hold ON), two rotate keys, various 20 | starting skill levels, a B version which starts with randomn blocks, 21 | finishing graphics, and high scores, just to name a few. 22 | 23 | In order for improvements, I need to know if there is reasonable 24 | demand. If this game is worth playing for hours upon hours, please let 25 | me know. If you wish to support the improvements, want future versions, 26 | and want to see other games ported to the HP48S, send $5.00 to: 27 | 28 | FRAN DACHILLE 29 | WEBB INSTITUTE 30 | GLEN COVE, NY 11542 31 | 32 | -------------------------------------------------------------------------------- /roms/README: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | ///////////////// 3 | ////////////////// 4 | //// //// 5 | //// /////////// 6 | //// /////////// 7 | //// //// 8 | //// /////////// 9 | //// ////////// 10 | 11 | www.chip8.com 12 | ----------------------------------------------------------------------------- 13 | Title : Chip-8 Program Pack 14 | Author : Revival Studios 15 | Genre : Compilation 16 | System : Chip-8/SuperChip/MegaChip8 17 | Last updated : 16/04/2011 18 | Product ID : RS-C8000 19 | ----------------------------------------------------------------------------- 20 | 21 | This is a collection of all CHIP-8 / SuperChip / MegaChip8 programs i found scattered around the web. I've researched and added information about the original author and year of release for most roms. 22 | The roms are divided in the following categories: 23 | 24 | - CHIP-8 Games 25 | - CHIP-8 Demo's 26 | - CHIP-8 Test programs 27 | - CHIP-8 Hires (hardware compatible 64x64 hires mode) 28 | - CHIP-8X/Hybrid games 29 | - SuperChip Games 30 | - SuperChip Demo's 31 | - SuperChip Test programs 32 | - MegaChip Games 33 | - MegaChip Demo's 34 | 35 | I've also converted various listings from paper to binary form and added them to this package. 36 | 37 | Running the roms: 38 | ----------------- 39 | These roms will run in most CHIP-8 emulators and/or the original machines (CHIP8). 40 | 41 | Distribution: 42 | ------------- 43 | This package can be freely distributed in its original form. 44 | If you have any additions for this pack, let me know. 45 | 46 | Watch out for more releases soon! 47 | 48 | 49 | Revival Studios 50 | 51 | -------------------------------------------------------------------------------- /roms/games/Worm V4 [RB-Revival Studios, 2007].txt: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | ///////////////// 3 | ////////////////// 4 | //// //// 5 | //// /////////// 6 | //// /////////// 7 | //// //// 8 | //// /////////// 9 | //// ////////// 10 | 11 | www.revival-studios.com 12 | ----------------------------------------------------------------------------- 13 | Title : SuperWorm V4 14 | Author : RB (Original game) 15 | Updates and fixes by: Martijn Wenting / Revival Studios 16 | Genre : Game 17 | System : Chip-8 / SuperChip8 18 | Date : 10/08/2007 19 | Product ID : RS-C8001 20 | ----------------------------------------------------------------------------- 21 | 22 | All the contents of this package are (c)Copyright 2007 Revival Studios. 23 | Original game: SuperWorm is (c)Copyright 1992 RB 24 | 25 | The contents of the package may only be spread in its original form, and may not be 26 | published or distributed otherwise without the written permission of the authors. 27 | 28 | Description: 29 | ------------ 30 | SuperWorm V4 is an update of the SuperChip8 game: Worm3 by RB. 31 | The original game was only for SuperChip, so i've created a Chip-8 port. 32 | It also includes several speed fixes and a new control system. 33 | 34 | Running the game: 35 | ----------------- 36 | Use the Megachip emulator or any other Chip-8/SuperChip compatible emulator to run the game. 37 | 38 | Credits: 39 | -------- 40 | Chip-8 version, Updates and fixes by: Martijn Wenting 41 | Original game by: RB 42 | 43 | Distribution: 44 | ------------- 45 | This package can be freely distributed in its original form. 46 | If you would like to include this game in your rom package, please let me know. 47 | 48 | Watch out for more releases soon! 49 | 50 | 51 | Martijn Wenting / Revival Studios 52 | 53 | -------------------------------------------------------------------------------- /roms/games/Mastermind FourRow (Robert Lindley, 1978).txt: -------------------------------------------------------------------------------- 1 | MASTERMIND 2 | by 3 | Robert Lindley 4 | 5 | I have progranmed two versLons of the game Mastermind. This game is distributed by Invicta Plastics, Suite 940, 200 - 5th Ave., New York, NY 10010, and is available most pLaces where toys and games are sold. 6 | For complete details of the game, please refer to their instructions. The information given here refers to this particular VIP iurplementation. 7 | The two versions are essentially the same except that the first has a four number code and the second has a five nr:mber hidden code selected at random.. In the four number version, the digits one through six are used and in the five number version the diglts zero through seven are used. 8 | While the game is running, the other hex keys, except key F, have no effect. Key F is used when you change your mind and want to change your input. This key erases the current partial entry. 9 | The game starts by displaying a series of dashes arranged in rows. As the game progresses, the player attempts to deduce the hidden code by replacing the dashes with digits entered via the hex keyboard. Each tlme a hex key is used, the selected digit replaces a dash in one vertical column. This vertical column is one guess of the ten allowed to deduce 10 | the hidden number. When the bottom dash in any column is replaced by a digit, that try is imidiately scored. This score appears below the current column. If any digit in the column exactly matches the hidden number digit in the same row, a broken bar will appear. then four or five (one for each row in the game) appear, the hidden number has been deduced 11 | and it will be revealed at the right end of the screen. If any digit in the column matches a hidden digit, but in an incorrect erorr, a white bar will appear. Note that the scoring is across all rows. For example, if there are two fives in a column and one of then is in the correct row and there is only one five in the hidden numbers, one broken bar will appear. 12 | When all allowed ten tries have been used, the hidden number will be revealed. 13 | 14 | -------------------------------------------------------------------------------- /roms/hires/Hires Worm V4 [RB-Revival Studios, 2007].txt: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | ///////////////// 3 | ////////////////// 4 | //// //// 5 | //// /////////// 6 | //// /////////// 7 | //// //// 8 | //// /////////// 9 | //// ////////// 10 | 11 | www.revival-studios.com 12 | ----------------------------------------------------------------------------- 13 | Title : SuperWorm V4 14 | Author : RB (Original game) 15 | Updates and fixes by: Martijn Wenting / Revival Studios 16 | Genre : Game 17 | System : Chip-8 / Chip-8 Hires / SuperChip8 18 | Date : 10/08/2007 19 | Product ID : RS-C8001 20 | ----------------------------------------------------------------------------- 21 | 22 | All the contents of this package are (c)Copyright 2007 Revival Studios. 23 | Original game: SuperWorm is (c)Copyright 1992 RB 24 | 25 | The contents of the package may only be spread in its original form, and may not be 26 | published or distributed otherwise without the written permission of the authors. 27 | 28 | Description: 29 | ------------ 30 | SuperWorm V4 is an update of the SuperChip8 game: Worm3 by RB. 31 | The original game was only for SuperChip, so i've created a Chip-8 and Hires Chip-8 port. 32 | It also includes several speed fixes and a new control system. 33 | 34 | Running the game: 35 | ----------------- 36 | Use the Megachip emulator or any other Chip-8/SuperChip compatible emulator to run the game. 37 | 38 | Credits: 39 | -------- 40 | Chip-8 version, Hires Chip-8 version, Updates and fixes by: Martijn Wenting 41 | Original game by: RB 42 | 43 | Distribution: 44 | ------------- 45 | This package can be freely distributed in its original form. 46 | If you would like to include this game in your rom package, please let me know. 47 | 48 | Watch out for more releases soon! 49 | 50 | 51 | Martijn Wenting / Revival Studios 52 | 53 | -------------------------------------------------------------------------------- /roms/games/Astro Dodge [Revival Studios, 2008].txt: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | ///////////////// 3 | ////////////////// 4 | //// //// 5 | //// /////////// 6 | //// /////////// 7 | //// //// 8 | //// /////////// 9 | //// ////////// 10 | 11 | www.revival-studios.com 12 | ----------------------------------------------------------------------------- 13 | Title : Astro Dodge 14 | Author : Martijn Wenting / Revival Studios 15 | Genre : Game 16 | System : Chip8 / SuperChip8 17 | Date : 18/12/2008 18 | Product ID : RS-C8003 19 | ----------------------------------------------------------------------------- 20 | 21 | All the contents of this package are (c)Copyright 2008 Revival Studios. 22 | 23 | The contents of the package may only be spread in its original form, and may not be 24 | published or distributed otherwise without the written permission of the authors. 25 | 26 | Description: 27 | ------------ 28 | Astro Dodge is an arcade game for the Chip8 and SuperChip8 systems. 29 | Both versions of the game are included in this package. 30 | 31 | Your goal is to make your way through the asteroids field and dodge the asteroids, scoring points for each asteroid you are able to dodge. 32 | Button 2,4,6,8 will move your ship, button 5 will start the game. 33 | 34 | Running the game(s): 35 | -------------------- 36 | The CHIP8 version of the game has been programmed to be compatible with original hardware like the Cosmac VIP and Telmac 1800. 37 | Use the Megachip emulator or any other Chip8/SuperChip compatible emulator to run the game(s). 38 | 39 | Credits: 40 | -------- 41 | Programming and Graphics by: Martijn Wenting 42 | 43 | Distribution: 44 | ------------- 45 | This package can be freely distributed in its original form. 46 | If you would like to include this game in your rom package, please let me know. 47 | 48 | Watch out for more releases soon! 49 | 50 | 51 | Martijn Wenting / Revival Studios 52 | 53 | -------------------------------------------------------------------------------- /roms/hires/Astro Dodge Hires [Revival Studios, 2008].txt: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | ///////////////// 3 | ////////////////// 4 | //// //// 5 | //// /////////// 6 | //// /////////// 7 | //// //// 8 | //// /////////// 9 | //// ////////// 10 | 11 | www.revival-studios.com 12 | ----------------------------------------------------------------------------- 13 | Title : Astro Dodge 14 | Author : Martijn Wenting / Revival Studios 15 | Genre : Game 16 | System : Chip8 / SuperChip8 17 | Date : 18/12/2008 18 | Product ID : RS-C8003 19 | ----------------------------------------------------------------------------- 20 | 21 | All the contents of this package are (c)Copyright 2008 Revival Studios. 22 | 23 | The contents of the package may only be spread in its original form, and may not be 24 | published or distributed otherwise without the written permission of the authors. 25 | 26 | Description: 27 | ------------ 28 | Astro Dodge is an arcade game for the Chip8 and SuperChip8 systems. 29 | Both versions of the game are included in this package. 30 | 31 | Your goal is to make your way through the asteroids field and dodge the asteroids, scoring points for each asteroid you are able to dodge. 32 | Button 2,4,6,8 will move your ship, button 5 will start the game. 33 | 34 | Running the game(s): 35 | -------------------- 36 | The CHIP8 version of the game has been programmed to be compatible with original hardware like the Cosmac VIP and Telmac 1800. 37 | Use the Megachip emulator or any other Chip8/SuperChip compatible emulator to run the game(s). 38 | 39 | Credits: 40 | -------- 41 | Programming and Graphics by: Martijn Wenting 42 | 43 | Distribution: 44 | ------------- 45 | This package can be freely distributed in its original form. 46 | If you would like to include this game in your rom package, please let me know. 47 | 48 | Watch out for more releases soon! 49 | 50 | 51 | Martijn Wenting / Revival Studios 52 | 53 | -------------------------------------------------------------------------------- /src/GraphicEngine.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/GraphicEngine.hpp" 2 | #include 3 | #include 4 | #include 5 | 6 | // From https://stackoverflow.com/questions/17335816/clear-screen-using-c 7 | void ClearScreen(){ 8 | std::cout << "\033[2J\033[1;1H"; 9 | } 10 | 11 | GraphicEngine::GraphicEngine(){ 12 | cls(); 13 | } 14 | 15 | void GraphicEngine::cls(){ 16 | // TODO 17 | fb.fill(std::bitset<64>(0)); 18 | dirty = true; 19 | } 20 | 21 | uint8_t GraphicEngine::draw_sprite(std::vector::iterator start, std::vector::iterator end, uint8_t x, uint8_t y){ 22 | bool b = false; 23 | for(uint8_t curr_y = y; curr_y <= 0x1f && start != end; ++start, ++curr_y){ 24 | std::bitset<64> sprite_y(*start); 25 | std::bitset<64> org = fb[curr_y]; 26 | 27 | // Uncomment the following line to wrap the sprite around the screen instead of clipping it 28 | // sprite_y = (x <= 56) ? (sprite_y << (56 - x)) : ((sprite_y >> (x - 56)) | (sprite_y << (120-x))); 29 | sprite_y = (x <= 56) ? (sprite_y << (56 - x)) : (sprite_y >> (x - 56)); 30 | fb[curr_y] = fb[curr_y] ^ sprite_y; 31 | 32 | // Update display related flags 33 | if((org & (~fb[curr_y])).count() > 0) b = true; 34 | if((org ^ fb[curr_y]).count() > 0) dirty = true; 35 | } 36 | 37 | return b?1:0; 38 | } 39 | 40 | std::string GraphicEngine::screen_as_string(){ 41 | std::string s; 42 | s.append("╔"); 43 | for(int i = 0; i < 64; ++i){ 44 | s.append("═"); 45 | } 46 | s.append("╗"); 47 | s.push_back('\n'); 48 | for(int i = 0; i < 16; ++i){ 49 | s.append("║"); 50 | for(int j = 63; j >= 0; --j){ // bitset indexes are right-to-left 51 | if(fb[2*i].test(j)){ 52 | if(fb[2*i + 1].test(j)){ 53 | s.append("█"); 54 | }else{ 55 | s.append("▀"); 56 | } 57 | }else{ 58 | if(fb[2*i + 1].test(j)){ 59 | s.append("▄"); 60 | }else{ 61 | s.append(" "); 62 | } 63 | } 64 | } 65 | s.append("║\n"); 66 | } 67 | s.append("╚"); 68 | for(int i = 0; i < 64; ++i){ 69 | s.append("═"); 70 | } 71 | s.append("╝\n"); 72 | return s; 73 | } 74 | 75 | void GraphicEngine::update_display(){ 76 | ClearScreen(); 77 | std::cout << screen_as_string(); 78 | dirty = false; 79 | } 80 | 81 | bool GraphicEngine::is_dirty(){ 82 | return dirty; 83 | } 84 | -------------------------------------------------------------------------------- /roms/games/Reversi [Philip Baltzer].txt: -------------------------------------------------------------------------------- 1 | 6. VIP REVERSI 2 | Reversi is a game over 100 years old, which has become popular recently under the 3 | name Othello. The game is played on a 8x8 square, using two kinds of markers. 4 | In VIP Reversi one player has the open markers and the other player the solid 5 | markers. The score for either player at any time is the total number of his markers 6 | on the square. 7 | 8 | How to play VIP Reversi 9 | 10 | 1. Load the CHIP-8 interpretor at 0000-01FF 11 | and the game starting at 0200. 12 | 13 | 2. Turn RUN switch on. 14 | 15 | 3. The 8x8 square will be formed and the starting marker configuration shown, having 16 | two of each kind of marker in the center four locations of the square. The starting 17 | score for each player is shown as 02 above a line of his markers. 18 | 19 | 4. Your VIP indicates the player's turn by blinking that player's score and also blinking 20 | a cursor dot in the 8x8 square. A player moves the blinking cursor dot in the 8x8 21 | square by pressing the direction keys 1-4 and 6-9 as shown. (VIPG1-6.JPG) 22 | 23 | 5. When the cursor-dot is properly located, the player presses key 5 to place his marker 24 | on the square. You will find that your VIP will not allow you to make a non-valid 25 | play. The only placements allowed are onces for which at least one of the other 26 | player's markers is surrounded between an existing marker of your own and your new 27 | marker being placed. All these markers must be in consecutive positions on the 28 | square and can be in any horizontal, vertical or diagonal direction. Once a new 29 | marker has been placed, your VIP will change all such surrounded markers of the 30 | other player to your kind and change the scores. 31 | 32 | 6. Sometimes it may not be possible for a player to make a valid move. If this happens 33 | he must forfeit his move by pressing the "F" key! The game ends when neither player 34 | can play or when the 8x8 square is completely filled with markers. The goal is to 35 | end the game with the highest score. Do not be discouraged if during the game you 36 | seem to be losing because this is a game with dramatic reversals! Develop a winning 37 | strategem and become a champion!! 38 | -------------------------------------------------------------------------------- /roms/demos/Trip8 Demo (2008) [Revival Studios].txt: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | ///////////////// 3 | ////////////////// 4 | //// //// 5 | //// /////////// 6 | //// /////////// 7 | //// //// 8 | //// /////////// 9 | //// ////////// 10 | 11 | www.revival-studios.com 12 | ----------------------------------------------------------------------------- 13 | Title : Trip8 / SuperTrip8 demo 14 | Author : Martijn Wenting / Revival Studios 15 | Genre : Demo 16 | System : Chip-8 / SuperChip8 17 | Date : 14/10/2008 18 | Product ID : RS-C8004 19 | ----------------------------------------------------------------------------- 20 | 21 | All the contents of this package are (c)Copyright 2008 Revival Studios. 22 | 23 | The contents of the package may only be spread in its original form, and may not be 24 | published or distributed otherwise without the written permission of the authors. 25 | 26 | Description: 27 | ------------ 28 | The Trip8/SuperTrip8 demo are demo's for the Chip-8 and SuperChip8 systems. The demo consists of an intro, 3D vectorballs, and 4 randomized dot-effects. 29 | 30 | Writing a demo for the original Chip-8 interpreter was a real pain, since your framerate basically drops in half for every sprite you need to draw. So even clearing and redrawing a few dots will cause the framerate to drop to near zero :) Originally the demo was going to be bigger and there were much more graphical effects programmed/prototyped, but a lot of these effects turned out to be too much for the original unoptimized Chip-8 interpreters to handle. 31 | 32 | Running the Demo: 33 | ----------------- 34 | Use the Megachip emulator or any other Chip-8/SuperChip compatible emulator to run the slideshow. 35 | 36 | Credits: 37 | -------- 38 | Programming/Graphics/Design by: Martijn Wenting 39 | 40 | Distribution: 41 | ------------- 42 | This package can be freely distributed in its original form. 43 | If you would like to include this slideshow in your rom package, please let me know. 44 | 45 | Watch out for more releases soon! 46 | 47 | 48 | Martijn Wenting / Revival Studios 49 | 50 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Makefile and project structure used from - https://hiltmon.com/blog/2013/07/03/a-simple-c-plus-plus-project-structure/ 2 | CC := g++ # This is the main compiler 3 | #CC := clang --analyze # and comment out the linker last line for sanity 4 | SRCDIR := src 5 | BUILDDIR := build 6 | TARGETDIR := bin 7 | TARGET := bin/c8emu 8 | SRCEXT := cpp 9 | SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT)) 10 | OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o)) 11 | CFLAGS := -g -Wall -Werror -std=c++11 12 | LIB := # -lncurses -pthread -lmongoclient -L lib -lboost_thread-mt -lboost_filesystem-mt -lboost_system-mt 13 | INC := -I include 14 | 15 | LLVMBUILDDIR := llvm/build 16 | LLVMTARGETDIR := llvm/linked 17 | LLVMTARGET := llvm/linked/c8emu.ll 18 | LLVMBCTARGET := llvm/linked/c8emu.bc 19 | LLVMBINTARGET := llvm/linked/c8emu 20 | LLVMINTERMEDIATE := $(patsubst $(SRCDIR)/%,$(LLVMBUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o)) 21 | LLVMCC := wllvm++ 22 | LLVMLINKER := wllvm++ 23 | LLVMCFLAGS := $(CFLAGS) 24 | WLLVMEXTRACTBC := extract-bc 25 | LLVMDECOMP := llvm-dis 26 | export LLVM_COMPILER=clang 27 | 28 | $(TARGET): $(OBJECTS) 29 | @mkdir -p $(TARGETDIR) 30 | @echo " Linking..." 31 | @echo " $(CC) $^ -o $(TARGET) $(LIB)"; $(CC) $^ -o $(TARGET) $(LIB) 32 | 33 | $(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT) 34 | @mkdir -p $(BUILDDIR) 35 | @echo " $(CC) $(CFLAGS) $(INC) -c -o $@ $<"; $(CC) $(CFLAGS) $(INC) -c -o $@ $< 36 | 37 | llvm: $(LLVMTARGET) 38 | 39 | $(LLVMTARGET): $(LLVMINTERMEDIATE) 40 | @mkdir -p $(LLVMTARGETDIR) 41 | @echo " Linking..." 42 | @echo " $(LLVMLINKER) -o $(LLVMBINTARGET) $(LIB) $^"; $(LLVMLINKER) -o $(LLVMBINTARGET) $(LIB) $^ 43 | @echo " $(WLLVMEXTRACTBC) $(LLVMBINTARGET)"; $(WLLVMEXTRACTBC) $(LLVMBINTARGET) 44 | @echo " $(LLVMDECOMP) $(LLVMBCTARGET) -o $(LLVMTARGET)"; $(LLVMDECOMP) $(LLVMBCTARGET) -o $(LLVMTARGET) 45 | 46 | $(LLVMBUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT) 47 | @mkdir -p $(LLVMBUILDDIR) 48 | @echo " $(LLVMCC) $(LLVMCFLAGS) $(INC) -c -o $@ $<"; $(LLVMCC) $(LLVMCFLAGS) $(INC) -c -o $@ $< 49 | 50 | clean: 51 | @echo " Cleaning..."; 52 | @echo " $(RM) -r $(BUILDDIR) $(TARGET) $(LLVMBUILDDIR) $(LLVMTARGETDIR)"; $(RM) -r $(BUILDDIR) $(TARGET) $(LLVMBUILDDIR) $(LLVMTARGETDIR) 53 | 54 | # Tests 55 | tester: 56 | $(CC) $(CFLAGS) test/tester.cpp $(INC) $(LIB) -o bin/tester 57 | 58 | # Spikes 59 | ticket: 60 | $(CC) $(CFLAGS) spikes/ticket.cpp $(INC) $(LIB) -o bin/ticket 61 | 62 | .PHONY: clean 63 | -------------------------------------------------------------------------------- /roms/games/Bowling [Gooitzen van der Wal].txt: -------------------------------------------------------------------------------- 1 | 7. VIP Bowling 2 | 3 | Bowling is a great game for recreation and competion requiring skill and a little 4 | bit of luck. This program simulates bowling closely with regular scoring and the 5 | option of using three different spins on the ball. 6 | 7 | How to play VIP Bowling 8 | 9 | 1. Load the CHIP-8 interpretor at 0000-01FF 10 | and the game starting at 0200. 11 | 12 | 2. Turn RUN switch on. 13 | 14 | 3. Up to 6 persons can compete. Make the choice by pressing Key 1,2,3,4,5 or 6. 15 | The players will be referred to as A,B,C,D,E and F. 16 | 17 | 4. It is possible to play up to 10 frames in one game. Make your choice of the 18 | number of frames by pressing Key 1,2,3,4,5,6,7,8,9 or 0 (for 10 frames). 19 | 20 | 5. It is possible to choose 3 ball speeds (Key 1,2 or 3). The speed option only 21 | affects the ball after it is released. 22 | 23 | 6. At the start of a player's turn, the video will display whose turn it is and 24 | whether he is working on a spare, strike, 2 strikes or nothing. 25 | Release the ball by pressing on of the following keys: Key 1,2,3,5,7,8 or 9. 26 | -Key 5 will cause a straight ball. 27 | -Key 1,2 and 3 will cause the ball to spin up. 28 | -Key 1 before the first pin 29 | -Key 2 after the first pin 30 | -Key 3 after the second pin 31 | -Key 7,8 and 9 will cause the ball to spin up. 32 | -Key 7 before the first pin 33 | -Key 8 after the first pin 34 | -Key 9 after the second pin 35 | 36 | 7. After the player's turn ends, the video will display whose turn it was, the 37 | frame, and the score. The next players follows the instructions at 6 above. 38 | 39 | 8. After all players have had their turn in a frame, the video will display the 40 | total of each player and whether he is working on a spare, 1 strike, 2 strikes 41 | or nothing. It will display the frame number and the total number of frames 42 | to go (unless the last frame was played). 43 | After pressing Any key, player A can start in the next frame. Continue with 44 | instruction 6 above. 45 | 46 | 9. If all frames in the game have been finished, press any key again. The player's 47 | who are still working on a spare will recieve 1 more ball, and those working 48 | on 1 or 2 strikes will receive 2 balls. 49 | 50 | 10. After all players have finished the game, the final score will be displayed. 51 | 52 | 53 | -------------------------------------------------------------------------------- /roms/games/Biorhythm [Jef Winsor].txt: -------------------------------------------------------------------------------- 1 | 13. VIP Biorhythm 2 | 3 | The theory of Biorhythm states that there are thre predominant cycles that can influence 4 | human behavior. These include a 23-day physical cycle, a 28-day emotional cycle and a 5 | 33-day intellectual cycle. All three cycles start at birth and continue throughout life. 6 | 7 | Each cycle consists of a positive and a negative period. Physical, Emotional and 8 | Intellectual aspects are enhanced during positive periods. Poor performance is 9 | indicated by the negative period of a cycle. 10 | 11 | A critical day occurs on the crossover from the positive to the negative period or 12 | vice versa. A critical day indicates instability in a particular aspect. 13 | 14 | 15 | How to Use VIP Biorhythm 16 | 17 | 1. Load the CHIP-8 interpreter at 0000-01FF and 18 | the game starting at 0200. 19 | 20 | 2. Turn RUN switch on. 21 | 22 | 3. Enter birthdate using 2-digit month, 2-digit day, and 4-digit year. 23 | 24 | 4. Enter start date using 2-digit month, 2-digit day, and 4-digit year. The start date 25 | indicates the first day of the 32-day Biorhythm chart the program will generate. 26 | 27 | 5. After a period of calculation proportional to the span of time involved, the three 28 | cycle curves will be shown for a 32-day period. Each horizontal bit position 29 | represents one day in the cycle. The start day, on the left, and every seventh 30 | day are indicated by week markers. The first day of a positive or negative period 31 | is a critical day. 32 | 33 | 6. To advance the start date, hold key F down until the desired date is reached. 34 | To decrement the start date, hold key B down. These functions allow changing the 35 | start date slightly without reentering all the dates and waiting for the calculations 36 | to be preformed. 37 | 38 | 7. Press Key 0 to clear the screen and enter a new set of dates. 39 | 40 | 41 | 42 | See VIPG1-13.jpg 43 | 44 | 45 | INTERPRETATION 46 | 47 | 48 | Physical Emotional Intellectual 49 | 50 | Positive Period Strong, Good moods, Good Judgement 51 | (Up) Vigorous Cooperative Sharp Mentally 52 | 53 | Negative Period Tire easily, Low Enthusiasm, Low attentiveness 54 | (Down) Less Stamina Feelings Subdued and concentration 55 | 56 | Critical Days Susceptible to injury emotionally unstable, Poor memory, 57 | (Crossover) or Illness, Upset easily Prone to mistakes 58 | Low endurance 59 | -------------------------------------------------------------------------------- /roms/hires/Trip8 Hires Demo (2008) [Revival Studios].txt: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | ///////////////// 3 | ////////////////// 4 | //// //// 5 | //// /////////// 6 | //// /////////// 7 | //// //// 8 | //// /////////// 9 | //// ////////// 10 | 11 | www.revival-studios.com 12 | ----------------------------------------------------------------------------- 13 | Title : Trip8 / SuperTrip8 demo 14 | Author : Martijn Wenting / Revival Studios 15 | Genre : Demo 16 | System : Chip-8 / Chip-8 Hires / SuperChip8 17 | Date : 14/10/2008 18 | Product ID : RS-C8004 19 | ----------------------------------------------------------------------------- 20 | 21 | All the contents of this package are (c)Copyright 2008 Revival Studios. 22 | 23 | The contents of the package may only be spread in its original form, and may not be 24 | published or distributed otherwise without the written permission of the authors. 25 | 26 | Description: 27 | ------------ 28 | The Trip8/SuperTrip8 demo are demo's for the Chip-8, Chip-8 Hires and SuperChip8 systems. The demo consists of an intro, 3D vectorballs, and 4 randomized dot-effects. 29 | 30 | Writing a demo for the original Chip-8 interpreter was a real pain, since your framerate basically drops in half for every sprite you need to draw. So even clearing and redrawing a few dots will cause the framerate to drop to near zero :) Originally the demo was going to be bigger and there were much more graphical effects programmed/prototyped, but a lot of these effects turned out to be too much for the original unoptimized Chip-8 interpreters to handle. 31 | The 64x64 Hires version of the demo will also work on the original hardware without modification. 32 | 33 | Running the Demo: 34 | ----------------- 35 | Use the Megachip emulator or any other Chip-8/SuperChip compatible emulator to run the demo. 36 | 37 | Credits: 38 | -------- 39 | Programming/Graphics/Design by: Martijn Wenting 40 | 41 | Distribution: 42 | ------------- 43 | This package can be freely distributed in its original form. 44 | If you would like to include this slideshow in your rom package, please let me know. 45 | 46 | Watch out for more releases soon! 47 | 48 | 49 | Martijn Wenting / Revival Studios 50 | 51 | -------------------------------------------------------------------------------- /roms/games/Deflection [John Fort].txt: -------------------------------------------------------------------------------- 1 | 8. VIP DEFLECTION 2 | 3 | In the VIP Deflection game you position mirrors anywhere on the display screen. 4 | The object of the game is to deflect a ball of the mirrors a maximum number of 5 | times before hitting the target. 6 | 7 | The number of deflections times the target number gives you deflection points. 8 | These are added to your previous point total. If you fail to hit the target you 9 | get no points. The winner of the game is the player who accumulates 257 or 10 | more deflected points. 11 | 12 | How to Play VIP Deflection 13 | 14 | 1. Load the CHIP-8 interpretor at 0000-01FF 15 | and the game starting at 0200. 16 | 17 | 2. Turn RUN switch on. 18 | 19 | 3. After the scores appear a letter, the target with a number and a ball. The 20 | letter signifies the player who will program the mirrors. This sequence will 21 | be repeated until there is a winner. 22 | 23 | 4. To program the mirrors, select the proper mirror type by using Table 1 (VIP1-8.jpg) 24 | as a guide. Key 1 will place a horizontal mirror on the board. Key 2 selects a 25 | vertical mirror, Key 3 a slant-left mirror, Key 4 a slant-right mirror. 26 | 27 | 5. After a mirror has been selected, you may position the mirror by using keys 1 28 | through 4 and 6 through 9 (see Table 2 for movement of a mirror). Once a 29 | mirror has been selected and positioned, it may be fixed into position by pressing 30 | Key 5. 31 | 32 | Table 2 - Mirror Positioning and Ball Direction 33 | Key Selection | Positioning and Direction 34 | ------------------+--------------------------- 35 | 1 | up and to the left 36 | 2 | up 37 | 3 | up and to the right 38 | 4 | left 39 | 5 | right 40 | 7 | down and to the left 41 | 8 | down 42 | 9 | down and to the right 43 | 44 | 6. You may position up to 10 mirrors on the game board. After you have the maximum 45 | amount on the board you must press Key 0 to progress to the fire mode. If you 46 | wish to progress to the fire mode with less than 10 mirrors programmed, you may 47 | do so by pressing Key 0. You fire the ball in the direction you want by using 48 | Keys 1 through 4 and Keys 6 through 9 (see Table 2). 49 | 50 | 7. After the ball has reached the target or leaves the game board, the player's 51 | score is computed and displayed and a new ball and target appear. 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /roms/games/Most Dangerous Game [Peter Maruhnic].txt: -------------------------------------------------------------------------------- 1 | 10. VIP Most Dangerous Game 2 | 3 | VIP Most Dangerous Game pits a hunter against a hunted in a maze. The hunter must 4 | shoot the hunted before either time runs out or the hunted escapes the maze. 5 | However, neither the hunted nor the hunter can see a wall in the maze until he runs 6 | into it. There is always at least one path through the maze. 7 | 8 | How To Play VIP Most Dangerous Game 9 | 10 | 1. Load the CHIP-8 interpretor at 0000-01FF 11 | and the game starting at 0200. 12 | 13 | 2. Turn RUN switch on. 14 | 15 | 3. Hunted's turn: 16 | When the arrow appears in the lower left, it is the hunted's turn. Keys 2-4-6-8 17 | control direction (up-left-right-down, respectively). The hunted continues to 18 | move until a) he makes 5 moves, b) he hits a wall or c) key 0 is pressed. 19 | 20 | 4. Hunter's turn 21 | When the arrow appears in the lower right, it is the hunter's turn. The hunter's 22 | turn consists of two modes, the move and the shoot. Keys 2-4-6-8 and 0 control both 23 | modes. Like the hunted, the hunter continues to move until a) he makes 3 moves, 24 | b) he hits a wall or c) key 0 is pressed. If he hits the wall, case b), he cannot 25 | fire a bullet. The hunter may fire one of his bullets using the direction keys 26 | 2-4-6-8. The bullet will travel four squares in the corresponding direction, unless 27 | a wall is encountered. If the hunter prefers not to use a bullet, he must press key 0. 28 | 29 | 5. Repeat steps 3 and 4 until: 30 | a) The number of turns (upper left on the display) expire. The hunted wins. 31 | b) The hunter lands on or shoots the hunted. The hunter wins. 32 | c) The hunted lands on hunter, thereby giving up. The hunter wins. 33 | d) The hunted reaches the lower right corner of the maze with at least 1 move 34 | remaining in his turn. The hunted wins, by escaping the maze. 35 | 36 | 6. Variations of VIP Most Dangerous Game may be played by changing certain bytes in 37 | the program. 38 | 39 | Location Default Meaning 40 | 0215 0F Number of turns in the game. 41 | 0217 06 Number of bullets hunter has at start. 42 | 0219 03 Number of moves per turn for the hunter. 43 | 0221 01 Number of squares per move (hunted and hunter). 44 | 022B 05 Number of moves per turn for the hunted. 45 | 024B 01 If zero, walls are invisible. 46 | 0355 04 Number of squares a bullet will go. 47 | 04E3 70 Probability (out of 100Hex) of a wall appearing. 48 | 04EB FE If FF, a wall may appear at previously tested boundaries. 49 | -------------------------------------------------------------------------------- /roms/CHANGELOG: -------------------------------------------------------------------------------- 1 | [16/4/2011]: 2 | - HIRES CHIP-8: Added Hires AstroDodge [Revival Studios, 2008] 3 | - HIRES CHIP-8: Added Hires Worm V4 [Revival Studios/RB, 2007] 4 | - HIRES CHIP-8: Added Trip8 Hires demo [Revival Studios, 2008] 5 | - HIRES CHIP-8: Added Hires Particle Demo [ZeroZshadow, 2008] 6 | - HIRES CHIP-8: Added Hires Stars [Sergey Naydenov, 2010] 7 | - HIRES CHIP-8: Added Hires Sierpinski [Sergey Naydenov, 2010] 8 | - HIRES CHIP-8: Added Hires Maze [David Winter, 19xx] 9 | - HIRES CHIP-8: Added Hires test [-, 1978] 10 | - CHIP-8 Programs: Life [GV Samways, 1980] 11 | - CHIP-8 Programs: Framed MK1 [GV Samways, 1980] 12 | - CHIP-8 Programs: Framed MK2 [GV Samways, 1980] 13 | - CHIP-8 Programs: Clock Program [Bill Fisher, 1981] 14 | - CHIP-8 Games: Russian Roulette [David Ruth, 1982] 15 | - CHIP-8 Games: FlipAround [unknown, 1980] 16 | 17 | [2/1/2011]: 18 | - CHIP-8 DEMOS: Added Particle Demo [ZeroZshadow, 2008] 19 | - SUPERCHIP-8 DEMOS: Added Super Particle Demo [ZeroZshadow, 2008] 20 | - MEGACHIP-8 DEMOS: Added Mega Particle Demo [ZeroZshadow, 2008] 21 | 22 | [19/9/2010]: 23 | - CHIP-8 DEMOS: Added Trip-8 Demo [Revival Studios,2008] 24 | - SUPERCHIP-8 DEMOS: Added SuperTrip-8 Demo [Revival Studios,2008] 25 | - CHIP-8 DEMOS: Added Stars [Sergey Naydenov, 2010] 26 | - CHIP-8 DEMOS: Added Sierpinski [Sergey Naydenov, 2010] 27 | - SUPERCHIP-8 DEMOS: Added SCStars [Sergey Naydenov, 2010] 28 | - SUPERCHIP-8 DEMOS: Added SCSierpinksi [Sergey Naydenov, 2010] 29 | - MEGACHIP-8 DEMOS: Added MegaSierpinski [Sergey Naydenov, 2010] 30 | - CHIP-8 TESTS: Added Division Test [Sergey Naydenov, 2010] 31 | - CHIP-8 TESTS: Added SQRT Test [Sergey Naydenov, 2010] 32 | - CHIP8x and HYBRIDS: Added various ETI660 Hybrids. 33 | 34 | [12/9/2010]: 35 | - CHIP-8 GAMES: Added Worm V4 [RB-Revival Studios, 2007] 36 | - CHIP-8 GAMES: Added ZeroPong [ZeroZshadow, 2007] 37 | - CHIP-8 GAMES: Added Rush Hour [Hap, 2006] (alt) 38 | - CHIP-8 GAMES: Added Pong (alt) 39 | 40 | [11/9/2010]: 41 | - CHIP-8 GAMES: Added a few converted roms from old Viper magazines & manuals. 42 | - Many new roms/programs added. 43 | 44 | [20/8/2010]: 45 | - CHIP-8 GAMES: Added AstroDodge [Revival Studios, 2008] 46 | - SUPERCHIP-8 GAMES: Added Super AstroDodge [Revival Studios, 2008] 47 | - SUPERCHIP-8 DEMOS: Added Climax Slideshow [Revival Studios, 2008] 48 | - Added Author and release-year information for each rom. 49 | - Added Text file by original author for each rom. 50 | 51 | [4/6/2008]: 52 | - Added Zero Demo [ZeroZshadow, 2007] 53 | - Added a number of other new roms. 54 | 55 | [2/10/2007]: 56 | - Initial release of the rom pack 57 | 58 | [Still Wanted]: 59 | - Snafu (Chip-8 Game) 60 | - Life (Chip-8 Demo) 61 | 62 | -------------------------------------------------------------------------------- /roms/games/Syzygy [Roy Trevino, 1990].txt: -------------------------------------------------------------------------------- 1 | SYZYGY v0.1 2 | 3 | One of the first games I remember playing on a computer was 4 | called "syzygy" on a now ancient TRS-80 Model 1. It has since 5 | appeared on other computers under various names. Why it was 6 | called syzygy, I have no idea (consult Websters). However, since 7 | the HP48SX has approximately the same memory, graphics and cpu 8 | power as my TRS-80 did (something like 16kB, 128x64, and a 1.2Mhz Z80), 9 | I thought it would be amusing to play it again. Now, approximately 10 | to my recollection, and with many apologies to the original author, 11 | here is a CHIP48 version of SYZYGY. Enough drivel. 12 | 13 | The object of the game is to seek out "targets". You do this with 14 | your syzygy. Initially small, the syzygy will grow by some amount 15 | each time a target is hit. Eventually, your syzygy will 16 | be so long as to make tougher and tougher to get any points (and easier 17 | and easier to get killed). Confused? Just try it. 18 | 19 | Anyways, the syzygy is not allowed to run into anything except targets. 20 | It cannot run into the screen border (if present), or itself (this 21 | includes backing into itself). Fast and immediate death will result. 22 | Don't worry if you die quickly a few times. The keys take a few 23 | minutes to get used to. 24 | 25 | To start: + start/restart game with border 26 | - start/restart borderless game 27 | 28 | To play: 9 up 29 | 6 down 30 | 1 left 31 | 2 right 32 | 33 | [Hint for frustrated beginners: hold left hand on 1 & 2, and right hand on 34 | 6 & 9 keys. Alternate between left hand, right hand, left hand... -jkh-] 35 | 36 | 37 | Fine print (borrowed from Andreas Gustafsson, author of CHIP-48): 38 | 39 | SYZYGY is (c) copyright 1990 by Roy Trevino (RTT) 40 | 41 | Noncommercial distribution allowed, provided that this 42 | copyright message is preserved, and any modified versions 43 | are clearly marked as such. 44 | 45 | SYZYGY, via CHIP-48, makes use of undocumented low-level features 46 | of the HP48SX calculator, and may or may not cause loss of data, 47 | excessive battery drainage, and/or damage to the calcultor 48 | hardware. The Author takes no responsibility whatsoever for 49 | any damage caused by the use of this program. 50 | 51 | THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR 52 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 53 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 54 | PURPOSE. 55 | 56 | Roy 57 | 58 | -------------------------------------------------------------- 59 | Roy Trevino Intel Corp. 60 | E-mail: rtrevino@sedona.intel.com Tel: (602) 554 2816 61 | UUCP: decwrl!apple!oliveb!orc!inews!rtrevino@sedona.intel.com 62 |  -------------------------------------------------------------------------------- /roms/games/Lunar Lander [Udo Pernisz, 1979].txt: -------------------------------------------------------------------------------- 1 | 15. Lunar Lander 2 | 3 | You are descending to the floor of a 250-foot crater. The right side of the TV display 4 | shows amount of fuel, feet from bottom and fall rate per cycle. Lenght of fall rate 5 | cycle changes from about 1/4 second to one second. The fall rate increases by one 6 | foot per second/per cycle. The computer will update the display only at the end of 7 | each cycle. 8 | 9 | The left side of the display shows the Lunar Lander descending from 250 feet. The 10 | Lander will first appear at one of sixteen locations. It will then slowly drop down 11 | the crater. The crater walls have rock formations protruding from them which must 12 | be avoided. If either rocket motor should touch any part of the crater, the Lander 13 | will explode in a cloud of smoke and disintegrate. (Remember, these are atomic 14 | thrusters and react like miniature atomic bombs upon impact). 15 | 16 | When you reach 32 feet, the display will change, and you will see the crater floor. 17 | You must now ladn between the rock formations on the floo and maintain a minimum fall 18 | rate. As you drop your fall rate to zero, you soon discover that the Lander becomes 19 | more and more unstable just as any hovering object would. And now with perfect skill 20 | you guide the ship in for a perfect touch down, or? 21 | 22 | How to Play VIP Lunar Lander 23 | 24 | 1. Load the CHIP-8 interpreter at 0000-01FF and teh game starting at 0200. 25 | 26 | 2. Key 2 controls the thrust of the Lunar Lander. One tone beep equals one pound 27 | of fuel and one foot of thrust. 28 | 29 | 3. Key 4 controlls the horizontal stabilizing engine, and moves the Lander one 30 | foot to the left per one pound of fuel. 31 | 32 | 4. Key 6 controls the stabilization to the right. 33 | 34 | 5. Stabilization controls only react after: (a) a complete fall cycle, or (b) after 35 | the Key 2 thrust control is pressed. You must be aware of this at all times or 36 | you will crash even though either key 4 or 6 is pressed. 37 | 38 | 6. At the end of each cycle, the Lunar Lander will move randomly at the rate of one 39 | foot either right or left. Therefore, as the fall rate approaches zero, the Lander 40 | becomes more uncontrollable, and your horizontal stabilizers react more quickly. 41 | (Just like the real thing). 42 | 43 | 7. If you land too fast, the Lander will bounce and flip over. 44 | 45 | 8. If you run out of fuel, the Lander will crash. 46 | 47 | 9. You will not be allowed to go above 250 feet. If you try to do so, you will just 48 | waste precious fuel. 49 | 50 | 10. Once you reach 32 feet and move into the landing display, you will not be allowed 51 | to rise above 26 feet. Trying to do so will waste more precious fuel. 52 | 53 | 11. Game options 54 | 55 | You may select one of three options at the begining of the game. 56 | 57 | Option 1: You start at 250 feet. You are given 150 pounds of fuel. You must land 58 | at 5 feet per second or less. The initial descent display is easy to 59 | maneuver through. 60 | 61 | Option 2: You start at 250 feet. You have 200 pounds of fuel. You must land at 3 feet 62 | per second or less. The initial descent display is hard to maneuver through. 63 | 64 | Option 3: You start at 32 feet. You have 100 pounds of fuel. You must land at 3 feet 65 | per second or less. This display allows you to practice landing. 66 | 67 | You should consider Option 2 as the complete game when trying for Astronaut Ratings. 68 | 69 | 12. Astronaut Ratings 70 | 71 | The computer will award you with ratings depending on how good a lander you are. 72 | 73 | You will obtain the rating of Astronaut by landing without regard to fall rate or 74 | fuel. You must not exceed fall rate, or zero fuel. 75 | 76 | You will obtain the rating of Astronaut Pilot, by ladning with regard to fuel. 80 77 | pounds or more if you land between the two rock formations on the floor, and 50 78 | pounds or more if you land between the crater wall and a rock formation. 79 | 80 | You will obtain the rating of Astronaut Captain by landing the ship with regard to 81 | fuel as per above and if the fall rate is two feet per second or less. (Not an 82 | easy task, as you will soon discover). 83 | 84 | 13. About Graphics 85 | 86 | This game has some interesting graphic displays when you run out of fuel, crash, 87 | land too fast, when you land successfully. I will leave them to your discovery, 88 | as they are fun to watch. 89 | 90 | 14. Landing Sites 91 | 92 | The final landing display will appear somewhat like the illustration below 93 | (VIPG1-15.jpg). You may land in any of the three locations pointed to. To land 94 | between the crater walls and rock formations, you will have to first bring the 95 | Lander to a zero fall rate while hovering in the center landing area. Then bring 96 | the ship up and just over the rock formation, and let it drop down to the landing 97 | site. At the last moment, a few taps on the thruster button will slow the lander 98 | to the required fall rate. It will take you many tries to land here, but don't 99 | give up, it can be done!! 100 | 101 | NOTE: VIP Lunar Lander requires at least 3K of RAM. RAM memories are available to 102 | increase your VIP from 2K to 3K at your local computer store or by contacting: 103 | RCA VIP Marketing 104 | New Holland Avenue 105 | Lancaster, PA 17604 106 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Screenshot 1](/res/Screenshots/animation2.gif) 2 | 3 | *Emulator displaying the CHIP-8 logo, drawing Sierpinski Triangle and Playing Tetris* 4 | 5 | # Chip-8 Emulator 6 | This is a terminal based Chip-8 Emulator written in C++. ```chip8emu``` can be used to run any CHIP-8 program written for the original specification. Discussed on reddit in [r/programming](https://redd.it/jcdatt) and [r/emulation](https://redd.it/jbpr5p). 7 | 8 | ## What is CHIP-8 9 | CHIP-8 is an interpreted programming language from the mid 1970s. A number of classic video games have been ported to CHIP-8 including Tetris, Space Invaders, Pong(Included in the [roms](/roms) directory). An active enthusiast community exists even today and participate anually in the [Octojam](https://itch.io/jam/octojam-7) to write programs for the CHIP-8 platform. CHIP 8 programs run on a CHIP 8 virtual machine(Similar to how Java Bytecode runs on a JVM, but in a much much more simplified manner). It was made to ease game development and programming of COSMAC VIP and Telmac 1800 microcomputers. Wikipedia has a very nicely written article on [CHIP 8](https://en.wikipedia.org/wiki/CHIP-8) for further detail. 10 | 11 | ## What is an emulator 12 | Prior to the execution of a computer program, it is generally compiled to a machine-level code specific to the platform on which it is to be run. A software that enables running a program written for one platform on another is called an emulator([More details](https://en.wikipedia.org/wiki/Emulator)). ```chip8emu``` enables you to run programs written for the original CHIP-8 specification on your computer. The programs to be run on an emulator are distributed as ROM files, which are generally a memory dump of the original cartridge that contained the program. An emulator reads the program from the ROM file and executes it step by step as the original platform would. The above explanation is a simplification and a more in-depth discussion on the topic is available at [Stack Overflow](https://stackoverflow.com/questions/448673/how-do-emulators-work-and-how-are-they-written). 13 | 14 | ## How does chip8emu look 15 | The image below displays screenshots of different programs(present in the [roms](/roms) directory) running on the emulator. The emulator consists of a 64x32 display demarcated by "#" borders and displays the internal machine state below(First line displays timers and special registers and second line displays the general purpose registers). 16 | ![Screenshot 2](/res/Screenshots/animation.gif) 17 | 18 | ## How to run 19 | Clone the repository and make: 20 | ``` 21 | git clone https://github.com/LakshyAAAgrawal/c8emu 22 | cd c8emu/ 23 | make 24 | ``` 25 | To run, execute: 26 | ``` 27 | ./bin/c8emu path/to/rom.ch8 28 | ``` 29 | For example, to run the Tic-Tac-Toe program from the ```roms``` directory, execute: 30 | ``` 31 | ./bin/c8emu roms/games/Tic-Tac-Toe\ \[David\ Winter\].ch8 32 | ``` 33 | 34 | ## Input to the emulator 35 | The left-most 4x4 keys of the QWERTY keyboard("1234", "qwer", "asdf", "zxcv") are used for input as follows: 36 | 37 | | Chip 8 Key | Keyboard | 38 | | :------------- | :----------: | 39 | | 0 | 'x' | 40 | | 1 | '1' | 41 | | 2 | '2' | 42 | | 3 | '3' | 43 | | 4 | 'q' | 44 | | 5 | 'w' | 45 | | 6 | 'e' | 46 | | 7 | 'a' | 47 | | 8 | 's' | 48 | | 9 | 'd' | 49 | | A | 'z' | 50 | | B | 'c' | 51 | | C | '4' | 52 | | D | 'r' | 53 | | E | 'f' | 54 | | F | 'v' | 55 | 56 | Pressing 'l'(small 'L') during execution will cause a system interrupt and halt the emulator(exit). 57 | 58 | ## Assumptions and compatibility 59 | The emulator currently supports Chip-8 only and not any of the extension sets like SCHIP-48, XO-CHIP. 60 | The following assumptions are made: 61 | 1. Instructions ```fx55``` and ```fx65``` do not affect the value of I. 62 | 2. Instruction ```Dxyn``` clips the sprite if it goes beyond the screen in either horizontal or vertical direction. 63 | 3. Instructions ```8xyE``` and ```8xy6``` leave Vy unaffected and modify Vx in-place. 64 | 65 | ## Contributing and Bug Reports 66 | You are welcome to submit bug reports as issues and to create pull requests to solve any existing issue. 67 | 68 | ## Customization 69 | Currently, only one customization is allowed. The Chip-8 systems provides programs with an in-system font set consisting of Hex-digits(0-F). The sprites for the same are loaded from [res/sprites.bin](/res/sprites.bin). The user could provide a custom sprite map and load into the emulator by simply changing the file content. Any binary editor could be used to generate the sprites file. 70 | 71 | ## Confirmed Working ROMs 72 | These are the ROMs I have already tested and verified working on ```chip8emu```. Many others should be supported as well. Also checkout [Octojam](https://itch.io/jam/octojam-7) for more recent ROMs. 73 | - roms/demos/Maze (alt) [David Winter, 199x].ch8 74 | - roms/demos/Sierpinski [Sergey Naydenov, 2010].ch8 75 | - roms/demos/Trip8 Demo (2008) [Revival Studios].ch8 76 | - roms/demos/Zero Demo [zeroZshadow, 2007].ch8 77 | - roms/games/Cave.ch8 78 | - roms/games/Figures.ch8 79 | - roms/games/Pong (alt).ch8 80 | - roms/games/Soccer.ch8 81 | - roms/games/Space Invaders [David Winter] (alt).ch8 82 | - roms/games/Tic-Tac-Toe [David Winter].ch8 83 | - roms/games/Tetris [Fran Dachille, 1991].ch8 84 | 85 | ## ROM Credits 86 | ROMs were taken from [https://github.com/dmatlack/chip8](https://github.com/dmatlack/chip8) 87 | 88 | Many ROMs were gotten from [Revival Studios](http://www.revival-studios.com/other.php) 89 | 90 | ## Note on implementation of instructions 91 | A very interesting bug came up during the testing of the emulator. While playing the ROMs mentioned in [issue #28](https://github.com/LakshyAAAgrawal/chip8emu/issues/28), the games were mostly working except for a few instructions not behaving as expected. Stepping through the Octo debugger revealed a behaviour not explicitly documented in most Chip-8 specifications. The Instructions 8xy4, 8xy5, 8xy6, 8xy7, 8xye modify the Vf register using it as a flag. The earlier implementation of chip8emu was updating the flag register before executig the instruction, however, the Vf flag must be set after the exeuction of the instruction. This is to ensure handling of cases where Vf is itself being operated upon. 92 | 93 | ## Specification and References 94 | Mainly: 95 | 1. [http://devernay.free.fr/hacks/chip8/C8TECH10.HTM](http://devernay.free.fr/hacks/chip8/C8TECH10.HTM) 96 | 2. [http://www.cs.columbia.edu/~sedwards/classes/2016/4840-spring/designs/Chip8.pdf](http://www.cs.columbia.edu/~sedwards/classes/2016/4840-spring/designs/Chip8.pdf) 97 | 3. [http://mattmik.com/files/chip8/mastering/chip8.html](http://mattmik.com/files/chip8/mastering/chip8.html) 98 | 99 | And a lot of other sources mentioned as comments in the source code at relevant places 100 | -------------------------------------------------------------------------------- /roms/games/Programmable Spacefighters [Jef Winsor].txt: -------------------------------------------------------------------------------- 1 | 14. VIP Programmable Spacefighters 2 | 3 | Programmable Spacefighters is a combat game involving 2 to 8 spaceships competing 4 | for the domination of a contained field in space. The field of play is a 5 | two-dimensional representation of an oblong spheroid. 6 | 7 | The movement and fire of each spacefighter is controlled by programming a series of 8 | commands into each fighter's instruction storage table. Once all the spacefighters 9 | are programmed, they carry out their commands by sequentially executing a single step 10 | at a time. The play of the game ins divided into rounds. Each spacefighter may 11 | execute between 1 and 15 commands per round. 12 | 13 | The fighters all have the same appearance and capabilities. Players distinguish 14 | between fighters by examining the defense strength and position of their fighters 15 | at the begining of every round. 16 | 17 | Each fighter may face in any of 8 directions. All firing and forward movement 18 | occurs in the direction the fighter is currently facing. As a spacefighter crosses 19 | outside the two-dimensional field of play, it wraps around and re-enters on the 20 | opposite side of the field. Laser bursts terminate when they travel outside the 21 | field or hit a target. 22 | 23 | Each round consists of a selected number of steps. Each step is executed in 2 parts. 24 | During the first part, every spacefighter wishing to fire may execute a fire operation. 25 | The defense strength of any fighter which is hit by a laser burst is reduced by 1 26 | and a small flash appears. 27 | 28 | After all fighters have had an opportunity to execute fire instructions, the movement 29 | part of the step begins. Any fighter which has had its defense strength reduced to 0 30 | is destroyed and a longer flash appears. The defense strength is changed to a special 31 | code so that the fighter will no longer be programmable or take part in the execution 32 | phase. The destroyed fighter will still be open to examination during the Defense/ 33 | Position Check phase. Fighers having a defense strength greater than 0 may execute 34 | a movement command if there is one. Breaking each step into 2 such parts removes any 35 | strategic advantage to moving first. 36 | 37 | The nature of the game, in that there are variable parameters and no fixed victory 38 | conditions, allows the players a lot of freedom. Two to eight players can command 39 | single fighters. Four or less players can each command multiple fighters. Two 40 | fleets could complete to destroy their opponents' flagship first. Handicaps can 41 | be implemented through an imbalance of fighters in different fleets. An odd number 42 | of players can play in a free for all or team game. In a non-combat approach, a full 43 | complement of space fighters could be programmed to preform in kaleidoscope or other 44 | type formations. 45 | 46 | 47 | How to Play VIP Programmable Spacefighters 48 | 49 | 1. Load the CHIP-8 interpreter at 0000-01FF and 50 | the game starting at 0200. 51 | 52 | 2. Turn RUN switch on. 53 | 54 | 3. Initalization of Game. 55 | Various parameters are entered at the start of the game to determine the number 56 | of spacefighters and other aspects of play. 57 | 58 | S: Enter number of spacefighters. 1 to 8 spacefighters may be used. The program 59 | will adjust invalid enteries to the nearest valid number. 60 | 61 | D: Enter defense strength. A spacefighter may be hit from 1 to F times by laser 62 | before being destroyed. 63 | 64 | E: Enter number of command entries. A spacefighter may be programmed with 1 to F 65 | commands during the programming phase of each round. 66 | 67 | C: Enter clock duration/no clock. A timer clock 1 to F phorseks in duration may 68 | be selected. Each phorsek equals 4 seconds. The clock is not enabled if a 0 69 | is entered. The clock time is the time allowed for each fighter to be set up. 70 | 71 | F: Enter fire power available. A spacefighter may be allowed to fire 1 to F 72 | laser bursts per round. 73 | 74 | A: Enter accumulation/no accumulation. A spacefighter may be allowed to accumulate 75 | all unused laser bursts by entering 1 to F. Accumulation is not allowed if a 76 | 0 is entered. 77 | 78 | 4. Presentation of Field and Spacefighters. 79 | The two-dimensional representation of the palying fields consists of 10 vertical 80 | by 15 horizontal positons indicated by grid markings around the perimeter. The 81 | spacefighters will be in their initial positions. 82 | 83 | 5. Defense/Position Check. 84 | Enter number of spacefighter to be examined. 85 | S: Current spacefighter being examined. 86 | D: Defense strength of current spacefighter. 87 | Enter 0 to end defense/position check phase. 88 | 89 | 6. Program Spacefighters. 90 | Surviving spacefighters are programmed in ascending order. Enter 0 to begin 91 | programming first spacefighter. Defense strength and position are shown during 92 | programming. 93 | E: indicates number of enteries left after current command. 94 | C: indicates time remaining to program current fighter if clock was entered. 95 | 96 | COMMAND FUNCTION 97 | 1 Rotate 45 ccw, Move fwd 98 | 2 Move fwd 99 | 3 Rotate 45 cw, Move fwd 100 | 4 Rotate 45 ccw 101 | 5 Fire 102 | 6 Rotate 45 cw 103 | B Erase all commands and reprogram current spacefighter 104 | E End programming of current spacefighter 105 | 7-A,C,D,F Rest, No operation 106 | 0 Rest, Begin programming next spacefighter 107 | 108 | Enter 0 to begin programming each successive spacefighter. 109 | 110 | 7. Execute Commands. 111 | Enter 0 after all spacefighters are programmed to start execution of commands. 112 | 113 | 8. The recommended starting point when tryint the game out is with 1 or 2 spacefighters, 114 | any defense, F (15) entries per round, no clock, F (15) fire power and any accumulation 115 | S: 1 or 2 116 | D: 1 117 | E: F 118 | C: 0 119 | F: F 120 | A: 0 121 | 122 | Use the above to try out the movement and fire execution of the fighters. Try 123 | performing loops, figure 8's, tight turns, maximum fire coverage techniques, etc. 124 | Start out simple when first playing the game against an opponent. 125 | Eight spacefighters can get very complicated. 126 | 127 | 9. Changing different parameters creates very different effects on the play of the game. 128 | The main effect of a large number of fighters is a more complicated game. A large 129 | number of enteries per round results in a more lively game involving farsighted 130 | planning. Fewer enteries involves more thinking and reacting to immediate developments 131 | but is not without strategy when there are multiple fighters opposing each other. 132 | The clock provides pressure which can be greatly increased by the moves-to-time ratio. 133 | More fire power increases the importance of movement and positioning. Accumulation 134 | of fire power can have long range effects if there is low fire power and a large 135 | number of moves per round. 136 | -------------------------------------------------------------------------------- /src/Machine.cpp: -------------------------------------------------------------------------------- 1 | #include "../include/Machine.hpp" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | Machine::Machine(){ 10 | registers = std::vector(16, 0); 11 | stack = std::vector(32, 0); 12 | memory = std::vector(4096, 0); 13 | PC = 0x200; 14 | last_tick = std::chrono::steady_clock::now(); 15 | I = 0; 16 | SP = 0; 17 | DT = 0; 18 | ST = 0; 19 | } 20 | 21 | uint8_t Machine::random_byte(){ 22 | // From https://stackoverflow.com/questions/13445688/how-to-generate-a-random-number-in-c 23 | std::random_device dev; 24 | std::mt19937 rng(dev()); 25 | std::uniform_int_distribution dist(0,255); 26 | return dist(rng); 27 | } 28 | 29 | void Machine::setInst(std::vector& prog, uint16_t start_addr){ 30 | if((int)start_addr + (int)prog.size() - 1 < 4096){ 31 | std::copy(prog.begin(), prog.end(), memory.begin() + start_addr); 32 | }else{ 33 | throw new ProgramLargerThanMemoryException(); 34 | } 35 | } 36 | 37 | void Machine::execute(uint16_t& opcode){ 38 | std::map> direct_match{ 39 | {0x00e0, [this](uint16_t& op){ ge.cls(); }}, // 00e0 - CLS 40 | {0x00ee, [this](uint16_t& op){ PC = stack[--SP]; }}, // 00ee - Return 41 | }; 42 | std::map> first_third_fourth_match{ 43 | {0xe09e, [this](uint16_t& op){ if(kb.isKeyDown(registers[(op & 0x0f00)>>8])) PC += 2; }}, // Ex9E - SKP Vx 44 | {0xe0a1, [this](uint16_t& op){ if(!kb.isKeyDown(registers[(op & 0x0f00)>>8])) PC += 2; }}, // ExA1 - SKNP Vx 45 | {0xf007, [this](uint16_t& op){ registers[(op & 0x0f00)>>8] = DT; }}, // Fx07 - LD Vx, DT 46 | {0xf00a, [this](uint16_t& op){ registers[(op & 0x0f00)>>8] = kb.waitAndGetKeypress(); }}, // Fx0A - LD Vx, K 47 | {0xf015, [this](uint16_t& op){ DT = registers[(op & 0x0f00)>>8]; }}, // Fx15 - LD DT, Vx 48 | {0xf018, [this](uint16_t& op){ ST = registers[(op & 0x0f00)>>8]; }}, // Fx18 - LD ST, Vx 49 | {0xf01e, [this](uint16_t& op){ I += (uint16_t)registers[(op & 0x0f00)>>8]; }}, // Fx1E - ADD I, Vx 50 | {0xf029, [this](uint16_t& op){ I = ((uint16_t)registers[(op & 0x0f00)>>8])*5; }}, // Fx29 - LD F, Vx 51 | {0xf033, [this](uint16_t& op){ // Fx33 - LD B, Vx 52 | memory[I] = (registers[(op & 0x0f00)>>8] / 100); 53 | memory[I+1] = ((registers[(op & 0x0f00)>>8]%100) / 10); 54 | memory[I+2] = ((registers[(op & 0x0f00)>>8]%10) / 1); 55 | }}, 56 | 57 | // TODO - Check both the following instructions whether I = I+X+1 http://mattmik.com/files/chip8/mastering/chip8.html 58 | // Change the value of I, as per mattmik 59 | {0xf055, [this](uint16_t& op){ // Fx55 - LD [I], Vx 60 | std::copy(registers.begin(), registers.begin() + ((op & 0x0f00)>>8) + 1, memory.begin() + I); 61 | I += ((uint16_t)((op & 0x0f00)>>8)) + 1; 62 | }}, 63 | {0xf065, [this](uint16_t& op){ // Fx65 - LD Vx, [I] 64 | std::copy(memory.begin() + I, memory.begin() + I + ((op & 0x0f00)>>8) + 1, registers.begin()); 65 | I += ((uint16_t)((op & 0x0f00)>>8)) + 1; 66 | }} 67 | }; 68 | std::map> first_fourth_match{ 69 | {0x5000, [this](uint16_t& op){ PC += ((registers[(op & 0x0f00)>>8] == registers[(op & 0x00f0)>>4])? 2: 0); }}, // 5xy0 - SE Vx, Vy 70 | {0x8000, [this](uint16_t& op){ registers[(op & 0x0f00)>>8] = registers[(op & 0x00f0)>>4]; }}, // 8xy0 - LD Vx, Vy Verified 71 | {0x8001, [this](uint16_t& op){ registers[(op & 0x0f00)>>8] = registers[(op & 0x00f0)>>4] | registers[(op & 0x0f00)>>8]; }}, // 8xy1 - OR Vx, Vy 72 | {0x8002, [this](uint16_t& op){ registers[(op & 0x0f00)>>8] = registers[(op & 0x00f0)>>4] & registers[(op & 0x0f00)>>8]; }}, // 8xy2 - AND Vx, Vy 73 | {0x8003, [this](uint16_t& op){ registers[(op & 0x0f00)>>8] = registers[(op & 0x00f0)>>4] ^ registers[(op & 0x0f00)>>8]; }}, // 8xy3 - XOR Vx, Vy 74 | {0x8004, [this](uint16_t& op){ // 8xy4 - ADD Vx, Vy 75 | // Update Vf after performing the operation 76 | // As verified from Octo (http://johnearnest.github.io/Octo/index.html) 77 | uint8_t orig_val = registers[(op & 0x0f00)>>8]; 78 | registers[(op & 0x0f00)>>8] = registers[(op & 0x00f0)>>4] + registers[(op & 0x0f00)>>8]; // TEST 79 | registers[0xf] = (registers[(op & 0x0f00)>>8] < orig_val)? 1 : 0; 80 | }}, 81 | {0x8005, [this](uint16_t& op){ // 8xy5 - SUB Vx, Vy 82 | // Vf to be set after calculation 83 | // As verified from Octo (http://johnearnest.github.io/Octo/index.html) 84 | uint8_t orig_val = registers[(op & 0x0f00)>>8]; 85 | registers[(op & 0x0f00)>>8] = registers[(op & 0x0f00)>>8] - registers[(op & 0x00f0)>>4]; 86 | registers[0xf] = (registers[(op & 0x0f00)>>8] > orig_val) ? 0 : 1; 87 | }}, 88 | {0x8006, [this](uint16_t& op){ // 8xy6 - SHR Vx Vy (From mattmik) 89 | // Set Vf after performing the operation 90 | // As verified from Octo (http://johnearnest.github.io/Octo/index.html) 91 | uint8_t new_vf = registers[(op & 0x0f0)>>4] & 0x1; 92 | registers[(op & 0x0f00)>>8] = registers[(op & 0x0f0)>>4] >> 1; 93 | registers[0xf] = new_vf; 94 | }}, 95 | {0x8007, [this](uint16_t& op){ // 8xy7 - SUBN Vx, Vy 96 | // The register Vf must be set AFTER performing the operation(per Octo http://johnearnest.github.io/Octo/index.html) 97 | // Ensure that values wrap around the minimum and max to other side 98 | uint8_t orig_val = registers[(op & 0x00f0)>>4]; 99 | registers[(op & 0x0f00)>>8] = registers[(op & 0x00f0)>>4] - registers[(op & 0x0f00)>>8]; 100 | registers[0xf] = ((registers[(op & 0x0f00)>>8] > orig_val)? 0 : 1); 101 | }}, 102 | {0x800e, [this](uint16_t& op){ // 8xyE - SHL Vx Vy (From mattmik) 103 | // Set Vf after performing the operation 104 | // As verified from Octo (http://johnearnest.github.io/Octo/index.html) 105 | uint8_t new_vf = (registers[(op & 0x0f0)>>4] >> 7) & 0x01; 106 | registers[(op & 0x0f00)>>8] = registers[(op & 0x00f0)>>4] << 1; 107 | registers[0xf] = new_vf; 108 | }}, 109 | {0x9000, [this](uint16_t& op){ PC += ((registers[(op & 0x0f00)>>8] != registers[(op & 0x00f0)>>4])? 2: 0); }}, // 9xy0 - SNE Vx, Vy 110 | {0x8000, [this](uint16_t& op){ registers[(op & 0x0f00)>>8] = registers[(op & 0x00f0)>>4]; }}, // 8xy0 - LD Vx, Vy 111 | }; 112 | std::map> first_match{ 113 | {0x0000, [](uint16_t& op){}}, // To be ignored as per COWGOD 114 | {0x1000, [this](uint16_t& op){ PC = (op & 0x0fff); }}, // JP addr 115 | {0x2000, [this](uint16_t& op){ stack[SP++] = PC; PC = (op & 0x0fff); }}, // CALL addr 116 | {0x3000, [this](uint16_t& op){ PC += ((registers[(op & 0x0f00)>>8] == (op & 0x00ff))? 2: 0); }}, // 3xkk - SE Vx, byte 117 | {0x4000, [this](uint16_t& op){ PC += ((registers[(op & 0x0f00)>>8] != (op & 0x00ff))? 2: 0); }}, // 4xkk - SNE Vx, byte 118 | {0x6000, [this](uint16_t& op){ registers[(op & 0x0f00)>>8] = (op & 0x00ff); }}, // 6xkk - LD Vx, byte 119 | {0x7000, [this](uint16_t& op){ registers[(op & 0x0f00)>>8] += (op & 0x00ff); }}, // 7xkk - ADD Vx, byte 120 | {0xa000, [this](uint16_t& op){ I = (op & ((uint16_t)0x0fff)); }}, // Annn - LD I, addr 121 | {0xb000, [this](uint16_t& op){ PC = ((uint16_t)registers[0]) + ((uint16_t)(op & 0x0fff)); }}, // Bnnn - JP V0, addr 122 | {0xc000, [this](uint16_t& op){ registers[(op & 0x0f00)>>8] = (op & 0x00ff) & random_byte(); }}, // Cxkk - RND Vx, byte 123 | {0xd000, [this](uint16_t& op){ // TODO - Dxyn - DRW Vx, Vy, nibble 124 | registers[0xf] = ge.draw_sprite(memory.begin() + I, memory.begin() + I + (op & 0x000f), registers[(op & 0x0f00)>>8] % 0x40, registers[(op & 0x00f0)>>4] % 0x20); 125 | }} 126 | }; 127 | 128 | // Match the opcode and execute it 129 | auto it = direct_match.find(opcode); 130 | if(it != direct_match.end()){} 131 | else if((it = first_third_fourth_match.find(opcode & 0xf0ff)) != first_third_fourth_match.end()){} 132 | else if((it = first_fourth_match.find(opcode & 0xf00f)) != first_fourth_match.end()){} 133 | else if((it = first_match.find(opcode & 0xf000)) != first_match.end()){} 134 | 135 | if(it != first_match.end()) (it->second)(opcode); 136 | else { 137 | std::cout << "No match found for opcode " << std::hex << (int) opcode << "\n"; 138 | std::cout << "This could be because this ROM uses SCHIP or another extension which is not yet supported.\n"; 139 | std::exit(0); 140 | } 141 | } 142 | 143 | void Machine::update_timers(const std::chrono::steady_clock::time_point& now){ 144 | auto time_span = std::chrono::duration_cast>(now - last_tick); 145 | int to_reduce = time_span.count()/16; 146 | if(to_reduce > 0){ 147 | /** 148 | * Suppose the function is called after 18 milliseconds from last_tick, the 2 milliseconds 149 | * will not be account for, hence reduce that much time from "now" 150 | */ 151 | last_tick = now - std::chrono::duration(time_span.count()%16); 152 | } 153 | DT = (DT >= to_reduce) ? (DT - to_reduce) : 0; 154 | ST = (ST >= to_reduce) ? (ST - to_reduce) : 0; 155 | 156 | // TODO - Update Sound state 157 | } 158 | 159 | void Machine::print_machine_state(){ 160 | std::cout << "DT " << (int)DT << "\t" << "ST " << (int)ST << "\t" << "I " << (int) I << "\t" << "SP " << (int) SP << "\t" << "PC " << (int) PC<< "\n"; 161 | for(int i = 0; i < 16; ++i){ 162 | std::cout << "V" << std::hex << i << " " ; std::cout << (int)registers[i] << " "; 163 | } 164 | 165 | // Uncomment to display Stack 166 | /* std::cout << "\nStack: "; 167 | for(int i = 0; i < 64; ++i){ 168 | std::cout << (int)stack[i] << " "; 169 | } */ 170 | 171 | // Uncomment to display the entire memory 172 | /* 173 | std::cout << "\nMemory: "; 174 | for(int i = 0; i < 4096; ++i){ 175 | std::cout << (int)memory[i] << " "; 176 | } 177 | */ 178 | std::cout << "\n"; 179 | } 180 | 181 | void Machine::runLoop(){ 182 | while(true){ 183 | // Update display 184 | if(ge.is_dirty()){ // Check if the screen has to be updated 185 | ge.update_display(); 186 | print_machine_state(); 187 | std::cout << "Opcode " << ((uint16_t) (memory[PC]<<8) | (memory[PC+1])) << "\n"; 188 | } 189 | 190 | // Update the keyboard buffer to check for all pressed keys 191 | if(kb.update_pressed_keys()) break; // Return true indicates interrupt received 192 | 193 | // Fetch Instruction and execute 194 | uint16_t opcode = (memory[PC]<<8) | (memory[PC+1]); 195 | PC += 2; // Increment Program Counter 196 | execute(opcode); 197 | 198 | // Update timers 199 | update_timers(std::chrono::steady_clock::now()); 200 | 201 | std::this_thread::sleep_for(std::chrono::microseconds(10)); 202 | } 203 | } 204 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2020 Lakshya A Agrawal 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------