diff --git a/README.md b/README.md index 5ee0828..6b080c7 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,11 @@ Each documented instruction has a list of what is pushed, and what is popped. the items are listed in chronological order, from first pushed/popped to last pushed/popped. +You'll notice that words specifying an address are always at the top of the +stack. This helps increse security and reduce the likelihood of bugs. When +writing functions to extend creature, it is highly advised that you follow this +principle when deciding on an order to pop arguments off of the stack in. + ### 0x0 PUSH Pushes the next word in program memory onto the stack. @@ -53,8 +58,8 @@ Pops: Adds two words. Tip: this can be used as a logical OR. Pops: -1. left operand -2. right operand +1. right operand +2. left operand Pushes: 1. left operand + right operand @@ -64,8 +69,8 @@ Pushes: Subtracts two words. Pops: -1. left operand -2. right operand +1. right operand +2. left operand Pushes: 1. left operand - right operand @@ -75,8 +80,8 @@ Pushes: Multiplies two words. Pops: -1. left operand -2. right operand +1. right operand +2. left operand Pushes: 1. left operand * right operand @@ -86,8 +91,8 @@ Pushes: Divides two words. Pops: -1. left operand -2. right operand +1. right operand +2. left operand Pushes: 1. left operand / right operand @@ -97,8 +102,8 @@ Pushes: Checks if two words are equal. Pushes 1 if true, zero if false. Pops: -1. left operand -2. right operand +1. right operand +2. left operand Pushes: 1. left operand == right operand @@ -108,8 +113,8 @@ Pushes: Checks if a word is greater than another word. Pushes 1 if true, zero if false. Pops: -1. left operand -2. right operand +1. right operand +2. left operand Pushes: 1. left operand > right operand @@ -119,8 +124,8 @@ Pushes: Checks if a word is less than another word. Pushes 1 if true, zero if false. Pops: -1. left operand -2. right operand +1. right operand +2. left operand Pushes: 1. left operand < right operand @@ -130,8 +135,8 @@ Pushes: Checks if two words are *not* equal. Pushes 1 if true, zero if false. Pops: -1. left operand -2. right operand +1. right operand +2. left operand Pushes: 1. left operand != right operand @@ -142,8 +147,8 @@ Performs a modulo operation on two words. Tip: this can be used as a logical AND. Pops: -1. left operand -2. right operand +1. right operand +2. left operand Pushes: 1. left operand % right operand