Documentation ¶
Overview ¶
Package program represents an NES program.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CHR ¶ added in v0.2.2
type CHR []byte
CHR defines CHR data.
func (CHR) GetLastNonZeroByte ¶ added in v0.2.2
GetLastNonZeroByte searches for the last byte in CHR that is not zero.
type Checksums ¶
Checksums contains the CRC32 checksums to identify the PRG and CHR parts of the ROM.
type Offset ¶
type Offset struct { // data byte or all opcode bytes that are part of the instruction OpcodeBytes []byte // WriteCallback is a custom callback function that gets called before the offset is // written, this allows custom bank switch code to be written at specific offsets. // The output of bundled data bytes will be interrupted. WriteCallback WriteCallbackFunc Type OffsetType Address uint16 HasAddressComment bool Label string // name of label or subroutine if identified as a jump destination Code string // asm output of this instruction Comment string LabelComment string }
Offset defines the content of an offset in a program that can represent data or code.
func (*Offset) ClearType ¶
func (o *Offset) ClearType(typ OffsetType)
ClearType unsets the type of the offset.
func (*Offset) IsType ¶
func (o *Offset) IsType(typ OffsetType) bool
IsType returns whether the offset is of given type.
func (*Offset) SetType ¶
func (o *Offset) SetType(typ OffsetType)
SetType sets the type of the offset.
type OffsetType ¶
type OffsetType uint8
OffsetType defines the type of a program offset.
const ( UnknownOffset OffsetType = 0 CodeOffset OffsetType = 1 << iota DataOffset CodeAsData // for branches into instructions and unofficial instructions CallDestination // opcode is the destination of a jsr call, indicating a subroutine JumpEngine JumpTable FunctionReference // reference to a function )
addressing modes.
type PRGBank ¶ added in v0.2.2
type PRGBank struct { PRG []Offset // PRG-ROM banks Constants map[string]uint16 Variables map[string]uint16 }
PRGBank defines a PRG bank.
func NewPRGBank ¶ added in v0.2.2
NewPRGBank creates a new PRG bank.
func (PRGBank) GetLastNonZeroByte ¶ added in v0.2.2
func (bank PRGBank) GetLastNonZeroByte(options *options.Disassembler) (int, error)
GetLastNonZeroByte searches for the last byte in PRG that is not zero.
type Program ¶
type Program struct { PRG []*PRGBank // PRG-ROM banks CHR CHR // CHR-ROM data RAM byte // PRG-RAM offsets Trainer []byte CodeBaseAddress uint16 Checksums Checksums Handlers Handlers Battery byte Mirror cartridge.MirrorMode Mapper byte VideoFormat byte // keep constants and variables in the banks and global in the app to let the chosen assembler decide // how to output them Constants map[string]uint16 Variables map[string]uint16 }
Program defines an NES program that contains code or data.
type WriteCallbackFunc ¶ added in v0.2.2
WriteCallbackFunc is a custom callback function that gets called before the offset is written.