From 2d0db6fe6f52b2901a10dc712616ed0beb075c64 Mon Sep 17 00:00:00 2001 From: d_m Date: Fri, 2 Aug 2024 13:41:33 -0400 Subject: [PATCH] more clarifications and notes --- uxntal.1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/uxntal.1 b/uxntal.1 index fcf7a1d..9bc5dd6 100644 --- a/uxntal.1 +++ b/uxntal.1 @@ -64,7 +64,11 @@ For example the generic effect for \fBADD\fP is ( x y -- x+y ). The eight combin \fBADD2k\fP ( x* y* -- x* y* x+y* ) sum two shorts using \fBwst\fP, retain arguments \fBADD2kr\fP ( [x* y*] -- [x* y* x+y*] ) sum two shorts using \fBrst\fP, retain arguments -Thus for regular instructions writing a "generic" effect (leaving sigils off values whose size depends on \fIshort\fP mode) is sufficient to describe its behavior across all eight variations. Note that some instructions always read values of a fixed size. (For example the boolean condition read by \fBJCN\fP is always one byte, no matter what modes are used.) +Thus for regular instructions writing a "generic" effect (leaving sigils off values whose size depends on \fIshort\fP mode) is sufficient to describe its behavior across all eight variations. Note that some instructions always read values of a fixed size. For example the boolean condition read by \fBJCN\fP is always one byte, no matter what modes are used. + +In \fIreturn\fP mode the stacks are reversed. Effects on \fBwst\fP will instead affect \fBrst\fP, and effects on \fBrst\fP will instead affect \fBwst\fP. For example, \fBSTH\fP reads a byte from \fBwst\fP and writes it to \fBrst\fP, but \fBSTHr\fP reads a byte from \fBrst\fP and writes it to \fBwst\fP. + +In \fIkeep\fP mode all the values on the left-hand side of the stack effect will also appear on the right-hand side before the outputs. For example, \fBSWP\fP is \fB(x y -- y x)\fP but \fBSWPk\fP is \fB(x y -- x y y x)\fP. .SS INC ( x -- x+1 ) @@ -72,6 +76,8 @@ Thus for regular instructions writing a "generic" effect (leaving sigils off val .SS POP ( x -- ) +\fBPOPk\fP is guaranteed to have no effect (it will not change the stack). + .SS NIP ( x y -- y )