Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

VirtualMachine

Guides

  • Virtual Machine Package

Symbols

  • VirtualMachineAdd
  • VirtualMachineDefinition
  • VirtualMachineExecute
  • VirtualMachineList
  • VirtualMachine
  • VirtualMachineObject
  • VirtualMachineObjectQ
  • $VirtualMachines

Other

  • Intel4004
  • MOS6502
  • NFA
  • PDP1
  • PDP8
  • RegisterMachine
"PDP-1"
​
"PDP-1" an emulator of the DEC's PDP-1 computer.
​
▪
Creating a virtual machine instance:
VirtualMachine
["PDP-1"]
create a new instance of the PDP-1 virtual machine
▪
For the
"PDP-1"
virtual machine, the following properties can be queried:
obj["ConsoleState"]
an
Association
representing the state of the console
obj["MemoryState"]
an
SparseArray
representing the state of the memory
obj["MemoryView"]
a
MenuView
representing the memory pages
obj["ProcessorState"]
an
Association
representing the state of the processor
obj["ScreenState"]
an
Image
representing the state of the screen
obj["StepCount"]
the number of steps the machine has been run
▪
For the
"PDP-1"
virtual machine, the following commands can be executed using
VirtualMachineExecute
:
VirtualMachineExecute
[obj,"ConsoleReset"]
reset the state of the consol
VirtualMachineExecute
[obj,"Debugger"]
return an interactive debugger
VirtualMachineExecute
[obj,"MemoryLoad",bin]
load a list of integers
bin
into memory
VirtualMachineExecute
[obj,"MemoryRead",addr]
read the contents of the memory address
addr
VirtualMachineExecute
[obj,"MemoryWrite",addr,val]
write
val
into the contents of the memory address
addr
VirtualMachineExecute
[obj,"ProcessorReset",org]
reset the state of the processor, setting the program counter to
org
VirtualMachineExecute
[obj,"Reset",bin,org]
reset the machine, loads
bin
into memory, and sets the program counter to
org
VirtualMachineExecute
[obj,"Run",n]
run
n
steps of the machine
VirtualMachineExecute
[obj,"RunTrace",n]
run
n
steps of the machine and return a trace of the evaluation
VirtualMachineExecute
[obj,"ScreenReset"]
reset the state of the screen
VirtualMachineExecute
[obj,"ScreenVisualization"]
a dynamic
Image
of the screen
Examples
MoreExamples⊳
Create a new instance of the
"PDP-1"
virtual machine:
In[1]:=
pdp1=
VirtualMachine
["PDP-1"]
Out[1]=
VirtualMachineObject
Machine: PDP-1
StepCount: 0
InstructionRegister: [???]
(00)
ProgramCounter: 0000

Get information about the object:
In[2]:=
Information[pdp1]
Out[2]=
VirtualMachineObject
Machine Name
PDP-1
Properties
{ConsoleState,Machine,MemoryState,MemoryView,ProcessorState,ScreenState,StepCount}
Commands
{ControlReset,Debugger,MemoryLoad,MemoryRead,MemoryReset,MemoryWrite,ProcessorReset,Reset,Run,RunTrace,ScreenReset,ScreenVisualization}
Functions
{Information,Normal}
Obtain the state of the processor:
In[3]:=
pdp1["ProcessorState"]//Dataset
Out[3]=
InstructionRegister
0
ProgramCounter
0
Overflow
0
Accumulator
0
InputOutputRegister
0
ProgramFlags
0
MemoryAddressRegister
0
MemoryBufferRegister
0
Load the Spacewar! binary into memory:
In[4]:=
VirtualMachineExecute
pdp1,"MemoryLoad",
Spacewar!

Out[4]=
VirtualMachineObject
Machine: PDP-1
StepCount: 0
InstructionRegister: [???]
(00)
ProgramCounter: 0000

Verify the memory has been loaded with the binary:
In[5]:=
pdp1["MemoryView"]
Out[5]=
Reset the processor and set the program counter to 4 (the start of the program):
In[6]:=
VirtualMachineExecute
[pdp1,"ProcessorReset",4]
Out[6]=
VirtualMachineObject
Machine: PDP-1
StepCount: 0
InstructionRegister: [???]
(00)
ProgramCounter: 0004

Open a dynamic
Image
representing the screen:
In[7]:=
VirtualMachineExecute
[pdp1,"ScreenVisualization"]
Out[7]=
Run the object for 100 000 steps and watch the spaceships move:
In[8]:=
VirtualMachineExecute
[pdp1,"Run",100000]
Out[8]=
VirtualMachineObject
Machine: PDP-1
StepCount: 100000
InstructionRegister: XOR
(07)
ProgramCounter: 0172

Obtain the current state of the processor:
In[9]:=
pdp1["ProcessorState"]//Dataset
Out[9]=
InstructionRegister
7
ProgramCounter
122
Overflow
0
Accumulator
83
InputOutputRegister
196608
ProgramFlags
0
MemoryAddressRegister
121
MemoryBufferRegister
187327
Get a trace of the execution of 100 additional steps:

© 2025 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com