From 1bac553f4b65e60633b42fdfb5d57a21de47f63b Mon Sep 17 00:00:00 2001 From: Tijmen van Nesselrooij Date: Sun, 17 Nov 2019 21:12:43 +0100 Subject: [PATCH] Update design.md with all operands --- design.md | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/design.md b/design.md index 354ab04..a1e0ed8 100644 --- a/design.md +++ b/design.md @@ -13,6 +13,7 @@ - `$[value]` for using literals/immediate values - `;` for end of statement (mandatory) - `[label]:` for labels +- `#[text]` for comments: any text is ignored till a newline (`\n`) is found - Elements must be separated by whitespace character - Good: `add $2 $5 %A;` - Bad: `add $2$5%A;` @@ -25,16 +26,26 @@ Divide register A by 5 and store the result in register A: ## Reserved symbols The following whitespace characters are used to separate symbols: -- space (' ') -- tab ('\t') -- return carriage ('\r') -- newline ('\n') +- space (` `) +- tab (`\t`) +- return carriage (`\r`) +- newline (`\n`) The following characters are used as identifiers: -- dollar ('$') -- percentage ('%') -- colon (':') -- semicolon (';') -- hash ('#') +- dollar (`$`) +- percentage (`%`) +- colon (`:`) +- semicolon (`;`) +- hash (`#`) All operands are reserved keywords and can therefore NOT be used as labels. + +## Operands + +- `addi` add the first to the second argument and store the result in the third argument +- `subi` subtract the first from the second argument and store the result in the third argument +- `divi` divide the first by the second argument and store the result in the third argument +- `muli` multiply the first by the second argument and store the result in the third argument +- `shli` shift left the first argument by the number of positions given by the second argument and store the result in the third argument +- `shri` shift right the first argument by the number of positions given by the second argument and store the result in the third argument +- `jmp` jump to the label given by the first argument