Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd/nes-viewer
README.md
nes.go

README.md

nes

This is an example on how to register a custom image format and reading NES ROMs. After importing it with _ you can use it with image.Decode. It uses black, red, green and blue as colors and shows 16 tiles per row.

import (
	"image"
	"os"

	_ "github.com/BakeRolls/nes"
)

func main() {
	r, err := os.Open("rom.nes")
	if err != nil {
		log.Fatal(err)
	}
	defer r.Close()
	img, _, err := image.Decode(r)
	if err != nil {
		log.Fatal(err)
	}
}

To view it in action, see the NES viewer which opens a window displaying the sprites of a given ROM.