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
impl Tx2
Sourcepub fn new(
ctx: &Context,
panic_on_unmasked_alarm: PanicOnUnmaskedAlarm,
mem_config: &MemoryConfiguration,
) -> Tx2
pub fn new( ctx: &Context, panic_on_unmasked_alarm: PanicOnUnmaskedAlarm, mem_config: &MemoryConfiguration, ) -> Tx2
Create a new instance.
pub fn get_status_of_alarm(&self, name: &str) -> Option<AlarmStatus>
pub fn get_alarm_statuses(&self) -> Vec<AlarmStatus>
pub fn set_alarm_masked( &mut self, kind: AlarmKind, masked: bool, ) -> Result<(), Alarm>
pub fn set_run_mode(&mut self, run_mode: RunMode)
Sourcepub fn set_next_execution_due(
&mut self,
now: Duration,
newval: Option<Duration>,
)
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.
Sourcefn set_next_hw_poll_due(&mut self, now: Duration, newval: Duration)
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.
Sourcepub fn codabo(
&mut self,
ctx: &Context,
reset_mode: &ResetMode,
) -> Result<(), Alarm>
pub fn codabo( &mut self, ctx: &Context, reset_mode: &ResetMode, ) -> Result<(), Alarm>
Emulate the user pressing the CODABO key.
fn on_input_event( &mut self, ctx: &Context, unit: Unsigned6Bit, event: InputEvent, ) -> Result<InputFlagRaised, InputEventError>
Sourcepub fn mount_paper_tape(
&mut self,
ctx: &Context,
data: Vec<u8>,
) -> Result<InputFlagRaised, InputEventError>
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.
Sourcepub fn lw_input(
&mut self,
ctx: &Context,
unit: Unsigned6Bit,
codes: &[Unsigned6Bit],
) -> Result<(bool, InputFlagRaised), String>
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.
Sourcepub fn next_tick(&self) -> Duration
pub fn next_tick(&self) -> Duration
Return the time at which the emulator would like to next be called.
fn poll_hw(&mut self, ctx: &Context) -> Result<(), Alarm>
fn execute_one_instruction( &mut self, ctx: &Context, ) -> Result<(u64, Option<OutputEvent>), UnmaskedAlarm>
Sourcepub fn tick(
&mut self,
ctx: &Context,
) -> Result<Option<OutputEvent>, UnmaskedAlarm>
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.
pub fn unmasked_alarm_active(&self) -> bool
pub fn drain_alarm_changes(&mut self) -> BTreeMap<AlarmKind, AlarmStatus>
pub fn disconnect_all_devices(&mut self, ctx: &Context) -> Result<(), Alarm>
fn extended_state_of_software_sequence( &self, seq: Unsigned6Bit, index_value: Signed18Bit, ) -> ExtendedUnitState
fn software_sequence_statuses( &self, ) -> BTreeMap<Unsigned6Bit, ExtendedUnitState>
pub fn sequence_statuses( &mut self, ctx: &Context, ) -> Result<BTreeMap<Unsigned6Bit, ExtendedUnitState>, Alarm>
pub fn drain_device_changes( &mut self, ctx: &Context, ) -> Result<BTreeMap<Unsigned6Bit, ExtendedUnitState>, Alarm>
Trait Implementations§
Source§impl FromWasmAbi for Tx2
impl FromWasmAbi for Tx2
Source§impl IntoWasmAbi for Tx2
impl IntoWasmAbi for Tx2
Source§impl LongRefFromWasmAbi for Tx2
impl LongRefFromWasmAbi for Tx2
Source§impl OptionFromWasmAbi for Tx2
impl OptionFromWasmAbi for Tx2
Source§impl OptionIntoWasmAbi for Tx2
impl OptionIntoWasmAbi for Tx2
Source§impl RefFromWasmAbi for Tx2
impl RefFromWasmAbi for Tx2
Source§impl RefMutFromWasmAbi for Tx2
impl RefMutFromWasmAbi for Tx2
Source§impl TryFromJsValue for Tx2
impl TryFromJsValue for Tx2
Source§impl VectorFromWasmAbi for Tx2
impl VectorFromWasmAbi for Tx2
Source§impl VectorIntoWasmAbi for Tx2
impl VectorIntoWasmAbi for Tx2
Source§impl WasmDescribeVector for Tx2
impl WasmDescribeVector for Tx2
impl SupportsConstructor for Tx2
impl SupportsInstanceProperty for Tx2
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§
§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
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 Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
§impl<T> ConvUtil for T
impl<T> ConvUtil for T
§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
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,
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.
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::Abi
Source§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
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
impl<Src> TryFrom<Src> for Src
§impl<Src, Dst> TryInto<Dst> for Srcwhere
Dst: TryFrom<Src>,
impl<Src, Dst> TryInto<Dst> for Srcwhere
Dst: TryFrom<Src>,
§impl<Src> ValueFrom<Src> for Src
impl<Src> ValueFrom<Src> for Src
§fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
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 Srcwhere
Dst: ValueFrom<Src>,
impl<Src, Dst> ValueInto<Dst> for Srcwhere
Dst: ValueFrom<Src>,
§fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>
fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>
Convert the subject into an exactly equivalent representation.