The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Games::NES::ROM - View information about an NES game from a ROM file

SYNOPSIS

    use Games::NES::ROM;
    
    # Read in the ROM
    my $rom = Games::NES::ROM->new( 'file.nes' );

    # Access the details
    print 'PRG Banks: ', $rom->PRG_count, "\n";
    print 'CHR Banks: ', $rom->CHR_count, "\n";
    # etc...
    
    # View the CRC checksum
    print 'CRC: ', $rom->CRC;

DESCRIPTION

This module loads the details of an NES rom file. An NES ROM file is layed out as follows:

    +-----------+---------------+---------+---------+ Header
    | NES\0x01a | [PC] [CC] X X | X X X X | X X X X | 16 Bytes
    +-----------+---------------+---------+---------+
    |                                               |
    |          PRG Banks (PC * 16384 Bytes)         |
    |                                               |
    +-----------------------------------------------+
    |                                               |
    |          CHR Banks (CC * 8192 Bytes)          |
    |                                               |
    +-----------------------------------------------+
    |                                               |
    |          Title (128 Bytes - Optional)         |
    |                                               |
    +-----------------------------------------------+

INSTALLATION

    perl Makefile.PL
    make
    make test
    make install

METHODS

new( [$filename] )

Creates a new instance of the module. An optional filename argument may be passed to immediately load the data.

load( $file )

Reads the ROM structure into memory.

sprite( $chr_bank, $index )

Returns the raw (composite) sprite in the specified CHR bank at the specified array index.

ACCESSORS

The following accessors are available:

  • identifier - sould be "NES\0x01a"

  • PRG_count - number of PRG banks

  • CHR_count - number of CHR banks

  • PRG_banks - arrayref of PRG data

  • CHR_banks - array ref of CHR data

  • mapper - the mapper number

  • has_trainer - is there trainer data?

  • trainer - the trianer data

  • horizontal_mirroring - does it use horizontal mirroring?

  • vertical_mirroring - does it use veritcal mirroring?

  • VRAM - uses VRAM?

  • SRAM - uses SRAM?

  • CRC - CRC checksum

  • title - game title if available

SEE ALSO

  • http://www.sadistech.com/nesromtool/romdoc.html

AUTHOR

Brian Cassidy <bricas@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2007 by Brian Cassidy

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.