• Stars
    star
    371
  • Rank 115,103 (Top 3 %)
  • Language
    Haskell
  • License
    BSD 3-Clause "New...
  • Created over 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🎮 NES Emulator written in Haskell

hnes

Build Status

Welcome to hnes. hnes is a NES emulator written in Haskell.

Screenshots

Mapper support

The following mappers are supported:

  • NROM (0)
  • UNROM (2)
  • AOROM (7)

Lots of games run, but more don't. You can see which roms are compatible here: http://tuxnes.sourceforge.net/nesmapper.txt The best games seem to be MMC3, so that is a priority.

Mappers are basically custom memory modules that exist on the cartridges themselves, that allow referencing more memory than the NES originally shipped with. Sometimes they even do computation. A very clever idea, but a nightmare to emulate, since each mapper has to be emulated as well

Controls

Nintendo Emulator
Up, Down, Left, Right Arrow Keys
Start Enter
Select Space
A Z
B X

Building

Get Stack for building Haskell projects.

Windows instructions:

$ stack exec -- pacman -Sy mingw-w64-x86_64-pkg-config mingw-w64-x86_64-SDL2
$ stack build

OS X instructions:

$ brew install sdl2
$ stack build

Ubuntu Linux instructions:

$ sudo apt-get install libsdl2-dev
$ stack build

FreeBSD instructions:

$ pkg install sdl2
$ stack build

Running

To run:

stack exec -- hnes roms/tests/cpu/nestest/nestest.nes

Task list

  • Basic structure
  • Mappers
    • Loading roms
    • Mappers
      • UNROM
      • NROM
      • AOROM
      • CNROM
      • MMC1
      • MMC3
  • CPU
    • All official opcodes
    • All illegal opcodes
    • Nestest passing
    • Blarggs CPU test roms passing
  • PPU
    • SDL integration
    • Background rendering
    • Scrolling
    • Sprite rendering
    • VBlank timing for Battletoads edge case
  • APU
  • Controller input handled
  • Performance tuning
  • Command line interface
    • Parse args
    • Use optparse-applicative
    • Some debug params?

Tests

There's a small test suite that is used to check for CPU and PPU accuracy. They use test roms rather than hand coding tests.

Just run stack test:

Known issues.

There are so many, where do I even begin.

  • Performance is pretty average still. I get around 80 fps on my 2015 i5 MacBook.
  • VBlank timing is off. I don't know the exact reasons, but it causes scrolling issues.

More Repositories

1

search-engine-scala

JavaScript
21
star
2

scalagb

A Z80 Gameboy emulator written in Scala
Scala
17
star
3

imgui-haskell

Haskell bindings for Dear Imgui
Haskell
12
star
4

scalasimpleray

A readable (hopefully) implementation of a very basic raytracer in Scala.
Scala
7
star
5

flappy-bird-corona

Lua
5
star
6

sublime-java-decompilation

Python
4
star
7

csgo-demo-voice-extractor

Extracts voice comms as wave files from a CSGO demo
TypeScript
4
star
8

bytepath-rs

A port of BYTEPATH to Rust
Rust
4
star
9

redmine_gitbranchdisplay

Basic plugin to see branches an issues revision lies on. Also closest tags.
Ruby
3
star
10

rnes

🎮 NES Emulator written in Rust
Assembly
3
star
11

http4sbin

A clone of httpbin using http4s
Scala
3
star
12

aoc2017

Advent of Code 2017 solutions in Haskell
Haskell
3
star
13

scala-js-chip8

Scala
3
star
14

ftp-test

Example of ftp-server
Haskell
2
star
15

INB373-Assignment01

C#
2
star
16

HaskellProjectEuler

Project Euler in Haskell
Haskell
2
star
17

rasty

Rust
2
star
18

playtest

JavaScript
2
star
19

bass_assignment

Python
1
star
20

scalacloth

A cloth simulation in Scala
Scala
1
star
21

QUTUniHomework

Repo containing homework.
Java
1
star
22

android-bootcamp-rest-server

android-bootcamp-rest-server.herokuapp.com
Ruby
1
star
23

BFPGScala

Just a container for the Brisbane Functional Group Exercises
Scala
1
star
24

sample_app

Sample app for Ruby tutorial
Ruby
1
star
25

m3u8-example

JavaScript
1
star
26

smith

Smith
TypeScript
1
star
27

scratchpad

TypeScript
1
star
28

ship

Scala
1
star
29

dtop

Fun with Rust on a Saturday arvo
HTML
1
star
30

search-engine-scala-pres

Presentation for search engine project
JavaScript
1
star
31

wai-play

Learning Haskell via wai
Haskell
1
star
32

hlox

A Haskell implementation of a Lox intepreter
Haskell
1
star
33

scalachip8

A Chip8 Emulator in Scala
Scala
1
star
34

hico

Haskell
1
star
35

BetterLEX

A better alternative to QUTs LEX survey
Ruby
1
star
36

android-hackathon

Java
1
star
37

dailyprogrammer

A repo containing reddit.com/r/dailyprogrammer solutions
Scala
1
star