Struct z80emu::RegisterPair

source ·
pub struct RegisterPair(/* private fields */);
Expand description

A struct that represents a register pair, that can be treated as a single 16-bit register or a separate 8-bit (MSB/LSB) registers.

Implementations§

source§

impl RegisterPair

source

pub fn ptr8hi(&mut self) -> *mut u8

source

pub fn ptr8lo(&mut self) -> *mut u8

source

pub fn get16(self) -> u16

source

pub fn set16(&mut self, val: u16)

source

pub fn get8hi(self) -> u8

source

pub fn get8lo(self) -> u8

source

pub fn set8hi(&mut self, val: u8)

source

pub fn set8lo(&mut self, val: u8)

source

pub fn get(self) -> (u8, u8)

Returns values of this pair of registers as a tuple of (MSB, LSB).

source

pub fn set(&mut self, hi: u8, lo: u8)

source

pub fn inc16(&mut self)

source

pub fn add16(&mut self, val: u16)

source

pub fn dec16(&mut self)

source

pub fn dec16_is_zero(&mut self) -> bool

Subtracts 1 from the 16-bit register and returns true if the result is 0.

source

pub fn op16<F: FnOnce(u16) -> (u8, u8)>(&mut self, op: F)

Applies op to the 16-bit register value and modifies it in place.

source

pub fn op8hi<F: FnOnce(u8) -> u8>(&mut self, op: F)

Applies op to the 8-bit high half value and modifies it in place.

source

pub fn op8lo<F: FnOnce(u8) -> u8>(&mut self, op: F)

Applies op to the 8-bit low half value and modifies it in place.

Trait Implementations§

source§

impl Clone for RegisterPair

source§

fn clone(&self) -> RegisterPair

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for RegisterPair

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for RegisterPair

source§

fn default() -> RegisterPair

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for RegisterPair

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<[u8; 2]> for RegisterPair

source§

fn from(pair: [u8; 2]) -> Self

Converts to this type from the input type.
source§

impl From<(u8, u8)> for RegisterPair

source§

fn from((hi, lo): (u8, u8)) -> Self

Converts to this type from the input type.
source§

impl From<i16> for RegisterPair

source§

fn from(int: i16) -> Self

Converts to this type from the input type.
source§

impl From<u16> for RegisterPair

source§

fn from(uint: u16) -> Self

Converts to this type from the input type.
source§

impl Hash for RegisterPair

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for RegisterPair

source§

fn eq(&self, other: &RegisterPair) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for RegisterPair

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Copy for RegisterPair

source§

impl Eq for RegisterPair

source§

impl StructuralPartialEq for RegisterPair

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,