commit 71777deafdbf3ac8d464d5b8ebde7ed21127a4b3
parent cf693327237aca7e3e0639d6ae2f186ab30e6125
Author: neau <neau@web>
Date: Wed, 22 Jun 2022 16:03:44 +0200
empty web commit
Diffstat:
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/p-code.mdwn b/p-code.mdwn
@@ -0,0 +1,16 @@
+In computer programming, a p-code machine is a [[virtual machine]] designed to execute the assembly language of a hypothetical CPU.
+
+Niklaus Wirth specified a simple p-code machine in the 1976 book Algorithms + Data Structures = Programs. The machine had 3 registers - a program counter p, a base register b, and a top-of-stack register t. There were 8 instructions:
+
+ lit 0, a : load constant a
+ opr 0, a : execute operation a (13 operations: RETURN, 5 math functions, and 7 comparison functions)
+ lod l, a : load variable l,a
+ sto l, a : store variable l,a
+ cal l, a : call procedure a at level l
+ int 0, a : increment t-register by a
+ jmp 0, a : jump to a
+ jpc 0, a : jump conditional to a[6]
+
+See more:
+
+* [On Wikipedia](https://en.wikipedia.org/wiki/P-code_machine)