Wolfram/VirtualMachine

Run virtual machines in the Wolfram Language

Contributed By: Wolfram Research

The VirtualMachine package allows you to run virtual machines in the Wolfram Language. These include computer architectures of the past, such as the PDP-1 and the Intel 4004, as well as abstract machines such as register machines and deterministic finite automatons.

Installation Instructions

To install this paclet in your Wolfram Language environment, evaluate this code:
PacletInstall[ResourceObject["Wolfram/VirtualMachine"]]

Paclet Guide

Examples

Basic Examples (6) 

Create an instance of the "PDP-8" virtual machine:

In[1]:=
pdp8 = InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["VirtualMachine", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"Wolfram/VirtualMachine\"", ",", "\"VirtualMachine\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["Wolfram/VirtualMachine", "VirtualMachine"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["Wolfram/VirtualMachine", "VirtualMachine"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]]["PDP-8"]
Out[1]=

Get information about the object:

In[2]:=
Information[pdp8]
Out[2]=

Load a program that fills the machine's memory with the value 8^^3333:

In[3]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["VirtualMachineExecute", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"Wolfram/VirtualMachine\"", ",", "\"VirtualMachineExecute\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][pdp8, "MemoryLoad", {519, 1798, 1030, 2560, 3842, 0, 8, 8^^3333}]
Out[3]=

Run the machine until it executes the halt instruction:

In[4]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["VirtualMachineExecute", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"Wolfram/VirtualMachine\"", ",", "\"VirtualMachineExecute\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][pdp8, "Run", Infinity]
Out[4]=

Obtain the state of the processor after the machine has halted:

In[5]:=
pdp8["ProcessorState"] // Dataset
Out[5]=

Verify the program has filled the entire memory:

In[6]:=
pdp8["MemoryView"]
Out[6]=

Scope (4) 

Use the Association in the second argument to create an instance of a "RegisterMachine" defined by a simple program:

In[7]:=
rm = InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["VirtualMachine", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"Wolfram/VirtualMachine\"", ",", "\"VirtualMachine\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["Wolfram/VirtualMachine", "VirtualMachine"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["Wolfram/VirtualMachine", "VirtualMachine"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][
  "RegisterMachine", <|
   "Program" -> {"INC"[1], "INC"[2], "DECJ"[2, 1]}|>]
Out[7]=

Run the register machine for 10 steps:

In[8]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["VirtualMachineExecute", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"Wolfram/VirtualMachine\"", ",", "\"VirtualMachineExecute\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][rm, "Run", 10]
Out[8]=

Get the state of the machine:

In[9]:=
rm["MachineState"] // Dataset
Out[9]=

Get a Dataset representing the evolution of the register machine:

In[10]:=
rm["EvolutionDataset"]
Out[10]=

Interactive Examples (2) 

Create a new instance of the "PDP-8" virtual machine:

In[11]:=
pdp8 = InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["VirtualMachine", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"Wolfram/VirtualMachine\"", ",", "\"VirtualMachine\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["Wolfram/VirtualMachine", "VirtualMachine"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["Wolfram/VirtualMachine", "VirtualMachine"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]]["PDP-8"]
Out[11]=

Use the PDP-8's front panel to interact with the computer:

In[12]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["VirtualMachineExecute", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"Wolfram/VirtualMachine\"", ",", "\"VirtualMachineExecute\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][pdp8, "FrontPanel"]
Out[12]=

Create a customized instance of the "Intel4004" virtual machine by setting the number of ROM and RAM chips to use:

In[13]:=
intel4004 = InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["VirtualMachine", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"Wolfram/VirtualMachine\"", ",", "\"VirtualMachine\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["Wolfram/VirtualMachine", "VirtualMachine"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["Wolfram/VirtualMachine", "VirtualMachine"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][
  "Intel4004", <|"ROMChipCount" -> 2, "RAMChipCount" -> 16|>]
Out[13]=

Use the following resource function to assemble a subroutine that computes the 4-bit AND of two numbers:

In[14]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/977f74e8-e770-4718-8e81-a81f935a659a"]
Out[14]=

Use the debugger to load the subroutine into ROM memory and debug it:

In[15]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["VirtualMachineExecute", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"Wolfram/VirtualMachine\"", ",", "\"VirtualMachineExecute\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][intel4004, "Debugger"]
Out[15]=

Neat Examples (8) 

Create an instance of the "PDP-1" virtual machine:

In[16]:=
pdp1 = InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["VirtualMachine", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"Wolfram/VirtualMachine\"", ",", "\"VirtualMachine\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["Wolfram/VirtualMachine", "VirtualMachine"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["Wolfram/VirtualMachine", "VirtualMachine"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]]["PDP-1"]
Out[16]=

Load the Spacewar! binary (represented as a list of integers) into memory:

In[17]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["VirtualMachineExecute", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"Wolfram/VirtualMachine\"", ",", "\"VirtualMachineExecute\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][pdp1, "MemoryLoad", CompressedData["
1:eJztm2l0lUW2ht+qysAUCCSEMJpAwAnFkVahNUxBGWSGMCkQwkwYr4iC5Coi
LaAtOLSiS0SJimKDrTiiIhq6VRoVFZEoKLZBu69Aq6Bom/u+X1XIMQv80/3n
3nW+tSpPzbWrateu/Z1zkj1mWv8iAz6p+MVzNhxmOIcihuzfO9S7xiGVHMVQ
scehBusoL2pbhyEJqKhg2bUsY50shlyGYtWfxvZFDsjFrz7Pc6x/90lY5WCz
JJVBW8ZNqu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ngTjPIVG8
kkcmxbdbJ9J/myieSdFF3penibTHmeJ/OySLu2gvxOvoZ8kP+MBhsbjAYJHY
2eA6kf7QNHGpweQ6fp49xRd5bsU1DnXq+HOxW/5CN4uRIv28weJGi0HiEU5R
7M551Pb7GPkZf+SWiA8Z/Cg/YiqXRPzc4Gvxdxa7RNrp98XNFhtE67BGbGex
WjzN4iaxh8WNtfx8e4i8K7uLzxl0ETtS/8Ru1CNxlMXpUdqhiXiz9f7MOTyK
YlOLOmItnl/5M7RHy0X6CfNF+i/9xNYG6TX9uYaYbVEhP4f3c1kNv5+7xVHA
feKl9IvF3TyHYhr1WXzMeRbQhIvzjWcXVhHpQ/yc7Nf7nyLv4S+SvR6+J55E
/0nsxa0RvzG4WzyXcif7dbpNpL92jfgk/RyR/n5D8R3eh+JtPFfJXv/K5HfR
rm8VBxq8LM51eFJMoV8i7tNvdslC63mrxdlJ/vwmJoVzIT9tE+24WEb/VLzD
YLdIf3ejuIp6LNI/vU/kGV0uvkAVFJdyCcQBBqmJfv3qBlbI7+M9+K5IO/6U
eJQumJjHdRA/4T0l0tm7JapnMFfsYzBOHG9QKLbg/SDSn7lUPI3nRjzH4mf5
kUVWPyHn+lr91I39An8Rd0cmWf+Eiwci/9PiPuf1b76YaOXC0ChadHd+3TuI
tDdnOH8+WojFRi5GdK9G/uoE7qdIeznR+na9xfccelmvnxeItNGnWq9nTaKf
Kzn/m6ZDTlsb9b/JBH0WX6J8Yh79YXETMELsGblKtOc09WJ9i2xxokNjMceh
vsh7IEWkk31Qw3HwPSL99V1iamQKgRuBt0TebxsjWr0iRvfDjeJIixvEZtG/
0kZ+fLbI9yGZdznz0c+w+L6l3yfGn//8878oKWk3
"]]
Out[17]=

Verify the memory has been loaded with the binary:

In[18]:=
pdp1["MemoryView"]
Out[18]=

Reset the processor and set the program counter to 4 (the start of the program):

In[19]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["VirtualMachineExecute", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"Wolfram/VirtualMachine\"", ",", "\"VirtualMachineExecute\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][pdp1, "ProcessorReset", 4]
Out[19]=

Open a dynamic Image representing the screen:

In[20]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["VirtualMachineExecute", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"Wolfram/VirtualMachine\"", ",", "\"VirtualMachineExecute\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][pdp1, "ScreenVisualization"]
Out[20]=

Run the object for 100 000 steps and see the spaceships move:

In[21]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["VirtualMachineExecute", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"Wolfram/VirtualMachine\"", ",", "\"VirtualMachineExecute\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][pdp1, "Run", 100000]
Out[21]=

Get the current state of the processor:

In[22]:=
pdp1["ProcessorState"] // Dataset
Out[22]=

Get a trace of the execution of 100 additional steps:

In[23]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["VirtualMachineExecute", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"Wolfram/VirtualMachine\"", ",", "\"VirtualMachineExecute\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["Wolfram/VirtualMachine", "VirtualMachineExecute"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][pdp1, "RunTrace", 100]
Out[23]=

Resource History

Paclet Source