|
ComSquare
|
#include <CPU.hpp>
Public Member Functions | |
| Memory::IMemoryBus & | getBus () |
| Get the memory bus used by this CPU. More... | |
| void | setBus (Memory::IMemoryBus &bus) |
| Set the memory bus used by this CPU. More... | |
| CPU (Memory::IMemoryBus &bus, Cartridge::Header &cartridgeHeader) | |
| Construct a new generic CPU. More... | |
| CPU (const CPU &)=default | |
| A default copy constructor. More... | |
| CPU & | operator= (const CPU &)=delete |
| A CPU is not assignable. More... | |
| ~CPU () override=default | |
| A default destructor. More... | |
| unsigned | update (unsigned maxCycle) |
| This function continue to execute the Cartridge code. More... | |
| unsigned | executeInstruction () |
| Execute a single instruction. More... | |
| unsigned | runDMA (unsigned maxCycles) |
| Run DMA's pending transfers. More... | |
| uint8_t | read (uint24_t addr) override |
| Read from the internal CPU register. More... | |
| void | write (uint24_t addr, uint8_t data) override |
| Write data to the internal CPU register. More... | |
| std::string | getValueName (uint24_t addr) const override |
| Get the name of the data at the address. More... | |
| uint24_t | getSize () const override |
| Get the size of the data. This size can be lower than the mapped data. More... | |
| std::string | getName () const override |
| Get the name of this accessor (used for debug purpose) More... | |
| Component | getComponent () const override |
| Get the component of this accessor (used for debug purpose) More... | |
| int | RESB () |
| Reset interrupt - Called on boot and when the reset button is pressed. More... | |
Public Member Functions inherited from ComSquare::Memory::AMemory | |
| uint24_t | getRelativeAddress (uint24_t addr) const override |
| Translate an absolute address to a relative address. More... | |
| void | setMemoryRegion (uint24_t start, uint24_t end) |
| Change starting and ending points of this mapped memory. More... | |
| bool | hasMemoryAt (uint24_t addr) const override |
| Return true if this component has mapped the address. More... | |
| ~AMemory () override=default | |
| A default destructor. More... | |
Public Member Functions inherited from ComSquare::Memory::IMemory | |
| virtual | ~IMemory ()=default |
| A virtual default destructor. More... | |
Public Attributes | |
| const Instruction | instructions [0x100] |
| All the instructions of the CPU. @info Instructions are indexed by their opcode. More... | |
| Callback | onReset |
| The callback triggered on reset. More... | |
| bool | IsNMIRequested = false |
| Is an NMI (non-maskable interrupt) requested. More... | |
| bool | IsIRQRequested = false |
| Is an interrupt (maskable) requested. More... | |
| bool | IsAbortRequested = false |
| Is an abort requested. More... | |
| bool | isDisabled = false |
| True if you want to disable updates of this CPU. More... | |
Private Member Functions | |
| uint24_t | _getImmediateAddr8Bits () |
| Immediate address mode is specified with a value in 8 bits. (This functions returns the 24bit space address of the value). More... | |
| uint24_t | _getImmediateAddr16Bits () |
| Immediate address mode is specified with a value in 16 bits. (This functions returns the 24bit space address of the value). More... | |
| uint24_t | _getImmediateAddrForA () |
| Immediate address mode is specified with a value in 8 or 16 bits. The value is 16 bits if the m flag is unset. (This functions returns the 24bit space address of the value). More... | |
| uint24_t | _getImmediateAddrForX () |
| Immediate address mode is specified with a value in 8 or 16 bits. The value is 16 bits if the x flag is unset. (This functions returns the 24bit space address of the value). More... | |
| uint24_t | _getDirectAddr () |
| The destination is formed by adding the direct page register with the 8-bit address to form an effective address. (This functions returns the 24bit space address of the value). More... | |
| uint24_t | _getAbsoluteAddr () |
| The effective address is formed by DBR:<16-bit exp>. (This functions returns the 24bit space address of the value). More... | |
| uint24_t | _getAbsoluteLongAddr () |
| The effective address is the expression. (This functions returns the 24bit space address of the value). More... | |
| uint24_t | _getDirectIndirectIndexedYAddr () |
| The address is DBR:$(read($($Value + D)) + Y). (This functions returns the 24bit space address of the value). More... | |
| uint24_t | _getDirectIndirectIndexedYLongAddr () |
| This mode is like the previous addressing mode, but the difference is that rather than pulling 2 bytes from the DP address, it pulls 3 bytes to form the effective address. More... | |
| uint24_t | _getDirectIndirectIndexedXAddr () |
| The direct page address is calculated and added with x. 2 bytes from the dp address combined with DBR will form the effective address. More... | |
| uint24_t | _getDirectIndexedByXAddr () |
| The DP address is added to X to form the effective address. The effective address is always in bank 0. More... | |
| uint24_t | _getDirectIndexedByYAddr () |
| The DP address is added to Y to form the effective address. The effective address is always in bank 0. More... | |
| uint24_t | _getAbsoluteIndexedByXAddr () |
| The absolute expression is added with X and combined with DBR to form the effective address. More... | |
| uint24_t | _getAbsoluteIndexedByYAddr () |
| The absolute expression is added with Y and combined with DBR to form the effective address. More... | |
| uint24_t | _getAbsoluteIndexedByXLongAddr () |
| The effective address is formed by adding the <long exp> with X. More... | |
| uint24_t | _getAbsoluteIndirectAddr () |
| 2 bytes are pulled from the <abs exp> to form the effective address. More... | |
| uint24_t | _getAbsoluteIndirectLongAddr () |
| 3 bytes are pulled from the <abs exp> to form the effective address. More... | |
| uint24_t | _getAbsoluteIndirectIndexedByXAddr () |
| The <abs exp> is added with X, then 2 bytes are pulled from that address to form the new location. More... | |
| uint24_t | _getDirectIndirectAddr () |
| 2 bytes are pulled from the direct page address to form the 16-bit address. It is combined with DBR to form a 24-bit effective address. More... | |
| uint24_t | _getDirectIndirectLongAddr () |
| 3 bytes are pulled from the direct page address to form an effective address. More... | |
| uint24_t | _getStackRelativeAddr () |
| The stack register is added to the <8-bit exp> to form the effective address. More... | |
| uint24_t | _getStackRelativeIndirectIndexedYAddr () |
| The <8-bit exp> is added to S and combined with DBR to form the base address. Y is added to the base address to form the effective address. More... | |
| void | _push (uint8_t data) |
| Push 8 bits of data to the stack. More... | |
| void | _push (uint16_t data) |
| Push 16 bits of data to the stack. More... | |
| uint8_t | _pop () |
| Pop 8 bits of data from the stack. More... | |
| uint16_t | _pop16 () |
| Pop 16 bits of data from the stack. More... | |
| uint8_t | _readPC () |
| Return the data at the program bank concatenated with the program counter. It also increment the program counter (the program bank is not incremented on overflows). More... | |
| void | _checkInterrupts () |
| Check if an interrupt is requested and handle it. More... | |
| void | _runInterrupt (uint24_t nativeHandler, uint24_t emulationHandler) |
| Run an interrupt (save state of the processor and jump to the interrupt handler) More... | |
| uint24_t | _getValueAddr (const Instruction &instruction) |
| Get the parameter address of an instruction from it's addressing mode. @info The current program counter should point to the instruction's opcode + 1. More... | |
| int | BRK (uint24_t, AddressingMode) |
| Break instruction - Causes a software break. The PC is loaded from a vector table. More... | |
| int | COP (uint24_t, AddressingMode) |
| Co-Processor Enable instruction - Causes a software break. The PC is loaded from a vector table. More... | |
| int | RTI (uint24_t, AddressingMode) |
| Return from Interrupt - Used to return from a interrupt handler. More... | |
| int | ADC (uint24_t valueAddr, AddressingMode) |
| Add with carry - Adds operand to the Accumulator; adds an additional 1 if carry is set. More... | |
| int | STA (uint24_t addr, AddressingMode) |
| Store the accumulator to memory. More... | |
| int | STX (uint24_t addr, AddressingMode) |
| Store the index register X to memory. More... | |
| int | STY (uint24_t addr, AddressingMode) |
| Store the index register Y to memory. More... | |
| int | STZ (uint24_t addr, AddressingMode) |
| Store zero to the memory. More... | |
| int | LDA (uint24_t addr, AddressingMode) |
| Load the accumulator from memory. More... | |
| int | LDX (uint24_t addr, AddressingMode) |
| Load the X index register from memory. More... | |
| int | LDY (uint24_t addr, AddressingMode) |
| Load the Y index register from memory. More... | |
| int | SEP (uint24_t valueAddr, AddressingMode) |
| Set status bits. More... | |
| int | REP (uint24_t valueAddr, AddressingMode) |
| Reset status bits. More... | |
| int | JSR (uint24_t addr, AddressingMode) |
| Jump to subroutine. More... | |
| int | JSL (uint24_t addr, AddressingMode) |
| Jump to subroutine (long) More... | |
| int | PHA (uint24_t, AddressingMode) |
| Push the accumulator to the stack. More... | |
| int | PHB (uint24_t, AddressingMode) |
| Push the data bank register to the stack. More... | |
| int | PHD (uint24_t, AddressingMode) |
| Push the direct page register to the stack. More... | |
| int | PHK (uint24_t, AddressingMode) |
| Push the program bank register to the stack. More... | |
| int | PHP (uint24_t, AddressingMode) |
| Push the processor status register to the stack. More... | |
| int | PHX (uint24_t, AddressingMode) |
| Push the x index register to the stack. More... | |
| int | PHY (uint24_t, AddressingMode) |
| Push the y index register to the stack. More... | |
| int | PLA (uint24_t, AddressingMode) |
| Pull the accumulator to the stack. More... | |
| int | PLB (uint24_t, AddressingMode) |
| Pull the data bank register to the stack. More... | |
| int | PLD (uint24_t, AddressingMode) |
| Pull the direct page register to the stack. More... | |
| int | PLP (uint24_t, AddressingMode) |
| Pull the processor status register to the stack. More... | |
| int | PLX (uint24_t, AddressingMode) |
| Pull the x index register to the stack. More... | |
| int | PLY (uint24_t, AddressingMode) |
| Pull the y index register to the stack. More... | |
| int | CLC (uint24_t, AddressingMode) |
| Clear the carry flag. More... | |
| int | CLI (uint24_t, AddressingMode) |
| Clear the Interrupt Disable flag. More... | |
| int | CLD (uint24_t, AddressingMode) |
| Clear the decimal flag. More... | |
| int | CLV (uint24_t, AddressingMode) |
| Clear the overflow flag. More... | |
| int | SEC (uint24_t, AddressingMode) |
| Set the carry Flag. More... | |
| int | SED (uint24_t, AddressingMode) |
| Set the decimal flag. More... | |
| int | SEI (uint24_t, AddressingMode) |
| Set the Interrupt Disable flag. More... | |
| int | XCE (uint24_t, AddressingMode) |
| Exchange Carry and Emulation Flags. More... | |
| int | AND (uint24_t valueAddr, AddressingMode) |
| And accumulator with memory. More... | |
| int | SBC (uint24_t valueAddr, AddressingMode) |
| Subtract with Borrow from Accumulator. More... | |
| int | TAX (uint24_t, AddressingMode) |
| Transfer A to X. More... | |
| int | TAY (uint24_t, AddressingMode) |
| Transfer A to Y. More... | |
| int | TXS (uint24_t, AddressingMode) |
| Transfer X to SP. More... | |
| int | INX (uint24_t, AddressingMode) |
| Increment the X register. More... | |
| int | INY (uint24_t, AddressingMode) |
| Increment the Y register. More... | |
| int | CPX (uint24_t valueAddr, AddressingMode) |
| Compare the X register with the memory. More... | |
| int | CPY (uint24_t valueAddr, AddressingMode) |
| Compare the Y register with the memory. More... | |
| int | BCC (uint24_t valueAddr, AddressingMode) |
| Branch if carry clear. More... | |
| int | BCS (uint24_t valueAddr, AddressingMode) |
| Branch if carry set. More... | |
| int | BEQ (uint24_t valueAddr, AddressingMode) |
| Branch if equal. More... | |
| int | BNE (uint24_t valueAddr, AddressingMode) |
| Branch if not equal. More... | |
| int | BMI (uint24_t valueAddr, AddressingMode) |
| Branch if minus. More... | |
| int | BPL (uint24_t valueAddr, AddressingMode) |
| Branch if plus. More... | |
| int | BVC (uint24_t valueAddr, AddressingMode) |
| Branch if Overflow Clear. More... | |
| int | BVS (uint24_t valueAddr, AddressingMode) |
| Branch if Overflow Set. More... | |
| int | BRA (uint24_t valueAddr, AddressingMode) |
| Branch always. More... | |
| int | BRL (uint24_t valueAddr, AddressingMode) |
| Branch always long. More... | |
| int | JMP (uint24_t valueAddr, AddressingMode) |
| Jump. More... | |
| int | JML (uint24_t valueAddr, AddressingMode) |
| Long jump. More... | |
| int | NOP (uint24_t, AddressingMode) |
| No OP. More... | |
| int | DEX (uint24_t, AddressingMode) |
| Decrement the X register. More... | |
| int | DEY (uint24_t, AddressingMode) |
| Decrement the Y register. More... | |
| int | ORA (uint24_t valueAddr, AddressingMode mode) |
| Or accumulator with memory. More... | |
| int | RTS (uint24_t, AddressingMode) |
| Return from subroutine. More... | |
| int | RTL (uint24_t, AddressingMode) |
| Return from subroutine long. More... | |
| int | CMP (uint24_t, AddressingMode) |
| Compare Accumulator with Memory. More... | |
| int | INC (uint24_t, AddressingMode) |
| Increment. More... | |
| int | DEC (uint24_t, AddressingMode) |
| Decrement. More... | |
| int | EOR (uint24_t, AddressingMode) |
| XOR, Exclusive OR accumulator with memory. More... | |
| int | TCD (uint24_t, AddressingMode) |
| Transfer 16 bit A to DP. More... | |
| int | TCS (uint24_t, AddressingMode) |
| Transfer 16 bit A to SP. More... | |
| int | TDC (uint24_t, AddressingMode) |
| Transfer DP to 16 bit A. More... | |
| int | TSC (uint24_t, AddressingMode) |
| Transfer DP to 16 bit A. More... | |
| int | TSX (uint24_t, AddressingMode) |
| Transfer SP to X. More... | |
| int | TXA (uint24_t, AddressingMode) |
| Transfer X to A. More... | |
| int | TYA (uint24_t, AddressingMode) |
| Transfer Y to A. More... | |
| int | TXY (uint24_t, AddressingMode) |
| Transfer X to Y. More... | |
| int | TYX (uint24_t, AddressingMode) |
| Transfer Y to X. More... | |
| int | TSB (uint24_t, AddressingMode) |
| Test and Set Memory Bits Against Accumulator. More... | |
| int | TRB (uint24_t, AddressingMode) |
| Test and Reset Memory Bits Against Accumulator. More... | |
| int | XBA (uint24_t, AddressingMode) |
| Exchange the B and A Accumulators. More... | |
| int | BIT (uint24_t, AddressingMode) |
| Test Memory Bits against Accumulator. More... | |
| int | ASL (uint24_t, AddressingMode) |
| Arithmetic Shift Left. More... | |
| int | LSR (uint24_t, AddressingMode) |
| int | ROL (uint24_t, AddressingMode) |
| int | ROR (uint24_t, AddressingMode) |
| int | PER (uint24_t, AddressingMode) |
| Push Effective PC Relative Indirect Address. More... | |
| int | PEI (uint24_t, AddressingMode) |
| Push Effective Indirect Address. More... | |
| int | PEA (uint24_t, AddressingMode) |
| Push Effective Absolute Address. More... | |
| int | STP (uint24_t, AddressingMode) |
| Stop the processor. More... | |
| int | WAI (uint24_t, AddressingMode) |
| Wait for Interrupt. More... | |
| int | WDM (uint24_t, AddressingMode) |
| WDM Reserved for Future Expansion (used as a code breakpoint) More... | |
| int | MVN (uint24_t, AddressingMode) |
| Block Move Next. This instruction is special: it takes parameter in the registers. More... | |
| int | MVP (uint24_t, AddressingMode) |
| Block Move Previous. This instruction is special: it takes parameter in the registers. More... | |
Private Attributes | |
| Registers | _registers {} |
| All the registers of the CPU. More... | |
| InternalRegisters | _internalRegisters {} |
| Internal registers of the CPU (accessible from the bus via addr $4200 to $421F). More... | |
| bool | _isEmulationMode = true |
| Is the CPU running in emulation mode (in 8bits) More... | |
| bool | _isStopped = false |
| If the processor is stopped (using an STP instruction), the clock is stopped and no instruction will be run until a manual reset. More... | |
| bool | _isWaitingForInterrupt = false |
| Is the processor waiting for an interrupt (if true, instructions are not run until an interrupt is requested). More... | |
| std::reference_wrapper< Memory::IMemoryBus > | _bus |
| The memory bus to use for read/write. More... | |
| Cartridge::Header & | _cartridgeHeader |
| The cartridge header (stored for interrupt vectors..) More... | |
| std::array< DMA, 8 > | _dmaChannels |
| DMA channels witch are mapped to the bus. More... | |
| bool | _hasIndexCrossedPageBoundary = false |
| True if an addressing mode with an iterator (x, y) has crossed the page. (Used because crossing the page boundary take one more cycle to run certain instructions). More... | |
Additional Inherited Members | |
Protected Attributes inherited from ComSquare::Memory::AMemory | |
| uint24_t | _start = 0 |
| The starting address mapped to this component. More... | |
| uint24_t | _end = 0 |
| The last continuous address mapped to this components. For shadows, see the MemoryShadow class. More... | |
The main CPU.
| ComSquare::CPU::CPU::CPU | ( | Memory::IMemoryBus & | bus, |
| Cartridge::Header & | cartridgeHeader | ||
| ) |
Construct a new generic CPU.
| bus | The memory bus to use to transfer data. |
| cartridgeHeader | The header used to know interrupts, main entry point etc... |
|
default |
A default copy constructor.
|
overridedefault |
A default destructor.
|
private |
Check if an interrupt is requested and handle it.
|
private |
The effective address is formed by DBR:<16-bit exp>. (This functions returns the 24bit space address of the value).
|
private |
The absolute expression is added with X and combined with DBR to form the effective address.
|
private |
The effective address is formed by adding the <long exp> with X.
|
private |
The absolute expression is added with Y and combined with DBR to form the effective address.
|
private |
2 bytes are pulled from the <abs exp> to form the effective address.
|
private |
The <abs exp> is added with X, then 2 bytes are pulled from that address to form the new location.
|
private |
3 bytes are pulled from the <abs exp> to form the effective address.
|
private |
The effective address is the expression. (This functions returns the 24bit space address of the value).
|
private |
The destination is formed by adding the direct page register with the 8-bit address to form an effective address. (This functions returns the 24bit space address of the value).
|
private |
The DP address is added to X to form the effective address. The effective address is always in bank 0.
|
private |
The DP address is added to Y to form the effective address. The effective address is always in bank 0.
|
private |
2 bytes are pulled from the direct page address to form the 16-bit address. It is combined with DBR to form a 24-bit effective address.
|
private |
The direct page address is calculated and added with x. 2 bytes from the dp address combined with DBR will form the effective address.
|
private |
The address is DBR:$(read($($Value + D)) + Y). (This functions returns the 24bit space address of the value).
|
private |
This mode is like the previous addressing mode, but the difference is that rather than pulling 2 bytes from the DP address, it pulls 3 bytes to form the effective address.
|
private |
3 bytes are pulled from the direct page address to form an effective address.
|
private |
Immediate address mode is specified with a value in 16 bits. (This functions returns the 24bit space address of the value).
|
private |
Immediate address mode is specified with a value in 8 bits. (This functions returns the 24bit space address of the value).
|
private |
Immediate address mode is specified with a value in 8 or 16 bits. The value is 16 bits if the m flag is unset. (This functions returns the 24bit space address of the value).
|
private |
Immediate address mode is specified with a value in 8 or 16 bits. The value is 16 bits if the x flag is unset. (This functions returns the 24bit space address of the value).
|
private |
The stack register is added to the <8-bit exp> to form the effective address.
|
private |
The <8-bit exp> is added to S and combined with DBR to form the base address. Y is added to the base address to form the effective address.
|
private |
Get the parameter address of an instruction from it's addressing mode. @info The current program counter should point to the instruction's opcode + 1.
|
private |
Pop 8 bits of data from the stack.
|
private |
Pop 16 bits of data from the stack.
|
private |
Push 16 bits of data to the stack.
|
private |
Push 8 bits of data to the stack.
|
inlineprivate |
Return the data at the program bank concatenated with the program counter. It also increment the program counter (the program bank is not incremented on overflows).
|
private |
Run an interrupt (save state of the processor and jump to the interrupt handler)
|
private |
Add with carry - Adds operand to the Accumulator; adds an additional 1 if carry is set.
|
private |
And accumulator with memory.
|
private |
Arithmetic Shift Left.
|
private |
Branch if carry clear.
|
private |
Branch if carry set.
|
private |
Branch if equal.
|
private |
Test Memory Bits against Accumulator.
|
private |
Branch if minus.
|
private |
Branch if not equal.
|
private |
Branch if plus.
|
private |
Branch always.
|
private |
Break instruction - Causes a software break. The PC is loaded from a vector table.
|
private |
Branch always long.
|
private |
Branch if Overflow Clear.
|
private |
Branch if Overflow Set.
|
private |
Clear the carry flag.
|
private |
Clear the decimal flag.
|
private |
Clear the Interrupt Disable flag.
|
private |
Clear the overflow flag.
|
private |
Compare Accumulator with Memory.
|
private |
Co-Processor Enable instruction - Causes a software break. The PC is loaded from a vector table.
|
private |
Compare the X register with the memory.
|
private |
Compare the Y register with the memory.
|
private |
Decrement.
|
private |
Decrement the X register.
|
private |
Decrement the Y register.
|
private |
XOR, Exclusive OR accumulator with memory.
| unsigned ComSquare::CPU::CPU::executeInstruction | ( | ) |
Execute a single instruction.
|
inline |
Get the memory bus used by this CPU.
|
overridevirtual |
Get the component of this accessor (used for debug purpose)
Implements ComSquare::Memory::IMemory.
|
overridevirtual |
Get the name of this accessor (used for debug purpose)
Implements ComSquare::Memory::IMemory.
|
overridevirtual |
Get the size of the data. This size can be lower than the mapped data.
Implements ComSquare::Memory::IMemory.
|
overridevirtual |
Get the name of the data at the address.
| addr | The address (in local space) |
Implements ComSquare::Memory::IMemory.
|
private |
Increment.
|
private |
Increment the X register.
|
private |
Increment the Y register.
|
private |
Long jump.
|
private |
Jump.
|
private |
Jump to subroutine (long)
|
private |
Jump to subroutine.
|
private |
Load the accumulator from memory.
|
private |
Load the X index register from memory.
|
private |
Load the Y index register from memory.
|
private |
|
private |
Block Move Next. This instruction is special: it takes parameter in the registers.
| X_register | Source address |
| Y_register | Destination address |
| C_register | (16 bits accumulator) Length -1 |
|
private |
Block Move Previous. This instruction is special: it takes parameter in the registers.
| X_register | Source address (last byte) |
| Y_register | Destination address (last byte) |
| C_register | (16 bits accumulator) Length -1 |
|
private |
No OP.
|
private |
Or accumulator with memory.
|
private |
Push Effective Absolute Address.
|
private |
Push Effective Indirect Address.
|
private |
Push Effective PC Relative Indirect Address.
|
private |
Push the accumulator to the stack.
|
private |
Push the data bank register to the stack.
|
private |
Push the direct page register to the stack.
|
private |
Push the program bank register to the stack.
|
private |
Push the processor status register to the stack.
|
private |
Push the x index register to the stack.
|
private |
Push the y index register to the stack.
|
private |
Pull the accumulator to the stack.
|
private |
Pull the data bank register to the stack.
|
private |
Pull the direct page register to the stack.
|
private |
Pull the processor status register to the stack.
|
private |
Pull the x index register to the stack.
|
private |
Pull the y index register to the stack.
|
overridevirtual |
Read from the internal CPU register.
@bref The CPU's internal registers starts at $4200 and finish at $421F.
| addr | The address to read from. The address 0x0 should refer to the first byte of the register. |
| InvalidAddress | will be thrown if the address is more than $1F (the number of register). |
Implements ComSquare::Memory::IMemory.
|
private |
Reset status bits.
| int ComSquare::CPU::CPU::RESB | ( | ) |
Reset interrupt - Called on boot and when the reset button is pressed.
|
private |
|
private |
|
private |
Return from Interrupt - Used to return from a interrupt handler.
|
private |
Return from subroutine long.
|
private |
Return from subroutine.
| unsigned ComSquare::CPU::CPU::runDMA | ( | unsigned | maxCycles | ) |
|
private |
Subtract with Borrow from Accumulator.
|
private |
Set the carry Flag.
|
private |
Set the decimal flag.
|
private |
Set the Interrupt Disable flag.
|
private |
Set status bits.
| void ComSquare::CPU::CPU::setBus | ( | Memory::IMemoryBus & | bus | ) |
Set the memory bus used by this CPU.
| bus | The bus to use. |
|
private |
Store the accumulator to memory.
|
private |
Stop the processor.
|
private |
Store the index register X to memory.
|
private |
Store the index register Y to memory.
|
private |
Store zero to the memory.
|
private |
Transfer A to X.
|
private |
Transfer A to Y.
|
private |
Transfer 16 bit A to DP.
|
private |
Transfer 16 bit A to SP.
|
private |
Transfer DP to 16 bit A.
|
private |
Test and Reset Memory Bits Against Accumulator.
|
private |
Test and Set Memory Bits Against Accumulator.
|
private |
Transfer DP to 16 bit A.
|
private |
Transfer SP to X.
|
private |
Transfer X to A.
|
private |
Transfer X to SP.
|
private |
Transfer X to Y.
|
private |
Transfer Y to A.
|
private |
Transfer Y to X.
| unsigned ComSquare::CPU::CPU::update | ( | unsigned | maxCycle | ) |
|
private |
Wait for Interrupt.
|
private |
WDM Reserved for Future Expansion (used as a code breakpoint)
|
overridevirtual |
Write data to the internal CPU register.
| addr | The address to write to. The address 0x0 should refer to the first byte of register. |
| data | The new value of the register. |
| InvalidAddress | will be thrown if the address is more than $1F (the number of register). |
Implements ComSquare::Memory::IMemory.
|
private |
Exchange the B and A Accumulators.
|
private |
Exchange Carry and Emulation Flags.
|
private |
The memory bus to use for read/write.
|
private |
The cartridge header (stored for interrupt vectors..)
|
private |
DMA channels witch are mapped to the bus.
|
private |
True if an addressing mode with an iterator (x, y) has crossed the page. (Used because crossing the page boundary take one more cycle to run certain instructions).
|
private |
Internal registers of the CPU (accessible from the bus via addr $4200 to $421F).
|
private |
Is the CPU running in emulation mode (in 8bits)
|
private |
If the processor is stopped (using an STP instruction), the clock is stopped and no instruction will be run until a manual reset.
|
private |
Is the processor waiting for an interrupt (if true, instructions are not run until an interrupt is requested).
| const Instruction ComSquare::CPU::CPU::instructions[0x100] |
All the instructions of the CPU. @info Instructions are indexed by their opcode.
| bool ComSquare::CPU::CPU::IsAbortRequested = false |
Is an abort requested.
| bool ComSquare::CPU::CPU::isDisabled = false |
True if you want to disable updates of this CPU.
| bool ComSquare::CPU::CPU::IsIRQRequested = false |
Is an interrupt (maskable) requested.
| bool ComSquare::CPU::CPU::IsNMIRequested = false |
Is an NMI (non-maskable interrupt) requested.
| Callback ComSquare::CPU::CPU::onReset |
The callback triggered on reset.
1.8.17