Tx2

Struct Tx2 

Source
pub struct Tx2 {
    control: ControlUnit,
    mem: MemoryUnit,
    devices: DeviceManager,
    next_execution_due: Option<Duration>,
    next_hw_poll_due: Duration,
    run_mode: RunMode,
}
Expand description

Tx2 emulates the TX-2 computer, with peripherals.

Fields§

§control: ControlUnit§mem: MemoryUnit§devices: DeviceManager§next_execution_due: Option<Duration>§next_hw_poll_due: Duration§run_mode: RunMode

Implementations§

Source§

impl Tx2

Source

pub fn new( ctx: &Context, panic_on_unmasked_alarm: PanicOnUnmaskedAlarm, mem_config: &MemoryConfiguration, ) -> Tx2

Create a new instance.

Source

pub fn get_status_of_alarm(&self, name: &str) -> Option<AlarmStatus>

Source

pub fn get_alarm_statuses(&self) -> Vec<AlarmStatus>

Source

pub fn set_alarm_masked( &mut self, kind: AlarmKind, masked: bool, ) -> Result<(), Alarm>

Source

pub fn set_run_mode(&mut self, run_mode: RunMode)

Source

pub fn set_next_execution_due( &mut self, now: Duration, newval: Option<Duration>, )

Update the emulator’s idea of when the next instruction should begin execution.

Source

fn set_next_hw_poll_due(&mut self, now: Duration, newval: Duration)

Update the emulator’s idea of when the next hardware state change might be.

Source

pub fn codabo( &mut self, ctx: &Context, reset_mode: &ResetMode, ) -> Result<(), Alarm>

Emulate the user pressing the CODABO key.

Source

fn on_input_event( &mut self, ctx: &Context, unit: Unsigned6Bit, event: InputEvent, ) -> Result<InputFlagRaised, InputEventError>

Source

pub fn mount_paper_tape( &mut self, ctx: &Context, data: Vec<u8>, ) -> Result<InputFlagRaised, InputEventError>

Emulate the effect of the user mounting a paper tape.

Source

pub fn lw_input( &mut self, ctx: &Context, unit: Unsigned6Bit, codes: &[Unsigned6Bit], ) -> Result<(bool, InputFlagRaised), String>

Emulate the effect of the user pressing a key on one of the Lincoln Writers.

Source

pub fn next_tick(&self) -> Duration

Return the time at which the emulator would like to next be called.

Source

fn poll_hw(&mut self, ctx: &Context) -> Result<(), Alarm>

Source

fn execute_one_instruction( &mut self, ctx: &Context, ) -> Result<(u64, Option<OutputEvent>), UnmaskedAlarm>

Source

pub fn tick( &mut self, ctx: &Context, ) -> Result<Option<OutputEvent>, UnmaskedAlarm>

Perform whatever emulation action is due now. If the TX-2 executes a TSD instruction, return the I/O data being emitted.

Source

pub fn unmasked_alarm_active(&self) -> bool

Source

pub fn drain_alarm_changes(&mut self) -> BTreeMap<AlarmKind, AlarmStatus>

Source

pub fn disconnect_all_devices(&mut self, ctx: &Context) -> Result<(), Alarm>

Source

fn extended_state_of_software_sequence( &self, seq: Unsigned6Bit, index_value: Signed18Bit, ) -> ExtendedUnitState

Source

fn software_sequence_statuses( &self, ) -> BTreeMap<Unsigned6Bit, ExtendedUnitState>

Source

pub fn sequence_statuses( &mut self, ctx: &Context, ) -> Result<BTreeMap<Unsigned6Bit, ExtendedUnitState>, Alarm>

Source

pub fn drain_device_changes( &mut self, ctx: &Context, ) -> Result<BTreeMap<Unsigned6Bit, ExtendedUnitState>, Alarm>

Trait Implementations§

Source§

impl From<Tx2> for JsValue

Source§

fn from(value: Tx2) -> Self

Converts to this type from the input type.
Source§

impl FromWasmAbi for Tx2

Source§

type Abi = u32

The Wasm ABI type that this converts from when coming back out from the ABI boundary.
Source§

unsafe fn from_abi(js: u32) -> Self

Recover a Self from Self::Abi. Read more
Source§

impl IntoWasmAbi for Tx2

Source§

type Abi = u32

The Wasm ABI type that this converts into when crossing the ABI boundary.
Source§

fn into_abi(self) -> u32

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
Source§

impl LongRefFromWasmAbi for Tx2

Source§

type Abi = u32

Same as RefFromWasmAbi::Abi
Source§

type Anchor = RcRef<Tx2>

Same as RefFromWasmAbi::Anchor
Source§

unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor

Same as RefFromWasmAbi::ref_from_abi
Source§

impl OptionFromWasmAbi for Tx2

Source§

fn is_none(abi: &Self::Abi) -> bool

Tests whether the argument is a “none” instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi.
Source§

impl OptionIntoWasmAbi for Tx2

Source§

fn none() -> Self::Abi

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more
Source§

impl RefFromWasmAbi for Tx2

Source§

type Abi = u32

The Wasm ABI type references to Self are recovered from.
Source§

type Anchor = RcRef<Tx2>

The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes don’t persist beyond one function call, and so that they remain anonymous.
Source§

unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor

Recover a Self::Anchor from Self::Abi. Read more
Source§

impl RefMutFromWasmAbi for Tx2

Source§

type Abi = u32

Same as RefFromWasmAbi::Abi
Source§

type Anchor = RcRefMut<Tx2>

Same as RefFromWasmAbi::Anchor
Source§

unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor

Same as RefFromWasmAbi::ref_from_abi
Source§

impl TryFromJsValue for Tx2

Source§

type Error = JsValue

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

fn try_from_js_value(value: JsValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl VectorFromWasmAbi for Tx2

Source§

type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi

Source§

unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Tx2]>

Source§

impl VectorIntoWasmAbi for Tx2

Source§

type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi

Source§

fn vector_into_abi(vector: Box<[Tx2]>) -> Self::Abi

Source§

impl WasmDescribe for Tx2

Source§

impl WasmDescribeVector for Tx2

Source§

impl SupportsConstructor for Tx2

Source§

impl SupportsInstanceProperty for Tx2

Source§

impl SupportsStaticProperty for Tx2

Auto Trait Implementations§

§

impl Freeze for Tx2

§

impl !RefUnwindSafe for Tx2

§

impl !Send for Tx2

§

impl !Sync for Tx2

§

impl Unpin for Tx2

§

impl !UnwindSafe for Tx2

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
§

impl<Src, Scheme> ApproxFrom<Src, Scheme> for Src
where Scheme: ApproxScheme,

§

type Err = NoError

The error type produced by a failed conversion.
§

fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>

Convert the given value into an approximately equivalent representation.
§

impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src
where Dst: ApproxFrom<Src, Scheme>, Scheme: ApproxScheme,

§

type Err = <Dst as ApproxFrom<Src, Scheme>>::Err

The error type produced by a failed conversion.
§

fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>

Convert the subject into an approximately equivalent representation.
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
§

impl<T, Dst> ConvAsUtil<Dst> for T

§

fn approx(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject with the default scheme.
§

fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject with a specific scheme.
§

impl<T> ConvUtil for T

§

fn approx_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject to a given type with the default scheme.
§

fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject to a given type with a specific scheme.
§

fn into_as<Dst>(self) -> Dst
where Self: Sized + Into<Dst>,

Convert the subject to a given type.
§

fn try_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + TryInto<Dst>,

Attempt to convert the subject to a given type.
§

fn value_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ValueInto<Dst>,

Attempt a value conversion of the subject to a given type.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ReturnWasmAbi for T
where T: IntoWasmAbi,

Source§

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi
Source§

fn return_abi(self) -> <T as ReturnWasmAbi>::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err.
§

impl<Src> TryFrom<Src> for Src

§

type Err = NoError

The error type produced by a failed conversion.
§

fn try_from(src: Src) -> Result<Src, <Src as TryFrom<Src>>::Err>

Convert the given value into the subject type.
Source§

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

Source§

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.
§

impl<Src, Dst> TryInto<Dst> for Src
where Dst: TryFrom<Src>,

§

type Err = <Dst as TryFrom<Src>>::Err

The error type produced by a failed conversion.
§

fn try_into(self) -> Result<Dst, <Src as TryInto<Dst>>::Err>

Convert the subject into the destination type.
Source§

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

Source§

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.
§

impl<Src> ValueFrom<Src> for Src

§

type Err = NoError

The error type produced by a failed conversion.
§

fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>

Convert the given value into an exactly equivalent representation.
§

impl<Src, Dst> ValueInto<Dst> for Src
where Dst: ValueFrom<Src>,

§

type Err = <Dst as ValueFrom<Src>>::Err

The error type produced by a failed conversion.
§

fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>

Convert the subject into an exactly equivalent representation.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,