anddani/nelm/1.0.0

NES

Headless NES emulator core.

NES

type NES

The state of the emulated console: CPU, PPU, memory, controllers, and the inserted cartridge.

A NES with no cartridge inserted.

Use fromRom to load a game.

fromRom : Bytes -> Result Error NES

Inserts a cartridge into the NES and presses reset.

Presses the reset button, restarting the currently inserted game.

step : NES -> ( NES, Int )

Advances one step (instruction) in the NES.

framebuffer : NES -> Array (Array Int)

Gets the current framebuffer from the PPU.

Use this to draw pixels on the screen.

frameCount : NES -> Int

Gets the current frame count from the PPU.

When the frame counter advances, draw a new frame on the screen.

type Button
= A
| B
| Select
| Start
| Up
| Down
| Left
| Right

A button on a NES controller.

= Controller1
| Controller2

The controller port a button press is sent to.

type alias Pressed =
Bool

Whether a button is held down (True) or released (False).

Register a key press (or release)