Common Lisp Package: ROMREADER

Homepage: <a href="http://github.com/redline6561/romreader">Github</a>

README:

# romreader ## An extensible reader of ROM formats in portable CL. ### Install You are strongly encouraged to use this library via [Quicklisp](http://quicklisp.org/). Simply start your lisp and run: ```(ql:quickload 'romreader)```. ### Getting Started If you're reading this, you're probably interested in parsing ROMs using Lisp. There are 3 things you can do with romreader: parse a rom it [supports](http://redlinernotes.com/docs/romreader.html#*valid-formats*_vars), teach it how to parse a new format, and access parts of a loaded rom. * Parsing a supported format is as easy as calling ```(load-rom "path/to/my/rom.format")```. * Teaching romreader to parse a new rom is done using [```defreader```](http://redlinernotes.com/docs/romreader.html#defreader_func). For an example, see [the NES reader](https://github.com/redline6561/romreader/blob/master/src/nes.lisp#L96). * Accessing [slots of a rom instance](http://redlinernotes.com/docs/romreader.html#rom_class) is done with ```rom-metadata```, ```rom-binary```, and ```rom-format```. Thus far, I have been using a plist to store metadata and a vector to store the binary but feel free to use your own representations. ```rom-binary``` and ```rom-metadata``` don't care. :) ### Docs [API Docs](http://redlinernotes.com/docs/romreader.html)

FUNCTION

Public

LOAD-ROM (PATH)

Check to see if PATH exists and is a supported ROM format. If so, call the appropriate reader and return a ROM instance, otherwise error.

Private

Undocumented

KSYMB (&REST ARGS)

MKSTR (&REST ARGS)

MACRO

Public

DEFREADER (FORMAT &BODY BODY)

Define a reader for FORMAT. FORMAT should be a pathname-type (i.e. file extension). FORMAT will be added to *valid-formats* if needed. BODY executes inside a WITH-OPEN-FILE binding 'in' to a binary-stream of the ROM. The BODY should return a list like so: (rom-metadata rom-binary).

GENERIC-FUNCTION

Private

PARSE-ROM (FORMAT PATHNAME)

Parse the file located at PATHNAME as a ROM of the given FORMAT. FORMAT should be a symbol denoting a file extension. Returns a ROM instance.

Undocumented

FILENAME (CONDITION)

SLOT-ACCESSOR

Public

ROM-BINARY (ROM)

The Return a bytevector of the ROM data.

ROM-CHR (ROM)

The Return the character/sprite data from the ROM.

SETFROM-CHR (NEW-VALUE OBJECT)

Set the Return the character/sprite data from the ROM.

ROM-FORMAT (ROM)

The Return the file extension of the ROM as a symbol.

ROM-METADATA (ROM)

The Return a plist of the ROM metadata.

ROM-PRG (ROM)

The Return the program data from the ROM.

SETFROM-PRG (NEW-VALUE OBJECT)

Set the Return the program data from the ROM.

VARIABLE

Public

*VALID-FORMATS*

A list of ROM formats with implemented readers. Do not manually modify this.

CLASS

Public

Undocumented

ROM

CONDITION

Public

ROMREADER-ERROR

The base condition for all errors in ROMREADER.

Private

UNKNOWN-FORMAT

Signalled when an appropriate parser method could not be found for the extension of the given ROM pathname.