Public Member Functions | Static Public Member Functions | Public Attributes | Properties

Romulus.Nes.WisePtr Struct Reference

Represents a pointer bound to a specific 16k bank of RAM addresses and a specific 16k bank of ROM, for easy conversion between Ptr16 values and ROM offsets. READ REMARKS. More...

List of all members.

Public Member Functions

 WisePtr (pCpu pointerValue, Bank16 romBank)
 Creates an instance of this class.
 WisePtr (Bank16 ramBank, Bank16 romBank)
 Creates an instance of this class.

Static Public Member Functions

static WisePtr From8000 (Bank16 RomBank)
 Gets a pointer for the specified ROM bank with a RAM base address of 8000.
static WisePtr FromC000 (Bank16 RomBank)
 Gets a pointer for the specified ROM bank with a RAM base address of C000.
static pUhRom Convert (pCpu value, Bank16 RomBank)
 Gets the rom offset for the specified pointer and RomBank. This is useful for one-off, one-way conversions.

Public Attributes

pCpu value
const int BankFilter = 0xFFFC000
 Defines the portion of an offset that represents a bank index.
const int AddressFilter = 0x3FFF
 Defines the portion of an offset that represents an address within a bank.

Properties

Bank16 RomBank [get, set]
 Gets or sets the ROM bank the pointer refers to.
pCpu Value [get, set]
 Gets/sets the pointer value.
int BankOffset [get, set]
 Gets or sets the offset relative to bank's base address.
pUhRom RomOffset [get, set]
 Gets/sets the ROM offset this pointer identifies. An exception will be thrown if the offset specified is outside the address space of the correct ROM bank.c.

Detailed Description

Represents a pointer bound to a specific 16k bank of RAM addresses and a specific 16k bank of ROM, for easy conversion between Ptr16 values and ROM offsets. READ REMARKS.

This type is intended for the internal use of objects, and is less suitable to be exposed by a class' public interface. A WisePtr variable should generally be constructed/assigned only ONCE. This provides a more declarative way of idendifying which Ram/Rom banks a pointer should refer to. Then, by only reading/writing the pointer value via the WisePtr functions and properties one can be sure that the values read and written fall within the address space of the correct banks, and makes conversion between pointers and ROM offsets easy and less error prone. Assigning another WisePtr to an already assigned variable defeats the safeguard by creating the possibility of changing which banks the pointer can refer to.


Constructor & Destructor Documentation

Romulus.Nes.WisePtr.WisePtr ( pCpu  pointerValue,
Bank16  romBank 
)

Creates an instance of this class.

Parameters:
pointerValue The pointer value.
romBank The ROM bank the pointer references.
Romulus.Nes.WisePtr.WisePtr ( Bank16  ramBank,
Bank16  romBank 
)

Creates an instance of this class.

Parameters:
ramBank The RAM address the pointer refers to.
romBank The ROM bank the pointer references.

Member Function Documentation

static pUhRom Romulus.Nes.WisePtr.Convert ( pCpu  value,
Bank16  RomBank 
) [static]

Gets the rom offset for the specified pointer and RomBank. This is useful for one-off, one-way conversions.

Parameters:
value 
RomBank 
Returns:
static WisePtr Romulus.Nes.WisePtr.From8000 ( Bank16  RomBank  )  [static]

Gets a pointer for the specified ROM bank with a RAM base address of 8000.

Parameters:
RomBank The rom bank referenced.
Returns:
A new WisePtr.
static WisePtr Romulus.Nes.WisePtr.FromC000 ( Bank16  RomBank  )  [static]

Gets a pointer for the specified ROM bank with a RAM base address of C000.

Parameters:
RomBank The rom bank referenced.
Returns:
A new WisePtr.

Member Data Documentation

Defines the portion of an offset that represents an address within a bank.

const int Romulus.Nes.WisePtr.BankFilter = 0xFFFC000

Defines the portion of an offset that represents a bank index.


Property Documentation

int Romulus.Nes.WisePtr.BankOffset [get, set]

Gets or sets the offset relative to bank's base address.

Bank16 Romulus.Nes.WisePtr.RomBank [get, set]

Gets or sets the ROM bank the pointer refers to.

pUhRom Romulus.Nes.WisePtr.RomOffset [get, set]

Gets/sets the ROM offset this pointer identifies. An exception will be thrown if the offset specified is outside the address space of the correct ROM bank.c.

pCpu Romulus.Nes.WisePtr.Value [get, set]

Gets/sets the pointer value.


The documentation for this struct was generated from the following file:
 All Classes Namespaces Functions Variables Enumerations Properties Events