diff --git a/uxntal.7 b/uxntal.7 index ef03077..25804c8 100644 --- a/uxntal.7 +++ b/uxntal.7 @@ -75,14 +75,18 @@ Regular instructions have a single stack effect which is modified in a predictab For example the generic effect for \fBADD\fP is ( x y -- x+y ). The eight combinations of modes have the following effects: - \fBADD\fP ( x^ y^ -- x+y^ ) sum two bytes using \fBwst\fP - \fBADDr\fP ( [x^ y^] -- [x+y^] ) sum two bytes using \fBrst\fP - \fBADD2\fP ( x* y* -- x+y* ) sum two shorts using \fBwst\fP - \fBADD2r\fP ( [x* y*] -- [x+y*] ) sum two shorts using \fBrst\fP - \fBADDk\fP ( x^ y^ -- x^ y^ x+y^ ) sum two bytes using \fBwst\fP, retain arguments - \fBADDkr\fP ( [x^ y^] -- [x^ y^ x+y^] ) sum two bytes using \fBrst\fP, retain arguments - \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 +.nf + + \fBADD\fP ( x^ y^ -- x+y^ ) sum bytes from \fBwst\fP + \fBADDr\fP ( [x^ y^] -- [x+y^] ) sum bytes from \fBrst\fP + \fBADD2\fP ( x* y* -- x+y* ) sum shorts from \fBwst\fP + \fBADD2r\fP ( [x* y*] -- [x+y*] ) sum shorts from \fBrst\fP + \fBADDk\fP ( x^ y^ -- x^ y^ x+y^ ) sum and keep bytes from \fBwst\fP + \fBADDkr\fP ( [x^ y^] -- [x^ y^ x+y^] ) sum and keep bytes from \fBrst\fP + \fBADD2k\fP ( x* y* -- x* y* x+y* ) sum and keep shorts from \fBwst\fP + \fBADD2kr\fP ( [x* y*] -- [x* y* x+y*] ) sum and keep shorts from \fBrst\fP + +.fi Thus for regular instructions writing a "generic" effect (leaving sigils off values whose size depends on \fIshort mode\fP) 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. @@ -98,77 +102,65 @@ We consider the top of the stack to be the first value of the stack, and count b .BR -.SS INC -( x -- x+1 ) +.SS INC ( x -- x+1 ) Increment the top value of the stack by 1. Overflow will be truncated, so \fB#ff INC\fP will evaluate to \fB0x00\fP. -.SS POP -( x -- ) +.SS POP ( x -- ) Remove the top value of the stack. \fBPOPk\fP is guaranteed to have no effect (it will not change the stack). -.SS NIP -( x y -- y ) +.SS NIP ( x y -- y ) Remove the second value of the stack. \fBNIPk\fP is guaranteed to have no effect (it will not change the stack). -.SS SWP -( x y -- y x ) +.SS SWP ( x y -- y x ) Swap the top two values of the stack. -.SS ROT -( x y z -- y z x ) +.SS ROT ( x y z -- y z x ) Rotate the top three values of the stack. The lowest becomes the top and the others are each shifted down one place. -.SS DUP -( x -- x x ) +.SS DUP ( x -- x x ) Place a copy of the top value of the stack on top of the stack. -.SS OVR -( x y -- x y x ) +.SS OVR ( x y -- x y x ) Place a copy of the second value of the stack on top of the stack. -.SS EQU -( x y -- x==y^ ) +.SS EQU ( x y -- x==y^ ) Test whether the top two values of the stack are equal. Result is guaranteed to be boolean (\fB0x00\fP or \fB0x01\fP). -.SS NEQ -( x y -- x!=y^ ) +.SS NEQ ( x y -- x!=y^ ) Test whether the top two values of the stack are not equal. Result is guaranteed to be boolean (\fB0x00\fP or \fB0x01\fP). -.SS GTH -( x y -- x>y^ ) +.SS GTH ( x y -- x>y^ ) Test whether the second value of the stack is greater than the top. Result is guaranteed to be boolean (\fB0x00\fP or \fB0x01\fP). -.SS LTH -( x y -- x>l)<>l)<