You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-1Lines changed: 15 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,21 @@ This project is available via `PyPI`: `python -m pip install paperpc`.
25
25
|`8xx`|`BRP`|`BRANCH IF POSITIVE`| Verifies `Accumulator` value is greater than `0`; if so, set `Program Counter` to value `xx`, prepare to execute value in `xx`|`No`|
26
26
|`901`|`INP`|`INPUT`|Read a single value fromw waiting input, replace `Accumulator` value|`Yes`|
27
27
|`902`|`OUT`|`OUTPUT`|Output the current value of the `Accumulator`|`No`|
28
-
|`000`|`HLT`|`HALT`|Terminates program |
28
+
|`903`|`PSH`|`PUSH`|Push a value to the machine's dedicated stack (080) |`No`|
29
+
|`904`|`POP`|`POP`|Pop a value from the machine's dedicated stack |`Yes`|
30
+
|`905`|`PTR`|`STACK POINTER`|Retrieves and loads the current stack pointer to the `Accumulator`|`Yes`|
31
+
|`906`|`SHI`|`STACK HEIGHT`|Calculates and places the current stack height in the `Accumulator`|`Yes`|
32
+
|`000`|`HLT`|`HALT`|Terminates program |`No`|
33
+
34
+
### The stack
35
+
36
+
The PaperPC stack starts at storage `080`. It occupies 18 spaces (limit `098`). This memory range may be used by
37
+
general heap operations (i.e. values can be assigned to this range). However, any stack operation will overwrite
38
+
values in the range starting at the stack pointer base, `080`. The stack overflows if the value of the stack pointer
39
+
increments above `098`.
40
+
41
+
In future releases, this will be configurable (e.g. a configuration file can remap, increase, or decrease the stack
42
+
size). This is planned, but not yet implemented as a `.pcconfig` file, existing on a per-project basis.
0 commit comments