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...
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. |
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.
Creates an instance of this class.
pointerValue | The pointer value. | |
romBank | The ROM bank the pointer references. |
Creates an instance of this class.
ramBank | The RAM address the pointer refers to. | |
romBank | The ROM bank the pointer references. |
Gets the rom offset for the specified pointer and RomBank. This is useful for one-off, one-way conversions.
value | ||
RomBank |
Gets a pointer for the specified ROM bank with a RAM base address of 8000.
RomBank | The rom bank referenced. |
Gets a pointer for the specified ROM bank with a RAM base address of C000.
RomBank | The rom bank referenced. |
const int Romulus.Nes.WisePtr.AddressFilter = 0x3FFF |
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.
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.