baryuxn 0.3.0

An implementation of the Uxn stack machine as a no_std library.
Documentation
//! # Uxn stack machine
//! Represents a fully functional [Uxn stack-machine](https://wiki.xxiivv.com/site/uxn.html).
//!
//! Execution of code is done using the [`UxnVector`](crate::UxnVector) abstraction. It is an iterator
//! requiring a starting address. It then runs until encountering a `BRK` instruction.
//! Using iterators eases up the interaction.
//! ```rust
//! # use baryuxn::*;
//! # struct NullDevices;
//! # impl UxnDeviceBus for NullDevices {
//! # fn read(&mut self, _machine: &mut UxnMachineState, _address: u8) -> u8 { 0 }
//! # fn write(&mut self, _machine: &mut UxnMachineState, _address: u8, _byte: u8) {}
//! # }
//! # fn main() {
//!     # let mut mem = [0; 0x10000];
//!     # let mut dev = NullDevices;
//!
//!     # let mut machine = UxnMachineState::new();
//!     for (opcode, pc) in UxnVector::new(0x100, &mut machine, &mut mem, &mut dev) {
//!         println!("{pc}: {opcode}");
//!     }
//! # }
//! ```

use crate::stack::UxnStack;

/// The Uxn machine, able to execute [Uxntal instructions](https://wiki.xxiivv.com/site/uxntal_opcodes.html).
#[derive(Debug, Clone, Copy, Eq, PartialEq, PartialOrd, Ord, Hash, Default)]
pub struct UxnMachineState {
    pub work_stack: UxnStack,
    pub return_stack: UxnStack,
}
impl UxnMachineState {
    /// Creates a new [`UxnMachineState`] with empty stacks.
    pub fn new() -> Self {
        Self::default()
    }
}