Quoted from interconnect:I don’t quite understand all of this, but would love to know more. What is the SWI and WVM? What is the purpose of the IVM you created? What do you mean by Virtual Machine? I am very familiar with VMs in terms of computing, but not in terms of pinball. What is the purpose of doing all of this; to make it extensible and easier for other game software to be modified as well?
SWI = software interrupt. This is a standard 6800 processor instruction.
WVM (presumably) = Williams virtual machine.
Be careful here. The term "virtual machine" is overloaded.
<disclaimer>The following is my understanding. I have no experience with the modern implementation of virtual machines. I also have no experience with the Williams System 3-11 software other than an occasional glance at the initialization code. The guts of the code is complicated.</disclaimer>
In the early days of computing (software), a virtual machine was typically an instruction set architecture (ISA) that did not physically exist. The "instructions" were executed by software. Think Java Virtual Machine. There is no actual processor (hardware) that executes the JVM opcodes. Another example of this meaning of virtual machine is the UCSD Pascal bytecode (aka pcode). Another more modern example is Microsoft's CLR managed runtime. Java and the CLR are good examples of "write once and debug everywhere". Typically these virtual machines are interpreted on an instruction by instruction basis but more modern virtual machines compile the intermediate (bytecode) to native instructions either on demand (JIT = just in time) or pre-compiled (at software installation).
The more modern usage of the term "virtual machine" is used to describe a hardware implementation that separates physical memory layout and provides boundaries to allow multiple separate instances of different operating systems to execute on a single hardware computing device. A crude example of this is if you have 32GB of physical memory, you can allocate 16GB to one "virtual machine" and 16GB to another "virtual machine". This allows you to run a Windows operating system concurrently with a Linux operating system. They are two separate entities and can share the hardware available on the machine. The arbiter of the hardware is typically a "hypervisor". Often these operating systems have virtual device drivers that communicate with the actual hardware device driver. The hypervisor programs the memory management of the processor so that it strictly adheres to the compartmentalization required for security reasons. In Intel parlance, user code executes at ring 3, supervisor code executes at ring 0 and hypervisor code executes at ring -1.
Back to your question. The WVM is a bytecode interpreter. These interpreters usually execute bytecode until an "escape" code is encountered. These opcodes cause the bytecode to return back to the native code. Presumably this IVM executes a single bytecode and then returns to native code rather than require an escape code. Normally, these interpreters are entered with a "call" or "jsr" instruction. These are often two or three byte opcodes. It is possible to reduce this by using the SWI vector. The SWI instruction is a single byte. This can save one or two bytes when entering the bytecode interpreter. Apple used this mechanism in their old MacOS operating systems with the A-traps. Microsoft used a similar scheme with "INT 2E". These instructions generate an interrupt (SWI = software interrupt) and the processor will divert execution to a defined vector. The code at this vector executes the required task. Typically, it generates a trap frame (context), executes what it needs to and then restores the context from the trap frame. In simpler processors, this is typically the RTI (return from interrupt) instruction.