Struct z80emu::z80::Z80

source ·
pub struct Z80<Q: Flavour> {
    pub flavour: Q,
    /* private fields */
}
Expand description

Emulates a Zilog’s Z80 CPU in various “flavours” via the Cpu trait.

Fields§

§flavour: Q

Exposes an instance of the Flavour implementation.

Implementations§

Creates a new instance of Z80 with the state just after RESET.

Retrieves the internal state of the MEMPTR register.

Changes the internal state of the MEMPTR register.

The content of the R register is lazy evaluated when its value is being set or retrieved. This method normalizes the internal state of the R register, so e.g. two instances of Z80 can be compared if they represent the same CPU state.

Converts between instances of Z80 with different flavours.

NOTE: Some Flavour related information may be lost during conversion.

Converts between instances of Z80 with different flavours.

NOTE: Some Flavour related information may be lost during conversion.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Instantly resets the Cpu to its initial state.
Returns the current value of the program counter.
Sets the current value of the program counter.
Returns the current value of the stack pointer.
Sets the current value of the stack pointer.
Returns the Accumulator value as an unsigned 8-bit integer.
Sets the Accumulator value from an unsigned 8-bit integer.
Returns the current state of the Flags register.
Sets the current state of the Flags register.
Increases the memory refresh counter.
Adds the arbitrary value to the memory refresh counter. This can be used to emulate the Cpu in the HALT state without executing the busy loop. Read more
Returns the current value of the memory refresh register R.
Sets the memory refresh register R value.
Returns the current value of the interrupt page I register.
Sets the current value of the interrupt page I register.
Returns the current memory refresh address.
Returns values of interrupt flip-flops (iff1, iff2).
Sets the values of interrupt flip-flops.
Forces Cpu to enter the HALT state. This doesn’t involve Clock and happens instantly. This also can be done by executing HALT instruction with Cpu::execute_instruction. Read more
Returns true if the Cpu is in the HALT state.
Returns the current interrupt mode.
Sets the interrupt mode.
Swaps the AF register with its alternative counterpart AF'.
Swaps the BC, DE and HL registers with their alternative counterparts BC', DE' and HL'.
Returns the content of the selected 8-bit register. Read more
Sets the content of the selected 8-bit register. Read more
Returns the content of the selected pair of registers as a tuple of 8-bit unsigned integers. Read more
Returns the content of the selected pair of alternative registers as a tuple of 8-bit unsigned integers. Read more
Returns the content of the selected pair of registers as an unsigned 16-bit integer.
Returns the content of the selected pair of alternative registers as an unsigned 16-bit integer.
Sets the content of the selected pair of registers. Read more
Sets the content of the selected pair of registers as an unsigned 16-bit integer.
Returns the content of one of the index registers as a tuple of 8-bit unsigned integers. Read more
Returns the content of one of the index registers as a 16-bit unsigned integer. Read more
Sets the content of one of the index registers. Read more
Sets the content of one of the index registers as a 16-bit unsigned integer. Read more
Returns true if the Cpu will accept the interrupt request before executing the next opcode.
Returns true if the Cpu will accept the non-maskable interrupt before executing the next opcode.
Restores the content of the interrupt flip-flop 1 from the content of the interrupt flip-flop 2. This is what RETN instruction usually does. Read more
Disables the maskable interrupts by resetting both interrupt flip-flops to Off. Read more
Enabes the maskable interrupts by setting both interrupt flip-flops to On. Read more
Returns true if the last command executed was EI.
Returns true if the last command executed was a 0xDD or a 0xFD prefix. Read more
Returns the prefix value after executing the last command. Read more
Requests a maskable interrupt. Read more
Attempts to trigger a non-maskable interrupt. Read more
Executes a single instruction given as code. If the instruction is a first byte of the multi-byte instruction the rest of the instruction body will be fetched via calls to Memory::read_opcode. Read more
Executes the next instruction present in the Memory at the program counter fetched via Memory::read_opcode. Read more
Executes instructions until Clock reaches the given limit or when other conditions are met. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.